Path: blob/aarch64-shenandoah-jdk8u272-b10/nashorn/test/script/nosecurity/debuggersupportapi.js
32280 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* JDK-8044798: API for debugging Nashorn25*26* @test27* @run28*/2930// Basic API class, method, field existence checks.3132// The following classes and the associated methods and fields are used as33// private debugger interface. Though private/implementation defined, nashorn34// code should not be changed to remove these classes, fields and methods.35// The test takes signatures of debugger interface and stores in .EXPECTED file.36// If any incompatible change is made to nashorn to break any of these, this37// test will fail.3839var Arrays = Java.type("java.util.Arrays");40var DebuggerSupport = Java.type("jdk.nashorn.internal.runtime.DebuggerSupport");4142print(DebuggerSupport.class);43print();44var methods = DebuggerSupport.class.declaredMethods;45Arrays.sort(methods, function(m1, m2) m1.name.compareTo(m2.name));46for each (var mth in methods) {47switch (mth.name) {48case "eval":49case "notifyInvoke":50case "getSourceInfo":51case "valueAsString":52case "valueInfos":53print(mth);54break;55case "valueInfo":56if (mth.parameterCount == 3) {57print(mth);58}59break;60}61}62print();6364var DebuggerValueDesc = Java.type("jdk.nashorn.internal.runtime.DebuggerSupport.DebuggerValueDesc");65print(DebuggerValueDesc.class);66print();67var fields = DebuggerValueDesc.class.declaredFields;68Arrays.sort(fields, function(f1, f2) f1.name.compareTo(f2.name));69for each (var fld in fields) {70switch (fld.name) {71case "key":72case "expandable":73case "valueAsObject":74case "valueAsString":75print(fld);76}77}78print();7980var SourceInfo = Java.type("jdk.nashorn.internal.runtime.DebuggerSupport.SourceInfo");81print(SourceInfo.class);82print();83var fields = SourceInfo.class.declaredFields;84Arrays.sort(fields, function(f1, f2) f1.name.compareTo(f2.name));85for each (var fld in fields) {86switch (fld.name) {87case "name":88case "hash":89case "url":90case "content":91print(fld);92}93}949596