Merge
diff --git a/.hgtags b/.hgtags
index a38996c..02c963d 100644
--- a/.hgtags
+++ b/.hgtags
@@ -296,3 +296,4 @@
6efe265424e3f1ea596408a1f71baf2de316c772 jdk9-b51
d6224d6021459ac8b3832e822f5acc849fa944af jdk9-b52
874d76e4699dfcd61ae1826c9fe0ddc1610ad598 jdk9-b53
+82cd31c5d6ca8d4c1653f4eb1c09eb2d9a3b2813 jdk9-b54
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 3f0dfcd..26a93cd 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -296,3 +296,4 @@
6207b4b8731ca75c51b031c47daa813ab92ef558 jdk9-b51
1822e59f17121b09e7899cf338cfb6e37fe5fceb jdk9-b52
d6ed47125a76cd1cf8a100568507bfb5e9669d9f jdk9-b53
+cb7367141e910e265b8344a8facee740bd1e5467 jdk9-b54
diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac
index 6cdab79..14497a0 100644
--- a/common/autoconf/configure.ac
+++ b/common/autoconf/configure.ac
@@ -54,6 +54,7 @@
AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK])
AC_DEFUN_ONCE([CUSTOM_LATE_HOOK])
+AC_DEFUN_ONCE([CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK])
AC_DEFUN_ONCE([CUSTOM_SUMMARY_AND_WARNINGS_HOOK])
# This line needs to be here, verbatim, after all includes and the dummy hook
@@ -265,6 +266,7 @@
# Create the actual output files. Now the main work of configure is done.
AC_OUTPUT
+CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK
# Try to move the config.log file to the output directory.
if test -e ./config.log; then
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index 045a792..84df883 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -481,9 +481,8 @@
CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
- CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
- CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
+ CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
+ CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
fi
if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
@@ -762,6 +761,8 @@
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
+ elif test "x$TOOLCHAIN_TYPE" = xxlc; then
+ LDFLAGS_JDK="${LDFLAGS_JDK} -brtl -bnolibpath -liconv -bexpall -bernotok"
fi
# Customize LDFLAGS for executables
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index e041c3e..d7648b2 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -4362,13 +4362,14 @@
+
# This line needs to be here, verbatim, after all includes and the dummy hook
# definitions. It is replaced with custom functionality when building
# custom sources.
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1425994551
+DATE_WHEN_GENERATED=1426774983
###############################################################################
#
@@ -41173,7 +41174,7 @@
# jtreg win32 script works for everybody
- JTREGEXE="$JT_HOME/win32/bin/jtreg"
+ JTREGEXE="$JT_HOME/bin/jtreg"
if test ! -f "$JTREGEXE"; then
as_fn_error $? "JTReg executable does not exist: $JTREGEXE" "$LINENO" 5
@@ -42372,9 +42373,8 @@
CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
- CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
- CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
+ CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
+ CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
fi
if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
@@ -42668,6 +42668,8 @@
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
+ elif test "x$TOOLCHAIN_TYPE" = xxlc; then
+ LDFLAGS_JDK="${LDFLAGS_JDK} -brtl -bnolibpath -liconv -bexpall -bernotok"
fi
# Customize LDFLAGS for executables
@@ -52969,6 +52971,7 @@
fi
+
# Try to move the config.log file to the output directory.
if test -e ./config.log; then
$MV -f ./config.log "$OUTPUT_ROOT/config.log" 2> /dev/null
diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
index 1de284e..7737ef8 100644
--- a/common/autoconf/toolchain.m4
+++ b/common/autoconf/toolchain.m4
@@ -763,7 +763,7 @@
BASIC_FIXUP_PATH([JT_HOME])
# jtreg win32 script works for everybody
- JTREGEXE="$JT_HOME/win32/bin/jtreg"
+ JTREGEXE="$JT_HOME/bin/jtreg"
if test ! -f "$JTREGEXE"; then
AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
diff --git a/corba/.hgtags b/corba/.hgtags
index 44432f0..c5b6821 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -296,3 +296,4 @@
2309c02386d1fa4ced5051873ffb9e04874f7a44 jdk9-b51
b8538bbb6f224ab1dabba579137099c166ad4724 jdk9-b52
aadc16ca5ab7d56f92ef9dbfa443595a939241b4 jdk9-b53
+d469c5ad0c763e325a78e0af3016878a57dfc5cc jdk9-b54
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 756de55..69d0b8f 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -456,3 +456,4 @@
403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51
9fb7fdc554db5be5c5b10f88f529ec3b870c44e3 jdk9-b52
effd5ef0c3eb4bb85aa975c489d6761dbf13ad6a jdk9-b53
+c3b117fa5bdedfafd9ed236403e6d406911195b1 jdk9-b54
diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
index b0d4280..8997305 100644
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2014 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -2204,7 +2204,8 @@
// Write the card table byte if needed.
void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) {
- CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set();
+ CardTableModRefBS* bs =
+ barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
assert(bs->kind() == BarrierSet::CardTableModRef ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
#ifdef ASSERT
@@ -2310,9 +2311,8 @@
Label& filtered = (filtered_ext != NULL) ? *filtered_ext : filtered_int;
assert_different_registers(Rstore_addr, Rnew_val, Rtmp1, Rtmp2);
- G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::G1SATBCT ||
- bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier");
+ G1SATBCardTableLoggingModRefBS* bs =
+ barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());
// Does store cross heap regions?
if (G1RSBarrierRegionFilter) {
diff --git a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
index 43258ce..6c08519 100644
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
@@ -694,7 +694,7 @@
__ release();
}
- CardTableModRefBS* const ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* const ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
assert_different_registers(addr, count, tmp);
diff --git a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp
index 9f9fc75..c27f81a 100644
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -916,7 +916,7 @@
Register cardtable = G5;
Register tmp = G1_scratch;
Register tmp2 = G3_scratch;
- jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base;
+ jbyte* byte_map_base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base;
Label not_already_dirty, restart, refill, young_card;
diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
index 226b80d..3a932cc 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -3858,9 +3858,8 @@
if (new_val == G0) return;
- G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::G1SATBCT ||
- bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier");
+ G1SATBCardTableLoggingModRefBS* bs =
+ barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());
if (G1RSBarrierRegionFilter) {
xor3(store_addr, new_val, tmp);
@@ -3904,7 +3903,8 @@
void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_val, Register tmp) {
// If we're writing constant NULL, we can skip the write barrier.
if (new_val == G0) return;
- CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set();
+ CardTableModRefBS* bs =
+ barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
assert(bs->kind() == BarrierSet::CardTableModRef ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
card_table_write(bs->byte_map_base, tmp, store_addr);
diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
index 780120b..196bc8d 100644
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1019,7 +1019,7 @@
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
{
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
assert_different_registers(addr, count, tmp);
diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
index 63da256..fa7e8c3 100644
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1718,8 +1718,8 @@
// arg0: store_address
Address store_addr(rbp, 2*BytesPerWord);
- BarrierSet* bs = Universe::heap()->barrier_set();
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct =
+ barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label done;
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index 85c738a..32af915 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -4204,8 +4204,8 @@
Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
PtrQueue::byte_offset_of_buf()));
- BarrierSet* bs = Universe::heap()->barrier_set();
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct =
+ barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label done;
@@ -4305,7 +4305,7 @@
void MacroAssembler::store_check_part_2(Register obj) {
BarrierSet* bs = Universe::heap()->barrier_set();
assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
// The calculation for byte_map_base is as follows:
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
index 1622fe5..086ac2f 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -752,7 +752,7 @@
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
{
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label L_loop;
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index c3c2500..7f6dbc8 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1272,7 +1272,7 @@
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
{
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label L_loop;
diff --git a/hotspot/src/os/windows/vm/attachListener_windows.cpp b/hotspot/src/os/windows/vm/attachListener_windows.cpp
index 3b3d0ca..916118e 100644
--- a/hotspot/src/os/windows/vm/attachListener_windows.cpp
+++ b/hotspot/src/os/windows/vm/attachListener_windows.cpp
@@ -62,7 +62,7 @@
class Win32AttachListener: AllStatic {
private:
enum {
- preallocate_count = 4 // number of preallocated operations
+ max_enqueued_operations = 4
};
// protects the preallocated list and the operation list
@@ -83,9 +83,12 @@
static void set_tail(Win32AttachOperation* tail) { _tail = tail; }
- // used to wakeup the listener
- static HANDLE _wakeup;
- static HANDLE wakeup() { return _wakeup; }
+ // A semaphore is used for communication about enqueued operations.
+ // The maximum count for the semaphore object will be set to "max_enqueued_operations".
+ // The state of a semaphore is signaled when its count is greater than
+ // zero (there are operations enqueued), and nonsignaled when it is zero.
+ static HANDLE _enqueued_ops_semaphore;
+ static HANDLE enqueued_ops_semaphore() { return _enqueued_ops_semaphore; }
public:
enum {
@@ -110,7 +113,7 @@
// statics
HANDLE Win32AttachListener::_mutex;
-HANDLE Win32AttachListener::_wakeup;
+HANDLE Win32AttachListener::_enqueued_ops_semaphore;
Win32AttachOperation* Win32AttachListener::_avail;
Win32AttachOperation* Win32AttachListener::_head;
Win32AttachOperation* Win32AttachListener::_tail;
@@ -155,20 +158,19 @@
};
-// preallocate the required number of operations
+// Preallocate the maximum number of operations that can be enqueued.
int Win32AttachListener::init() {
_mutex = (void*)::CreateMutex(NULL, FALSE, NULL);
guarantee(_mutex != (HANDLE)NULL, "mutex creation failed");
- _wakeup = ::CreateSemaphore(NULL, 0, 1, NULL);
- guarantee(_wakeup != (HANDLE)NULL, "semaphore creation failed");
+ _enqueued_ops_semaphore = ::CreateSemaphore(NULL, 0, max_enqueued_operations, NULL);
+ guarantee(_enqueued_ops_semaphore != (HANDLE)NULL, "semaphore creation failed");
set_head(NULL);
set_tail(NULL);
-
- // preallocate a few operations
set_available(NULL);
- for (int i=0; i<preallocate_count; i++) {
+
+ for (int i=0; i<max_enqueued_operations; i++) {
Win32AttachOperation* op = new Win32AttachOperation();
op->set_next(available());
set_available(op);
@@ -221,8 +223,12 @@
op->set_arg(2, arg2);
op->set_pipe(pipename);
- // wakeup the thread waiting for operations
- ::ReleaseSemaphore(wakeup(), 1, NULL);
+ // Increment number of enqueued operations.
+ // Side effect: Semaphore will be signaled and will release
+ // any blocking waiters (i.e. the AttachListener thread).
+ BOOL not_exceeding_semaphore_maximum_count =
+ ::ReleaseSemaphore(enqueued_ops_semaphore(), 1, NULL);
+ guarantee(not_exceeding_semaphore_maximum_count, "invariant");
}
::ReleaseMutex(mutex());
@@ -230,10 +236,12 @@
}
-// dequeue the operation from the head of the operation list. If
+// dequeue the operation from the head of the operation list.
Win32AttachOperation* Win32AttachListener::dequeue() {
for (;;) {
- DWORD res = ::WaitForSingleObject(wakeup(), INFINITE);
+ DWORD res = ::WaitForSingleObject(enqueued_ops_semaphore(), INFINITE);
+ // returning from WaitForSingleObject will have decreased
+ // the current count of the semaphore by 1.
guarantee(res == WAIT_OBJECT_0, "wait failed");
res = ::WaitForSingleObject(mutex(), INFINITE);
diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp
index 4e0563a..92640cc 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2105,8 +2105,14 @@
// LIR_OpProfileType
void LIR_OpProfileType::print_instr(outputStream* out) const {
- out->print("exact = "); exact_klass()->print_name_on(out);
- out->print("current = "); ciTypeEntries::print_ciklass(out, current_klass());
+ out->print("exact = ");
+ if (exact_klass() == NULL) {
+ out->print("unknown");
+ } else {
+ exact_klass()->print_name_on(out);
+ }
+ out->print(" current = "); ciTypeEntries::print_ciklass(out, current_klass());
+ out->print(" ");
mdp()->print(out); out->print(" ");
obj()->print(out); out->print(" ");
tmp()->print(out); out->print(" ");
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
index 0a1e741..a606b7b 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
@@ -1582,9 +1582,9 @@
////////////////////////////////////////////////////////////////////////
void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
-
- assert(sizeof(*((CardTableModRefBS*)_bs)->byte_map_base) == sizeof(jbyte), "adjust this code");
- LIR_Const* card_table_base = new LIR_Const(((CardTableModRefBS*)_bs)->byte_map_base);
+ CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(_bs);
+ assert(sizeof(*(ct->byte_map_base)) == sizeof(jbyte), "adjust this code");
+ LIR_Const* card_table_base = new LIR_Const(ct->byte_map_base);
if (addr->is_address()) {
LIR_Address* address = addr->as_address_ptr();
// ptr cannot be an object because we use this barrier for array card marks
@@ -1609,7 +1609,6 @@
__ move(new LIR_Address(FrameMap::Rthread_opr, in_bytes(JavaThread::card_table_base_offset()), T_ADDRESS), tmp);
}
- CardTableModRefBS* ct = (CardTableModRefBS*)_bs;
LIR_Address *card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTableModRefBS::card_shift, 0, T_BYTE);
if(((int)ct->byte_map_base & 0xff) == 0) {
__ move(tmp, card_addr);
diff --git a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp
index 634878e..a647d85 100644
--- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp
@@ -43,7 +43,7 @@
#define TRACE_BCEA(level, code)
#endif
-// Maintain a map of which aguments a local variable or
+// Maintain a map of which arguments a local variable or
// stack slot may contain. In addition to tracking
// arguments, it tracks two special values, "allocated"
// which represents any object allocated in the current
@@ -319,14 +319,16 @@
bool must_record_dependencies = false;
for (i = arg_size - 1; i >= 0; i--) {
ArgumentMap arg = state.raw_pop();
- if (!is_argument(arg))
+ // Check if callee arg is a caller arg or an allocated object
+ bool allocated = arg.contains_allocated();
+ if (!(is_argument(arg) || allocated))
continue;
for (int j = 0; j < _arg_size; j++) {
if (arg.contains(j)) {
_arg_modified[j] |= analyzer._arg_modified[i];
}
}
- if (!is_arg_stack(arg)) {
+ if (!(is_arg_stack(arg) || allocated)) {
// arguments have already been recognized as escaping
} else if (analyzer.is_arg_stack(i) && !analyzer.is_arg_returned(i)) {
set_method_escape(arg);
@@ -1392,12 +1394,12 @@
method()->print_short_name();
tty->print_cr(has_dependencies() ? " (not stored)" : "");
tty->print(" non-escaping args: ");
- _arg_local.print_on(tty);
+ _arg_local.print();
tty->print(" stack-allocatable args: ");
- _arg_stack.print_on(tty);
+ _arg_stack.print();
if (_return_local) {
tty->print(" returned args: ");
- _arg_returned.print_on(tty);
+ _arg_returned.print();
} else if (is_return_allocated()) {
tty->print_cr(" return allocated value");
} else {
diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp
index 65a38fe..5cc8a68 100644
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1091,6 +1091,7 @@
}
// update idnum for new location
merged_methods->at(i)->set_method_idnum(i);
+ merged_methods->at(i)->set_orig_method_idnum(i);
}
// Verify correct order
diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp
index 4228fc2..25323c5 100644
--- a/hotspot/src/share/vm/code/codeCache.cpp
+++ b/hotspot/src/share/vm/code/codeCache.cpp
@@ -360,7 +360,7 @@
* run the constructor for the CodeBlob subclass he is busy
* instantiating.
*/
-CodeBlob* CodeCache::allocate(int size, int code_blob_type) {
+CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool strict) {
// Possibly wakes up the sweeper thread.
NMethodSweeper::notify(code_blob_type);
assert_locked_or_safepoint(CodeCache_lock);
@@ -379,11 +379,28 @@
if (cb != NULL) break;
if (!heap->expand_by(CodeCacheExpansionSize)) {
// Expansion failed
- if (SegmentedCodeCache && (code_blob_type == CodeBlobType::NonNMethod)) {
- // Fallback solution: Store non-nmethod code in the non-profiled code heap.
- // Note that at in the sweeper, we check the reverse_free_ratio of the non-profiled
- // code heap and force stack scanning if less than 10% if the code heap are free.
- return allocate(size, CodeBlobType::MethodNonProfiled);
+ if (SegmentedCodeCache && !strict) {
+ // Fallback solution: Try to store code in another code heap.
+ // Note that in the sweeper, we check the reverse_free_ratio of the code heap
+ // and force stack scanning if less than 10% of the code heap are free.
+ int type = code_blob_type;
+ switch (type) {
+ case CodeBlobType::NonNMethod:
+ type = CodeBlobType::MethodNonProfiled;
+ strict = false; // Allow recursive search for other heaps
+ break;
+ case CodeBlobType::MethodProfiled:
+ type = CodeBlobType::MethodNonProfiled;
+ strict = true;
+ break;
+ case CodeBlobType::MethodNonProfiled:
+ type = CodeBlobType::MethodProfiled;
+ strict = true;
+ break;
+ }
+ if (heap_available(type)) {
+ return allocate(size, type, strict);
+ }
}
MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
CompileBroker::handle_full_code_cache(code_blob_type);
diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp
index d682f90..09879b1 100644
--- a/hotspot/src/share/vm/code/codeCache.hpp
+++ b/hotspot/src/share/vm/code/codeCache.hpp
@@ -122,7 +122,7 @@
static void initialize();
// Allocation/administration
- static CodeBlob* allocate(int size, int code_blob_type); // allocates a new CodeBlob
+ static CodeBlob* allocate(int size, int code_blob_type, bool strict = false); // allocates a new CodeBlob
static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled
static int alignment_unit(); // guaranteed alignment of all CodeBlobs
static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp
index d59bd65..46cd7fb 100644
--- a/hotspot/src/share/vm/compiler/disassembler.cpp
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp
@@ -343,8 +343,8 @@
}
BarrierSet* bs = Universe::heap()->barrier_set();
- if (bs->kind() == BarrierSet::CardTableModRef &&
- adr == (address)((CardTableModRefBS*)(bs))->byte_map_base) {
+ if (bs->is_a(BarrierSet::CardTableModRef) &&
+ adr == (address)(barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base)) {
st->print("word_map_base");
if (WizardMode) st->print(" " INTPTR_FORMAT, (intptr_t)adr);
return;
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
index b588cce..73f265a 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -97,9 +97,7 @@
void ConcurrentMarkSweepThread::run() {
assert(this == cmst(), "just checking");
- this->record_stack_base_and_size();
- this->initialize_thread_local_storage();
- this->set_active_handles(JNIHandleBlock::allocate_block());
+ initialize_in_thread();
// From this time Thread::current() should be working.
assert(this == Thread::current(), "just checking");
if (BindCMSThreadToCPU && !os::bind_to_processor(CPUForCMSThread)) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index 0119858..bdd5e55 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1440,7 +1440,7 @@
CMCountDataClosureBase(G1CollectedHeap* g1h,
BitMap* region_bm, BitMap* card_bm):
_g1h(g1h), _cm(g1h->concurrent_mark()),
- _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
+ _ct_bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
_region_bm(region_bm), _card_bm(card_bm) { }
};
@@ -3111,7 +3111,7 @@
BitMap* cm_card_bm,
uint max_worker_id) :
_g1h(g1h), _cm(g1h->concurrent_mark()),
- _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
+ _ct_bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
_cm_card_bm(cm_card_bm), _max_worker_id(max_worker_id) { }
bool doHeapRegion(HeapRegion* hr) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
index da75e61..4e199a6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@
if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context);
add_to_alloc_buffer_waste(alloc_buf->words_remaining());
- alloc_buf->retire(false /* end_of_gc */, false /* retain */);
+ alloc_buf->retire();
HeapWord* buf = _g1h->par_allocate_during_gc(dest, gclab_word_size, context);
if (buf == NULL) {
@@ -154,9 +154,7 @@
G1ParGCAllocBuffer* const buf = _alloc_buffers[state];
if (buf != NULL) {
add_to_alloc_buffer_waste(buf->words_remaining());
- buf->flush_stats_and_retire(_g1h->alloc_buffer_stats(state),
- true /* end_of_gc */,
- false /* retain */);
+ buf->flush_and_retire_stats(_g1h->alloc_buffer_stats(state));
}
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp
index b32a4191d..f14b1df 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -159,11 +159,11 @@
_retired = false;
}
- virtual void retire(bool end_of_gc, bool retain) {
+ virtual void retire() {
if (_retired) {
return;
}
- ParGCAllocBuffer::retire(end_of_gc, retain);
+ ParGCAllocBuffer::retire();
_retired = true;
}
};
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index fa51a4b..c47a851 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1274,7 +1274,7 @@
virtual bool is_in_closed_subset(const void* p) const;
G1SATBCardTableLoggingModRefBS* g1_barrier_set() {
- return (G1SATBCardTableLoggingModRefBS*) barrier_set();
+ return barrier_set_cast<G1SATBCardTableLoggingModRefBS>(barrier_set());
}
// This resets the card table to all zeros. It is used after
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
index b97a3a1..829faeb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
@@ -33,8 +33,11 @@
#include "runtime/orderAccess.inline.hpp"
#include "runtime/thread.inline.hpp"
-G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind) :
- CardTableModRefBS(whole_heap, kind) { }
+G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(
+ MemRegion whole_heap,
+ const BarrierSet::FakeRtti& fake_rtti) :
+ CardTableModRefBS(whole_heap, fake_rtti.add_tag(BarrierSet::G1SATBCT))
+{ }
void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
// Nulls should have been already filtered.
@@ -130,7 +133,7 @@
G1SATBCardTableLoggingModRefBS::
G1SATBCardTableLoggingModRefBS(MemRegion whole_heap) :
- G1SATBCardTableModRefBS(whole_heap, BarrierSet::G1SATBCTLogging),
+ G1SATBCardTableModRefBS(whole_heap, BarrierSet::FakeRtti(G1SATBCTLogging)),
_dcqs(JavaThread::dirty_card_queue_set()),
_listener()
{
@@ -203,7 +206,7 @@
if (new_val == NULL) return;
// Otherwise, log it.
G1SATBCardTableLoggingModRefBS* g1_bs =
- (G1SATBCardTableLoggingModRefBS*)Universe::heap()->barrier_set();
+ barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());
g1_bs->write_ref_field_work(field, new_val);
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
index 98c8b65..c307815 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
@@ -43,7 +43,7 @@
g1_young_gen = CT_MR_BS_last_reserved << 1
};
- G1SATBCardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind);
+ G1SATBCardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
~G1SATBCardTableModRefBS() { }
public:
@@ -53,10 +53,6 @@
// pre-marking object graph.
static void enqueue(oop pre_val);
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::G1SATBCT || CardTableModRefBS::is_a(bsn);
- }
-
virtual bool has_write_ref_pre_barrier() { return true; }
// This notes that we don't need to access any BarrierSet data
@@ -128,6 +124,11 @@
}
};
+template<>
+struct BarrierSet::GetName<G1SATBCardTableModRefBS> {
+ static const BarrierSet::Name value = BarrierSet::G1SATBCT;
+};
+
class G1SATBCardTableLoggingModRefBSChangedListener : public G1MappingChangedListener {
private:
G1SATBCardTableLoggingModRefBS* _card_table;
@@ -159,11 +160,6 @@
virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); }
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::G1SATBCTLogging ||
- G1SATBCardTableModRefBS::is_a(bsn);
- }
-
void write_ref_field_work(void* field, oop new_val, bool release = false);
// Can be called from static contexts.
@@ -177,4 +173,9 @@
void write_ref_array_work(MemRegion mr) { invalidate(mr); }
};
+template<>
+struct BarrierSet::GetName<G1SATBCardTableLoggingModRefBS> {
+ static const BarrierSet::Name value = BarrierSet::G1SATBCTLogging;
+};
+
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 68a6767..3ad7f19 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -193,7 +193,7 @@
HeapRegionRemSet* hrrs = rem_set();
hrrs->clear();
CardTableModRefBS* ct_bs =
- (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set();
+ barrier_set_cast<CardTableModRefBS>(G1CollectedHeap::heap()->barrier_set());
ct_bs->clear(MemRegion(bottom(), end()));
}
@@ -643,13 +643,9 @@
// _vo == UseNextMarking -> use "next" marking information,
// _vo == UseMarkWord -> use mark word from object header.
VerifyLiveClosure(G1CollectedHeap* g1h, VerifyOption vo) :
- _g1h(g1h), _bs(NULL), _containing_obj(NULL),
- _failures(false), _n_failures(0), _vo(vo)
- {
- BarrierSet* bs = _g1h->barrier_set();
- if (bs->is_a(BarrierSet::CardTableModRef))
- _bs = (CardTableModRefBS*)bs;
- }
+ _g1h(g1h), _bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
+ _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo)
+ { }
void set_containing_obj(oop obj) {
_containing_obj = obj;
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index c4b0f97..a54864d 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -232,7 +232,7 @@
if (word_sz * 100 <
ParallelGCBufferWastePct * plab->word_sz()) {
// Is small enough; abandon this buffer and start a new one.
- plab->retire(false, false);
+ plab->retire();
size_t buf_size = plab->word_sz();
HeapWord* buf_space = sp->par_allocate(buf_size);
if (buf_space == NULL) {
@@ -463,10 +463,7 @@
// Flush stats related to To-space PLAB activity and
// retire the last buffer.
- par_scan_state.to_space_alloc_buffer()->
- flush_stats_and_retire(_gen.plab_stats(),
- true /* end_of_gc */,
- false /* retain */);
+ par_scan_state.to_space_alloc_buffer()->flush_and_retire_stats(_gen.plab_stats());
// Every thread has its own age table. We need to merge
// them all into one.
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
index 9630cb0..7448978 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
_young_gen = heap->young_gen();
- _card_table = (CardTableExtension*)heap->barrier_set();
+ _card_table = barrier_set_cast<CardTableExtension>(heap->barrier_set());
// No point in asserting barrier set type here. Need to make CardTableExtension
// a unique barrier set type.
}
@@ -341,7 +341,9 @@
PSOldGen* old_gen = heap->old_gen();
- CheckForPreciseMarks check(heap->young_gen(), (CardTableExtension*)heap->barrier_set());
+ CheckForPreciseMarks check(
+ heap->young_gen(),
+ barrier_set_cast<CardTableExtension>(heap->barrier_set()));
old_gen->oop_iterate_no_header(&check);
@@ -349,8 +351,8 @@
}
void CardTableExtension::verify_all_young_refs_precise_helper(MemRegion mr) {
- CardTableExtension* card_table = (CardTableExtension*)Universe::heap()->barrier_set();
- // FIX ME ASSERT HERE
+ CardTableExtension* card_table =
+ barrier_set_cast<CardTableExtension>(Universe::heap()->barrier_set());
jbyte* bot = card_table->byte_for(mr.start());
jbyte* top = card_table->byte_for(mr.end());
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
index d2d3319..dd29609 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
@@ -54,10 +54,16 @@
};
CardTableExtension(MemRegion whole_heap) :
- CardTableModRefBS(whole_heap, BarrierSet::CardTableModRef) { }
-
- // Too risky for the 4/10/02 putback
- // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }
+ CardTableModRefBS(
+ whole_heap,
+ // Concrete tag should be BarrierSet::CardTableExtension.
+ // That will presently break things in a bunch of places though.
+ // The concrete tag is used as a dispatch key in many places, and
+ // CardTableExtension does not correctly dispatch in some of those
+ // uses. This will be addressed as part of a reorganization of the
+ // BarrierSet hierarchy.
+ BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableExtension))
+ { }
// Scavenge support
void scavenge_contents_parallel(ObjectStartArray* start_array,
@@ -110,4 +116,9 @@
#endif // ASSERT
};
+template<>
+struct BarrierSet::GetName<CardTableExtension> {
+ static const BarrierSet::Name value = BarrierSet::CardTableExtension;
+};
+
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
index b3b550a..ff58762 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
// Set up the thread for stack overflow support
this->record_stack_base_and_size();
this->initialize_thread_local_storage();
+ this->initialize_named_thread();
// Bind yourself to your processor.
if (processor_id() != GCTaskManager::sentinel_worker()) {
if (TraceGCTaskThread) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
index e641151..7288b96 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
@@ -1,6 +1,5 @@
-
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -233,15 +232,12 @@
young_gen->to_space()->is_empty();
young_gen_empty = eden_empty && survivors_empty;
- BarrierSet* bs = heap->barrier_set();
- if (bs->is_a(BarrierSet::ModRef)) {
- ModRefBarrierSet* modBS = (ModRefBarrierSet*)bs;
- MemRegion old_mr = heap->old_gen()->reserved();
- if (young_gen_empty) {
- modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
- } else {
- modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
- }
+ ModRefBarrierSet* modBS = barrier_set_cast<ModRefBarrierSet>(heap->barrier_set());
+ MemRegion old_mr = heap->old_gen()->reserved();
+ if (young_gen_empty) {
+ modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
+ } else {
+ modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
}
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
index a578d75..c7ac0eb 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -111,8 +111,8 @@
Universe::heap()->barrier_set()->resize_covered_region(cmr);
- CardTableModRefBS* _ct = (CardTableModRefBS*)Universe::heap()->barrier_set();
- assert (_ct->kind() == BarrierSet::CardTableModRef, "Sanity");
+ CardTableModRefBS* _ct =
+ barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
// Verify that the start and end of this generation is the start of a card.
// If this wasn't true, a single card could span more than one generation,
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
index 28cff78..3e89b0a 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1050,16 +1050,12 @@
bool young_gen_empty = eden_empty && from_space->is_empty() &&
to_space->is_empty();
- BarrierSet* bs = heap->barrier_set();
- if (bs->is_a(BarrierSet::ModRef)) {
- ModRefBarrierSet* modBS = (ModRefBarrierSet*)bs;
- MemRegion old_mr = heap->old_gen()->reserved();
-
- if (young_gen_empty) {
- modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
- } else {
- modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
- }
+ ModRefBarrierSet* modBS = barrier_set_cast<ModRefBarrierSet>(heap->barrier_set());
+ MemRegion old_mr = heap->old_gen()->reserved();
+ if (young_gen_empty) {
+ modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
+ } else {
+ modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
}
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
index db5a528..3c0542f 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
@@ -1,6 +1,5 @@
-
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -866,9 +865,7 @@
NULL); // header provides liveness info
// Cache the cardtable
- BarrierSet* bs = Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
- _card_table = (CardTableExtension*)bs;
+ _card_table = barrier_set_cast<CardTableExtension>(heap->barrier_set());
_counters = new CollectorCounters("PSScavenge", 0);
}
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
index f829e93..df320d8 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -183,8 +183,8 @@
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which);
assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
- CardTableExtension* card_table = (CardTableExtension *)Universe::heap()->barrier_set();
- // FIX ME! Assert that card_table is the type we believe it to be.
+ CardTableExtension* card_table =
+ barrier_set_cast<CardTableExtension>(Universe::heap()->barrier_set());
card_table->scavenge_contents_parallel(_gen->start_array(),
_gen->object_space(),
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
index c90da2b..9002cd0 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,7 @@
void ConcurrentGCThread::initialize_in_thread() {
this->record_stack_base_and_size();
this->initialize_thread_local_storage();
+ this->initialize_named_thread();
this->set_active_handles(JNIHandleBlock::allocate_block());
// From this time Thread::current() should be working.
assert(this == Thread::current(), "just checking");
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
index 0a39605..fe21e58 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,27 +24,30 @@
#include "precompiled.hpp"
#include "gc_implementation/shared/parGCAllocBuffer.hpp"
-#include "memory/sharedHeap.hpp"
+#include "memory/threadLocalAllocBuffer.hpp"
#include "oops/arrayOop.hpp"
#include "oops/oop.inline.hpp"
-#include "utilities/globalDefinitions.hpp"
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+size_t ParGCAllocBuffer::min_size() {
+ // Make sure that we return something that is larger than AlignmentReserve
+ return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
+}
+
+size_t ParGCAllocBuffer::max_size() {
+ return ThreadLocalAllocBuffer::max_size();
+}
ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
_word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
- _end(NULL), _hard_end(NULL),
- _retained(false), _retained_filler(),
- _allocated(0), _wasted(0)
+ _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0)
{
- assert (min_size() > AlignmentReserve, "Inconsistency!");
- // arrayOopDesc::header_size depends on command line initialization.
- FillerHeaderSize = align_object_size(arrayOopDesc::header_size(T_INT));
- AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? FillerHeaderSize : 0;
+ // ArrayOopDesc::header_size depends on command line initialization.
+ AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
+ assert(min_size() > AlignmentReserve,
+ err_msg("Minimum PLAB size " SIZE_FORMAT" must be larger than alignment reserve " SIZE_FORMAT" "
+ "to be able to contain objects", min_size(), AlignmentReserve));
}
-size_t ParGCAllocBuffer::FillerHeaderSize;
-
// If the minimum object size is greater than MinObjAlignment, we can
// end up with a shard at the end of the buffer that's smaller than
// the smallest object. We can't allow that because the buffer must
@@ -52,39 +55,33 @@
// sure we have enough space for a filler int array object.
size_t ParGCAllocBuffer::AlignmentReserve;
-void ParGCAllocBuffer::retire(bool end_of_gc, bool retain) {
- assert(!retain || end_of_gc, "Can only retain at GC end.");
- if (_retained) {
- // If the buffer had been retained shorten the previous filler object.
- assert(_retained_filler.end() <= _top, "INVARIANT");
- CollectedHeap::fill_with_object(_retained_filler);
- // Wasted space book-keeping, otherwise (normally) done in invalidate()
- _wasted += _retained_filler.word_size();
- _retained = false;
- }
- assert(!end_of_gc || !_retained, "At this point, end_of_gc ==> !_retained.");
- if (_top < _hard_end) {
- CollectedHeap::fill_with_object(_top, _hard_end);
- if (!retain) {
- invalidate();
- } else {
- // Is there wasted space we'd like to retain for the next GC?
- if (pointer_delta(_end, _top) > FillerHeaderSize) {
- _retained = true;
- _retained_filler = MemRegion(_top, FillerHeaderSize);
- _top = _top + FillerHeaderSize;
- } else {
- invalidate();
- }
- }
- }
-}
+void ParGCAllocBuffer::flush_and_retire_stats(PLABStats* stats) {
+ // Retire the last allocation buffer.
+ size_t unused = retire_internal();
-void ParGCAllocBuffer::flush_stats(PLABStats* stats) {
- assert(ResizePLAB, "Wasted work");
+ // Now flush the statistics.
stats->add_allocated(_allocated);
stats->add_wasted(_wasted);
- stats->add_unused(pointer_delta(_end, _top));
+ stats->add_unused(unused);
+
+ // Since we have flushed the stats we need to clear the _allocated and _wasted
+ // fields in case somebody retains an instance of this over GCs. Not doing so
+ // will artifically inflate the values in the statistics.
+ _allocated = 0;
+ _wasted = 0;
+}
+
+void ParGCAllocBuffer::retire() {
+ _wasted += retire_internal();
+}
+
+size_t ParGCAllocBuffer::retire_internal() {
+ size_t result = 0;
+ if (_top < _hard_end) {
+ CollectedHeap::fill_with_object(_top, _hard_end);
+ result += invalidate();
+ }
+ return result;
}
// Compute desired plab size and latch result for later
@@ -101,44 +98,37 @@
err_msg("Inconsistency in PLAB stats: "
"_allocated: "SIZE_FORMAT", "
"_wasted: "SIZE_FORMAT", "
- "_unused: "SIZE_FORMAT", "
- "_used : "SIZE_FORMAT,
- _allocated, _wasted, _unused, _used));
+ "_unused: "SIZE_FORMAT,
+ _allocated, _wasted, _unused));
_allocated = 1;
}
- double wasted_frac = (double)_unused/(double)_allocated;
- size_t target_refills = (size_t)((wasted_frac*TargetSurvivorRatio)/
- TargetPLABWastePct);
+ double wasted_frac = (double)_unused / (double)_allocated;
+ size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct);
if (target_refills == 0) {
target_refills = 1;
}
- _used = _allocated - _wasted - _unused;
- size_t plab_sz = _used/(target_refills*no_of_gc_workers);
- if (PrintPLAB) gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " ", plab_sz);
+ size_t used = _allocated - _wasted - _unused;
+ size_t recent_plab_sz = used / (target_refills * no_of_gc_workers);
// Take historical weighted average
- _filter.sample(plab_sz);
+ _filter.sample(recent_plab_sz);
// Clip from above and below, and align to object boundary
- plab_sz = MAX2(min_size(), (size_t)_filter.average());
- plab_sz = MIN2(max_size(), plab_sz);
- plab_sz = align_object_size(plab_sz);
+ size_t new_plab_sz = MAX2(min_size(), (size_t)_filter.average());
+ new_plab_sz = MIN2(max_size(), new_plab_sz);
+ new_plab_sz = align_object_size(new_plab_sz);
// Latch the result
- if (PrintPLAB) gclog_or_tty->print(" desired_plab_sz = " SIZE_FORMAT ") ", plab_sz);
- _desired_plab_sz = plab_sz;
- // Now clear the accumulators for next round:
- // note this needs to be fixed in the case where we
- // are retaining across scavenges. FIX ME !!! XXX
- _allocated = 0;
- _wasted = 0;
- _unused = 0;
+ if (PrintPLAB) {
+ gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT" desired_plab_sz = " SIZE_FORMAT") ", recent_plab_sz, new_plab_sz);
+ }
+ _desired_plab_sz = new_plab_sz;
+
+ reset();
}
#ifndef PRODUCT
void ParGCAllocBuffer::print() {
- gclog_or_tty->print("parGCAllocBuffer: _bottom: " PTR_FORMAT " _top: " PTR_FORMAT
- " _end: " PTR_FORMAT " _hard_end: " PTR_FORMAT " _retained: %c"
- " _retained_filler: [" PTR_FORMAT "," PTR_FORMAT ")\n",
- _bottom, _top, _end, _hard_end,
- "FT"[_retained], _retained_filler.start(), _retained_filler.end());
+ gclog_or_tty->print_cr("parGCAllocBuffer: _bottom: " PTR_FORMAT " _top: " PTR_FORMAT
+ " _end: " PTR_FORMAT " _hard_end: " PTR_FORMAT ")",
+ p2i(_bottom), p2i(_top), p2i(_end), p2i(_hard_end));
}
#endif // !PRODUCT
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
index 953ab2f..a8991a0 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,37 +24,43 @@
#ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
#define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
-#include "gc_interface/collectedHeap.hpp"
+
+#include "gc_implementation/shared/gcUtil.hpp"
#include "memory/allocation.hpp"
-#include "memory/blockOffsetTable.hpp"
-#include "memory/threadLocalAllocBuffer.hpp"
+#include "runtime/atomic.hpp"
#include "utilities/globalDefinitions.hpp"
-// Forward decl.
-
+// Forward declarations.
class PLABStats;
// A per-thread allocation buffer used during GC.
class ParGCAllocBuffer: public CHeapObj<mtGC> {
protected:
- char head[32];
- size_t _word_sz; // in HeapWord units
+ char head[32];
+ size_t _word_sz; // In HeapWord units
HeapWord* _bottom;
HeapWord* _top;
- HeapWord* _end; // last allocatable address + 1
- HeapWord* _hard_end; // _end + AlignmentReserve
- bool _retained; // whether we hold a _retained_filler
- MemRegion _retained_filler;
+ HeapWord* _end; // Last allocatable address + 1
+ HeapWord* _hard_end; // _end + AlignmentReserve
// In support of ergonomic sizing of PLAB's
size_t _allocated; // in HeapWord units
size_t _wasted; // in HeapWord units
- char tail[32];
- static size_t FillerHeaderSize;
+ char tail[32];
static size_t AlignmentReserve;
- // Flush the stats supporting ergonomic sizing of PLAB's
- // Should not be called directly
- void flush_stats(PLABStats* stats);
+ // Force future allocations to fail and queries for contains()
+ // to return false. Returns the amount of unused space in this PLAB.
+ size_t invalidate() {
+ _end = _hard_end;
+ size_t remaining = pointer_delta(_end, _top); // Calculate remaining space.
+ _top = _end; // Force future allocations to fail.
+ _bottom = _end; // Force future contains() queries to return false.
+ return remaining;
+ }
+
+ // Fill in remaining space with a dummy object and invalidate the PLAB. Returns
+ // the amount of remaining space.
+ size_t retire_internal();
public:
// Initializes the buffer to be empty, but with the given "word_sz".
@@ -62,14 +68,10 @@
ParGCAllocBuffer(size_t word_sz);
virtual ~ParGCAllocBuffer() {}
- static const size_t min_size() {
- // Make sure that we return something that is larger than AlignmentReserve
- return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
- }
-
- static const size_t max_size() {
- return ThreadLocalAllocBuffer::max_size();
- }
+ // Minimum PLAB size.
+ static size_t min_size();
+ // Maximum PLAB size.
+ static size_t max_size();
// If an allocation of the given "word_sz" can be satisfied within the
// buffer, do the allocation, returning a pointer to the start of the
@@ -128,62 +130,37 @@
_allocated += word_sz();
}
- // Flush the stats supporting ergonomic sizing of PLAB's
- // and retire the current buffer.
- void flush_stats_and_retire(PLABStats* stats, bool end_of_gc, bool retain) {
- // We flush the stats first in order to get a reading of
- // unused space in the last buffer.
- if (ResizePLAB) {
- flush_stats(stats);
+ // Flush allocation statistics into the given PLABStats supporting ergonomic
+ // sizing of PLAB's and retire the current buffer. To be called at the end of
+ // GC.
+ void flush_and_retire_stats(PLABStats* stats);
- // Since we have flushed the stats we need to clear
- // the _allocated and _wasted fields. Not doing so
- // will artifically inflate the values in the stats
- // to which we add them.
- // The next time we flush these values, we will add
- // what we have just flushed in addition to the size
- // of the buffers allocated between now and then.
- _allocated = 0;
- _wasted = 0;
- }
- // Retire the last allocation buffer.
- retire(end_of_gc, retain);
- }
-
- // Force future allocations to fail and queries for contains()
- // to return false
- void invalidate() {
- assert(!_retained, "Shouldn't retain an invalidated buffer.");
- _end = _hard_end;
- _wasted += pointer_delta(_end, _top); // unused space
- _top = _end; // force future allocations to fail
- _bottom = _end; // force future contains() queries to return false
- }
-
- // Fills in the unallocated portion of the buffer with a garbage object.
- // If "end_of_gc" is TRUE, is after the last use in the GC. IF "retain"
- // is true, attempt to re-use the unused portion in the next GC.
- virtual void retire(bool end_of_gc, bool retain);
+ // Fills in the unallocated portion of the buffer with a garbage object and updates
+ // statistics. To be called during GC.
+ virtual void retire();
void print() PRODUCT_RETURN;
};
-// PLAB stats book-keeping
+// PLAB book-keeping.
class PLABStats VALUE_OBJ_CLASS_SPEC {
- size_t _allocated; // total allocated
+ size_t _allocated; // Total allocated
size_t _wasted; // of which wasted (internal fragmentation)
size_t _unused; // Unused in last buffer
- size_t _used; // derived = allocated - wasted - unused
- size_t _desired_plab_sz;// output of filter (below), suitably trimmed and quantized
+ size_t _desired_plab_sz;// Output of filter (below), suitably trimmed and quantized
AdaptiveWeightedAverage
- _filter; // integrator with decay
+ _filter; // Integrator with decay
+ void reset() {
+ _allocated = 0;
+ _wasted = 0;
+ _unused = 0;
+ }
public:
PLABStats(size_t desired_plab_sz_, unsigned wt) :
_allocated(0),
_wasted(0),
_unused(0),
- _used(0),
_desired_plab_sz(desired_plab_sz_),
_filter(wt)
{ }
@@ -200,9 +177,9 @@
return _desired_plab_sz;
}
+ // Updates the current desired PLAB size. Computes the new desired PLAB size,
+ // updates _desired_plab_sz and clears sensor accumulators.
void adjust_desired_plab_sz(uint no_of_gc_workers);
- // filter computation, latches output to
- // _desired_plab_sz, clears sensor accumulators
void add_allocated(size_t v) {
Atomic::add_ptr(v, &_allocated);
diff --git a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp
index 2349a45..12591db 100644
--- a/hotspot/src/share/vm/memory/barrierSet.hpp
+++ b/hotspot/src/share/vm/memory/barrierSet.hpp
@@ -27,6 +27,7 @@
#include "memory/memRegion.hpp"
#include "oops/oopsHierarchy.hpp"
+#include "utilities/fakeRttiSupport.hpp"
// This class provides the interface between a barrier implementation and
// the rest of the system.
@@ -34,18 +35,57 @@
class BarrierSet: public CHeapObj<mtGC> {
friend class VMStructs;
public:
- enum Name {
- ModRef,
- CardTableModRef,
- CardTableExtension,
- G1SATBCT,
- G1SATBCTLogging
+ // Fake RTTI support. For a derived class T to participate
+ // - T must have a corresponding Name entry.
+ // - GetName<T> must be specialized to return the corresponding Name
+ // entry.
+ // - If T is a base class, the constructor must have a FakeRtti
+ // parameter and pass it up to its base class, with the tag set
+ // augmented with the corresponding Name entry.
+ // - If T is a concrete class, the constructor must create a
+ // FakeRtti object whose tag set includes the corresponding Name
+ // entry, and pass it up to its base class.
+
+ enum Name { // associated class
+ ModRef, // ModRefBarrierSet
+ CardTableModRef, // CardTableModRefBS
+ CardTableForRS, // CardTableModRefBSForCTRS
+ CardTableExtension, // CardTableExtension
+ G1SATBCT, // G1SATBCardTableModRefBS
+ G1SATBCTLogging // G1SATBCardTableLoggingModRefBS
};
+protected:
+ typedef FakeRttiSupport<BarrierSet, Name> FakeRtti;
+
+private:
+ FakeRtti _fake_rtti;
+
+ // Metafunction mapping a class derived from BarrierSet to the
+ // corresponding Name enum tag.
+ template<typename T> struct GetName;
+
+ // Downcast argument to a derived barrier set type.
+ // The cast is checked in a debug build.
+ // T must have a specialization for BarrierSet::GetName<T>.
+ template<typename T> friend T* barrier_set_cast(BarrierSet* bs);
+
+public:
+ // Note: This is not presently the Name corresponding to the
+ // concrete class of this object.
+ BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
+
+ // Test whether this object is of the type corresponding to bsn.
+ bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); }
+
+ // End of fake RTTI support.
+
+public:
enum Flags {
None = 0,
TargetUninitialized = 1
};
+
protected:
// Some barrier sets create tables whose elements correspond to parts of
// the heap; the CardTableModRefBS is an example. Such barrier sets will
@@ -53,17 +93,12 @@
// "covering" parts of the heap that are committed. At most one covered
// region per generation is needed.
static const int _max_covered_regions = 2;
- Name _kind;
- BarrierSet(Name kind) : _kind(kind) { }
+ BarrierSet(const FakeRtti& fake_rtti) : _fake_rtti(fake_rtti) { }
~BarrierSet() { }
public:
- // To get around prohibition on RTTI.
- BarrierSet::Name kind() { return _kind; }
- virtual bool is_a(BarrierSet::Name bsn) = 0;
-
// These operations indicate what kind of barriers the BarrierSet has.
virtual bool has_read_ref_barrier() = 0;
virtual bool has_read_prim_barrier() = 0;
@@ -177,4 +212,10 @@
virtual void print_on(outputStream* st) const = 0;
};
+template<typename T>
+inline T* barrier_set_cast(BarrierSet* bs) {
+ assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
+ return static_cast<T*>(bs);
+}
+
#endif // SHARE_VM_MEMORY_BARRIERSET_HPP
diff --git a/hotspot/src/share/vm/memory/barrierSet.inline.hpp b/hotspot/src/share/vm/memory/barrierSet.inline.hpp
index ded96f3..98437ab 100644
--- a/hotspot/src/share/vm/memory/barrierSet.inline.hpp
+++ b/hotspot/src/share/vm/memory/barrierSet.inline.hpp
@@ -34,7 +34,7 @@
template <class T> void BarrierSet::write_ref_field_pre(T* field, oop new_val) {
if (kind() == CardTableModRef) {
- ((CardTableModRefBS*)this)->inline_write_ref_field_pre(field, new_val);
+ barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field_pre(field, new_val);
} else {
write_ref_field_pre_work(field, new_val);
}
@@ -42,7 +42,7 @@
void BarrierSet::write_ref_field(void* field, oop new_val, bool release) {
if (kind() == CardTableModRef) {
- ((CardTableModRefBS*)this)->inline_write_ref_field(field, new_val, release);
+ barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field(field, new_val, release);
} else {
write_ref_field_work(field, new_val, release);
}
@@ -78,7 +78,7 @@
inline void BarrierSet::write_region(MemRegion mr) {
if (kind() == CardTableModRef) {
- ((CardTableModRefBS*)this)->inline_write_region(mr);
+ barrier_set_cast<CardTableModRefBS>(this)->inline_write_region(mr);
} else {
write_region_work(mr);
}
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
index fdf264e..d002423 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
@@ -53,8 +53,10 @@
return align_size_up(_guard_index + 1, MAX2(_page_size, granularity));
}
-CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind) :
- ModRefBarrierSet(kind),
+CardTableModRefBS::CardTableModRefBS(
+ MemRegion whole_heap,
+ const BarrierSet::FakeRtti& fake_rtti) :
+ ModRefBarrierSet(fake_rtti.add_tag(BarrierSet::CardTableModRef)),
_whole_heap(whole_heap),
_guard_index(0),
_guard_region(),
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
index f2d1c12..f7cf9e6 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
@@ -279,11 +279,6 @@
static int precleaned_card_val() { return precleaned_card; }
static int deferred_card_val() { return deferred_card; }
- // For RTTI simulation.
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn);
- }
-
virtual void initialize();
// *** Barrier set functions.
@@ -292,7 +287,7 @@
protected:
- CardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind);
+ CardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
~CardTableModRefBS();
// Record a reference update. Note that these versions are precise!
@@ -462,6 +457,11 @@
void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
};
+template<>
+struct BarrierSet::GetName<CardTableModRefBS> {
+ static const BarrierSet::Name value = BarrierSet::CardTableModRef;
+};
+
class CardTableRS;
// A specialization for the CardTableRS gen rem set.
@@ -472,10 +472,24 @@
bool card_may_have_been_dirty(jbyte cv);
public:
CardTableModRefBSForCTRS(MemRegion whole_heap) :
- CardTableModRefBS(whole_heap, BarrierSet::CardTableModRef) {}
+ CardTableModRefBS(
+ whole_heap,
+ // Concrete tag should be BarrierSet::CardTableForRS.
+ // That will presently break things in a bunch of places though.
+ // The concrete tag is used as a dispatch key in many places, and
+ // CardTableForRS does not correctly dispatch in some of those
+ // uses. This will be addressed as part of a reorganization of the
+ // BarrierSet hierarchy.
+ BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableForRS))
+ {}
void set_CTRS(CardTableRS* rs) { _rs = rs; }
};
+template<>
+struct BarrierSet::GetName<CardTableModRefBSForCTRS> {
+ static const BarrierSet::Name value = BarrierSet::CardTableForRS;
+};
+
#endif // SHARE_VM_MEMORY_CARDTABLEMODREFBS_HPP
diff --git a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
index 394d2c5..ac7db90 100644
--- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
+++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
@@ -37,10 +37,6 @@
class ModRefBarrierSet: public BarrierSet {
public:
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::ModRef;
- }
-
// Barriers only on ref writes.
bool has_read_ref_barrier() { return false; }
bool has_read_prim_barrier() { return false; }
@@ -60,7 +56,8 @@
protected:
- ModRefBarrierSet(BarrierSet::Name kind) : BarrierSet(kind) { }
+ ModRefBarrierSet(const BarrierSet::FakeRtti& fake_rtti)
+ : BarrierSet(fake_rtti.add_tag(BarrierSet::ModRef)) { }
~ModRefBarrierSet() { }
virtual void write_ref_field_work(void* field, oop new_val, bool release = false) = 0;
@@ -100,4 +97,9 @@
virtual void clear(MemRegion mr) = 0;
};
+template<>
+struct BarrierSet::GetName<ModRefBarrierSet> {
+ static const BarrierSet::Name value = BarrierSet::ModRef;
+};
+
#endif // SHARE_VM_MEMORY_MODREFBARRIERSET_HPP
diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp
index 3f3ae19..f5b19fe 100644
--- a/hotspot/src/share/vm/oops/constMethod.hpp
+++ b/hotspot/src/share/vm/oops/constMethod.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -215,6 +215,7 @@
u2 _max_stack; // Maximum number of entries on the expression stack
u2 _max_locals; // Number of local variables used by this method
u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
+ u2 _orig_method_idnum; // Original unique identification number for the method
// Constructor
ConstMethod(int byte_code_size,
@@ -473,6 +474,9 @@
u2 method_idnum() const { return _method_idnum; }
void set_method_idnum(u2 idnum) { _method_idnum = idnum; }
+ u2 orig_method_idnum() const { return _orig_method_idnum; }
+ void set_orig_method_idnum(u2 idnum) { _orig_method_idnum = idnum; }
+
// max stack
int max_stack() const { return _max_stack; }
void set_max_stack(int size) { _max_stack = size; }
diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp
index 6355e0d..f9f73d2 100644
--- a/hotspot/src/share/vm/oops/cpCache.cpp
+++ b/hotspot/src/share/vm/oops/cpCache.cpp
@@ -454,7 +454,6 @@
new_method->name()->as_C_string(),
new_method->signature()->as_C_string()));
}
-
return true;
}
@@ -482,7 +481,6 @@
new_method->name()->as_C_string(),
new_method->signature()->as_C_string()));
}
-
return true;
}
@@ -509,36 +507,33 @@
(!f1_as_method()->is_old() && !f1_as_method()->is_obsolete())));
}
-bool ConstantPoolCacheEntry::is_interesting_method_entry(Klass* k) {
+Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) {
if (!is_method_entry()) {
// not a method entry so not interesting by default
- return false;
+ return NULL;
}
-
Method* m = NULL;
if (is_vfinal()) {
// virtual and final so _f2 contains method ptr instead of vtable index
m = f2_as_vfinal_method();
} else if (is_f1_null()) {
// NULL _f1 means this is a virtual entry so also not interesting
- return false;
+ return NULL;
} else {
if (!(_f1->is_method())) {
// _f1 can also contain a Klass* for an interface
- return false;
+ return NULL;
}
m = f1_as_method();
}
-
assert(m != NULL && m->is_method(), "sanity check");
if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
// robustness for above sanity checks or method is not in
// the interesting class
- return false;
+ return NULL;
}
-
// the method is in the interesting class so the entry is interesting
- return true;
+ return m;
}
#endif // INCLUDE_JVMTI
@@ -615,7 +610,7 @@
// If any entry of this ConstantPoolCache points to any of
// old_methods, replace it with the corresponding new_method.
void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed) {
+ int methods_length, bool * trace_name_printed) {
if (methods_length == 0) {
// nothing to do if there are no methods
@@ -626,7 +621,7 @@
Klass* old_holder = old_methods[0]->method_holder();
for (int i = 0; i < length(); i++) {
- if (!entry_at(i)->is_interesting_method_entry(old_holder)) {
+ if (entry_at(i)->get_interesting_method_entry(old_holder) == NULL) {
// skip uninteresting methods
continue;
}
@@ -650,10 +645,33 @@
}
}
+// If any entry of this ConstantPoolCache points to any of
+// old_methods, replace it with the corresponding new_method.
+void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+ for (int i = 0; i < length(); i++) {
+ ConstantPoolCacheEntry* entry = entry_at(i);
+ Method* old_method = entry->get_interesting_method_entry(holder);
+ if (old_method == NULL || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ if (old_method->is_deleted()) {
+ // clean up entries with deleted methods
+ entry->initialize_entry(entry->constant_pool_index());
+ continue;
+ }
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ entry_at(i)->adjust_method_entry(old_method, new_method, trace_name_printed);
+ }
+}
+
// the constant pool cache should never contain old or obsolete methods
bool ConstantPoolCache::check_no_old_or_obsolete_entries() {
for (int i = 1; i < length(); i++) {
- if (entry_at(i)->is_interesting_method_entry(NULL) &&
+ if (entry_at(i)->get_interesting_method_entry(NULL) != NULL &&
!entry_at(i)->check_no_old_or_obsolete_entries()) {
return false;
}
@@ -663,7 +681,7 @@
void ConstantPoolCache::dump_cache() {
for (int i = 1; i < length(); i++) {
- if (entry_at(i)->is_interesting_method_entry(NULL)) {
+ if (entry_at(i)->get_interesting_method_entry(NULL) != NULL) {
entry_at(i)->print(tty, i);
}
}
diff --git a/hotspot/src/share/vm/oops/cpCache.hpp b/hotspot/src/share/vm/oops/cpCache.hpp
index debd091..eeef44f 100644
--- a/hotspot/src/share/vm/oops/cpCache.hpp
+++ b/hotspot/src/share/vm/oops/cpCache.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -379,9 +379,9 @@
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
bool adjust_method_entry(Method* old_method, Method* new_method,
- bool * trace_name_printed);
+ bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
- bool is_interesting_method_entry(Klass* k);
+ Method* get_interesting_method_entry(Klass* k);
#endif // INCLUDE_JVMTI
// Debugging & Printing
@@ -478,7 +478,8 @@
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
void adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed);
+ int methods_length, bool* trace_name_printed);
+ void adjust_method_entries(InstanceKlass* holder, bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_cache();
#endif // INCLUDE_JVMTI
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index ce0fb5d..91843cd 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -2793,30 +2793,33 @@
// not yet in the vtable due to concurrent subclass define and superinterface
// redefinition
// Note: those in the vtable, should have been updated via adjust_method_entries
-void InstanceKlass::adjust_default_methods(Method** old_methods, Method** new_methods,
- int methods_length, bool* trace_name_printed) {
+void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) {
// search the default_methods for uses of either obsolete or EMCP methods
if (default_methods() != NULL) {
- for (int j = 0; j < methods_length; j++) {
- Method* old_method = old_methods[j];
- Method* new_method = new_methods[j];
+ for (int index = 0; index < default_methods()->length(); index ++) {
+ Method* old_method = default_methods()->at(index);
+ if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ assert(!old_method->is_deleted(), "default methods may not be deleted");
- for (int index = 0; index < default_methods()->length(); index ++) {
- if (default_methods()->at(index) == old_method) {
- default_methods()->at_put(index, new_method);
- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
- if (!(*trace_name_printed)) {
- // RC_TRACE_MESG macro has an embedded ResourceMark
- RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
- external_name(),
- old_method->method_holder()->external_name()));
- *trace_name_printed = true;
- }
- RC_TRACE(0x00100000, ("default method update: %s(%s) ",
- new_method->name()->as_C_string(),
- new_method->signature()->as_C_string()));
- }
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ default_methods()->at_put(index, new_method);
+ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+ if (!(*trace_name_printed)) {
+ // RC_TRACE_MESG macro has an embedded ResourceMark
+ RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
+ external_name(),
+ old_method->method_holder()->external_name()));
+ *trace_name_printed = true;
}
+ RC_TRACE(0x00100000, ("default method update: %s(%s) ",
+ new_method->name()->as_C_string(),
+ new_method->signature()->as_C_string()));
}
}
}
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index 5cbe4a8..507454e 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -937,8 +937,7 @@
Method* method_at_itable(Klass* holder, int index, TRAPS);
#if INCLUDE_JVMTI
- void adjust_default_methods(Method** old_methods, Method** new_methods,
- int methods_length, bool* trace_name_printed);
+ void adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed);
#endif // INCLUDE_JVMTI
// Garbage collection
diff --git a/hotspot/src/share/vm/oops/klassVtable.cpp b/hotspot/src/share/vm/oops/klassVtable.cpp
index 8a0ec13..5cfa70a 100644
--- a/hotspot/src/share/vm/oops/klassVtable.cpp
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp
@@ -863,44 +863,43 @@
}
return updated;
}
-void klassVtable::adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed) {
- // search the vtable for uses of either obsolete or EMCP methods
- for (int j = 0; j < methods_length; j++) {
- Method* old_method = old_methods[j];
- Method* new_method = new_methods[j];
- // In the vast majority of cases we could get the vtable index
- // by using: old_method->vtable_index()
- // However, there are rare cases, eg. sun.awt.X11.XDecoratedPeer.getX()
- // in sun.awt.X11.XFramePeer where methods occur more than once in the
- // vtable, so, alas, we must do an exhaustive search.
- for (int index = 0; index < length(); index++) {
- if (unchecked_method_at(index) == old_method) {
- put_method_at(new_method, index);
- // For default methods, need to update the _default_methods array
- // which can only have one method entry for a given signature
- bool updated_default = false;
- if (old_method->is_default_method()) {
- updated_default = adjust_default_method(index, old_method, new_method);
- }
+// search the vtable for uses of either obsolete or EMCP methods
+void klassVtable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+ int prn_enabled = 0;
+ for (int index = 0; index < length(); index++) {
+ Method* old_method = unchecked_method_at(index);
+ if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ assert(!old_method->is_deleted(), "vtable methods may not be deleted");
- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
- if (!(*trace_name_printed)) {
- // RC_TRACE_MESG macro has an embedded ResourceMark
- RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s",
- klass()->external_name(),
- old_method->method_holder()->external_name()));
- *trace_name_printed = true;
- }
- // RC_TRACE macro has an embedded ResourceMark
- RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s",
- new_method->name()->as_C_string(),
- new_method->signature()->as_C_string(),
- updated_default ? "true" : "false"));
- }
- // cannot 'break' here; see for-loop comment above.
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ put_method_at(new_method, index);
+ // For default methods, need to update the _default_methods array
+ // which can only have one method entry for a given signature
+ bool updated_default = false;
+ if (old_method->is_default_method()) {
+ updated_default = adjust_default_method(index, old_method, new_method);
+ }
+
+ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+ if (!(*trace_name_printed)) {
+ // RC_TRACE_MESG macro has an embedded ResourceMark
+ RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s",
+ klass()->external_name(),
+ old_method->method_holder()->external_name()));
+ *trace_name_printed = true;
}
+ // RC_TRACE macro has an embedded ResourceMark
+ RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s",
+ new_method->name()->as_C_string(),
+ new_method->signature()->as_C_string(),
+ updated_default ? "true" : "false"));
}
}
}
@@ -1193,37 +1192,35 @@
}
#if INCLUDE_JVMTI
-void klassItable::adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed) {
- // search the itable for uses of either obsolete or EMCP methods
- for (int j = 0; j < methods_length; j++) {
- Method* old_method = old_methods[j];
- Method* new_method = new_methods[j];
- itableMethodEntry* ime = method_entry(0);
+// search the itable for uses of either obsolete or EMCP methods
+void klassItable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
- // The itable can describe more than one interface and the same
- // method signature can be specified by more than one interface.
- // This means we have to do an exhaustive search to find all the
- // old_method references.
- for (int i = 0; i < _size_method_table; i++) {
- if (ime->method() == old_method) {
- ime->initialize(new_method);
+ itableMethodEntry* ime = method_entry(0);
+ for (int i = 0; i < _size_method_table; i++, ime++) {
+ Method* old_method = ime->method();
+ if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ assert(!old_method->is_deleted(), "itable methods may not be deleted");
- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
- if (!(*trace_name_printed)) {
- // RC_TRACE_MESG macro has an embedded ResourceMark
- RC_TRACE_MESG(("adjust: name=%s",
- old_method->method_holder()->external_name()));
- *trace_name_printed = true;
- }
- // RC_TRACE macro has an embedded ResourceMark
- RC_TRACE(0x00200000, ("itable method update: %s(%s)",
- new_method->name()->as_C_string(),
- new_method->signature()->as_C_string()));
- }
- // cannot 'break' here; see for-loop comment above.
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ ime->initialize(new_method);
+
+ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+ if (!(*trace_name_printed)) {
+ // RC_TRACE_MESG macro has an embedded ResourceMark
+ RC_TRACE_MESG(("adjust: name=%s",
+ old_method->method_holder()->external_name()));
+ *trace_name_printed = true;
}
- ime++;
+ // RC_TRACE macro has an embedded ResourceMark
+ RC_TRACE(0x00200000, ("itable method update: %s(%s)",
+ new_method->name()->as_C_string(),
+ new_method->signature()->as_C_string()));
}
}
}
diff --git a/hotspot/src/share/vm/oops/klassVtable.hpp b/hotspot/src/share/vm/oops/klassVtable.hpp
index 01ad63f..e4b4c9f 100644
--- a/hotspot/src/share/vm/oops/klassVtable.hpp
+++ b/hotspot/src/share/vm/oops/klassVtable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -98,8 +98,7 @@
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
- void adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed);
+ void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_vtable();
#endif // INCLUDE_JVMTI
@@ -288,8 +287,7 @@
// trace_name_printed is set to true if the current call has
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
- void adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed);
+ void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_itable();
#endif // INCLUDE_JVMTI
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index 9e37b0b..ac0a422 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -1450,6 +1450,7 @@
for (int i = 0; i < length; i++) {
Method* m = methods->at(i);
m->set_method_idnum(i);
+ m->set_orig_method_idnum(i);
}
}
}
diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp
index 8b27934..d87864a 100644
--- a/hotspot/src/share/vm/oops/method.hpp
+++ b/hotspot/src/share/vm/oops/method.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -233,6 +233,9 @@
u2 method_idnum() const { return constMethod()->method_idnum(); }
void set_method_idnum(u2 idnum) { constMethod()->set_method_idnum(idnum); }
+ u2 orig_method_idnum() const { return constMethod()->orig_method_idnum(); }
+ void set_orig_method_idnum(u2 idnum) { constMethod()->set_orig_method_idnum(idnum); }
+
// code size
int code_size() const { return constMethod()->code_size(); }
diff --git a/hotspot/src/share/vm/opto/arraycopynode.cpp b/hotspot/src/share/vm/opto/arraycopynode.cpp
new file mode 100644
index 0000000..5542d7f
--- /dev/null
+++ b/hotspot/src/share/vm/opto/arraycopynode.cpp
@@ -0,0 +1,597 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "opto/arraycopynode.hpp"
+#include "opto/graphKit.hpp"
+
+ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
+ : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM),
+ _alloc_tightly_coupled(alloc_tightly_coupled),
+ _kind(None),
+ _arguments_validated(false) {
+ init_class_id(Class_ArrayCopy);
+ init_flags(Flag_is_macro);
+ C->add_macro_node(this);
+}
+
+uint ArrayCopyNode::size_of() const { return sizeof(*this); }
+
+ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
+ Node* src, Node* src_offset,
+ Node* dest, Node* dest_offset,
+ Node* length,
+ bool alloc_tightly_coupled,
+ Node* src_klass, Node* dest_klass,
+ Node* src_length, Node* dest_length) {
+
+ ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled);
+ Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
+
+ ac->init_req(ArrayCopyNode::Src, src);
+ ac->init_req(ArrayCopyNode::SrcPos, src_offset);
+ ac->init_req(ArrayCopyNode::Dest, dest);
+ ac->init_req(ArrayCopyNode::DestPos, dest_offset);
+ ac->init_req(ArrayCopyNode::Length, length);
+ ac->init_req(ArrayCopyNode::SrcLen, src_length);
+ ac->init_req(ArrayCopyNode::DestLen, dest_length);
+ ac->init_req(ArrayCopyNode::SrcKlass, src_klass);
+ ac->init_req(ArrayCopyNode::DestKlass, dest_klass);
+
+ if (may_throw) {
+ ac->set_req(TypeFunc::I_O , kit->i_o());
+ kit->add_safepoint_edges(ac, false);
+ }
+
+ return ac;
+}
+
+void ArrayCopyNode::connect_outputs(GraphKit* kit) {
+ kit->set_all_memory_call(this, true);
+ kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control)));
+ kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O)));
+ kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
+ kit->set_all_memory_call(this);
+}
+
+#ifndef PRODUCT
+const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"};
+void ArrayCopyNode::dump_spec(outputStream *st) const {
+ CallNode::dump_spec(st);
+ st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : "");
+}
+#endif
+
+intptr_t ArrayCopyNode::get_length_if_constant(PhaseGVN *phase) const {
+ // check that length is constant
+ Node* length = in(ArrayCopyNode::Length);
+ const Type* length_type = phase->type(length);
+
+ if (length_type == Type::TOP) {
+ return -1;
+ }
+
+ assert(is_clonebasic() || is_arraycopy() || is_copyof() || is_copyofrange(), "unexpected array copy type");
+
+ return is_clonebasic() ? length->find_intptr_t_con(-1) : length->find_int_con(-1);
+}
+
+int ArrayCopyNode::get_count(PhaseGVN *phase) const {
+ Node* src = in(ArrayCopyNode::Src);
+ const Type* src_type = phase->type(src);
+
+ if (is_clonebasic()) {
+ if (src_type->isa_instptr()) {
+ const TypeInstPtr* inst_src = src_type->is_instptr();
+ ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+ // ciInstanceKlass::nof_nonstatic_fields() doesn't take injected
+ // fields into account. They are rare anyway so easier to simply
+ // skip instances with injected fields.
+ if ((!inst_src->klass_is_exact() && (ik->is_interface() || ik->has_subklass())) || ik->has_injected_fields()) {
+ return -1;
+ }
+ int nb_fields = ik->nof_nonstatic_fields();
+ return nb_fields;
+ } else {
+ const TypeAryPtr* ary_src = src_type->isa_aryptr();
+ assert (ary_src != NULL, "not an array or instance?");
+ // clone passes a length as a rounded number of longs. If we're
+ // cloning an array we'll do it element by element. If the
+ // length input to ArrayCopyNode is constant, length of input
+ // array must be too.
+
+ assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con() ||
+ phase->is_IterGVN(), "inconsistent");
+
+ if (ary_src->size()->is_con()) {
+ return ary_src->size()->get_con();
+ }
+ return -1;
+ }
+ }
+
+ return get_length_if_constant(phase);
+}
+
+Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) {
+ if (!is_clonebasic()) {
+ return NULL;
+ }
+
+ Node* src = in(ArrayCopyNode::Src);
+ Node* dest = in(ArrayCopyNode::Dest);
+ Node* ctl = in(TypeFunc::Control);
+ Node* in_mem = in(TypeFunc::Memory);
+
+ const Type* src_type = phase->type(src);
+
+ assert(src->is_AddP(), "should be base + off");
+ assert(dest->is_AddP(), "should be base + off");
+ Node* base_src = src->in(AddPNode::Base);
+ Node* base_dest = dest->in(AddPNode::Base);
+
+ MergeMemNode* mem = MergeMemNode::make(in_mem);
+
+ const TypeInstPtr* inst_src = src_type->isa_instptr();
+
+ if (inst_src == NULL) {
+ return NULL;
+ }
+
+ if (!inst_src->klass_is_exact()) {
+ ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+ assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy");
+ phase->C->dependencies()->assert_leaf_type(ik);
+ }
+
+ ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+ assert(ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem, "too many fields");
+
+ for (int i = 0; i < count; i++) {
+ ciField* field = ik->nonstatic_field_at(i);
+ int fieldidx = phase->C->alias_type(field)->index();
+ const TypePtr* adr_type = phase->C->alias_type(field)->adr_type();
+ Node* off = phase->MakeConX(field->offset());
+ Node* next_src = phase->transform(new AddPNode(base_src,base_src,off));
+ Node* next_dest = phase->transform(new AddPNode(base_dest,base_dest,off));
+ BasicType bt = field->layout_type();
+
+ const Type *type;
+ if (bt == T_OBJECT) {
+ if (!field->type()->is_loaded()) {
+ type = TypeInstPtr::BOTTOM;
+ } else {
+ ciType* field_klass = field->type();
+ type = TypeOopPtr::make_from_klass(field_klass->as_klass());
+ }
+ } else {
+ type = Type::get_const_basic_type(bt);
+ }
+
+ Node* v = LoadNode::make(*phase, ctl, mem->memory_at(fieldidx), next_src, adr_type, type, bt, MemNode::unordered);
+ v = phase->transform(v);
+ Node* s = StoreNode::make(*phase, ctl, mem->memory_at(fieldidx), next_dest, adr_type, v, bt, MemNode::unordered);
+ s = phase->transform(s);
+ mem->set_memory_at(fieldidx, s);
+ }
+
+ if (!finish_transform(phase, can_reshape, ctl, mem)) {
+ return NULL;
+ }
+
+ return mem;
+}
+
+bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,
+ Node*& adr_src,
+ Node*& base_src,
+ Node*& adr_dest,
+ Node*& base_dest,
+ BasicType& copy_type,
+ const Type*& value_type,
+ bool& disjoint_bases) {
+ Node* src = in(ArrayCopyNode::Src);
+ Node* dest = in(ArrayCopyNode::Dest);
+ const Type* src_type = phase->type(src);
+ const TypeAryPtr* ary_src = src_type->isa_aryptr();
+
+ if (is_arraycopy() || is_copyofrange() || is_copyof()) {
+ const Type* dest_type = phase->type(dest);
+ const TypeAryPtr* ary_dest = dest_type->isa_aryptr();
+ Node* src_offset = in(ArrayCopyNode::SrcPos);
+ Node* dest_offset = in(ArrayCopyNode::DestPos);
+
+ // newly allocated object is guaranteed to not overlap with source object
+ disjoint_bases = is_alloc_tightly_coupled();
+
+ if (ary_src == NULL || ary_src->klass() == NULL ||
+ ary_dest == NULL || ary_dest->klass() == NULL) {
+ // We don't know if arguments are arrays
+ return false;
+ }
+
+ BasicType src_elem = ary_src->klass()->as_array_klass()->element_type()->basic_type();
+ BasicType dest_elem = ary_dest->klass()->as_array_klass()->element_type()->basic_type();
+ if (src_elem == T_ARRAY) src_elem = T_OBJECT;
+ if (dest_elem == T_ARRAY) dest_elem = T_OBJECT;
+
+ if (src_elem != dest_elem || dest_elem == T_VOID) {
+ // We don't know if arguments are arrays of the same type
+ return false;
+ }
+
+ if (dest_elem == T_OBJECT && (!is_alloc_tightly_coupled() || !GraphKit::use_ReduceInitialCardMarks())) {
+ // It's an object array copy but we can't emit the card marking
+ // that is needed
+ return false;
+ }
+
+ value_type = ary_src->elem();
+
+ base_src = src;
+ base_dest = dest;
+
+ uint shift = exact_log2(type2aelembytes(dest_elem));
+ uint header = arrayOopDesc::base_offset_in_bytes(dest_elem);
+
+ adr_src = src;
+ adr_dest = dest;
+
+ src_offset = Compile::conv_I2X_index(phase, src_offset, ary_src->size());
+ dest_offset = Compile::conv_I2X_index(phase, dest_offset, ary_dest->size());
+
+ Node* src_scale = phase->transform(new LShiftXNode(src_offset, phase->intcon(shift)));
+ Node* dest_scale = phase->transform(new LShiftXNode(dest_offset, phase->intcon(shift)));
+
+ adr_src = phase->transform(new AddPNode(base_src, adr_src, src_scale));
+ adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, dest_scale));
+
+ adr_src = new AddPNode(base_src, adr_src, phase->MakeConX(header));
+ adr_dest = new AddPNode(base_dest, adr_dest, phase->MakeConX(header));
+
+ adr_src = phase->transform(adr_src);
+ adr_dest = phase->transform(adr_dest);
+
+ copy_type = dest_elem;
+ } else {
+ assert (is_clonebasic(), "should be");
+
+ disjoint_bases = true;
+ assert(src->is_AddP(), "should be base + off");
+ assert(dest->is_AddP(), "should be base + off");
+ adr_src = src;
+ base_src = src->in(AddPNode::Base);
+ adr_dest = dest;
+ base_dest = dest->in(AddPNode::Base);
+
+ assert(phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con() == phase->type(dest->in(AddPNode::Offset))->is_intptr_t()->get_con(), "same start offset?");
+ BasicType elem = ary_src->klass()->as_array_klass()->element_type()->basic_type();
+ if (elem == T_ARRAY) elem = T_OBJECT;
+
+ int diff = arrayOopDesc::base_offset_in_bytes(elem) - phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con();
+ assert(diff >= 0, "clone should not start after 1st array element");
+ if (diff > 0) {
+ adr_src = phase->transform(new AddPNode(base_src, adr_src, phase->MakeConX(diff)));
+ adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, phase->MakeConX(diff)));
+ }
+
+ copy_type = elem;
+ value_type = ary_src->elem();
+ }
+ return true;
+}
+
+const TypePtr* ArrayCopyNode::get_address_type(PhaseGVN *phase, Node* n) {
+ const Type* at = phase->type(n);
+ assert(at != Type::TOP, "unexpected type");
+ const TypePtr* atp = at->isa_ptr();
+ // adjust atp to be the correct array element address type
+ atp = atp->add_offset(Type::OffsetBot);
+ return atp;
+}
+
+void ArrayCopyNode::array_copy_test_overlap(PhaseGVN *phase, bool can_reshape, bool disjoint_bases, int count, Node*& forward_ctl, Node*& backward_ctl) {
+ Node* ctl = in(TypeFunc::Control);
+ if (!disjoint_bases && count > 1) {
+ Node* src_offset = in(ArrayCopyNode::SrcPos);
+ Node* dest_offset = in(ArrayCopyNode::DestPos);
+ assert(src_offset != NULL && dest_offset != NULL, "should be");
+ Node* cmp = phase->transform(new CmpINode(src_offset, dest_offset));
+ Node *bol = phase->transform(new BoolNode(cmp, BoolTest::lt));
+ IfNode *iff = new IfNode(ctl, bol, PROB_FAIR, COUNT_UNKNOWN);
+
+ phase->transform(iff);
+
+ forward_ctl = phase->transform(new IfFalseNode(iff));
+ backward_ctl = phase->transform(new IfTrueNode(iff));
+ } else {
+ forward_ctl = ctl;
+ }
+}
+
+Node* ArrayCopyNode::array_copy_forward(PhaseGVN *phase,
+ bool can_reshape,
+ Node* forward_ctl,
+ Node* start_mem_src,
+ Node* start_mem_dest,
+ const TypePtr* atp_src,
+ const TypePtr* atp_dest,
+ Node* adr_src,
+ Node* base_src,
+ Node* adr_dest,
+ Node* base_dest,
+ BasicType copy_type,
+ const Type* value_type,
+ int count) {
+ Node* mem = phase->C->top();
+ if (!forward_ctl->is_top()) {
+ // copy forward
+ mem = start_mem_dest;
+
+ if (count > 0) {
+ Node* v = LoadNode::make(*phase, forward_ctl, start_mem_src, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, forward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ for (int i = 1; i < count; i++) {
+ Node* off = phase->MakeConX(type2aelembytes(copy_type) * i);
+ Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
+ Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
+ v = LoadNode::make(*phase, forward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, forward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ }
+ } else if(can_reshape) {
+ PhaseIterGVN* igvn = phase->is_IterGVN();
+ igvn->_worklist.push(adr_src);
+ igvn->_worklist.push(adr_dest);
+ }
+ }
+ return mem;
+}
+
+Node* ArrayCopyNode::array_copy_backward(PhaseGVN *phase,
+ bool can_reshape,
+ Node* backward_ctl,
+ Node* start_mem_src,
+ Node* start_mem_dest,
+ const TypePtr* atp_src,
+ const TypePtr* atp_dest,
+ Node* adr_src,
+ Node* base_src,
+ Node* adr_dest,
+ Node* base_dest,
+ BasicType copy_type,
+ const Type* value_type,
+ int count) {
+ Node* mem = phase->C->top();
+ if (!backward_ctl->is_top()) {
+ // copy backward
+ mem = start_mem_dest;
+
+ if (count > 0) {
+ for (int i = count-1; i >= 1; i--) {
+ Node* off = phase->MakeConX(type2aelembytes(copy_type) * i);
+ Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
+ Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
+ Node* v = LoadNode::make(*phase, backward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, backward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ }
+ Node* v = LoadNode::make(*phase, backward_ctl, mem, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, backward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ } else if(can_reshape) {
+ PhaseIterGVN* igvn = phase->is_IterGVN();
+ igvn->_worklist.push(adr_src);
+ igvn->_worklist.push(adr_dest);
+ }
+ }
+ return mem;
+}
+
+bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
+ Node* ctl, Node *mem) {
+ if (can_reshape) {
+ PhaseIterGVN* igvn = phase->is_IterGVN();
+ igvn->set_delay_transform(false);
+ if (is_clonebasic()) {
+ Node* out_mem = proj_out(TypeFunc::Memory);
+
+ if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() ||
+ out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) {
+ assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking");
+ return false;
+ }
+
+ igvn->replace_node(out_mem->raw_out(0), mem);
+
+ Node* out_ctl = proj_out(TypeFunc::Control);
+ igvn->replace_node(out_ctl, ctl);
+ } else {
+ // replace fallthrough projections of the ArrayCopyNode by the
+ // new memory, control and the input IO.
+ CallProjections callprojs;
+ extract_projections(&callprojs, true);
+
+ igvn->replace_node(callprojs.fallthrough_ioproj, in(TypeFunc::I_O));
+ igvn->replace_node(callprojs.fallthrough_memproj, mem);
+ igvn->replace_node(callprojs.fallthrough_catchproj, ctl);
+
+ // The ArrayCopyNode is not disconnected. It still has the
+ // projections for the exception case. Replace current
+ // ArrayCopyNode with a dummy new one with a top() control so
+ // that this part of the graph stays consistent but is
+ // eventually removed.
+
+ set_req(0, phase->C->top());
+ remove_dead_region(phase, can_reshape);
+ }
+ } else {
+ if (in(TypeFunc::Control) != ctl) {
+ // we can't return new memory and control from Ideal at parse time
+ assert(!is_clonebasic(), "added control for clone?");
+ return false;
+ }
+ }
+ return true;
+}
+
+
+Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+ if (remove_dead_region(phase, can_reshape)) return this;
+
+ if (StressArrayCopyMacroNode && !can_reshape) {
+ phase->record_for_igvn(this);
+ return NULL;
+ }
+
+ // See if it's a small array copy and we can inline it as
+ // loads/stores
+ // Here we can only do:
+ // - arraycopy if all arguments were validated before and we don't
+ // need card marking
+ // - clone for which we don't need to do card marking
+
+ if (!is_clonebasic() && !is_arraycopy_validated() &&
+ !is_copyofrange_validated() && !is_copyof_validated()) {
+ return NULL;
+ }
+
+ assert(in(TypeFunc::Control) != NULL &&
+ in(TypeFunc::Memory) != NULL &&
+ in(ArrayCopyNode::Src) != NULL &&
+ in(ArrayCopyNode::Dest) != NULL &&
+ in(ArrayCopyNode::Length) != NULL &&
+ ((in(ArrayCopyNode::SrcPos) != NULL && in(ArrayCopyNode::DestPos) != NULL) ||
+ is_clonebasic()), "broken inputs");
+
+ if (in(TypeFunc::Control)->is_top() ||
+ in(TypeFunc::Memory)->is_top() ||
+ phase->type(in(ArrayCopyNode::Src)) == Type::TOP ||
+ phase->type(in(ArrayCopyNode::Dest)) == Type::TOP ||
+ (in(ArrayCopyNode::SrcPos) != NULL && in(ArrayCopyNode::SrcPos)->is_top()) ||
+ (in(ArrayCopyNode::DestPos) != NULL && in(ArrayCopyNode::DestPos)->is_top())) {
+ return NULL;
+ }
+
+ int count = get_count(phase);
+
+ if (count < 0 || count > ArrayCopyLoadStoreMaxElem) {
+ return NULL;
+ }
+
+ Node* mem = try_clone_instance(phase, can_reshape, count);
+ if (mem != NULL) {
+ return mem;
+ }
+
+ Node* adr_src = NULL;
+ Node* base_src = NULL;
+ Node* adr_dest = NULL;
+ Node* base_dest = NULL;
+ BasicType copy_type = T_ILLEGAL;
+ const Type* value_type = NULL;
+ bool disjoint_bases = false;
+
+ if (!prepare_array_copy(phase, can_reshape,
+ adr_src, base_src, adr_dest, base_dest,
+ copy_type, value_type, disjoint_bases)) {
+ return NULL;
+ }
+
+ Node* src = in(ArrayCopyNode::Src);
+ Node* dest = in(ArrayCopyNode::Dest);
+ const TypePtr* atp_src = get_address_type(phase, src);
+ const TypePtr* atp_dest = get_address_type(phase, dest);
+ uint alias_idx_src = phase->C->get_alias_index(atp_src);
+ uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
+
+ Node *in_mem = in(TypeFunc::Memory);
+ Node *start_mem_src = in_mem;
+ Node *start_mem_dest = in_mem;
+ if (in_mem->is_MergeMem()) {
+ start_mem_src = in_mem->as_MergeMem()->memory_at(alias_idx_src);
+ start_mem_dest = in_mem->as_MergeMem()->memory_at(alias_idx_dest);
+ }
+
+
+ if (can_reshape) {
+ assert(!phase->is_IterGVN()->delay_transform(), "cannot delay transforms");
+ phase->is_IterGVN()->set_delay_transform(true);
+ }
+
+ Node* backward_ctl = phase->C->top();
+ Node* forward_ctl = phase->C->top();
+ array_copy_test_overlap(phase, can_reshape, disjoint_bases, count, forward_ctl, backward_ctl);
+
+ Node* forward_mem = array_copy_forward(phase, can_reshape, forward_ctl,
+ start_mem_src, start_mem_dest,
+ atp_src, atp_dest,
+ adr_src, base_src, adr_dest, base_dest,
+ copy_type, value_type, count);
+
+ Node* backward_mem = array_copy_backward(phase, can_reshape, backward_ctl,
+ start_mem_src, start_mem_dest,
+ atp_src, atp_dest,
+ adr_src, base_src, adr_dest, base_dest,
+ copy_type, value_type, count);
+
+ Node* ctl = NULL;
+ if (!forward_ctl->is_top() && !backward_ctl->is_top()) {
+ ctl = new RegionNode(3);
+ mem = new PhiNode(ctl, Type::MEMORY, atp_dest);
+ ctl->init_req(1, forward_ctl);
+ mem->init_req(1, forward_mem);
+ ctl->init_req(2, backward_ctl);
+ mem->init_req(2, backward_mem);
+ ctl = phase->transform(ctl);
+ mem = phase->transform(mem);
+ } else if (!forward_ctl->is_top()) {
+ ctl = forward_ctl;
+ mem = forward_mem;
+ } else {
+ assert(!backward_ctl->is_top(), "no copy?");
+ ctl = backward_ctl;
+ mem = backward_mem;
+ }
+
+ if (can_reshape) {
+ assert(phase->is_IterGVN()->delay_transform(), "should be delaying transforms");
+ phase->is_IterGVN()->set_delay_transform(false);
+ }
+
+ MergeMemNode* out_mem = MergeMemNode::make(in_mem);
+ out_mem->set_memory_at(alias_idx_dest, mem);
+ mem = out_mem;
+
+ if (!finish_transform(phase, can_reshape, ctl, mem)) {
+ return NULL;
+ }
+
+ return mem;
+}
diff --git a/hotspot/src/share/vm/opto/arraycopynode.hpp b/hotspot/src/share/vm/opto/arraycopynode.hpp
new file mode 100644
index 0000000..e61f1ba
--- /dev/null
+++ b/hotspot/src/share/vm/opto/arraycopynode.hpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
+#define SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
+
+#include "opto/callnode.hpp"
+
+class GraphKit;
+
+class ArrayCopyNode : public CallNode {
+private:
+
+ // What kind of arraycopy variant is this?
+ enum {
+ None, // not set yet
+ ArrayCopy, // System.arraycopy()
+ CloneBasic, // A clone that can be copied by 64 bit chunks
+ CloneOop, // An oop array clone
+ CopyOf, // Arrays.copyOf()
+ CopyOfRange // Arrays.copyOfRange()
+ } _kind;
+
+#ifndef PRODUCT
+ static const char* _kind_names[CopyOfRange+1];
+#endif
+ // Is the alloc obtained with
+ // AllocateArrayNode::Ideal_array_allocation() tighly coupled
+ // (arraycopy follows immediately the allocation)?
+ // We cache the result of LibraryCallKit::tightly_coupled_allocation
+ // here because it's much easier to find whether there's a tightly
+ // couple allocation at parse time than at macro expansion time. At
+ // macro expansion time, for every use of the allocation node we
+ // would need to figure out whether it happens after the arraycopy (and
+ // can be ignored) or between the allocation and the arraycopy. At
+ // parse time, it's straightforward because whatever happens after
+ // the arraycopy is not parsed yet so doesn't exist when
+ // LibraryCallKit::tightly_coupled_allocation() is called.
+ bool _alloc_tightly_coupled;
+
+ bool _arguments_validated;
+
+ static const TypeFunc* arraycopy_type() {
+ const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
+ fields[Src] = TypeInstPtr::BOTTOM;
+ fields[SrcPos] = TypeInt::INT;
+ fields[Dest] = TypeInstPtr::BOTTOM;
+ fields[DestPos] = TypeInt::INT;
+ fields[Length] = TypeInt::INT;
+ fields[SrcLen] = TypeInt::INT;
+ fields[DestLen] = TypeInt::INT;
+ fields[SrcKlass] = TypeKlassPtr::BOTTOM;
+ fields[DestKlass] = TypeKlassPtr::BOTTOM;
+ const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
+
+ // create result type (range)
+ fields = TypeTuple::fields(0);
+
+ const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
+
+ return TypeFunc::make(domain, range);
+ }
+
+ ArrayCopyNode(Compile* C, bool alloc_tightly_coupled);
+
+ intptr_t get_length_if_constant(PhaseGVN *phase) const;
+ int get_count(PhaseGVN *phase) const;
+ static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
+
+ Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
+ Node* conv_I2X_offset(PhaseGVN *phase, Node* offset, const TypeAryPtr* ary_t);
+ bool prepare_array_copy(PhaseGVN *phase, bool can_reshape,
+ Node*& adr_src, Node*& base_src, Node*& adr_dest, Node*& base_dest,
+ BasicType& copy_type, const Type*& value_type, bool& disjoint_bases);
+ void array_copy_test_overlap(PhaseGVN *phase, bool can_reshape,
+ bool disjoint_bases, int count,
+ Node*& forward_ctl, Node*& backward_ctl);
+ Node* array_copy_forward(PhaseGVN *phase, bool can_reshape, Node* ctl,
+ Node* start_mem_src, Node* start_mem_dest,
+ const TypePtr* atp_src, const TypePtr* atp_dest,
+ Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
+ BasicType copy_type, const Type* value_type, int count);
+ Node* array_copy_backward(PhaseGVN *phase, bool can_reshape, Node* ctl,
+ Node *start_mem_src, Node* start_mem_dest,
+ const TypePtr* atp_src, const TypePtr* atp_dest,
+ Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
+ BasicType copy_type, const Type* value_type, int count);
+ bool finish_transform(PhaseGVN *phase, bool can_reshape,
+ Node* ctl, Node *mem);
+
+public:
+
+ enum {
+ Src = TypeFunc::Parms,
+ SrcPos,
+ Dest,
+ DestPos,
+ Length,
+ SrcLen,
+ DestLen,
+ SrcKlass,
+ DestKlass,
+ ParmLimit
+ };
+
+ static ArrayCopyNode* make(GraphKit* kit, bool may_throw,
+ Node* src, Node* src_offset,
+ Node* dest, Node* dest_offset,
+ Node* length,
+ bool alloc_tightly_coupled,
+ Node* src_klass = NULL, Node* dest_klass = NULL,
+ Node* src_length = NULL, Node* dest_length = NULL);
+
+ void connect_outputs(GraphKit* kit);
+
+ bool is_arraycopy() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
+ bool is_arraycopy_validated() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
+ bool is_clonebasic() const { assert(_kind != None, "should bet set"); return _kind == CloneBasic; }
+ bool is_cloneoop() const { assert(_kind != None, "should bet set"); return _kind == CloneOop; }
+ bool is_copyof() const { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
+ bool is_copyof_validated() const { assert(_kind != None, "should bet set"); return _kind == CopyOf && _arguments_validated; }
+ bool is_copyofrange() const { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
+ bool is_copyofrange_validated() const { assert(_kind != None, "should bet set"); return _kind == CopyOfRange && _arguments_validated; }
+
+ void set_arraycopy(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
+ void set_clonebasic() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; }
+ void set_cloneoop() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; }
+ void set_copyof(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = validated; }
+ void set_copyofrange(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = validated; }
+
+ virtual int Opcode() const;
+ virtual uint size_of() const; // Size is bigger
+ virtual bool guaranteed_safepoint() { return false; }
+ virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
+
+ bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
+
+#ifndef PRODUCT
+ virtual void dump_spec(outputStream *st) const;
+#endif
+};
+
+#endif // SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp
index a5f173e..46975b5 100644
--- a/hotspot/src/share/vm/opto/callnode.cpp
+++ b/hotspot/src/share/vm/opto/callnode.cpp
@@ -1875,194 +1875,3 @@
log->tail(tag);
}
}
-
-ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
- : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM),
- _alloc_tightly_coupled(alloc_tightly_coupled),
- _kind(None),
- _arguments_validated(false) {
- init_class_id(Class_ArrayCopy);
- init_flags(Flag_is_macro);
- C->add_macro_node(this);
-}
-
-uint ArrayCopyNode::size_of() const { return sizeof(*this); }
-
-ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
- Node* src, Node* src_offset,
- Node* dest, Node* dest_offset,
- Node* length,
- bool alloc_tightly_coupled,
- Node* src_klass, Node* dest_klass,
- Node* src_length, Node* dest_length) {
-
- ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled);
- Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
-
- ac->init_req(ArrayCopyNode::Src, src);
- ac->init_req(ArrayCopyNode::SrcPos, src_offset);
- ac->init_req(ArrayCopyNode::Dest, dest);
- ac->init_req(ArrayCopyNode::DestPos, dest_offset);
- ac->init_req(ArrayCopyNode::Length, length);
- ac->init_req(ArrayCopyNode::SrcLen, src_length);
- ac->init_req(ArrayCopyNode::DestLen, dest_length);
- ac->init_req(ArrayCopyNode::SrcKlass, src_klass);
- ac->init_req(ArrayCopyNode::DestKlass, dest_klass);
-
- if (may_throw) {
- ac->set_req(TypeFunc::I_O , kit->i_o());
- kit->add_safepoint_edges(ac, false);
- }
-
- return ac;
-}
-
-void ArrayCopyNode::connect_outputs(GraphKit* kit) {
- kit->set_all_memory_call(this, true);
- kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control)));
- kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O)));
- kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
- kit->set_all_memory_call(this);
-}
-
-#ifndef PRODUCT
-const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"};
-void ArrayCopyNode::dump_spec(outputStream *st) const {
- CallNode::dump_spec(st);
- st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : "");
-}
-#endif
-
-int ArrayCopyNode::get_count(PhaseGVN *phase) const {
- Node* src = in(ArrayCopyNode::Src);
- const Type* src_type = phase->type(src);
-
- assert(is_clonebasic(), "unexpected arraycopy type");
- if (src_type->isa_instptr()) {
- const TypeInstPtr* inst_src = src_type->is_instptr();
- ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
- // ciInstanceKlass::nof_nonstatic_fields() doesn't take injected
- // fields into account. They are rare anyway so easier to simply
- // skip instances with injected fields.
- if ((!inst_src->klass_is_exact() && (ik->is_interface() || ik->has_subklass())) || ik->has_injected_fields()) {
- return -1;
- }
- int nb_fields = ik->nof_nonstatic_fields();
- return nb_fields;
- }
- return -1;
-}
-
-Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) {
- assert(is_clonebasic(), "unexpected arraycopy type");
-
- Node* src = in(ArrayCopyNode::Src);
- Node* dest = in(ArrayCopyNode::Dest);
- Node* ctl = in(TypeFunc::Control);
- Node* in_mem = in(TypeFunc::Memory);
-
- const Type* src_type = phase->type(src);
- const Type* dest_type = phase->type(dest);
-
- assert(src->is_AddP(), "should be base + off");
- assert(dest->is_AddP(), "should be base + off");
- Node* base_src = src->in(AddPNode::Base);
- Node* base_dest = dest->in(AddPNode::Base);
-
- MergeMemNode* mem = MergeMemNode::make(in_mem);
-
- const TypeInstPtr* inst_src = src_type->is_instptr();
-
- if (!inst_src->klass_is_exact()) {
- ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
- assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy");
- phase->C->dependencies()->assert_leaf_type(ik);
- }
-
- ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
- assert(ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem, "too many fields");
-
- for (int i = 0; i < count; i++) {
- ciField* field = ik->nonstatic_field_at(i);
- int fieldidx = phase->C->alias_type(field)->index();
- const TypePtr* adr_type = phase->C->alias_type(field)->adr_type();
- Node* off = phase->MakeConX(field->offset());
- Node* next_src = phase->transform(new AddPNode(base_src,base_src,off));
- Node* next_dest = phase->transform(new AddPNode(base_dest,base_dest,off));
- BasicType bt = field->layout_type();
-
- const Type *type;
- if (bt == T_OBJECT) {
- if (!field->type()->is_loaded()) {
- type = TypeInstPtr::BOTTOM;
- } else {
- ciType* field_klass = field->type();
- type = TypeOopPtr::make_from_klass(field_klass->as_klass());
- }
- } else {
- type = Type::get_const_basic_type(bt);
- }
-
- Node* v = LoadNode::make(*phase, ctl, mem->memory_at(fieldidx), next_src, adr_type, type, bt, MemNode::unordered);
- v = phase->transform(v);
- Node* s = StoreNode::make(*phase, ctl, mem->memory_at(fieldidx), next_dest, adr_type, v, bt, MemNode::unordered);
- s = phase->transform(s);
- mem->set_memory_at(fieldidx, s);
- }
-
- if (!finish_transform(phase, can_reshape, ctl, mem)) {
- return NULL;
- }
-
- return mem;
-}
-
-bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
- Node* ctl, Node *mem) {
- if (can_reshape) {
- PhaseIterGVN* igvn = phase->is_IterGVN();
- assert(is_clonebasic(), "unexpected arraycopy type");
- Node* out_mem = proj_out(TypeFunc::Memory);
-
- if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() ||
- out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) {
- assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking");
- return false;
- }
-
- igvn->replace_node(out_mem->raw_out(0), mem);
-
- Node* out_ctl = proj_out(TypeFunc::Control);
- igvn->replace_node(out_ctl, ctl);
- }
- return true;
-}
-
-
-Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
- if (remove_dead_region(phase, can_reshape)) return this;
-
- if (StressArrayCopyMacroNode && !can_reshape) return NULL;
-
- // See if it's a small array copy and we can inline it as
- // loads/stores
- // Here we can only do:
- // - clone for which we don't need to do card marking
-
- if (!is_clonebasic()) {
- return NULL;
- }
-
- if (in(TypeFunc::Control)->is_top() || in(TypeFunc::Memory)->is_top()) {
- return NULL;
- }
-
- int count = get_count(phase);
-
- if (count < 0 || count > ArrayCopyLoadStoreMaxElem) {
- return NULL;
- }
-
- Node* mem = try_clone_instance(phase, can_reshape, count);
- return mem;
-}
diff --git a/hotspot/src/share/vm/opto/callnode.hpp b/hotspot/src/share/vm/opto/callnode.hpp
index 66ea270..26f5c6b 100644
--- a/hotspot/src/share/vm/opto/callnode.hpp
+++ b/hotspot/src/share/vm/opto/callnode.hpp
@@ -1083,117 +1083,4 @@
#endif
};
-class GraphKit;
-
-class ArrayCopyNode : public CallNode {
-private:
-
- // What kind of arraycopy variant is this?
- enum {
- None, // not set yet
- ArrayCopy, // System.arraycopy()
- CloneBasic, // A clone that can be copied by 64 bit chunks
- CloneOop, // An oop array clone
- CopyOf, // Arrays.copyOf()
- CopyOfRange // Arrays.copyOfRange()
- } _kind;
-
-#ifndef PRODUCT
- static const char* _kind_names[CopyOfRange+1];
-#endif
- // Is the alloc obtained with
- // AllocateArrayNode::Ideal_array_allocation() tighly coupled
- // (arraycopy follows immediately the allocation)?
- // We cache the result of LibraryCallKit::tightly_coupled_allocation
- // here because it's much easier to find whether there's a tightly
- // couple allocation at parse time than at macro expansion time. At
- // macro expansion time, for every use of the allocation node we
- // would need to figure out whether it happens after the arraycopy (and
- // can be ignored) or between the allocation and the arraycopy. At
- // parse time, it's straightforward because whatever happens after
- // the arraycopy is not parsed yet so doesn't exist when
- // LibraryCallKit::tightly_coupled_allocation() is called.
- bool _alloc_tightly_coupled;
-
- bool _arguments_validated;
-
- static const TypeFunc* arraycopy_type() {
- const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
- fields[Src] = TypeInstPtr::BOTTOM;
- fields[SrcPos] = TypeInt::INT;
- fields[Dest] = TypeInstPtr::BOTTOM;
- fields[DestPos] = TypeInt::INT;
- fields[Length] = TypeInt::INT;
- fields[SrcLen] = TypeInt::INT;
- fields[DestLen] = TypeInt::INT;
- fields[SrcKlass] = TypeKlassPtr::BOTTOM;
- fields[DestKlass] = TypeKlassPtr::BOTTOM;
- const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
-
- // create result type (range)
- fields = TypeTuple::fields(0);
-
- const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
-
- return TypeFunc::make(domain, range);
- }
-
- ArrayCopyNode(Compile* C, bool alloc_tightly_coupled);
-
- int get_count(PhaseGVN *phase) const;
- static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
-
- Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
- bool finish_transform(PhaseGVN *phase, bool can_reshape,
- Node* ctl, Node *mem);
-
-public:
-
- enum {
- Src = TypeFunc::Parms,
- SrcPos,
- Dest,
- DestPos,
- Length,
- SrcLen,
- DestLen,
- SrcKlass,
- DestKlass,
- ParmLimit
- };
-
- static ArrayCopyNode* make(GraphKit* kit, bool may_throw,
- Node* src, Node* src_offset,
- Node* dest, Node* dest_offset,
- Node* length,
- bool alloc_tightly_coupled,
- Node* src_klass = NULL, Node* dest_klass = NULL,
- Node* src_length = NULL, Node* dest_length = NULL);
-
- void connect_outputs(GraphKit* kit);
-
- bool is_arraycopy() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
- bool is_arraycopy_validated() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
- bool is_clonebasic() const { assert(_kind != None, "should bet set"); return _kind == CloneBasic; }
- bool is_cloneoop() const { assert(_kind != None, "should bet set"); return _kind == CloneOop; }
- bool is_copyof() const { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
- bool is_copyofrange() const { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
-
- void set_arraycopy(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
- void set_clonebasic() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; }
- void set_cloneoop() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; }
- void set_copyof() { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = false; }
- void set_copyofrange() { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = false; }
-
- virtual int Opcode() const;
- virtual uint size_of() const; // Size is bigger
- virtual bool guaranteed_safepoint() { return false; }
- virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
-
- bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
-
-#ifndef PRODUCT
- virtual void dump_spec(outputStream *st) const;
-#endif
-};
#endif // SHARE_VM_OPTO_CALLNODE_HPP
diff --git a/hotspot/src/share/vm/opto/classes.cpp b/hotspot/src/share/vm/opto/classes.cpp
index a311392..cf63ea1 100644
--- a/hotspot/src/share/vm/opto/classes.cpp
+++ b/hotspot/src/share/vm/opto/classes.cpp
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "opto/addnode.hpp"
+#include "opto/arraycopynode.hpp"
#include "opto/callnode.hpp"
#include "opto/castnode.hpp"
#include "opto/cfgnode.hpp"
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index 62fb82b..bbdb43e 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -42,6 +42,7 @@
#include "opto/chaitin.hpp"
#include "opto/compile.hpp"
#include "opto/connode.hpp"
+#include "opto/convertnode.hpp"
#include "opto/divnode.hpp"
#include "opto/escape.hpp"
#include "opto/idealGraphPrinter.hpp"
@@ -3867,6 +3868,26 @@
return SSC_full_test;
}
+Node* Compile::conv_I2X_index(PhaseGVN *phase, Node* idx, const TypeInt* sizetype) {
+#ifdef _LP64
+ // The scaled index operand to AddP must be a clean 64-bit value.
+ // Java allows a 32-bit int to be incremented to a negative
+ // value, which appears in a 64-bit register as a large
+ // positive number. Using that large positive number as an
+ // operand in pointer arithmetic has bad consequences.
+ // On the other hand, 32-bit overflow is rare, and the possibility
+ // can often be excluded, if we annotate the ConvI2L node with
+ // a type assertion that its value is known to be a small positive
+ // number. (The prior range check has ensured this.)
+ // This assertion is used by ConvI2LNode::Ideal.
+ int index_max = max_jint - 1; // array size is max_jint, index is one less
+ if (sizetype != NULL) index_max = sizetype->_hi - 1;
+ const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
+ idx = phase->transform(new ConvI2LNode(idx, lidxtype));
+#endif
+ return idx;
+}
+
// The message about the current inlining is accumulated in
// _print_inlining_stream and transfered into the _print_inlining_list
// once we know whether inlining succeeds or not. For regular
diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp
index c901da0..2b9c334 100644
--- a/hotspot/src/share/vm/opto/compile.hpp
+++ b/hotspot/src/share/vm/opto/compile.hpp
@@ -74,6 +74,7 @@
class JVMState;
class Type;
class TypeData;
+class TypeInt;
class TypePtr;
class TypeOopPtr;
class TypeFunc;
@@ -1221,6 +1222,8 @@
enum { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
int static_subtype_check(ciKlass* superk, ciKlass* subk);
+ static Node* conv_I2X_index(PhaseGVN *phase, Node* offset, const TypeInt* sizetype);
+
// Auxiliary method for randomized fuzzing/stressing
static bool randomized_select(int count);
};
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index 7865ccc..5a90b50 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -1660,22 +1660,7 @@
// must be correct type for alignment purposes
Node* base = basic_plus_adr(ary, header);
-#ifdef _LP64
- // The scaled index operand to AddP must be a clean 64-bit value.
- // Java allows a 32-bit int to be incremented to a negative
- // value, which appears in a 64-bit register as a large
- // positive number. Using that large positive number as an
- // operand in pointer arithmetic has bad consequences.
- // On the other hand, 32-bit overflow is rare, and the possibility
- // can often be excluded, if we annotate the ConvI2L node with
- // a type assertion that its value is known to be a small positive
- // number. (The prior range check has ensured this.)
- // This assertion is used by ConvI2LNode::Ideal.
- int index_max = max_jint - 1; // array size is max_jint, index is one less
- if (sizetype != NULL) index_max = sizetype->_hi - 1;
- const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
- idx = _gvn.transform( new ConvI2LNode(idx, lidxtype) );
-#endif
+ idx = Compile::conv_I2X_index(&_gvn, idx, sizetype);
Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) );
return basic_plus_adr(ary, base, scale);
}
@@ -3759,7 +3744,8 @@
Node* GraphKit::byte_map_base_node() {
// Get base of card map
- CardTableModRefBS* ct = (CardTableModRefBS*)(Universe::heap()->barrier_set());
+ CardTableModRefBS* ct =
+ barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust users of this code");
if (ct->byte_map_base != NULL) {
return makecon(TypeRawPtr::make((address)ct->byte_map_base));
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index 3c909e7..e1fc843 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -30,6 +30,7 @@
#include "compiler/compileLog.hpp"
#include "oops/objArrayKlass.hpp"
#include "opto/addnode.hpp"
+#include "opto/arraycopynode.hpp"
#include "opto/callGenerator.hpp"
#include "opto/castnode.hpp"
#include "opto/cfgnode.hpp"
@@ -3867,26 +3868,65 @@
Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
- newcopy = new_array(klass_node, length, 0); // no arguments to push
-
// Generate a direct call to the right arraycopy function(s).
// We know the copy is disjoint but we might not know if the
// oop stores need checking.
// Extreme case: Arrays.copyOf((Integer[])x, 10, String[].class).
// This will fail a store-check if x contains any non-nulls.
- Node* alloc = tightly_coupled_allocation(newcopy, NULL);
+ // ArrayCopyNode:Ideal may transform the ArrayCopyNode to
+ // loads/stores but it is legal only if we're sure the
+ // Arrays.copyOf would succeed. So we need all input arguments
+ // to the copyOf to be validated, including that the copy to the
+ // new array won't trigger an ArrayStoreException. That subtype
+ // check can be optimized if we know something on the type of
+ // the input array from type speculation.
+ if (_gvn.type(klass_node)->singleton()) {
+ ciKlass* subk = _gvn.type(load_object_klass(original))->is_klassptr()->klass();
+ ciKlass* superk = _gvn.type(klass_node)->is_klassptr()->klass();
- ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, alloc != NULL,
+ int test = C->static_subtype_check(superk, subk);
+ if (test != Compile::SSC_always_true && test != Compile::SSC_always_false) {
+ const TypeOopPtr* t_original = _gvn.type(original)->is_oopptr();
+ if (t_original->speculative_type() != NULL) {
+ original = maybe_cast_profiled_obj(original, t_original->speculative_type(), true);
+ }
+ }
+ }
+
+ bool validated = false;
+ // Reason_class_check rather than Reason_intrinsic because we
+ // want to intrinsify even if this traps.
+ if (!too_many_traps(Deoptimization::Reason_class_check)) {
+ Node* not_subtype_ctrl = gen_subtype_check(load_object_klass(original),
+ klass_node);
+
+ if (not_subtype_ctrl != top()) {
+ PreserveJVMState pjvms(this);
+ set_control(not_subtype_ctrl);
+ uncommon_trap(Deoptimization::Reason_class_check,
+ Deoptimization::Action_make_not_entrant);
+ assert(stopped(), "Should be stopped");
+ }
+ validated = true;
+ }
+
+ newcopy = new_array(klass_node, length, 0); // no arguments to push
+
+ ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, true,
load_object_klass(original), klass_node);
if (!is_copyOfRange) {
- ac->set_copyof();
+ ac->set_copyof(validated);
} else {
- ac->set_copyofrange();
+ ac->set_copyofrange(validated);
}
Node* n = _gvn.transform(ac);
- assert(n == ac, "cannot disappear");
- ac->connect_outputs(this);
+ if (n == ac) {
+ ac->connect_outputs(this);
+ } else {
+ assert(validated, "shouldn't transform if all arguments not validated");
+ set_all_memory(n);
+ }
}
} // original reexecute is set back here
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
index f61e335..d0e31cf 100644
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
@@ -2032,7 +2032,7 @@
// Hopefully, compiler will optimize for powers of 2.
Node *ctrl = get_ctrl(main_limit);
Node *stride = cl->stride();
- Node *init = cl->init_trip();
+ Node *init = cl->init_trip()->uncast();
Node *span = new SubINode(main_limit,init);
register_new_node(span,ctrl);
Node *rndup = _igvn.intcon(stride_con + ((stride_con>0)?-1:1));
diff --git a/hotspot/src/share/vm/opto/macroArrayCopy.cpp b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
index 503bd44..d6f0cae 100644
--- a/hotspot/src/share/vm/opto/macroArrayCopy.cpp
+++ b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "opto/arraycopynode.hpp"
#include "oops/objArrayKlass.hpp"
#include "opto/convertnode.hpp"
#include "opto/graphKit.hpp"
@@ -519,7 +520,7 @@
// Test S[] against D[], not S against D, because (probably)
// the secondary supertype cache is less busy for S[] than S.
// This usually only matters when D is an interface.
- Node* not_subtype_ctrl = ac->is_arraycopy_validated() ? top() :
+ Node* not_subtype_ctrl = (ac->is_arraycopy_validated() || ac->is_copyof_validated() || ac->is_copyofrange_validated()) ? top() :
Phase::gen_subtype_check(src_klass, dest_klass, ctrl, mem, &_igvn);
// Plug failing path into checked_oop_disjoint_arraycopy
if (not_subtype_ctrl != top()) {
diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp
index aa28426..a6e95fe 100644
--- a/hotspot/src/share/vm/opto/type.cpp
+++ b/hotspot/src/share/vm/opto/type.cpp
@@ -974,21 +974,10 @@
//------------------------------eq---------------------------------------------
// Structural equality check for Type representations
-bool TypeF::eq( const Type *t ) const {
- if( g_isnan(_f) ||
- g_isnan(t->getf()) ) {
- // One or both are NANs. If both are NANs return true, else false.
- return (g_isnan(_f) && g_isnan(t->getf()));
- }
- if (_f == t->getf()) {
- // (NaN is impossible at this point, since it is not equal even to itself)
- if (_f == 0.0) {
- // difference between positive and negative zero
- if (jint_cast(_f) != jint_cast(t->getf())) return false;
- }
- return true;
- }
- return false;
+bool TypeF::eq(const Type *t) const {
+ // Bitwise comparison to distinguish between +/-0. These values must be treated
+ // as different to be consistent with C1 and the interpreter.
+ return (jint_cast(_f) == jint_cast(t->getf()));
}
//------------------------------hash-------------------------------------------
@@ -1089,21 +1078,10 @@
//------------------------------eq---------------------------------------------
// Structural equality check for Type representations
-bool TypeD::eq( const Type *t ) const {
- if( g_isnan(_d) ||
- g_isnan(t->getd()) ) {
- // One or both are NANs. If both are NANs return true, else false.
- return (g_isnan(_d) && g_isnan(t->getd()));
- }
- if (_d == t->getd()) {
- // (NaN is impossible at this point, since it is not equal even to itself)
- if (_d == 0.0) {
- // difference between positive and negative zero
- if (jlong_cast(_d) != jlong_cast(t->getd())) return false;
- }
- return true;
- }
- return false;
+bool TypeD::eq(const Type *t) const {
+ // Bitwise comparison to distinguish between +/-0. These values must be treated
+ // as different to be consistent with C1 and the interpreter.
+ return (jlong_cast(_d) == jlong_cast(t->getd()));
}
//------------------------------hash-------------------------------------------
diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
index 50c3806..b5e5f64 100644
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
@@ -782,9 +782,13 @@
Method* idnum_owner = scratch_class->method_with_idnum(old_num);
if (idnum_owner != NULL) {
// There is already a method assigned this idnum -- switch them
+ // Take current and original idnum from the new_method
idnum_owner->set_method_idnum(new_num);
+ idnum_owner->set_orig_method_idnum(k_new_method->orig_method_idnum());
}
+ // Take current and original idnum from the old_method
k_new_method->set_method_idnum(old_num);
+ k_new_method->set_orig_method_idnum(k_old_method->orig_method_idnum());
if (thread->has_pending_exception()) {
return JVMTI_ERROR_OUT_OF_MEMORY;
}
@@ -817,9 +821,12 @@
Method* idnum_owner = scratch_class->method_with_idnum(num);
if (idnum_owner != NULL) {
// There is already a method assigned this idnum -- switch them
+ // Take current and original idnum from the new_method
idnum_owner->set_method_idnum(new_num);
+ idnum_owner->set_orig_method_idnum(k_new_method->orig_method_idnum());
}
k_new_method->set_method_idnum(num);
+ k_new_method->set_orig_method_idnum(num);
if (thread->has_pending_exception()) {
return JVMTI_ERROR_OUT_OF_MEMORY;
}
@@ -3327,6 +3334,7 @@
// This is a very busy routine. We don't want too much tracing
// printed out.
bool trace_name_printed = false;
+ InstanceKlass *the_class = InstanceKlass::cast(_the_class_oop);
// Very noisy: only enable this call if you are trying to determine
// that a specific class gets found by this routine.
@@ -3338,10 +3346,8 @@
// If the class being redefined is java.lang.Object, we need to fix all
// array class vtables also
if (k->oop_is_array() && _the_class_oop == SystemDictionary::Object_klass()) {
- k->vtable()->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+ k->vtable()->adjust_method_entries(the_class, &trace_name_printed);
+
} else if (k->oop_is_instance()) {
HandleMark hm(_thread);
InstanceKlass *ik = InstanceKlass::cast(k);
@@ -3383,14 +3389,9 @@
|| ik->is_subtype_of(_the_class_oop))) {
// ik->vtable() creates a wrapper object; rm cleans it up
ResourceMark rm(_thread);
- ik->vtable()->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
- ik->adjust_default_methods(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+
+ ik->vtable()->adjust_method_entries(the_class, &trace_name_printed);
+ ik->adjust_default_methods(the_class, &trace_name_printed);
}
// If the current class has an itable and we are either redefining an
@@ -3405,10 +3406,8 @@
|| ik->is_subclass_of(_the_class_oop))) {
// ik->itable() creates a wrapper object; rm cleans it up
ResourceMark rm(_thread);
- ik->itable()->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+
+ ik->itable()->adjust_method_entries(the_class, &trace_name_printed);
}
// The constant pools in other classes (other_cp) can refer to
@@ -3432,10 +3431,7 @@
other_cp = constantPoolHandle(ik->constants());
cp_cache = other_cp->cache();
if (cp_cache != NULL) {
- cp_cache->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+ cp_cache->adjust_method_entries(the_class, &trace_name_printed);
}
}
@@ -3578,6 +3574,7 @@
// obsolete methods need a unique idnum so they become new entries in
// the jmethodID cache in InstanceKlass
+ assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
if (num != ConstMethod::UNSET_IDNUM) {
old_method->set_method_idnum(num);
diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
index eb83161..5ac9413 100644
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
@@ -289,7 +289,12 @@
// Create MDO if necessary.
void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) {
- if (mh->is_native() || mh->is_abstract() || mh->is_accessor()) return;
+ if (mh->is_native() ||
+ mh->is_abstract() ||
+ mh->is_accessor() ||
+ mh->is_constant_getter()) {
+ return;
+ }
if (mh->method_data() == NULL) {
Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
}
diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp
index 52018be..0263a50 100644
--- a/hotspot/src/share/vm/runtime/java.cpp
+++ b/hotspot/src/share/vm/runtime/java.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -421,9 +421,11 @@
os::infinite_sleep();
}
- // Terminate watcher thread - must before disenrolling any periodic task
- if (PeriodicTask::num_tasks() > 0)
+ // Stop the WatcherThread. We do this before disenrolling various
+ // PeriodicTasks to reduce the likelihood of races.
+ if (PeriodicTask::num_tasks() > 0) {
WatcherThread::stop();
+ }
// Print statistics gathered (profiling ...)
if (Arguments::has_profile()) {
diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp
index d2a9ff9..c059be0 100644
--- a/hotspot/src/share/vm/runtime/sweeper.cpp
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp
@@ -724,6 +724,7 @@
// state of the code cache if it's requested.
void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
if (PrintMethodFlushing) {
+ ResourceMark rm;
stringStream s;
// Dump code cache state into a buffer before locking the tty,
// because log_state() will use locks causing lock conflicts.
@@ -741,6 +742,7 @@
}
if (LogCompilation && (xtty != NULL)) {
+ ResourceMark rm;
stringStream s;
// Dump code cache state into a buffer before locking the tty,
// because log_state() will use locks causing lock conflicts.
diff --git a/hotspot/src/share/vm/runtime/task.cpp b/hotspot/src/share/vm/runtime/task.cpp
index 0e6378c..de12a94 100644
--- a/hotspot/src/share/vm/runtime/task.cpp
+++ b/hotspot/src/share/vm/runtime/task.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@
#endif
void PeriodicTask::real_time_tick(int delay_time) {
+ assert(Thread::current()->is_Watcher_thread(), "must be WatcherThread");
+
#ifndef PRODUCT
if (ProfilerCheckIntervals) {
_ticks++;
@@ -60,6 +62,8 @@
#endif
{
+ // The WatcherThread does not participate in the safepoint protocol
+ // for the PeriodicTask_lock because it is not a JavaThread.
MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
int orig_num_tasks = _num_tasks;
@@ -74,8 +78,7 @@
}
int PeriodicTask::time_to_wait() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
- NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+ assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
if (_num_tasks == 0) {
return 0; // sleep until shutdown or a task is enrolled
@@ -98,14 +101,19 @@
}
PeriodicTask::~PeriodicTask() {
+ // This PeriodicTask may have already been disenrolled by a call
+ // to disenroll() before the PeriodicTask was deleted.
disenroll();
}
-/* enroll could be called from a JavaThread, so we have to check for
- * safepoint when taking the lock to avoid deadlocking */
+// enroll the current PeriodicTask
void PeriodicTask::enroll() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
- NULL : PeriodicTask_lock);
+ // Follow normal safepoint aware lock enter protocol if the caller does
+ // not already own the PeriodicTask_lock. Otherwise, we don't try to
+ // enter it again because VM internal Mutexes do not support recursion.
+ //
+ MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
+ : PeriodicTask_lock);
if (_num_tasks == PeriodicTask::max_tasks) {
fatal("Overflow in PeriodicTask table");
@@ -113,18 +121,21 @@
_tasks[_num_tasks++] = this;
WatcherThread* thread = WatcherThread::watcher_thread();
- if (thread) {
+ if (thread != NULL) {
thread->unpark();
} else {
WatcherThread::start();
}
}
-/* disenroll could be called from a JavaThread, so we have to check for
- * safepoint when taking the lock to avoid deadlocking */
+// disenroll the current PeriodicTask
void PeriodicTask::disenroll() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
- NULL : PeriodicTask_lock);
+ // Follow normal safepoint aware lock enter protocol if the caller does
+ // not already own the PeriodicTask_lock. Otherwise, we don't try to
+ // enter it again because VM internal Mutexes do not support recursion.
+ //
+ MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
+ : PeriodicTask_lock);
int index;
for(index = 0; index < _num_tasks && _tasks[index] != this; index++)
diff --git a/hotspot/src/share/vm/runtime/task.hpp b/hotspot/src/share/vm/runtime/task.hpp
index 5fc8c16..c7181089 100644
--- a/hotspot/src/share/vm/runtime/task.hpp
+++ b/hotspot/src/share/vm/runtime/task.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@
static int _num_tasks;
static PeriodicTask* _tasks[PeriodicTask::max_tasks];
+ // Can only be called by the WatcherThread
static void real_time_tick(int delay_time);
#ifndef PRODUCT
@@ -98,6 +99,7 @@
// Calculate when the next periodic task will fire.
// Called by the WatcherThread's run method.
+ // Requires the PeriodicTask_lock.
static int time_to_wait();
// The task to perform at each period
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 00e5f80..63d00e0 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -1161,6 +1161,10 @@
va_end(ap);
}
+void NamedThread::initialize_named_thread() {
+ set_native_thread_name(name());
+}
+
void NamedThread::print_on(outputStream* st) const {
st->print("\"%s\" ", name());
Thread::print_on(st);
@@ -1197,8 +1201,15 @@
}
int WatcherThread::sleep() const {
+ // The WatcherThread does not participate in the safepoint protocol
+ // for the PeriodicTask_lock because it is not a JavaThread.
MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+ if (_should_terminate) {
+ // check for termination before we do any housekeeping or wait
+ return 0; // we did not sleep.
+ }
+
// remaining will be zero if there are no tasks,
// causing the WatcherThread to sleep until a task is
// enrolled
@@ -1211,8 +1222,9 @@
jlong time_before_loop = os::javaTimeNanos();
- for (;;) {
- bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag, remaining);
+ while (true) {
+ bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag,
+ remaining);
jlong now = os::javaTimeNanos();
if (remaining == 0) {
@@ -1253,7 +1265,7 @@
this->initialize_thread_local_storage();
this->set_native_thread_name(this->name());
this->set_active_handles(JNIHandleBlock::allocate_block());
- while (!_should_terminate) {
+ while (true) {
assert(watcher_thread() == Thread::current(), "thread consistency check");
assert(watcher_thread() == this, "thread consistency check");
@@ -1289,6 +1301,11 @@
}
}
+ if (_should_terminate) {
+ // check for termination before posting the next tick
+ break;
+ }
+
PeriodicTask::real_time_tick(time_waited);
}
@@ -1319,27 +1336,19 @@
}
void WatcherThread::stop() {
- // Get the PeriodicTask_lock if we can. If we cannot, then the
- // WatcherThread is using it and we don't want to block on that lock
- // here because that might cause a safepoint deadlock depending on
- // what the current WatcherThread tasks are doing.
- bool have_lock = PeriodicTask_lock->try_lock();
+ {
+ // Follow normal safepoint aware lock enter protocol since the
+ // WatcherThread is stopped by another JavaThread.
+ MutexLocker ml(PeriodicTask_lock);
+ _should_terminate = true;
- _should_terminate = true;
- OrderAccess::fence(); // ensure WatcherThread sees update in main loop
-
- if (have_lock) {
WatcherThread* watcher = watcher_thread();
if (watcher != NULL) {
- // If we managed to get the lock, then we should unpark the
- // WatcherThread so that it can see we want it to stop.
+ // unpark the WatcherThread so it can see that it should terminate
watcher->unpark();
}
-
- PeriodicTask_lock->unlock();
}
- // it is ok to take late safepoints here, if needed
MutexLocker mu(Terminator_lock);
while (watcher_thread() != NULL) {
@@ -1359,9 +1368,7 @@
}
void WatcherThread::unpark() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self()
- ? NULL
- : PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+ assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
PeriodicTask_lock->notify();
}
@@ -3558,8 +3565,8 @@
}
{
- MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
- // Make sure the watcher thread can be started by WatcherThread::start()
+ MutexLocker ml(PeriodicTask_lock);
+ // Make sure the WatcherThread can be started by WatcherThread::start()
// or by dynamic enrollment.
WatcherThread::make_startable();
// Start up the WatcherThread if there are any periodic tasks
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index d49fdff..e3c22d4 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -667,6 +667,7 @@
~NamedThread();
// May only be called once per thread.
void set_name(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+ void initialize_named_thread();
virtual bool is_Named_thread() const { return true; }
virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
JavaThread *processed_thread() { return _processed_thread; }
@@ -701,7 +702,8 @@
static WatcherThread* _watcher_thread;
static bool _startable;
- volatile static bool _should_terminate; // updated without holding lock
+ // volatile due to at least one lock-free read
+ volatile static bool _should_terminate;
os::WatcherThreadCrashProtection* _crash_protection;
public:
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 4576976..631e530 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -487,7 +487,6 @@
\
unchecked_nonstatic_field(ageTable, sizes, sizeof(ageTable::sizes)) \
\
- nonstatic_field(BarrierSet, _kind, BarrierSet::Name) \
nonstatic_field(BlockOffsetTable, _bottom, HeapWord*) \
nonstatic_field(BlockOffsetTable, _end, HeapWord*) \
\
diff --git a/hotspot/src/share/vm/runtime/vmThread.cpp b/hotspot/src/share/vm/runtime/vmThread.cpp
index c349c06..8e34fa4 100644
--- a/hotspot/src/share/vm/runtime/vmThread.cpp
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp
@@ -243,7 +243,7 @@
assert(this == vm_thread(), "check");
this->initialize_thread_local_storage();
- this->set_native_thread_name(this->name());
+ this->initialize_named_thread();
this->record_stack_base_and_size();
// Notify_lock wait checks on active_handles() to rewait in
// case of spurious wakeup, it should wait on the last
diff --git a/hotspot/src/share/vm/shark/sharkBuilder.cpp b/hotspot/src/share/vm/shark/sharkBuilder.cpp
index 329a94a..f02a0e2 100644
--- a/hotspot/src/share/vm/shark/sharkBuilder.cpp
+++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -446,7 +446,7 @@
CreateIntToPtr(
CreateAdd(
LLVMValue::intptr_constant(
- (intptr_t) ((CardTableModRefBS *) bs)->byte_map_base),
+ (intptr_t) (barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base)),
CreateLShr(
CreatePtrToInt(field, SharkType::intptr_type()),
LLVMValue::intptr_constant(CardTableModRefBS::card_shift))),
diff --git a/hotspot/src/share/vm/utilities/fakeRttiSupport.hpp b/hotspot/src/share/vm/utilities/fakeRttiSupport.hpp
new file mode 100644
index 0000000..8c56400
--- /dev/null
+++ b/hotspot/src/share/vm/utilities/fakeRttiSupport.hpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_UTILITIES_FAKERTTISUPPORT_HPP
+#define SHARE_VM_UTILITIES_FAKERTTISUPPORT_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/debug.hpp"
+
+// Provides support for checked downcasts in a hierarchy of classes.
+// The base class provides a member of this type, specialized on that
+// base class and an associated tag type. Tags are small non-negative
+// integer values uniquely associated with distinct classes in the
+// hierarchy. A tag type is often an enum type.
+//
+// The concrete class specifies the concrete tag.
+//
+// The tag set specifies the set of classes in the derivation
+// sequence. Classes in the derivation sequence add their associated
+// tag during construction. Given the tag associated with a class, an
+// object is an instance of that class if the tag is included in the
+// object's set of recorded tags.
+//
+// A tag T is present in a tag set if the T'th bit of the tag set is
+// one.
+//
+// Note: The representation of a tag set being uintx sets an upper
+// bound on the size of a class hierarchy this utility can be used
+// with.
+template<typename T, typename TagType>
+class FakeRttiSupport VALUE_OBJ_CLASS_SPEC {
+public:
+ // Construct with the indicated concrete tag, and include the
+ // concrete tag in the associated tag set.
+ explicit FakeRttiSupport(TagType concrete_tag) :
+ _tag_set(tag_bit(concrete_tag)), _concrete_tag(concrete_tag) { }
+
+ // Construct with the indicated concrete tag and tag set.
+ // Note: This constructor is public only to allow clients to set up
+ // "unusual" (or perhaps buggy) fake RTTI configurations.
+ FakeRttiSupport(TagType concrete_tag, uintx tag_set) :
+ _tag_set(tag_set), _concrete_tag(validate_tag(concrete_tag)) { }
+
+ // Get the concrete tag.
+ TagType concrete_tag() const { return _concrete_tag; }
+
+ // Test whether tag is in the tag set.
+ bool has_tag(TagType tag) const {
+ return (_tag_set & tag_bit(tag)) != 0;
+ }
+
+ // Return a new support object which is the same as this, except tag
+ // has been added to the tag set. The tag must not already be
+ // present in the tag set.
+ FakeRttiSupport add_tag(TagType tag) const {
+ uintx tbit = tag_bit(tag);
+ assert((_tag_set & tbit) == 0,
+ err_msg("Tag " UINTX_FORMAT " is already present in tag set: " UINTX_FORMAT,
+ (uintx)tag, _tag_set));
+ return FakeRttiSupport(_concrete_tag, _tag_set | tbit);
+ }
+
+private:
+ uintx _tag_set;
+ TagType _concrete_tag;
+
+ static uintx tag_bit(TagType tag) {
+ return ((uintx)1) << validate_tag(tag);
+ }
+
+ static TagType validate_tag(uintx tag) {
+ // Type of tag is not TagType to dodge useless MacOSX compiler warning.
+ assert(tag < (sizeof(uintx) * BitsPerByte),
+ err_msg("Tag " UINTX_FORMAT " is too large", tag));
+ return static_cast<TagType>(tag);
+ }
+};
+
+#endif // include guard
diff --git a/hotspot/src/share/vm/utilities/workgroup.cpp b/hotspot/src/share/vm/utilities/workgroup.cpp
index 8e9fa51..3f20f36 100644
--- a/hotspot/src/share/vm/utilities/workgroup.cpp
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -247,6 +247,7 @@
void GangWorker::initialize() {
this->initialize_thread_local_storage();
this->record_stack_base_and_size();
+ this->initialize_named_thread();
assert(_gang != NULL, "No gang to run in");
os::set_priority(this, NearMaxPriority);
if (TraceWorkGang) {
diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index b87440f..db2196a 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -114,7 +114,9 @@
compiler/c2/7047069/Test7047069.java \
runtime/6294277/SourceDebugExtension.java \
runtime/ClassFile/JsrRewriting.java \
- runtime/ClassFile/OomWhileParsingRepeatedJsr.java
+ runtime/ClassFile/OomWhileParsingRepeatedJsr.java \
+ runtime/SharedArchiveFile/LimitSharedSizes.java \
+ runtime/SharedArchiveFile/SpaceUtilizationCheck.java
# Compact 3 adds further tests to compact2
#
@@ -387,35 +389,7 @@
-compiler/runtime/6826736
hotspot_compiler_closed = \
- closed/compiler/c1/ \
- closed/compiler/c2/ \
- closed/compiler/codegen/ \
- closed/compiler/escapeAnalysis/ \
- closed/compiler/interpreter/ \
- closed/compiler/jsr292/ \
- closed/compiler/loopopts/ \
- closed/compiler/oracle/ \
- closed/compiler/runtime/ \
- closed/compiler/symantec/ \
- -closed/compiler/c1/4477197 \
- -closed/compiler/c1/5040872 \
- -closed/compiler/c1/6507107 \
- -closed/compiler/c2/4344895 \
- -closed/compiler/c2/4485006 \
- -closed/compiler/c2/4523683 \
- -closed/compiler/c2/4620290 \
- -closed/compiler/c2/4998314 \
- -closed/compiler/c2/6329104 \
- -closed/compiler/c2/6434117 \
- -closed/compiler/c2/6547163 \
- -closed/compiler/c2/6563987 \
- -closed/compiler/c2/6595044 \
- -closed/compiler/codegen/6440479 \
- -closed/compiler/codegen/6603011 \
- -closed/compiler/interpreter/5034475 \
- -closed/compiler/jsr292/LongLambdaFormDynamicStackDepth.java \
- -closed/compiler/loopopts/4463485 \
- -closed/compiler/loopopts/8021898
+ sanity/ExecuteInternalVMTests.java
hotspot_gc = \
sanity/ExecuteInternalVMTests.java \
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
similarity index 60%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
index d24a6e7..a603333 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,10 +21,30 @@
* questions.
*/
-package pkg;
-
-/**
- * Source file for C
+/*
+ * @test
+ * @bug 8073792
+ * @summary assert broken when array size becomes known during igvn
+ * @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCloneBadAssert.m TestArrayCloneBadAssert
+ *
*/
-public class C {
+
+public class TestArrayCloneBadAssert {
+
+ static final int[] array = new int[5];
+
+ static int[] m(int[] arr) {
+ int i = 0;
+ for (; i < 2; i++) {
+ }
+ if (i == 2) {
+ arr = array;
+ }
+ return arr.clone();
+ }
+
+ static public void main(String[] args) {
+ int[] arr = new int[5];
+ m(arr);
+ }
}
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java
new file mode 100644
index 0000000..0554910
--- /dev/null
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java
@@ -0,0 +1,617 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6912521
+ * @summary small array copy as loads/stores
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
+ *
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+public class TestArrayCopyAsLoadsStores {
+
+ public enum ArraySrc {
+ SMALL,
+ LARGE,
+ ZERO
+ }
+
+ public enum ArrayDst {
+ NONE,
+ NEW,
+ SRC
+ }
+
+ static class A {
+ }
+
+ static class B extends A {
+ }
+
+ static final A[] small_a_src = new A[5];
+ static final A[] large_a_src = new A[10];
+ static final A[] zero_a_src = new A[0];
+ static final int[] small_int_src = new int[5];
+ static final int[] large_int_src = new int[10];
+ static final int[] zero_int_src = new int[0];
+ static final Object[] small_object_src = new Object[5];
+ static Object src;
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface Args {
+ ArraySrc src();
+ ArrayDst dst() default ArrayDst.NONE;
+ int[] extra_args() default {};
+ }
+
+ // array clone should be compiled as loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m1() throws CloneNotSupportedException {
+ return (A[])small_a_src.clone();
+ }
+
+ @Args(src=ArraySrc.SMALL)
+ static int[] m2() throws CloneNotSupportedException {
+ return (int[])small_int_src.clone();
+ }
+
+ // new array allocation should be optimized out
+ @Args(src=ArraySrc.SMALL)
+ static int m3() throws CloneNotSupportedException {
+ int[] array_clone = (int[])small_int_src.clone();
+ return array_clone[0] + array_clone[1] + array_clone[2] +
+ array_clone[3] + array_clone[4];
+ }
+
+ // should not be compiled as loads/stores
+ @Args(src=ArraySrc.LARGE)
+ static int[] m4() throws CloneNotSupportedException {
+ return (int[])large_int_src.clone();
+ }
+
+ // check that array of length 0 is handled correctly
+ @Args(src=ArraySrc.ZERO)
+ static int[] m5() throws CloneNotSupportedException {
+ return (int[])zero_int_src.clone();
+ }
+
+ // array copy should be compiled as loads/stores
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW)
+ static void m6(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 0, 5);
+ }
+
+ // array copy should not be compiled as loads/stores
+ @Args(src=ArraySrc.LARGE, dst=ArrayDst.NEW)
+ static void m7(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 0, 10);
+ }
+
+ // array copy should be compiled as loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m8(A[] src) {
+ src[0] = src[0]; // force null check
+ A[] dest = new A[5];
+ System.arraycopy(src, 0, dest, 0, 5);
+ return dest;
+ }
+
+ // array copy should not be compiled as loads/stores: we would
+ // need to emit GC barriers
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW)
+ static void m9(A[] src, A[] dest) {
+ System.arraycopy(src, 0, dest, 0, 5);
+ }
+
+ // overlapping array regions: copy backward
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC)
+ static void m10(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 1, 4);
+ }
+
+ static boolean m10_check(int[] src, int[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 5; i++) {
+ int j = Math.max(i - 1, 0);
+ if (dest[i] != src[j]) {
+ System.out.println("Test m10 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // overlapping array regions: copy forward
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC)
+ static void m11(int[] src, int[] dest) {
+ System.arraycopy(src, 1, dest, 0, 4);
+ }
+
+ static boolean m11_check(int[] src, int[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 5; i++) {
+ int j = Math.min(i + 1, 4);
+ if (dest[i] != src[j]) {
+ System.out.println("Test m11 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // overlapping array region with unknown src/dest offsets: compiled code must include both forward and backward copies
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC, extra_args={0,1})
+ static void m12(int[] src, int[] dest, int srcPos, int destPos) {
+ System.arraycopy(src, srcPos, dest, destPos, 4);
+ }
+
+ static boolean m12_check(int[] src, int[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 5; i++) {
+ int j = Math.max(i - 1, 0);
+ if (dest[i] != src[j]) {
+ System.out.println("Test m10 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // Array allocation and copy should optimize out
+ @Args(src=ArraySrc.SMALL)
+ static int m13(int[] src) {
+ int[] dest = new int[5];
+ System.arraycopy(src, 0, dest, 0, 5);
+ return dest[0] + dest[1] + dest[2] + dest[3] + dest[4];
+ }
+
+ // Check that copy of length 0 is handled correctly
+ @Args(src=ArraySrc.ZERO, dst=ArrayDst.NEW)
+ static void m14(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 0, 0);
+ }
+
+ // copyOf should compile to loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m15() {
+ return Arrays.copyOf(small_a_src, 5, A[].class);
+ }
+
+ static Object[] helper16(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ // CopyOf may need subtype check
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static A[] m16(A[] unused_src, int i) {
+ Object[] arr = helper16(i);
+ return Arrays.copyOf(arr, 5, A[].class);
+ }
+
+ static Object[] helper17_1(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ static A[] helper17_2(Object[] arr) {
+ return Arrays.copyOf(arr, 5, A[].class);
+ }
+
+ // CopyOf may leverage type speculation
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static A[] m17(A[] unused_src, int i) {
+ Object[] arr = helper17_1(i);
+ return helper17_2(arr);
+ }
+
+ static Object[] helper18_1(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ static Object[] helper18_2(Object[] arr) {
+ return Arrays.copyOf(arr, 5, Object[].class);
+ }
+
+ // CopyOf should not attempt to use type speculation if it's not needed
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static Object[] m18(A[] unused_src, int i) {
+ Object[] arr = helper18_1(i);
+ return helper18_2(arr);
+ }
+
+ static Object[] helper19(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ // CopyOf may need subtype check. Test is run to make type check
+ // fail and cause deoptimization. Next compilation should not
+ // compile as loads/stores because the first compilation
+ // deoptimized.
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static A[] m19(A[] unused_src, int i) {
+ Object[] arr = helper19(i);
+ return Arrays.copyOf(arr, 5, A[].class);
+ }
+
+ // copyOf for large array should not compile to loads/stores
+ @Args(src=ArraySrc.LARGE)
+ static A[] m20() {
+ return Arrays.copyOf(large_a_src, 10, A[].class);
+ }
+
+ // check zero length copyOf is handled correctly
+ @Args(src=ArraySrc.ZERO)
+ static A[] m21() {
+ return Arrays.copyOf(zero_a_src, 0, A[].class);
+ }
+
+ // Run with srcPos=0 for a 1st compile, then with incorrect value
+ // of srcPos to cause deoptimization, then with srcPos=0 for a 2nd
+ // compile. The 2nd compile shouldn't turn arraycopy into
+ // loads/stores because input arguments are no longer known to be
+ // valid.
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW, extra_args={0})
+ static void m22(int[] src, int[] dest, int srcPos) {
+ System.arraycopy(src, srcPos, dest, 0, 5);
+ }
+
+ // copyOfRange should compile to loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m23() {
+ return Arrays.copyOfRange(small_a_src, 1, 4, A[].class);
+ }
+
+ static boolean m23_check(A[] src, A[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 3; i++) {
+ if (src[i+1] != dest[i]) {
+ System.out.println("Test m23 failed for " + i + " src[" + (i+1) +"]=" + dest[i] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // array copy should be compiled as loads/stores. Invoke then with
+ // incompatible array type to verify we don't allow a forbidden
+ // arraycopy to happen.
+ @Args(src=ArraySrc.SMALL)
+ static A[] m24(Object[] src) {
+ src[0] = src[0]; // force null check
+ A[] dest = new A[5];
+ System.arraycopy(src, 0, dest, 0, 5);
+ return dest;
+ }
+
+ // overlapping array region with unknown src/dest offsets but
+ // length 1: compiled code doesn't need both forward and backward
+ // copies
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC, extra_args={0,1})
+ static void m25(int[] src, int[] dest, int srcPos, int destPos) {
+ System.arraycopy(src, srcPos, dest, destPos, 1);
+ }
+
+ static boolean m25_check(int[] src, int[] dest) {
+ boolean failure = false;
+ if (dest[1] != src[0]) {
+ System.out.println("Test m10 failed for src[0]=" + src[0] + ", dest[1]=" + dest[1]);
+ return true;
+ }
+ return false;
+ }
+
+ final HashMap<String,Method> tests = new HashMap<>();
+ {
+ for (Method m : this.getClass().getDeclaredMethods()) {
+ if (m.getName().matches("m[0-9]+(_check)?")) {
+ assert(Modifier.isStatic(m.getModifiers())) : m;
+ tests.put(m.getName(), m);
+ }
+ }
+ }
+
+ boolean success = true;
+
+ void doTest(String name) throws Exception {
+ Method m = tests.get(name);
+ Method m_check = tests.get(name + "_check");
+ Class[] paramTypes = m.getParameterTypes();
+ Object[] params = new Object[paramTypes.length];
+ Class retType = m.getReturnType();
+ boolean isIntArray = (retType.isPrimitive() && !retType.equals(Void.TYPE)) ||
+ (retType.equals(Void.TYPE) && paramTypes[0].getComponentType().isPrimitive()) ||
+ (retType.isArray() && retType.getComponentType().isPrimitive());
+
+ Args args = m.getAnnotation(Args.class);
+
+ Object src = null;
+ switch(args.src()) {
+ case SMALL: {
+ if (isIntArray) {
+ src = small_int_src;
+ } else {
+ src = small_a_src;
+ }
+ break;
+ }
+ case LARGE: {
+ if (isIntArray) {
+ src = large_int_src;
+ } else {
+ src = large_a_src;
+ }
+ break;
+ }
+ case ZERO: {
+ if (isIntArray) {
+ src = zero_int_src;
+ } else {
+ src = zero_a_src;
+ }
+ break;
+ }
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ boolean failure = false;
+
+ int p = 0;
+
+ if (params.length > 0) {
+ if (isIntArray) {
+ params[0] = ((int[])src).clone();
+ } else {
+ params[0] = ((A[])src).clone();
+ }
+ p++;
+ }
+
+ if (params.length > 1) {
+ switch(args.dst()) {
+ case NEW: {
+ if (isIntArray) {
+ params[1] = new int[((int[])params[0]).length];
+ } else {
+ params[1] = new A[((A[])params[0]).length];
+ }
+ p++;
+ break;
+ }
+ case SRC: {
+ params[1] = params[0];
+ p++;
+ break;
+ }
+ case NONE: break;
+ }
+ }
+
+ for (int j = 0; j < args.extra_args().length; j++) {
+ params[p+j] = args.extra_args()[j];
+ }
+
+ Object res = m.invoke(null, params);
+
+ if (retType.isPrimitive() && !retType.equals(Void.TYPE)) {
+ int s = (int)res;
+ int sum = 0;
+ int[] int_res = (int[])src;
+ for (int j = 0; j < int_res.length; j++) {
+ sum += int_res[j];
+ }
+ failure = (s != sum);
+ if (failure) {
+ System.out.println("Test " + name + " failed: result = " + s + " != " + sum);
+ }
+ } else {
+ Object dest = null;
+ if (!retType.equals(Void.TYPE)) {
+ dest = res;
+ } else {
+ dest = params[1];
+ }
+
+ if (m_check != null) {
+ failure = (boolean)m_check.invoke(null, new Object[] { src, dest });
+ } else {
+ if (isIntArray) {
+ int[] int_res = (int[])src;
+ int[] int_dest = (int[])dest;
+ for (int j = 0; j < int_res.length; j++) {
+ if (int_res[j] != int_dest[j]) {
+ System.out.println("Test " + name + " failed for " + j + " src[" + j +"]=" + int_res[j] + ", dest[" + j + "]=" + int_dest[j]);
+ failure = true;
+ }
+ }
+ } else {
+ Object[] object_res = (Object[])src;
+ Object[] object_dest = (Object[])dest;
+ for (int j = 0; j < object_res.length; j++) {
+ if (object_res[j] != object_dest[j]) {
+ System.out.println("Test " + name + " failed for " + j + " src[" + j +"]=" + object_res[j] + ", dest[" + j + "]=" + object_dest[j]);
+ failure = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (failure) {
+ success = false;
+ break;
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ for (int i = 0; i < small_a_src.length; i++) {
+ small_a_src[i] = new A();
+ }
+
+ for (int i = 0; i < small_int_src.length; i++) {
+ small_int_src[i] = i;
+ }
+
+ for (int i = 0; i < large_int_src.length; i++) {
+ large_int_src[i] = i;
+ }
+
+ for (int i = 0; i < 5; i++) {
+ small_object_src[i] = new Object();
+ }
+
+ TestArrayCopyAsLoadsStores test = new TestArrayCopyAsLoadsStores();
+
+ test.doTest("m1");
+ test.doTest("m2");
+ test.doTest("m3");
+ test.doTest("m4");
+ test.doTest("m5");
+ test.doTest("m6");
+ test.doTest("m7");
+ test.doTest("m8");
+ test.doTest("m9");
+ test.doTest("m10");
+ test.doTest("m11");
+ test.doTest("m12");
+ test.doTest("m13");
+ test.doTest("m14");
+ test.doTest("m15");
+
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper16(i);
+ }
+
+ test.doTest("m16");
+
+ // load class B so type check in m17 would not be simple comparison
+ B b = new B();
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper17_1(i);
+ }
+
+ test.doTest("m17");
+
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper18_1(i);
+ }
+ test.doTest("m18");
+
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper19(i);
+ }
+
+ // Compile
+ for (int i = 0; i < 20000; i++) {
+ m19(null, 0);
+ }
+
+ // force deopt
+ boolean m19_exception = false;
+ for (int i = 0; i < 10; i++) {
+ try {
+ m19(null, 1);
+ } catch(ArrayStoreException ase) {
+ m19_exception = true;
+ }
+ }
+
+ if (!m19_exception) {
+ System.out.println("Test m19: exception wasn't thrown");
+ test.success = false;
+ }
+
+ test.doTest("m19");
+
+ test.doTest("m20");
+ test.doTest("m21");
+
+ // Compile
+ int[] dst = new int[small_int_src.length];
+ for (int i = 0; i < 20000; i++) {
+ m22(small_int_src, dst, 0);
+ }
+
+ // force deopt
+ for (int i = 0; i < 10; i++) {
+ try {
+ m22(small_int_src, dst, 5);
+ } catch(ArrayIndexOutOfBoundsException aioobe) {}
+ }
+
+ test.doTest("m22");
+ test.doTest("m23");
+
+ test.doTest("m24");
+ boolean m24_exception = false;
+ try {
+ m24(small_object_src);
+ } catch(ArrayStoreException ase) {
+ m24_exception = true;
+ }
+
+ if (!m24_exception) {
+ System.out.println("Test m24: exception wasn't thrown");
+ test.success = false;
+ }
+
+ test.doTest("m25");
+
+ if (!test.success) {
+ throw new RuntimeException("some tests failed");
+ }
+ }
+}
diff --git a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
new file mode 100644
index 0000000..cb3ce01
--- /dev/null
+++ b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8073670
+ * @summary Test that causes C2 to fold two NaNs with different values into a single NaN.
+ * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_nan -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_nan FloatingPointFoldingTest
+ */
+
+public class FloatingPointFoldingTest {
+ // Double values.
+ public static final long MINUS_INF_LONGBITS = 0xfff0000000000000L;
+ public static final double DOUBLE_MINUS_INF = Double.longBitsToDouble(MINUS_INF_LONGBITS);
+
+ public static final long PLUS_INF_LONGBITS = 0x7ff0000000000000L;
+ public static final double DOUBLE_PLUS_INF = Double.longBitsToDouble(PLUS_INF_LONGBITS);
+
+ public static final long MINUS_ZERO_LONGBITS = 0x8000000000000000L;
+ public static final double DOUBLE_MINUS_ZERO = Double.longBitsToDouble(MINUS_ZERO_LONGBITS);
+
+ // We need two different NaN values. A floating point number is
+ // considered to be NaN is the sign bit is 0, all exponent bits
+ // are set to 1, and at least one bit of the exponent is not zero.
+ //
+ // As java.lang.Double.NaN is 0x7ff8000000000000L, we use
+ // 0x7ffc000000000000L as a second NaN double value.
+ public static final long NAN_LONGBITS = 0x7ffc000000000000L;
+ public static final double DOUBLE_NAN = Double.longBitsToDouble(NAN_LONGBITS);
+
+ // Float values.
+ public static final int MINUS_INF_INTBITS = 0xff800000;
+ public static final float FLOAT_MINUS_INF = Float.intBitsToFloat(MINUS_INF_INTBITS);
+
+ public static final int PLUS_INF_INTBITS = 0x7f800000;
+ public static final float FLOAT_PLUS_INF = Float.intBitsToFloat(PLUS_INF_INTBITS);
+
+ public static final int MINUS_ZERO_INTBITS = 0x80000000;
+ public static final float FLOAT_MINUS_ZERO = Float.intBitsToFloat(MINUS_ZERO_INTBITS);
+
+ // As java.lang.Float.NaN is 0x7fc00000, we use 0x7fe00000
+ // as a second NaN float value.
+ public static final int NAN_INTBITS = 0x7fe00000;
+ public static final float FLOAT_NAN = Float.intBitsToFloat(NAN_INTBITS);
+
+
+ // Double tests.
+ static void test_double_inf(long[] result) {
+ double d1 = DOUBLE_MINUS_INF;
+ double d2 = DOUBLE_PLUS_INF;
+ result[0] = Double.doubleToRawLongBits(d1);
+ result[1] = Double.doubleToRawLongBits(d2);
+ }
+
+ static void test_double_zero(long[] result) {
+ double d1 = DOUBLE_MINUS_ZERO;
+ double d2 = 0;
+ result[0] = Double.doubleToRawLongBits(d1);
+ result[1] = Double.doubleToRawLongBits(d2);
+ }
+
+ static void test_double_nan(long[] result) {
+ double d1 = DOUBLE_NAN;
+ double d2 = Double.NaN;
+ result[0] = Double.doubleToRawLongBits(d1);
+ result[1] = Double.doubleToRawLongBits(d2);
+ }
+
+ // Float tests.
+ static void test_float_inf(int[] result) {
+ float f1 = FLOAT_MINUS_INF;
+ float f2 = FLOAT_PLUS_INF;
+ result[0] = Float.floatToRawIntBits(f1);
+ result[1] = Float.floatToRawIntBits(f2);
+ }
+
+ static void test_float_zero(int[] result) {
+ float f1 = FLOAT_MINUS_ZERO;
+ float f2 = 0;
+ result[0] = Float.floatToRawIntBits(f1);
+ result[1] = Float.floatToRawIntBits(f2);
+ }
+
+ static void test_float_nan(int[] result) {
+ float f1 = FLOAT_NAN;
+ float f2 = Float.NaN;
+ result[0] = Float.floatToRawIntBits(f1);
+ result[1] = Float.floatToRawIntBits(f2);
+ }
+
+ // Check doubles.
+ static void check_double(long[] result, double d1, double d2) {
+ if (result[0] == result[1]) {
+ throw new RuntimeException("ERROR: Two different double values are considered equal. \n"
+ + String.format("\toriginal values: 0x%x 0x%x\n", Double.doubleToRawLongBits(d1), Double.doubleToRawLongBits(d2))
+ + String.format("\tvalues after execution of method test(): 0x%x 0x%x", result[0], result[1]));
+ }
+ }
+
+ // Check floats.
+ static void check_float(int[] result, float f1, float f2) {
+ if (result[0] == result[1]) {
+ throw new RuntimeException("ERROR: Two different float values are considered equal. \n"
+ + String.format("\toriginal values: 0x%x 0x%x\n", Float.floatToRawIntBits(f1), Float.floatToRawIntBits(f2))
+ + String.format("\tvalues after execution of method test(): 0x%x 0x%x", result[0], result[1]));
+ }
+ }
+
+ public static void main(String[] args) {
+ // Float tests.
+
+ int[] iresult = new int[2];
+
+ // -Inf and +Inf.
+ test_float_inf(iresult);
+ check_float(iresult, FLOAT_MINUS_INF, FLOAT_PLUS_INF);
+
+ // 0 and -0.
+ test_float_zero(iresult);
+ check_float(iresult, FLOAT_MINUS_ZERO, 0);
+
+ // Diferrent NaNs.
+ test_float_nan(iresult);
+ check_float(iresult, FLOAT_NAN, Float.NaN);
+
+ // Double tests.
+
+ long[] lresult = new long[2];
+
+ // -Inf and +Inf.
+ test_double_inf(lresult);
+ check_double(lresult, DOUBLE_MINUS_INF, DOUBLE_PLUS_INF);
+
+ // 0 and -0.
+ test_double_zero(lresult);
+ check_double(lresult, DOUBLE_MINUS_ZERO, 0);
+
+ // Diferrent NaNs.
+ test_double_nan(lresult);
+ check_double(lresult, DOUBLE_NAN, Double.NaN);
+ }
+}
diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
index e70f62a..276ba90 100644
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
@@ -51,7 +51,9 @@
public static void main(String[] args) {
for (BlobType btype : BlobType.getAvailable()) {
- new UsageThresholdIncreasedTest(btype).runTest();
+ if (CodeCacheUtils.isCodeHeapPredictable(btype)) {
+ new UsageThresholdIncreasedTest(btype).runTest();
+ }
}
}
diff --git a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
new file mode 100644
index 0000000..7eac5e0
--- /dev/null
+++ b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8073956
+ * @summary Tests C2 EA with allocated object escaping through a call.
+ * @run main/othervm -XX:CompileCommand=dontinline,TestEscapeThroughInvoke::create TestEscapeThroughInvoke
+ */
+public class TestEscapeThroughInvoke {
+ private A a;
+
+ public static void main(String[] args) {
+ TestEscapeThroughInvoke test = new TestEscapeThroughInvoke();
+ test.a = new A(42);
+ // Make sure run gets compiled by C2
+ for (int i = 0; i < 100_000; ++i) {
+ test.run();
+ }
+ }
+
+ private void run() {
+ // Allocate something to trigger EA
+ new Object();
+ // Create a new escaping instance of A and
+ // verify that it is always equal to 'a.saved'.
+ A escapingA = create(42);
+ a.check(escapingA);
+ }
+
+ // Create and return a new instance of A that escaped through 'A::saveInto'.
+ // The 'dummy' parameters are needed to avoid EA skipping the methods.
+ private A create(Integer dummy) {
+ A result = new A(dummy);
+ result.saveInto(a, dummy); // result escapes into 'a' here
+ return result;
+ }
+}
+
+class A {
+ private A saved;
+
+ public A(Integer dummy) { }
+
+ public void saveInto(A other, Integer dummy) {
+ other.saved = this;
+ }
+
+ public void check(A other) {
+ if (this.saved != other) {
+ throw new RuntimeException("TEST FAILED: Objects not equal.");
+ }
+ }
+}
diff --git a/hotspot/test/compiler/loopopts/CountedLoopProblem.java b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
index da206cb..23cc0bb 100644
--- a/hotspot/test/compiler/loopopts/CountedLoopProblem.java
+++ b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
@@ -36,18 +36,22 @@
public static void main(String[] args) throws Exception {
Random r = new Random(42);
int x = 0;
- StringBuilder sb = new StringBuilder();
- for(int i = 0; i < 1000000; ++i) {
- int v = Math.abs(r.nextInt());
- sb.append('+').append(v).append('\n');
- x += v;
- // To trigger the problem we must OSR in the following loop
- // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
- while(x < 0) x += 1000000000;
- sb.append('=').append(x).append('\n');
- }
- if (sb.toString().hashCode() != 0xaba94591) {
- throw new Exception("Unexpected result");
+ try {
+ StringBuilder sb = new StringBuilder();
+ for(int i = 0; i < 1000000; ++i) {
+ int v = Math.abs(r.nextInt());
+ sb.append('+').append(v).append('\n');
+ x += v;
+ // To trigger the problem we must OSR in the following loop
+ // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
+ while(x < 0) x += 1000000000;
+ sb.append('=').append(x).append('\n');
+ }
+ if (sb.toString().hashCode() != 0xaba94591) {
+ throw new Exception("Unexpected result");
+ }
+ } catch(OutOfMemoryError e) {
+ // small heap, ignore
}
}
}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
similarity index 60%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
index d24a6e7..c9c985a 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -19,12 +19,28 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
+ *
*/
-package pkg;
-
/**
- * Source file for C
+ * @test
+ * @bug 8073184
+ * @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-LoopLimitCheck -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp TestCastIINoLoopLimitCheck
+ *
*/
-public class C {
+
+public class TestCastIINoLoopLimitCheck {
+
+ static void m(int i, int index, char[] buf) {
+ while (i >= 65536) {
+ i = i / 100;
+ buf [--index] = 0;
+ buf [--index] = 1;
+ }
+ }
+
+ static public void main(String[] args) {
+ m(0, 0, null);
+ }
}
diff --git a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java
new file mode 100644
index 0000000..ca57139
--- /dev/null
+++ b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8073154
+ * @build TestProfileReturnTypePrinting
+ * @run main/othervm -XX:TypeProfileLevel=020
+ * -XX:CompileOnly=TestProfileReturnTypePrinting.testMethod
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR
+ * TestProfileReturnTypePrinting
+ * @summary Verify that c1's LIR that contains ProfileType node could be dumped
+ * without a crash disregard to an exact class knowledge.
+ */
+public class TestProfileReturnTypePrinting {
+ private static final int ITERATIONS = 1_000_000;
+
+ public static void main(String args[]) {
+ for (int i = 0; i < ITERATIONS; i++) {
+ TestProfileReturnTypePrinting.testMethod(i);
+ }
+ }
+
+ private static int testMethod(int i) {
+ return TestProfileReturnTypePrinting.foo().hashCode()
+ + TestProfileReturnTypePrinting.bar(i).hashCode();
+ }
+
+ /* Exact class of returned value is known statically. */
+ private static B foo() {
+ return new B();
+ }
+
+ /* Exact class of returned value is not known statically. */
+ private static Object bar(int i) {
+ if (i % 2 == 0) {
+ return new A();
+ } else {
+ return new B();
+ }
+ }
+
+ private static class A {
+ }
+
+ private static class B extends A {
+ }
+}
diff --git a/hotspot/test/compiler/tiered/LevelTransitionTest.java b/hotspot/test/compiler/tiered/LevelTransitionTest.java
index 79d3626..8520609 100644
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java
@@ -29,6 +29,7 @@
/**
* @test LevelTransitionTest
* @library /testlibrary /../../test/lib /compiler/whitebox
+ * @ignore 8067651
* @build TransitionsTestExecutor LevelTransitionTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java
index abe6ed3..3b05574 100644
--- a/hotspot/test/gc/TestSmallHeap.java
+++ b/hotspot/test/gc/TestSmallHeap.java
@@ -26,6 +26,7 @@
* @bug 8067438
* @requires vm.gc=="null"
* @requires (vm.opt.AggressiveOpts=="null") | (vm.opt.AggressiveOpts=="false")
+ * @requires vm.compMode != "Xcomp"
* @summary Verify that starting the VM with a small heap works
* @library /testlibrary /../../test/lib
* @build TestSmallHeap
diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
index 3232b27..abf6f80 100644
--- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
* @key gc
* @summary Tests that all SoftReferences has been cleared at time of OOM.
* @library /testlibrary
+ * @ignore 8073669
* @build TestSoftReferencesBehaviorOnOOME
* @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
* @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java
index 01efb5f..f9f6434 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java
@@ -47,6 +47,7 @@
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency1",
"test");
@@ -55,5 +56,3 @@
}
}
}
-
-
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java
index 16f776f..c6df9d7 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java
@@ -47,6 +47,7 @@
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency2",
"test");
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java
index aa89c09..a3c79e2 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java
@@ -47,6 +47,7 @@
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency3",
"test");
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java
index f6b8914..79096eb 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java
@@ -47,6 +47,7 @@
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency4",
"test");
diff --git a/hotspot/test/runtime/Thread/Fibonacci.java b/hotspot/test/runtime/Thread/Fibonacci.java
new file mode 100644
index 0000000..94d38be
--- /dev/null
+++ b/hotspot/test/runtime/Thread/Fibonacci.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Calculates Fibonacci numbers "recursively" via threads and compares
+ * the result with the classical calculation.
+ * This test is skipped on 32-bit Windows: limited virtual space on Win-32
+ * make this test inherently unstable on Windows with 32-bit VM data model.
+ * @requires !(os.family == "windows" & sun.arch.data.model == "32")
+ * @library /testlibrary
+ * @run main Fibonacci 15
+ */
+
+import com.oracle.java.testlibrary.Asserts;
+
+public class Fibonacci extends Thread {
+ private int index;
+ private int value;
+ private Fibonacci left;
+ private Fibonacci right;
+
+ public Fibonacci(int i) {
+ index = i;
+ }
+
+ private int getValue() {
+ return value;
+ }
+
+ @Override
+ public void run() {
+ if (index == 0 || index == 1) {
+ // base cases, 0 Fibonacci number = 0, 1 Fibonacci number = 1
+ value = index;
+ } else {
+ // inductive cases
+ left = new Fibonacci(index - 2);
+ right = new Fibonacci(index - 1);
+ left.start();
+ right.start();
+ try {
+ left.join();
+ right.join();
+ } catch (InterruptedException e) {
+ throw new Error("InterruptedException for index " + index, e);
+ }
+ // compute and terminate
+ value = left.getValue() + right.getValue();
+ }
+ }
+
+ public static int traditionalFibonacci(int n) {
+ int n1 = 0, n2 = 1, nn = 0;
+
+ if (n == 0 || n == 1) {
+ nn = n;
+ }
+
+ for (int i = 1; i < n; ++i) {
+ nn = n2 + n1;
+ n1 = n2;
+ n2 = nn;
+ }
+ return nn;
+ }
+
+ public static void main(String[] args) throws Error,AssertionError {
+ int expected;
+ int number;
+ Fibonacci recursiveFibonacci;
+
+ if (args.length != 1) {
+ throw new Error("Error: args.length must be 1");
+ }
+
+ number = Integer.parseInt(args[0]);
+ recursiveFibonacci = new Fibonacci(number);
+
+ recursiveFibonacci.start();
+ try {
+ recursiveFibonacci.join();
+ } catch (InterruptedException e) {
+ throw new Error("InterruptedException in main thread", e);
+ }
+
+ expected = traditionalFibonacci(number);
+
+ System.out.println("Fibonacci[" + number + "] = " + expected);
+
+ Asserts.assertEQ(recursiveFibonacci.getValue(), expected,
+ "Unexpected calculated value: " + recursiveFibonacci.getValue() + " expected " + expected );
+ }
+}
diff --git a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java
index eb90bc0..ec135bb 100644
--- a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java
+++ b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java
@@ -39,7 +39,7 @@
* @library /testlibrary
* @build com.oracle.java.testlibrary.*
* @build com.oracle.java.testlibrary.dcmd.*
- * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog RunGCTest
+ * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog -XX:-ExplicitGCInvokesConcurrent RunGCTest
*/
public class RunGCTest {
public void run(CommandExecutor executor) {
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
index 12d0943..b398ea1 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
package sun.hotspot.tools.ctw;
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
import java.io.*;
import java.nio.file.Files;
@@ -55,7 +55,7 @@
try {
try {
- if (ManagementFactoryHelper.getCompilationMXBean() == null) {
+ if (ManagementFactory.getCompilationMXBean() == null) {
throw new RuntimeException(
"CTW can not work in interpreted mode");
}
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
index ea621cb..4e98bd8 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
package sun.hotspot.tools.ctw;
import com.sun.management.HotSpotDiagnosticMXBean;
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
import java.io.File;
import java.util.regex.Pattern;
@@ -160,7 +160,7 @@
public static String getVMOption(String name) {
String result;
HotSpotDiagnosticMXBean diagnostic
- = ManagementFactoryHelper.getDiagnosticMXBean();
+ = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
result = diagnostic.getVMOption(name).getValue();
return result;
}
diff --git a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java
index ff00999..84103c3 100644
--- a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java
+++ b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java
@@ -58,7 +58,7 @@
}
jvmArgs.add(RandomRunner.class.getName());
String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
- String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getOutput().trim();
+ String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getStdout().trim();
seedOpt.verify(etalon, cmdLineArgs);
}
@@ -122,7 +122,7 @@
String lastLineOrig = getLastLine(orig);
String lastLine;
try {
- lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getOutput().trim());
+ lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getStdout().trim());
} catch (Throwable t) {
throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
}
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 601dfcb..c4ae975 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -296,3 +296,4 @@
7cb3674cbd8c06222851444285bb66b2952a2a5c jdk9-b51
57b26c883d54f45912bc3885ccad3c6b80960b1f jdk9-b52
d5b5a010a16688f188f5a9247ed873f5100b530c jdk9-b53
+542c0c855ad467624cbedf11bff08e44b86b068d jdk9-b54
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
index 4cb5800..cca303c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -247,9 +247,11 @@
* </p>
*
* <p>
- * <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
- * {@link java.util.Properties} format. If the file exists and the system property is specified,
- * its value will be used to override the default of the property.
+ * <b>jaxp.properties:</b> This configuration file is in standard
+ * {@link java.util.Properties} format and typically located in the {@code conf}
+ * directory of the Java installation. If the file exists and the system
+ * property is specified, its value will be used to override the default
+ * of the property.
* </p>
*
* <p>
@@ -314,9 +316,11 @@
* </p>
*
* <p>
- * <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
- * java.util.Properties format. If the file exists and the system property is specified,
- * its value will be used to override the default of the property.
+ * <b>jaxp.properties:</b> This configuration file is in standard
+ * {@link java.util.Properties} format and typically located in the {@code conf}
+ * directory of the Java installation. If the file exists and the system
+ * property is specified, its value will be used to override the default
+ * of the property.
*
* @since 1.7
* </p>
@@ -380,9 +384,11 @@
* </p>
*
* <p>
- * <b>${JAVA_HOME}/conf/jaxp.properties: </b> This configuration file is in standard
- * java.util.Properties format. If the file exists and the system property is specified,
- * its value will be used to override the default of the property.
+ * <b>jaxp.properties:</b> This configuration file is in standard
+ * {@link java.util.Properties} format and typically located in the {@code conf}
+ * directory of the Java installation. If the file exists and the system
+ * property is specified, its value will be used to override the default
+ * of the property.
*
* @since 1.7
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
index de6050a..d3afb25 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,23 +32,34 @@
import java.util.regex.Pattern;
/**
- * <p>Factory that creates new <code>javax.xml.datatype</code> <code>Object</code>s that map XML to/from Java <code>Object</code>s.</p>
- *
- * <p>A new instance of the <code>DatatypeFactory</code> is created through the {@link #newInstance()} method
- * that uses the following implementation resolution mechanisms to determine an implementation:</p>
+ * Factory that creates new <code>javax.xml.datatype</code> <code>Object</code>s that map XML to/from Java <code>Object</code>s.
+ * <p>
+ * A new instance of the {@code DatatypeFactory} is created through the {@link #newInstance()} method
+ * that uses the following implementation resolution mechanisms to determine an implementation:
+ * <p>
* <ol>
* <li>
- * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "<code>javax.xml.datatype.DatatypeFactory</code>",
+ * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "{@code javax.xml.datatype.DatatypeFactory}",
* exists, a class with the name of the property value is instantiated.
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
* </li>
* <li>
- * If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
- * The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
- * and processed as documented in the prior step.
+ * <p>
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ * <p>
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
* </li>
* <li>
- * Uses the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class, to attempt
+ * <p>
+ * Use the service-provider loading facility, defined by the {@link java.util.ServiceLoader} class, to attempt
* to locate and load an implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
* the service-provider loading facility will use the {@linkplain
@@ -56,13 +67,14 @@
* to attempt to load the service. If the context class
* loader is null, the {@linkplain
* ClassLoader#getSystemClassLoader() system class loader} will be used.
- * <br>
+ * <p>
* In case of {@link java.util.ServiceConfigurationError service
- * configuration error} a {@link javax.xml.datatype.DatatypeConfigurationException}
+ * configuration error}, a {@link javax.xml.datatype.DatatypeConfigurationException}
* will be thrown.
* </li>
* <li>
- * The final mechanism is to attempt to instantiate the <code>Class</code> specified by
+ * <p>
+ * The final mechanism is to attempt to instantiate the {@code Class} specified by
* {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}.
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
* </li>
@@ -79,7 +91,7 @@
/**
* <p>Default property name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.</p>
*
- * <p>Default value is <code>javax.xml.datatype.DatatypeFactory</code>.</p>
+ * <p>Default value is {@code javax.xml.datatype.DatatypeFactory}.</p>
*/
public static final String DATATYPEFACTORY_PROPERTY =
// We use a String constant here, rather than calling
@@ -120,18 +132,18 @@
/**
* <p>Protected constructor to prevent instantiation outside of package.</p>
*
- * <p>Use {@link #newInstance()} to create a <code>DatatypeFactory</code>.</p>
+ * <p>Use {@link #newInstance()} to create a {@code DatatypeFactory}.</p>
*/
protected DatatypeFactory() {
}
/**
- * <p>Obtain a new instance of a <code>DatatypeFactory</code>.</p>
+ * <p>Obtain a new instance of a {@code DatatypeFactory}.</p>
*
* <p>The implementation resolution mechanisms are <a href="#DatatypeFactory.newInstance">defined</a> in this
* <code>Class</code>'s documentation.</p>
*
- * @return New instance of a <code>DatatypeFactory</code>
+ * @return New instance of a {@code DatatypeFactory}
*
* @throws DatatypeConfigurationException If the implementation is not
* available or cannot be instantiated.
@@ -149,12 +161,12 @@
}
/**
- * <p>Obtain a new instance of a <code>DatatypeFactory</code> from class name.
+ * <p>Obtain a new instance of a {@code DatatypeFactory} from class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
* should be loaded.</p>
*
- * <p>Once an application has obtained a reference to a <code>DatatypeFactory</code>
+ * <p>Once an application has obtained a reference to a {@code DatatypeFactory}
* it can use the factory to configure and obtain datatype instances.</P>
*
*
@@ -168,12 +180,12 @@
* java -Djaxp.debug=1 YourProgram ....
* </pre>
*
- * @param factoryClassName fully qualified factory class name that provides implementation of <code>javax.xml.datatype.DatatypeFactory</code>.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.datatype.DatatypeFactory}.
*
* @param classLoader <code>ClassLoader</code> used to load the factory class. If <code>null</code>
* current <code>Thread</code>'s context classLoader is used to load the factory class.
*
- * @return New instance of a <code>DatatypeFactory</code>
+ * @return New instance of a {@code DatatypeFactory}
*
* @throws DatatypeConfigurationException if <code>factoryClassName</code> is <code>null</code>, or
* the factory class cannot be loaded, instantiated.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
index 62bd3bd..c500869 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,31 +55,34 @@
/**
* Obtain a new instance of a
- * <code>DocumentBuilderFactory</code>. This static method creates
+ * {@code DocumentBuilderFactory}. This static method creates
* a new factory instance.
* This method uses the following ordered lookup procedure to determine
- * the <code>DocumentBuilderFactory</code> implementation class to
+ * the {@code DocumentBuilderFactory} implementation class to
* load:
+ * <p>
* <ul>
* <li>
- * Use the <code>javax.xml.parsers.DocumentBuilderFactory</code> system
+ * Use the {@code javax.xml.parsers.DocumentBuilderFactory} system
* property.
* </li>
* <li>
- * Use the properties file "conf/jaxp.properties" in the JRE directory.
- * This configuration file is in standard <code>java.util.Properties
- * </code> format and contains the fully qualified name of the
- * implementation class with the key being the system property defined
- * above.
- *
+ * <p>
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ * <p>
* The jaxp.properties file is read only once by the JAXP implementation
- * and it's values are then cached for future use. If the file does not exist
+ * and its values are then cached for future use. If the file does not exist
* when the first attempt is made to read from it, no further attempts are
* made to check for its existence. It is not possible to change the value
* of any property in jaxp.properties after it has been read for the first time.
* </li>
* <li>
- * Uses the service-provider loading facilities, defined by the
+ * <p>
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -90,26 +93,30 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise, the system-default implementation is returned.
* </li>
* </ul>
*
+ * <p>
* Once an application has obtained a reference to a
- * <code>DocumentBuilderFactory</code> it can use the factory to
+ * {@code DocumentBuilderFactory} it can use the factory to
* configure and obtain parser instances.
*
*
* <h2>Tip for Trouble-shooting</h2>
- * <p>Setting the <code>jaxp.debug</code> system property will cause
+ * <p>
+ * Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to <code>System.err</code> about what it is doing and where it is looking at.</p>
+ * to {@code System.err} about what it is doing and where it is looking at.
*
- * <p> If you have problems loading {@link DocumentBuilder}s, try:</p>
+ * <p>
+ * If you have problems loading {@link DocumentBuilder}s, try:
* <pre>
* java -Djaxp.debug=1 YourProgram ....
* </pre>
*
- * @return New instance of a <code>DocumentBuilderFactory</code>
+ * @return New instance of a {@code DocumentBuilderFactory}
*
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
@@ -124,31 +131,31 @@
}
/**
- * <p>Obtain a new instance of a <code>DocumentBuilderFactory</code> from class name.
+ * <p>Obtain a new instance of a {@code DocumentBuilderFactory} from class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
- * should be loaded.</p>
+ * should be loaded.
*
- * <p>Once an application has obtained a reference to a <code>DocumentBuilderFactory</code>
- * it can use the factory to configure and obtain parser instances.</p>
+ * <p>Once an application has obtained a reference to a {@code DocumentBuilderFactory}
+ * it can use the factory to configure and obtain parser instances.
*
*
* <h2>Tip for Trouble-shooting</h2>
- * <p>Setting the <code>jaxp.debug</code> system property will cause
+ * <p>Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to <code>System.err</code> about what it is doing and where it is looking at.</p>
+ * to {@code System.err} about what it is doing and where it is looking at.</p>
*
* <p> If you have problems try:</p>
* <pre>
* java -Djaxp.debug=1 YourProgram ....
* </pre>
*
- * @param factoryClassName fully qualified factory class name that provides implementation of <code>javax.xml.parsers.DocumentBuilderFactory</code>.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.parsers.DocumentBuilderFactory}.
*
* @param classLoader <code>ClassLoader</code> used to load the factory class. If <code>null</code>
* current <code>Thread</code>'s context classLoader is used to load the factory class.
*
- * @return New instance of a <code>DocumentBuilderFactory</code>
+ * @return New instance of a {@code DocumentBuilderFactory}
*
* @throws FactoryConfigurationError if <code>factoryClassName</code> is <code>null</code>, or
* the factory class cannot be loaded, instantiated.
@@ -406,14 +413,14 @@
throws IllegalArgumentException;
/**
- * <p>Set a feature for this <code>DocumentBuilderFactory</code> and <code>DocumentBuilder</code>s created by this factory.</p>
+ * <p>Set a feature for this {@code DocumentBuilderFactory} and <code>DocumentBuilder</code>s created by this factory.</p>
*
* <p>
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * A {@link ParserConfigurationException} is thrown if this <code>DocumentBuilderFactory</code> or the
+ * A {@link ParserConfigurationException} is thrown if this {@code DocumentBuilderFactory} or the
* <code>DocumentBuilder</code>s it creates cannot support the feature.
- * It is possible for a <code>DocumentBuilderFactory</code> to expose a feature value but be unable to change its state.
+ * It is possible for a {@code DocumentBuilderFactory} to expose a feature value but be unable to change its state.
* </p>
*
* <p>
@@ -436,7 +443,7 @@
* @param name Feature name.
* @param value Is feature state <code>true</code> or <code>false</code>.
*
- * @throws ParserConfigurationException if this <code>DocumentBuilderFactory</code> or the <code>DocumentBuilder</code>s
+ * @throws ParserConfigurationException if this {@code DocumentBuilderFactory} or the <code>DocumentBuilder</code>s
* it creates cannot support this feature.
* @throws NullPointerException If the <code>name</code> parameter is null.
* @since 1.5
@@ -450,16 +457,16 @@
* <p>
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * An {@link ParserConfigurationException} is thrown if this <code>DocumentBuilderFactory</code> or the
+ * An {@link ParserConfigurationException} is thrown if this {@code DocumentBuilderFactory} or the
* <code>DocumentBuilder</code>s it creates cannot support the feature.
- * It is possible for an <code>DocumentBuilderFactory</code> to expose a feature value but be unable to change its state.
+ * It is possible for an {@code DocumentBuilderFactory} to expose a feature value but be unable to change its state.
* </p>
*
* @param name Feature name.
*
* @return State of the named feature.
*
- * @throws ParserConfigurationException if this <code>DocumentBuilderFactory</code>
+ * @throws ParserConfigurationException if this {@code DocumentBuilderFactory}
* or the <code>DocumentBuilder</code>s it creates cannot support this feature.
* @since 1.5
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
index f2e9120..1160a62 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,31 +59,34 @@
}
/**
- * Obtain a new instance of a <code>SAXParserFactory</code>. This
+ * Obtain a new instance of a {@code SAXParserFactory}. This
* static method creates a new factory instance
* This method uses the following ordered lookup procedure to determine
- * the <code>SAXParserFactory</code> implementation class to
+ * the {@code SAXParserFactory} implementation class to
* load:
+ * <p>
* <ul>
* <li>
- * Use the <code>javax.xml.parsers.SAXParserFactory</code> system
+ * Use the {@code javax.xml.parsers.SAXParserFactory} system
* property.
* </li>
* <li>
- * Use the properties file "conf/jaxp.properties" in the JRE directory.
- * This configuration file is in standard <code>java.util.Properties
- * </code> format and contains the fully qualified name of the
- * implementation class with the key being the system property defined
- * above.
- *
+ * <p>
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ * <p>
* The jaxp.properties file is read only once by the JAXP implementation
- * and it's values are then cached for future use. If the file does not exist
+ * and its values are then cached for future use. If the file does not exist
* when the first attempt is made to read from it, no further attempts are
* made to check for its existence. It is not possible to change the value
* of any property in jaxp.properties after it has been read for the first time.
* </li>
* <li>
- * Use the service-provider loading facilities, defined by the
+ * <p>
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -94,22 +97,26 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise the system-default implementation is returned.
* </li>
* </ul>
*
+ * <p>
* Once an application has obtained a reference to a
- * <code>SAXParserFactory</code> it can use the factory to
+ * {@code SAXParserFactory} it can use the factory to
* configure and obtain parser instances.
*
*
*
* <h2>Tip for Trouble-shooting</h2>
- * <p>Setting the <code>jaxp.debug</code> system property will cause
+ * <p>
+ * Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to <code>System.err</code> about what it is doing and where it is looking at.</p>
+ * to {@code System.err} about what it is doing and where it is looking at.
*
- * <p> If you have problems loading {@link SAXParser}s, try:</p>
+ * <p>
+ * If you have problems loading {@link SAXParser}s, try:
* <pre>
* java -Djaxp.debug=1 YourProgram ....
* </pre>
@@ -131,31 +138,32 @@
}
/**
- * <p>Obtain a new instance of a <code>SAXParserFactory</code> from class name.
+ * <p>Obtain a new instance of a {@code SAXParserFactory} from class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
* should be loaded.</p>
*
- * <p>Once an application has obtained a reference to a <code>SAXParserFactory</code>
+ * <p>Once an application has obtained a reference to a {@code SAXParserFactory}
* it can use the factory to configure and obtain parser instances.</p>
*
*
* <h2>Tip for Trouble-shooting</h2>
- * <p>Setting the <code>jaxp.debug</code> system property will cause
+ * <p>Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to <code>System.err</code> about what it is doing and where it is looking at.</p>
+ * to {@code System.err} about what it is doing and where it is looking at.</p>
*
- * <p> If you have problems, try:</p>
+ * <p>
+ * If you have problems, try:
* <pre>
* java -Djaxp.debug=1 YourProgram ....
* </pre>
*
- * @param factoryClassName fully qualified factory class name that provides implementation of <code>javax.xml.parsers.SAXParserFactory</code>.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.parsers.SAXParserFactory}.
*
* @param classLoader <code>ClassLoader</code> used to load the factory class. If <code>null</code>
* current <code>Thread</code>'s context classLoader is used to load the factory class.
*
- * @return New instance of a <code>SAXParserFactory</code>
+ * @return New instance of a {@code SAXParserFactory}
*
* @throws FactoryConfigurationError if <code>factoryClassName</code> is <code>null</code>, or
* the factory class cannot be loaded, instantiated.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
index 548feeb..fc14bc6 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
@@ -23,7 +23,7 @@
*/
/*
- * Copyright (c) 2009, 2013, by Oracle Corporation. All Rights Reserved.
+ * Copyright (c) 2009, 2015, by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream;
@@ -70,19 +70,34 @@
* This static method creates a new factory instance.
* This method uses the following ordered lookup procedure to determine
* the XMLEventFactory implementation class to load:
- * </p>
+ * <p>
* <ul>
* <li>
* Use the javax.xml.stream.XMLEventFactory system property.
* </li>
* <li>
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the system property defined above.
+ * <p>
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * <p>
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ * <p>
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
* </li>
* <li>
- * Use the service-provider loading facilities, defined by the
+ * <p>
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -93,18 +108,18 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise, the system-default implementation is returned.
* </li>
* </ul>
* <p>
* Once an application has obtained a reference to a XMLEventFactory it
* can use the factory to configure and obtain stream instances.
- * </p>
* <p>
* Note that this is a new method that replaces the deprecated newInstance() method.
* No changes in behavior are defined by this replacement method relative to
* the deprecated method.
- * </p>
+ *
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
* the implementation is not available or cannot be instantiated.
@@ -143,20 +158,35 @@
* <p>
* This method uses the following ordered lookup procedure to determine
* the XMLEventFactory implementation class to load:
- * </p>
+ * <p>
* <ul>
* <li>
* Use the value of the system property identified by {@code factoryId}.
* </li>
* <li>
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the given {@code factoryId}.
+ * <p>
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * conf directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * <p>
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ * <p>
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
* </li>
* <li>
+ * <p>
* If {@code factoryId} is "javax.xml.stream.XMLEventFactory",
- * use the service-provider loading facilities, defined by the
+ * use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to {@linkplain
* java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load}
* an implementation of the service using the specified {@code ClassLoader}.
@@ -169,6 +199,7 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise, throws a {@link FactoryConfigurationError}.
* </li>
* </ul>
@@ -179,7 +210,6 @@
* newInstance(String factoryId, ClassLoader classLoader)} method.
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
- * </p>
*
* @apiNote The parameter factoryId defined here is inconsistent with that
* of other JAXP factories where the first parameter is fully qualified
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
index 20af7a0..9003037 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
@@ -68,7 +68,7 @@
*
*
* @version 1.2
- * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+ * @author Copyright (c) 2009, 2015 by Oracle Corporation. All Rights Reserved.
* @see XMLOutputFactory
* @see XMLEventReader
* @see XMLStreamReader
@@ -163,16 +163,28 @@
* </p>
* <ul>
* <li>
- * Use the javax.xml.stream.XMLInputFactory system property.
+ * <p>Use the javax.xml.stream.XMLInputFactory system property.
* </li>
* <li>
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the system property defined above.
+ * <p>Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * <p>The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ * <p>
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
* </li>
* <li>
- * Use the service-provider loading facilities, defined by the
+ * <p>Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -183,7 +195,7 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
- * Otherwise, the system-default implementation is returned.
+ * <p>Otherwise, the system-default implementation is returned.
* </li>
* </ul>
* <p>
@@ -233,20 +245,36 @@
* <p>
* This method uses the following ordered lookup procedure to determine
* the XMLInputFactory implementation class to load:
- * </p>
+ * <p>
* <ul>
* <li>
+ * <p>
* Use the value of the system property identified by {@code factoryId}.
* </li>
* <li>
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the given {@code factoryId}.
+ * <p>
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * <p>
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ * <p>
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
* </li>
* <li>
+ * <p>
* If {@code factoryId} is "javax.xml.stream.XMLInputFactory",
- * use the service-provider loading facilities, defined by the
+ * use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to {@linkplain
* java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load}
* an implementation of the service using the specified {@code ClassLoader}.
@@ -259,6 +287,7 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise, throws a {@link FactoryConfigurationError}.
* </li>
* </ul>
@@ -269,7 +298,7 @@
* newInstance(String factoryId, ClassLoader classLoader)} method.
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
- * </p>
+ *
*
* @apiNote The parameter factoryId defined here is inconsistent with that
* of other JAXP factories where the first parameter is fully qualified
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
index e875ac2..4524a4e 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
@@ -102,7 +102,7 @@
* namespace URI of the element or attribute using that prefix.</p>
*
* @version 1.2
- * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+ * @author Copyright (c) 2009, 2015 by Oracle Corporation. All Rights Reserved.
* @see XMLInputFactory
* @see XMLEventWriter
* @see XMLStreamWriter
@@ -136,19 +136,34 @@
* This static method creates a new factory instance. This method uses the
* following ordered lookup procedure to determine the XMLOutputFactory
* implementation class to load:
- * </p>
+ * <p>
* <ul>
* <li>
* Use the javax.xml.stream.XMLOutputFactory system property.
* </li>
* <li>
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the system property defined above.
+ * <p>
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * <p>
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ * <p>
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
* </li>
* <li>
- * Use the service-provider loading facilities, defined by the
+ * <p>
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -159,17 +174,17 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise, the system-default implementation is returned.
* </li>
* <p>
* Once an application has obtained a reference to a XMLOutputFactory it
* can use the factory to configure and obtain stream instances.
- * </p>
* <p>
* Note that this is a new method that replaces the deprecated newInstance() method.
* No changes in behavior are defined by this replacement method relative to the
* deprecated method.
- * </p>
+ *
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
* the implementation is not available or cannot be instantiated.
@@ -207,20 +222,35 @@
* <p>
* This method uses the following ordered lookup procedure to determine
* the XMLOutputFactory implementation class to load:
- * </p>
+ * <p>
* <ul>
* <li>
* Use the value of the system property identified by {@code factoryId}.
* </li>
* <li>
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the given {@code factoryId}.
+ * <p>
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * <p>
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ * <p>
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
* </li>
* <li>
+ * <p>
* If {@code factoryId} is "javax.xml.stream.XMLOutputFactory",
- * use the service-provider loading facilities, defined by the
+ * use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to {@linkplain
* java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load}
* an implementation of the service using the specified {@code ClassLoader}.
@@ -233,6 +263,7 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise, throws a {@link FactoryConfigurationError}.
* </li>
* </ul>
@@ -246,7 +277,7 @@
* {@link #newInstance(java.lang.String, java.lang.ClassLoader)
* newInstance(String factoryId, ClassLoader classLoader)} method.
* The original method was incorrectly defined to return XMLInputFactory.
- * </p>
+ *
*
* @param factoryId Name of the factory to find, same as
* a property name
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
index 846cda1..2fd931d 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
* <p>The system property that determines which Factory implementation
* to create is named <code>"javax.xml.transform.TransformerFactory"</code>.
* This property names a concrete subclass of the
- * <code>TransformerFactory</code> abstract class. If the property is not
+ * {@code TransformerFactory} abstract class. If the property is not
* defined, a platform default is be used.</p>
*
* @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
@@ -51,31 +51,36 @@
/**
- * <p>Obtain a new instance of a <code>TransformerFactory</code>.
- * This static method creates a new factory instance.</p>
- * <p>This method uses the following ordered lookup procedure to determine
- * the <code>TransformerFactory</code> implementation class to
- * load:</p>
+ * <p>
+ * Obtain a new instance of a {@code TransformerFactory}.
+ * This static method creates a new factory instance.
+ * <p>
+ * This method uses the following ordered lookup procedure to determine
+ * the {@code TransformerFactory} implementation class to
+ * load:
+ * <p>
* <ul>
* <li>
- * Use the <code>javax.xml.transform.TransformerFactory</code> system
+ * Use the {@code javax.xml.transform.TransformerFactory} system
* property.
* </li>
* <li>
- * Use the properties file "conf/jaxp.properties" in the JRE directory.
- * This configuration file is in standard <code>java.util.Properties
- * </code> format and contains the fully qualified name of the
- * implementation class with the key being the system property defined
- * above.
- * <br>
+ * <p>
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ * <p>
* The jaxp.properties file is read only once by the JAXP implementation
- * and it's values are then cached for future use. If the file does not exist
+ * and its values are then cached for future use. If the file does not exist
* when the first attempt is made to read from it, no further attempts are
* made to check for its existence. It is not possible to change the value
* of any property in jaxp.properties after it has been read for the first time.
* </li>
* <li>
- * Use the service-provider loading facilities, defined by the
+ * <p>
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -86,13 +91,15 @@
* ClassLoader#getSystemClassLoader() system class loader} will be used.
* </li>
* <li>
+ * <p>
* Otherwise, the system-default implementation is returned.
* </li>
* </ul>
*
- * <p>Once an application has obtained a reference to a <code>
- * TransformerFactory</code> it can use the factory to configure
- * and obtain transformer instances.</p>
+ * <p>
+ * Once an application has obtained a reference to a
+ * {@code TransformerFactory} it can use the factory to configure
+ * and obtain transformer instances.
*
* @return new TransformerFactory instance, never null.
*
@@ -111,13 +118,13 @@
}
/**
- * <p>Obtain a new instance of a <code>TransformerFactory</code> from factory class name.
+ * <p>Obtain a new instance of a {@code TransformerFactory} from factory class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
* should be loaded.</p>
*
- * <p>Once an application has obtained a reference to a <code>
- * TransformerFactory</code> it can use the factory to configure
+ * <p>Once an application has obtained a reference to a
+ * {@code TransformerFactory} it can use the factory to configure
* and obtain transformer instances.</p>
*
* <h2>Tip for Trouble-shooting</h2>
@@ -130,7 +137,7 @@
* java -Djaxp.debug=1 YourProgram ....
* </pre>
*
- * @param factoryClassName fully qualified factory class name that provides implementation of <code>javax.xml.transform.TransformerFactory</code>.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.transform.TransformerFactory}.
*
* @param classLoader <code>ClassLoader</code> used to load the factory class. If <code>null</code>
* current <code>Thread</code>'s context classLoader is used to load the factory class.
@@ -232,7 +239,7 @@
* @param charset The value of the charset attribute to match. May be null.
*
* @return A <code>Source</code> <code>Object</code> suitable for passing
- * to the <code>TransformerFactory</code>.
+ * to the {@code TransformerFactory}.
*
* @throws TransformerConfigurationException An <code>Exception</code>
* is thrown if an error occurings during parsing of the
@@ -268,15 +275,15 @@
//======= CONFIGURATION METHODS =======
/**
- * <p>Set a feature for this <code>TransformerFactory</code> and <code>Transformer</code>s
+ * <p>Set a feature for this {@code TransformerFactory} and <code>Transformer</code>s
* or <code>Template</code>s created by this factory.</p>
*
* <p>
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the
+ * An {@link TransformerConfigurationException} is thrown if this {@code TransformerFactory} or the
* <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
- * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
+ * It is possible for an {@code TransformerFactory} to expose a feature value but be unable to change its state.
* </p>
*
* <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
@@ -299,7 +306,7 @@
* @param name Feature name.
* @param value Is feature state <code>true</code> or <code>false</code>.
*
- * @throws TransformerConfigurationException if this <code>TransformerFactory</code>
+ * @throws TransformerConfigurationException if this {@code TransformerFactory}
* or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature.
* @throws NullPointerException If the <code>name</code> parameter is null.
*/
@@ -312,9 +319,9 @@
* <p>
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * <code>false</code> is returned if this <code>TransformerFactory</code> or the
+ * <code>false</code> is returned if this {@code TransformerFactory} or the
* <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
- * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
+ * It is possible for an {@code TransformerFactory} to expose a feature value but be unable to change its state.
* </p>
*
* @param name Feature name.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
index 527c6c7..ad7e61f 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -132,8 +132,9 @@
* where "the class loader" refers to the context class loader:</p>
* <ol>
* <li>
+ * <p>
* If the system property
- * <code>"javax.xml.validation.SchemaFactory:<i>schemaLanguage</i>"</code>
+ * {@code "javax.xml.validation.SchemaFactory:<i>schemaLanguage</i>"}
* is present (where <i>schemaLanguage</i> is the parameter
* to this method), then its value is read
* as a class name. The method will try to
@@ -141,12 +142,22 @@
* and returns it if it is successfully created.
* </li>
* <li>
- * <code>$java.home/conf/jaxp.properties</code> is read and
- * the value associated with the key being the system property above
- * is looked for. If present, the value is processed just like above.
+ * <p>
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * conf directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ * <p>
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
* </li>
* <li>
- * Use the service-provider loading facilities, defined by the
+ * <p>
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -166,19 +177,20 @@
* {@link SchemaFactoryConfigurationError} will be thrown.
* </li>
* <li>
+ * <p>
* Platform default <code>SchemaFactory</code> is located
* in a implementation specific way. There must be a platform default
* <code>SchemaFactory</code> for W3C XML Schema.
* </li>
* </ol>
*
- * <p>If everything fails, {@link IllegalArgumentException} will be thrown.</p>
+ * <p>If everything fails, {@link IllegalArgumentException} will be thrown.
*
- * <p><strong>Tip for Trouble-shooting:</strong></p>
+ * <p><strong>Tip for Trouble-shooting:</strong>
* <p>See {@link java.util.Properties#load(java.io.InputStream)} for
* exactly how a property file is parsed. In particular, colons ':'
* need to be escaped in a property file, so make sure schema language
- * URIs are properly escaped in it. For example:</p>
+ * URIs are properly escaped in it. For example:
* <pre>
* http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
* </pre>
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
index ea7370e..05f7a4e 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package javax.xml.xpath;
/**
- * <p>An <code>XPathFactory</code> instance can be used to create
+ * <p>An {@code XPathFactory} instance can be used to create
* {@link javax.xml.xpath.XPath} objects.</p>
*
*<p>See {@link #newInstance(String uri)} for lookup mechanism.</p>
@@ -68,13 +68,13 @@
/**
* <p>Protected constructor as {@link #newInstance()} or {@link #newInstance(String uri)}
* or {@link #newInstance(String uri, String factoryClassName, ClassLoader classLoader)}
- * should be used to create a new instance of an <code>XPathFactory</code>.</p>
+ * should be used to create a new instance of an {@code XPathFactory}.</p>
*/
protected XPathFactory() {
}
/**
- * <p>Get a new <code>XPathFactory</code> instance using the default object model,
+ * <p>Get a new {@code XPathFactory} instance using the default object model,
* {@link #DEFAULT_OBJECT_MODEL_URI},
* the W3C DOM.</p>
*
@@ -85,10 +85,10 @@
*
* <p>Since the implementation for the W3C DOM is always available, this method will never fail.</p>
*
- * @return Instance of an <code>XPathFactory</code>.
+ * @return Instance of an {@code XPathFactory}.
*
* @throws RuntimeException When there is a failure in creating an
- * <code>XPathFactory</code> for the default object model.
+ * {@code XPathFactory} for the default object model.
*/
public static XPathFactory newInstance() {
@@ -105,23 +105,35 @@
}
/**
- * <p>Get a new <code>XPathFactory</code> instance using the specified object model.</p>
+ * <p>Get a new {@code XPathFactory} instance using the specified object model.</p>
*
- * <p>To find a <code>XPathFactory</code> object,
+ * <p>To find a {@code XPathFactory} object,
* this method looks the following places in the following order where "the class loader" refers to the context class loader:</p>
* <ol>
* <li>
+ * <p>
* If the system property {@link #DEFAULT_PROPERTY_NAME} + ":uri" is present,
* where uri is the parameter to this method, then its value is read as a class name.
* The method will try to create a new instance of this class by using the class loader,
* and returns it if it is successfully created.
* </li>
* <li>
- * ${java.home}/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for.
- * If present, the value is processed just like above.
+ * <p>
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * conf directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ * <p>
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
* </li>
* <li>
- * Use the service-provider loading facilities, defined by the
+ * <p>
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -140,16 +152,17 @@
* {@link XPathFactoryConfigurationException} will be thrown.
* </li>
* <li>
- * Platform default <code>XPathFactory</code> is located in a platform specific way.
+ * <p>
+ * Platform default {@code XPathFactory} is located in a platform specific way.
* There must be a platform default XPathFactory for the W3C DOM, i.e. {@link #DEFAULT_OBJECT_MODEL_URI}.
* </li>
* </ol>
- * <p>If everything fails, an <code>XPathFactoryConfigurationException</code> will be thrown.</p>
+ * <p>If everything fails, an {@code XPathFactoryConfigurationException} will be thrown.
*
- * <p>Tip for Trouble-shooting:</p>
+ * <p>Tip for Trouble-shooting:
* <p>See {@link java.util.Properties#load(java.io.InputStream)} for exactly how a property file is parsed.
* In particular, colons ':' need to be escaped in a property file, so make sure the URIs are properly escaped in it.
- * For example:</p>
+ * For example:
* <pre>
* http\://java.sun.com/jaxp/xpath/dom=org.acme.DomXPathFactory
* </pre>
@@ -159,7 +172,7 @@
* <code>http://java.sun.com/jaxp/xpath/dom</code> for the W3C DOM,
* the org.w3c.dom package, and implementations are free to introduce other URIs for other object models.
*
- * @return Instance of an <code>XPathFactory</code>.
+ * @return Instance of an {@code XPathFactory}.
*
* @throws XPathFactoryConfigurationException If the specified object model
* is unavailable, or if there is a configuration error.
@@ -199,7 +212,7 @@
}
/**
- * <p>Obtain a new instance of a <code>XPathFactory</code> from a factory class name. <code>XPathFactory</code>
+ * <p>Obtain a new instance of a {@code XPathFactory} from a factory class name. {@code XPathFactory}
* is returned if specified factory class supports the specified object model.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
@@ -227,7 +240,7 @@
* current <code>Thread</code>'s context classLoader is used to load the factory class.
*
*
- * @return New instance of a <code>XPathFactory</code>
+ * @return New instance of a {@code XPathFactory}
*
* @throws XPathFactoryConfigurationException
* if <code>factoryClassName</code> is <code>null</code>, or
@@ -281,11 +294,11 @@
}
/**
- * <p>Is specified object model supported by this <code>XPathFactory</code>?</p>
+ * <p>Is specified object model supported by this {@code XPathFactory}?</p>
*
- * @param objectModel Specifies the object model which the returned <code>XPathFactory</code> will understand.
+ * @param objectModel Specifies the object model which the returned {@code XPathFactory} will understand.
*
- * @return <code>true</code> if <code>XPathFactory</code> supports <code>objectModel</code>, else <code>false</code>.
+ * @return <code>true</code> if {@code XPathFactory} supports <code>objectModel</code>, else <code>false</code>.
*
* @throws NullPointerException If <code>objectModel</code> is <code>null</code>.
* @throws IllegalArgumentException If <code>objectModel.length() == 0</code>.
@@ -293,16 +306,16 @@
public abstract boolean isObjectModelSupported(String objectModel);
/**
- * <p>Set a feature for this <code>XPathFactory</code> and
+ * <p>Set a feature for this {@code XPathFactory} and
* <code>XPath</code>s created by this factory.</p>
*
* <p>
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
* An {@link XPathFactoryConfigurationException} is thrown if this
- * <code>XPathFactory</code> or the <code>XPath</code>s
+ * {@code XPathFactory} or the <code>XPath</code>s
* it creates cannot support the feature.
- * It is possible for an <code>XPathFactory</code> to expose a feature value
+ * It is possible for an {@code XPathFactory} to expose a feature value
* but be unable to change its state.
* </p>
*
@@ -316,7 +329,7 @@
* @param name Feature name.
* @param value Is feature state <code>true</code> or <code>false</code>.
*
- * @throws XPathFactoryConfigurationException if this <code>XPathFactory</code> or the <code>XPath</code>s
+ * @throws XPathFactoryConfigurationException if this {@code XPathFactory} or the <code>XPath</code>s
* it creates cannot support this feature.
* @throws NullPointerException if <code>name</code> is <code>null</code>.
*/
@@ -330,9 +343,9 @@
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
* An {@link XPathFactoryConfigurationException} is thrown if this
- * <code>XPathFactory</code> or the <code>XPath</code>s
+ * {@code XPathFactory} or the <code>XPath</code>s
* it creates cannot support the feature.
- * It is possible for an <code>XPathFactory</code> to expose a feature value
+ * It is possible for an {@code XPathFactory} to expose a feature value
* but be unable to change its state.
* </p>
*
@@ -341,7 +354,7 @@
* @return State of the named feature.
*
* @throws XPathFactoryConfigurationException if this
- * <code>XPathFactory</code> or the <code>XPath</code>s
+ * {@code XPathFactory} or the <code>XPath</code>s
* it creates cannot support this feature.
* @throws NullPointerException if <code>name</code> is <code>null</code>.
*/
@@ -382,7 +395,7 @@
/**
* <p>Return a new <code>XPath</code> using the underlying object
- * model determined when the <code>XPathFactory</code> was instantiated.</p>
+ * model determined when the {@code XPathFactory} was instantiated.</p>
*
* @return New instance of an <code>XPath</code>.
*/
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index cb0c2af..4d619c6 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -299,3 +299,4 @@
bb9cf97a5ac6aa1aa2a1034676d64413071f58ea jdk9-b51
1d1e7704eca9c77ebe6a8705d17ac568801f7a3b jdk9-b52
b8fbe40efa97fe0753076ccc6dfc50747c7877d0 jdk9-b53
+83a0cf0e08788c33872e1fe3e87bf9a0d1e59eaa jdk9-b54
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 7b8fe32..6c1c4c3 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -296,3 +296,4 @@
a0dad230aeb3b0d5cfd5b0715029e48d50573f8c jdk9-b51
607ea68032cd4a4cf2c7a7a41fcb39602d6a75e2 jdk9-b52
6cb5f5c34009630749a40cefe116d143f0b2583e jdk9-b53
+568a62ab7d764d7c74ac1d87387dbe500662b551 jdk9-b54
diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk
index ed7ba13..2d10867 100644
--- a/jdk/make/CompileDemos.gmk
+++ b/jdk/make/CompileDemos.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -219,6 +219,9 @@
# Param 7 = libs for solaris
# Param 8 = libs for linux
# Param 9 = extra directories with required sources
+ # Param 10 = DISABLED_WARNINGS_gcc
+ # Param 11 = DISABLED_WARNINGS_microsoft
+ # Param 12 = DISABLED_WARNINGS_clang
BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
$$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \
$$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
@@ -254,6 +257,9 @@
LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
OPTIMIZATION := LOW, \
CXXFLAGS := $$($1_CXXFLAGS), \
+ DISABLED_WARNINGS_gcc := $(10), \
+ DISABLED_WARNINGS_clang := $(12), \
+ DISABLED_WARNINGS_microsoft := $(11), \
LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
diff --git a/jdk/make/gendata/GendataPolicyJars.gmk b/jdk/make/gendata/GendataPolicyJars.gmk
index 9364159..256b32e 100644
--- a/jdk/make/gendata/GendataPolicyJars.gmk
+++ b/jdk/make/gendata/GendataPolicyJars.gmk
@@ -77,7 +77,7 @@
$(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, \
- $(US_EXPORT_POLICY_JAR_DEPS), \
+ DEPENDENCIES := $(US_EXPORT_POLICY_JAR_DEPS), \
SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
SUFFIXES := .policy, \
JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED), \
@@ -139,8 +139,8 @@
$(install-file)
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
- $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
- $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
+ DEPENDENCIES := $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
SUFFIXES := .policy, \
JAR := $(LOCAL_POLICY_JAR_LIMITED), \
@@ -148,7 +148,7 @@
SKIP_METAINF := true))
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
- $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
+ DEPENDENCIES := $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
SUFFIXES := .policy, \
JAR := $(LOCAL_POLICY_JAR_UNLIMITED), \
diff --git a/jdk/make/gensrc/Gensrc-jdk.dev.gmk b/jdk/make/gensrc/Gensrc-jdk.dev.gmk
index 0c956ab..b8f57aa 100644
--- a/jdk/make/gensrc/Gensrc-jdk.dev.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.dev.gmk
@@ -32,8 +32,7 @@
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
$(filter %.properties, \
$(call CacheFind, \
- $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources \
- $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
+ $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources)), \
ListResourceBundle))
TARGETS += $(COMPILE_PROPERTIES)
diff --git a/jdk/make/gensrc/Gensrc-jdk.jartool.gmk b/jdk/make/gensrc/Gensrc-jdk.jartool.gmk
new file mode 100644
index 0000000..0fb8eab
--- /dev/null
+++ b/jdk/make/gensrc/Gensrc-jdk.jartool.gmk
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, \
+ $(call CacheFind, \
+ $(JDK_TOPDIR)/src/jdk.jartool/share/classes/sun/tools/jar/resources)), \
+ ListResourceBundle))
+
+TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all
diff --git a/jdk/make/launcher/Launcher-jdk.dev.gmk b/jdk/make/launcher/Launcher-jdk.dev.gmk
index 92b6d1b..b58545e 100644
--- a/jdk/make/launcher/Launcher-jdk.dev.gmk
+++ b/jdk/make/launcher/Launcher-jdk.dev.gmk
@@ -25,18 +25,6 @@
include LauncherCommon.gmk
-$(eval $(call SetupLauncher,jar, \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jarsigner, \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
-
-ifndef BUILD_HEADLESS_ONLY
- $(eval $(call SetupLauncher,policytool, \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
- $(XLIBS)))
-endif
-
$(eval $(call SetupLauncher,jdeps, \
-DEXPAND_CLASSPATH_WILDCARDS \
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
diff --git a/jdk/make/launcher/Launcher-jdk.jartool.gmk b/jdk/make/launcher/Launcher-jdk.jartool.gmk
new file mode 100644
index 0000000..b6d44e3
--- /dev/null
+++ b/jdk/make/launcher/Launcher-jdk.jartool.gmk
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include LauncherCommon.gmk
+
+$(eval $(call SetupLauncher,jar, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jarsigner, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.pack200.gmk
similarity index 90%
rename from jdk/make/launcher/Launcher-jdk.runtime.gmk
rename to jdk/make/launcher/Launcher-jdk.pack200.gmk
index 366dc5c..6ee00f7 100644
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,9 @@
# The order of the object files on the link command line affects the size of the resulting
# binary (at least on linux) which causes the size to differ between old and new build.
-UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
- $(JDK_TOPDIR)/src/jdk.runtime/share/native/unpack200
-UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
+UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
+ $(JDK_TOPDIR)/src/jdk.pack200/share/native/unpack200
+UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
@@ -79,6 +79,9 @@
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC, \
+ DISABLED_WARNINGS_gcc := sign-compare unused-result format-nonliteral \
+ format-security parentheses, \
+ DISABLED_WARNINGS_microsoft := 4267 4018, \
MAPFILE := $(UNPACK_MAPFILE),\
LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
@@ -96,7 +99,7 @@
-D "JDK_INTERNAL_NAME=unpack200" \
-D "JDK_FTYPE=0x1L", \
DEBUG_SYMBOLS := true, \
- MANIFEST := $(JDK_TOPDIR)/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest))
+ MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest))
ifneq ($(USE_EXTERNAL_LIBZ), true)
diff --git a/jdk/make/launcher/Launcher-jdk.policytool.gmk b/jdk/make/launcher/Launcher-jdk.policytool.gmk
new file mode 100644
index 0000000..133e3f6
--- /dev/null
+++ b/jdk/make/launcher/Launcher-jdk.policytool.gmk
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include LauncherCommon.gmk
+
+ifndef BUILD_HEADLESS_ONLY
+ $(eval $(call SetupLauncher,policytool, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
+ $(XLIBS)))
+endif
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index d7e5077..5490686 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,9 @@
OPTIMIZATION := HIGHEST, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(BUILD_LIBMLIB_CFLAGS), \
+ DISABLED_WARNINGS_gcc := parentheses, \
+ DISABLED_WARNINGS_clang := parentheses, \
+ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -127,6 +130,7 @@
CFLAGS := -xarch=sparcvis \
$(LIBMLIB_IMAGE_V_CFLAGS) \
$(CFLAGS_JDKLIB), \
+ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
@@ -175,9 +179,6 @@
LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-endif
-
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
LIBAWT_CFLAGS += -xarch=sparcvis
@@ -253,6 +254,11 @@
LANG := $(LIBAWT_LANG), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
+ DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
+ format-nonliteral parentheses, \
+ DISABLED_WARNINGS_clang := logical-op-parentheses, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+ DISABLED_WARNINGS_microsoft := 4297 4244 4267, \
ASFLAGS := $(LIBAWT_ASFLAGS), \
MAPFILE := $(LIBAWT_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -361,6 +367,11 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
$(X_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
+ deprecated-declarations unused-result maybe-uninitialized format \
+ format-security int-to-pointer-cast parentheses, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
+ E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
@@ -417,6 +428,9 @@
$(LCMS_CFLAGS), \
CFLAGS_solaris := -xc99=no_lib, \
CFLAGS_windows := -DCMS_IS_WINDOWS_, \
+ DISABLED_WARNINGS_gcc := format-nonliteral, \
+ DISABLED_WARNINGS_clang := tautological-compare, \
+ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -495,6 +509,9 @@
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+ DISABLED_WARNINGS_gcc := clobbered parentheses, \
+ DISABLED_WARNINGS_clang := logical-op-parentheses, \
+ DISABLED_WARNINGS_microsoft := 4267, \
MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -563,6 +580,9 @@
$(CUPS_CFLAGS) \
$(X_CFLAGS) \
$(LIBAWT_HEADLESS_CFLAGS), \
+ DISABLED_WARNINGS_gcc := maybe-uninitialized int-to-pointer-cast, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
+ E_EMPTY_TRANSLATION_UNIT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -644,6 +664,11 @@
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
+ DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast reorder \
+ delete-non-virtual-dtor, \
+ DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types, \
+ DISABLED_WARNINGS_solstudio := truncwarn, \
+ DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090, \
MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -876,6 +901,10 @@
OPTIMIZATION := LOW, \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits unused-result maybe-uninitialized, \
+ DISABLED_WARNINGS_clang := incompatible-pointer-types, \
+ DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST, \
+ DISABLED_WARNINGS_microsoft := 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -946,6 +975,9 @@
$(X_CFLAGS) \
$(X_LIBS) \
$(LIBAWT_LWAWT_CFLAGS), \
+ DISABLED_WARNINGS_clang := incomplete-implementation \
+ deprecated-declarations objc-method-access bitwise-op-parentheses \
+ incompatible-pointer-types parentheses-equality extra-tokens, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
-L$(INSTALL_LIBRARIES_HERE), \
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index 7046e35..678af20 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
##########################################################################################
-# libfdlibm is statically linked with libjava below and not delivered into the
+# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
@@ -48,6 +48,8 @@
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
CFLAGS_windows_debug := -DLOGGING, \
CFLAGS_aix := -qfloat=nomaf, \
+ DISABLED_WARNINGS_gcc := sign-compare, \
+ DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -94,6 +96,7 @@
LANG := C, \
OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
CFLAGS := $(CFLAGS_JDKLIB), \
+ DISABLED_WARNINGS_microsoft := 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -147,6 +150,10 @@
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits format-nonliteral, \
+ DISABLED_WARNINGS_clang := int-conversion, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+ DISABLED_WARNINGS_microsoft := 4022 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -209,6 +216,9 @@
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
+ DISABLED_WARNINGS_gcc := parentheses, \
+ DISABLED_WARNINGS_clang := dangling-else, \
+ DISABLED_WARNINGS_microsoft := 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
REORDER := $(BUILD_LIBZIP_REORDER), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -307,6 +317,12 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
+ DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \
+ parentheses, \
+ DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
+ int-conversion, \
+ DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION E_NEWLINE_NOT_LAST, \
+ DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -355,6 +371,7 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
+ DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -375,6 +392,8 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
+ DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
+ int-conversion, \
LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -401,4 +420,3 @@
TARGETS += $(BUILD_LIBJLI_STATIC)
endif
-
diff --git a/jdk/make/lib/Lib-java.security.jgss.gmk b/jdk/make/lib/Lib-java.security.jgss.gmk
index ba78eb4..a92212f 100644
--- a/jdk/make/lib/Lib-java.security.jgss.gmk
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+ DISABLED_WARNINGS_gcc := pointer-to-int-cast, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2gss/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -82,6 +83,7 @@
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(BUILD_LIBKRB5_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+ DISABLED_WARNINGS_clang := implicit-function-declaration, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
diff --git a/jdk/make/lib/Lib-jdk.crypto.ec.gmk b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
index db75429..564eb40 100644
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,8 @@
-DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
CXXFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
$(BUILD_LIBSUNEC_FLAGS), \
+ DISABLED_WARNINGS_gcc := sign-compare, \
+ DISABLED_WARNINGS_microsoft := 4101 4244 4146 4018, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsunec/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
index bbd6bc3..0672aa3 100644
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,8 @@
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.pkcs11, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+ DISABLED_WARNINGS_microsoft := 4013 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/Lib-jdk.deploy.osx.gmk b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
index 628c17f..f68b9c0 100644
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(LIBAPPLESCRIPTENGINE_SRC) \
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx, \
+ DISABLED_WARNINGS_clang := implicit-function-declaration format, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := -framework Cocoa \
@@ -71,6 +72,7 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBOSX_CFLAGS), \
+ DISABLED_WARNINGS_clang := deprecated-declarations, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/Lib-jdk.runtime.gmk b/jdk/make/lib/Lib-jdk.pack200.gmk
similarity index 83%
rename from jdk/make/lib/Lib-jdk.runtime.gmk
rename to jdk/make/lib/Lib-jdk.pack200.gmk
index 4bf9b02..b8bab61 100644
--- a/jdk/make/lib/Lib-jdk.runtime.gmk
+++ b/jdk/make/lib/Lib-jdk.pack200.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -30,16 +30,20 @@
$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
LIBRARY := unpack, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libunpack \
- $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack, \
+ SRC := $(JDK_TOPDIR)/src/jdk.pack200/share/native/libunpack \
+ $(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack, \
LANG := C++, \
OPTIMIZATION := LOW, \
CFLAGS := $(CXXFLAGS_JDKLIB) \
-DNO_ZLIB -DUNPACK_JNI -DFULL \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
- -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
+ -I$(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
$(LIBJAVA_HEADER_FLAGS), \
CFLAGS_release := -DPRODUCT, \
+ DISABLED_WARNINGS_gcc := conversion-null sign-compare format-security \
+ format-nonliteral parentheses, \
+ DISABLED_WARNINGS_solstudio := truncwarn, \
+ DISABLED_WARNINGS_microsoft := 4267 4018, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/NetworkingLibraries.gmk b/jdk/make/lib/NetworkingLibraries.gmk
index 57d86ea..4231121 100644
--- a/jdk/make/lib/NetworkingLibraries.gmk
+++ b/jdk/make/lib/NetworkingLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,9 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
$(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
+ DISABLED_WARNINGS_gcc := format-nonliteral, \
+ DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
+ DISABLED_WARNINGS_microsoft := 4244 4047 4133, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/NioLibraries.gmk b/jdk/make/lib/NioLibraries.gmk
index 9a6e3e0..fd973cc 100644
--- a/jdk/make/lib/NioLibraries.gmk
+++ b/jdk/make/lib/NioLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,9 @@
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(BUILD_LIBNIO_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits, \
+ DISABLED_WARNINGS_clang := tautological-compare, \
+ DISABLED_WARNINGS_microsoft := 4244, \
MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -92,4 +95,3 @@
TARGETS += $(BUILD_LIBNIO)
$(BUILD_LIBNIO): $(BUILD_LIBNET)
-
diff --git a/jdk/make/lib/PlatformLibraries.gmk b/jdk/make/lib/PlatformLibraries.gmk
index 1459221..0035b1d 100644
--- a/jdk/make/lib/PlatformLibraries.gmk
+++ b/jdk/make/lib/PlatformLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(LIBOSXAPP_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+ DISABLED_WARNINGS_clang := objc-method-access objc-root-class, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX_macosx := \
@@ -59,4 +60,3 @@
TARGETS += $(BUILD_LIBOSXAPP)
endif
-
diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk
index ec3b99d..f123d17 100644
--- a/jdk/make/lib/SoundLibraries.gmk
+++ b/jdk/make/lib/SoundLibraries.gmk
@@ -129,6 +129,8 @@
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJSOUND_CFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+ DISABLED_WARNINGS_clang := implicit-function-declaration \
+ deprecated-writable-strings, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -175,6 +177,7 @@
-DUSE_PORTS=TRUE \
-DUSE_PLATFORM_MIDI_OUT=TRUE \
-DUSE_PLATFORM_MIDI_IN=TRUE, \
+ DISABLED_WARNINGS_gcc := parentheses, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c b/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c
index 0f78bc9..72c9717 100644
--- a/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c
+++ b/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c
@@ -143,7 +143,7 @@
for (i = 0; i < numpcs; i++) {
PCStackInfo pcrecord = (record->pcinfo[i]);
- fprintf(fp, "PcDescriptor(pc=0x%lx):\n", (jint)(pcrecord.pc));
+ fprintf(fp, "PcDescriptor(pc=%p):\n", pcrecord.pc);
print_stack_frames(&pcrecord, jvmti, fp);
}
}
diff --git a/jdk/src/demo/share/jvmti/waiters/Agent.cpp b/jdk/src/demo/share/jvmti/waiters/Agent.cpp
index cf2285c..8f67f54 100644
--- a/jdk/src/demo/share/jvmti/waiters/Agent.cpp
+++ b/jdk/src/demo/share/jvmti/waiters/Agent.cpp
@@ -111,8 +111,6 @@
/* VM initialization and VM death calls to Agent */
Agent::Agent(jvmtiEnv *jvmti, JNIEnv *env, jthread thread)
{
- jvmtiError err;
-
stdout_message("Agent created..\n");
stdout_message("VMInit...\n");
/* Start monitor list */
@@ -129,8 +127,6 @@
void Agent::vm_death(jvmtiEnv *jvmti, JNIEnv *env)
{
- jvmtiError err;
-
/* Delete all Monitors we allocated */
for ( int i = 0; i < (int)monitor_count; i++ ) {
delete monitor_list[i];
diff --git a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
index 07a31a0..b9ffb20 100644
--- a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
+++ b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,8 +45,13 @@
* The X509V1CertImpl class is used as a conversion wrapper around
* sun.security.x509.X509Cert certificates when running under JDK1.1.x.
*
+ * @deprecated This is the implementation class for the deprecated
+ * {@code javax.security.cert.X509Certificate} class. The classes in the
+ * {@code java.security.cert} package should be used instead.
+ *
* @author Jeff Nisewanger
*/
+@Deprecated
public class X509V1CertImpl extends X509Certificate implements Serializable {
static final long serialVersionUID = -2048442350420423405L;
private java.security.cert.X509Certificate wrappedCert;
diff --git a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
index 72b2603..940084c 100644
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
@@ -171,6 +171,11 @@
* variables, first call {@link java.util.Map#clear() Map.clear()}
* before adding environment variables.
*
+ * <p>
+ * Unless otherwise noted, passing a {@code null} argument to a constructor
+ * or method in this class will cause a {@link NullPointerException} to be
+ * thrown.
+ *
* @author Martin Buchholz
* @since 1.5
*/
@@ -193,7 +198,6 @@
* command.
*
* @param command the list containing the program and its arguments
- * @throws NullPointerException if the argument is null
*/
public ProcessBuilder(List<String> command) {
if (command == null)
@@ -228,8 +232,6 @@
*
* @param command the list containing the program and its arguments
* @return this process builder
- *
- * @throws NullPointerException if the argument is null
*/
public ProcessBuilder command(List<String> command) {
if (command == null)
@@ -554,7 +556,6 @@
* }</pre>
*
* @param file The {@code File} for the {@code Redirect}.
- * @throws NullPointerException if the specified file is null
* @return a redirect to read from the specified file
*/
public static Redirect from(final File file) {
@@ -581,7 +582,6 @@
* }</pre>
*
* @param file The {@code File} for the {@code Redirect}.
- * @throws NullPointerException if the specified file is null
* @return a redirect to write to the specified file
*/
public static Redirect to(final File file) {
@@ -612,7 +612,6 @@
* }</pre>
*
* @param file The {@code File} for the {@code Redirect}.
- * @throws NullPointerException if the specified file is null
* @return a redirect to append to the specified file
*/
public static Redirect appendTo(final File file) {
diff --git a/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template b/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template
index f5e50a5..faa51bb 100644
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template
@@ -266,16 +266,15 @@
* method, passing the new replacement, after checking that the new
* replacement is acceptable. </p>
*
- * @param newReplacement The replacement value
- *
+ * @param newReplacement The new replacement; must not be
+ * <tt>null</tt>, must have non-zero length,
#if[decoder]
- * The new replacement; must not be <tt>null</tt>
- * and must have non-zero length
+ * and must not be longer than the value returned by the
+ * {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method
#end[decoder]
#if[encoder]
- * The new replacement; must not be <tt>null</tt>, must have
- * non-zero length, must not be longer than the value returned by
- * the {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and
+ * must not be longer than the value returned by the
+ * {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and
* must be {@link #isLegalReplacement legal}
#end[encoder]
*
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Acl.java b/jdk/src/java.base/share/classes/java/security/acl/Acl.java
index cffb48e..9131966 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Acl.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Acl.java
@@ -82,8 +82,12 @@
* @see java.security.acl.Acl#getPermissions
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Acl extends Owner {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java b/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java
index cd9675f..dd4e548 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,11 @@
* @see java.security.acl.Acl
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface AclEntry extends Cloneable {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java b/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java
index 6f08e17..0a153e2 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,11 @@
* non-existent ACL (Access Control List).
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public class AclNotFoundException extends Exception {
private static final long serialVersionUID = 5684295034092681791L;
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Group.java b/jdk/src/java.base/share/classes/java/security/acl/Group.java
index ebd9c44..9ff69f5 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Group.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Group.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,11 @@
* Principal or Group.
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Group extends Principal {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java b/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java
index 196c8f1..b25bf84 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,11 @@
* @see java.security.acl.Owner#deleteOwner
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public class LastOwnerException extends Exception {
private static final long serialVersionUID = -5141997548211140359L;
diff --git a/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java b/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java
index 0a4b04b..68d214d 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,11 @@
* the object, but the Principal attempting the modification is not an owner.
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public class NotOwnerException extends Exception {
private static final long serialVersionUID = -5555597911163362399L;
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Owner.java b/jdk/src/java.base/share/classes/java/security/acl/Owner.java
index 2f649d4..2a4999b 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Owner.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Owner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,10 @@
*
* @see java.security.acl.Acl
*
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Owner {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Permission.java b/jdk/src/java.base/share/classes/java/security/acl/Permission.java
index 380a010..236f107 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Permission.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Permission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,11 @@
* a particular type of access to a resource.
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Permission {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/package-info.java b/jdk/src/java.base/share/classes/java/security/acl/package-info.java
index fbe5a8d..f0362fd 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/package-info.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,12 @@
*/
/**
- * The classes and interfaces in this package have been
- * superseded by classes in the java.security package.
- * See that package and, for example, java.security.Permission for details.
+ * The classes and interfaces in this package have been deprecated.
+ * The {@code java.security} package contains suitable replacements.
+ * See that package and, for example, {@code java.security.Permission}
+ * for details.
*
* @since 1.1
*/
+@Deprecated
package java.security.acl;
diff --git a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
index 90a94ed..89bf11d 100644
--- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
+++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
* @throws NullPointerException if {@code encodedKey}
- * or {@algorithm} is null.
+ * or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
* @since 1.9
diff --git a/jdk/src/java.base/share/classes/java/time/format/Parsed.java b/jdk/src/java.base/share/classes/java/time/format/Parsed.java
index 1eb8845..58cbfaf 100644
--- a/jdk/src/java.base/share/classes/java/time/format/Parsed.java
+++ b/jdk/src/java.base/share/classes/java/time/format/Parsed.java
@@ -216,7 +216,16 @@
return (R) (date != null ? LocalDate.from(date) : null);
} else if (query == TemporalQueries.localTime()) {
return (R) time;
- } else if (query == TemporalQueries.zone() || query == TemporalQueries.offset()) {
+ } else if (query == TemporalQueries.offset()) {
+ Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
+ if (offsetSecs != null) {
+ return (R) ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
+ }
+ if (zone instanceof ZoneOffset) {
+ return (R)zone;
+ }
+ return query.queryFrom(this);
+ } else if (query == TemporalQueries.zone()) {
return query.queryFrom(this);
} else if (query == TemporalQueries.precision()) {
return null; // not a complete date/time
diff --git a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
index 0fcd3ea..96cf39a 100644
--- a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
@@ -1183,7 +1183,7 @@
*
* <p> Given the regular expression <tt>dog</tt>, the input
* <tt>"zzzdogzzzdogzzz"</tt>, and the function
- * <tt>mr -> mr.group().toUpperCase()</tt>, an invocation of this method on
+ * {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
* a matcher for that expression would yield the string
* <tt>"zzzDOGzzzDOGzzz"</tt>.
*
@@ -1405,7 +1405,7 @@
*
* <p> Given the regular expression <tt>dog</tt>, the input
* <tt>"zzzdogzzzdogzzz"</tt>, and the function
- * <tt>mr -> mr.group().toUpperCase()</tt>, an invocation of this method on
+ * {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
* a matcher for that expression would yield the string
* <tt>"zzzDOGzzzdogzzz"</tt>.
*
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
index f6abafa..fb5b8ed 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -152,7 +152,11 @@
* {@link javax.security.cert.X509Certificate} format).
* @exception SSLPeerUnverifiedException if the peer is not verified.
* @see #getPeerPrincipal()
+ * @deprecated The {@link #getPeerCertificates()} method that returns an
+ * array of {@code java.security.cert.Certificate} should
+ * be used instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate [] getPeerCertificateChain()
throws SSLPeerUnverifiedException
{
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java
index d98edf0..5f6317d 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -272,7 +272,11 @@
* @exception SSLPeerUnverifiedException if the peer's identity
* has not been verified
* @see #getPeerPrincipal()
+ * @deprecated The {@link #getPeerCertificates()} method that returns an
+ * array of {@code java.security.cert.Certificate} should
+ * be used instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate [] getPeerCertificateChain()
throws SSLPeerUnverifiedException;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java b/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java
index 10fd767..84fdefd 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,9 +57,11 @@
*
* @since 1.4
* @see X509Certificate
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*
* @author Hemma Prafullchandra
*/
+@Deprecated
public abstract class Certificate {
/**
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java
index 1496c75..95fbcfb 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,9 @@
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateEncodingException extends CertificateException {
private static final long serialVersionUID = -8187642723048403470L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java
index 68ee6798..144bb97 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,9 @@
* @author Hemma Prafullchandra
* @since 1.4
* @see Certificate
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateException extends Exception {
private static final long serialVersionUID = -5757213374030785290L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java
index 7e4579f..9f4eb7d 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,9 @@
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateExpiredException extends CertificateException {
private static final long serialVersionUID = 5091601212177261883L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java
index 9a53daa..c5c67c7 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,9 @@
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateNotYetValidException extends CertificateException {
private static final long serialVersionUID = -8976172474266822818L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java
index 4378587..cd1f6ac 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,9 @@
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateParsingException extends CertificateException {
private static final long serialVersionUID = -8449352422951136229L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java b/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java
index 1ef7ddc..666524a 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,9 @@
* @see Certificate
* @see java.security.cert.X509Extension
* @see java.security.Security security properties
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public abstract class X509Certificate extends Certificate {
/*
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/package-info.java b/jdk/src/java.base/share/classes/javax/security/cert/package-info.java
index c09a0ea..a1d7a34 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/package-info.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,16 @@
/**
* Provides classes for public key certificates.
*
- * These classes include a simplified version of the
- * java.security.cert package. These classes were developed
- * as part of the Java Secure Socket
+ * This package has been deprecated. These classes include a simplified
+ * version of the {@code java.security.cert} package. These classes were
+ * developed as part of the Java Secure Socket
* Extension (JSSE). When JSSE was added to the J2SE version 1.4, this
* package was added for backward-compatibility reasons only.
*
* New applications should not use this package, but rather
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @since 1.4
*/
+@Deprecated
package javax.security.cert;
diff --git a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
index 15402d1..ef25c51 100644
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
@@ -57,31 +57,29 @@
* Provides the caller with the capability of performing unsafe
* operations.
*
- * <p> The returned <code>Unsafe</code> object should be carefully guarded
+ * <p>The returned {@code Unsafe} object should be carefully guarded
* by the caller, since it can be used to read and write data at arbitrary
* memory addresses. It must never be passed to untrusted code.
*
- * <p> Most methods in this class are very low-level, and correspond to a
+ * <p>Most methods in this class are very low-level, and correspond to a
* small number of hardware instructions (on typical machines). Compilers
* are encouraged to optimize these methods accordingly.
*
- * <p> Here is a suggested idiom for using unsafe operations:
+ * <p>Here is a suggested idiom for using unsafe operations:
*
- * <blockquote><pre>
+ * <pre> {@code
* class MyTrustedClass {
* private static final Unsafe unsafe = Unsafe.getUnsafe();
* ...
* private long myCountAddress = ...;
* public int getCount() { return unsafe.getByte(myCountAddress); }
- * }
- * </pre></blockquote>
+ * }}</pre>
*
- * (It may assist compilers to make the local variable be
- * <code>final</code>.)
+ * (It may assist compilers to make the local variable {@code final}.)
*
- * @exception SecurityException if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow
- * access to the system properties.
+ * @throws SecurityException if a security manager exists and its
+ * {@code checkPropertiesAccess} method doesn't allow
+ * access to the system properties.
*/
@CallerSensitive
public static Unsafe getUnsafe() {
@@ -100,28 +98,27 @@
/**
* Fetches a value from a given Java variable.
* More specifically, fetches a field or array element within the given
- * object <code>o</code> at the given offset, or (if <code>o</code> is
- * null) from the memory address whose numerical value is the given
- * offset.
+ * object {@code o} at the given offset, or (if {@code o} is null)
+ * from the memory address whose numerical value is the given offset.
* <p>
* The results are undefined unless one of the following cases is true:
* <ul>
* <li>The offset was obtained from {@link #objectFieldOffset} on
* the {@link java.lang.reflect.Field} of some Java field and the object
- * referred to by <code>o</code> is of a class compatible with that
+ * referred to by {@code o} is of a class compatible with that
* field's class.
*
- * <li>The offset and object reference <code>o</code> (either null or
+ * <li>The offset and object reference {@code o} (either null or
* non-null) were both obtained via {@link #staticFieldOffset}
* and {@link #staticFieldBase} (respectively) from the
* reflective {@link Field} representation of some Java field.
*
- * <li>The object referred to by <code>o</code> is an array, and the offset
- * is an integer of the form <code>B+N*S</code>, where <code>N</code> is
- * a valid index into the array, and <code>B</code> and <code>S</code> are
+ * <li>The object referred to by {@code o} is an array, and the offset
+ * is an integer of the form {@code B+N*S}, where {@code N} is
+ * a valid index into the array, and {@code B} and {@code S} are
* the values obtained by {@link #arrayBaseOffset} and {@link
* #arrayIndexScale} (respectively) from the array's class. The value
- * referred to is the <code>N</code><em>th</em> element of the array.
+ * referred to is the {@code N}<em>th</em> element of the array.
*
* </ul>
* <p>
@@ -162,7 +159,7 @@
* is stored into that variable.
* <p>
* The variable must be of the same type as the method
- * parameter <code>x</code>.
+ * parameter {@code x}.
*
* @param o Java heap object in which the variable resides, if any, else
* null
@@ -184,9 +181,9 @@
/**
* Stores a reference value into a given Java variable.
* <p>
- * Unless the reference <code>x</code> being stored is either null
+ * Unless the reference {@code x} being stored is either null
* or matches the field type, the results are undefined.
- * If the reference <code>o</code> is non-null, car marks or
+ * If the reference {@code o} is non-null, car marks or
* other store barriers for that object (if the VM requires them)
* are updated.
* @see #putInt(Object, long, int)
@@ -272,11 +269,11 @@
* zero, or does not point into a block obtained from {@link
* #allocateMemory}, the results are undefined.
*
- * <p> If the native pointer is less than 64 bits wide, it is extended as
+ * <p>If the native pointer is less than 64 bits wide, it is extended as
* an unsigned number to a Java long. The pointer may be indexed by any
* given byte offset, simply by adding that offset (as a simple integer) to
* the long representing the pointer. The number of bytes actually read
- * from the target address maybe determined by consulting {@link
+ * from the target address may be determined by consulting {@link
* #addressSize}.
*
* @see #allocateMemory
@@ -288,7 +285,7 @@
* zero, or does not point into a block obtained from {@link
* #allocateMemory}, the results are undefined.
*
- * <p> The number of bytes actually written at the target address maybe
+ * <p>The number of bytes actually written at the target address may be
* determined by consulting {@link #addressSize}.
*
* @see #getAddress(long)
@@ -357,7 +354,7 @@
* (usually zero). This provides a <em>single-register</em> addressing mode,
* as discussed in {@link #getInt(Object,long)}.
*
- * <p>Equivalent to <code>setMemory(null, address, bytes, value)</code>.
+ * <p>Equivalent to {@code setMemory(null, address, bytes, value)}.
*/
public void setMemory(long address, long bytes, byte value) {
setMemory(null, address, bytes, value);
@@ -388,7 +385,7 @@
* block. This provides a <em>single-register</em> addressing mode,
* as discussed in {@link #getInt(Object,long)}.
*
- * Equivalent to <code>copyMemory(null, srcAddress, null, destAddress, bytes)</code>.
+ * Equivalent to {@code copyMemory(null, srcAddress, null, destAddress, bytes)}.
*/
public void copyMemory(long srcAddress, long destAddress, long bytes) {
copyMemory(null, srcAddress, null, destAddress, bytes);
@@ -413,7 +410,7 @@
public static final int INVALID_FIELD_OFFSET = -1;
/**
- * Report the location of a given field in the storage allocation of its
+ * Reports the location of a given field in the storage allocation of its
* class. Do not expect to perform any sort of arithmetic on this offset;
* it is just a cookie which is passed to the unsafe heap memory accessors.
*
@@ -433,7 +430,7 @@
public native long objectFieldOffset(Field f);
/**
- * Report the location of a given static field, in conjunction with {@link
+ * Reports the location of a given static field, in conjunction with {@link
* #staticFieldBase}.
* <p>Do not expect to perform any sort of arithmetic on this offset;
* it is just a cookie which is passed to the unsafe heap memory accessors.
@@ -452,7 +449,7 @@
public native long staticFieldOffset(Field f);
/**
- * Report the location of a given static field, in conjunction with {@link
+ * Reports the location of a given static field, in conjunction with {@link
* #staticFieldOffset}.
* <p>Fetch the base "Object", if any, with which static fields of the
* given class can be accessed via methods like {@link #getInt(Object,
@@ -464,7 +461,7 @@
public native Object staticFieldBase(Field f);
/**
- * Detect if the given class may need to be initialized. This is often
+ * Detects if the given class may need to be initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
* @return false only if a call to {@code ensureClassInitialized} would have no effect
@@ -472,14 +469,14 @@
public native boolean shouldBeInitialized(Class<?> c);
/**
- * Ensure the given class has been initialized. This is often
+ * Ensures the given class has been initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
*/
public native void ensureClassInitialized(Class<?> c);
/**
- * Report the offset of the first element in the storage allocation of a
+ * Reports the offset of the first element in the storage allocation of a
* given array class. If {@link #arrayIndexScale} returns a non-zero value
* for the same class, you may use that scale factor, together with this
* base offset, to form new offsets to access elements of arrays of the
@@ -527,7 +524,7 @@
= theUnsafe.arrayBaseOffset(Object[].class);
/**
- * Report the scale factor for addressing elements in the storage
+ * Reports the scale factor for addressing elements in the storage
* allocation of a given array class. However, arrays of "narrow" types
* will generally not work properly with accessors like {@link
* #getByte(Object, long)}, so the scale factor for such classes is reported
@@ -576,7 +573,7 @@
= theUnsafe.arrayIndexScale(Object[].class);
/**
- * Report the size in bytes of a native pointer, as stored via {@link
+ * Reports the size in bytes of a native pointer, as stored via {@link
* #putAddress}. This value will be either 4 or 8. Note that the sizes of
* other primitive types (as stored in native memory blocks) is determined
* fully by their information content.
@@ -587,7 +584,7 @@
public static final int ADDRESS_SIZE = theUnsafe.addressSize();
/**
- * Report the size in bytes of a native memory page (whatever that is).
+ * Reports the size in bytes of a native memory page (whatever that is).
* This value will always be a power of two.
*/
public native int pageSize();
@@ -596,7 +593,7 @@
/// random trusted operations from JNI:
/**
- * Tell the VM to define a class, without security checks. By default, the
+ * Tells the VM to define a class, without security checks. By default, the
* class loader and protection domain come from the caller's class.
*/
public native Class<?> defineClass(String name, byte[] b, int off, int len,
@@ -604,7 +601,7 @@
ProtectionDomain protectionDomain);
/**
- * Define a class but do not make it known to the class loader or system dictionary.
+ * Defines a class but does not make it known to the class loader or system dictionary.
* <p>
* For each CP entry, the corresponding CP patch must either be null or have
* the a format that matches its tag:
@@ -621,38 +618,38 @@
*/
public native Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches);
-
- /** Allocate an instance but do not run any constructor.
- Initializes the class if it has not yet been. */
+ /**
+ * Allocates an instance but does not run any constructor.
+ * Initializes the class if it has not yet been.
+ */
public native Object allocateInstance(Class<?> cls)
throws InstantiationException;
- /** Throw the exception without telling the verifier. */
+ /** Throws the exception without telling the verifier. */
public native void throwException(Throwable ee);
-
/**
- * Atomically update Java variable to <tt>x</tt> if it is currently
- * holding <tt>expected</tt>.
- * @return <tt>true</tt> if successful
+ * Atomically updates Java variable to {@code x} if it is currently
+ * holding {@code expected}.
+ * @return {@code true} if successful
*/
public final native boolean compareAndSwapObject(Object o, long offset,
Object expected,
Object x);
/**
- * Atomically update Java variable to <tt>x</tt> if it is currently
- * holding <tt>expected</tt>.
- * @return <tt>true</tt> if successful
+ * Atomically updates Java variable to {@code x} if it is currently
+ * holding {@code expected}.
+ * @return {@code true} if successful
*/
public final native boolean compareAndSwapInt(Object o, long offset,
int expected,
int x);
/**
- * Atomically update Java variable to <tt>x</tt> if it is currently
- * holding <tt>expected</tt>.
- * @return <tt>true</tt> if successful
+ * Atomically updates Java variable to {@code x} if it is currently
+ * holding {@code expected}.
+ * @return {@code true} if successful
*/
public final native boolean compareAndSwapLong(Object o, long offset,
long expected,
@@ -736,28 +733,28 @@
public native void putOrderedLong(Object o, long offset, long x);
/**
- * Unblock the given thread blocked on <tt>park</tt>, or, if it is
- * not blocked, cause the subsequent call to <tt>park</tt> not to
+ * Unblocks the given thread blocked on {@code park}, or, if it is
+ * not blocked, causes the subsequent call to {@code park} not to
* block. Note: this operation is "unsafe" solely because the
* caller must somehow ensure that the thread has not been
* destroyed. Nothing special is usually required to ensure this
* when called from Java (in which there will ordinarily be a live
* reference to the thread) but this is not nearly-automatically
* so when calling from native code.
- * @param thread the thread to unpark.
*
+ * @param thread the thread to unpark.
*/
public native void unpark(Object thread);
/**
- * Block current thread, returning when a balancing
- * <tt>unpark</tt> occurs, or a balancing <tt>unpark</tt> has
+ * Blocks current thread, returning when a balancing
+ * {@code unpark} occurs, or a balancing {@code unpark} has
* already occurred, or the thread is interrupted, or, if not
* absolute and time is not zero, the given time nanoseconds have
* elapsed, or if absolute, the given deadline in milliseconds
* since Epoch has passed, or spuriously (i.e., returning for no
* "reason"). Note: This operation is in the Unsafe class only
- * because <tt>unpark</tt> is, so it would be strange to place it
+ * because {@code unpark} is, so it would be strange to place it
* elsewhere.
*/
public native void park(boolean isAbsolute, long time);
@@ -765,8 +762,8 @@
/**
* Gets the load average in the system run queue assigned
* to the available processors averaged over various periods of time.
- * This method retrieves the given <tt>nelem</tt> samples and
- * assigns to the elements of the given <tt>loadavg</tt> array.
+ * This method retrieves the given {@code nelem} samples and
+ * assigns to the elements of the given {@code loadavg} array.
* The system imposes a maximum of 3 samples, representing
* averages over the last 1, 5, and 15 minutes, respectively.
*
@@ -784,8 +781,8 @@
/**
* Atomically adds the given value to the current value of a field
- * or array element within the given object <code>o</code>
- * at the given <code>offset</code>.
+ * or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -803,8 +800,8 @@
/**
* Atomically adds the given value to the current value of a field
- * or array element within the given object <code>o</code>
- * at the given <code>offset</code>.
+ * or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -822,8 +819,8 @@
/**
* Atomically exchanges the given value with the current value of
- * a field or array element within the given object <code>o</code>
- * at the given <code>offset</code>.
+ * a field or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -841,8 +838,8 @@
/**
* Atomically exchanges the given value with the current value of
- * a field or array element within the given object <code>o</code>
- * at the given <code>offset</code>.
+ * a field or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -861,7 +858,7 @@
/**
* Atomically exchanges the given reference value with the current
* reference value of a field or array element within the given
- * object <code>o</code> at the given <code>offset</code>.
+ * object {@code o} at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
index 3b8ff0c..9d70053 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -244,7 +244,9 @@
public java.security.cert.Certificate[] getServerCertificates()
throws SSLPeerUnverifiedException {
if (cachedResponse != null) {
- List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
+ List<java.security.cert.Certificate> l =
+ ((SecureCacheResponse)cachedResponse)
+ .getServerCertificateChain();
if (l == null) {
return null;
} else {
@@ -262,7 +264,12 @@
/**
* Returns the server's X.509 certificate chain, or null if
* the server did not authenticate.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getServerCertificates()} instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate[] getServerCertificateChain()
throws SSLPeerUnverifiedException {
if (cachedResponse != null) {
@@ -271,7 +278,7 @@
if (http == null) {
throw new IllegalStateException("connection not yet open");
} else {
- return ((HttpsClient)http).getServerCertificateChain ();
+ return ((HttpsClient)http).getServerCertificateChain();
}
}
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java
index 30e9fb0..5bc55ed 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -699,7 +699,12 @@
/**
* Returns the X.509 certificate chain with which the server
* authenticated itself, or null if the server did not authenticate.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getServerCertificates()} instead.
*/
+ @Deprecated
javax.security.cert.X509Certificate [] getServerCertificateChain()
throws SSLPeerUnverifiedException
{
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
index c3067c0..5477b2c 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -204,7 +204,12 @@
* NOTE: This method is not necessary for the version of this class
* implementing javax.net.ssl.HttpsURLConnection, but provided for
* compatibility with the com.sun.net.ssl.HttpsURLConnection version.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getServerCertificates()} instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate[] getServerCertificateChain() {
try {
return delegate.getServerCertificateChain();
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java
index 7f1577b..cb4f54e 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java
@@ -1569,6 +1569,9 @@
/*
* Returns the subject alternative name of the specified type in the
* subjectAltNames extension of a certificate.
+ *
+ * Note that only those subjectAltName types that use String data
+ * should be passed into this function.
*/
private static Collection<String> getSubjectAltNames(
Collection<List<?>> subjectAltNames, int type) {
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java
index b5f304b..881c4bf 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -464,8 +464,13 @@
*
* @return array of peer X.509 certs, with the peer's own cert
* first in the chain, and with the "root" CA last.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getPeerCertificates()} instead.
*/
@Override
+ @Deprecated
public javax.security.cert.X509Certificate[] getPeerCertificateChain()
throws SSLPeerUnverifiedException {
//
diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c
index 27e828f..846e683 100644
--- a/jdk/src/java.base/share/native/libjli/java.c
+++ b/jdk/src/java.base/share/native/libjli/java.c
@@ -661,15 +661,24 @@
* arguments are for the application (i.e. the main class name, or
* the -jar argument).
*/
- if ((i > 0 && *arg != '-')
- || JLI_StrCmp(arg, "-version") == 0
- || JLI_StrCmp(arg, "-fullversion") == 0
- || JLI_StrCmp(arg, "-help") == 0
- || JLI_StrCmp(arg, "-?") == 0
- || JLI_StrCmp(arg, "-jar") == 0
- || JLI_StrCmp(arg, "-X") == 0
- ) {
- return;
+ if (i > 0) {
+ char *prev = argv[i - 1];
+ // skip non-dash arg preceded by class path specifiers
+ if (*arg != '-' &&
+ ((JLI_StrCmp(prev, "-cp") == 0
+ || JLI_StrCmp(prev, "-classpath") == 0))) {
+ continue;
+ }
+
+ if (*arg != '-'
+ || JLI_StrCmp(arg, "-version") == 0
+ || JLI_StrCmp(arg, "-fullversion") == 0
+ || JLI_StrCmp(arg, "-help") == 0
+ || JLI_StrCmp(arg, "-?") == 0
+ || JLI_StrCmp(arg, "-jar") == 0
+ || JLI_StrCmp(arg, "-X") == 0) {
+ return;
+ }
}
/*
* The following case checks for "-XX:NativeMemoryTracking=value".
diff --git a/jdk/src/java.base/share/native/libjli/manifest_info.h b/jdk/src/java.base/share/native/libjli/manifest_info.h
index cd951d5..5f9773e 100644
--- a/jdk/src/java.base/share/native/libjli/manifest_info.h
+++ b/jdk/src/java.base/share/native/libjli/manifest_info.h
@@ -32,13 +32,16 @@
* Zip file header signatures
*/
#define SIGSIZ 4 /* size of all header signatures */
-#define LOCSIG 0x04034b50L /* "PK\003\004" */
-#define EXTSIG 0x08074b50L /* "PK\007\008" */
-#define CENSIG 0x02014b50L /* "PK\001\002" */
-#define ENDSIG 0x06054b50L /* "PK\005\006" */
-#define ZIP64_ENDSIG 0x06064b50L /* "PK\006\006" */
-#define ZIP64_LOCSIG 0x07064b50L /* "PK\006\007" */
+#define PKZIP_SIGNATURE_AT(p, b2, b3) \
+ (((p)[0] == 'P') & ((p)[1] == 'K') & ((p)[2] == b2) & ((p)[3] == b3))
+#define CENSIG_AT(p) PKZIP_SIGNATURE_AT(p, 1, 2)
+#define LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 3, 4)
+#define ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 5, 6)
+#define EXTSIG_AT(p) PKZIP_SIGNATURE_AT(p, 7, 8)
+#define ZIP64_ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 6)
+#define ZIP64_LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 7)
+
/*
* Header sizes including signatures
*/
diff --git a/jdk/src/java.base/share/native/libjli/parse_manifest.c b/jdk/src/java.base/share/native/libjli/parse_manifest.c
index a8e17b8..9ce82c1 100644
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c
@@ -138,7 +138,7 @@
return -1;
if ((bytes = read(fd, ep, ZIP64_LOCHDR)) < 0)
return -1;
- if (GETSIG(ep) == ZIP64_LOCSIG)
+ if (ZIP64_LOCSIG_AT(ep))
return end64pos;
return -1;
}
@@ -176,7 +176,7 @@
return (-1);
if ((bytes = read(fd, eb, ENDHDR)) < 0)
return (-1);
- if (GETSIG(eb) == ENDSIG) {
+ if (ENDSIG_AT(eb)) {
return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
}
@@ -200,14 +200,11 @@
/*
* Search backwards from the end of file stopping when the END header
- * signature is found. (The first condition of the "if" is just a
- * fast fail, because the GETSIG macro isn't always cheap. The
- * final condition protects against false positives.)
+ * signature is found.
*/
endpos = &buffer[bytes];
for (cp = &buffer[bytes - ENDHDR]; cp >= &buffer[0]; cp--)
- if ((*cp == (ENDSIG & 0xFF)) && (GETSIG(cp) == ENDSIG) &&
- (cp + ENDHDR + ENDCOM(cp) == endpos)) {
+ if (ENDSIG_AT(cp) && (cp + ENDHDR + ENDCOM(cp) == endpos)) {
(void) memcpy(eb, cp, ENDHDR);
free(buffer);
pos = flen - (endpos - cp);
@@ -267,7 +264,7 @@
if ((bytes = read(fd, buffer, MINREAD)) < 0) {
return (-1);
}
- if (GETSIG(buffer) != ZIP64_ENDSIG) {
+ if (!ZIP64_ENDSIG_AT(buffer)) {
return -1;
}
if ((offset = ZIP64_ENDOFF(buffer)) < (jlong)0) {
@@ -356,7 +353,7 @@
* Loop through the Central Directory Headers. Note that a valid zip/jar
* must have an ENDHDR (with ENDSIG) after the Central Directory.
*/
- while (GETSIG(p) == CENSIG) {
+ while (CENSIG_AT(p)) {
/*
* If a complete header isn't in the buffer, shift the contents
@@ -403,7 +400,7 @@
free(buffer);
return (-1);
}
- if (GETSIG(locbuf) != LOCSIG) {
+ if (!LOCSIG_AT(locbuf)) {
free(buffer);
return (-1);
}
diff --git a/jdk/src/java.base/share/native/libzip/zip_util.c b/jdk/src/java.base/share/native/libzip/zip_util.c
index 51ee1d5..d99a5cd 100644
--- a/jdk/src/java.base/share/native/libzip/zip_util.c
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c
@@ -281,9 +281,9 @@
return (cenpos >= 0 &&
locpos >= 0 &&
readFullyAt(zip->zfd, buf, sizeof(buf), cenpos) != -1 &&
- GETSIG(buf) == CENSIG &&
+ CENSIG_AT(buf) &&
readFullyAt(zip->zfd, buf, sizeof(buf), locpos) != -1 &&
- GETSIG(buf) == LOCSIG);
+ LOCSIG_AT(buf));
}
/*
@@ -674,7 +674,7 @@
method = CENHOW(cp);
nlen = CENNAM(cp);
- if (GETSIG(cp) != CENSIG)
+ if (!CENSIG_AT(cp))
ZIP_FORMAT_ERROR("invalid CEN header (bad signature)");
if (CENFLG(cp) & 1)
ZIP_FORMAT_ERROR("invalid CEN header (encrypted entry)");
@@ -827,10 +827,7 @@
// Assumption, zfd refers to start of file. Trivially, reuse errbuf.
if (readFully(zfd, errbuf, 4) != -1) { // errors will be handled later
- if (GETSIG(errbuf) == LOCSIG)
- zip->locsig = JNI_TRUE;
- else
- zip->locsig = JNI_FALSE;
+ zip->locsig = LOCSIG_AT(errbuf) ? JNI_TRUE : JNI_FALSE;
}
len = zip->len = IO_Lseek(zfd, 0, SEEK_END);
@@ -1284,7 +1281,7 @@
zip->msg = "error reading zip file";
return -1;
}
- if (GETSIG(loc) != LOCSIG) {
+ if (!LOCSIG_AT(loc)) {
zip->msg = "invalid LOC header (bad signature)";
return -1;
}
diff --git a/jdk/src/java.base/share/native/libzip/zip_util.h b/jdk/src/java.base/share/native/libzip/zip_util.h
index 1287d3a..1f5f3bd 100644
--- a/jdk/src/java.base/share/native/libzip/zip_util.h
+++ b/jdk/src/java.base/share/native/libzip/zip_util.h
@@ -33,13 +33,14 @@
/*
* Header signatures
*/
-#define LOCSIG 0x04034b50L /* "PK\003\004" */
-#define EXTSIG 0x08074b50L /* "PK\007\008" */
-#define CENSIG 0x02014b50L /* "PK\001\002" */
-#define ENDSIG 0x06054b50L /* "PK\005\006" */
-
-#define ZIP64_ENDSIG 0x06064b50L /* "PK\006\006" */
-#define ZIP64_LOCSIG 0x07064b50L /* "PK\006\007" */
+#define PKZIP_SIGNATURE_AT(p, b2, b3) \
+ (((p)[0] == 'P') & ((p)[1] == 'K') & ((p)[2] == b2) & ((p)[3] == b3))
+#define CENSIG_AT(p) PKZIP_SIGNATURE_AT(p, 1, 2)
+#define LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 3, 4)
+#define ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 5, 6)
+#define EXTSIG_AT(p) PKZIP_SIGNATURE_AT(p, 7, 8)
+#define ZIP64_ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 6)
+#define ZIP64_LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 7)
/*
* Header sizes including signatures
diff --git a/jdk/src/java.base/unix/native/launcher/jexec.c b/jdk/src/java.base/unix/native/launcher/jexec.c
index a30617d..179ae4f 100644
--- a/jdk/src/java.base/unix/native/launcher/jexec.c
+++ b/jdk/src/java.base/unix/native/launcher/jexec.c
@@ -323,7 +323,7 @@
result = BAD_MAGIC_MSG;
// be sure the file is at least a ZIP file
- if (GETSIG(buf) == LOCSIG) {
+ if (LOCSIG_AT(buf)) {
off_t flen = LOCNAM(buf);
off_t xlen = LOCEXT(buf);
diff --git a/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c b/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
index 2308a59..c245045 100644
--- a/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
+++ b/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
#include <winsock2.h> /* needed for htonl */
#include <iprtrmib.h>
#include <assert.h>
+#include <limits.h>
#include "java_net_NetworkInterface.h"
#include "jni_util.h"
@@ -70,7 +71,7 @@
#endif
-static int bufsize = 1024;
+static int bufsize = 4096;
/*
* return an array of IP_ADAPTER_ADDRESSES containing one element
@@ -102,7 +103,11 @@
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (ret == ERROR_BUFFER_OVERFLOW) {
- IP_ADAPTER_ADDRESSES * newAdapterInfo =
+ IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
+ if (len < (ULONG_MAX - bufsize)) {
+ len = len + bufsize;
+ }
+ newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (newAdapterInfo == NULL) {
free(adapterInfo);
@@ -113,7 +118,6 @@
adapterInfo = newAdapterInfo;
- bufsize = len;
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
@@ -176,7 +180,11 @@
flags |= GAA_FLAG_INCLUDE_PREFIX;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (val == ERROR_BUFFER_OVERFLOW) {
- IP_ADAPTER_ADDRESSES * newAdapterInfo =
+ IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
+ if (len < (ULONG_MAX - bufsize)) {
+ len = len + bufsize;
+ }
+ newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (newAdapterInfo == NULL) {
free(adapterInfo);
@@ -187,7 +195,6 @@
adapterInfo = newAdapterInfo;
- bufsize = len;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
index 3b7b47f..beb0b0f 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -489,6 +489,8 @@
* <tt>MAX_VALUE_LENGTH</tt>.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
+ * @throws IllegalArgumentException if either the key or the value contain
+ * the null control character, code point U+0000.
*/
public abstract void put(String key, String value);
diff --git a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
index ebbca48..7bcd1d3 100644
--- a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
+++ b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,13 @@
*/
class FileSystemPreferences extends AbstractPreferences {
+ /**
+ * The code point U+0000, assigned to the null control character, is the
+ * only character encoded in Unicode and ISO/IEC 10646 that is always
+ * invalid in any XML 1.0 and 1.1 document.
+ */
+ private static final String CODE_POINT_U0000 = String.valueOf('\u0000');
+
static {
PrivilegedAction<Void> load = () -> {
System.loadLibrary("prefs");
@@ -525,6 +532,11 @@
}
protected void putSpi(String key, String value) {
+ if (key.indexOf(CODE_POINT_U0000) != -1) {
+ throw new IllegalArgumentException("Key contains code point U+0000");
+ } else if (value.indexOf(CODE_POINT_U0000) != -1) {
+ throw new IllegalArgumentException("Value contains code point U+0000");
+ }
initCacheIfNecessary();
changeLog.add(new Put(key, value));
prefsCache.put(key, value);
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
index 351b3a9..f1a7f16 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
@@ -52,7 +52,7 @@
* <pre>
* XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
* Reference ref = factory.newReference("#reference-1", DigestMethod.SHA1);
- * List<Reference> references = Collections.singletonList(ref);
+ * List<Reference> references = Collections.singletonList(ref);
* Manifest manifest = factory.newManifest(references, "manifest-1");
* </pre>
*
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
index 572be86..4117c8b 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
@@ -65,7 +65,7 @@
* <pre>
* XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
* Manifest manifest = fac.newManifest(references);
- * List<XMLStructure> content = Collections.singletonList(manifest);
+ * List<XMLStructure> content = Collections.singletonList(manifest);
* XMLObject object = factory.newXMLObject(content, "object-1", null, null);
* </pre>
*
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSigner.java b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSigner.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSigner.java
rename to jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSigner.java
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSignerParameters.java b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSignerParameters.java
rename to jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/package-info.java b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/package-info.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/jarsigner/package-info.java
rename to jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/package-info.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_ja.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_ja.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/CommandLine.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/CommandLine.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/CommandLine.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/CommandLine.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/JarException.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/JarException.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/JarException.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/JarException.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Manifest.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Manifest.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/Manifest.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/Manifest.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/SignatureFile.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/SignatureFile.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/SignatureFile.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/SignatureFile.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_de.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_de.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_es.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_es.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_fr.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_fr.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_it.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_it.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ja.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ja.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ko.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ko.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_pt_BR.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_pt_BR.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_sv.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_sv.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_CN.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_CN.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_TW.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_TW.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties
diff --git a/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java b/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java
index f80df88..c9a520a 100644
--- a/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java
+++ b/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -295,8 +295,8 @@
},
{ "DatePatterns",
new String[] {
- "d. MMMM'ta 'yyyy", // full date pattern
- "d. MMMM'ta 'yyyy", // long date pattern
+ "d. MMMM yyyy", // full date pattern
+ "d. MMMM yyyy", // long date pattern
"d.M.yyyy", // medium date pattern
"d.M.yyyy", // short date pattern
}
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bands.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/bands.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bands.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/bands.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bands.h b/jdk/src/jdk.pack200/share/native/common-unpack/bands.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bands.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/bands.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bytes.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/bytes.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bytes.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/bytes.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bytes.h b/jdk/src/jdk.pack200/share/native/common-unpack/bytes.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bytes.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/bytes.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/coding.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/coding.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/coding.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/coding.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/coding.h b/jdk/src/jdk.pack200/share/native/common-unpack/coding.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/coding.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/coding.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/constants.h b/jdk/src/jdk.pack200/share/native/common-unpack/constants.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/constants.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/constants.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/defines.h b/jdk/src/jdk.pack200/share/native/common-unpack/defines.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/defines.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/defines.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/unpack.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/unpack.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/unpack.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/unpack.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/unpack.h b/jdk/src/jdk.pack200/share/native/common-unpack/unpack.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/unpack.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/unpack.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/utils.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/utils.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/utils.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/utils.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/utils.h b/jdk/src/jdk.pack200/share/native/common-unpack/utils.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/utils.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/utils.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/zip.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/zip.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/zip.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/zip.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/zip.h b/jdk/src/jdk.pack200/share/native/common-unpack/zip.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/zip.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/zip.h
diff --git a/jdk/src/jdk.runtime/share/native/libunpack/jni.cpp b/jdk/src/jdk.pack200/share/native/libunpack/jni.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/libunpack/jni.cpp
rename to jdk/src/jdk.pack200/share/native/libunpack/jni.cpp
diff --git a/jdk/src/jdk.runtime/share/native/unpack200/main.cpp b/jdk/src/jdk.pack200/share/native/unpack200/main.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/unpack200/main.cpp
rename to jdk/src/jdk.pack200/share/native/unpack200/main.cpp
diff --git a/jdk/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest b/jdk/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest
similarity index 100%
rename from jdk/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest
rename to jdk/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/PolicyTool.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/PolicyTool.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_de.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_de.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_de.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_de.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_es.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_es.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_es.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_es.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_fr.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_fr.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_fr.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_fr.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_it.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_it.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_it.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_it.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ja.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ja.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ja.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ja.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ko.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ko.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ko.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ko.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_pt_BR.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_sv.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_sv.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_sv.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_sv.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_CN.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_HK.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_TW.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT
index 6df529b..20863c6 100644
--- a/jdk/test/TEST.ROOT
+++ b/jdk/test/TEST.ROOT
@@ -5,7 +5,7 @@
keys=2d dnd i18n
# Tests that must run in othervm mode
-othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces
+othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation
# Tests that cannot run concurrently
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/Dynamic.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/Dynamic.java
new file mode 100644
index 0000000..3aa6d29
--- /dev/null
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/Dynamic.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.PrintStream;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
+import java.util.Random;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+
+public class Dynamic {
+
+ static final String ALGORITHM = "AES";
+ static final String[] MODE = {
+ "ECb", "CbC", "CTR", "PCBC", "OFB", "OFB150", "cFB", "CFB7",
+ "cFB8", "cFB16", "cFB24", "cFB32", "Cfb40", "cfB48", "cfB56",
+ "cfB64", "cfB72", "cfB80", "cfB88", "cfB96", "cfb104", "cfB112",
+ "cfB120", "cfB128", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40",
+ "OFB48", "OFB56", "OFB64", "OFB72", "OFB80", "OFB88", "OFB96",
+ "OFB104", "OFB112", "OFB120", "OFB128", "GCM"
+ };
+ static final String[] PADDING = {
+ "NoPadding", "PKCS5Padding", "ISO10126Padding"
+ };
+ static final String SUNJCE = "SunJCE";
+
+ Cipher ci = null;
+ byte[] iv = null;
+ AlgorithmParameterSpec aps = null;
+ SecretKey key = null;
+ int keyStrength;
+ static int DefaultSize = 128;
+
+ public void run(String[] argv) throws Exception {
+ if (!runAllTest(argv, System.out)) {
+ throw new Exception("Test Failed");
+ }
+ }
+
+ protected boolean runAllTest(String argv[], PrintStream out) {
+ boolean result = true;
+ StringBuilder failedList = new StringBuilder();
+ int failedCnt = 0;
+ int testCount = 0;
+ int padKinds; // how many kinds of padding mode such as PKCS5padding and
+ // NoPadding.
+
+ try {
+ for (int i = 0; i < 3; i++) {
+ keyStrength = DefaultSize + i * 64; // obtain the key size 128,
+ // 192, 256
+
+ for (int j = 0; j < MODE.length; j++) {
+ if (MODE[j].equalsIgnoreCase("ECB")
+ || MODE[j].equalsIgnoreCase("PCBC")
+ || MODE[j].equalsIgnoreCase("CBC")) {
+ padKinds = PADDING.length;
+ } else {
+ padKinds = 1;
+ }
+
+ for (int k = 0; k < padKinds; k++) {
+ testCount++;
+ try {
+ if (!runTest(ALGORITHM, MODE[j], PADDING[k])) {
+ result = false;
+ failedCnt++;
+ failedList.append(ALGORITHM + "/" + MODE[j]
+ + "/" + PADDING[k] + " ");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ result = false;
+ failedCnt++;
+ failedList.append(ALGORITHM + "/" + MODE[j] + "/"
+ + PADDING[k] + " ");
+ }
+
+ }
+ }
+ }
+
+ if (result) {
+ out.println("STATUS:Passed. Test " + testCount
+ + " cases, All Passed");
+ return true;
+ }
+ out.println("STATUS:Failed. " + failedCnt + " Failed: "
+ + failedList);
+ return false;
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ out.println("STATUS:Failed. Unexpected Exception: " + ex);
+ return false;
+ }
+ }
+
+ protected boolean runTest(String algo, String mo, String pad)
+ throws Exception {
+ boolean result = true;
+ try {
+ byte[] plainText = new byte[160000];
+ new Random().nextBytes(plainText);
+
+ String transformation = algo + "/" + mo + "/" + pad;
+ ci = Cipher.getInstance(transformation, SUNJCE);
+ KeyGenerator kg = KeyGenerator.getInstance(algo, SUNJCE);
+ if (keyStrength > Cipher.getMaxAllowedKeyLength(transformation)) {
+ // skip if this key length is larger than what's
+ // configured in the jce jurisdiction policy files
+ System.out.println(keyStrength
+ + " is larger than what's configured "
+ + "in the jce jurisdiction policy files");
+ return result;
+ }
+ kg.init(keyStrength);
+ key = kg.generateKey();
+
+ if (!mo.equalsIgnoreCase("GCM")) {
+ ci.init(Cipher.ENCRYPT_MODE, key, aps);
+ } else {
+ ci.init(Cipher.ENCRYPT_MODE, key);
+ }
+ byte[] cipherText = new byte[ci.getOutputSize(plainText.length)];
+ int offset = ci.update(plainText, 0, plainText.length, cipherText,
+ 0);
+ ci.doFinal(cipherText, offset);
+
+ if (!mo.equalsIgnoreCase("ECB")) {
+ iv = ci.getIV();
+ aps = new IvParameterSpec(iv);
+ } else {
+ aps = null;
+ }
+
+ if (!mo.equalsIgnoreCase("GCM")) {
+ ci.init(Cipher.DECRYPT_MODE, key, aps);
+ } else {
+ ci.init(Cipher.DECRYPT_MODE, key, ci.getParameters());
+ }
+ byte[] recoveredText = new byte[ci.getOutputSize(cipherText.length)];
+ int len = ci.doFinal(cipherText, 0, cipherText.length,
+ recoveredText);
+
+ byte[] tmp = new byte[len];
+ for (int i = 0; i < len; i++) {
+ tmp[i] = recoveredText[i];
+ }
+
+ result = Arrays.equals(plainText, tmp);
+ } catch (NoSuchAlgorithmException nsaEx) {
+ nsaEx.printStackTrace();
+ // CFB7 and OFB150 are negative test,SunJCE not support this
+ // algorithm
+ result = mo.equalsIgnoreCase("CFB7")
+ || mo.equalsIgnoreCase("OFB150");
+
+ }
+ return result;
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java
similarity index 71%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java
index d24a6e7..132e79d 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,10 +21,15 @@
* questions.
*/
-package pkg;
-
-/**
- * Source file for C
+/*
+ * @test
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes with
+ * default provider
*/
-public class C {
+
+public class TestAESWithDefaultProvider extends Dynamic {
+ public static void main(String argv[]) throws Exception {
+ new TestAESWithDefaultProvider().run(argv);
+ }
}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java
similarity index 61%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java
index d24a6e7..8dec9f1 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java
@@ -1,5 +1,4 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,10 +20,20 @@
* questions.
*/
-package pkg;
+import java.security.Security;
-/**
- * Source file for C
+/*
+ * @test
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes after
+ * remove then add provider.
+ * @run main/othervm/policy=testAES.policy TestAESWithProviderChange
*/
-public class C {
+
+public class TestAESWithProviderChange extends Dynamic {
+ public static void main(String argv[]) throws Exception {
+ Security.removeProvider(SUNJCE);
+ Security.addProvider(new com.sun.crypto.provider.SunJCE());
+ new TestAESWithProviderChange().run(argv);
+ }
}
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java
new file mode 100644
index 0000000..81761a7
--- /dev/null
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.*;
+import java.security.Provider;
+
+/*
+ * @test
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes after
+ * remove default provider then add it back.
+ * @run main/othervm/policy=testAES.policy TestAESWithRemoveAddProvider
+ */
+
+public class TestAESWithRemoveAddProvider extends Dynamic {
+ public static void main(String argv[]) throws Exception {
+ Provider pJCE = Security.getProvider(SUNJCE);
+ Security.removeProvider(SUNJCE);
+ Security.addProvider(pJCE);
+ new TestAESWithRemoveAddProvider().run(argv);
+ }
+}
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy
new file mode 100644
index 0000000..a138a57
--- /dev/null
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy
@@ -0,0 +1,6 @@
+grant
+{
+ permission java.security.SecurityPermission "removeProvider.SunJCE";
+ permission java.security.SecurityPermission "insertProvider.SunJCE";
+ permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+};
diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java
index 03d165f..cfc4d44 100644
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java
@@ -26,7 +26,7 @@
* @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
* 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
* 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
- * 4947220 7018606 7034570 4244896 5049299 8003488 8054494
+ * 4947220 7018606 7034570 4244896 5049299 8003488 8054494 8058464
* @summary Basic tests for Process and Environment Variable code
* @run main/othervm/timeout=300 Basic
* @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
@@ -941,6 +941,14 @@
() -> pb.redirectOutput(Redirect.from(ifile)),
() -> pb.redirectError(Redirect.from(ifile)));
+ THROWS(NullPointerException.class,
+ () -> pb.redirectInput((File)null),
+ () -> pb.redirectOutput((File)null),
+ () -> pb.redirectError((File)null),
+ () -> pb.redirectInput((Redirect)null),
+ () -> pb.redirectOutput((Redirect)null),
+ () -> pb.redirectError((Redirect)null));
+
THROWS(IOException.class,
// Input file does not exist
() -> pb.start());
diff --git a/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java
new file mode 100644
index 0000000..05f9f19
--- /dev/null
+++ b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8046246
+ * @summary Tests and benchmarks the JVMTI RedefineClasses when a
+ * single class (and its parent) contains many methods.
+ *
+ * @run build ManyMethodsBenchmarkApp ManyMethodsBenchmarkAgent
+ * @run shell MakeJAR3.sh ManyMethodsBenchmarkAgent 'Can-Retransform-Classes: true'
+ * @run main/othervm -javaagent:ManyMethodsBenchmarkAgent.jar ManyMethodsBenchmarkApp
+ */
+import java.lang.instrument.*;
+
+public class ManyMethodsBenchmarkAgent
+{
+ public static boolean fail = false;
+ public static boolean completed = false;
+ private static Instrumentation instrumentation;
+
+ public static void
+ premain( String agentArgs,
+ Instrumentation instrumentation) {
+ System.out.println("ManyMethodsBenchmarkAgent started");
+ ManyMethodsBenchmarkAgent.instrumentation = instrumentation;
+ System.out.println("ManyMethodsBenchmarkAgent finished");
+ }
+
+ static void instr() {
+ System.out.println("ManyMethodsBenchmarkAgent.instr started");
+
+ Class[] allClasses = instrumentation.getAllLoadedClasses();
+
+ for (int i = 0; i < allClasses.length; i++) {
+ Class klass = allClasses[i];
+ String name = klass.getName();
+ if (!name.equals("Base")) {
+ continue;
+ }
+ System.err.println("Instrumenting the class: " + klass);
+
+ try {
+ instrumentation.retransformClasses(klass);
+ } catch (Throwable e) {
+ System.err.println("Error: bad return from retransform: " + klass);
+ System.err.println(" ERROR: " + e);
+ fail = true;
+ }
+ }
+ completed = true;
+ System.out.println("ManyMethodsBenchmarkAgent.instr finished");
+ }
+
+}
diff --git a/jdk/test/java/lang/instrument/ManyMethodsBenchmarkApp.java b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkApp.java
new file mode 100644
index 0000000..c85bf42
--- /dev/null
+++ b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkApp.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.List;
+import javax.tools.JavaCompiler;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+/**
+ * A manual benchmark of the JVMTI RedefineClasses when a
+ * single class (and its parent) contains many methods.
+ */
+public class ManyMethodsBenchmarkApp {
+ // Limit is 64k but we can not put such many as the CP limit is 32k.
+ // In practice, it means a real limit is much lower (less than 22000).
+ static final int METHOD_COUNT = 20000;
+
+ static Class<?> loadClassInNewClassLoader(String className) throws Exception {
+ URL[] urls = { new File(".").toURI().toURL() };
+ URLClassLoader ucl = new URLClassLoader(urls, null);
+ Class<?> klazz = Class.forName(className, true, ucl);
+ return klazz;
+ }
+
+ static void benchmarkClassOperations(String className) throws Exception {
+ Class<?> klazz = loadClassInNewClassLoader(className);
+
+ Method[] methods = klazz.getDeclaredMethods();
+ if (methods.length != METHOD_COUNT) {
+ throw new AssertionError("unexpected method count: " + methods.length +
+ " expected: " + METHOD_COUNT);
+ }
+
+ methods = klazz.getMethods();
+ // returned methods includes those inherited from Object
+ int objectMethodSlop = 100;
+ if (methods.length <= METHOD_COUNT ||
+ methods.length >= METHOD_COUNT + objectMethodSlop) {
+ throw new AssertionError("unexpected method count: " + methods.length);
+ }
+
+ // Invoke methods to make them appear in the constant pool cache
+ Object obj = klazz.newInstance();
+ Object[] args = new Object[0];
+ for (Method m: methods) {
+ try {
+ Class<?>[] types = m.getParameterTypes();
+ String name = m.getName();
+ // System.out.println("method: " + name + "; argno: " + types.length);
+ if (types.length == 0 && name.length() == 2 && name.startsWith("f")) {
+ m.invoke(obj, args);
+ }
+ } catch (InvocationTargetException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("test started: ManyMethodsBenchmarkApp");
+
+ // Create source files with many methods
+ File base = new File("Base.java");
+ try (FileWriter fw = new FileWriter(base)) {
+ fw.write("public class Base {\n");
+ final int L = 10;
+ // Each of the first L methods makes calls to its own chunk of METHOD_COUNT/L methods
+ for (int k = 0; k < L; k++) {
+ fw.write(" public void f" + k + "() {\n");
+ int shift = (k == 0) ? L : 0;
+ for (int i = (k * (METHOD_COUNT/L)) + shift; i < (k + 1) * METHOD_COUNT/L; i++) {
+ fw.write(" f" + i + "();\n");
+ }
+ fw.write(" }\n");
+ }
+
+ // The rest of (METHOD_COUNT - L) methods have empty body
+ for (int i = L; i < METHOD_COUNT; i++) {
+ fw.write(" public static void f" + i + "() {}\n");
+ }
+ fw.write("}\n");
+ }
+
+ // Compile the generated source files.
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ List<File> files = Arrays.asList(new File[] { base });
+ try (StandardJavaFileManager fileManager =
+ compiler.getStandardFileManager(null, null, null)) {
+ compiler.getTask(null, fileManager, null, null, null,
+ fileManager.getJavaFileObjectsFromFiles(files))
+ .call();
+ }
+
+ benchmarkClassOperations("Base");
+
+ ManyMethodsBenchmarkAgent.instr();
+
+ // Cleanup
+ base.delete();
+ new File("Base.class").delete();
+ if (!ManyMethodsBenchmarkAgent.completed) {
+ throw new Exception("ERROR: ManyMethodsBenchmarkAgent did not complete.");
+ }
+
+ if (ManyMethodsBenchmarkAgent.fail) {
+ throw new Exception("ERROR: ManyMethodsBenchmarkAgent failed.");
+ } else {
+ System.out.println("ManyMethodsBenchmarkAgent succeeded.");
+ }
+ System.out.println("test finished: ManyMethodsBenchmarkApp");
+ }
+}
diff --git a/jdk/test/java/math/BigDecimal/StringConstructor.java b/jdk/test/java/math/BigDecimal/StringConstructor.java
index 992eb9d..c8051eb 100644
--- a/jdk/test/java/math/BigDecimal/StringConstructor.java
+++ b/jdk/test/java/math/BigDecimal/StringConstructor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,19 +23,20 @@
/*
* @test
- * @bug 4103117 4331084 4488017 4490929 6255285 6268365
- * @summary Tests the BigDecimal string constructor.
+ * @library ..
+ * @bug 4103117 4331084 4488017 4490929 6255285 6268365 8074460
+ * @summary Tests the BigDecimal string constructor (use -Dseed=X to set PRNG seed).
*/
import java.math.*;
-import java.util.Random;
public class StringConstructor {
- private static int seed = new Random().nextInt();
- private static Random rnd = new Random(seed);
+ private static RandomSeed rndSeed = new RandomSeed(false);
public static void main(String[] args) throws Exception {
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+
constructWithError("");
constructWithError("+");
constructWithError("-");
@@ -71,19 +72,18 @@
// Roundtrip tests
for (int i=0; i<100; i++) {
- int size = rnd.nextInt(100) + 1;
- BigInteger bi = new BigInteger(size, rnd);
- if (rnd.nextBoolean())
+ int size = rndSeed.getRandom().nextInt(100) + 1;
+ BigInteger bi = new BigInteger(size, rndSeed.getRandom());
+ if (rndSeed.getRandom().nextBoolean())
bi = bi.negate();
int decimalLength = bi.toString().length();
- int scale = rnd.nextInt(decimalLength);
+ int scale = rndSeed.getRandom().nextInt(decimalLength);
BigDecimal bd = new BigDecimal(bi, scale);
String bdString = bd.toString();
// System.err.println("bi" + bi.toString() + "\tscale " + scale);
// System.err.println("bd string: " + bdString);
BigDecimal bdDoppel = new BigDecimal(bdString);
if (!bd.equals(bdDoppel)) {
- System.err.println("Random number seed = " + seed);
System.err.println("bd string: scale: " + bd.scale() +
"\t" + bdString);
System.err.println("bd doppel: scale: " + bdDoppel.scale() +
diff --git a/jdk/test/java/math/BigInteger/BigIntegerTest.java b/jdk/test/java/math/BigInteger/BigIntegerTest.java
index 4de80fa..e1b36c0 100644
--- a/jdk/test/java/math/BigInteger/BigIntegerTest.java
+++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,9 @@
/*
* @test
- * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465
- * @summary tests methods in BigInteger
+ * @library ..
+ * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460
+ * @summary tests methods in BigInteger (use -Dseed=X to set PRNG seed)
* @run main/timeout=400 BigIntegerTest
* @author madbot
*/
@@ -35,7 +36,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.math.BigInteger;
-import java.util.Random;
/**
* This is a simple test class created to ensure that the results
@@ -86,7 +86,8 @@
static final int SIZE = 1000; // numbers per batch
- static Random rnd = new Random();
+ private static RandomSeed rndSeed = new RandomSeed(false);
+
static boolean failure = false;
public static void constructor() {
@@ -97,7 +98,7 @@
int arrayLength = 23;
int halfLength = arrayLength/2;
byte[] array = new byte[arrayLength];
- rnd.nextBytes(array);
+ rndSeed.getRandom().nextBytes(array);
int[][] offLen = new int[][] { // offset, length, num exceptions
{-1, arrayLength, 1}, // negative offset
@@ -161,7 +162,7 @@
}
byte[] magNonZeroLength = new byte[42];
- rnd.nextBytes(magNonZeroLength);
+ rndSeed.getRandom().nextBytes(magNonZeroLength);
for (int signum = -1; signum <= 1; signum++) {
BigInteger bi = new BigInteger(signum, magNonZeroLength, 0, 0);
if (bi.compareTo(BigInteger.ZERO) != 0) {
@@ -174,13 +175,13 @@
for (int i = 0; i < SIZE; i++) {
// create reference value via a different code path from those tested
- BigInteger reference = new BigInteger(2 + rnd.nextInt(336), 4, rnd);
+ BigInteger reference = new BigInteger(2 + rndSeed.getRandom().nextInt(336), 4, rndSeed.getRandom());
byte[] refArray = reference.toByteArray();
int refLen = refArray.length;
- int factor = rnd.nextInt(5);
- int objLen = refArray.length + factor*rnd.nextInt(refArray.length) + 1;
- int offset = rnd.nextInt(objLen - refLen);
+ int factor = rndSeed.getRandom().nextInt(5);
+ int objLen = refArray.length + factor*rndSeed.getRandom().nextInt(refArray.length) + 1;
+ int offset = rndSeed.getRandom().nextInt(objLen - refLen);
byte[] objArray = new byte[objLen];
System.arraycopy(refArray, 0, objArray, offset, refLen);
@@ -191,7 +192,7 @@
failCount++;
}
- boolean isNegative = rnd.nextBoolean();
+ boolean isNegative = rndSeed.getRandom().nextBoolean();
BigInteger signMag = new BigInteger(isNegative ? -1 : 1, objArray, offset, refLen);
if (signMag.compareTo(isNegative ? reference.negate() : reference) != 0) {
System.err.println("Sign-magnitude BigInteger not equal for offset " +
@@ -208,7 +209,7 @@
for (int i=0; i<SIZE; i++) {
// Test identity x^power == x*x*x ... *x
- int power = rnd.nextInt(6) + 2;
+ int power = rndSeed.getRandom().nextInt(6) + 2;
BigInteger x = fetchNumber(order);
BigInteger y = x.pow(power);
BigInteger z = x;
@@ -309,12 +310,12 @@
for (int i=0; i<SIZE; i++) {
BigInteger x = fetchNumber(BITS_KARATSUBA - 32 - 1);
BigInteger u = base.add(x);
- int a = 1 + rnd.nextInt(31);
+ int a = 1 + rndSeed.getRandom().nextInt(31);
BigInteger w = u.shiftLeft(a);
BigInteger y = fetchNumber(BITS_KARATSUBA - 32 - 1);
BigInteger v = base.add(y);
- int b = 1 + rnd.nextInt(32);
+ int b = 1 + rndSeed.getRandom().nextInt(32);
BigInteger z = v.shiftLeft(b);
BigInteger multiplyResult = u.multiply(v).shiftLeft(a + b);
@@ -363,7 +364,7 @@
for (int i=0; i<SIZE; i++) {
BigInteger x = fetchNumber(BITS_KARATSUBA_SQUARE - 32 - 1);
BigInteger u = base.add(x);
- int a = 1 + rnd.nextInt(31);
+ int a = 1 + rndSeed.getRandom().nextInt(31);
BigInteger w = u.shiftLeft(a);
BigInteger squareResult = u.multiply(u).shiftLeft(2*a);
@@ -381,7 +382,7 @@
for (int i=0; i<SIZE; i++) {
BigInteger x = fetchNumber(BITS_TOOM_COOK_SQUARE - 32 - 1);
BigInteger u = base.add(x);
- int a = 1 + rnd.nextInt(31);
+ int a = 1 + rndSeed.getRandom().nextInt(31);
BigInteger w = u.shiftLeft(a);
BigInteger squareResult = u.multiply(u).shiftLeft(2*a);
@@ -415,20 +416,20 @@
BigInteger base = BigInteger.ONE.shiftLeft(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 33);
for (int i=0; i<SIZE; i++) {
- BigInteger addend = new BigInteger(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 34, rnd);
+ BigInteger addend = new BigInteger(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 34, rndSeed.getRandom());
BigInteger v = base.add(addend);
- BigInteger u = v.multiply(BigInteger.valueOf(2 + rnd.nextInt(Short.MAX_VALUE - 1)));
+ BigInteger u = v.multiply(BigInteger.valueOf(2 + rndSeed.getRandom().nextInt(Short.MAX_VALUE - 1)));
- if(rnd.nextBoolean()) {
+ if(rndSeed.getRandom().nextBoolean()) {
u = u.negate();
}
- if(rnd.nextBoolean()) {
+ if(rndSeed.getRandom().nextBoolean()) {
v = v.negate();
}
- int a = BITS_BURNIKEL_ZIEGLER_OFFSET + rnd.nextInt(16);
- int b = 1 + rnd.nextInt(16);
+ int a = BITS_BURNIKEL_ZIEGLER_OFFSET + rndSeed.getRandom().nextInt(16);
+ int b = 1 + rndSeed.getRandom().nextInt(16);
BigInteger w = u.multiply(BigInteger.ONE.shiftLeft(a));
BigInteger z = v.multiply(BigInteger.ONE.shiftLeft(b));
@@ -450,7 +451,7 @@
int failCount = 0;
for (int i=0; i<SIZE*10; i++) {
- int x = rnd.nextInt();
+ int x = rndSeed.getRandom().nextInt();
BigInteger bigX = BigInteger.valueOf((long)x);
int bit = (x < 0 ? 0 : 1);
int tmp = x, bitCount = 0;
@@ -471,7 +472,7 @@
int failCount = 0;
for (int i=0; i<SIZE*10; i++) {
- int x = rnd.nextInt();
+ int x = rndSeed.getRandom().nextInt();
BigInteger bigX = BigInteger.valueOf((long)x);
int signBit = (x < 0 ? 0x80000000 : 0);
int tmp = x, bitLength, j;
@@ -575,7 +576,7 @@
for (int i=0; i<100; i++) {
BigInteger x = fetchNumber(order);
- int n = Math.abs(rnd.nextInt()%200);
+ int n = Math.abs(rndSeed.getRandom().nextInt()%200);
if (!x.shiftLeft(n).equals
(x.multiply(BigInteger.valueOf(2L).pow(n))))
@@ -642,8 +643,8 @@
// Generic string conversion.
for (int i=0; i<100; i++) {
- byte xBytes[] = new byte[Math.abs(rnd.nextInt())%100+1];
- rnd.nextBytes(xBytes);
+ byte xBytes[] = new byte[Math.abs(rndSeed.getRandom().nextInt())%100+1];
+ rndSeed.getRandom().nextBytes(xBytes);
BigInteger x = new BigInteger(xBytes);
for (int radix=Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
@@ -667,7 +668,7 @@
for (int bits = upper; bits >= lower; bits--) {
for (int i = 0; i < 50; i++) {
- BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rnd));
+ BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rndSeed.getRandom()));
for (int radix = Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
String result = x.toString(radix);
@@ -764,9 +765,9 @@
int failCount = 0;
for (int i=0; i<10; i++) {
- BigInteger m = new BigInteger(100, 5, rnd);
+ BigInteger m = new BigInteger(100, 5, rndSeed.getRandom());
while(m.compareTo(BigInteger.ONE) != 1)
- m = new BigInteger(100, 5, rnd);
+ m = new BigInteger(100, 5, rndSeed.getRandom());
BigInteger exp = m.subtract(BigInteger.ONE);
BigInteger base = fetchNumber(order).abs();
while(base.compareTo(m) != -1)
@@ -826,7 +827,7 @@
// Test consistency
for(int i=0; i<10; i++) {
- p1 = BigInteger.probablePrime(100, rnd);
+ p1 = BigInteger.probablePrime(100, rndSeed.getRandom());
if (!p1.isProbablePrime(100)) {
System.err.println("Consistency "+p1.toString(16));
failCount++;
@@ -867,7 +868,7 @@
// Numbers of the form (6k+1)(12k+1)(18k+1) are Carmichael numbers if
// each of the factors is prime
int found = 0;
- BigInteger f1 = new BigInteger(40, 100, rnd);
+ BigInteger f1 = new BigInteger(40, 100, rndSeed.getRandom());
while (found < NUM_CARMICHAELS_TO_TEST) {
BigInteger k = null;
BigInteger f2, f3;
@@ -894,8 +895,8 @@
// Test some composites that are products of 2 primes
for (int i=0; i<50; i++) {
- p1 = BigInteger.probablePrime(100, rnd);
- p2 = BigInteger.probablePrime(100, rnd);
+ p1 = BigInteger.probablePrime(100, rndSeed.getRandom());
+ p2 = BigInteger.probablePrime(100, rndSeed.getRandom());
c1 = p1.multiply(p2);
if (c1.isProbablePrime(100)) {
System.err.println("Composite failed "+c1.toString(16));
@@ -904,8 +905,8 @@
}
for (int i=0; i<4; i++) {
- p1 = BigInteger.probablePrime(600, rnd);
- p2 = BigInteger.probablePrime(600, rnd);
+ p1 = BigInteger.probablePrime(600, rndSeed.getRandom());
+ p2 = BigInteger.probablePrime(600, rndSeed.getRandom());
c1 = p1.multiply(p2);
if (c1.isProbablePrime(100)) {
System.err.println("Composite failed "+c1.toString(16));
@@ -960,7 +961,7 @@
// Next, pick some large primes, use nextProbablePrime to find the
// next one, and make sure there are no primes in between
for (int i=0; i<100; i+=10) {
- p1 = BigInteger.probablePrime(50 + i, rnd);
+ p1 = BigInteger.probablePrime(50 + i, rndSeed.getRandom());
p2 = p1.add(ONE);
p3 = p1.nextProbablePrime();
while(p2.compareTo(p3) < 0) {
@@ -1025,7 +1026,7 @@
}
for(int i=0; i<10; i++) {
- BigInteger b1 = fetchNumber(rnd.nextInt(100));
+ BigInteger b1 = fetchNumber(rndSeed.getRandom().nextInt(100));
BigInteger b2 = null;
File f = new File("serialtest");
try (FileOutputStream fos = new FileOutputStream(f)) {
@@ -1059,6 +1060,7 @@
*
*/
public static void main(String[] args) throws Exception {
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
// Some variables for sizing test numbers in bits
int order1 = ORDER_MEDIUM;
@@ -1131,8 +1133,8 @@
* If order is less than 2, order is changed to 2.
*/
private static BigInteger fetchNumber(int order) {
- boolean negative = rnd.nextBoolean();
- int numType = rnd.nextInt(7);
+ boolean negative = rndSeed.getRandom().nextBoolean();
+ int numType = rndSeed.getRandom().nextInt(7);
BigInteger result = null;
if (order < 2) order = 2;
@@ -1156,14 +1158,14 @@
break;
case 3: // One bit in number
- result = BigInteger.ONE.shiftLeft(rnd.nextInt(order));
+ result = BigInteger.ONE.shiftLeft(rndSeed.getRandom().nextInt(order));
break;
case 4: // Random bit density
byte[] val = new byte[(order+7)/8];
- int iterations = rnd.nextInt(order);
+ int iterations = rndSeed.getRandom().nextInt(order);
for (int i=0; i<iterations; i++) {
- int bitIdx = rnd.nextInt(order);
+ int bitIdx = rndSeed.getRandom().nextInt(order);
val[bitIdx/8] |= 1 << (bitIdx%8);
}
result = new BigInteger(1, val);
@@ -1171,9 +1173,9 @@
case 5: // Runs of consecutive ones and zeros
result = ZERO;
int remaining = order;
- int bit = rnd.nextInt(2);
+ int bit = rndSeed.getRandom().nextInt(2);
while (remaining > 0) {
- int runLength = Math.min(remaining, rnd.nextInt(order));
+ int runLength = Math.min(remaining, rndSeed.getRandom().nextInt(order));
result = result.shiftLeft(runLength);
if (bit > 0)
result = result.add(ONE.shiftLeft(runLength).subtract(ONE));
@@ -1183,7 +1185,7 @@
break;
default: // random bits
- result = new BigInteger(order, rnd);
+ result = new BigInteger(order, rndSeed.getRandom());
}
if (negative)
diff --git a/jdk/test/java/math/BigInteger/ModPow65537.java b/jdk/test/java/math/BigInteger/ModPow65537.java
index ec962e2..f8e4a54 100644
--- a/jdk/test/java/math/BigInteger/ModPow65537.java
+++ b/jdk/test/java/math/BigInteger/ModPow65537.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,13 @@
/*
* @test
- * @bug 4891312
- * @summary verify that modPow() not broken by the special case for 65537
+ * @library ..
+ * @bug 4891312 8074460
+ * @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed)
* @author Andreas Sterbenz
*/
import java.math.BigInteger;
-import java.util.*;
import java.security.*;
import java.security.spec.*;
@@ -78,7 +78,9 @@
private static void testSigning(KeyPair kp) throws Exception {
System.out.println(kp.getPublic());
byte[] data = new byte[1024];
- new Random().nextBytes(data);
+ RandomSeed rndSeed = new RandomSeed(false);
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+ rndSeed.getRandom().nextBytes(data);
Signature sig = Signature.getInstance("SHA1withRSA", "SunRsaSign");
sig.initSign(kp.getPrivate());
diff --git a/jdk/test/java/math/BigInteger/PrimeTest.java b/jdk/test/java/math/BigInteger/PrimeTest.java
index 5f5affe..fae4fd7 100644
--- a/jdk/test/java/math/BigInteger/PrimeTest.java
+++ b/jdk/test/java/math/BigInteger/PrimeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,13 @@
/*
* @test
- * @bug 8026236
- * @summary test primality verification methods in BigInteger
+ * @library ..
+ * @bug 8026236 8074460
+ * @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed)
* @author bpb
*/
import java.math.BigInteger;
import java.util.BitSet;
-import java.util.HashSet;
import java.util.List;
import java.util.NavigableSet;
import java.util.Set;
@@ -178,7 +178,9 @@
}
// Create a list of non-prime BigIntegers.
- List<BigInteger> nonPrimeBigInts = (new SplittableRandom())
+ RandomSeed rndSeed = new RandomSeed(true);
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+ List<BigInteger> nonPrimeBigInts = (rndSeed.getSplittableRandom())
.ints(NUM_NON_PRIMES, 2, maxPrime).mapToObj(BigInteger::valueOf)
.filter(b -> !b.isProbablePrime(certainty)).collect(toList());
diff --git a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java
index b944a95..d3cb73c 100644
--- a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java
+++ b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 1025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,10 @@
/*
* @test
* @ignore This test has huge memory requirements
+ * @library ..
* @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests
- * @bug 6910473 8021204 8021203 9005933
- * @summary Test range of BigInteger values
+ * @bug 6910473 8021204 8021203 9005933 8074460
+ * @summary Test range of BigInteger values (use -Dseed=X to set PRNG seed)
* @author Dmitry Nadezhin
*/
import java.io.ByteArrayInputStream;
@@ -35,7 +36,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Arrays;
-import java.util.Random;
import java.math.BigInteger;
public class SymmetricRangeTests {
@@ -114,8 +114,9 @@
System.out.println("Testing overflow in BitSieve.sieveSingle");
int bitLength = (5 << 27) - 1;
try {
- Random rnd = new Random();
- BigInteger actual = new BigInteger(bitLength, 0, rnd);
+ RandomSeed rndSeed = new RandomSeed(false);
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+ BigInteger actual = new BigInteger(bitLength, 0, rndSeed.getRandom());
throw new RuntimeException("new BigInteger(bitLength, 0, null).bitLength()=" + actual.bitLength());
} catch (ArithmeticException e) {
// expected
diff --git a/jdk/test/java/math/RandomSeed.java b/jdk/test/java/math/RandomSeed.java
new file mode 100644
index 0000000..494705c
--- /dev/null
+++ b/jdk/test/java/math/RandomSeed.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Random;
+import java.util.SplittableRandom;
+
+public class RandomSeed {
+ private long seed = 0L;
+ private Random rnd = null;
+ private SplittableRandom srnd = null;
+
+ public RandomSeed(boolean isSplittableRandom) {
+ init(isSplittableRandom);
+ }
+
+ private void init(boolean isSplittableRandom) {
+ // obtain seed from environment if supplied
+ boolean isSeedProvided = false;
+ try {
+ // note that Long.valueOf(null) also throws a NumberFormatException
+ // so if the property is undefined this will still work correctly
+ seed = Long.valueOf(System.getProperty("seed"));
+ isSeedProvided = true;
+ } catch (NumberFormatException e) {
+ // do nothing: isSeedProvided is already false
+ }
+
+ // if no seed from environment, create a fresh one
+ Random tmpRnd = null;
+ if (!isSeedProvided) {
+ tmpRnd = new Random();
+ seed = tmpRnd.nextLong();
+ }
+
+ // create the PRNG
+ if (isSplittableRandom) {
+ srnd = new SplittableRandom(seed);
+ } else {
+ rnd = tmpRnd != null ? tmpRnd : new Random();
+ rnd.setSeed(seed);
+ }
+ }
+
+ public Random getRandom() {
+ if (rnd == null) {
+ throw new IllegalStateException("Variable of type Random not initialized");
+ }
+ return rnd;
+ }
+
+ public SplittableRandom getSplittableRandom() {
+ if (srnd == null) {
+ throw new IllegalStateException("Variable of type SplittableRandom not initialized");
+ }
+ return srnd;
+ }
+
+ public long getSeed() {
+ return seed;
+ }
+}
diff --git a/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java b/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
index 122da86..11e2dcd 100644
--- a/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
+++ b/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
@@ -152,144 +152,181 @@
@DataProvider(name="parseSuccess")
Object[][] data_parseSuccess() {
return new Object[][] {
- {"Z", 1, -1, ZoneId.of("Z")},
- {"UTC", 3, -1, ZoneId.of("UTC")},
- {"UT", 2, -1, ZoneId.of("UT")},
- {"GMT", 3, -1, ZoneId.of("GMT")},
+ {"Z", 1, -1, ZoneId.of("Z"), true},
+ {"UTC", 3, -1, ZoneId.of("UTC"), false},
+ {"UT", 2, -1, ZoneId.of("UT"), false},
+ {"GMT", 3, -1, ZoneId.of("GMT"), false},
- {"+00:00", 6, -1, ZoneOffset.UTC},
- {"UTC+00:00", 9, -1, ZoneId.of("UTC")},
- {"UT+00:00", 8, -1, ZoneId.of("UT")},
- {"GMT+00:00", 9, -1, ZoneId.of("GMT")},
- {"-00:00", 6, -1, ZoneOffset.UTC},
- {"UTC-00:00", 9, -1, ZoneId.of("UTC")},
- {"UT-00:00", 8, -1, ZoneId.of("UT")},
- {"GMT-00:00", 9, -1, ZoneId.of("GMT")},
+ {"+00:00", 6, -1, ZoneOffset.UTC, true},
+ {"UTC+00:00", 9, -1, ZoneId.of("UTC"), false},
+ {"UT+00:00", 8, -1, ZoneId.of("UT"), false},
+ {"GMT+00:00", 9, -1, ZoneId.of("GMT"), false},
+ {"-00:00", 6, -1, ZoneOffset.UTC, true},
+ {"UTC-00:00", 9, -1, ZoneId.of("UTC"), false},
+ {"UT-00:00", 8, -1, ZoneId.of("UT"), false},
+ {"GMT-00:00", 9, -1, ZoneId.of("GMT"), false},
- {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)},
- {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")},
- {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")},
- {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")},
- {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)},
- {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")},
- {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")},
- {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")},
+ {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30), true},
+ {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30"), false},
+ {"UT+02:30", 8, -1, ZoneId.of("UT+02:30"), false},
+ {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30"), false},
+ {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30), true},
+ {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30"), false},
+ {"UT-02:30", 8, -1, ZoneId.of("UT-02:30"), false},
+ {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30"), false},
// fallback to UTC
- {"UTC-01:WW", 3, -1, ZoneId.of("UTC")},
- {"UT-02:WW", 2, -1, ZoneId.of("UT")},
- {"GMT-03:WW", 3, -1, ZoneId.of("GMT")},
- {"Z0", 1, -1, ZoneOffset.UTC},
- {"UTC1", 3, -1, ZoneId.of("UTC")},
+ {"UTC-01:WW", 3, -1, ZoneId.of("UTC"), false},
+ {"UT-02:WW", 2, -1, ZoneId.of("UT"), false},
+ {"GMT-03:WW", 3, -1, ZoneId.of("GMT"), false},
+ {"Z0", 1, -1, ZoneOffset.UTC, true},
+ {"UTC1", 3, -1, ZoneId.of("UTC"), false},
// Z not parsed as zero
- {"UTCZ", 3, -1, ZoneId.of("UTC")},
- {"UTZ", 2, -1, ZoneId.of("UT")},
- {"GMTZ", 3, -1, ZoneId.of("GMT")},
+ {"UTCZ", 3, -1, ZoneId.of("UTC"), false},
+ {"UTZ", 2, -1, ZoneId.of("UT"), false},
+ {"GMTZ", 3, -1, ZoneId.of("GMT"), false},
// 0 not parsed
- {"UTC0", 3, -1, ZoneId.of("UTC")},
- {"UT0", 2, -1, ZoneId.of("UT")},
+ {"UTC0", 3, -1, ZoneId.of("UTC"), false},
+ {"UT0", 2, -1, ZoneId.of("UT"), false},
// fail to parse
- {"", 0, 0, null},
- {"A", 0, 0, null},
- {"UZ", 0, 0, null},
- {"GMA", 0, 0, null},
- {"0", 0, 0, null},
- {"+", 0, 0, null},
- {"-", 0, 0, null},
+ {"", 0, 0, null, false},
+ {"A", 0, 0, null, false},
+ {"UZ", 0, 0, null, false},
+ {"GMA", 0, 0, null, false},
+ {"0", 0, 0, null, false},
+ {"+", 0, 0, null, false},
+ {"-", 0, 0, null, false},
// zone IDs
- {"Europe/London", 13, -1, ZoneId.of("Europe/London")},
- {"America/New_York", 16, -1, ZoneId.of("America/New_York")},
- {"America/Bogusville", 0, 0, null},
+ {"Europe/London", 13, -1, ZoneId.of("Europe/London"), false},
+ {"America/New_York", 16, -1, ZoneId.of("America/New_York"), false},
+ {"America/Bogusville", 0, 0, null, false},
};
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_plain(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_plain(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + text);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + text);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + text);
- } else {
- assertEquals(parsed, null);
- }
+ test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_prefix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_prefix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
pos.setIndex(3);
- String prefixText = "XXX" + text;
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(prefixText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex, "Incorrect error index parsing: " + prefixText);
- assertEquals(pos.getIndex(), expectedIndex + 3, "Incorrect index parsing: " + prefixText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + prefixText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + prefixText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + prefixText);
- } else {
- assertEquals(parsed, null);
- }
+ test("XXX" + text,
+ expectedIndex + 3,
+ expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+ expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_suffix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_suffix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
- String suffixText = text + "XXX";
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(suffixText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + suffixText);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + suffixText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + suffixText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + suffixText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + suffixText);
- } else {
- assertEquals(parsed, null);
- }
+ test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_caseSensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_caseSensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.parseCaseSensitive().appendZoneId();
- String lcText = text.toLowerCase(Locale.ENGLISH);
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+
if (text.matches("[^A-Z]*[A-Z].*")) { // if input has letters
+ String lcText = text.toLowerCase(Locale.ENGLISH);
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
assertEquals(pos.getErrorIndex() >= 0, true);
assertEquals(pos.getIndex(), 0);
assertEquals(parsed, null);
} else {
- // case sensitive made no difference
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected);
- assertEquals(parsed.query(TemporalQueries.offset()), null);
- assertEquals(parsed.query(TemporalQueries.zone()), expected);
- } else {
- assertEquals(parsed, null);
- }
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_caseInsensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_caseInsensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.parseCaseInsensitive().appendZoneId();
- String lcText = text.toLowerCase(Locale.ENGLISH);
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_plain(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_prefix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ pos.setIndex(3);
+ test("XXX" + text,
+ expectedIndex + 3,
+ expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+ expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_suffix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_caseSensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.parseCaseSensitive().appendZoneOrOffsetId();
+ if (text.matches("[^A-Z]*[A-Z].*")) { // if input has letters
+ String lcText = text.toLowerCase(Locale.ENGLISH);
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+ assertEquals(pos.getErrorIndex() >= 0, true);
+ assertEquals(pos.getIndex(), 0);
+ assertEquals(parsed, null);
+ } else {
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetIdparseSuccess_caseInsensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.parseCaseInsensitive().appendZoneOrOffsetId();
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ private void test(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected,
+ boolean isZoneOffset) {
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
+ assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
+ assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
if (expected != null) {
- ZoneId zid = parsed.query(TemporalQueries.zoneId());
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + lcText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + lcText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + lcText);
+ assertEquals(parsed.query(TemporalQueries.zoneId()),
+ expected,
+ "Incorrect zoneId parsing: " + text);
+ assertEquals(parsed.query(TemporalQueries.offset()),
+ isZoneOffset ? expected : null,
+ "Incorrect offset parsing: " + text);
+ assertEquals(parsed.query(TemporalQueries.zone()),
+ expected,
+ "Incorrect zone parsing: " + text);
} else {
assertEquals(parsed, null);
}
diff --git a/jdk/test/java/util/prefs/CodePointZeroPrefsTest.java b/jdk/test/java/util/prefs/CodePointZeroPrefsTest.java
new file mode 100644
index 0000000..8a63b86
--- /dev/null
+++ b/jdk/test/java/util/prefs/CodePointZeroPrefsTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.lang.reflect.Constructor;
+import java.util.prefs.Preferences;
+import java.util.prefs.PreferencesFactory;
+
+/*
+ * @test
+ * @bug 8068373
+ * @summary Ensure writing a code point U+0000 null control character is detected.
+ */
+public class CodePointZeroPrefsTest
+{
+ public static void main(String[] args) throws Exception
+ {
+ int failures = 0;
+
+ // Deliberately reflect so you can reproduce it on any platform.
+ Constructor<? extends PreferencesFactory> constructor =
+ Class.forName("java.util.prefs.FileSystemPreferencesFactory").asSubclass(PreferencesFactory.class).getDeclaredConstructor();
+ constructor.setAccessible(true);
+ PreferencesFactory factory = constructor.newInstance();
+
+ Preferences node = factory.userRoot().node("com/acme/testing");
+
+ // legal key and value
+ try {
+ node.put("a", "1");
+ } catch (IllegalArgumentException iae) {
+ System.err.println("Unexpected IllegalArgumentException for legal key");
+ failures++;
+ }
+
+ // illegal key only
+ int numIAEs = 0;
+ try {
+ node.put("a\u0000b", "1");
+ System.err.println("IllegalArgumentException not thrown for illegal key");
+ failures++;
+ } catch (IllegalArgumentException iae) {
+ // do nothing
+ }
+
+ // illegal value only
+ numIAEs = 0;
+ try {
+ node.put("ab", "2\u00003");
+ System.err.println("IllegalArgumentException not thrown for illegal value");
+ failures++;
+ } catch (IllegalArgumentException iae) {
+ // do nothing
+ }
+
+ // illegal key and value
+ numIAEs = 0;
+ try {
+ node.put("a\u0000b", "2\u00003");
+ System.err.println("IllegalArgumentException not thrown for illegal entry");
+ failures++;
+ } catch (IllegalArgumentException iae) {
+ // do nothing
+ }
+
+ if (failures != 0) {
+ throw new RuntimeException("CodePointZeroPrefsTest failed with "
+ + failures + " errors!");
+ }
+ }
+}
diff --git a/jdk/test/sun/text/resources/Format/Bug8074791.java b/jdk/test/sun/text/resources/Format/Bug8074791.java
new file mode 100644
index 0000000..138158c
--- /dev/null
+++ b/jdk/test/sun/text/resources/Format/Bug8074791.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8074791
+ * @summary Make sure that Finnish month names are correct in formatted text.
+ */
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import static java.text.DateFormat.*;
+import static java.util.Calendar.JANUARY;
+
+public class Bug8074791 {
+ private static Locale FINNISH = new Locale("fi");
+ private static String JAN_FORMAT = "tammikuuta";
+ private static String JAN_STANDALONE = "tammikuu";
+
+ public static void main(String[] arg) {
+ int errors = 0;
+
+ DateFormat df = DateFormat.getDateInstance(LONG, FINNISH);
+ Date jan20 = new GregorianCalendar(2015, JANUARY, 20).getTime();
+ String str = df.format(jan20).toString();
+ // Extract the month name (locale data dependent)
+ String month = str.replaceAll(".+\\s([a-z]+)\\s\\d+$", "$1");
+ if (!month.equals(JAN_FORMAT)) {
+ errors++;
+ System.err.println("wrong format month name: got '" + month
+ + "', expected '" + JAN_FORMAT + "'");
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat("LLLL", FINNISH); // stand-alone month name
+ month = sdf.format(jan20);
+ if (!month.equals(JAN_STANDALONE)) {
+ errors++;
+ System.err.println("wrong stand-alone month name: got '" + month
+ + "', expected '" + JAN_STANDALONE + "'");
+ }
+
+ if (errors > 0) {
+ throw new RuntimeException();
+ }
+ }
+}
diff --git a/jdk/test/sun/text/resources/LocaleData b/jdk/test/sun/text/resources/LocaleData
index 2059321..719cc3d 100644
--- a/jdk/test/sun/text/resources/LocaleData
+++ b/jdk/test/sun/text/resources/LocaleData
@@ -8273,3 +8273,9 @@
FormatData/zh/MonthNarrows/10=11
FormatData/zh/MonthNarrows/11=12
FormatData/zh/MonthNarrows/12=
+
+# bug #8074791
+FormatData/fi/DatePatterns/0=d. MMMM yyyy
+FormatData/fi/DatePatterns/1=d. MMMM yyyy
+FormatData/fi/DatePatterns/2=d.M.yyyy
+FormatData/fi/DatePatterns/3=d.M.yyyy
diff --git a/jdk/test/sun/text/resources/LocaleDataTest.java b/jdk/test/sun/text/resources/LocaleDataTest.java
index abfdd97..96d6d1d 100644
--- a/jdk/test/sun/text/resources/LocaleDataTest.java
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
* 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
* 7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 8017142
- * 8037343 8055222 8042126
+ * 8037343 8055222 8042126 8074791
* @summary Verify locale data
*
*/
diff --git a/jdk/test/tools/launcher/TestSpecialArgs.java b/jdk/test/tools/launcher/TestSpecialArgs.java
index 0e35f02..307a4e0 100644
--- a/jdk/test/tools/launcher/TestSpecialArgs.java
+++ b/jdk/test/tools/launcher/TestSpecialArgs.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7124089 7131021 8042469 8066185
+ * @bug 7124089 7131021 8042469 8066185 8074373
* @summary Checks for Launcher special flags, such as MacOSX specific flags,
* and JVM NativeMemoryTracking flags.
* @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java
@@ -270,6 +270,16 @@
tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary");
checkTestResult(tr);
+ // should accept with no warnings
+ tr = doExec(javaCmd, "-cp", jarFile.getName(),
+ "-XX:NativeMemoryTracking=summary", "Foo");
+ ensureNoWarnings(tr);
+
+ // should accept with no warnings
+ tr = doExec(javaCmd, "-classpath", jarFile.getName(),
+ "-XX:NativeMemoryTracking=summary", "Foo");
+ ensureNoWarnings(tr);
+
// make sure a missing class is handled correctly, because the class
// resolution is performed by the JVM.
tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary");
@@ -278,6 +288,14 @@
}
}
+ void ensureNoWarnings(TestResult tr) {
+ checkTestResult(tr);
+ if (tr.contains("warning: Native Memory Tracking")) {
+ System.err.println(tr.toString());
+ throw new RuntimeException("Test Fails");
+ }
+ }
+
void checkTestResult(TestResult tr) {
if (!tr.isOK()) {
System.err.println(tr.toString());
diff --git a/langtools/.hgtags b/langtools/.hgtags
index c0b793f..0d0e853 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -296,3 +296,4 @@
7c44d9a33bbea75f5d91625df9bbccea360aea2a jdk9-b51
ee20efe0255d7ac6e06e88e06f7c72f6c6da7bf9 jdk9-b52
99ff00581f3633c1787bec21f2a8f3a2ffe57665 jdk9-b53
+ed34864f3b43a7df394fce6c3f0bc86b70a5d686 jdk9-b54
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
index fde64a5..c1627f2 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
@@ -144,6 +144,7 @@
}
public Void scan(DocCommentTree tree, TreePath p) {
+ env.initTypes();
env.setCurrent(p, tree);
boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
index 5597d30..e6ee1e4 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
@@ -32,6 +32,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
+import java.util.regex.Pattern;
import javax.lang.model.element.Name;
import javax.tools.StandardLocation;
@@ -79,7 +80,8 @@
private static final String STATS = "-stats";
public static final String XIMPLICIT_HEADERS = "-XimplicitHeaders:";
public static final String XCUSTOM_TAGS_PREFIX = "-XcustomTags:";
- public static final String TAGS_SEPARATOR = ",";
+ public static final String XCHECK_PACKAGE = "-XcheckPackage:";
+ public static final String SEPARATOR = ",";
// <editor-fold defaultstate="collapsed" desc="Command-line entry point">
public static void main(String... args) {
@@ -156,7 +158,7 @@
env.init(task);
checker = new Checker(env);
- DeclScanner ds = new DeclScanner() {
+ DeclScanner ds = new DeclScanner(env) {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
@@ -272,6 +274,8 @@
env.setImplicitHeaders(Character.digit(ch, 10));
} else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
+ } else if (arg.startsWith(XCHECK_PACKAGE)) {
+ env.setCheckPackages(arg.substring(arg.indexOf(":") + 1));
} else
throw new IllegalArgumentException(arg);
}
@@ -280,7 +284,7 @@
checker = new Checker(env);
if (addTaskListener) {
- final DeclScanner ds = new DeclScanner() {
+ final DeclScanner ds = new DeclScanner(env) {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
@@ -337,6 +341,9 @@
return true;
if (opt.startsWith(XMSGS_CUSTOM_PREFIX))
return Messages.Options.isValidOptions(opt.substring(XMSGS_CUSTOM_PREFIX.length()));
+ if (opt.startsWith(XCHECK_PACKAGE)) {
+ return Env.validatePackages(opt.substring(opt.indexOf(":") + 1));
+ }
return false;
}
@@ -348,6 +355,12 @@
// <editor-fold defaultstate="collapsed" desc="DeclScanner">
static abstract class DeclScanner extends TreePathScanner<Void, Void> {
+ final Env env;
+
+ public DeclScanner(Env env) {
+ this.env = env;
+ }
+
abstract void visitDecl(Tree tree, Name name);
@Override @DefinedBy(Api.COMPILER_TREE)
@@ -373,6 +386,33 @@
visitDecl(tree, tree.getName());
return super.visitVariable(tree, ignore);
}
+
+ @Override @DefinedBy(Api.COMPILER_TREE)
+ public Void visitCompilationUnit(CompilationUnitTree node, Void p) {
+ if (env.includePackages != null) {
+ String packageName = node.getPackageName() != null
+ ? node.getPackageName().toString()
+ : "";
+ if (!env.includePackages.isEmpty()) {
+ boolean included = false;
+ for (Pattern pack : env.includePackages) {
+ if (pack.matcher(packageName).matches()) {
+ included = true;
+ break;
+ }
+ }
+ if (!included)
+ return null;
+ }
+ for (Pattern pack : env.excludePackages) {
+ if (pack.matcher(packageName).matches()) {
+ return null;
+ }
+ }
+ }
+ return super.visitCompilationUnit(node, p);
+ }
+
}
// </editor-fold>
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java
index 222945d..448e4d7 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java
@@ -26,8 +26,12 @@
package com.sun.tools.doclint;
-import java.util.Set;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
@@ -36,6 +40,7 @@
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
+import javax.tools.Diagnostic.Kind;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.util.DocTrees;
@@ -44,6 +49,7 @@
import com.sun.source.util.TreePath;
import com.sun.tools.javac.model.JavacTypes;
import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.MatchingUtils;
import com.sun.tools.javac.util.StringUtils;
/**
@@ -90,6 +96,9 @@
Set<String> customTags;
+ Set<Pattern> includePackages;
+ Set<Pattern> excludePackages;
+
// Utility classes
DocTrees trees;
Elements elements;
@@ -129,6 +138,12 @@
this.trees = trees;
this.elements = elements;
this.types = types;
+ }
+
+ void initTypes() {
+ if (java_lang_Error != null)
+ return ;
+
java_lang_Error = elements.getTypeElement("java.lang.Error").asType();
java_lang_RuntimeException = elements.getTypeElement("java.lang.RuntimeException").asType();
java_lang_Throwable = elements.getTypeElement("java.lang.Throwable").asType();
@@ -141,12 +156,43 @@
void setCustomTags(String cTags) {
customTags = new LinkedHashSet<>();
- for (String s : cTags.split(DocLint.TAGS_SEPARATOR)) {
+ for (String s : cTags.split(DocLint.SEPARATOR)) {
if (!s.isEmpty())
customTags.add(s);
}
}
+ void setCheckPackages(String packages) {
+ includePackages = new HashSet<>();
+ excludePackages = new HashSet<>();
+ for (String pack : packages.split(DocLint.SEPARATOR)) {
+ boolean excluded = false;
+ if (pack.startsWith("-")) {
+ pack = pack.substring(1);
+ excluded = true;
+ }
+ if (pack.isEmpty())
+ continue;
+ Pattern pattern = MatchingUtils.validImportStringToPattern(pack);
+ if (excluded) {
+ excludePackages.add(pattern);
+ } else {
+ includePackages.add(pattern);
+ }
+ }
+ }
+
+ static boolean validatePackages(String packages) {
+ for (String pack : packages.split(DocLint.SEPARATOR)) {
+ if (pack.startsWith("-")) {
+ pack = pack.substring(1);
+ }
+ if (!pack.isEmpty() && !MatchingUtils.isValidImportString(pack))
+ return false;
+ }
+ return true;
+ }
+
/** Set the current declaration and its doc comment. */
void setCurrent(TreePath path, DocCommentTree comment) {
currPath = path;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties
index 7a69076..1f47d94 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties
@@ -107,6 +107,13 @@
\ equivalent to -Xmsgs:all/protected, meaning that\n\
\ all messages are reported for protected and public\n\
\ declarations only. \n\
+\ -XcheckPackage:<packages>\n\
+\ Enable or disable checks in specific packages.\n\
+\ <packages> is a comma separated list of package specifiers.\n\
+\ Package specifier is either a qualified name of a package\n\
+\ or a package name prefix followed by ''.*'', which expands to\n\
+\ all sub-packages of the given package. Prefix the package specifier\n\
+\ with ''-'' to disable checks for the specified packages.\n\
\ -stats\n\
\ Report statistics on the reported issues.\n\
\ -h -help --help -usage -?\n\
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index df8d0ea..25d25c3 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1211,10 +1211,8 @@
if (pattype.constValue() == null) {
log.error(c.pat.pos(),
(stringSwitch ? "string.const.req" : "const.expr.req"));
- } else if (labels.contains(pattype.constValue())) {
+ } else if (!labels.add(pattype.constValue())) {
log.error(c.pos(), "duplicate.case.label");
- } else {
- labels.add(pattype.constValue());
}
}
}
@@ -1251,19 +1249,17 @@
// where
/** Return the selected enumeration constant symbol, or null. */
private Symbol enumConstant(JCTree tree, Type enumType) {
- if (!tree.hasTag(IDENT)) {
- log.error(tree.pos(), "enum.label.must.be.unqualified.enum");
- return syms.errSymbol;
- }
- JCIdent ident = (JCIdent)tree;
- Name name = ident.name;
- for (Symbol sym : enumType.tsym.members().getSymbolsByName(name)) {
- if (sym.kind == VAR) {
- Symbol s = ident.sym = sym;
- ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
- ident.type = s.type;
- return ((s.flags_field & Flags.ENUM) == 0)
- ? null : s;
+ if (tree.hasTag(IDENT)) {
+ JCIdent ident = (JCIdent)tree;
+ Name name = ident.name;
+ for (Symbol sym : enumType.tsym.members().getSymbolsByName(name)) {
+ if (sym.kind == VAR) {
+ Symbol s = ident.sym = sym;
+ ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
+ ident.type = s.type;
+ return ((s.flags_field & Flags.ENUM) == 0)
+ ? null : s;
+ }
}
}
return null;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
index 912cb24..a37f37a 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
@@ -496,6 +496,14 @@
if (doclintOpts.equals(Collections.singleton(DocLint.XMSGS_CUSTOM_PREFIX + "none")))
return List.nil();
+ String checkPackages = options.get(Option.XDOCLINT_PACKAGE);
+
+ if (checkPackages != null) {
+ for (String s : checkPackages.split("\\s+")) {
+ doclintOpts.add(s.replace(Option.XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
+ }
+ }
+
// standard doclet normally generates H1, H2,
// so for now, allow user comments to assume that
doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
index acde6e7..01284a3 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
@@ -129,6 +129,22 @@
}
},
+ XDOCLINT_PACKAGE("-Xdoclint/package:", "opt.Xdoclint.package.args", "opt.Xdoclint.package.desc", EXTENDED, BASIC) {
+ @Override
+ public boolean matches(String option) {
+ return DocLint.isValidOption(
+ option.replace(XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
+ }
+
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ String prev = helper.get(XDOCLINT_PACKAGE);
+ String next = (prev == null) ? option : (prev + " " + option);
+ helper.put(XDOCLINT_PACKAGE.text, next);
+ return false;
+ }
+ },
+
// -nowarn is retained for command-line backward compatibility
NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) {
@Override
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
index 67bf74c..eedd14a 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
@@ -70,6 +70,7 @@
import com.sun.tools.javac.util.JavacMessages;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.MatchingUtils;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Options;
@@ -1431,7 +1432,6 @@
return specifiedPackages;
}
- private static final Pattern allMatches = Pattern.compile(".*");
public static final Pattern noMatches = Pattern.compile("(\\P{all})+");
/**
@@ -1440,8 +1440,8 @@
* import-style string, return a regex that won't match anything.
*/
private static Pattern importStringToPattern(String s, Processor p, Log log) {
- if (isValidImportString(s)) {
- return validImportStringToPattern(s);
+ if (MatchingUtils.isValidImportString(s)) {
+ return MatchingUtils.validImportStringToPattern(s);
} else {
log.warning("proc.malformed.supported.string", s, p.getClass().getName());
return noMatches; // won't match any valid identifier
@@ -1449,54 +1449,6 @@
}
/**
- * Return true if the argument string is a valid import-style
- * string specifying claimed annotations; return false otherwise.
- */
- public static boolean isValidImportString(String s) {
- if (s.equals("*"))
- return true;
-
- boolean valid = true;
- String t = s;
- int index = t.indexOf('*');
-
- if (index != -1) {
- // '*' must be last character...
- if (index == t.length() -1) {
- // ... any and preceding character must be '.'
- if ( index-1 >= 0 ) {
- valid = t.charAt(index-1) == '.';
- // Strip off ".*$" for identifier checks
- t = t.substring(0, t.length()-2);
- }
- } else
- return false;
- }
-
- // Verify string is off the form (javaId \.)+ or javaId
- if (valid) {
- String[] javaIds = t.split("\\.", t.length()+2);
- for(String javaId: javaIds)
- valid &= SourceVersion.isIdentifier(javaId);
- }
- return valid;
- }
-
- public static Pattern validImportStringToPattern(String s) {
- if (s.equals("*")) {
- return allMatches;
- } else {
- String s_prime = s.replace(".", "\\.");
-
- if (s_prime.endsWith("*")) {
- s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+";
- }
-
- return Pattern.compile(s_prime);
- }
- }
-
- /**
* For internal use only. This method may be removed without warning.
*/
public Context getContext() {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
index b38b827..92f2d4c 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
@@ -228,6 +228,17 @@
\ Enable or disable specific checks for problems in javadoc comments,\n\
\ where <group> is one of accessibility, html, missing, reference, or syntax,\n\
\ and <access> is one of public, protected, package, or private.
+
+javac.opt.Xdoclint.package.args = \
+ ([-]<packages>)
+
+javac.opt.Xdoclint.package.desc=\n\
+\ Enable or disable checks in specific packages. <packages> is a comma separated\n\
+\ list of package specifiers. Package specifier is either a qualified name of a package\n\
+\ or a package name prefix followed by '.*', which expands to all sub-packages of\n\
+\ the given package. Prefix the package specifier with '-' to disable checks for\n\
+\ the specified packages.
+
javac.opt.Xstdout=\
Redirect standard output
javac.opt.X=\
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java
new file mode 100644
index 0000000..e8d930d
--- /dev/null
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.util;
+
+import java.util.regex.Pattern;
+import javax.lang.model.SourceVersion;
+
+/**Utilities to convert an import-like string to a regexp.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class MatchingUtils {
+ private static final Pattern allMatches = Pattern.compile(".*");
+
+ /**
+ * Return true if the argument string is a valid import-style
+ * string specifying claimed annotations; return false otherwise.
+ */
+ public static boolean isValidImportString(String s) {
+ if (s.equals("*"))
+ return true;
+
+ boolean valid = true;
+ String t = s;
+ int index = t.indexOf('*');
+
+ if (index != -1) {
+ // '*' must be last character...
+ if (index == t.length() -1) {
+ // ... any and preceding character must be '.'
+ if ( index-1 >= 0 ) {
+ valid = t.charAt(index-1) == '.';
+ // Strip off ".*$" for identifier checks
+ t = t.substring(0, t.length()-2);
+ }
+ } else
+ return false;
+ }
+
+ // Verify string is off the form (javaId \.)+ or javaId
+ if (valid) {
+ String[] javaIds = t.split("\\.", t.length()+2);
+ for(String javaId: javaIds)
+ valid &= SourceVersion.isIdentifier(javaId);
+ }
+ return valid;
+ }
+
+ public static Pattern validImportStringToPattern(String s) {
+ if (s.equals("*")) {
+ return allMatches;
+ } else {
+ String s_prime = s.replace(".", "\\.");
+
+ if (s_prime.endsWith("*")) {
+ s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+";
+ }
+
+ return Pattern.compile(s_prime);
+ }
+ }
+
+}
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java
index 9393710..cffb0da 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
import java.util.HashSet;
import com.sun.tools.sjavac.Transformer;
+import com.sun.tools.sjavac.Util;
/**
* Instances of this class represent values for sjavac command line options.
@@ -358,21 +359,25 @@
@Override
public void exclude(String exclPattern) {
+ exclPattern = Util.normalizeDriveLetter(exclPattern);
excludes.add(exclPattern);
}
@Override
public void include(String inclPattern) {
+ inclPattern = Util.normalizeDriveLetter(inclPattern);
includes.add(inclPattern);
}
@Override
public void excludeFile(String exclFilePattern) {
+ exclFilePattern = Util.normalizeDriveLetter(exclFilePattern);
excludeFiles.add(exclFilePattern);
}
@Override
public void includeFile(String inclFilePattern) {
+ inclFilePattern = Util.normalizeDriveLetter(inclFilePattern);
includeFiles.add(inclFilePattern);
}
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
index d6665e1..706f0d7 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,8 +55,6 @@
*/
int noOfPackages;
- private final String SCROLL_YES = "yes";
-
/**
* Constructor to construct FrameOutputWriter object.
*
@@ -96,90 +94,73 @@
* as well as warning if browser is not supporting the Html frames.
*/
protected void generateFrameFile() throws IOException {
- Content frameset = getFrameDetails();
+ Content frame = getFrameDetails();
+ HtmlTree body = new HtmlTree(HtmlTag.BODY);
+ body.addContent(frame);
if (configuration.windowtitle.length() > 0) {
- printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
- frameset);
+ printFramesDocument(configuration.windowtitle, configuration,
+ body);
} else {
- printFramesetDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
- configuration.notimestamp, frameset);
+ printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
+ configuration, body);
}
}
/**
- * Add the code for issueing the warning for a non-frame capable web
- * client. Also provide links to the non-frame version documentation.
- *
- * @param contentTree the content tree to which the non-frames information will be added
- */
- protected void addFrameWarning(Content contentTree) {
- Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
- Content noScript = HtmlTree.NOSCRIPT(
- HtmlTree.DIV(getResource("doclet.No_Script_Message")));
- noframes.addContent(noScript);
- Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
- getResource("doclet.Frame_Alert"));
- noframes.addContent(noframesHead);
- Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
- getHyperLink(configuration.topFile,
- configuration.getText("doclet.Non_Frame_Version"))));
- noframes.addContent(p);
- contentTree.addContent(noframes);
- }
-
- /**
* Get the frame sizes and their contents.
*
* @return a content tree for the frame details
*/
protected Content getFrameDetails() {
- HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
- "top.loadFrames()");
+ HtmlTree leftContainerDiv = new HtmlTree(HtmlTag.DIV);
+ HtmlTree rightContainerDiv = new HtmlTree(HtmlTag.DIV);
+ leftContainerDiv.addStyle(HtmlStyle.leftContainer);
+ rightContainerDiv.addStyle(HtmlStyle.rightContainer);
if (noOfPackages <= 1) {
- addAllClassesFrameTag(frameset);
+ addAllClassesFrameTag(leftContainerDiv);
} else if (noOfPackages > 1) {
- HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
- "top.loadFrames()");
- addAllPackagesFrameTag(leftFrameset);
- addAllClassesFrameTag(leftFrameset);
- frameset.addContent(leftFrameset);
+ addAllPackagesFrameTag(leftContainerDiv);
+ addAllClassesFrameTag(leftContainerDiv);
}
- addClassFrameTag(frameset);
- addFrameWarning(frameset);
- return frameset;
+ addClassFrameTag(rightContainerDiv);
+ HtmlTree mainContainer = HtmlTree.DIV(HtmlStyle.mainContainer, leftContainerDiv);
+ mainContainer.addContent(rightContainerDiv);
+ return mainContainer;
}
/**
- * Add the FRAME tag for the frame that lists all packages.
+ * Add the IFRAME tag for the frame that lists all packages.
*
* @param contentTree the content tree to which the information will be added
*/
private void addAllPackagesFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(DocPaths.OVERVIEW_FRAME.getPath(),
+ HtmlTree frame = HtmlTree.IFRAME(DocPaths.OVERVIEW_FRAME.getPath(),
"packageListFrame", configuration.getText("doclet.All_Packages"));
- contentTree.addContent(frame);
+ HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
+ contentTree.addContent(leftTop);
}
/**
- * Add the FRAME tag for the frame that lists all classes.
+ * Add the IFRAME tag for the frame that lists all classes.
*
* @param contentTree the content tree to which the information will be added
*/
private void addAllClassesFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
+ HtmlTree frame = HtmlTree.IFRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
"packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
- contentTree.addContent(frame);
+ HtmlTree leftBottom = HtmlTree.DIV(HtmlStyle.leftBottom, frame);
+ contentTree.addContent(leftBottom);
}
/**
- * Add the FRAME tag for the frame that describes the class in detail.
+ * Add the IFRAME tag for the frame that describes the class in detail.
*
* @param contentTree the content tree to which the information will be added
*/
private void addClassFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(configuration.topFile.getPath(), "classFrame",
- configuration.getText("doclet.Package_class_and_interface_descriptions"),
- SCROLL_YES);
+ HtmlTree frame = HtmlTree.IFRAME(configuration.topFile.getPath(), "classFrame",
+ configuration.getText("doclet.Package_class_and_interface_descriptions"));
+ frame.addStyle(HtmlStyle.rightIframe);
contentTree.addContent(frame);
}
}
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
index fed89db..6ffaf79 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,9 +48,6 @@
public static final DocType TRANSITIONAL =
new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
- public static final DocType FRAMESET =
- new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
-
/**
* Constructor to construct a DocType object.
*
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
index ab3200a..3b9b003 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
import com.sun.tools.doclets.internal.toolkit.util.DocPath;
+import com.sun.tools.doclets.internal.toolkit.util.DocPaths;
/**
@@ -56,6 +57,8 @@
public static final String CONTENT_TYPE = "text/html";
+ DocPath pathToRoot;
+
/**
* Constructor. Initializes the destination file name through the super
* class HtmlWriter.
@@ -65,6 +68,7 @@
public HtmlDocWriter(Configuration configuration, DocPath filename)
throws IOException {
super(configuration, filename);
+ this.pathToRoot = filename.parent().invert();
configuration.message.notice("doclet.Generating_0",
DocFile.createFileForOutput(configuration, filename).getPath());
}
@@ -298,33 +302,54 @@
}
/**
- * Print the frameset version of the Html file header.
- * Called only when generating an HTML frameset file.
+ * Print the frames version of the Html file header.
+ * Called only when generating an HTML frames file.
*
* @param title Title of this HTML document
- * @param noTimeStamp If true, don't print time stamp in header
- * @param frameset the frameset to be added to the HTML document
+ * @param configuration the configuration object
+ * @param frame the frame content tree to be added to the HTML document
*/
- public void printFramesetDocument(String title, boolean noTimeStamp,
- Content frameset) throws IOException {
- Content htmlDocType = DocType.FRAMESET;
+ public void printFramesDocument(String title, ConfigurationImpl configuration,
+ HtmlTree body) throws IOException {
+ Content htmlDocType = DocType.TRANSITIONAL;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
- head.addContent(getGeneratedBy(!noTimeStamp));
+ head.addContent(getGeneratedBy(!configuration.notimestamp));
Content windowTitle = HtmlTree.TITLE(new StringContent(title));
head.addContent(windowTitle);
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
(configuration.charset.length() > 0) ?
configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
head.addContent(meta);
- head.addContent(getFramesetJavaScript());
+ head.addContent(getStyleSheetProperties(configuration));
+ head.addContent(getFramesJavaScript());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
- head, frameset);
+ head, body);
Content htmlDocument = new HtmlDocument(htmlDocType,
htmlComment, htmlTree);
write(htmlDocument);
}
+ /**
+ * Returns a link to the stylesheet file.
+ *
+ * @return an HtmlTree for the lINK tag which provides the stylesheet location
+ */
+ public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
+ String stylesheetfile = configuration.stylesheetfile;
+ DocPath stylesheet;
+ if (stylesheetfile.isEmpty()) {
+ stylesheet = DocPaths.STYLESHEET;
+ } else {
+ DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
+ stylesheet = DocPath.create(file.getName());
+ }
+ HtmlTree link = HtmlTree.LINK("stylesheet", "text/css",
+ pathToRoot.resolve(stylesheet).getPath(),
+ "Style");
+ return link;
+ }
+
protected Comment getGeneratedBy(boolean timestamp) {
String text = "Generated by javadoc"; // marker string, deliberately not localized
if (timestamp) {
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
index a2dddaf..4d30028 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,11 @@
indexHeader,
inheritance,
interfaceName,
+ leftContainer,
+ leftTop,
+ leftBottom,
legalCopy,
+ mainContainer,
memberNameLabel,
memberNameLink,
memberSummary,
@@ -79,6 +83,8 @@
packageHierarchyLabel,
paramLabel,
returnLabel,
+ rightContainer,
+ rightIframe,
rowColor,
seeLabel,
serializedFormContainer,
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
index eea7112..f213391 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,8 +52,6 @@
DT,
EM(BlockType.INLINE, EndTag.END),
FONT(BlockType.INLINE, EndTag.END),
- FRAME(BlockType.OTHER, EndTag.NOEND),
- FRAMESET(BlockType.OTHER, EndTag.END),
H1,
H2,
H3,
@@ -64,6 +62,7 @@
HR(BlockType.BLOCK, EndTag.NOEND),
HTML(BlockType.OTHER, EndTag.END),
I(BlockType.INLINE, EndTag.END),
+ IFRAME(BlockType.OTHER, EndTag.END),
IMG(BlockType.INLINE, EndTag.NOEND),
LI,
LISTING,
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
index 7d5c47b..77aee4a 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -326,53 +326,18 @@
}
/**
- * Generates a FRAME tag.
+ * Generates a IFRAME tag.
*
* @param src the url of the document to be shown in the frame
* @param name specifies the name of the frame
* @param title the title for the frame
- * @param scrolling specifies whether to display scrollbars in the frame
- * @return an HtmlTree object for the FRAME tag
+ * @return an HtmlTree object for the IFRAME tag
*/
- public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
- HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
+ public static HtmlTree IFRAME(String src, String name, String title) {
+ HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
- if (scrolling != null)
- htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
- return htmltree;
- }
-
- /**
- * Generates a Frame tag.
- *
- * @param src the url of the document to be shown in the frame
- * @param name specifies the name of the frame
- * @param title the title for the frame
- * @return an HtmlTree object for the SPAN tag
- */
- public static HtmlTree FRAME(String src, String name, String title) {
- return FRAME(src, name, title, null);
- }
-
- /**
- * Generates a FRAMESET tag.
- *
- * @param cols the size of columns in the frameset
- * @param rows the size of rows in the frameset
- * @param title the title for the frameset
- * @param onload the script to run when the document loads
- * @return an HtmlTree object for the FRAMESET tag
- */
- public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
- HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
- if (cols != null)
- htmltree.addAttr(HtmlAttr.COLS, cols);
- if (rows != null)
- htmltree.addAttr(HtmlAttr.ROWS, rows);
- htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
- htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
}
@@ -779,7 +744,7 @@
return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
case BR :
return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
- case FRAME :
+ case IFRAME :
return (hasAttr(HtmlAttr.SRC) && !hasContent());
case HR :
return (!hasContent());
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
index f74c084..3e923cb 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -376,7 +376,7 @@
*
* @return a content for the SCRIPT tag
*/
- protected Content getFramesetJavaScript() {
+ protected Content getFramesJavaScript() {
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
script.addAttr(HtmlAttr.TYPE, "text/javascript");
String scriptCode = DocletConstants.NL +
@@ -425,10 +425,6 @@
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" return true;" + DocletConstants.NL +
- " }" + DocletConstants.NL +
- " function loadFrames() {" + DocletConstants.NL +
- " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
- " top.classFrame.location = top.targetPage;" + DocletConstants.NL +
" }" + DocletConstants.NL;
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
index 9951877..8e97bda 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
@@ -104,10 +104,7 @@
doclet.Package_Hierarchies=Package Hierarchies:
doclet.Hierarchy_For_Package=Hierarchy For Package {0}
doclet.Hierarchy_For_All_Packages=Hierarchy For All Packages
-doclet.Frame_Alert=Frame Alert
-doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to {0}.
doclet.No_Script_Message=JavaScript is disabled on your browser.
-doclet.Non_Frame_Version=Non-frame version
doclet.Description_From_Interface=Description copied from interface:
doclet.Description_From_Class=Description copied from class:
doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to document.
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
index cebb4fd..883f64b 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
@@ -11,6 +11,17 @@
font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
font-size:14px;
margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+}
+iframe {
+ margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+ overflow-y:scroll;
+ border:none;
}
a:link, a:visited {
text-decoration:none;
@@ -463,7 +474,6 @@
.useSummary td, .constantsSummary td, .deprecatedSummary td {
text-align:left;
padding:0px 0px 12px 10px;
- width:100%;
}
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
@@ -488,6 +498,7 @@
font-size:13px;
}
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.useSummary td.colFirst, .useSummary th.colFirst,
.overviewSummary td.colOne, .overviewSummary th.colOne,
.memberSummary td.colFirst, .memberSummary th.colFirst,
.memberSummary td.colOne, .memberSummary th.colOne,
@@ -569,6 +580,61 @@
font-style:normal;
}
-div.contentContainer ul.blockList li.blockList h2{
+div.contentContainer ul.blockList li.blockList h2 {
padding-bottom:0px;
}
+/*
+IFRAME specific styles
+*/
+.mainContainer {
+ margin:0 auto;
+ padding:0;
+ height:100%;
+ width:100%;
+ position:fixed;
+ top:0;
+ left:0;
+}
+.leftContainer {
+ height:100%;
+ position:fixed;
+ width:320px;
+}
+.leftTop {
+ position:relative;
+ float:left;
+ width:315px;
+ top:0;
+ left:0;
+ height:30%;
+ border-right:6px solid #ccc;
+ border-bottom:6px solid #ccc;
+}
+.leftBottom {
+ position:relative;
+ float:left;
+ width:315px;
+ bottom:0;
+ left:0;
+ height:70%;
+ border-right:6px solid #ccc;
+ border-top:1px solid #000;
+}
+.rightContainer {
+ position:absolute;
+ left:320px;
+ top:0;
+ bottom:0;
+ height:100%;
+ right:0;
+ border-left:1px solid #000;
+}
+.rightIframe {
+ margin:0;
+ padding:0;
+ height:100%;
+ right:30px;
+ width:100%;
+ overflow:visible;
+ margin-bottom:30px;
+}
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
index 17a08f9..2732615 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
@@ -833,7 +833,7 @@
for (String customTag : customTagNames) {
customTags.append(sep);
customTags.append(customTag);
- sep = DocLint.TAGS_SEPARATOR;
+ sep = DocLint.SEPARATOR;
}
doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
diff --git a/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java b/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
index 43da7cd..aac1d0c 100644
--- a/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
+++ b/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,10 @@
/*
* @test
- * @bug 4275630 4749453 4625400 4753048 4415270
- * @summary Generated HTML is invalid with frameset DTD.
+ * @bug 4275630 4749453 4625400 4753048 4415270 8074521
+ * @summary Generated HTML is invalid with frames.
* Displays unnecessary horizontal scroll bars.
* Missing whitespace in DOCTYPE declaration
- * <NOFRAMES> not allowed outside <FRAMESET> element
* HTML table tags inserted in wrong place in pakcage use page
* @author dkramer
* @library ../lib
@@ -55,7 +54,7 @@
checkExit(Exit.OK);
// Test the proper DOCTYPE element are present:
- checkOutput("index.html", true, FRAMESET);
+ checkOutput("index.html", true, LOOSE);
checkOutput("overview-summary.html", true, LOOSE);
checkOutput("p1/package-summary.html", true, LOOSE);
checkOutput("p1/C.html", true, LOOSE);
@@ -63,10 +62,9 @@
checkOutput("allclasses-frame.html", true, LOOSE);
checkOutput("p1/package-frame.html", true, LOOSE);
- // Test that <NOFRAMES> is inside <FRAMESET> element:
+ // Test for IFRAME element:
checkOutput("index.html", true,
- "</noframes>\n"
- + "</frameset>");
+ "<iframe");
// Test the table elements are in the correct order:
checkOutput("p1/package-use.html", true,
@@ -74,8 +72,6 @@
+ "</tr>");
}
- private static final String FRAMESET =
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
private static final String LOOSE =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
}
diff --git a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java
index cf3dd12..bbb57ff 100644
--- a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java
+++ b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,10 +47,9 @@
"pkg", testSrc("NoPackage.java"));
checkExit(Exit.OK);
- //Make sure the horizontal scroll bar does not appear in class frame.
checkOutput("index.html", true,
- "<frame src=\"overview-summary.html\" name=\"classFrame\" title=\""
- + "Package, class and interface descriptions\" scrolling=\"yes\">");
+ "<iframe src=\"overview-summary.html\" name=\"classFrame\" title=\""
+ + "Package, class and interface descriptions\" class=\"rightIframe\">");
//Test index-all.html
checkOutput("index-all.html", true,
diff --git a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
index 504dcb2..4736d25 100644
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -99,10 +99,6 @@
+ " }\n"
+ " return true;\n"
+ " }\n"
- + " function loadFrames() {\n"
- + " if (targetPage != \"\" && targetPage != \"undefined\")\n"
- + " top.classFrame.location = top.targetPage;\n"
- + " }\n"
+ "</script>");
//Make sure title javascript only runs if is-external is not true
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java b/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java
deleted file mode 100644
index ef809e9..0000000
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 7001086
- * @summary Test Non-frame warning.
- * @author Bhavesh Patel
- * @library ../lib
- * @build JavadocTester
- * @run main TestNonFrameWarning
- */
-
-public class TestNonFrameWarning extends JavadocTester {
-
- public static void main(String... args) throws Exception {
- TestNonFrameWarning tester = new TestNonFrameWarning();
- tester.runTests();
- }
-
- @Test
- void test() {
- javadoc("-d", "out",
- "-sourcepath", testSrc,
- "pkg");
- checkExit(Exit.OK);
-
- checkOutput("index.html", true,
- "<p>This document is designed to be viewed using the frames feature. "
- + "If you see this message, you are using a non-frame-capable web client. "
- + "Link to <a href=\"pkg/package-summary.html\">Non-frame version</a>.</p>");
- }
-}
diff --git a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java
index 741f711..4ededa0 100644
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
"<div class=\"subTitle\">compact1, compact2, compact3</div>");
checkOutput("index.html", true,
- "<frame src=\"overview-frame.html\" name=\"packageListFrame\" "
+ "<iframe src=\"overview-frame.html\" name=\"packageListFrame\" "
+ "title=\"All Packages\">");
// Test for "overview-summary.html" showing the profile list.
diff --git a/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java b/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java
index e433ae8..d96d58c 100644
--- a/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java
+++ b/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549
+ * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461
* @summary Run tests on doclet stylesheet.
* @author jamieh
* @library ../lib
@@ -64,6 +64,17 @@
+ " font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;\n"
+ " font-size:14px;\n"
+ " margin:0;\n"
+ + " padding:0;\n"
+ + " height:100%;\n"
+ + " width:100%;\n"
+ + "}",
+ "iframe {\n"
+ + " margin:0;\n"
+ + " padding:0;\n"
+ + " height:100%;\n"
+ + " width:100%;\n"
+ + " overflow-y:scroll;\n"
+ + " border:none;\n"
+ "}",
"ul {\n"
+ " list-style-type:disc;\n"
@@ -118,6 +129,21 @@
+ " background-color:#4D7A97;\n"
+ " height:16px;\n"
+ "}",
+ // Test the formatting styles for proper content display in use and constant values pages.
+ ".overviewSummary td.colFirst, .overviewSummary th.colFirst,\n"
+ + ".useSummary td.colFirst, .useSummary th.colFirst,\n"
+ + ".overviewSummary td.colOne, .overviewSummary th.colOne,\n"
+ + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
+ + ".memberSummary td.colOne, .memberSummary th.colOne,\n"
+ + ".typeSummary td.colFirst{\n"
+ + " width:25%;\n"
+ + " vertical-align:top;\n"
+ + "}",
+ ".overviewSummary td, .memberSummary td, .typeSummary td,\n"
+ + ".useSummary td, .constantsSummary td, .deprecatedSummary td {\n"
+ + " text-align:left;\n"
+ + " padding:0px 0px 12px 10px;\n"
+ + "}",
".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n"
+ " padding-top:0px;\n"
+ " padding-left:0px;\n"
@@ -134,6 +160,9 @@
"<link rel=\"stylesheet\" type=\"text/css\" "
+ "href=\"../stylesheet.css\" title=\"Style\">");
+ checkOutput("index.html", true,
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">");
+
checkOutput("stylesheet.css", false,
"* {\n"
+ " margin:0;\n"
diff --git a/langtools/test/tools/doclint/tool/HelpTest.out b/langtools/test/tools/doclint/tool/HelpTest.out
index 0d7d402..1c41968 100644
--- a/langtools/test/tools/doclint/tool/HelpTest.out
+++ b/langtools/test/tools/doclint/tool/HelpTest.out
@@ -30,6 +30,13 @@
equivalent to -Xmsgs:all/protected, meaning that
all messages are reported for protected and public
declarations only.
+ -XcheckPackage:<packages>
+ Enable or disable checks in specific packages.
+ <packages> is a comma separated list of package specifiers.
+ Package specifier is either a qualified name of a package
+ or a package name prefix followed by '.*', which expands to
+ all sub-packages of the given package. Prefix the package specifier
+ with '-' to disable checks for the specified packages.
-stats
Report statistics on the reported issues.
-h -help --help -usage -?
diff --git a/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java b/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java
index 539dd41..823740f 100644
--- a/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java
+++ b/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 8074306
+ * @bug 8074306 8073432 8074501
* @summary NULLCHK is emitted as Object.getClass
* @compile -source 6 -target 6 TestSyntheticNullChecks.java
* @run main TestSyntheticNullChecks 6
diff --git a/langtools/test/tools/javac/doclint/IncludePackagesTest.java b/langtools/test/tools/javac/doclint/IncludePackagesTest.java
new file mode 100644
index 0000000..f466792
--- /dev/null
+++ b/langtools/test/tools/javac/doclint/IncludePackagesTest.java
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8071851
+ * @summary Test the -Xdoclint/package option
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import static javax.tools.Diagnostic.Kind.*;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.main.Main;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class IncludePackagesTest {
+ public static void main(String... args) throws Exception {
+ new IncludePackagesTest().run();
+ }
+
+ JavaCompiler javac;
+ StandardJavaFileManager fm;
+ List<JavaFileObject> files;
+
+ final String[] sources = new String[] {
+ "p1/p1T.java",
+ "package p1;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p1T {\n" +
+ "}\n",
+ "p1/sp1/p1sp1T.java",
+ "package p1.sp1;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p1sp1T {\n" +
+ "}\n",
+ "p1/sp1/sp2/p1sp1sp2T.java",
+ "package p1.sp1.sp2;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p1sp1sp2T {\n" +
+ "}\n",
+ "p2/p2T.java",
+ "package p2;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p2T {\n" +
+ "}\n",
+ "Default.java",
+ "/** Syntax < error. */\n" +
+ "public class Default {\n" +
+ "}\n",
+ };
+
+ final String rawDiags = "-XDrawDiagnostics";
+ private enum Message {
+ // doclint messages
+ p1T(ERROR, "p1T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ p1sp1T(ERROR, "p1sp1T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ p1sp1sp2T(ERROR, "p1sp1sp2T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ p2T(ERROR, "p2T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ Default(ERROR, "Default.java:1:12: compiler.err.proc.messager: malformed HTML"),
+ INVALID_PACKAGE_ERROR(ERROR, "invalid flag: -Xdoclint/package:wrong+package");
+
+ final Diagnostic.Kind kind;
+ final String text;
+
+ static Message get(String text) {
+ for (Message m: values()) {
+ if (m.text.equals(text))
+ return m;
+ }
+ return null;
+ }
+
+ Message(Diagnostic.Kind kind, String text) {
+ this.kind = kind;
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + kind + ",\"" + text + "\"]";
+ }
+ }
+ void run() throws Exception {
+ javac = ToolProvider.getSystemJavaCompiler();
+ fm = javac.getStandardFileManager(null, null, null);
+ try {
+ fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
+ files = new ArrayList<>();
+
+ for (int si = 0; si < sources.length; si += 2) {
+ files.add(new JFOImpl(sources[si], sources[si + 1]));
+ }
+
+ test(Arrays.asList(rawDiags, "-Xdoclint"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1T, Message.p1sp1T, Message.p1sp1sp2T,
+ Message.p2T, Message.Default));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:p1"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1T));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:p1.*"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1sp1T, Message.p1sp1sp2T));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:p1.*,-p1.sp1"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1sp1sp2T));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:-p1.sp1"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1T, Message.p1sp1sp2T, Message.p2T, Message.Default));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:wrong+package"),
+ Main.Result.CMDERR,
+ EnumSet.of(Message.INVALID_PACKAGE_ERROR));
+
+ if (errors > 0)
+ throw new Exception(errors + " errors occurred");
+ } finally {
+ fm.close();
+ }
+ }
+
+ void test(List<String> opts, Main.Result expectResult, Set<Message> expectMessages) {
+ System.err.println("test: " + opts);
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ try {
+ JavacTask t = (JavacTask) javac.getTask(pw, fm, null, opts, null, files);
+ boolean ok = t.call();
+ pw.close();
+ String out = sw.toString().replaceAll("[\r\n]+", "\n");
+ if (!out.isEmpty())
+ System.err.println(out);
+ if (ok && expectResult != Main.Result.OK) {
+ error("Compilation succeeded unexpectedly");
+ } else if (!ok && expectResult != Main.Result.ERROR) {
+ error("Compilation failed unexpectedly");
+ } else
+ check(out, expectMessages);
+ } catch (IllegalArgumentException e) {
+ System.err.println(e);
+ String expectOut = expectMessages.iterator().next().text;
+ if (expectResult != Main.Result.CMDERR)
+ error("unexpected exception caught");
+ else if (!e.getMessage().equals(expectOut)) {
+ error("unexpected exception message: "
+ + e.getMessage()
+ + " expected: " + expectOut);
+ }
+ }
+ }
+
+ private void check(String out, Set<Message> expect) {
+ Pattern stats = Pattern.compile("^([1-9]+) (error|warning)(s?)");
+ Set<Message> found = EnumSet.noneOf(Message.class);
+ int e = 0, w = 0;
+ if (!out.isEmpty()) {
+ for (String line: out.split("[\r\n]+")) {
+ Matcher s = stats.matcher(line);
+ if (s.matches()) {
+ int i = Integer.valueOf(s.group(1));
+ if (s.group(2).equals("error"))
+ e++;
+ else
+ w++;
+ continue;
+ }
+
+ Message m = Message.get(line);
+ if (m == null)
+ error("Unexpected line: " + line);
+ else
+ found.add(m);
+ }
+ }
+ for (Message m: expect) {
+ if (!found.contains(m))
+ error("expected message not found: " + m.text);
+ }
+ for (Message m: found) {
+ if (!expect.contains(m))
+ error("unexpected message found: " + m.text);
+ }
+ }
+
+ void error(String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+
+ class JFOImpl extends SimpleJavaFileObject {
+
+ private final String code;
+
+ public JFOImpl(String fileName, String code) {
+ super(URI.create(fileName), JavaFileObject.Kind.SOURCE);
+ this.code = code;
+ }
+
+ @Override
+ public CharSequence getCharContent(boolean ignoreEncoding) {
+ return code;
+ }
+ }
+}
diff --git a/langtools/test/tools/javac/enum/EnumSwitch2.java b/langtools/test/tools/javac/enum/EnumSwitch2.java
index 71d8d00..aae2c55 100644
--- a/langtools/test/tools/javac/enum/EnumSwitch2.java
+++ b/langtools/test/tools/javac/enum/EnumSwitch2.java
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 4936393
+ * @bug 4936393 8050021
* @summary enum switch case labels required to be unqualified.
* @author gafter
* @compile/fail/ref=EnumSwitch2.out -XDrawDiagnostics EnumSwitch2.java
diff --git a/langtools/test/tools/javac/enum/EnumSwitch2.out b/langtools/test/tools/javac/enum/EnumSwitch2.out
index 840f10c..cab9c9b 100644
--- a/langtools/test/tools/javac/enum/EnumSwitch2.out
+++ b/langtools/test/tools/javac/enum/EnumSwitch2.out
@@ -1,4 +1,3 @@
EnumSwitch2.java:14:16: compiler.err.enum.label.must.be.unqualified.enum
EnumSwitch2.java:15:16: compiler.err.enum.label.must.be.unqualified.enum
-EnumSwitch2.java:15:9: compiler.err.duplicate.case.label
-3 errors
+2 errors
diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk
index 2318812..0668026 100644
--- a/make/CompileJavaModules.gmk
+++ b/make/CompileJavaModules.gmk
@@ -90,12 +90,16 @@
################################################################################
+java.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
+
+################################################################################
+
java.datatransfer_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
java.datatransfer_COPY := flavormap.properties
################################################################################
-java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-missing,-reference '-Xdoclint/package:java.*,javax.*'
+java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-missing,-reference '-Xdoclint/package:java.*,javax.*'
java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
java.desktop_CLEAN := iio-plugin.properties cursors.properties
@@ -336,6 +340,7 @@
################################################################################
+jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*'
jdk.compiler_COPY := javax.tools.JavaCompilerTool
jdk.compiler_CLEAN_FILES := $(wildcard \
$(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
diff --git a/make/Images.gmk b/make/Images.gmk
index 6fe4f76..3a81714 100644
--- a/make/Images.gmk
+++ b/make/Images.gmk
@@ -494,29 +494,16 @@
GCOV_FIND_EXPR := -type f -name "*.gcno"
- ifeq ($(JVM_VARIANT_CLIENT), true)
- $(eval $(call SetupCopyFiles,COPY_HOTSPOT_CLIENT_GCOV_GCNO, \
- SRC := $(HOTSPOT_OUTPUTDIR), \
- DEST := $(SYMBOLS_IMAGE_DIR)/gcov/hotspot/client, \
- FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR)/*compiler1/ $(GCOV_FIND_EXPR)), \
- FLATTEN := true))
+ $(eval $(call SetupCopyFiles,COPY_HOTSPOT_GCOV_GCNO, \
+ SRC := $(OUTPUT_ROOT), \
+ DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
+ FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR) $(GCOV_FIND_EXPR))))
- SYMBOLS_TARGETS += $(COPY_HOTSPOT_CLIENT_GCOV_GCNO)
- endif
-
- ifeq ($(JVM_VARIANT_SERVER), true)
- $(eval $(call SetupCopyFiles,COPY_HOTSPOT_SERVER_GCOV_GCNO, \
- SRC := $(HOTSPOT_OUTPUTDIR), \
- DEST := $(SYMBOLS_IMAGE_DIR)/gcov/hotspot/server, \
- FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR)/*compiler2/ $(GCOV_FIND_EXPR)), \
- FLATTEN := true))
-
- SYMBOLS_TARGETS += $(COPY_HOTSPOT_SERVER_GCOV_GCNO)
- endif
+ SYMBOLS_TARGETS += $(COPY_HOTSPOT_GCOV_GCNO)
$(eval $(call SetupCopyFiles,COPY_JDK_GCOV_GCNO, \
- SRC := $(SUPPORT_OUTPUTDIR)/native, \
- DEST := $(SYMBOLS_IMAGE_DIR)/gcov/jdk, \
+ SRC := $(OUTPUT_ROOT), \
+ DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
FILES := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/native $(GCOV_FIND_EXPR))))
SYMBOLS_TARGETS += $(COPY_JDK_GCOV_GCNO)
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
index 17dca95..0018125 100644
--- a/make/common/NativeCompilation.gmk
+++ b/make/common/NativeCompilation.gmk
@@ -60,7 +60,7 @@
-e 's|Note: including file: *||' \
-e 's|\\|/|g' \
-e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \
- -e '/$(subst /,\/,$(TOPDIR))/!d' \
+ -e '\|$(TOPDIR)|I !d' \
-e 's|$$$$| \\|g' \
#
@@ -153,7 +153,7 @@
exit `cat $$($1_$2_DEP).exitvalue`
$(RM) $$($1_$2_DEP).exitvalue
($(ECHO) $$@: \\ \
- && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) > $$($1_$2_DEP)
+ && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) | $(SORT) -u > $$($1_$2_DEP)
endif
# Create a dependency target file from the dependency file.
# Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
@@ -392,12 +392,6 @@
$1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release)
endif
- # Pick up disabled warnings, if possible on this platform.
- ifneq ($(DISABLE_WARNING_PREFIX),)
- $1_EXTRA_CFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
- $1_EXTRA_CXXFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
- endif
-
ifeq ($$($1_DEBUG_SYMBOLS), true)
ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
ifdef OPENJDK
@@ -415,6 +409,9 @@
endif
endif
+ # If no C++ flags are explicitly set, default to using the C flags.
+ # After that, we can set additional C++ flags that should not interfere
+ # with the mechanism for copying the C flags by default.
ifeq ($$($1_CXXFLAGS),)
$1_CXXFLAGS:=$$($1_CFLAGS)
endif
@@ -427,6 +424,12 @@
$1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER)
endif
+ # Pick up disabled warnings, if possible on this platform.
+ ifneq ($(DISABLE_WARNING_PREFIX),)
+ $1_EXTRA_CFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
+ $1_EXTRA_CXXFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
+ endif
+
ifeq (NONE, $$($1_OPTIMIZATION))
$1_EXTRA_CFLAGS += $(C_O_FLAG_NONE)
$1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NONE)
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index c6f7d0b..b2a596b 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -287,3 +287,4 @@
10b32cc48ccc2592621b28558a1cf70a0ce22fe5 jdk9-b51
fada76c29db9c792ad7127e674ef5337e15d2225 jdk9-b52
6cd23482ca9bd0caa6bfa6bf9064251178083d17 jdk9-b53
+26460b897225010a4c7664eaff7a71f1156cacb3 jdk9-b54
diff --git a/nashorn/make/BuildNashorn.gmk b/nashorn/make/BuildNashorn.gmk
index a36b28a..31cc8a0 100644
--- a/nashorn/make/BuildNashorn.gmk
+++ b/nashorn/make/BuildNashorn.gmk
@@ -105,8 +105,8 @@
# Create nashorn.jar from the final classes dir
$(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
- $(NASGEN_RUN_FILE) \
- $(VERSION_FILE), \
+ DEPENDENCIES := $(NASGEN_RUN_FILE) \
+ $(VERSION_FILE), \
SRCS := $(NASHORN_CLASSES_DIR), \
SUFFIXES := .class .js .properties Factory, \
MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
diff --git a/nashorn/make/build-nasgen.xml b/nashorn/make/build-nasgen.xml
index d983337..0032011 100644
--- a/nashorn/make/build-nasgen.xml
+++ b/nashorn/make/build-nasgen.xml
@@ -35,11 +35,10 @@
<classpath>
<pathelement location="${basedir}/jcov2/lib/jcov_j2se_rt.jar"/>
<pathelement location="${basedir}/buildtools/nasgen/dist/nasgen.jar"/>
- <pathelement path="${basedir}/build/classes"/>
<pathelement location="${dist.dir}/nasgen.jar"/>
<pathelement path="${build.dir}/classes"/>
</classpath>
- <jvmarg value="${boot.class.path}"/>
+ <jvmarg value="-Xbootclasspath/p:${basedir}/build/classes"/>
<arg value="${build.dir}/classes"/>
<arg value="jdk.nashorn.internal.objects"/>
<arg value="${build.dir}/classes"/>
@@ -52,8 +51,8 @@
<java classname="jdk.nashorn.internal.tools.nasgen.Main" fork="true" failonerror="true">
<classpath>
<pathelement location="${basedir}/buildtools/nasgen/dist/nasgen.jar"/>
- <pathelement path="${basedir}/build/eclipse"/>
</classpath>
+ <jvmarg value="-Xbootclasspath/p:${basedir}/build/eclipse"/>
<arg value="${basedir}/build/eclipse"/>
<arg value="jdk.nashorn.internal.objects"/>
<arg value="${basedir}/build/eclipse/.nasgentmp"/>
diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml
index 9bc4d67..bd85a06 100644
--- a/nashorn/make/build.xml
+++ b/nashorn/make/build.xml
@@ -98,7 +98,7 @@
<fail message="Unsupported Java version: ${ant.java.version}. Please use Java version 1.8 or greater." unless="jdk1.8+">
</fail>
</target>
-
+
<target name="init" depends="check-ant-version, check-java-version, init-conditions, init-cc">
<!-- extends jvm args -->
<property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
@@ -209,7 +209,7 @@
</target>
<target name="javadoc" depends="jar">
- <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html"
+ <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html"
extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
additionalparam="-quiet" failonerror="true">
<classpath>
@@ -227,7 +227,7 @@
<!-- generate javadoc only for nashorn extension api classes -->
<target name="javadocapi" depends="jar">
- <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}"
+ <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}"
windowtitle="${nashorn.product.name}" additionalparam="-quiet" failonerror="true">
<classpath>
<pathelement location="${build.classes.dir}"/>
@@ -314,6 +314,15 @@
permission java.security.AllPermission;
};
+grant codeBase "file:/${basedir}/${nashorn.api.tests.jar}" {
+ permission java.util.PropertyPermission "parserapitest.*", "read";
+ permission java.util.PropertyPermission "test.*", "read";
+ permission java.util.PropertyPermission "test262.*", "read";
+ permission java.io.FilePermission "${basedir}/test/-","read";
+ permission java.io.FilePermission "$${user.dir}", "read";
+ permission java.util.PropertyPermission "user.dir", "read";
+};
+
grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
permission java.security.AllPermission;
};
@@ -395,6 +404,7 @@
<fileset id="test.classes" dir="${build.test.classes.dir}">
<include name="**/api/javaaccess/*Test.class"/>
<include name="**/api/scripting/*Test.class"/>
+ <include name="**/api/tree/*Test.class"/>
<include name="**/codegen/*Test.class"/>
<include name="**/parser/*Test.class"/>
<include name="**/runtime/*Test.class"/>
@@ -440,7 +450,7 @@
<delete dir="${build.dir}/nashorn_code_cache"/>
<property name="debug.test.jvmargs" value=""/>
<testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes"
- verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
+ verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
<jvmarg line="${boot.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
<jvmarg line="${debug.test.jvmargs}"/>
@@ -466,7 +476,7 @@
<antcall target="-test-nosecurity" inheritRefs="true">
<param name="optimistic" value="true"/>
<param name="testResultsSubDir" value="optimistic"/>
- </antcall>
+ </antcall>
<antcall target="-test-security" inheritRefs="true">
<param name="optimistic" value="true"/>
<param name="testResultsSubDir" value="optimistic"/>
@@ -478,7 +488,7 @@
<antcall target="-test-nosecurity" inheritRefs="true">
<param name="optimistic" value="false"/>
<param name="testResultsSubDir" value="pessimistic"/>
- </antcall>
+ </antcall>
<antcall target="-test-security" inheritRefs="true">
<param name="optimistic" value="false"/>
<param name="testResultsSubDir" value="pessimistic"/>
diff --git a/nashorn/make/nbproject/project.xml b/nashorn/make/nbproject/project.xml
index 94d0c14..b39e873 100644
--- a/nashorn/make/nbproject/project.xml
+++ b/nashorn/make/nbproject/project.xml
@@ -2,21 +2,21 @@
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
+
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
-
+
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
-
+
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
+
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
@@ -155,7 +155,7 @@
</view>
<subprojects/>
</general-data>
- <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
<compilation-unit>
<package-root>../test/src</package-root>
<unit-tests/>
diff --git a/nashorn/make/project.properties b/nashorn/make/project.properties
index a6a0b54..4a25880 100644
--- a/nashorn/make/project.properties
+++ b/nashorn/make/project.properties
@@ -1,21 +1,21 @@
#
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
-#
+#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
-#
+#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
+#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
@@ -81,8 +81,8 @@
file.reference.testng.jar=test/lib/testng.jar
# Set testng verbose level
-# From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed)
-# Actually, this is a lie: you can specify -1 and this will put TestNG in
+# From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed)
+# Actually, this is a lie: you can specify -1 and this will put TestNG in
# debug mode (no longer slicing off stack traces and all)."
testng.verbose=2
@@ -134,6 +134,10 @@
test-sys-prop.test262.suite.dir=${test262.suite.dir}
test-sys-prop.es5conform.testcases.dir=${test.external.dir}/ES5Conform/TestCases
test-sys-prop.test.basic.dir=${test.basic.dir}
+test-sys-prop.test.external.dir=${test.external.dir}
+test-sys-prop.test.maptests.dir=${test.maptests.dir}
+test-sys-prop.test.sandbox.dir=${test.sandbox.dir}
+test-sys-prop.test.trusted.dir=${test.trusted.dir}
test-sys-prop-no-security.test.dir=${test.dir}
test-sys-prop-no-security.test.js.roots=${test.nosecurity.dir}
@@ -147,9 +151,11 @@
# turn on/off scripting mode for parser tests
test-sys-prop.parsertest.scripting=true
+test-sys-prop.parserapitest.verbose=false
# turn on/off test262 scripts for parser tests
test-sys-prop.parsertest.test262=false
+test-sys-prop.parserapitest.test262=false
# Control the verbosity of the CompilerTest
test-sys-prop.compilertest.verbose=false
@@ -289,19 +295,19 @@
# Extra jvmargs that might be useful for debugging
# and performance improvements/monitoring
#
-# -XX:+UnlockDiagnosticVMOptions
+# -XX:+UnlockDiagnosticVMOptions
#
# turn off compressed class pointers in metaspace
-# -XX:-UseCompressedKlassPointers
+# -XX:-UseCompressedKlassPointers
#
# dump the heap after every GC
# -XX:+PrintHeapAtGC
#
-# manually set a metaspace size for class data
+# manually set a metaspace size for class data
# -XX:ClassMetaspaceSize=300M
#
# print out methods compiled
-# -XX:+PrintCompilation
+# -XX:+PrintCompilation
#
# print all compiled nmethods with oopmaps and lots of other info
# -XX:+PrintNMethods
@@ -311,7 +317,7 @@
# feature in HotSpot - for example, the uncommon trap placement fix
# was hidden behind this flag before it became the default
#
-# -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode
+# -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode
#
# Crank up the type profile level to 222, which has some warmup
# penalties, but produces much better code for JavaScript, where better
@@ -342,7 +348,7 @@
octane.iterations=25
# List of octane tests to run, as properties prefixed with
-# "octane.benchmark." mapping to the benchmark name in
+# "octane.benchmark." mapping to the benchmark name in
# the test harness
#
# Octane tests that are disabled should have their entire line
diff --git a/nashorn/samples/breakcontinue_in_tryfinally.js b/nashorn/samples/breakcontinue_in_tryfinally.js
new file mode 100644
index 0000000..06c0bce
--- /dev/null
+++ b/nashorn/samples/breakcontinue_in_tryfinally.js
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Find break or continue inside try..finally in all scripts
+// in a given directory (recursively). If no directory is specified
+// the current working directory is scanned for scripts.
+
+if (arguments.length == 0) {
+ arguments[0] = ".";
+}
+
+var File = Java.type("java.io.File");
+var file = new File(arguments[0]);
+if (!file.exists()) {
+ print(arguments[0] + " is neither a directory nor a file");
+ exit(1);
+}
+
+var Files = Java.type("java.nio.file.Files");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+
+var parser = Parser.create("-scripting", "--const-as-var");
+
+function checkFile(file) {
+ // print("checking " + file);
+ var ast = parser.parse(file, print);
+ if (!ast) {
+ return;
+ }
+
+ // locate 'break/continue' inside try..finally
+ ast.accept(visitor = new (Java.extend(SimpleTreeVisitor)) {
+ lineMap: null,
+ inTryFinally: false,
+
+ printWarning: function(node, msg) {
+ var pos = node.startPosition;
+ var line = this.lineMap.getLineNumber(pos);
+ var column = this.lineMap.getColumnNumber(pos);
+ print(msg + " found in " + file + " @ " + line + ":" + column);
+ },
+
+ visitBreak: function(node, extra) {
+ if (this.inTryFinally) {
+ this.printWarning(node, "break");
+ }
+ },
+
+ visitContinue: function(node, extra) {
+ if (this.inTryFinally) {
+ this.printWarning(node, "continue");
+ }
+ },
+
+ visitCompilationUnit: function(node, extra) {
+ this.lineMap = node.lineMap;
+ Java.super(visitor).visitCompilationUnit(node, extra);
+ },
+
+ visitFunctionDeclaration: function(node, extra) {
+ var oldInTryFinally = this.inTryFinally;
+ this.inTryFinally = false;
+ try {
+ Java.super(visitor).visitFunctionDeclaration(node, extra);
+ } finally {
+ this.inTryFinally = oldInTryFinally;
+ }
+ },
+
+ visitFunctionExpression: function(node, extra) {
+ var oldInTryFinally = this.inTryFinally;
+ this.inTryFinally = false;
+ try {
+ Java.super(visitor).visitFunctionExpression(node, extra);
+ } finally {
+ this.inTryFinally = oldInTryFinally;
+ }
+ },
+
+ visitTry: function(node, extra) {
+ var oldInTryFinally = this.inTryFinally;
+ this.inTryFinally = (node.finallyBlock != null);
+ try {
+ Java.super(visitor).visitTry(node, extra);
+ } finally {
+ this.inTryFinally = oldInTryFinally;
+ }
+ }
+ }, null);
+}
+
+
+if (file.isDirectory()) {
+ Files.walk(file.toPath())
+ .filter(function(p) Files.isRegularFile(p))
+ .filter(function(p) p.toFile().name.endsWith('.js'))
+ .forEach(checkFile);
+} else {
+ checkFile(file);
+}
diff --git a/nashorn/samples/cricket.js b/nashorn/samples/cricket.js
new file mode 100644
index 0000000..fdd3198
--- /dev/null
+++ b/nashorn/samples/cricket.js
@@ -0,0 +1,140 @@
+#// Usage: jjs -scripting cricket.js
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Example that demonstrates reading XML Rss feed.
+// XML DOM Document element is wrapped by script
+// "proxy" (JSAdapter constructor)
+
+// Java classes used
+var DocBuilderFac = Java.type("javax.xml.parsers.DocumentBuilderFactory");
+var Node = Java.type("org.w3c.dom.Node");
+
+// constants from Node class
+var ELEMENT_NODE = Node.ELEMENT_NODE;
+var TEXT_NODE = Node.TEXT_NODE;
+
+// parse XML from uri and return Document
+function parseXML(uri) {
+ var docBuilder = DocBuilderFac.newInstance().newDocumentBuilder();
+ return docBuilder["parse(java.lang.String)"](uri);
+}
+
+// get child Elements of given name of the parent element given
+function getChildElements(elem, name) {
+ var nodeList = elem.childNodes;
+ var childElems = [];
+ var len = nodeList.length;
+ for (var i = 0; i < len; i++) {
+ var node = nodeList.item(i);
+ if (node.nodeType == ELEMENT_NODE &&
+ node.tagName == name) {
+ childElems.push(wrapElement(node));
+ }
+ }
+
+ return childElems;
+}
+
+// get concatenated child text content of an Element
+function getElemText(elem) {
+ var nodeList = elem.childNodes;
+ var len = nodeList.length;
+ var text = '';
+ for (var i = 0; i < len; i++) {
+ var node = nodeList.item(i);
+ if (node.nodeType == TEXT_NODE) {
+ text += node.nodeValue;
+ }
+ }
+
+ return text;
+}
+
+// Wrap DOM Element object as a convenient script object
+// using JSAdapter. JSAdapter is like java.lang.reflect.Proxy
+// in that it allows property access, method calls be trapped
+// by 'magic' methods like __get__, __call__.
+function wrapElement(elem) {
+ if (! elem) {
+ return elem;
+ }
+ return new JSAdapter() {
+ // getter to expose child elements and attributes by name
+ __get__: function(name) {
+ if (typeof name == 'string') {
+ if (name.startsWith('@')) {
+ var attr = elem.getAttributeNode(name.substring(1));
+ return !attr? undefined : attr.value;
+ }
+
+ var arr = getChildElements(elem, name);
+ if (arr.length == 1) {
+ // single child element, expose as single element
+ return arr[0];
+ } else {
+ // multiple children of given name, expose as array
+ return arr;
+ }
+ }
+ return undefined;
+ },
+
+ __call__: function(name) {
+ // toString override to get text content of this Element
+ if (name == 'toString' || name == 'valueOf') {
+ return getElemText(elem);
+ }
+ return undefined;
+ }
+ }
+}
+
+function printCricketScore() {
+ var doc = parseXML("http://static.cricinfo.com/rss/livescores.xml");
+ // wrap document root Element as script convenient object
+ var rss = wrapElement(doc.documentElement);
+ print("rss file version " + rss['@version']);
+
+ print(rss.channel.title);
+ print(rss.channel.description);
+ print(rss.channel.pubDate);
+
+ print("=====================");
+
+ var items = rss.channel.item;
+ for each (var i in items) {
+ print(i.description);
+ }
+}
+
+printCricketScore();
diff --git a/nashorn/samples/evalcheck.js b/nashorn/samples/evalcheck.js
new file mode 100644
index 0000000..4e45d0d
--- /dev/null
+++ b/nashorn/samples/evalcheck.js
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+// Simple demo of Nashorn Parser API
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+var IdentifierTree = Java.type("jdk.nashorn.api.tree.IdentifierTree");
+
+var parser = Parser.create();
+var ast = parser.parse("t", "eval('hello');\n eval(2 + 3)", print);
+// locate 'eval' calls in the script
+ast.accept(visitor = new (Java.extend(SimpleTreeVisitor)) {
+ lineMap: null,
+ visitCompilationUnit: function(node, extra) {
+ this.lineMap = node.lineMap;
+ Java.super(visitor).visitCompilationUnit(node, extra);
+ },
+
+ visitFunctionCall: function(node, extra) {
+ var func = node.functionSelect;
+ if (func instanceof IdentifierTree && func.name == "eval") {
+ var pos = node.startPosition;
+ var line = this.lineMap.getLineNumber(pos);
+ var column = this.lineMap.getColumnNumber(pos);
+ print("eval call found @ " + line + ":" + column);
+ }
+ }
+}, null);
diff --git a/nashorn/samples/findproto.js b/nashorn/samples/findproto.js
new file mode 100644
index 0000000..d8b7699
--- /dev/null
+++ b/nashorn/samples/findproto.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// __proto__ magic property is non-standard. Use Object.getPrototypeOf
+// and Object.setPrototypeOf instead. This script finds __proto__
+// usage in scripts a given directory (recursively). If no directory
+// is specified the current working directory is scanned for scripts.
+
+if (arguments.length == 0) {
+ arguments[0] = ".";
+}
+
+var File = Java.type("java.io.File");
+var file = new File(arguments[0]);
+if (!file.exists()) {
+ print(arguments[0] + " is neither a file nor a directory");
+ exit(1);
+}
+
+var Files = Java.type("java.nio.file.Files");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+
+var parser = Parser.create("-scripting", "--const-as-var");
+var protoFound = false;
+
+function checkFile(file) {
+ // print("checking " + file);
+ var ast = parser.parse(file, print);
+ if (!ast) {
+ return;
+ }
+
+ // locate __proto__ usage and warn
+ ast.accept(visitor = new (Java.extend(SimpleTreeVisitor)) {
+ lineMap: null,
+
+ printWarning: function(node) {
+ var pos = node.startPosition;
+ var line = this.lineMap.getLineNumber(pos);
+ var column = this.lineMap.getColumnNumber(pos);
+ print("WARNING: __proto__ usage in " + file + " @ " + line + ":" + column);
+ },
+
+ checkProto: function(node, name) {
+ if (name == "__proto__") {
+ protoFound = true;
+ this.printWarning(node);
+ }
+ },
+
+ visitCompilationUnit: function(node, extra) {
+ this.lineMap = node.lineMap;
+ Java.super(visitor).visitCompilationUnit(node, extra);
+ },
+
+ visitIdentifier: function(node, extra) {
+ this.checkProto(node, node.name);
+ Java.super(visitor).visitIdentifier(node, extra);
+ },
+
+ visitMemberSelect: function(node, extra) {
+ this.checkProto(node, node.identifier);
+ Java.super(visitor).visitMemberSelect(node, extra);
+ },
+
+ visitProperty: function(node, extra) {
+ this.checkProto(node, node.key);
+ Java.super(visitor).visitProperty(node, extra);
+ }
+ }, null);
+}
+
+if (file.isDirectory()) {
+ Files.walk(file.toPath())
+ .filter(function(p) Files.isRegularFile(p))
+ .filter(function(p) p.toFile().name.endsWith('.js'))
+ .forEach(checkFile);
+} else {
+ checkFile(file);
+}
+
+if (protoFound) {
+ print("__proto__ is non-standard. Use Object.get/setPrototypeOf instead");
+}
diff --git a/nashorn/samples/findvardelete.js b/nashorn/samples/findvardelete.js
new file mode 100644
index 0000000..95b67c4
--- /dev/null
+++ b/nashorn/samples/findvardelete.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// delete of scope vars is reported as error in strict mode.
+// This script finds scripts that such deletes. Scripts in
+// the specified directory are scanned. If no directory is
+// specified, the current directory is scanned.
+
+if (arguments.length == 0) {
+ arguments[0] = ".";
+}
+
+var File = Java.type("java.io.File");
+var file = new File(arguments[0]);
+if (!file.exists()) {
+ print(arguments[0] + " is neither a directory nor a file");
+ exit(1);
+}
+
+var Files = Java.type("java.nio.file.Files");
+var IdentifierTree = Java.type("jdk.nashorn.api.tree.IdentifierTree");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+var Tree = Java.type("jdk.nashorn.api.tree.Tree");
+
+var parser = Parser.create("-scripting", "--const-as-var");
+
+function checkFile(file) {
+ // print("checking " + file);
+ var ast = parser.parse(file, print);
+ if (!ast) {
+ return;
+ }
+
+ // locate __proto__ usage and warn
+ ast.accept(visitor = new (Java.extend(SimpleTreeVisitor)) {
+ lineMap: null,
+
+ printWarning: function(node, varName) {
+ var pos = node.startPosition;
+ var line = this.lineMap.getLineNumber(pos);
+ var column = this.lineMap.getColumnNumber(pos);
+ print("WARNING: delete " + varName + " in " + file + " @ " + line + ":" + column);
+ },
+
+ visitCompilationUnit: function(node, extra) {
+ this.lineMap = node.lineMap;
+ Java.super(visitor).visitCompilationUnit(node, extra);
+ },
+
+ visitUnary: function(node, extra) {
+ if (node.kind == Tree.Kind.DELETE &&
+ node.expression instanceof IdentifierTree) {
+ this.printWarning(node, node.expression.name);
+ }
+ Java.super(visitor).visitUnary(node, extra);
+ },
+
+ }, null);
+}
+
+if (file.isDirectory()) {
+ Files.walk(file.toPath())
+ .filter(function(p) Files.isRegularFile(p))
+ .filter(function(p) p.toFile().name.endsWith('.js'))
+ .forEach(checkFile);
+} else {
+ checkFile(file);
+}
diff --git a/nashorn/samples/findwith.js b/nashorn/samples/findwith.js
new file mode 100644
index 0000000..1d82d71
--- /dev/null
+++ b/nashorn/samples/findwith.js
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// 'with' statement is not considered a good practive. In strict mode,
+// with statements result in early error being thrown.
+
+// This script finds 'with' usage in scripts a given directory (recursively).
+// If no directory is specified the current working directory is scanned
+// for scripts.
+
+if (arguments.length == 0) {
+ arguments[0] = ".";
+}
+
+var File = Java.type("java.io.File");
+var file = new File(arguments[0]);
+if (!file.exists()) {
+ print(arguments[0] + " is neither a directory nor a file");
+ exit(1);
+}
+
+var Files = Java.type("java.nio.file.Files");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+
+var parser = Parser.create("-scripting", "--const-as-var");
+var protoFound = false;
+
+function checkFile(file) {
+ // print("checking " + file);
+ var ast = parser.parse(file, print);
+ if (!ast) {
+ return;
+ }
+
+ // locate __proto__ usage and warn
+ ast.accept(visitor = new (Java.extend(SimpleTreeVisitor)) {
+ lineMap: null,
+
+ printWarning: function(node) {
+ var pos = node.startPosition;
+ var line = this.lineMap.getLineNumber(pos);
+ var column = this.lineMap.getColumnNumber(pos);
+ print("WARNING: 'with' usage in " + file + " @ " + line + ":" + column);
+ },
+
+ visitCompilationUnit: function(node, extra) {
+ this.lineMap = node.lineMap;
+ Java.super(visitor).visitCompilationUnit(node, extra);
+ },
+
+ visitWith: function(node, extra) {
+ this.printWarning(node);
+ Java.super(visitor).visitWith(node, extra);
+ }
+ }, null);
+}
+
+if (file.isDirectory()) {
+ Files.walk(file.toPath())
+ .filter(function(p) Files.isRegularFile(p))
+ .filter(function(p) p.toFile().name.endsWith('.js'))
+ .forEach(checkFile);
+} else {
+ checkFile(file);
+}
+
+if (protoFound) {
+ print("__proto__ is non-standard. Use Object.get/setPrototypeOf instead");
+}
diff --git a/nashorn/samples/nashornastviewer.js b/nashorn/samples/nashornastviewer.js
new file mode 100644
index 0000000..d44fcd2
--- /dev/null
+++ b/nashorn/samples/nashornastviewer.js
@@ -0,0 +1,113 @@
+#// Usage: jjs -scripting -fx nashornastviewer.js -- <scriptfile>
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+# NOTE: This script requires JDK 9 build to run
+
+if (!$OPTIONS._fx) {
+ print("Usage: jjs -scripting -fx nashornastviewer.js -- <.js file>");
+ exit(1);
+}
+
+// Using JavaFX from Nashorn. See also:
+// http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/javafx.html
+
+// This example shows AST of a script file as a JavaFX
+// tree view in a window. If no file is specified, AST of
+// this script file is shown. This script demonstrates
+// Nashorn Parser API too - http://openjdk.java.net/jeps/236
+
+// JavaFX classes used
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var Scene = Java.type("javafx.scene.Scene");
+var TreeItem = Java.type("javafx.scene.control.TreeItem");
+var TreeView = Java.type("javafx.scene.control.TreeView");
+
+// Java classes used
+var Enum = Java.type("java.lang.Enum");
+var File = Java.type("java.io.File");
+var List = Java.type("java.util.List");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var Tree = Java.type("jdk.nashorn.api.tree.Tree");
+
+// Create a javafx TreeItem to view a AST node
+function treeItemForASTNode(ast, name) {
+ var item = new TreeItem(name);
+ // make an iteratable script object from a Tree
+ ast = Object.bindProperties({}, ast);
+ for (var prop in ast) {
+ var node = ast[prop];
+ var type = typeof node;
+
+ if (node == null || type == "function") {
+ // skip nulls and Java methods
+ continue;
+ }
+
+ var subitem = null;
+ if (node instanceof Tree) {
+ subitem = treeItemForASTNode(node, prop);
+ } else if (node instanceof List) {
+ var len = node.size();
+ subitem = new TreeItem(prop);
+ for (var i = 0; i < len; i++) {
+ var li = treeItemForASTNode(node.get(i), String(i));
+ subitem.children.add(li);
+ }
+ } else if (node instanceof Enum || type != 'object') {
+ subitem = new TreeItem(prop + ": " + node);
+ }
+
+ if (subitem) {
+ item.children.add(subitem);
+ }
+ }
+ return item;
+}
+
+// do we have a script file passed? if not, use current script
+var sourceName = arguments.length == 0? __FILE__ : arguments[0];
+
+var parser = Parser.create("-scripting");
+// parse script to get CompilationUnitTree of it
+var ast = parser.parse(new File(sourceName), null);
+
+// JavaFX start method
+function start(stage) {
+ stage.title = "AST Viewer";
+ var rootItem = treeItemForASTNode(ast, sourceName);
+ var tree = new TreeView(rootItem);
+ var root = new StackPane();
+ root.children.add(tree);
+ stage.scene = new Scene(root, 300, 450);
+ stage.show();
+}
diff --git a/nashorn/samples/withcheck.js b/nashorn/samples/withcheck.js
new file mode 100644
index 0000000..d74a2e2
--- /dev/null
+++ b/nashorn/samples/withcheck.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+// Simple demo of Nashorn Parser API
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var parser = Parser.create("-strict");
+// you'll get diagnostic message for 'with'
+parser.parse("t", "with({}){}", print);
diff --git a/nashorn/samples/xmlviewer.js b/nashorn/samples/xmlviewer.js
new file mode 100644
index 0000000..45b499f
--- /dev/null
+++ b/nashorn/samples/xmlviewer.js
@@ -0,0 +1,103 @@
+#jjs -fx xmlviewer.js [-- <url-of-xml-doc>]
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+if (! $OPTIONS._fx) {
+ print("Usage: jjs -fx xmlviewer.js [-- <url-of-xml-doc>]");
+ exit(1);
+}
+
+// Using JavaFX from Nashorn. See also:
+// http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/javafx.html
+
+// Simple sample to view a XML document as a JavaFX tree.
+
+// JavaFX classes used
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var Scene = Java.type("javafx.scene.Scene");
+var TreeItem = Java.type("javafx.scene.control.TreeItem");
+var TreeView = Java.type("javafx.scene.control.TreeView");
+
+// XML DocumentBuilderFactory
+var DocBuilderFac = Java.type("javax.xml.parsers.DocumentBuilderFactory");
+var Attr = Java.type("org.w3c.dom.Attr");
+var Element = Java.type("org.w3c.dom.Element");
+var Text = Java.type("org.w3c.dom.Text");
+
+// parse XML from uri and return Document
+function parseXML(uri) {
+ var docBuilder = DocBuilderFac.newInstance().newDocumentBuilder();
+ docBuilder.validating = false;
+ return docBuilder["parse(java.lang.String)"](uri);
+}
+
+// Create a javafx TreeItem to view a XML element
+function treeItemForObject(element, name) {
+ var item = new TreeItem(name);
+ item.expanded = true;
+ var attrs = element.attributes;
+ var numAttrs = attrs.length;
+ for (var a = 0; a < numAttrs; a++) {
+ var attr = attrs.item(a);
+ var subitem = new TreeItem(attr.name + " = " + attr.value);
+ item.children.add(subitem);
+ }
+
+ var childNodes = element.childNodes;
+ var numNodes = childNodes.length;
+ for (var n = 0; n < numNodes; n++) {
+ var node = childNodes.item(n);
+ if (node instanceof Element) {
+ var subitem = treeItemForObject(node, node.tagName);
+ item.children.add(subitem);
+ }
+ }
+
+ return item;
+}
+
+// Ofcourse, the best default URL is cricket score :)
+var DEFAULT_URL = "http://synd.cricbuzz.com/j2me/1.0/livematches.xml";
+
+var url = arguments.length == 0? DEFAULT_URL : arguments[0];
+var element = parseXML(url).getDocumentElement();
+
+// JavaFX start method
+function start(stage) {
+ stage.title = "XML Viewer: " + url;
+ var rootItem = treeItemForObject(element, element.tagName);
+ var tree = new TreeView(rootItem);
+ var root = new StackPane();
+ root.children.add(tree);
+ stage.scene = new Scene(root, 300, 450);
+ stage.show();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/AbstractJSObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/AbstractJSObject.java
index 84fdec8..321a109 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/AbstractJSObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/AbstractJSObject.java
@@ -161,9 +161,8 @@
* @return set of property names
*/
@Override
- @SuppressWarnings("unchecked")
public Set<String> keySet() {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
/**
@@ -172,9 +171,8 @@
* @return set of property values.
*/
@Override
- @SuppressWarnings("unchecked")
public Collection<Object> values() {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
// JavaScript instanceof check
@@ -249,9 +247,27 @@
* Returns this object's numeric value.
*
* @return this object's numeric value.
+ * @deprecated use {@link #getDefaultValue(Class)} with {@link Number} hint instead.
*/
- @Override
+ @Override @Deprecated
public double toNumber() {
return Double.NaN;
}
+
+ /**
+ * When passed an {@link AbstractJSObject}, invokes its {@link #getDefaultValue(Class)} method. When passed any
+ * other {@link JSObject}, it will obtain its {@code [[DefaultValue]]} method as per ECMAScript 5.1 section
+ * 8.6.2.
+ *
+ * @param jsobj the {@link JSObject} whose {@code [[DefaultValue]]} is obtained.
+ * @param hint the type hint. Should be either {@code null}, {@code Number.class} or {@code String.class}.
+ * @return this object's default value.
+ * @throws UnsupportedOperationException if the conversion can't be performed. The engine will convert this
+ * exception into a JavaScript {@code TypeError}.
+ * @deprecated use {@link JSObject#getDefaultValue(Class)} instead.
+ */
+ @Deprecated
+ public static Object getDefaultValue(final JSObject jsobj, final Class<?> hint) {
+ return jsobj.getDefaultValue(hint);
+ }
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java
index aa4a236..cabd137 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java
@@ -813,7 +813,7 @@
}
}
- @Override
+ @Override @Deprecated
public double toNumber() {
return inGlobal(new Callable<Double>() {
@Override public Double call() {
@@ -823,7 +823,7 @@
}
@Override
- public Object getDefaultValue(Class<?> hint) {
+ public Object getDefaultValue(final Class<?> hint) {
return inGlobal(new Callable<Object>() {
@Override public Object call() {
try {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java
new file mode 100644
index 0000000..ff6b84b
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for an array access expression.
+ *
+ * For example:
+ * <pre>
+ * <em>expression</em> [ <em>index</em> ]
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ArrayAccessTree extends ExpressionTree {
+ /**
+ * Returns the array that is accessed.
+ *
+ * @return the array that is accessed
+ */
+ ExpressionTree getExpression();
+
+ /**
+ * Returns the index of the array element accessed.
+ *
+ * @return the index expression
+ */
+ ExpressionTree getIndex();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTreeImpl.java
new file mode 100644
index 0000000..3a68400
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTreeImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.Expression;
+
+final class ArrayAccessTreeImpl extends ExpressionTreeImpl implements ArrayAccessTree {
+
+ private final ExpressionTree base, index;
+
+ ArrayAccessTreeImpl(final Expression node, final ExpressionTree base, final ExpressionTree index) {
+ super(node);
+ this.base = base;
+ this.index = index;
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.ARRAY_ACCESS;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return base;
+ }
+
+ @Override
+ public ExpressionTree getIndex() {
+ return index;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitArrayAccess(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java
new file mode 100644
index 0000000..a4c1182
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * Represents ECMAScript array literal expression.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ArrayLiteralTree extends ExpressionTree {
+ /**
+ * Returns the list of Array element expressions.
+ *
+ * @return array element expressions
+ */
+ public List<? extends ExpressionTree> getElements();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTreeImpl.java
new file mode 100644
index 0000000..1145f3f
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTreeImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.LiteralNode;
+
+final class ArrayLiteralTreeImpl extends ExpressionTreeImpl
+ implements ArrayLiteralTree {
+ private final List<? extends ExpressionTree> elements;
+ ArrayLiteralTreeImpl(final LiteralNode<?> node, final List<? extends ExpressionTree> elements) {
+ super(node);
+ this.elements = elements;
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.ARRAY_LITERAL;
+ }
+
+ @Override
+ public List<? extends ExpressionTree> getElements() {
+ return elements;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitArrayLiteral(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java
new file mode 100644
index 0000000..d09e1cc
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for an assignment expression.
+ *
+ * For example:
+ * <pre>
+ * <em>variable</em> = <em>expression</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface AssignmentTree extends ExpressionTree {
+ /**
+ * Returns the left hand side (LHS) of this assignment.
+ *
+ * @return left hand side (LHS) expression
+ */
+ ExpressionTree getVariable();
+
+ /**
+ * Returns the right hand side (RHS) of this assignment.
+ *
+ * @return right hand side (RHS) expression
+ */
+ ExpressionTree getExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTreeImpl.java
new file mode 100644
index 0000000..e9cc8c8
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTreeImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.BinaryNode;
+
+final class AssignmentTreeImpl extends ExpressionTreeImpl implements AssignmentTree {
+ private final Tree.Kind kind;
+ private final ExpressionTree var, expr;
+
+ AssignmentTreeImpl(final BinaryNode node, final ExpressionTree left, final ExpressionTree right) {
+ super(node);
+ assert node.isAssignment() : "assignment node expected";
+ this.var = left;
+ this.expr = right;
+ this.kind = getOperator(node.tokenType());
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return kind;
+ }
+
+ @Override
+ public ExpressionTree getVariable() {
+ return var;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitAssignment(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java
new file mode 100644
index 0000000..b92afc5
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a binary expression.
+ * Use {@link #getKind getKind} to determine the kind of operator.
+ *
+ * For example:
+ * <pre>
+ * <em>leftOperand</em> <em>operator</em> <em>rightOperand</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface BinaryTree extends ExpressionTree {
+ /**
+ * Returns left hand side (LHS) of this binary expression.
+ *
+ * @return left hand side (LHS) of this binary expression
+ */
+ ExpressionTree getLeftOperand();
+
+ /**
+ * Returns right hand side (RHS) of this binary expression.
+ *
+ * @return right hand side (RHS) of this binary expression
+ */
+ ExpressionTree getRightOperand();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTreeImpl.java
new file mode 100644
index 0000000..3328f9a
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTreeImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.BinaryNode;
+
+class BinaryTreeImpl extends ExpressionTreeImpl implements BinaryTree {
+ private final Tree.Kind kind;
+ private final ExpressionTree left, right;
+
+ BinaryTreeImpl(final BinaryNode node, final ExpressionTree left, final ExpressionTree right) {
+ super(node);
+ assert !node.isAssignment() : "assignment node";
+ this.left = left;
+ this.right = right;
+ this.kind = getOperator(node.tokenType());
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return kind;
+ }
+
+ @Override
+ public ExpressionTree getLeftOperand() {
+ return left;
+ }
+
+ @Override
+ public ExpressionTree getRightOperand() {
+ return right;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitBinary(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java
new file mode 100644
index 0000000..bdb6ed1
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a statement block.
+ *
+ * For example:
+ * <pre>
+ * { }
+ *
+ * { <em>statements</em> }
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface BlockTree extends StatementTree {
+ /**
+ * Returns the list of statements in this block.
+ *
+ * @return the list of statements in this block
+ */
+ List<? extends StatementTree> getStatements();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTreeImpl.java
new file mode 100644
index 0000000..a40432a
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTreeImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.Block;
+import jdk.nashorn.internal.ir.BlockStatement;
+
+final class BlockTreeImpl extends StatementTreeImpl implements BlockTree {
+ private final List<? extends StatementTree> statements;
+
+ BlockTreeImpl(final BlockStatement node, final List<? extends StatementTree> statements) {
+ super(node);
+ this.statements = statements;
+ }
+
+ BlockTreeImpl(final Block node, final List<? extends StatementTree> statements) {
+ super(node);
+ this.statements = statements;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.BLOCK;
+ }
+
+ @Override
+ public List<? extends StatementTree> getStatements() {
+ return statements;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitBlock(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java
new file mode 100644
index 0000000..79450f3
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'break' statement.
+ *
+ * For example:
+ * <pre>
+ * break;
+ *
+ * break <em>label</em> ;
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface BreakTree extends GotoTree {
+ /**
+ * Label associated with this break statement. This is null
+ * if there is no label associated with this break statement.
+ *
+ * @return label associated with this break statement.
+ */
+ @Override
+ String getLabel();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTreeImpl.java
new file mode 100644
index 0000000..2a7e6bc
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTreeImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.BreakNode;
+
+final class BreakTreeImpl extends StatementTreeImpl implements BreakTree {
+ private final String label;
+
+ BreakTreeImpl(final BreakNode node) {
+ super(node);
+ this.label = node.getLabelName();
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.BREAK;
+ }
+
+ @Override
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitBreak(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java
new file mode 100644
index 0000000..a5c2b69
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a 'case' in a 'switch' statement.
+ *
+ * For example:
+ * <pre>
+ * case <em>expression</em> :
+ * <em>statements</em>
+ *
+ * default :
+ * <em>statements</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface CaseTree extends Tree {
+ /**
+ * Case expression of this 'case' statement.
+ *
+ * @return null if and only if this Case is {@code default:}
+ */
+ ExpressionTree getExpression();
+
+ /**
+ * Return the list of statements for this 'case'.
+ *
+ * @return list of statements for this 'case'
+ */
+ List<? extends StatementTree> getStatements();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTreeImpl.java
new file mode 100644
index 0000000..fa59f3e
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTreeImpl.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.CaseNode;
+
+final class CaseTreeImpl extends TreeImpl implements CaseTree {
+ private final ExpressionTree expression;
+ private final List<? extends StatementTree> statements;
+
+ public CaseTreeImpl(final CaseNode node,
+ final ExpressionTree expression,
+ final List<? extends StatementTree> statements) {
+ super(node);
+ this.expression = expression;
+ this.statements = statements;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.CASE;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expression;
+ }
+
+ @Override
+ public List<? extends StatementTree> getStatements() {
+ return statements;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitCase(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java
new file mode 100644
index 0000000..91e0c3e
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'catch' block in a 'try' statement.
+ *
+ * For example:
+ * <pre>
+ * catch ( <em>parameter</em> )
+ * <em>block</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface CatchTree extends Tree {
+ /**
+ * Returns the catch parameter identifier of the exception caught.
+ *
+ * @return the catch parameter identifier
+ */
+ IdentifierTree getParameter();
+
+ /**
+ * Returns the code block of this catch block.
+ *
+ * @return the code block
+ */
+ BlockTree getBlock();
+
+ /**
+ * Returns the optional catch condition expression. This is null
+ * if this is an unconditional catch statement.
+ *
+ * @return the optional catch condition expression.
+ */
+ ExpressionTree getCondition();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTreeImpl.java
new file mode 100644
index 0000000..e10a204
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTreeImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.CatchNode;
+
+final class CatchTreeImpl extends TreeImpl implements CatchTree {
+ private final IdentifierTree param;
+ private final BlockTree block;
+ private final ExpressionTree condition;
+
+ CatchTreeImpl(final CatchNode node,
+ final IdentifierTree param,
+ final BlockTree block,
+ final ExpressionTree condition) {
+ super(node);
+ this.param = param;
+ this.block = block;
+ this.condition = condition;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.CATCH;
+ }
+
+ @Override
+ public IdentifierTree getParameter() {
+ return param;
+ }
+
+ @Override
+ public BlockTree getBlock() {
+ return block;
+ }
+
+ @Override
+ public ExpressionTree getCondition() {
+ return condition;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitCatch(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java
new file mode 100644
index 0000000..60b69ad
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * Represents the abstract syntax tree for compilation units (source
+ * files)
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface CompilationUnitTree extends Tree {
+ /**
+ * Return the list of source elements in this compilation unit.
+ *
+ * @return the list of source elements in this compilation unit
+ */
+ List<? extends Tree> getSourceElements();
+
+ /**
+ * Return the source name of this script compilation unit.
+ *
+ * @return the source name of this script compilation unit
+ */
+ String getSourceName();
+
+ /**
+ * Returns if this is a ECMAScript "strict" compilation unit or not.
+ *
+ * @return true if this compilation unit is declared "strict"
+ */
+ boolean isStrict();
+
+ /**
+ * Returns the line map for this compilation unit, if available.
+ * Returns null if the line map is not available.
+ *
+ * @return the line map for this compilation unit
+ */
+ LineMap getLineMap();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTreeImpl.java
new file mode 100644
index 0000000..5eacb9a
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTreeImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.FunctionNode;
+
+final class CompilationUnitTreeImpl extends TreeImpl
+ implements CompilationUnitTree {
+ private final FunctionNode funcNode;
+ private final List<? extends Tree> elements;
+
+ CompilationUnitTreeImpl(final FunctionNode node,
+ final List<? extends Tree> elements) {
+ super(node);
+ this.funcNode = node;
+ assert funcNode.getKind() == FunctionNode.Kind.SCRIPT : "script function expected";
+ this.elements = elements;
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.COMPILATION_UNIT;
+ }
+
+ @Override
+ public List<? extends Tree> getSourceElements() {
+ return elements;
+ }
+
+ @Override
+ public String getSourceName() {
+ return funcNode.getSourceName();
+ }
+
+ @Override
+ public boolean isStrict() {
+ return funcNode.isStrict();
+ }
+
+ @Override
+ public LineMap getLineMap() {
+ return new LineMapImpl(funcNode.getSource());
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitCompilationUnit(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java
new file mode 100644
index 0000000..228791f
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for compound assignment operator.
+ * Use {@link #getKind getKind} to determine the kind of operator.
+ *
+ * For example:
+ * <pre>
+ * <em>variable</em> <em>operator</em> <em>expression</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface CompoundAssignmentTree extends ExpressionTree {
+ /**
+ * Returns the left hand side (LHS) of this assignment.
+ *
+ * @return left hand side (LHS) expression
+ */
+ ExpressionTree getVariable();
+
+ /**
+ * Returns the right hand side (RHS) of this assignment.
+ *
+ * @return right hand side (RHS) expression
+ */
+ ExpressionTree getExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTreeImpl.java
new file mode 100644
index 0000000..328769d
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTreeImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.BinaryNode;
+
+final class CompoundAssignmentTreeImpl extends ExpressionTreeImpl implements CompoundAssignmentTree {
+
+ private final ExpressionTree var, expr;
+ private final Kind kind;
+
+ CompoundAssignmentTreeImpl(final BinaryNode node, final ExpressionTree left, final ExpressionTree right) {
+ super(node);
+ assert node.isAssignment() : "not an assignment node";
+ this.var = left;
+ this.expr = right;
+ this.kind = getOperator(node.tokenType());
+ assert kind != Tree.Kind.ASSIGNMENT : "compound assignment expected";
+ }
+
+ @Override
+ public Kind getKind() {
+ return kind;
+ }
+
+ @Override
+ public ExpressionTree getVariable() {
+ return var;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitCompoundAssignment(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java
new file mode 100644
index 0000000..55b5b09
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for the conditional operator ? :.
+ *
+ * For example:
+ * <pre>
+ * <em>condition</em> ? <em>trueExpression</em> : <em>falseExpression</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ConditionalExpressionTree extends ExpressionTree {
+ /**
+ * Returns the condition expression of this ternary expression.
+ *
+ * @return the condition expression
+ */
+ ExpressionTree getCondition();
+
+ /**
+ * Returns the true part of this ternary expression.
+ *
+ * @return the 'true' part expression
+ */
+ ExpressionTree getTrueExpression();
+
+ /**
+ * Returns the false part of this ternary expression.
+ *
+ * @return the 'false' part expression
+ */
+ ExpressionTree getFalseExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTreeImpl.java
new file mode 100644
index 0000000..03fbd7e
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTreeImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.TernaryNode;
+
+final class ConditionalExpressionTreeImpl extends ExpressionTreeImpl implements ConditionalExpressionTree {
+ private final ExpressionTree condExpr, trueExpr, falseExpr;
+
+ ConditionalExpressionTreeImpl(final TernaryNode node,
+ final ExpressionTree condExpr, final ExpressionTree trueExpr,
+ final ExpressionTree falseExpr) {
+ super(node);
+ this.condExpr = condExpr;
+ this.trueExpr = trueExpr;
+ this.falseExpr = falseExpr;
+
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.CONDITIONAL_EXPRESSION;
+ }
+
+ @Override
+ public ExpressionTree getCondition() {
+ return condExpr;
+ }
+
+ @Override
+ public ExpressionTree getTrueExpression() {
+ return trueExpr;
+ }
+
+ @Override
+ public ExpressionTree getFalseExpression() {
+ return falseExpr;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitConditionalExpression(this, data);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java
similarity index 61%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java
index d24a6e7..a621571 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,19 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A mixin for conditional "loop" statements.
+ *
+ * @since 1.9
*/
-public class C {
+@jdk.Exported
+public interface ConditionalLoopTree extends LoopTree {
+ /**
+ * Returns the condition expression of this 'loop' statement.
+ *
+ * @return the condition expression
+ */
+ ExpressionTree getCondition();
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java
new file mode 100644
index 0000000..faded12
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'continue' statement.
+ *
+ * For example:
+ * <pre>
+ * continue;
+ * continue <em>label</em> ;
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ContinueTree extends GotoTree {
+ /**
+ * Label associated with this continue statement. This is null
+ * if there is no label associated with this continue statement.
+ *
+ * @return label associated with this continue statement.
+ */
+ @Override
+ String getLabel();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTreeImpl.java
new file mode 100644
index 0000000..add2959
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTreeImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.ContinueNode;
+
+final class ContinueTreeImpl extends StatementTreeImpl implements ContinueTree {
+ private final String label;
+
+ ContinueTreeImpl(final ContinueNode node) {
+ super(node);
+ this.label = node.getLabelName();
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.CONTINUE;
+ }
+
+ @Override
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitContinue(this, data);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java
similarity index 65%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java
index d24a6e7..92beb54 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,18 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A tree node for a 'debugger' statement.
+ *
+ * For example:
+ * <pre>
+ * <em>debugger;</em>
+ * </pre>
+ *
+ * @since 1.9
*/
-public class C {
+@jdk.Exported
+public interface DebuggerTree extends StatementTree {
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTreeImpl.java
new file mode 100644
index 0000000..48edd71
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTreeImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.DebuggerNode;
+
+final class DebuggerTreeImpl extends StatementTreeImpl implements DebuggerTree {
+ DebuggerTreeImpl(final DebuggerNode node) {
+ super(node);
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.DEBUGGER;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitDebugger(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java
new file mode 100644
index 0000000..4fa51b7
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * Interface for diagnostics from tools. A diagnostic usually reports
+ * a problem at a specific position in a source file. However, not
+ * all diagnostics are associated with a position or a file.
+ *
+ * <p>A position is a zero-based character offset from the beginning of
+ * a file. Negative values (except {@link #NOPOS}) are not valid
+ * positions.
+ *
+ * <p>Line and column numbers begin at 1. Negative values (except
+ * {@link #NOPOS}) and 0 are not valid line or column numbers.
+ *
+ * <p>Line terminator is as defined in ECMAScript specification which is one
+ * of { \u000A, \u000B, \u2028, \u2029 }.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface Diagnostic {
+
+ /**
+ * Kinds of diagnostics, for example, error or warning.
+ *
+ * The kind of a diagnostic can be used to determine how the
+ * diagnostic should be presented to the user. For example,
+ * errors might be colored red or prefixed with the word "Error",
+ * while warnings might be colored yellow or prefixed with the
+ * word "Warning". There is no requirement that the Kind
+ * should imply any inherent semantic meaning to the message
+ * of the diagnostic: for example, a tool might provide an
+ * option to report all warnings as errors.
+ */
+ enum Kind {
+ /**
+ * Problem which prevents the tool's normal completion.
+ */
+ ERROR,
+ /**
+ * Problem which does not usually prevent the tool from
+ * completing normally.
+ */
+ WARNING,
+ /**
+ * Problem similar to a warning, but is mandated by the tool's
+ * specification. For example, the Java™ Language
+ * Specification mandates warnings on certain
+ * unchecked operations and the use of deprecated methods.
+ */
+ MANDATORY_WARNING,
+ /**
+ * Informative message from the tool.
+ */
+ NOTE,
+ /**
+ * Diagnostic which does not fit within the other kinds.
+ */
+ OTHER,
+ }
+
+ /**
+ * Used to signal that no position is available.
+ */
+ public final static long NOPOS = -1;
+
+ /**
+ * Gets the kind of this diagnostic, for example, error or
+ * warning.
+ * @return the kind of this diagnostic
+ */
+ Kind getKind();
+
+ /**
+ * Gets a character offset from the beginning of the source object
+ * associated with this diagnostic that indicates the location of
+ * the problem. In addition, the following must be true:
+ *
+ * <p>{@code getStartPostion() <= getPosition()}
+ * <p>{@code getPosition() <= getEndPosition()}
+ *
+ * @return character offset from beginning of source; {@link
+ * #NOPOS} if no location is suitable
+ */
+ long getPosition();
+
+ /**
+ * Gets the source file name.
+ *
+ * @return the file name or null if not available
+ */
+ String getFileName();
+
+ /**
+ * Gets the line number of the character offset returned by
+ * {@linkplain #getPosition()}.
+ *
+ * @return a line number or {@link #NOPOS} if and only if {@link
+ * #getPosition()} returns {@link #NOPOS}
+ */
+ long getLineNumber();
+
+ /**
+ * Gets the column number of the character offset returned by
+ * {@linkplain #getPosition()}.
+ *
+ * @return a column number or {@link #NOPOS} if and only if {@link
+ * #getPosition()} returns {@link #NOPOS}
+ */
+ long getColumnNumber();
+
+ /**
+ * Gets a diagnostic code indicating the type of diagnostic. The
+ * code is implementation-dependent and might be {@code null}.
+ *
+ * @return a diagnostic code
+ */
+ String getCode();
+
+ /**
+ * Gets a message for this diagnostic.
+ *
+ * @return a message
+ */
+ String getMessage();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticImpl.java
new file mode 100644
index 0000000..ee4eadf
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.parser.Token;
+import jdk.nashorn.internal.runtime.ParserException;
+
+final class DiagnosticImpl implements Diagnostic {
+ private final ParserException exp;
+ private final Kind kind;
+
+ DiagnosticImpl(final ParserException exp, final Kind kind) {
+ this.exp = exp;
+ this.kind = kind;
+ }
+
+ @Override
+ public Kind getKind() {
+ return kind;
+ }
+
+ @Override
+ public long getPosition() {
+ return exp.getPosition();
+ }
+
+ @Override
+ public String getFileName() {
+ return exp.getFileName();
+ }
+
+ @Override
+ public long getLineNumber() {
+ return exp.getLineNumber();
+ }
+
+ @Override
+ public long getColumnNumber() {
+ return exp.getColumnNumber();
+ }
+
+ @Override
+ public String getCode() {
+ final long token = exp.getToken();
+ return (token < 0)? null : Token.toString(null, token, true);
+ }
+
+ @Override
+ public String getMessage() {
+ return exp.getMessage();
+ }
+
+ @Override
+ public String toString() {
+ return getMessage();
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java
new file mode 100644
index 0000000..d84fe87
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * Interface for receiving diagnostics from Nashorn parser.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+@FunctionalInterface
+public interface DiagnosticListener {
+ /**
+ * Invoked whenever a parsing problem is found.
+ *
+ * @param diagnostic additional information errors, warnings detected during parsing.
+ */
+ void report(Diagnostic diagnostic);
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java
new file mode 100644
index 0000000..f410cb7a
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'do' statement.
+ *
+ * For example:
+ * <pre>
+ * do
+ * <em>statement</em>
+ * while ( <em>expression</em> );
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface DoWhileLoopTree extends ConditionalLoopTree {
+ /**
+ * Returns the condition expression of this do-while statement.
+ *
+ * @return the condition expression
+ */
+ ExpressionTree getCondition();
+
+ /**
+ * The statement contained within this do-while statement.
+ *
+ * @return the statement
+ */
+ StatementTree getStatement();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTreeImpl.java
new file mode 100644
index 0000000..03e4ef4
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTreeImpl.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.WhileNode;
+
+final class DoWhileLoopTreeImpl extends StatementTreeImpl implements DoWhileLoopTree {
+ private final ExpressionTree cond;
+ private final StatementTree stat;
+
+ DoWhileLoopTreeImpl(final WhileNode node, final ExpressionTree cond, final StatementTree stat) {
+ super(node);
+ assert node.isDoWhile() : "do while expected";
+ this.cond = cond;
+ this.stat = stat;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.DO_WHILE_LOOP;
+ }
+
+ @Override
+ public ExpressionTree getCondition() {
+ return cond;
+ }
+
+ @Override
+ public StatementTree getStatement() {
+ return stat;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitDoWhileLoop(this, data);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java
similarity index 65%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java
index d24a6e7..30667b0 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,17 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A tree node for an empty (skip) statement.
+ *
+ * For example:
+ * <pre>
+ * ;
+ * </pre>
+ *
+ * @since 1.9
*/
-public class C {
-}
+@jdk.Exported
+public interface EmptyStatementTree extends StatementTree {}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTreeImpl.java
new file mode 100644
index 0000000..26a9070
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTreeImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.EmptyNode;
+
+final class EmptyStatementTreeImpl extends StatementTreeImpl implements EmptyStatementTree {
+ EmptyStatementTreeImpl(final EmptyNode node) {
+ super(node);
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.EMPTY_STATEMENT;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitEmptyStatement(this, data);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java
similarity index 67%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java
index d24a6e7..b335bae 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,13 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A tree node to stand in for a malformed expression.
+ *
+ * @since 1.9
*/
-public class C {
+@jdk.Exported
+public interface ErroneousTree extends ExpressionTree {
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTreeImpl.java
new file mode 100644
index 0000000..7cc9d08
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTreeImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.ErrorNode;
+
+final class ErroneousTreeImpl extends ExpressionTreeImpl implements ErroneousTree {
+ ErroneousTreeImpl(final ErrorNode errorNode) {
+ super(errorNode);
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.ERROR;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitErroneous(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java
new file mode 100644
index 0000000..3c07edb
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for an expression statement.
+ *
+ * For example:
+ * <pre>
+ * <em>expression</em> ;
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ExpressionStatementTree extends StatementTree {
+ /**
+ * Returns the expression of this expression statement.
+ *
+ * @return the expression
+ */
+ ExpressionTree getExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTreeImpl.java
new file mode 100644
index 0000000..7e7f516
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTreeImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.ExpressionStatement;
+
+final class ExpressionStatementTreeImpl extends StatementTreeImpl implements ExpressionStatementTree {
+ private final ExpressionTree expr;
+
+ ExpressionStatementTreeImpl(final ExpressionStatement es, final ExpressionTree expr) {
+ super(es);
+ this.expr = expr;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.EXPRESSION_STATEMENT;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitExpressionStatement(this, data);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java
similarity index 67%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java
index d24a6e7..f831855 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,13 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A tree node used as the base class for the different types of
+ * expressions.
+ *
+ * @since 1.9
*/
-public class C {
-}
+@jdk.Exported
+public interface ExpressionTree extends Tree {}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTreeImpl.java
similarity index 65%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTreeImpl.java
index d24a6e7..3024f51 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTreeImpl.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,12 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
-/**
- * Source file for C
- */
-public class C {
+import jdk.nashorn.internal.ir.Expression;
+
+abstract class ExpressionTreeImpl extends TreeImpl implements ExpressionTree {
+ ExpressionTreeImpl(final Expression expr) {
+ super(expr);
+ }
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java
new file mode 100644
index 0000000..a1e1d04
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for for..in statement
+ *
+ * For example:
+ * <pre>
+ * for ( <em>variable</em> in <em>expression</em> )
+ * <em>statement</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ForInLoopTree extends LoopTree {
+ /**
+ * The for..in left hand side expression.
+ *
+ * @return the left hand side expression
+ */
+ ExpressionTree getVariable();
+
+ /**
+ * The object or array being whose properties are iterated.
+ *
+ * @return the object or array expression being iterated
+ */
+ ExpressionTree getExpression();
+
+ /**
+ * The statement contained in this for..in statement.
+ *
+ * @return the statement
+ */
+ StatementTree getStatement();
+
+ /**
+ * Returns if this is a for..each..in statement or not.
+ *
+ * @return true if this is a for..each..in statement
+ */
+ boolean isForEach();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTreeImpl.java
new file mode 100644
index 0000000..eb75302
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTreeImpl.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.ForNode;
+
+final class ForInLoopTreeImpl extends StatementTreeImpl implements ForInLoopTree {
+ private final ExpressionTree lhsExpr;
+ private final ExpressionTree expr;
+ private final StatementTree stat;
+ private final boolean forEach;
+
+ ForInLoopTreeImpl(final ForNode node,
+ final ExpressionTree lhsExpr,
+ final ExpressionTree expr,
+ final StatementTree stat) {
+ super(node);
+ assert node.isForIn() : "for ..in expected";
+ this.lhsExpr = lhsExpr;
+ this.expr = expr;
+ this.stat = stat;
+ this.forEach = node.isForEach();
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.FOR_IN_LOOP;
+ }
+
+ @Override
+ public ExpressionTree getVariable() {
+ return lhsExpr;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public StatementTree getStatement() {
+ return stat;
+ }
+
+ @Override
+ public boolean isForEach() {
+ return forEach;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitForInLoop(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java
new file mode 100644
index 0000000..9d6e538
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a basic 'for' loop statement.
+ *
+ * For example:
+ * <pre>
+ * for ( <em>initializer</em> ; <em>condition</em> ; <em>update</em> )
+ * <em>statement</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ForLoopTree extends ConditionalLoopTree {
+ /**
+ * Returns the initializer expression of this 'for' statement.
+ *
+ * @return the initializer expression
+ */
+ ExpressionTree getInitializer();
+
+ /**
+ * Returns the condition expression of this 'for' statement.
+ *
+ * @return the condition expression
+ */
+ @Override
+ ExpressionTree getCondition();
+
+ /**
+ * Returns the update expression of this 'for' statement.
+ *
+ * @return the update expression
+ */
+ ExpressionTree getUpdate();
+
+ /**
+ * Returns the statement contained in this 'for' statement.
+ *
+ * @return the statement
+ */
+ @Override
+ StatementTree getStatement();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTreeImpl.java
new file mode 100644
index 0000000..5bfcc21
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTreeImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.ForNode;
+
+final class ForLoopTreeImpl extends StatementTreeImpl implements ForLoopTree {
+ private final ExpressionTree init;
+ private final ExpressionTree cond;
+ private final ExpressionTree update;
+ private final StatementTree stat;
+
+ ForLoopTreeImpl(final ForNode node,
+ final ExpressionTree init,
+ final ExpressionTree cond,
+ final ExpressionTree update,
+ final StatementTree stat) {
+ super(node);
+ assert !node.isForIn() : "for statement expected";
+ this.init = init;
+ this.cond = cond;
+ this.update = update;
+ this.stat = stat;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.FOR_LOOP;
+ }
+
+ @Override
+ public ExpressionTree getInitializer() {
+ return init;
+ }
+
+ @Override
+ public ExpressionTree getCondition() {
+ return cond;
+ }
+
+ @Override
+ public ExpressionTree getUpdate() {
+ return update;
+ }
+
+ @Override
+ public StatementTree getStatement() {
+ return stat;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitForLoop(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java
new file mode 100644
index 0000000..8157f13
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a function call expression.
+ *
+ * For example:
+ * <pre>
+ * <em>identifier</em> ( <em>arguments</em> )
+ *
+ * this . <em>identifier</em> ( <em>arguments</em> )
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface FunctionCallTree extends ExpressionTree {
+ /**
+ * Returns the function being called.
+ *
+ * @return the function being called
+ */
+ ExpressionTree getFunctionSelect();
+
+ /**
+ * Returns the list of arguments being passed to this function call.
+ *
+ * @return the list of argument expressions
+ */
+ List<? extends ExpressionTree> getArguments();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTreeImpl.java
new file mode 100644
index 0000000..80f7ee8
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTreeImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.CallNode;
+
+class FunctionCallTreeImpl extends ExpressionTreeImpl implements FunctionCallTree {
+ private final List<? extends ExpressionTree> arguments;
+ private final ExpressionTree function;
+ FunctionCallTreeImpl(final CallNode node,
+ final ExpressionTree function,
+ final List<? extends ExpressionTree> arguments) {
+ super(node);
+ this.function = function;
+ this.arguments = arguments;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.FUNCTION_INVOCATION;
+ }
+
+ @Override
+ public ExpressionTree getFunctionSelect() {
+ return function;
+ }
+
+ @Override
+ public List<? extends ExpressionTree> getArguments() {
+ return arguments;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitFunctionCall(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java
new file mode 100644
index 0000000..df55089
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a function declaration.
+ *
+ * For example:
+ * <pre>
+ * <em>function</em> <em>name</em>
+ * ( <em>parameters</em> )
+ * <em>body</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface FunctionDeclarationTree extends StatementTree {
+ /**
+ * Returns the name of the function being declared.
+ *
+ * @return name the function declared
+ */
+ String getName();
+
+ /**
+ * Returns the parameters of this function.
+ *
+ * @return the list of parameters
+ */
+ List<? extends ExpressionTree> getParameters();
+
+ /**
+ * Returns the body of code of this function.
+ *
+ * @return the body of code
+ */
+ BlockTree getBody();
+
+ /**
+ * Is this a strict function?
+ *
+ * @return true if this function is strict
+ */
+ boolean isStrict();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTreeImpl.java
new file mode 100644
index 0000000..c1ca8c5
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTreeImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.FunctionNode;
+import jdk.nashorn.internal.ir.VarNode;
+
+final class FunctionDeclarationTreeImpl extends StatementTreeImpl
+ implements FunctionDeclarationTree {
+ private final FunctionNode funcNode;
+ private final String funcName;
+ private final List<? extends ExpressionTree> params;
+ private final BlockTree body;
+
+ FunctionDeclarationTreeImpl(final VarNode node,
+ final List<? extends ExpressionTree> params,
+ final BlockTree body) {
+ super(node);
+ assert node.getInit() instanceof FunctionNode : "function expected";
+ funcNode = (FunctionNode)node.getInit();
+ assert funcNode.isDeclared() : "function declaration expected";
+ funcName = node.getName().getName();
+ this.params = params;
+ this.body = body;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.FUNCTION;
+ }
+
+ @Override
+ public String getName() {
+ return funcName;
+ }
+
+ @Override
+ public List<? extends ExpressionTree> getParameters() {
+ return params;
+ }
+
+ @Override
+ public BlockTree getBody() {
+ return body;
+ }
+
+ @Override
+ public boolean isStrict() {
+ return funcNode.isStrict();
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitFunctionDeclaration(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java
new file mode 100644
index 0000000..40b4053
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a function expression.
+ *
+ * For example:
+ * <pre>
+ * <em>var</em> func = <em>function</em>
+ * ( <em>parameters</em> )
+ * <em>body</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface FunctionExpressionTree extends ExpressionTree {
+ /**
+ * Returns the name of the function being declared.
+ *
+ * @return name the function declared
+ */
+ String getName();
+
+ /**
+ * Returns the parameters of this function.
+ *
+ * @return the list of parameters
+ */
+ List<? extends ExpressionTree> getParameters();
+
+ /**
+ * Returns the body of code of this function.
+ *
+ * @return the body of code
+ */
+ BlockTree getBody();
+
+ /**
+ * Is this a strict function?
+ *
+ * @return true if this function is strict
+ */
+ boolean isStrict();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTreeImpl.java
new file mode 100644
index 0000000..e2ab356
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTreeImpl.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.FunctionNode;
+
+final class FunctionExpressionTreeImpl extends ExpressionTreeImpl
+ implements FunctionExpressionTree {
+ private final FunctionNode funcNode;
+ private final String funcName;
+ private final List<? extends ExpressionTree> params;
+ private final BlockTree body;
+
+ FunctionExpressionTreeImpl(final FunctionNode node,
+ final List<? extends ExpressionTree> params,
+ final BlockTree body) {
+ super(node);
+ funcNode = node;
+ assert !funcNode.isDeclared() : "function expression expected";
+
+ final FunctionNode.Kind kind = node.getKind();
+ if (node.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) {
+ funcName = null;
+ } else {
+ funcName = node.getIdent().getName();
+ }
+
+ this.params = params;
+ this.body = body;
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.FUNCTION_EXPRESSION;
+ }
+
+ @Override
+ public String getName() {
+ return funcName;
+ }
+
+ @Override
+ public List<? extends ExpressionTree> getParameters() {
+ return params;
+ }
+
+ @Override
+ public BlockTree getBody() {
+ return body;
+ }
+
+ @Override
+ public boolean isStrict() {
+ return funcNode.isStrict();
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitFunctionExpression(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java
new file mode 100644
index 0000000..fb0517e
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a statement that jumps to a target. Note that
+ * ECMAScript does not support a goto statement. But, this Tree
+ * type serves as a super interface for {@link BreakTree} and
+ * {@link ContinueTree}.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface GotoTree extends StatementTree {
+ /**
+ * Label associated with this goto statement. This is null
+ * if there is no label associated with this goto statement.
+ *
+ * @return label associated with this goto statement.
+ */
+ String getLabel();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java
new file mode 100644
index 0000000..f923cc8
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java
@@ -0,0 +1,517 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.api.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+import jdk.nashorn.internal.ir.AccessNode;
+import jdk.nashorn.internal.ir.BinaryNode;
+import jdk.nashorn.internal.ir.Block;
+import jdk.nashorn.internal.ir.BlockStatement;
+import jdk.nashorn.internal.ir.BreakNode;
+import jdk.nashorn.internal.ir.CallNode;
+import jdk.nashorn.internal.ir.CaseNode;
+import jdk.nashorn.internal.ir.CatchNode;
+import jdk.nashorn.internal.ir.ContinueNode;
+import jdk.nashorn.internal.ir.DebuggerNode;
+import jdk.nashorn.internal.ir.EmptyNode;
+import jdk.nashorn.internal.ir.ErrorNode;
+import jdk.nashorn.internal.ir.Expression;
+import jdk.nashorn.internal.ir.ExpressionStatement;
+import jdk.nashorn.internal.ir.ForNode;
+import jdk.nashorn.internal.ir.FunctionNode;
+import jdk.nashorn.internal.ir.IdentNode;
+import jdk.nashorn.internal.ir.IfNode;
+import jdk.nashorn.internal.ir.IndexNode;
+import jdk.nashorn.internal.ir.LabelNode;
+import jdk.nashorn.internal.ir.LexicalContext;
+import jdk.nashorn.internal.ir.LiteralNode;
+import jdk.nashorn.internal.ir.Node;
+import jdk.nashorn.internal.ir.ObjectNode;
+import jdk.nashorn.internal.ir.PropertyNode;
+import jdk.nashorn.internal.ir.ReturnNode;
+import jdk.nashorn.internal.ir.RuntimeNode;
+import jdk.nashorn.internal.ir.SplitNode;
+import jdk.nashorn.internal.ir.Statement;
+import jdk.nashorn.internal.ir.SwitchNode;
+import jdk.nashorn.internal.ir.TernaryNode;
+import jdk.nashorn.internal.ir.ThrowNode;
+import jdk.nashorn.internal.ir.TryNode;
+import jdk.nashorn.internal.ir.UnaryNode;
+import jdk.nashorn.internal.ir.VarNode;
+import jdk.nashorn.internal.ir.WhileNode;
+import jdk.nashorn.internal.ir.WithNode;
+import jdk.nashorn.internal.ir.visitor.NodeVisitor;
+import jdk.nashorn.internal.parser.Lexer;
+import jdk.nashorn.internal.parser.TokenType;
+
+/**
+ * This class translates from nashorn IR Node objects
+ * to nashorn parser API Tree objects.
+ */
+final class IRTranslator extends NodeVisitor<LexicalContext> {
+
+ public IRTranslator() {
+ super(new LexicalContext());
+ }
+
+ // currently translated Statement
+ private StatementTreeImpl curStat;
+ // currently translated Expression
+ private ExpressionTreeImpl curExpr;
+
+ // entry point for translator
+ CompilationUnitTree translate(final FunctionNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ assert (node.getKind() == FunctionNode.Kind.SCRIPT) : "script function expected";
+
+ final Block body = node.getBody();
+ return new CompilationUnitTreeImpl(node,
+ translateStats(body != null? body.getStatements() : null));
+ }
+
+ @Override
+ public boolean enterAccessNode(final AccessNode accessNode) {
+ curExpr = new MemberSelectTreeImpl(accessNode, translateExpr(accessNode.getBase()));
+ return false;
+ }
+
+ @Override
+ public boolean enterBlock(final Block block) {
+ // FIXME: revisit this!
+ if (block.isSynthetic()) {
+ final int statCount = block.getStatementCount();
+ switch (statCount) {
+ case 0: {
+ final EmptyNode emptyNode = new EmptyNode(-1, block.getToken(), block.getFinish());
+ curStat = new EmptyStatementTreeImpl(emptyNode);
+ return false;
+ }
+ case 1: {
+ curStat = translateStat(block.getStatements().get(0));
+ return false;
+ }
+ }
+ }
+
+ curStat = new BlockTreeImpl(block,
+ translateStats(block.getStatements()));
+ return false;
+ }
+
+ @Override
+ public boolean enterBinaryNode(final BinaryNode binaryNode) {
+ if (binaryNode.isAssignment()) {
+ final ExpressionTree srcTree = translateExpr(binaryNode.getAssignmentSource());
+ final ExpressionTree destTree = translateExpr(binaryNode.getAssignmentDest());
+
+ if (binaryNode.tokenType() == TokenType.ASSIGN) {
+ curExpr = new AssignmentTreeImpl(binaryNode, destTree, srcTree);
+ } else {
+ curExpr = new CompoundAssignmentTreeImpl(binaryNode, destTree, srcTree);
+ }
+ } else {
+ final ExpressionTree leftTree = translateExpr(binaryNode.lhs());
+ final ExpressionTree rightTree = translateExpr(binaryNode.rhs());
+
+ if (binaryNode.tokenType() == TokenType.INSTANCEOF) {
+ curExpr = new InstanceOfTreeImpl(binaryNode, leftTree, rightTree);
+ } else {
+ curExpr = new BinaryTreeImpl(binaryNode, leftTree, rightTree);
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean enterBreakNode(final BreakNode breakNode) {
+ curStat = new BreakTreeImpl(breakNode);
+ return false;
+ }
+
+ @Override
+ public boolean enterCallNode(final CallNode callNode) {
+ curExpr = null;
+ callNode.getFunction().accept(this);
+ final ExpressionTree funcTree = curExpr;
+ final List<? extends ExpressionTree> argTrees = translateExprs(callNode.getArgs());
+ curExpr = new FunctionCallTreeImpl(callNode, funcTree, argTrees);
+ return false;
+ }
+
+ @Override
+ public boolean enterCaseNode(final CaseNode caseNode) {
+ assert false : "should not reach here!";
+ return false;
+ }
+
+ @Override
+ public boolean enterCatchNode(final CatchNode catchNode) {
+ assert false : "should not reach here";
+ return false;
+ }
+
+ @Override
+ public boolean enterContinueNode(final ContinueNode continueNode) {
+ curStat = new ContinueTreeImpl(continueNode);
+ return false;
+ }
+
+ @Override
+ public boolean enterDebuggerNode(final DebuggerNode debuggerNode) {
+ curStat = new DebuggerTreeImpl(debuggerNode);
+ return false;
+ }
+
+ @Override
+ public boolean enterEmptyNode(final EmptyNode emptyNode) {
+ curStat = new EmptyStatementTreeImpl(emptyNode);
+ return false;
+ }
+
+ @Override
+ public boolean enterErrorNode(final ErrorNode errorNode) {
+ curExpr = new ErroneousTreeImpl(errorNode);
+ return false;
+ }
+
+ @Override
+ public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
+ curStat = new ExpressionStatementTreeImpl(expressionStatement,
+ translateExpr(expressionStatement.getExpression()));
+ return false;
+ }
+
+ @Override
+ public boolean enterBlockStatement(final BlockStatement blockStatement) {
+ final Block block = blockStatement.getBlock();
+ if (blockStatement.isSynthetic()) {
+ assert block != null && block.getStatements() != null && block.getStatements().size() == 1;
+ curStat = translateStat(block.getStatements().get(0));
+ } else {
+ curStat = new BlockTreeImpl(blockStatement,
+ translateStats(block != null? block.getStatements() : null));
+ }
+ return false;
+ }
+
+ @Override
+ public boolean enterForNode(final ForNode forNode) {
+ if (forNode.isForIn()) {
+ curStat = new ForInLoopTreeImpl(forNode,
+ translateExpr(forNode.getInit()),
+ translateExpr(forNode.getModify()),
+ translateBlock(forNode.getBody()));
+ } else {
+ curStat = new ForLoopTreeImpl(forNode,
+ translateExpr(forNode.getInit()),
+ translateExpr(forNode.getTest()),
+ translateExpr(forNode.getModify()),
+ translateBlock(forNode.getBody()));
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean enterFunctionNode(final FunctionNode functionNode) {
+ assert !functionNode.isDeclared() : "should not reach here for function declaration";
+
+ final List<? extends ExpressionTree> paramTrees
+ = translateExprs(functionNode.getParameters());
+ final BlockTree blockTree = (BlockTree) translateBlock(functionNode.getBody());
+ curExpr = new FunctionExpressionTreeImpl(functionNode, paramTrees, blockTree);
+
+ return false;
+ }
+
+ @Override
+ public boolean enterIdentNode(final IdentNode identNode) {
+ curExpr = new IdentifierTreeImpl(identNode);
+ return false;
+ }
+
+ @Override
+ public boolean enterIfNode(final IfNode ifNode) {
+ curStat = new IfTreeImpl(ifNode,
+ translateExpr(ifNode.getTest()),
+ translateBlock(ifNode.getPass()),
+ translateBlock(ifNode.getFail()));
+ return false;
+ }
+
+ @Override
+ public boolean enterIndexNode(final IndexNode indexNode) {
+ curExpr = new ArrayAccessTreeImpl(indexNode,
+ translateExpr(indexNode.getBase()),
+ translateExpr(indexNode.getIndex()));
+ return false;
+ }
+
+ @Override
+ public boolean enterLabelNode(final LabelNode labelNode) {
+ curStat = new LabeledStatementTreeImpl(labelNode,
+ translateBlock(labelNode.getBody()));
+ return false;
+ }
+
+ @Override
+ public boolean enterLiteralNode(final LiteralNode<?> literalNode) {
+ final Object value = literalNode.getValue();
+ if (value instanceof Lexer.RegexToken) {
+ curExpr = new RegExpLiteralTreeImpl(literalNode);
+ } else if (literalNode.isArray()) {
+ final List<Expression> exprNodes = literalNode.getElementExpressions();
+ final List<ExpressionTreeImpl> exprTrees = new ArrayList<>(exprNodes.size());
+ for (final Node node : exprNodes) {
+ if (node == null) {
+ exprTrees.add(null);
+ } else {
+ curExpr = null;
+ node.accept(this);
+ assert curExpr != null : "null for " + node;
+ exprTrees.add(curExpr);
+ }
+ }
+ curExpr = new ArrayLiteralTreeImpl(literalNode, exprTrees);
+ } else {
+ curExpr = new LiteralTreeImpl(literalNode);
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean enterObjectNode(final ObjectNode objectNode) {
+ final List<PropertyNode> propNodes = objectNode.getElements();
+ final List<PropertyTreeImpl> propTrees = new ArrayList<>(propNodes.size());
+ for (final PropertyNode propNode : propNodes) {
+ propTrees.add(new PropertyTreeImpl(propNode,
+ translateExpr(propNode.getKey()),
+ translateExpr(propNode.getValue()),
+ (FunctionExpressionTree) translateExpr(propNode.getGetter()),
+ (FunctionExpressionTree) translateExpr(propNode.getSetter())));
+ }
+ curExpr = new ObjectLiteralTreeImpl(objectNode, propTrees);
+ return false;
+ }
+
+ @Override
+ public boolean enterPropertyNode(final PropertyNode propertyNode) {
+ assert false : "should not reach here!";
+ return false;
+ }
+
+ @Override
+ public boolean enterReturnNode(final ReturnNode returnNode) {
+ curStat = new ReturnTreeImpl(returnNode,
+ translateExpr(returnNode.getExpression()));
+ return false;
+ }
+
+ @Override
+ public boolean enterRuntimeNode(final RuntimeNode runtimeNode) {
+ assert false : "should not reach here: RuntimeNode";
+ return false;
+ }
+
+ @Override
+ public boolean enterSplitNode(final SplitNode splitNode) {
+ assert false : "should not reach here!";
+ return false;
+ }
+
+ @Override
+ public boolean enterSwitchNode(final SwitchNode switchNode) {
+ final List<CaseNode> caseNodes = switchNode.getCases();
+ final List<CaseTreeImpl> caseTrees = new ArrayList<>(caseNodes.size());
+ for (final CaseNode caseNode : caseNodes) {
+ final Block body = caseNode.getBody();
+ caseTrees.add(
+ new CaseTreeImpl(caseNode,
+ translateExpr(caseNode.getTest()),
+ translateStats(body != null? body.getStatements() : null)));
+ }
+
+ curStat = new SwitchTreeImpl(switchNode,
+ translateExpr(switchNode.getExpression()),
+ caseTrees);
+ return false;
+ }
+
+ @Override
+ public boolean enterTernaryNode(final TernaryNode ternaryNode) {
+ curExpr = new ConditionalExpressionTreeImpl(ternaryNode,
+ translateExpr(ternaryNode.getTest()),
+ translateExpr(ternaryNode.getTrueExpression()),
+ translateExpr(ternaryNode.getFalseExpression()));
+ return false;
+ }
+
+ @Override
+ public boolean enterThrowNode(final ThrowNode throwNode) {
+ curStat = new ThrowTreeImpl(throwNode,
+ translateExpr(throwNode.getExpression()));
+ return false;
+ }
+
+ @Override
+ public boolean enterTryNode(final TryNode tryNode) {
+ final List<? extends CatchNode> catchNodes = tryNode.getCatches();
+ final List<CatchTreeImpl> catchTrees = new ArrayList<>(catchNodes.size());
+ for (final CatchNode catchNode : catchNodes) {
+ catchTrees.add(new CatchTreeImpl(catchNode,
+ translateIdent(catchNode.getException()),
+ (BlockTree) translateBlock(catchNode.getBody()),
+ translateExpr(catchNode.getExceptionCondition())));
+ }
+
+ curStat = new TryTreeImpl(tryNode,
+ (BlockTree) translateBlock(tryNode.getBody()),
+ catchTrees,
+ (BlockTree) translateBlock(tryNode.getFinallyBody()));
+
+ return false;
+ }
+
+ @Override
+ public boolean enterUnaryNode(final UnaryNode unaryNode) {
+ if (unaryNode.tokenType() == TokenType.NEW) {
+ curExpr = new NewTreeImpl(unaryNode,
+ translateExpr(unaryNode.getExpression()));
+ } else {
+ curExpr = new UnaryTreeImpl(unaryNode,
+ translateExpr(unaryNode.getExpression()));
+ }
+ return false;
+ }
+
+ @Override
+ public boolean enterVarNode(final VarNode varNode) {
+ final Expression initNode = varNode.getInit();
+ if (initNode instanceof FunctionNode && ((FunctionNode)initNode).isDeclared()) {
+ final FunctionNode funcNode = (FunctionNode) initNode;
+
+ final List<? extends ExpressionTree> paramTrees
+ = translateExprs(funcNode.getParameters());
+ final BlockTree blockTree = (BlockTree) translateBlock(funcNode.getBody());
+ curStat = new FunctionDeclarationTreeImpl(varNode, paramTrees, blockTree);
+ } else {
+ curStat = new VariableTreeImpl(varNode, translateExpr(initNode));
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean enterWhileNode(final WhileNode whileNode) {
+ final ExpressionTree condTree = translateExpr(whileNode.getTest());
+ final StatementTree statTree = translateBlock(whileNode.getBody());
+
+ if (whileNode.isDoWhile()) {
+ curStat = new DoWhileLoopTreeImpl(whileNode, condTree, statTree);
+ } else {
+ curStat = new WhileLoopTreeImpl(whileNode, condTree, statTree);
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean enterWithNode(final WithNode withNode) {
+ curStat = new WithTreeImpl(withNode,
+ translateExpr(withNode.getExpression()),
+ translateBlock(withNode.getBody()));
+
+ return false;
+ }
+
+ private StatementTree translateBlock(final Block blockNode) {
+ if (blockNode == null) {
+ return null;
+ }
+ curStat = null;
+ blockNode.accept(this);
+ return curStat;
+ }
+
+ private List<? extends StatementTree> translateStats(final List<? extends Statement> stats) {
+ if (stats == null) {
+ return null;
+ }
+ final List<StatementTreeImpl> statTrees = new ArrayList<>(stats.size());
+ for (final Statement stat : stats) {
+ curStat = null;
+ stat.accept(this);
+ assert curStat != null;
+ statTrees.add(curStat);
+ }
+ return statTrees;
+ }
+
+ private List<? extends ExpressionTree> translateExprs(final List<? extends Expression> exprs) {
+ if (exprs == null) {
+ return null;
+ }
+ final List<ExpressionTreeImpl> exprTrees = new ArrayList<>(exprs.size());
+ for (final Expression expr : exprs) {
+ curExpr = null;
+ expr.accept(this);
+ assert curExpr != null;
+ exprTrees.add(curExpr);
+ }
+ return exprTrees;
+ }
+
+ private ExpressionTreeImpl translateExpr(final Expression expr) {
+ if (expr == null) {
+ return null;
+ }
+
+ curExpr = null;
+ expr.accept(this);
+ assert curExpr != null : "null for " + expr;
+ return curExpr;
+ }
+
+ private StatementTreeImpl translateStat(final Statement stat) {
+ if (stat == null) {
+ return null;
+ }
+
+ curStat = null;
+ stat.accept(this);
+ assert curStat != null : "null for " + stat;
+ return curStat;
+ }
+
+ private IdentifierTree translateIdent(final IdentNode ident) {
+ return new IdentifierTreeImpl(ident);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java
similarity index 60%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java
index d24a6e7..03035b6 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,24 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A tree node for an identifier expression.
+ *
+ * For example:
+ * <pre>
+ * <em>name</em>
+ * </pre>
+ *
+ * @since 1.9
*/
-public class C {
+@jdk.Exported
+public interface IdentifierTree extends ExpressionTree {
+ /**
+ * Returns the name of this identifier.
+ *
+ * @return the name of this identifier
+ */
+ String getName();
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTreeImpl.java
new file mode 100644
index 0000000..a13a364
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTreeImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.IdentNode;
+
+final class IdentifierTreeImpl extends ExpressionTreeImpl implements IdentifierTree {
+ private final String name;
+
+ IdentifierTreeImpl(final IdentNode node) {
+ super(node);
+ this.name = node.getName();
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.IDENTIFIER;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitIdentifier(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java
new file mode 100644
index 0000000..fe98193
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for an 'if' statement.
+ *
+ * For example:
+ * <pre>
+ * if ( <em>condition</em> )
+ * <em>thenStatement</em>
+ *
+ * if ( <em>condition</em> )
+ * <em>thenStatement</em>
+ * else
+ * <em>elseStatement</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface IfTree extends StatementTree {
+ /**
+ * Returns the condition expression of this 'if' statement.
+ *
+ * @return the condition expression
+ */
+ ExpressionTree getCondition();
+
+ /**
+ * Returns the 'then' statement of this 'if' statement.
+ *
+ * @return the 'then' statement
+ */
+ StatementTree getThenStatement();
+
+ /**
+ * Returns the then statement of this 'if' statement.
+ * null if this if statement has no else branch.
+ *
+ * @return the 'else' statement
+ */
+ StatementTree getElseStatement();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTreeImpl.java
new file mode 100644
index 0000000..52d0524
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTreeImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.IfNode;
+
+final class IfTreeImpl extends StatementTreeImpl implements IfTree {
+ private final ExpressionTree cond;
+ private final StatementTree thenStat;
+ private final StatementTree elseStat;
+ IfTreeImpl(final IfNode node, final ExpressionTree cond,
+ final StatementTree thenStat, final StatementTree elseStat) {
+ super(node);
+ this.cond = cond;
+ this.thenStat = thenStat;
+ this.elseStat = elseStat;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.IF;
+ }
+
+ @Override
+ public ExpressionTree getCondition() {
+ return cond;
+ }
+
+ @Override
+ public StatementTree getThenStatement() {
+ return thenStat;
+ }
+
+ /**
+ * @return null if this if statement has no else branch.
+ */
+ @Override
+ public StatementTree getElseStatement() {
+ return elseStat;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitIf(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java
new file mode 100644
index 0000000..f1b36f9
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for an 'instanceof' expression.
+ *
+ * For example:
+ * <pre>
+ * <em>expression</em> instanceof <em>type</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface InstanceOfTree extends ExpressionTree {
+ /**
+ * Returns the expression whose type is being checked.
+ *
+ * @return the expression whose type is being checked
+ */
+ ExpressionTree getExpression();
+
+ /**
+ * Returns the type expression.
+ *
+ * @return the type expression
+ */
+ Tree getType();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTreeImpl.java
new file mode 100644
index 0000000..6898282
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTreeImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.BinaryNode;
+import jdk.nashorn.internal.parser.TokenType;
+
+final class InstanceOfTreeImpl extends BinaryTreeImpl implements InstanceOfTree {
+ InstanceOfTreeImpl(final BinaryNode node,
+ final ExpressionTree expr,
+ final ExpressionTree type) {
+ super(node, expr, type);
+ assert node.tokenType() == TokenType.INSTANCEOF : "instanceof expected";
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.INSTANCE_OF;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return getLeftOperand();
+ }
+
+ @Override
+ public Tree getType() {
+ return getRightOperand();
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitInstanceOf(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java
new file mode 100644
index 0000000..893fafd
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a labeled statement.
+ *
+ * For example:
+ * <pre>
+ * <em>label</em> : <em>statement</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface LabeledStatementTree extends StatementTree {
+ /**
+ * Returns the label associated with this statement.
+ *
+ * @return the label
+ */
+ String getLabel();
+
+ /**
+ * Returns the statement being labeled.
+ *
+ * @return the statement labeled
+ */
+ StatementTree getStatement();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTreeImpl.java
new file mode 100644
index 0000000..ffbdfd7
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTreeImpl.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.LabelNode;
+
+final class LabeledStatementTreeImpl extends StatementTreeImpl
+ implements LabeledStatementTree {
+ private final String name;
+ private final StatementTree stat;
+
+ LabeledStatementTreeImpl(final LabelNode node, final StatementTree stat) {
+ super(node);
+ this.name = node.getLabelName();
+ this.stat = stat;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.LABELED_STATEMENT;
+ }
+
+ @Override
+ public String getLabel() {
+ return name;
+ }
+
+ @Override
+ public StatementTree getStatement() {
+ return stat;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitLabeledStatement(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java
new file mode 100644
index 0000000..f65d39d
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * Provides methods to convert between character positions and line numbers
+ * for a compilation unit.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface LineMap {
+ /**
+ * Find the line containing a position; a line termination
+ * character is on the line it terminates.
+ *
+ * @param pos character offset of the position
+ * @return the line number of pos (first line is 1)
+ */
+ long getLineNumber(long pos);
+
+ /**
+ * Find the column for a character position.
+ * Tab characters preceding the position on the same line
+ * will be expanded when calculating the column number.
+ *
+ * @param pos character offset of the position
+ * @return the tab-expanded column number of pos (first column is 1)
+ */
+ long getColumnNumber(long pos);
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMapImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMapImpl.java
new file mode 100644
index 0000000..5ddc6de
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMapImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.runtime.Source;
+
+final class LineMapImpl implements LineMap {
+ private final Source source;
+
+ LineMapImpl(final Source source) {
+ this.source = source;
+ }
+
+ @Override
+ public long getLineNumber(long pos) {
+ return source.getLine((int)pos);
+ }
+
+ @Override
+ public long getColumnNumber(long pos) {
+ return source.getColumn((int)pos);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java
new file mode 100644
index 0000000..4bae2d1
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a literal expression.
+ * Use {@link #getKind getKind} to determine the kind of literal.
+ *
+ * For example:
+ * <pre>
+ * <em>value</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface LiteralTree extends ExpressionTree {
+ /**
+ * Returns the value of this literal.
+ *
+ * @return the value of this literal
+ */
+ Object getValue();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTreeImpl.java
new file mode 100644
index 0000000..c08a236
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTreeImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.LiteralNode;
+
+final class LiteralTreeImpl extends ExpressionTreeImpl implements LiteralTree {
+ private final Object value;
+ private final Kind kind;
+ LiteralTreeImpl(final LiteralNode<?> node) {
+ super(node);
+ this.kind = literalKind(node);
+ this.value = node.getValue();
+ }
+
+ @Override
+ public Kind getKind() {
+ return kind;
+ }
+
+ @Override
+ public Object getValue() {
+ return value;
+ }
+
+ private static Kind literalKind(final LiteralNode<?> node) {
+ if (node.isBoolean()) {
+ return Kind.BOOLEAN_LITERAL;
+ } else if (node.isNumeric()) {
+ return Kind.NUMBER_LITERAL;
+ } else if (node.isString()) {
+ return Kind.STRING_LITERAL;
+ } else if (node.isNull()) {
+ return Kind.NULL_LITERAL;
+ } else {
+ throw new AssertionError("should not reach here: " + node.getValue());
+ }
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitLiteral(this, data);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java
similarity index 62%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java
index d24a6e7..4d2ca02 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,19 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A mixin for "loop" statements.
+ *
+ * @since 1.9
*/
-public class C {
+@jdk.Exported
+public interface LoopTree extends StatementTree {
+ /**
+ * Returns the statement contained in this 'loop' statement.
+ *
+ * @return the statement
+ */
+ StatementTree getStatement();
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java
new file mode 100644
index 0000000..d34214e
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a member access expression.
+ *
+ * For example:
+ * <pre>
+ * <em>expression</em> . <em>identifier</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface MemberSelectTree extends ExpressionTree {
+ /**
+ * The object expression whose member is being selected.
+ *
+ * @return the object whose member is selected
+ */
+ ExpressionTree getExpression();
+
+ /**
+ * Returns the name of the property.
+ *
+ * @return the name of the property
+ */
+ String getIdentifier();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTreeImpl.java
new file mode 100644
index 0000000..0dca2c1
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTreeImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.AccessNode;
+
+final class MemberSelectTreeImpl extends ExpressionTreeImpl
+ implements MemberSelectTree {
+ private final String ident;
+ private final ExpressionTree expr;
+ MemberSelectTreeImpl(final AccessNode node, final ExpressionTree expr) {
+ super(node);
+ this.ident = node.getProperty();
+ this.expr = expr;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.MEMBER_SELECT;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public String getIdentifier() {
+ return ident;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitMemberSelect(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java
new file mode 100644
index 0000000..59c536d
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node to declare a new instance of a class.
+ *
+ * For example:
+ * <pre>
+ * new <em>identifier</em> ( )
+ *
+ * new <em>identifier</em> ( <em>arguments</em> )
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface NewTree extends ExpressionTree {
+ /**
+ * Returns the constructor expression of this 'new' expression.
+ *
+ * @return the constructor expression of this 'new' expression
+ */
+ ExpressionTree getConstructorExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTreeImpl.java
new file mode 100644
index 0000000..aa02d18
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTreeImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.UnaryNode;
+import jdk.nashorn.internal.parser.TokenType;
+
+final class NewTreeImpl extends ExpressionTreeImpl implements NewTree {
+ private final ExpressionTree constrExpr;
+
+ NewTreeImpl(final UnaryNode node, final ExpressionTree constrExpr) {
+ super(node);
+ assert (node.tokenType() == TokenType.NEW) : "new expected";
+ this.constrExpr = constrExpr;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.NEW;
+ }
+
+ @Override
+ public ExpressionTree getConstructorExpression() {
+ return constrExpr;
+ }
+
+ @Override
+ public <R, D> R accept(TreeVisitor<R, D> visitor, D data) {
+ return visitor.visitNew(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java
new file mode 100644
index 0000000..7639935
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * Represents ECMAScript object literal expression.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ObjectLiteralTree extends ExpressionTree {
+ /**
+ * Returns the list of properties of this object literal.
+ *
+ * @return the list of properties of this object literal
+ */
+ public List<? extends PropertyTree> getProperties();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTreeImpl.java
new file mode 100644
index 0000000..36752a9
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTreeImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.ObjectNode;
+
+final class ObjectLiteralTreeImpl extends ExpressionTreeImpl
+ implements ObjectLiteralTree {
+ private final List<? extends PropertyTree> props;
+ ObjectLiteralTreeImpl(final ObjectNode node, final List<? extends PropertyTree> props) {
+ super(node);
+ this.props = props;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.OBJECT_LITERAL;
+ }
+
+ @Override
+ public List<? extends PropertyTree> getProperties() {
+ return props;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitObjectLiteral(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java
new file mode 100644
index 0000000..2352742
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a parenthesized expression. Note: parentheses
+ * not be preserved by the parser.
+ *
+ * For example:
+ * <pre>
+ * ( <em>expression</em> )
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ParenthesizedTree extends ExpressionTree {
+ /**
+ * Returns the expression within the parenthesis.
+ *
+ * @return the expression within the parenthesis
+ */
+ ExpressionTree getExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java
new file mode 100644
index 0000000..dde1f50
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.net.URL;
+import java.nio.file.Path;
+import jdk.nashorn.api.scripting.NashornException;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
+
+/**
+ * Represents nashorn ECMAScript parser instance.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface Parser {
+ /**
+ * Parses the source file and returns compilation unit tree
+ *
+ * @param file source file to parse
+ * @param listener to receive diagnostic messages from the parser. This can be null.
+ * if null is passed, a NashornException is thrown on the first parse error.
+ * @return compilation unit tree
+ * @throws NullPointerException if file is null
+ * @throws IOException if parse source read fails
+ * @throws NashornException is thrown if no listener is supplied and parser encounters error
+ */
+ public CompilationUnitTree parse(final File file, final DiagnosticListener listener) throws IOException, NashornException;
+
+ /**
+ * Parses the source Path and returns compilation unit tree
+ *
+ * @param path source Path to parse
+ * @param listener to receive diagnostic messages from the parser. This can be null.
+ * if null is passed, a NashornException is thrown on the first parse error.
+ * @return compilation unit tree
+ * @throws NullPointerException if path is null
+ * @throws IOException if parse source read fails
+ * @throws NashornException is thrown if no listener is supplied and parser encounters error
+ */
+ public CompilationUnitTree parse(final Path path, final DiagnosticListener listener) throws IOException, NashornException;
+
+ /**
+ * Parses the source url and returns compilation unit tree
+ *
+ * @param url source file to parse
+ * @param listener to receive diagnostic messages from the parser. This can be null.
+ * if null is passed, a NashornException is thrown on the first parse error.
+ * @return compilation unit tree
+ * @throws NullPointerException if url is null
+ * @throws IOException if parse source read fails
+ * @throws NashornException is thrown if no listener is supplied and parser encounters error
+ */
+ public CompilationUnitTree parse(final URL url, final DiagnosticListener listener) throws IOException, NashornException;
+
+ /**
+ * Parses the readerand returns compilation unit tree
+ *
+ * @param name name of the source file to parse
+ * @param reader from which source is read
+ * @param listener to receive diagnostic messages from the parser. This can be null.
+ * if null is passed, a NashornException is thrown on the first parse error.
+ * @return compilation unit tree
+ * @throws NullPointerException if name or reader is null
+ * @throws IOException if parse source read fails
+ * @throws NashornException is thrown if no listener is supplied and parser encounters error
+ */
+ public CompilationUnitTree parse(final String name, Reader reader, final DiagnosticListener listener) throws IOException, NashornException;
+
+ /**
+ * Parses the string source and returns compilation unit tree
+ *
+ * @param name of the source
+ * @param code string source
+ * @param listener to receive diagnostic messages from the parser. This can be null.
+ * if null is passed, a NashornException is thrown on the first parse error.
+ * @return compilation unit tree
+ * @throws NullPointerException if name or code is null
+ * @throws NashornException is thrown if no listener is supplied and parser encounters error
+ */
+ public CompilationUnitTree parse(final String name, String code, final DiagnosticListener listener) throws NashornException;
+
+ /**
+ * Parses the source from script object and returns compilation unit tree
+ *
+ * @param scriptObj script object whose script and name properties are used for script source
+ * @param listener to receive diagnostic messages from the parser. This can be null.
+ * if null is passed, a NashornException is thrown on the first parse error.
+ * @return compilation unit tree
+ * @throws NullPointerException if scriptObj is null
+ * @throws NashornException is thrown if no listener is supplied and parser encounters error
+ */
+ public CompilationUnitTree parse(final ScriptObjectMirror scriptObj, final DiagnosticListener listener) throws NashornException;
+
+ /**
+ * Factory method to create a new instance of Parser.
+ *
+ * @param options configuration options to initialize the Parser.
+ * Currently the following options are supported:
+ *
+ * <dl>
+ * <dt>"--const-as-var"</dt><dd>treat "const" declaration as "var"</dd>
+ * <dt>"-dump-on-error" or "-doe"</dt><dd>dump stack trace on error</dd>
+ * <dt>"--empty-statements"</dt><dd>include empty statement nodes</dd>
+ * <dt>"--no-syntax-extensions" or "-nse"</dt><dd>disable ECMAScript syntax extensions</dd>
+ * <dt>"-scripting"</dt><dd>enable scripting mode extensions</dd>
+ * <dt>"-strict"</dt><dd>enable ECMAScript strict mode</dd>
+ * </dl>
+ *
+ * @throws NullPointerException if options arrry or any of it's element is null
+ * @throws IllegalArgumentException on unsupported option value.
+ * @return a new Parser instance.
+ */
+ public static Parser create(final String... options) throws IllegalArgumentException {
+ options.getClass();
+ for (String opt : options) {
+ switch (opt) {
+ case "--const-as-var":
+ case "-dump-on-error":
+ case "-doe":
+ case "--empty-statements":
+ case "--no-syntax-extensions":
+ case "-nse":
+ case "-scripting":
+ case "-strict":
+ break;
+ default:
+ throw new IllegalArgumentException(opt);
+ }
+ }
+
+ return new ParserImpl(options);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParserImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParserImpl.java
new file mode 100644
index 0000000..e265cf0
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParserImpl.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.net.URL;
+import java.nio.file.Path;
+import java.util.Map;
+import java.util.Objects;
+import jdk.nashorn.api.scripting.NashornException;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.internal.ir.FunctionNode;
+import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ErrorManager;
+import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.ParserException;
+import jdk.nashorn.internal.runtime.ScriptEnvironment;
+import jdk.nashorn.internal.runtime.Source;
+import jdk.nashorn.internal.runtime.options.Options;
+
+final class ParserImpl implements Parser {
+
+ private final ScriptEnvironment env;
+
+ ParserImpl(final String... args) throws IllegalArgumentException {
+ Objects.requireNonNull(args);
+ Options options = new Options("nashorn");
+ options.process(args);
+ this.env = new ScriptEnvironment(options,
+ new PrintWriter(System.out), new PrintWriter(System.err));
+ }
+
+ @Override
+ public CompilationUnitTree parse(final File file, final DiagnosticListener listener) throws IOException, NashornException {
+ Objects.requireNonNull(file);
+ final Source src = Source.sourceFor(file.getName(), file);
+ return translate(makeParser(src, listener).parse());
+ }
+
+ @Override
+ public CompilationUnitTree parse(final Path path, final DiagnosticListener listener) throws IOException, NashornException {
+ Objects.requireNonNull(path);
+ final Source src = Source.sourceFor(path.toString(), path);
+ return translate(makeParser(src, listener).parse());
+ }
+
+ @Override
+ public CompilationUnitTree parse(final URL url, final DiagnosticListener listener) throws IOException, NashornException {
+ final Source src = Source.sourceFor(url.toString(), url);
+ return translate(makeParser(src, listener).parse());
+ }
+
+ @Override
+ public CompilationUnitTree parse(final String name, final Reader reader, final DiagnosticListener listener) throws IOException, NashornException {
+ Objects.requireNonNull(name);
+ Objects.requireNonNull(reader);
+ final Source src = Source.sourceFor(name, reader);
+ return translate(makeParser(src, listener).parse());
+ }
+
+ @Override
+ public CompilationUnitTree parse(final String name, final String code, final DiagnosticListener listener) throws NashornException {
+ final Source src = Source.sourceFor(name, code);
+ return translate(makeParser(src, listener).parse());
+ }
+
+ @Override
+ public CompilationUnitTree parse(final ScriptObjectMirror scriptObj, final DiagnosticListener listener) throws NashornException {
+ Objects.requireNonNull(scriptObj);
+ final Map<?,?> map = scriptObj;
+ if (map.containsKey("script") && map.containsKey("name")) {
+ final String script = JSType.toString(map.get("script"));
+ final String name = JSType.toString(map.get("name"));
+ final Source src = Source.sourceFor(name, script);
+ return translate(makeParser(src, listener).parse());
+ } else {
+ throw new IllegalArgumentException("can't find 'script' and 'name' properties");
+ }
+ }
+
+ private jdk.nashorn.internal.parser.Parser makeParser(final Source source, final DiagnosticListener listener) {
+ final ErrorManager errMgr = listener != null? new ListenerErrorManager(listener) : new Context.ThrowErrorManager();
+ return new jdk.nashorn.internal.parser.Parser(env, source, errMgr);
+ }
+
+ private static class ListenerErrorManager extends ErrorManager {
+ private final DiagnosticListener listener;
+
+ ListenerErrorManager(final DiagnosticListener listener) {
+ // null check
+ listener.getClass();
+ this.listener = listener;
+ }
+
+ @Override
+ public void error(final String msg) {
+ error(new ParserException(msg));
+ }
+
+ @Override
+ public void error(final ParserException e) {
+ listener.report(new DiagnosticImpl(e, Diagnostic.Kind.ERROR));
+ }
+
+ @Override
+ public void warning(final String msg) {
+ warning(new ParserException(msg));
+ }
+
+ @Override
+ public void warning(final ParserException e) {
+ listener.report(new DiagnosticImpl(e, Diagnostic.Kind.WARNING));
+ }
+ }
+
+ private CompilationUnitTree translate(final FunctionNode node) {
+ return new IRTranslator().translate(node);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java
new file mode 100644
index 0000000..b7bdd20
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * To represent property setting in an object literal tree.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface PropertyTree extends Tree {
+ /**
+ * Returns the name of this property.
+ *
+ * @return the name of the property
+ */
+ public ExpressionTree getKey();
+
+ /**
+ * Returns the value of this property. This is null for accessor properties.
+ *
+ * @return the value of the property
+ */
+ public ExpressionTree getValue();
+
+ /**
+ * Returns the setter function of this property if this
+ * is an accessor property. This is null for data properties.
+ *
+ * @return the setter function of the property
+ */
+ public FunctionExpressionTree getGetter();
+
+ /**
+ * Returns the getter function of this property if this
+ * is an accessor property. This is null for data properties.
+ *
+ * @return the getter function of the property
+ */
+ public FunctionExpressionTree getSetter();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTreeImpl.java
new file mode 100644
index 0000000..a787968
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTreeImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.PropertyNode;
+
+final class PropertyTreeImpl extends TreeImpl implements PropertyTree {
+ private final ExpressionTree key;
+ private final ExpressionTree value;
+ private final FunctionExpressionTree getter;
+ private final FunctionExpressionTree setter;
+ PropertyTreeImpl(final PropertyNode node,
+ final ExpressionTree key,
+ final ExpressionTree value,
+ final FunctionExpressionTree getter,
+ final FunctionExpressionTree setter) {
+ super(node);
+ this.key = key;
+ this.value = value;
+ this.getter = getter;
+ this.setter = setter;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.PROPERTY;
+ }
+
+ @Override
+ public ExpressionTree getKey() {
+ return key;
+ }
+
+ @Override
+ public ExpressionTree getValue() {
+ return value;
+ }
+
+ @Override
+ public FunctionExpressionTree getGetter() {
+ return getter;
+ }
+
+ @Override
+ public FunctionExpressionTree getSetter() {
+ return setter;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitProperty(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java
new file mode 100644
index 0000000..f62cbaa
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * Represents regular expression literal in the source code.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface RegExpLiteralTree extends Tree {
+ /**
+ * Regular expression pattern to match.
+ *
+ * @return regular expression patten
+ */
+ public String getPattern();
+
+ /**
+ * Regular expression matching options.
+ *
+ * @return options like "i" for ignoreCase used
+ */
+ public String getOptions();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTreeImpl.java
new file mode 100644
index 0000000..9da4e53
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTreeImpl.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.LiteralNode;
+import jdk.nashorn.internal.parser.Lexer;
+
+final class RegExpLiteralTreeImpl extends ExpressionTreeImpl
+ implements RegExpLiteralTree {
+ private final String pattern;
+ private final String options;
+ RegExpLiteralTreeImpl(final LiteralNode<?> node) {
+ super(node);
+ assert node.getValue() instanceof Lexer.RegexToken : "regexp expected";
+ final Lexer.RegexToken regex = (Lexer.RegexToken) node.getValue();
+ this.pattern = regex.getExpression();
+ this.options = regex.getOptions();
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.REGEXP_LITERAL;
+ }
+
+ @Override
+ public String getPattern() {
+ return pattern;
+ }
+
+ @Override
+ public String getOptions() {
+ return options;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitRegExpLiteral(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java
new file mode 100644
index 0000000..11fd296
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'return' statement.
+ *
+ * For example:
+ * <pre>
+ * return;
+ * return <em>expression</em>;
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ReturnTree extends StatementTree {
+ /**
+ * Returns the expression being returned. This is null if no value
+ * is being returned. i.e., empty return statement.
+ *
+ * @return the returned expression
+ */
+ ExpressionTree getExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTreeImpl.java
new file mode 100644
index 0000000..ad88a12
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTreeImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.ReturnNode;
+
+final class ReturnTreeImpl extends StatementTreeImpl implements ReturnTree {
+ private final ExpressionTree expr;
+
+ ReturnTreeImpl(final ReturnNode returnNode, final ExpressionTree expr) {
+ super(returnNode);
+ this.expr = expr;
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.RETURN;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitReturn(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES5_1.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES5_1.java
new file mode 100644
index 0000000..8897f2f
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES5_1.java
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A simple implementation of the TreeVisitor for ECMAScript edition 5.1.
+ *
+ * <p>The visit methods corresponding to ES 5.1 language constructs walk the
+ * "components" of the given tree by calling accept method passing the
+ * current visitor and the additional parameter.
+ *
+ * <p>For constructs introduced in later versions, {@code visitUnknown}
+ * is called instead which throws {@link UnknownTreeException}.
+ *
+ * <p> Methods in this class may be overridden subject to their
+ * general contract. Note that annotating methods in concrete
+ * subclasses with {@link java.lang.Override @Override} will help
+ * ensure that methods are overridden as intended.
+ *
+ * @param <R> the return type of this visitor's methods. Use {@link
+ * Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ * methods. Use {@code Void} for visitors that do not need an
+ * additional parameter.
+ */
+public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
+ @Override
+ public R visitAssignment(AssignmentTree node, P r) {
+ node.getVariable().accept(this, r);
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitCompoundAssignment(CompoundAssignmentTree node, P r) {
+ node.getVariable().accept(this, r);
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitBinary(BinaryTree node, P r) {
+ node.getLeftOperand().accept(this, r);
+ node.getRightOperand().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitBlock(BlockTree node, P r) {
+ node.getStatements().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ return null;
+ }
+
+ @Override
+ public R visitBreak(BreakTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitCase(CaseTree node, P r) {
+ final Tree caseVal = node.getExpression();
+ if (caseVal != null) {
+ caseVal.accept(this, r);
+ }
+
+ node.getStatements().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ return null;
+ }
+
+ @Override
+ public R visitCatch(CatchTree node, P r) {
+ final Tree cond = node.getCondition();
+ if (cond != null) {
+ cond.accept(this, r);
+ }
+ node.getParameter().accept(this, r);
+ node.getBlock().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitConditionalExpression(ConditionalExpressionTree node, P r) {
+ node.getCondition().accept(this, r);
+ node.getTrueExpression().accept(this, r);
+ node.getFalseExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitContinue(ContinueTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitDebugger(DebuggerTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitDoWhileLoop(DoWhileLoopTree node, P r) {
+ node.getStatement().accept(this, r);
+ node.getCondition().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitErroneous(ErroneousTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitExpressionStatement(ExpressionStatementTree node, P r) {
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitForLoop(ForLoopTree node, P r) {
+ final Tree init = node.getInitializer();
+ if (init != null) {
+ init.accept(this, r);
+ }
+
+ final Tree cond = node.getCondition();
+ if (cond != null) {
+ cond.accept(this, r);
+ }
+
+ final Tree update = node.getUpdate();
+ if (update != null) {
+ update.accept(this, r);
+ }
+
+ node.getStatement().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitForInLoop(ForInLoopTree node, P r) {
+ node.getVariable().accept(this, r);
+ node.getExpression().accept(this, r);
+ final StatementTree stat = node.getStatement();
+ if (stat != null) {
+ stat.accept(this, r);
+ }
+ return null;
+ }
+
+ @Override
+ public R visitFunctionCall(FunctionCallTree node, P r) {
+ node.getFunctionSelect().accept(this, r);
+ node.getArguments().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ return null;
+ }
+
+ @Override
+ public R visitFunctionDeclaration(FunctionDeclarationTree node, P r) {
+ node.getParameters().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ node.getBody().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitFunctionExpression(FunctionExpressionTree node, P r) {
+ node.getParameters().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ node.getBody().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitIdentifier(IdentifierTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitIf(IfTree node, P r) {
+ node.getCondition().accept(this, r);
+ node.getThenStatement().accept(this, r);
+ final Tree elseStat = node.getElseStatement();
+ if (elseStat != null) {
+ elseStat.accept(this, r);
+ }
+ return null;
+ }
+
+ @Override
+ public R visitArrayAccess(ArrayAccessTree node, P r) {
+ node.getExpression().accept(this, r);
+ node.getIndex().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitArrayLiteral(ArrayLiteralTree node, P r) {
+ node.getElements().stream().filter((tree) -> (tree != null)).forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ return null;
+ }
+
+ @Override
+ public R visitLabeledStatement(LabeledStatementTree node, P r) {
+ node.getStatement().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitLiteral(LiteralTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitParenthesized(ParenthesizedTree node, P r) {
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitReturn(ReturnTree node, P r) {
+ final Tree retExpr = node.getExpression();
+ if (retExpr != null) {
+ retExpr.accept(this, r);
+ }
+ return null;
+ }
+
+ @Override
+ public R visitMemberSelect(MemberSelectTree node, P r) {
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitNew(NewTree node, P r) {
+ node.getConstructorExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitObjectLiteral(ObjectLiteralTree node, P r) {
+ node.getProperties().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ return null;
+ }
+
+ @Override
+ public R visitProperty(PropertyTree node, P r) {
+ FunctionExpressionTree getter = node.getGetter();
+ if (getter != null) {
+ getter.accept(this, r);
+ }
+ ExpressionTree key = node.getKey();
+ if (key != null) {
+ key.accept(this, r);
+ }
+
+ FunctionExpressionTree setter = node.getSetter();
+ if (setter != null) {
+ setter.accept(this, r);
+ }
+
+ ExpressionTree value = node.getValue();
+ if (value != null) {
+ value.accept(this, r);
+ }
+ return null;
+ }
+
+ @Override
+ public R visitRegExpLiteral(RegExpLiteralTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitEmptyStatement(EmptyStatementTree node, P r) {
+ return null;
+ }
+
+ @Override
+ public R visitSwitch(SwitchTree node, P r) {
+ node.getExpression().accept(this, r);
+ node.getCases().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ return null;
+ }
+
+ @Override
+ public R visitThrow(ThrowTree node, P r) {
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitCompilationUnit(CompilationUnitTree node, P r) {
+ node.getSourceElements().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+ return null;
+ }
+
+ @Override
+ public R visitTry(TryTree node, P r) {
+ node.getBlock().accept(this, r);
+ node.getCatches().forEach((tree) -> {
+ tree.accept(this, r);
+ });
+
+ final Tree finallyBlock = node.getFinallyBlock();
+ if (finallyBlock != null) {
+ finallyBlock.accept(this, r);
+ }
+ return null;
+ }
+
+ @Override
+ public R visitInstanceOf(InstanceOfTree node, P r) {
+ node.getType().accept(this, r);
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitUnary(UnaryTree node, P r) {
+ node.getExpression().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitVariable(VariableTree node, P r) {
+ if (node.getInitializer() != null) {
+ node.getInitializer().accept(this, r);
+ }
+ return null;
+ }
+
+ @Override
+ public R visitWhileLoop(WhileLoopTree node, P r) {
+ node.getCondition().accept(this, r);
+ node.getStatement().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitWith(WithTree node, P r) {
+ node.getScope().accept(this, r);
+ node.getStatement().accept(this, r);
+ return null;
+ }
+
+ @Override
+ public R visitUnknown(Tree node, P r) {
+ // unknown in ECMAScript 5.1 edition
+ throw new UnknownTreeException(node, r);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java
similarity index 67%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java
index d24a6e7..c508239 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,14 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
/**
- * Source file for C
+ * A tree node used as the base class for the different kinds of
+ * statements.
+ *
+ * @since 1.9
*/
-public class C {
+@jdk.Exported
+public interface StatementTree extends Tree {
}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTreeImpl.java
similarity index 60%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTreeImpl.java
index d24a6e7..338b23b 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTreeImpl.java
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,10 +23,17 @@
* questions.
*/
-package pkg;
+package jdk.nashorn.api.tree;
-/**
- * Source file for C
- */
-public class C {
+import jdk.nashorn.internal.ir.Block;
+import jdk.nashorn.internal.ir.Statement;
+
+abstract class StatementTreeImpl extends TreeImpl implements StatementTree {
+ StatementTreeImpl(final Statement stat) {
+ super(stat);
+ }
+
+ StatementTreeImpl(final Block stat) {
+ super(stat);
+ }
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java
new file mode 100644
index 0000000..48c1bd7
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a 'switch' statement.
+ *
+ * For example:
+ * <pre>
+ * switch ( <em>expression</em> ) {
+ * <em>cases</em>
+ * }
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface SwitchTree extends StatementTree {
+ /**
+ * Returns the expression on which this statement switches.
+ *
+ * @return the switch expression
+ */
+ ExpressionTree getExpression();
+
+
+ /**
+ * Returns the list of 'case' statements.
+ *
+ * @return the 'case' statements
+ */
+ List<? extends CaseTree> getCases();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTreeImpl.java
new file mode 100644
index 0000000..d9e6f0f
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTreeImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.SwitchNode;
+
+final class SwitchTreeImpl extends StatementTreeImpl implements SwitchTree {
+ private final ExpressionTree expr;
+ private final List<? extends CaseTree> cases;
+ SwitchTreeImpl(final SwitchNode node,
+ final ExpressionTree expr,
+ List<? extends CaseTree> cases) {
+ super(node);
+ this.expr = expr;
+ this.cases = cases;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.SWITCH;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public List<? extends CaseTree> getCases() {
+ return cases;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitSwitch(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java
new file mode 100644
index 0000000..339abb0
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'throw' statement.
+ *
+ * For example:
+ * <pre>
+ * throw <em>expression</em>;
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface ThrowTree extends StatementTree {
+ /**
+ * Returns the expression being thrown.
+ *
+ * @return the expression being thrown.
+ */
+ ExpressionTree getExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTreeImpl.java
new file mode 100644
index 0000000..bc0a0b3
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTreeImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.ThrowNode;
+
+final class ThrowTreeImpl extends StatementTreeImpl implements ThrowTree {
+ private final ExpressionTree expr;
+ ThrowTreeImpl(final ThrowNode node, final ExpressionTree expr) {
+ super(node);
+ this.expr = expr;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.THROW;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitThrow(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java
new file mode 100644
index 0000000..210ec56
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java
@@ -0,0 +1,603 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * Common interface for all nodes in an abstract syntax tree.
+ *
+ * <p><b>WARNING:</b> This interface and its sub-interfaces are
+ * subject to change as the ECMAScript programming language evolves.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface Tree {
+
+ /**
+ * Enumerates all kinds of trees.
+ */
+ @jdk.Exported
+ public enum Kind {
+ /**
+ * Used for instances of {@link ArrayAccessTree}.
+ */
+ ARRAY_ACCESS(ArrayAccessTree.class),
+
+ /**
+ * Used for instances of {@link ArrayLiteralTree}.
+ */
+ ARRAY_LITERAL(ArrayLiteralTree.class),
+
+ /**
+ * Used for instances of {@link AssignmentTree}.
+ */
+ ASSIGNMENT(AssignmentTree.class),
+
+ /**
+ * Used for instances of {@link BlockTree}.
+ */
+ BLOCK(BlockTree.class),
+
+ /**
+ * Used for instances of {@link BreakTree}.
+ */
+ BREAK(BreakTree.class),
+
+ /**
+ * Used for instances of {@link CaseTree}.
+ */
+ CASE(CaseTree.class),
+
+ /**
+ * Used for instances of {@link CatchTree}.
+ */
+ CATCH(CatchTree.class),
+
+ /**
+ * Used for instances of {@link CompilationUnitTree}.
+ */
+ COMPILATION_UNIT(CompilationUnitTree.class),
+
+ /**
+ * Used for instances of {@link ConditionalExpressionTree}.
+ */
+ CONDITIONAL_EXPRESSION(ConditionalExpressionTree.class),
+
+ /**
+ * Used for instances of {@link ContinueTree}.
+ */
+ CONTINUE(ContinueTree.class),
+
+ /**
+ * Used for instances of {@link DoWhileLoopTree}.
+ */
+ DO_WHILE_LOOP(DoWhileLoopTree.class),
+
+ /**
+ * Used for instances of {@link DebuggerTree}.
+ */
+ DEBUGGER(DebuggerTree.class),
+
+ /**
+ * Used for instances of {@link ForInLoopTree}.
+ */
+ FOR_IN_LOOP(ForInLoopTree.class),
+
+ /**
+ * Used for instances of {@link FunctionExpressionTree}.
+ */
+ FUNCTION_EXPRESSION(FunctionExpressionTree.class),
+
+ /**
+ * Used for instances of {@link ErroneousTree}.
+ */
+ ERROR(ErroneousTree.class),
+
+ /**
+ * Used for instances of {@link ExpressionStatementTree}.
+ */
+ EXPRESSION_STATEMENT(ExpressionStatementTree.class),
+
+ /**
+ * Used for instances of {@link MemberSelectTree}.
+ */
+ MEMBER_SELECT(MemberSelectTree.class),
+
+ /**
+ * Used for instances of {@link ForLoopTree}.
+ */
+ FOR_LOOP(ForLoopTree.class),
+
+ /**
+ * Used for instances of {@link IdentifierTree}.
+ */
+ IDENTIFIER(IdentifierTree.class),
+
+ /**
+ * Used for instances of {@link IfTree}.
+ */
+ IF(IfTree.class),
+
+ /**
+ * Used for instances of {@link InstanceOfTree}.
+ */
+ INSTANCE_OF(InstanceOfTree.class),
+
+ /**
+ * Used for instances of {@link LabeledStatementTree}.
+ */
+ LABELED_STATEMENT(LabeledStatementTree.class),
+
+ /**
+ * Used for instances of {@link FunctionDeclarationTree}.
+ */
+ FUNCTION(FunctionDeclarationTree.class),
+
+ /**
+ * Used for instances of {@link FunctionCallTree}.
+ */
+ FUNCTION_INVOCATION(FunctionCallTree.class),
+
+ /**
+ * Used for instances of {@link NewTree}.
+ */
+ NEW(NewTree.class),
+
+ /**
+ * Used for instances of {@link ObjectLiteralTree}.
+ */
+ OBJECT_LITERAL(ObjectLiteralTree.class),
+
+ /**
+ * Used for instances of {@link ParenthesizedTree}.
+ */
+ PARENTHESIZED(ParenthesizedTree.class),
+
+ /**
+ * Used for instances of {@link PropertyTree}.
+ */
+ PROPERTY(PropertyTree.class),
+
+ /**
+ * Used for instances of {@link RegExpLiteralTree}.
+ */
+ REGEXP_LITERAL(RegExpLiteralTree.class),
+
+ /**
+ * Used for instances of {@link ReturnTree}.
+ */
+ RETURN(ReturnTree.class),
+
+ /**
+ * Used for instances of {@link EmptyStatementTree}.
+ */
+ EMPTY_STATEMENT(EmptyStatementTree.class),
+
+ /**
+ * Used for instances of {@link SwitchTree}.
+ */
+ SWITCH(SwitchTree.class),
+
+ /**
+ * Used for instances of {@link ThrowTree}.
+ */
+ THROW(ThrowTree.class),
+
+ /**
+ * Used for instances of {@link TryTree}.
+ */
+ TRY(TryTree.class),
+
+ /**
+ * Used for instances of {@link VariableTree}.
+ */
+ VARIABLE(VariableTree.class),
+
+ /**
+ * Used for instances of {@link WhileLoopTree}.
+ */
+ WHILE_LOOP(WhileLoopTree.class),
+
+ /**
+ * Used for instances of {@link WithTree}.
+ */
+ WITH(WithTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing postfix
+ * increment operator {@code ++}.
+ */
+ POSTFIX_INCREMENT(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing postfix
+ * decrement operator {@code --}.
+ */
+ POSTFIX_DECREMENT(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing prefix
+ * increment operator {@code ++}.
+ */
+ PREFIX_INCREMENT(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing prefix
+ * decrement operator {@code --}.
+ */
+ PREFIX_DECREMENT(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing unary plus
+ * operator {@code +}.
+ */
+ UNARY_PLUS(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing unary minus
+ * operator {@code -}.
+ */
+ UNARY_MINUS(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing bitwise
+ * complement operator {@code ~}.
+ */
+ BITWISE_COMPLEMENT(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing logical
+ * complement operator {@code !}.
+ */
+ LOGICAL_COMPLEMENT(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing logical
+ * delete operator {@code delete}.
+ */
+ DELETE(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing logical
+ * typeof operator {@code typeof}.
+ */
+ TYPEOF(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link UnaryTree} representing logical
+ * void operator {@code typeof}.
+ */
+ VOID(UnaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * comma {@code ,}.
+ */
+ COMMA(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * multiplication {@code *}.
+ */
+ MULTIPLY(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * division {@code /}.
+ */
+ DIVIDE(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * remainder {@code %}.
+ */
+ REMAINDER(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * addition or string concatenation {@code +}.
+ */
+ PLUS(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * subtraction {@code -}.
+ */
+ MINUS(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * left shift {@code <<}.
+ */
+ LEFT_SHIFT(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * right shift {@code >>}.
+ */
+ RIGHT_SHIFT(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * unsigned right shift {@code >>>}.
+ */
+ UNSIGNED_RIGHT_SHIFT(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * less-than {@code <}.
+ */
+ LESS_THAN(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * greater-than {@code >}.
+ */
+ GREATER_THAN(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * less-than-equal {@code <=}.
+ */
+ LESS_THAN_EQUAL(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * greater-than-equal {@code >=}.
+ */
+ GREATER_THAN_EQUAL(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * in operator {@code in}.
+ */
+ IN(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * equal-to {@code ==}.
+ */
+ EQUAL_TO(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * not-equal-to {@code !=}.
+ */
+ NOT_EQUAL_TO(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * equal-to {@code ===}.
+ */
+ STRICT_EQUAL_TO(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * not-equal-to {@code !==}.
+ */
+ STRICT_NOT_EQUAL_TO(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * bitwise and logical "and" {@code &}.
+ */
+ AND(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * bitwise and logical "xor" {@code ^}.
+ */
+ XOR(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * bitwise and logical "or" {@code |}.
+ */
+ OR(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * conditional-and {@code &&}.
+ */
+ CONDITIONAL_AND(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link BinaryTree} representing
+ * conditional-or {@code ||}.
+ */
+ CONDITIONAL_OR(BinaryTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * multiplication assignment {@code *=}.
+ */
+ MULTIPLY_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * division assignment {@code /=}.
+ */
+ DIVIDE_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * remainder assignment {@code %=}.
+ */
+ REMAINDER_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * addition or string concatenation assignment {@code +=}.
+ */
+ PLUS_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * subtraction assignment {@code -=}.
+ */
+ MINUS_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * left shift assignment {@code <<=}.
+ */
+ LEFT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * right shift assignment {@code >>=}.
+ */
+ RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * unsigned right shift assignment {@code >>>=}.
+ */
+ UNSIGNED_RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * bitwise and logical "and" assignment {@code &=}.
+ */
+ AND_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * bitwise and logical "xor" assignment {@code ^=}.
+ */
+ XOR_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link CompoundAssignmentTree} representing
+ * bitwise and logical "or" assignment {@code |=}.
+ */
+ OR_ASSIGNMENT(CompoundAssignmentTree.class),
+
+ /**
+ * Used for instances of {@link LiteralTree} representing
+ * a number literal expression of type {@code double}.
+ */
+ NUMBER_LITERAL(LiteralTree.class),
+
+ /**
+ * Used for instances of {@link LiteralTree} representing
+ * a boolean literal expression of type {@code boolean}.
+ */
+ BOOLEAN_LITERAL(LiteralTree.class),
+
+ /**
+ * Used for instances of {@link LiteralTree} representing
+ * a string literal expression of type {@link String}.
+ */
+ STRING_LITERAL(LiteralTree.class),
+
+ /**
+ * Used for instances of {@link LiteralTree} representing
+ * the use of {@code null}.
+ */
+ NULL_LITERAL(LiteralTree.class),
+
+ /**
+ * An implementation-reserved node. This is the not the node
+ * you are looking for.
+ */
+ OTHER(null);
+
+ Kind(Class<? extends Tree> intf) {
+ associatedInterface = intf;
+ }
+
+ /**
+ * Returns the associated interface type that uses this kind.
+ * @return the associated interface
+ */
+ public Class<? extends Tree> asInterface() {
+ return associatedInterface;
+ }
+
+ /**
+ * Returns if this is a literal tree kind or not.
+ *
+ * @return true if this is a literal tree kind, false otherwise
+ */
+ public boolean isLiteral() {
+ return associatedInterface == LiteralTree.class;
+ }
+
+ /**
+ * Returns if this is an expression tree kind or not.
+ *
+ * @return true if this is an expression tree kind, false otherwise
+ */
+ public boolean isExpression() {
+ return ExpressionTree.class.isAssignableFrom(associatedInterface);
+ }
+
+ /**
+ * Returns if this is a statement tree kind or not.
+ *
+ * @return true if this is a statement tree kind, false otherwise
+ */
+ public boolean isStatement() {
+ return StatementTree.class.isAssignableFrom(associatedInterface);
+ }
+
+ private final Class<? extends Tree> associatedInterface;
+ }
+
+ /**
+ * Start character offset of this Tree within the source.
+ *
+ * @return the position
+ */
+ long getStartPosition();
+
+ /**
+ * End character offset of this Tree within the source.
+ *
+ * @return the position
+ */
+ long getEndPosition();
+
+ /**
+ * Gets the kind of this tree.
+ *
+ * @return the kind of this tree.
+ */
+ Kind getKind();
+
+ /**
+ * Accept method used to implement the visitor pattern. The
+ * visitor pattern is used to implement operations on trees.
+ *
+ * @param <R> result type of this operation.
+ * @param <D> type of additional data.
+ * @param visitor tree visitor
+ * @param data additional data passed to visitor methods
+ * @return the value from visitor's visit methods
+ */
+ <R,D> R accept(TreeVisitor<R,D> visitor, D data);
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeImpl.java
new file mode 100644
index 0000000..fb51ce5
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeImpl.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.Node;
+
+import jdk.nashorn.internal.parser.TokenType;
+
+abstract class TreeImpl implements Tree {
+ protected final Node node;
+
+ TreeImpl(final Node node) {
+ this.node = node;
+ }
+
+ @Override
+ public long getStartPosition() {
+ return node.getStart();
+ }
+
+ @Override
+ public long getEndPosition() {
+ return node.getFinish();
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitUnknown(this, data);
+ }
+
+ static Kind getOperator(final TokenType tt) {
+ switch(tt) {
+ case NEW:
+ return Kind.NEW;
+ case NOT:
+ return Kind.LOGICAL_COMPLEMENT;
+ case NE:
+ return Kind.NOT_EQUAL_TO;
+ case NE_STRICT:
+ return Kind.STRICT_NOT_EQUAL_TO;
+ case MOD:
+ return Kind.REMAINDER;
+ case ASSIGN_MOD:
+ return Kind.REMAINDER_ASSIGNMENT;
+ case BIT_AND:
+ return Kind.AND;
+ case AND:
+ return Kind.CONDITIONAL_AND;
+ case ASSIGN_BIT_AND:
+ return Kind.AND_ASSIGNMENT;
+ case MUL:
+ return Kind.MULTIPLY;
+ case ASSIGN_MUL:
+ return Kind.MULTIPLY_ASSIGNMENT;
+ case ADD:
+ return Kind.PLUS;
+ case INCPREFIX:
+ return Kind.PREFIX_INCREMENT;
+ case INCPOSTFIX:
+ return Kind.POSTFIX_INCREMENT;
+ case ASSIGN_ADD:
+ return Kind.PLUS_ASSIGNMENT;
+ case SUB:
+ return Kind.MINUS;
+ case DECPREFIX:
+ return Kind.PREFIX_DECREMENT;
+ case DECPOSTFIX:
+ return Kind.POSTFIX_DECREMENT;
+ case ASSIGN_SUB:
+ return Kind.MINUS_ASSIGNMENT;
+ case DIV:
+ return Kind.DIVIDE;
+ case ASSIGN_DIV:
+ return Kind.DIVIDE_ASSIGNMENT;
+ case LT:
+ return Kind.LESS_THAN;
+ case SHL:
+ return Kind.LEFT_SHIFT;
+ case ASSIGN_SHL:
+ return Kind.LEFT_SHIFT_ASSIGNMENT;
+ case LE:
+ return Kind.LESS_THAN_EQUAL;
+ case ASSIGN:
+ return Kind.ASSIGNMENT;
+ case EQ:
+ return Kind.EQUAL_TO;
+ case EQ_STRICT:
+ return Kind.STRICT_EQUAL_TO;
+ case GT:
+ return Kind.GREATER_THAN;
+ case GE:
+ return Kind.GREATER_THAN_EQUAL;
+ case SAR:
+ return Kind.RIGHT_SHIFT;
+ case ASSIGN_SAR:
+ return Kind.RIGHT_SHIFT_ASSIGNMENT;
+ case SHR:
+ return Kind.UNSIGNED_RIGHT_SHIFT;
+ case ASSIGN_SHR:
+ return Kind.UNSIGNED_RIGHT_SHIFT_ASSIGNMENT;
+ case TERNARY:
+ return Kind.CONDITIONAL_EXPRESSION;
+ case BIT_XOR:
+ return Kind.XOR;
+ case ASSIGN_BIT_XOR:
+ return Kind.XOR_ASSIGNMENT;
+ case BIT_OR:
+ return Kind.OR;
+ case ASSIGN_BIT_OR:
+ return Kind.OR_ASSIGNMENT;
+ case OR:
+ return Kind.CONDITIONAL_OR;
+ case BIT_NOT:
+ return Kind.BITWISE_COMPLEMENT;
+ case DELETE:
+ return Kind.DELETE;
+ case TYPEOF:
+ return Kind.TYPEOF;
+ case VOID:
+ return Kind.VOID;
+ case IN:
+ return Kind.IN;
+ case INSTANCEOF:
+ return Kind.INSTANCE_OF;
+ case COMMARIGHT:
+ return Kind.COMMA;
+ default:
+ throw new AssertionError("should not reach here: " + tt);
+ }
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java
new file mode 100644
index 0000000..ee064b2
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java
@@ -0,0 +1,438 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A visitor of trees, in the style of the visitor design pattern.
+ * Classes implementing this interface are used to operate
+ * on a tree when the kind of tree is unknown at compile time.
+ * When a visitor is passed to an tree's {@link Tree#accept
+ * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
+ * to that tree is invoked.
+ *
+ * <p> Classes implementing this interface may or may not throw a
+ * {@code NullPointerException} if the additional parameter {@code p}
+ * is {@code null}; see documentation of the implementing class for
+ * details.
+ *
+ * <p> <b>WARNING:</b> It is possible that methods will be added to
+ this interface to accommodate new, currently unknown, language
+ structures added to future versions of the ECMAScript programming
+ language. When new visit methods are added for new Tree subtypes,
+ default method bodies will be introduced which will call visitUnknown
+ method as a fallback.
+ *
+ * @param <R> the return type of this visitor's methods. Use {@link
+ * Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ * methods. Use {@code Void} for visitors that do not need an
+ * additional parameter.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface TreeVisitor<R,P> {
+ /**
+ * Visit assignment tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitAssignment(AssignmentTree node, P p);
+
+ /**
+ * Visit compound assignment tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitCompoundAssignment(CompoundAssignmentTree node, P p);
+
+ /**
+ * Visit binary expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitBinary(BinaryTree node, P p);
+
+ /**
+ * Visit block statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitBlock(BlockTree node, P p);
+
+ /**
+ * Visit break statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitBreak(BreakTree node, P p);
+
+ /**
+ * Visit case statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitCase(CaseTree node, P p);
+
+ /**
+ * Visit catch block statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitCatch(CatchTree node, P p);
+
+ /**
+ * Visit conditional expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitConditionalExpression(ConditionalExpressionTree node, P p);
+
+ /**
+ * Visit continue statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitContinue(ContinueTree node, P p);
+
+ /**
+ * Visit debugger statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitDebugger(DebuggerTree node, P p);
+
+ /**
+ * Visit do-while statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitDoWhileLoop(DoWhileLoopTree node, P p);
+
+ /**
+ * Visit error expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitErroneous(ErroneousTree node, P p);
+
+ /**
+ * Visit expression statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitExpressionStatement(ExpressionStatementTree node, P p);
+
+ /**
+ * Visit 'for' statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitForLoop(ForLoopTree node, P p);
+
+ /**
+ * Visit for..in statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitForInLoop(ForInLoopTree node, P p);
+
+ /**
+ * Visit function call expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitFunctionCall(FunctionCallTree node, P p);
+
+ /**
+ * Visit function declaration tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitFunctionDeclaration(FunctionDeclarationTree node, P p);
+
+ /**
+ * Visit function expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitFunctionExpression(FunctionExpressionTree node, P p);
+
+ /**
+ * Visit identifier tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitIdentifier(IdentifierTree node, P p);
+
+ /**
+ * Visit 'if' statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitIf(IfTree node, P p);
+
+ /**
+ * Visit array access expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitArrayAccess(ArrayAccessTree node, P p);
+
+ /**
+ * Visit array literal expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitArrayLiteral(ArrayLiteralTree node, P p);
+
+ /**
+ * Visit labeled statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitLabeledStatement(LabeledStatementTree node, P p);
+
+ /**
+ * Visit literal expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitLiteral(LiteralTree node, P p);
+
+ /**
+ * Visit parenthesized expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitParenthesized(ParenthesizedTree node, P p);
+
+ /**
+ * Visit return statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitReturn(ReturnTree node, P p);
+
+ /**
+ * Visit member select expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitMemberSelect(MemberSelectTree node, P p);
+
+ /**
+ * Visit 'new' expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitNew(NewTree node, P p);
+
+ /**
+ * Visit object literal tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitObjectLiteral(ObjectLiteralTree node, P p);
+
+ /**
+ * Visit a property of an object literal expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitProperty(PropertyTree node, P p);
+
+ /**
+ * Visit regular expression literal tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitRegExpLiteral(RegExpLiteralTree node, P p);
+
+ /**
+ * Visit an empty statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitEmptyStatement(EmptyStatementTree node, P p);
+
+ /**
+ * Visit 'switch' statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitSwitch(SwitchTree node, P p);
+
+ /**
+ * Visit 'throw' expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitThrow(ThrowTree node, P p);
+
+ /**
+ * Visit compilation unit tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitCompilationUnit(CompilationUnitTree node, P p);
+
+ /**
+ * Visit 'try' statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitTry(TryTree node, P p);
+
+ /**
+ * Visit 'instanceof' expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitInstanceOf(InstanceOfTree node, P p);
+
+ /**
+ * Visit unary expression tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitUnary(UnaryTree node, P p);
+
+ /**
+ * Visit variable declaration tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitVariable(VariableTree node, P p);
+
+ /**
+ * Visit 'while' statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitWhileLoop(WhileLoopTree node, P p);
+
+ /**
+ * Visit 'with' statement tree.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitWith(WithTree node, P p);
+
+ /**
+ * Visit unknown expression/statement tree. This fallback will be
+ * called if new Tree subtypes are introduced in future. A specific
+ * implementation may throw {{@linkplain UnknownTreeException unknown tree exception}
+ * if the visitor implementation was for an older language version.
+ *
+ * @param node node being visited
+ * @param p extra parameter passed to the visitor
+ * @return value from the visitor
+ */
+ R visitUnknown(Tree node, P p);
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java
new file mode 100644
index 0000000..59fbdcc
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a 'try' statement.
+ *
+ * For example:
+ * <pre>
+ * try
+ * <em>block</em>
+ * <em>catches</em>
+ * finally
+ * <em>finallyBlock</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface TryTree extends StatementTree {
+ /**
+ * Returns the 'try' block of this 'try' statement.
+ *
+ * @return the 'try' block
+ */
+ BlockTree getBlock();
+
+ /**
+ * Returns the list of 'catch' statements associated with this 'try'.
+ *
+ * @return the list of 'catch' statements associated with this 'try'.
+ */
+ List<? extends CatchTree> getCatches();
+
+ /**
+ * Returns the 'finally' block associated with this 'try'. This is
+ * null if there is no 'finally' block associated with this 'try'.
+ *
+ * @return the 'finally' block associated with this 'try'.
+ */
+ BlockTree getFinallyBlock();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTreeImpl.java
new file mode 100644
index 0000000..2766071
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTreeImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import java.util.List;
+import jdk.nashorn.internal.ir.TryNode;
+
+final class TryTreeImpl extends StatementTreeImpl implements TryTree {
+ private final BlockTree block;
+ private final List<? extends CatchTree> catches;
+ private final BlockTree finallyBlock;
+ TryTreeImpl(final TryNode node,
+ final BlockTree block,
+ final List<? extends CatchTree> catches,
+ final BlockTree finallyBlock) {
+ super(node);
+ this.block = block;
+ this.catches = catches;
+ this.finallyBlock = finallyBlock;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.TRY;
+ }
+
+ @Override
+ public BlockTree getBlock() {
+ return block;
+ }
+
+ @Override
+ public List<? extends CatchTree> getCatches() {
+ return catches;
+ }
+
+ @Override
+ public BlockTree getFinallyBlock() {
+ return finallyBlock;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitTry(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java
new file mode 100644
index 0000000..e2e1bc2
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for postfix and unary expressions.
+ * Use {@link #getKind getKind} to determine the kind of operator.
+ *
+ * For example:
+ * <pre>
+ * <em>operator</em> <em>expression</em>
+ *
+ * <em>expression</em> <em>operator</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface UnaryTree extends ExpressionTree {
+ /**
+ * Returns the expression operated by the unary operator.
+ *
+ * @return The expression operated by the unary operator.
+ */
+ ExpressionTree getExpression();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTreeImpl.java
new file mode 100644
index 0000000..c8e7d7a
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTreeImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.UnaryNode;
+
+class UnaryTreeImpl extends ExpressionTreeImpl implements UnaryTree {
+ private final ExpressionTree expr;
+ private final Kind kind;
+ UnaryTreeImpl(final UnaryNode node, final ExpressionTree expr) {
+ super(node);
+ this.expr = expr;
+ this.kind = getOperator(node.tokenType());
+ }
+
+ @Override
+ public Kind getKind() {
+ return kind;
+ }
+
+ @Override
+ public ExpressionTree getExpression() {
+ return expr;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitUnary(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java
new file mode 100644
index 0000000..2892568
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+
+/**
+ * Indicates that an unknown kind of Tree was encountered. This
+ * can occur if the language evolves and new kinds of Trees are
+ * added to the {@code Tree} hierarchy. May be thrown by a
+ * {@linkplain TreeVisitor tree visitor} to indicate that the
+ * visitor was created for a prior version of the language.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public class UnknownTreeException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ private transient final Tree tree;
+ private transient final Object parameter;
+
+ /**
+ * Creates a new {@code UnknownTreeException}. The {@code p}
+ * parameter may be used to pass in an additional argument with
+ * information about the context in which the unknown element was
+ * encountered; for example, the visit methods of {@link
+ * TreeVisitor} may pass in their additional parameter.
+ *
+ * @param t the unknown tree, may be {@code null}
+ * @param p an additional parameter, may be {@code null}
+ */
+ public UnknownTreeException(Tree t, Object p) {
+ super("Unknown tree: " + t);
+ this.tree = t;
+ this.parameter = p;
+ }
+
+ /**
+ * Returns the unknown tree.
+ * The value may be unavailable if this exception has been
+ * serialized and then read back in.
+ *
+ * @return the unknown element, or {@code null} if unavailable
+ */
+ public Tree getUnknownTree() {
+ return tree;
+ }
+
+ /**
+ * Returns the additional argument.
+ * The value may be unavailable if this exception has been
+ * serialized and then read back in.
+ *
+ * @return the additional argument
+ */
+ public Object getArgument() {
+ return parameter;
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java
new file mode 100644
index 0000000..aec0e6c
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a variable declaration.
+ *
+ * For example:
+ * <pre>
+ * <em>var</em> <em>name</em> <em>initializer</em> ;
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface VariableTree extends StatementTree {
+ /**
+ * Returns the name of this variable.
+ *
+ * @return the name of this variable
+ */
+ String getName();
+
+ /**
+ * Returns the initial value expression for this variable. This is
+ * null if no initial value for this variable.
+ *
+ * @return the initial value expression
+ */
+ ExpressionTree getInitializer();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTreeImpl.java
new file mode 100644
index 0000000..7be6a44
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTreeImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.VarNode;
+
+final class VariableTreeImpl extends StatementTreeImpl implements VariableTree {
+ private final String name;
+ private final ExpressionTree init;
+
+ VariableTreeImpl(final VarNode node, final ExpressionTree init) {
+ super(node);
+ this.name = node.getName().getName();
+ this.init = init;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.VARIABLE;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public ExpressionTree getInitializer() {
+ return init;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitVariable(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java
new file mode 100644
index 0000000..9e89dd3
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'while' loop statement.
+ *
+ * For example:
+ * <pre>
+ * while ( <em>condition</em> )
+ * <em>statement</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface WhileLoopTree extends ConditionalLoopTree {
+ /**
+ * The condition expression of this 'while' statement.
+ *
+ * @return the condition expression
+ */
+ ExpressionTree getCondition();
+
+ /**
+ * The statement contained in this 'while' statement.
+ *
+ * @return the statement contained
+ */
+ StatementTree getStatement();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTreeImpl.java
new file mode 100644
index 0000000..bf9152c
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTreeImpl.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.WhileNode;
+
+final class WhileLoopTreeImpl extends StatementTreeImpl implements WhileLoopTree {
+ private final ExpressionTree cond;
+ private final StatementTree stat;
+
+ WhileLoopTreeImpl(final WhileNode node, final ExpressionTree cond, final StatementTree stat) {
+ super(node);
+ assert !node.isDoWhile() : "while expected";
+ this.cond = cond;
+ this.stat = stat;
+ }
+
+ @Override
+ public Tree.Kind getKind() {
+ return Tree.Kind.WHILE_LOOP;
+ }
+
+ @Override
+ public ExpressionTree getCondition() {
+ return cond;
+ }
+
+ @Override
+ public StatementTree getStatement() {
+ return stat;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitWhileLoop(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java
new file mode 100644
index 0000000..96c4b2a
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+/**
+ * A tree node for a 'with' statement.
+ *
+ * For example:
+ * <pre>
+ * with ( <em>scope</em> )
+ * <em>statement</em>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public interface WithTree extends StatementTree {
+ /**
+ * The scope object expression for this 'with' statement.
+ *
+ * @return the scope object
+ */
+ ExpressionTree getScope();
+
+ /**
+ * The statement contained in this 'with' statement.
+ *
+ * @return the statement contained
+ */
+ StatementTree getStatement();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTreeImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTreeImpl.java
new file mode 100644
index 0000000..a3ac964
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTreeImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.tree;
+
+import jdk.nashorn.internal.ir.WithNode;
+
+final class WithTreeImpl extends StatementTreeImpl implements WithTree {
+ private final ExpressionTree scope;
+ private final StatementTree stat;
+ WithTreeImpl(final WithNode node, final ExpressionTree scope,
+ final StatementTree stat) {
+ super(node);
+ this.scope = scope;
+ this.stat = stat;
+ }
+
+ @Override
+ public Kind getKind() {
+ return Kind.WITH;
+ }
+
+ @Override
+ public ExpressionTree getScope() {
+ return scope;
+ }
+
+ @Override
+ public StatementTree getStatement() {
+ return stat;
+ }
+
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
+ return visitor.visitWith(this, data);
+ }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java
new file mode 100644
index 0000000..1c2d048
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * <p>
+ * Nashorn parser API provides interfaces to represent ECMAScript source code
+ * as abstract syntax trees (AST) and Parser to parse ECMAScript source scripts.
+ * </p>
+ * <p>
+ * Using parser API user can write Java code to access parse tree
+ * representation of ECMAScript source. Script source may be a file,
+ * a URL or a String. Unless stated otherwise null argument in methods of this
+ * package result in NullPointerException being thrown.
+ * </p>
+ *
+ * <pre>
+ * <code>
+ * import jdk.nashorn.api.tree.*;
+ * import java.io.File;
+ *
+ * // Simple example that prints warning on 'with' statements
+ * public class Main {
+ * public static void main(String[] args) throws Exception {
+ * // Create a new parser instance
+ * Parser parser = Parser.create();
+ * File sourceFile = new File(args[0]);
+ *
+ * // Parse given source File using parse method.
+ * // Pass a diagnostic listener to print error messages.
+ * CompilationUnitTree cut = parser.parse(sourceFile,
+ * (d) -> { System.out.println(d); });
+ *
+ * if (cut != null) {
+ * // call Tree.accept method passing a SimpleTreeVisitor
+ * cut.accept(new SimpleTreeVisitor<Void, Void>() {
+ * // visit method for 'with' statement
+ * public Void visitWith(WithTree wt, Void v) {
+ * // print warning on 'with' statement
+ * System.out.println("Warning: using 'with' statement!");
+ * return null;
+ * }
+ * }, null);
+ * }
+ * }
+ * }
+ * </code>
+ * </pre>
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+package jdk.nashorn.api.tree;
+
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 8428dc9..fd627a6 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -836,7 +836,7 @@
*/
final CodeGenerator codegen = this;
- final Node currentDiscard = codegen.lc.getCurrentDiscard();
+ final boolean isCurrentDiscard = codegen.lc.isCurrentDiscard(expr);
expr.accept(new NodeOperatorVisitor<LexicalContext>(new LexicalContext()) {
@Override
public boolean enterIdentNode(final IdentNode identNode) {
@@ -1192,7 +1192,7 @@
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinExpr) {
- loadExpression(joinExpr.getExpression(), resultBounds);
+ loadMaybeDiscard(joinExpr, joinExpr.getExpression(), resultBounds);
return false;
}
@@ -1209,7 +1209,7 @@
throw new AssertionError(otherNode.getClass().getName());
}
});
- if(currentDiscard != expr) {
+ if(!isCurrentDiscard) {
coerceStackTop(resultBounds);
}
return method;
@@ -3648,7 +3648,7 @@
// TODO: move checks for discarding to actual expression load code (e.g. as we do with void). That way we might
// be able to eliminate even more checks.
if(expr instanceof PrimitiveLiteralNode | isLocalVariable(expr)) {
- assert lc.getCurrentDiscard() != expr;
+ assert !lc.isCurrentDiscard(expr);
// Don't bother evaluating expressions without side effects. Typical usage is "void 0" for reliably generating
// undefined.
return;
@@ -3656,11 +3656,37 @@
lc.pushDiscard(expr);
loadExpression(expr, TypeBounds.UNBOUNDED);
- if (lc.getCurrentDiscard() == expr) {
+ if (lc.popDiscardIfCurrent(expr)) {
assert !expr.isAssignment();
// NOTE: if we had a way to load with type void, we could avoid popping
method.pop();
- lc.popDiscard();
+ }
+ }
+
+ /**
+ * Loads the expression with the specified type bounds, but if the parent expression is the current discard,
+ * then instead loads and discards the expression.
+ * @param parent the parent expression that's tested for being the current discard
+ * @param expr the expression that's either normally loaded or discard-loaded
+ * @param resultBounds result bounds for when loading the expression normally
+ */
+ private void loadMaybeDiscard(final Expression parent, final Expression expr, final TypeBounds resultBounds) {
+ loadMaybeDiscard(lc.popDiscardIfCurrent(parent), expr, resultBounds);
+ }
+
+ /**
+ * Loads the expression with the specified type bounds, or loads and discards the expression, depending on the
+ * value of the discard flag. Useful as a helper for expressions with control flow where you often can't combine
+ * testing for being the current discard and loading the subexpressions.
+ * @param discard if true, the expression is loaded and discarded
+ * @param expr the expression that's either normally loaded or discard-loaded
+ * @param resultBounds result bounds for when loading the expression normally
+ */
+ private void loadMaybeDiscard(final boolean discard, final Expression expr, final TypeBounds resultBounds) {
+ if (discard) {
+ loadAndDiscard(expr);
+ } else {
+ loadExpression(expr, resultBounds);
}
}
@@ -3717,9 +3743,7 @@
public void loadVOID(final UnaryNode unaryNode, final TypeBounds resultBounds) {
loadAndDiscard(unaryNode.getExpression());
- if(lc.getCurrentDiscard() == unaryNode) {
- lc.popDiscard();
- } else {
+ if (!lc.popDiscardIfCurrent(unaryNode)) {
method.loadUndefined(resultBounds.widest);
}
}
@@ -3752,16 +3776,23 @@
private void loadAND_OR(final BinaryNode binaryNode, final TypeBounds resultBounds, final boolean isAnd) {
final Type narrowestOperandType = Type.widestReturnType(binaryNode.lhs().getType(), binaryNode.rhs().getType());
+ final boolean isCurrentDiscard = lc.popDiscardIfCurrent(binaryNode);
+
final Label skip = new Label("skip");
if(narrowestOperandType == Type.BOOLEAN) {
// optimize all-boolean logical expressions
final Label onTrue = new Label("andor_true");
emitBranch(binaryNode, onTrue, true);
- method.load(false);
- method._goto(skip);
- method.label(onTrue);
- method.load(true);
- method.label(skip);
+ if (isCurrentDiscard) {
+ method.label(onTrue);
+ method.pop();
+ } else {
+ method.load(false);
+ method._goto(skip);
+ method.label(onTrue);
+ method.load(true);
+ method.label(skip);
+ }
return;
}
@@ -3770,7 +3801,11 @@
final boolean lhsConvert = LocalVariableConversion.hasLiveConversion(lhs);
final Label evalRhs = lhsConvert ? new Label("eval_rhs") : null;
- loadExpression(lhs, outBounds).dup().convert(Type.BOOLEAN);
+ loadExpression(lhs, outBounds);
+ if (!isCurrentDiscard) {
+ method.dup();
+ }
+ method.convert(Type.BOOLEAN);
if (isAnd) {
if(lhsConvert) {
method.ifne(evalRhs);
@@ -3789,9 +3824,11 @@
method.label(evalRhs);
}
- method.pop();
+ if (!isCurrentDiscard) {
+ method.pop();
+ }
final JoinPredecessorExpression rhs = (JoinPredecessorExpression)binaryNode.rhs();
- loadExpression(rhs, outBounds);
+ loadMaybeDiscard(isCurrentDiscard, rhs, outBounds);
method.beforeJoinPoint(rhs);
method.label(skip);
}
@@ -3813,9 +3850,8 @@
// Detect dead assignments
if(lhs instanceof IdentNode) {
final Symbol symbol = ((IdentNode)lhs).getSymbol();
- if(!symbol.isScope() && !symbol.hasSlotFor(rhsType) && lc.getCurrentDiscard() == binaryNode) {
+ if(!symbol.isScope() && !symbol.hasSlotFor(rhsType) && lc.popDiscardIfCurrent(binaryNode)) {
loadAndDiscard(rhs);
- lc.popDiscard();
method.markDeadLocalVariable(symbol);
return;
}
@@ -4069,11 +4105,11 @@
private void loadCOMMARIGHT(final BinaryNode binaryNode, final TypeBounds resultBounds) {
loadAndDiscard(binaryNode.lhs());
- loadExpression(binaryNode.rhs(), resultBounds);
+ loadMaybeDiscard(binaryNode, binaryNode.rhs(), resultBounds);
}
private void loadCOMMALEFT(final BinaryNode binaryNode, final TypeBounds resultBounds) {
- loadExpression(binaryNode.lhs(), resultBounds);
+ loadMaybeDiscard(binaryNode, binaryNode.lhs(), resultBounds);
loadAndDiscard(binaryNode.rhs());
}
@@ -4173,13 +4209,14 @@
emitBranch(test, falseLabel, false);
- loadExpression(trueExpr.getExpression(), outBounds);
- assert Type.generic(method.peekType()) == outBounds.narrowest;
+ final boolean isCurrentDiscard = lc.popDiscardIfCurrent(ternaryNode);
+ loadMaybeDiscard(isCurrentDiscard, trueExpr.getExpression(), outBounds);
+ assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
method.beforeJoinPoint(trueExpr);
method._goto(exitLabel);
method.label(falseLabel);
- loadExpression(falseExpr.getExpression(), outBounds);
- assert Type.generic(method.peekType()) == outBounds.narrowest;
+ loadMaybeDiscard(isCurrentDiscard, falseExpr.getExpression(), outBounds);
+ assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
method.beforeJoinPoint(falseExpr);
method.label(exitLabel);
}
@@ -4365,9 +4402,8 @@
// store the result that "lives on" after the op, e.g. "i" in i++ postfix.
protected void storeNonDiscard() {
- if (lc.getCurrentDiscard() == assignNode) {
+ if (lc.popDiscardIfCurrent(assignNode)) {
assert assignNode.isAssignment();
- lc.popDiscard();
return;
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java
index ccd9065..6312714 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java
@@ -34,6 +34,7 @@
import jdk.nashorn.internal.IntDeque;
import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.Block;
+import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.FunctionNode;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.LexicalContextNode;
@@ -59,9 +60,11 @@
/** Method emitter stack - every time we start a sub method (e.g. a split) we push one */
private final Deque<MethodEmitter> methodEmitters = new ArrayDeque<>();
- /** The discard stack - whenever we enter a discard node we keep track of its return value status -
- * i.e. should we keep it or throw it away */
- private final Deque<Node> discard = new ArrayDeque<>();
+ /** The discard stack - whenever we evaluate an expression that will be discarded, we push it on this stack. Various
+ * implementations of expression code emitter can choose to emit code that'll discard the expression themselves, or
+ * ignore it in which case CodeGenerator.loadAndDiscard() will explicitly emit a pop instruction. */
+ private final Deque<Expression> discard = new ArrayDeque<>();
+
private final Deque<Map<String, Collection<Label>>> unwarrantedOptimismHandlers = new ArrayDeque<>();
private final Deque<StringBuilder> slotTypesDescriptors = new ArrayDeque<>();
@@ -270,16 +273,20 @@
}
}
- void pushDiscard(final Node node) {
- discard.push(node);
+ void pushDiscard(final Expression expr) {
+ discard.push(expr);
}
- Node popDiscard() {
- return discard.pop();
+ boolean popDiscardIfCurrent(final Expression expr) {
+ if (isCurrentDiscard(expr)) {
+ discard.pop();
+ return true;
+ }
+ return false;
}
- Node getCurrentDiscard() {
- return discard.peek();
+ boolean isCurrentDiscard(final Expression expr) {
+ return discard.peek() == expr;
}
int quickSlot(final Type type) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java
index 431244d..b45b986 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java
@@ -32,7 +32,6 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import jdk.nashorn.internal.codegen.ObjectClassGenerator.AllocatorDescriptor;
import jdk.nashorn.internal.ir.Block;
import jdk.nashorn.internal.ir.FunctionNode;
import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
@@ -208,7 +207,7 @@
final RecompilableScriptFunctionData data = new RecompilableScriptFunctionData(
newFunctionNode,
compiler.getCodeInstaller(),
- new AllocatorDescriptor(newFunctionNode.getThisProperties()),
+ ObjectClassGenerator.createAllocationStrategy(newFunctionNode.getThisProperties()),
nestedFunctions,
externalSymbolDepths.get(fnId),
internalSymbols.get(fnId),
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 379d3ac..67adc4a 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -206,7 +206,6 @@
// continuations (since RewriteException's byteCodeSlots carries an array and not a name-value map).
symbolIsConverted(symbol, branchLvarType, targetType);
- //symbolIsUsed(symbol, branchLvarType);
return new LocalVariableConversion(symbol, branchLvarType.type, targetType.type, next);
}
@@ -229,7 +228,7 @@
for(final Symbol symbol: commonSymbols) {
final LvarType type1 = types1.get(symbol);
final LvarType type2 = types2.get(symbol);
- final LvarType widest = widestLvarType(type1, type2);
+ final LvarType widest = widestLvarType(type1, type2);
if(widest != type1 && matches1) {
matches1 = false;
if(!matches2) {
@@ -242,7 +241,7 @@
union = cloneMap(types2);
}
}
- if(!(matches1 || matches2) && union != null) { //remove overly enthusiastic "union can be null" warning
+ if(!(matches1 || matches2)) {
assert union != null;
union.put(symbol, widest);
}
@@ -711,8 +710,13 @@
@Override
public boolean enterIfNode(final IfNode ifNode) {
+ processIfNode(ifNode);
+ return false;
+ }
+
+ private void processIfNode(final IfNode ifNode) {
if(!reachable) {
- return false;
+ return;
}
final Expression test = ifNode.getTest();
@@ -721,48 +725,48 @@
visitExpressionOnEmptyStack(test);
- final Map<Symbol, LvarType> afterTestLvarTypes = localVariableTypes;
- if(!isAlwaysFalse(test)) {
+ final Map<Symbol, LvarType> passLvarTypes;
+ final boolean reachableFromPass;
+ final boolean isTestAlwaysTrue = isAlwaysTrue(test);
+ if(isAlwaysFalse(test)) {
+ passLvarTypes = null;
+ reachableFromPass = false;
+ } else {
+ final Map<Symbol, LvarType> afterTestLvarTypes = localVariableTypes;
pass.accept(this);
assertTypeStackIsEmpty();
+ if (isTestAlwaysTrue) {
+ return;
+ }
+ passLvarTypes = localVariableTypes;
+ reachableFromPass = reachable;
+ localVariableTypes = afterTestLvarTypes;
+ reachable = true;
}
- final Map<Symbol, LvarType> passLvarTypes = localVariableTypes;
- final boolean reachableFromPass = reachable;
- reachable = true;
- localVariableTypes = afterTestLvarTypes;
- if(!isAlwaysTrue(test) && fail != null) {
+ // If we get here, then we need to consider the case where pass block is not executed
+ assert !isTestAlwaysTrue;
+
+ if (fail != null) {
fail.accept(this);
assertTypeStackIsEmpty();
- final boolean reachableFromFail = reachable;
- reachable |= reachableFromPass;
- if(!reachable) {
- return false;
- }
-
- if(reachableFromFail) {
- if(reachableFromPass) {
- final Map<Symbol, LvarType> failLvarTypes = localVariableTypes;
- localVariableTypes = getUnionTypes(passLvarTypes, failLvarTypes);
- setConversion(pass, passLvarTypes, localVariableTypes);
- setConversion(fail, failLvarTypes, localVariableTypes);
- }
- return false;
- }
}
- if(reachableFromPass) {
- localVariableTypes = getUnionTypes(afterTestLvarTypes, passLvarTypes);
- // IfNode itself is associated with conversions that might need to be performed after the test if there's no
- // else branch. E.g.
- // if(x = 1, cond) { x = 1.0 } must widen "x = 1" to a double.
- setConversion(pass, passLvarTypes, localVariableTypes);
- setConversion(ifNode, afterTestLvarTypes, localVariableTypes);
- } else {
- localVariableTypes = afterTestLvarTypes;
+ if(reachable) {
+ if(reachableFromPass) {
+ final Map<Symbol, LvarType> failLvarTypes = localVariableTypes;
+ localVariableTypes = getUnionTypes(passLvarTypes, failLvarTypes);
+ setConversion(pass, passLvarTypes, localVariableTypes);
+ // IfNode itself is associated with conversions that might need to be performed after the test if
+ // there's no else branch. E.g.
+ // if(x = 1, cond) { x = 1.0 } must widen "x = 1" to a double.
+ setConversion(fail != null ? fail : ifNode, failLvarTypes, localVariableTypes);
+ }
+ } else if (reachableFromPass) {
+ assert passLvarTypes != null;
+ localVariableTypes = passLvarTypes;
+ reachable = true;
}
-
- return false;
}
@Override
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
index b7f95aa..03594c4 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
@@ -45,6 +45,7 @@
import jdk.nashorn.internal.ir.CallNode;
import jdk.nashorn.internal.ir.CaseNode;
import jdk.nashorn.internal.ir.CatchNode;
+import jdk.nashorn.internal.ir.DebuggerNode;
import jdk.nashorn.internal.ir.ContinueNode;
import jdk.nashorn.internal.ir.EmptyNode;
import jdk.nashorn.internal.ir.Expression;
@@ -185,6 +186,15 @@
}
@Override
+ public boolean enterDebuggerNode(final DebuggerNode debuggerNode) {
+ final int line = debuggerNode.getLineNumber();
+ final long token = debuggerNode.getToken();
+ final int finish = debuggerNode.getFinish();
+ addStatement(new ExpressionStatement(line, token, finish, new RuntimeNode(token, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Expression>())));
+ return false;
+ }
+
+ @Override
public boolean enterJumpToInlinedFinally(final JumpToInlinedFinally jumpToInlinedFinally) {
addStatement(jumpToInlinedFinally);
return false;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
index 1bec86f..ae96dc4 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
@@ -100,15 +100,16 @@
for (final MapTuple<T> tuple : tuples) {
final String key = tuple.key;
final Symbol symbol = tuple.symbol;
+ final Class<?> initialType = tuple.getValueType();
- //TODO initial type is object here no matter what. Is that right?
if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
final int flags = getPropertyFlags(symbol, hasArguments, false);
properties.add(
new SpillProperty(
key,
flags,
- spillIndex++));
+ spillIndex++,
+ initialType));
}
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
index a5a5cf6..2205044 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
@@ -56,6 +56,7 @@
import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.runtime.AccessorProperty;
+import jdk.nashorn.internal.runtime.AllocationStrategy;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.FunctionScope;
import jdk.nashorn.internal.runtime.JSType;
@@ -826,44 +827,13 @@
}
/**
- * Describes the allocator class name and property map for a constructor function with the specified
+ * Creates the allocator class name and property map for a constructor function with the specified
* number of "this" properties that it initializes.
- *
+ * @param thisProperties number of properties assigned to "this"
+ * @return the allocation strategy
*/
- public static class AllocatorDescriptor {
- private final String allocatorClassName;
- private final PropertyMap allocatorMap;
-
- /**
- * Creates a new allocator descriptor
- * @param thisProperties the number of "this" properties that the function initializes
- */
- public AllocatorDescriptor(final int thisProperties) {
- final int paddedFieldCount = getPaddedFieldCount(thisProperties);
- this.allocatorClassName = Compiler.binaryName(getClassName(paddedFieldCount));
- this.allocatorMap = PropertyMap.newMap(null, allocatorClassName, 0, paddedFieldCount, 0);
- }
-
- /**
- * Returns the name of the class that the function allocates
- * @return the name of the class that the function allocates
- */
- public String getAllocatorClassName() {
- return allocatorClassName;
- }
-
- /**
- * Returns the allocator map for the function.
- * @return the allocator map for the function.
- */
- public PropertyMap getAllocatorMap() {
- return allocatorMap;
- }
-
- @Override
- public String toString() {
- return "AllocatorDescriptor[allocatorClassName=" + allocatorClassName + ", allocatorMap.size=" +
- allocatorMap.size() + "]";
- }
+ static AllocationStrategy createAllocationStrategy(final int thisProperties) {
+ final int paddedFieldCount = getPaddedFieldCount(thisProperties);
+ return new AllocationStrategy(paddedFieldCount);
}
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java
index c68dba2..98b1efba 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java
@@ -56,7 +56,7 @@
/** Break label. */
private final Label breakLabel;
- /** Does the block/function need a new scope? */
+ /** Does the block/function need a new scope? Is this synthetic? */
protected final int flags;
/**
@@ -80,6 +80,11 @@
public static final int IS_GLOBAL_SCOPE = 1 << 3;
/**
+ * Is this block a synthetic one introduced by Parser?
+ */
+ public static final int IS_SYNTHETIC = 1 << 4;
+
+ /**
* Constructor
*
* @param token The first token of the block
@@ -108,7 +113,7 @@
* @param statements All statements in the block
*/
public Block(final long token, final int finish, final Statement...statements){
- this(token, finish, 0, statements);
+ this(token, finish, IS_SYNTHETIC, statements);
}
/**
@@ -119,7 +124,7 @@
* @param statements All statements in the block
*/
public Block(final long token, final int finish, final List<Statement> statements){
- this(token, finish, 0, statements);
+ this(token, finish, IS_SYNTHETIC, statements);
}
/**
@@ -366,6 +371,15 @@
return (flags & NEEDS_SCOPE) == NEEDS_SCOPE;
}
+ /**
+ * Check whether this block is synthetic or not.
+ *
+ * @return true if this is a synthetic block
+ */
+ public boolean isSynthetic() {
+ return (flags & IS_SYNTHETIC) == IS_SYNTHETIC;
+ }
+
@Override
public Block setFlags(final LexicalContext lc, final int flags) {
if (this.flags == flags) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java
index 3a7c810..8f077e8 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java
@@ -90,6 +90,15 @@
return block.isTerminal();
}
+ /**
+ * Tells if this is a synthetic block statement or not.
+ *
+ * @return true if this is a synthetic statement
+ */
+ public boolean isSynthetic() {
+ return block.isSynthetic();
+ }
+
@Override
public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
if (visitor.enterBlockStatement(this)) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/DebuggerNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/DebuggerNode.java
new file mode 100644
index 0000000..70df838
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/DebuggerNode.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.ir;
+
+import jdk.nashorn.internal.ir.annotations.Immutable;
+import jdk.nashorn.internal.ir.visitor.NodeVisitor;
+
+/**
+ * IR representation for a debugger statement.
+ */
+@Immutable
+public final class DebuggerNode extends Statement {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor
+ *
+ * @param lineNumber line number
+ * @param token token
+ * @param finish finish
+ */
+ public DebuggerNode(final int lineNumber, final long token, final int finish) {
+ super(lineNumber, token, finish);
+ }
+
+ @Override
+ public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
+ if (visitor.enterDebuggerNode(this)) {
+ return visitor.leaveDebuggerNode(this);
+ }
+
+ return this;
+ }
+
+ @Override
+ public void toString(final StringBuilder sb, final boolean printType) {
+ sb.append("debugger");
+ }
+}
+
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ErrorNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ErrorNode.java
new file mode 100644
index 0000000..c8ba0e8
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ErrorNode.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.ir;
+
+import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
+import jdk.nashorn.internal.ir.visitor.NodeVisitor;
+
+/**
+ * IR representation for an error expression.
+ */
+@Immutable
+public final class ErrorNode extends Expression {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor
+ *
+ * @param token token
+ * @param finish finish
+ */
+ public ErrorNode(final long token, final int finish) {
+ super(token, finish);
+ }
+
+ @Override
+ public Type getType() {
+ return Type.OBJECT;
+ }
+
+ @Override
+ public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
+ if (visitor.enterErrorNode(this)) {
+ return visitor.leaveErrorNode(this);
+ }
+
+ return this;
+ }
+
+ @Override
+ public void toString(final StringBuilder sb, final boolean printType) {
+ sb.append("<error>");
+ }
+}
+
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java
index f2a9003..9588ca1 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java
@@ -181,6 +181,28 @@
}
/**
+ * Test if the value is an array
+ *
+ * @return True if value is an array
+ */
+ public boolean isArray() {
+ return false;
+ }
+
+ public List<Expression> getElementExpressions() {
+ return null;
+ }
+
+ /**
+ * Test if the value is a boolean.
+ *
+ * @return True if value is a boolean.
+ */
+ public boolean isBoolean() {
+ return value instanceof Boolean;
+ }
+
+ /**
* Test if the value is a string.
*
* @return True if value is a string.
@@ -607,6 +629,12 @@
/** Sub units with indexes ranges, in which to split up code generation, for large literals */
private final List<ArrayUnit> units;
+ @Override
+ public boolean isArray() {
+ return true;
+ }
+
+
/**
* An ArrayUnit is a range in an ArrayLiteral. ArrayLiterals can
* be split if they are too large, for bytecode generation reasons
@@ -834,6 +862,7 @@
* null.
* @return a list of array element expressions.
*/
+ @Override
public List<Expression> getElementExpressions() {
return Collections.unmodifiableList(Arrays.asList(value));
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java
index 9cee46f..098bc38 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java
@@ -38,6 +38,7 @@
import jdk.nashorn.internal.ir.CaseNode;
import jdk.nashorn.internal.ir.CatchNode;
import jdk.nashorn.internal.ir.ContinueNode;
+import jdk.nashorn.internal.ir.DebuggerNode;
import jdk.nashorn.internal.ir.EmptyNode;
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.ExpressionStatement;
@@ -289,6 +290,13 @@
}
@Override
+ public boolean enterDebuggerNode(final DebuggerNode debuggerNode) {
+ enterDefault(debuggerNode);
+ type("DebuggerStatement");
+ return leave();
+ }
+
+ @Override
public boolean enterEmptyNode(final EmptyNode emptyNode) {
enterDefault(emptyNode);
@@ -302,7 +310,7 @@
// handle debugger statement
final Node expression = expressionStatement.getExpression();
if (expression instanceof RuntimeNode) {
- expression.accept(this);
+ assert false : "should not reach here: RuntimeNode";
return false;
}
@@ -319,14 +327,18 @@
@Override
public boolean enterBlockStatement(final BlockStatement blockStatement) {
+ if (blockStatement.isSynthetic()) {
+ final Block blk = blockStatement.getBlock();
+ blk.getStatements().get(0).accept(this);
+ return false;
+ }
+
enterDefault(blockStatement);
type("BlockStatement");
comma();
- property("block");
- blockStatement.getBlock().accept(this);
-
+ array("body", blockStatement.getBlock().getStatements());
return leave();
}
@@ -677,19 +689,13 @@
@Override
public boolean enterRuntimeNode(final RuntimeNode runtimeNode) {
- final RuntimeNode.Request req = runtimeNode.getRequest();
-
- if (req == RuntimeNode.Request.DEBUGGER) {
- enterDefault(runtimeNode);
- type("DebuggerStatement");
- return leave();
- }
-
+ assert false : "should not reach here: RuntimeNode";
return false;
}
@Override
public boolean enterSplitNode(final SplitNode splitNode) {
+ assert false : "should not reach here: SplitNode";
return false;
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/visitor/NodeVisitor.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/visitor/NodeVisitor.java
index 28022b1..adee367 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/visitor/NodeVisitor.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/visitor/NodeVisitor.java
@@ -34,7 +34,9 @@
import jdk.nashorn.internal.ir.CaseNode;
import jdk.nashorn.internal.ir.CatchNode;
import jdk.nashorn.internal.ir.ContinueNode;
+import jdk.nashorn.internal.ir.DebuggerNode;
import jdk.nashorn.internal.ir.EmptyNode;
+import jdk.nashorn.internal.ir.ErrorNode;
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
@@ -293,6 +295,27 @@
return leaveDefault(continueNode);
}
+
+ /**
+ * Callback for entering a DebuggerNode
+ *
+ * @param debuggerNode the node
+ * @return true if traversal should continue and node children be traversed, false otherwise
+ */
+ public boolean enterDebuggerNode(final DebuggerNode debuggerNode) {
+ return enterDefault(debuggerNode);
+ }
+
+ /**
+ * Callback for leaving a DebuggerNode
+ *
+ * @param debuggerNode the node
+ * @return processed node, which will replace the original one, or the original node
+ */
+ public Node leaveDebuggerNode(final DebuggerNode debuggerNode) {
+ return leaveDefault(debuggerNode);
+ }
+
/**
* Callback for entering an EmptyNode
*
@@ -314,6 +337,26 @@
}
/**
+ * Callback for entering an ErrorNode
+ *
+ * @param errorNode the node
+ * @return true if traversal should continue and node children be traversed, false otherwise
+ */
+ public boolean enterErrorNode(final ErrorNode errorNode) {
+ return enterDefault(errorNode);
+ }
+
+ /**
+ * Callback for leaving an ErrorNode
+ *
+ * @param errorNode the node
+ * @return processed node, which will replace the original one, or the original node
+ */
+ public Node leaveErrorNode(final ErrorNode errorNode) {
+ return leaveDefault(errorNode);
+ }
+
+ /**
* Callback for entering an ExpressionStatement
*
* @param expressionStatement the node
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
index cc263e2..ecf3c2e 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
@@ -305,7 +305,7 @@
final ScriptFunction typeErrorThrower = global.getTypeErrorThrower();
if (findProperty("arguments", true) != null) {
initUserAccessors("arguments", Property.NOT_CONFIGURABLE | Property.NOT_ENUMERABLE, typeErrorThrower, typeErrorThrower);
- }
+ }
if (findProperty("caller", true) != null) {
initUserAccessors("caller", Property.NOT_CONFIGURABLE | Property.NOT_ENUMERABLE, typeErrorThrower, typeErrorThrower);
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java
index f1f46ea..5243818 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java
@@ -244,20 +244,15 @@
private static PropertyMap addObjectProperty(final PropertyMap propertyMap, final List<Object> values,
final String id, final Object value) {
final Property oldProperty = propertyMap.findProperty(id);
- final Property newProperty;
final PropertyMap newMap;
final Class<?> type = ObjectClassGenerator.OBJECT_FIELDS_ONLY ? Object.class : getType(value);
if (oldProperty != null) {
values.set(oldProperty.getSlot(), value);
- newProperty = new SpillProperty(id, 0, oldProperty.getSlot());
- newProperty.setType(type);
- newMap = propertyMap.replaceProperty(oldProperty, newProperty);;
+ newMap = propertyMap.replaceProperty(oldProperty, new SpillProperty(id, 0, oldProperty.getSlot(), type));;
} else {
values.add(value);
- newProperty = new SpillProperty(id, 0, propertyMap.size());
- newProperty.setType(type);
- newMap = propertyMap.addProperty(newProperty);
+ newMap = propertyMap.addProperty(new SpillProperty(id, 0, propertyMap.size(), type));
}
return newMap;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
index 2806f79..66fe395 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
@@ -77,7 +77,9 @@
import jdk.nashorn.internal.ir.CaseNode;
import jdk.nashorn.internal.ir.CatchNode;
import jdk.nashorn.internal.ir.ContinueNode;
+import jdk.nashorn.internal.ir.DebuggerNode;
import jdk.nashorn.internal.ir.EmptyNode;
+import jdk.nashorn.internal.ir.ErrorNode;
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
@@ -356,7 +358,8 @@
restoreBlock(body);
body.setFlag(Block.NEEDS_SCOPE);
- final Block functionBody = new Block(functionToken, source.getLength() - 1, body.getFlags(), body.getStatements());
+ final Block functionBody = new Block(functionToken, source.getLength() - 1,
+ body.getFlags() | Block.IS_SYNTHETIC, body.getStatements());
lc.pop(function);
expect(EOF);
@@ -540,7 +543,8 @@
expect(RBRACE);
}
- return new Block(blockToken, finish, newBlock.getFlags(), newBlock.getStatements());
+ final int flags = newBlock.getFlags() | (needsBraces? 0 : Block.IS_SYNTHETIC);
+ return new Block(blockToken, finish, flags, newBlock.getStatements());
}
@@ -559,7 +563,7 @@
} finally {
restoreBlock(newBlock);
}
- return new Block(newBlock.getToken(), finish, newBlock.getFlags(), newBlock.getStatements());
+ return new Block(newBlock.getToken(), finish, newBlock.getFlags() | Block.IS_SYNTHETIC, newBlock.getStatements());
}
/**
@@ -712,7 +716,7 @@
restoreBlock(body);
body.setFlag(Block.NEEDS_SCOPE);
- final Block programBody = new Block(functionToken, functionLine, body.getFlags(), body.getStatements());
+ final Block programBody = new Block(functionToken, functionLine, body.getFlags() | Block.IS_SYNTHETIC, body.getStatements());
lc.pop(script);
script.setLastToken(token);
@@ -826,8 +830,13 @@
}
}
} catch (final Exception e) {
+ final int errorLine = line;
+ final long errorToken = token;
//recover parsing
recover(e);
+ final ErrorNode errorExpr = new ErrorNode(errorToken, finish);
+ final ExpressionStatement expressionStatement = new ExpressionStatement(errorLine, errorToken, finish, errorExpr);
+ appendStatement(expressionStatement);
}
// No backtracking from here on.
@@ -1853,7 +1862,7 @@
appendStatement(catchNode);
} finally {
restoreBlock(catchBlock);
- catchBlocks.add(new Block(catchBlock.getToken(), finish, catchBlock.getFlags(), catchBlock.getStatements()));
+ catchBlocks.add(new Block(catchBlock.getToken(), finish, catchBlock.getFlags() | Block.IS_SYNTHETIC, catchBlock.getStatements()));
}
// If unconditional catch then should to be the end.
@@ -1883,7 +1892,7 @@
restoreBlock(outer);
}
- appendStatement(new BlockStatement(startLine, new Block(tryToken, finish, outer.getFlags(), outer.getStatements())));
+ appendStatement(new BlockStatement(startLine, new Block(tryToken, finish, outer.getFlags() | Block.IS_SYNTHETIC, outer.getStatements())));
}
/**
@@ -1901,7 +1910,7 @@
// DEBUGGER tested in caller.
next();
endOfLine();
- appendStatement(new ExpressionStatement(debuggerLine, debuggerToken, finish, new RuntimeNode(debuggerToken, finish, RuntimeNode.Request.DEBUGGER, Collections.<Expression>emptyList())));
+ appendStatement(new DebuggerNode(debuggerLine, debuggerToken, finish));
}
/**
@@ -2882,7 +2891,6 @@
Block functionBody;
int bodyFinish = 0;
-
final boolean parseBody;
Object endParserState = null;
try {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java
index e4d6ccb..395aee5 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java
@@ -29,55 +29,52 @@
import java.io.Serializable;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
+import jdk.nashorn.internal.codegen.Compiler;
import jdk.nashorn.internal.codegen.CompilerConstants;
-import jdk.nashorn.internal.codegen.ObjectClassGenerator.AllocatorDescriptor;
+import jdk.nashorn.internal.codegen.ObjectClassGenerator;
/**
- * Encapsulates the allocation strategy for a function when used as a constructor. Basically the same as
- * {@link AllocatorDescriptor}, but with an additionally cached resolved method handle. There is also a
- * canonical default allocation strategy for functions that don't assign any "this" properties (vast majority
- * of all functions), therefore saving some storage space in {@link RecompilableScriptFunctionData} that would
- * otherwise be lost to identical tuples of (map, className, handle) fields.
+ * Encapsulates the allocation strategy for a function when used as a constructor.
*/
-final class AllocationStrategy implements Serializable {
+final public class AllocationStrategy implements Serializable {
private static final long serialVersionUID = 1L;
private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
- private static final AllocationStrategy DEFAULT_STRATEGY = new AllocationStrategy(new AllocatorDescriptor(0));
-
- /** Allocator map from allocator descriptor */
- private final PropertyMap allocatorMap;
+ /** Number of fields in the allocated object */
+ private final int fieldCount;
/** Name of class where allocator function resides */
- private final String allocatorClassName;
+ private transient String allocatorClassName;
/** lazily generated allocator */
private transient MethodHandle allocator;
- private AllocationStrategy(final AllocatorDescriptor desc) {
- this.allocatorMap = desc.getAllocatorMap();
- // These classes get loaded, so an interned variant of their name is most likely around anyway.
- this.allocatorClassName = desc.getAllocatorClassName().intern();
+ /**
+ * Construct an allocation strategy with the given map and class name.
+ * @param fieldCount number of fields in the allocated object
+ */
+ public AllocationStrategy(final int fieldCount) {
+ this.fieldCount = fieldCount;
}
- private boolean matches(final AllocatorDescriptor desc) {
- return desc.getAllocatorMap().size() == allocatorMap.size() &&
- desc.getAllocatorClassName().equals(allocatorClassName);
- }
-
- static AllocationStrategy get(final AllocatorDescriptor desc) {
- return DEFAULT_STRATEGY.matches(desc) ? DEFAULT_STRATEGY : new AllocationStrategy(desc);
+ private String getAllocatorClassName() {
+ if (allocatorClassName == null) {
+ // These classes get loaded, so an interned variant of their name is most likely around anyway.
+ allocatorClassName = Compiler.binaryName(ObjectClassGenerator.getClassName(fieldCount)).intern();
+ }
+ return allocatorClassName;
}
PropertyMap getAllocatorMap() {
- return allocatorMap;
+ // Create a new map for each function instance
+ return PropertyMap.newMap(null, getAllocatorClassName(), 0, fieldCount, 0);
}
ScriptObject allocate(final PropertyMap map) {
try {
if (allocator == null) {
- allocator = MH.findStatic(LOOKUP, Context.forStructureClass(allocatorClassName),
+ allocator = MH.findStatic(LOOKUP, Context.forStructureClass(getAllocatorClassName()),
CompilerConstants.ALLOCATE.symbolName(), MH.type(ScriptObject.class, PropertyMap.class));
}
return (ScriptObject)allocator.invokeExact(map);
@@ -88,17 +85,8 @@
}
}
- private Object readResolve() {
- if(allocatorMap.size() == DEFAULT_STRATEGY.allocatorMap.size() &&
- allocatorClassName.equals(DEFAULT_STRATEGY.allocatorClassName)) {
- return DEFAULT_STRATEGY;
- }
- return this;
- }
-
@Override
public String toString() {
- return "AllocationStrategy[allocatorClassName=" + allocatorClassName + ", allocatorMap.size=" +
- allocatorMap.size() + "]";
+ return "AllocationStrategy[fieldCount=" + fieldCount + "]";
}
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java
index ce20ed3..8dee00e 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java
@@ -27,6 +27,7 @@
import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid;
+
import java.lang.invoke.CallSite;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -594,7 +595,7 @@
* switchpoint has been invalidated by a {@code RewriteException} triggered on another thread for this function.
* This is not a problem, though, as these switch points are always used to produce call sites that fall back to
* relinking when they are invalidated, and in this case the execution will end up here again. What this method
- * basically does is minimize such busy-loop relinking while the function is being recompiled on a different thread.
+ * basically does is reduce such busy-loop relinking while the function is being recompiled on a different thread.
* @param invocationSupplier the supplier that constructs the actual invocation method handle; should use the
* {@code CompiledFunction} method itself in some capacity.
* @return a tuple object containing the method handle as created by the supplier and an optimistic assumptions
@@ -602,20 +603,27 @@
* function can't be further deoptimized).
*/
private synchronized HandleAndAssumptions getValidOptimisticInvocation(final Supplier<MethodHandle> invocationSupplier) {
- for(;;) {
+ for(int i = 0; i < 2; ++i) {
final MethodHandle handle = invocationSupplier.get();
final SwitchPoint assumptions = canBeDeoptimized() ? optimismInfo.optimisticAssumptions : null;
- if(assumptions != null && assumptions.hasBeenInvalidated()) {
+ if(i == 0 && assumptions != null && assumptions.hasBeenInvalidated()) {
// We can be in a situation where one thread is in the middle of a deoptimizing compilation when we hit
// this and thus, it has invalidated the old switch point, but hasn't created the new one yet. Note that
// the behavior of invalidating the old switch point before recompilation, and only creating the new one
- // after recompilation is by design. If we didn't wait here for the recompilation to complete, we would
- // be busy looping through the fallback path of the invalidated switch point, relinking the call site
- // again with the same invalidated switch point, invoking the fallback, etc. stealing CPU cycles from
- // the recompilation task we're dependent on. This can still happen if the switch point gets invalidated
- // after we grabbed it here, in which case we'll indeed do one busy relink immediately.
+ // after recompilation is by design. If we didn't wait here, we would be busy looping through the
+ // fallback path of the invalidated switch point, relinking the call site again with the same
+ // invalidated switch point, invoking the fallback, etc. stealing CPU cycles from the recompilation
+ // task we're dependent on. This can still happen if the switch point gets invalidated after we grabbed
+ // it here, in which case we'll indeed do one busy relink immediately.
+ // On the other hand, in order to avoid a rare livelock, we aren't doing an infinite loop, and we
+ // aren't wait()-ing indefinitely. We'll do at most one, at most 1000ms long wait after which we'll
+ // return the current handle even if it's invalidated (and which'll then trigger one loop through the
+ // relink mechanism). We therefore strike a balance between busy looping and a livelock risk by making
+ // sure that there's at most one iteration of busy loop per second. It is theoretically possible to
+ // correctly implement this without ever risking a livelock, but using this heuristic we eliminate the
+ // chance of the livelock, while still maintaining a good enough busy-looping prevention.
try {
- wait();
+ wait(1000L);
} catch (final InterruptedException e) {
// Intentionally ignored. There's nothing meaningful we can do if we're interrupted
}
@@ -623,6 +631,7 @@
return new HandleAndAssumptions(handle, assumptions);
}
}
+ throw new AssertionError(); // never reached
}
private static void relinkComposableInvoker(final CallSite cs, final CompiledFunction inv, final boolean constructor) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
index 06414ed..c65b031 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
@@ -43,7 +43,6 @@
import jdk.nashorn.internal.codegen.CompilerConstants;
import jdk.nashorn.internal.codegen.FunctionSignature;
import jdk.nashorn.internal.codegen.Namespace;
-import jdk.nashorn.internal.codegen.ObjectClassGenerator.AllocatorDescriptor;
import jdk.nashorn.internal.codegen.OptimisticTypesPersistence;
import jdk.nashorn.internal.codegen.TypeMap;
import jdk.nashorn.internal.codegen.types.Type;
@@ -126,7 +125,7 @@
*
* @param functionNode functionNode that represents this function code
* @param installer installer for code regeneration versions of this function
- * @param allocationDescriptor descriptor for the allocation behavior when this function is used as a constructor
+ * @param allocationStrategy strategy for the allocation behavior when this function is used as a constructor
* @param nestedFunctions nested function map
* @param externalScopeDepths external scope depths
* @param internalSymbols internal symbols to method, defined in its scope
@@ -135,7 +134,7 @@
public RecompilableScriptFunctionData(
final FunctionNode functionNode,
final CodeInstaller<ScriptEnvironment> installer,
- final AllocatorDescriptor allocationDescriptor,
+ final AllocationStrategy allocationStrategy,
final Map<Integer, RecompilableScriptFunctionData> nestedFunctions,
final Map<String, Integer> externalScopeDepths,
final Set<String> internalSymbols,
@@ -153,7 +152,7 @@
this.endParserState = functionNode.getEndParserState();
this.token = tokenFor(functionNode);
this.installer = installer;
- this.allocationStrategy = AllocationStrategy.get(allocationDescriptor);
+ this.allocationStrategy = allocationStrategy;
this.nestedFunctions = smallMap(nestedFunctions);
this.externalScopeDepths = smallMap(externalScopeDepths);
this.internalSymbols = smallSet(new HashSet<>(internalSymbols));
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java
index d999c11..c3e6a4a 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java
@@ -143,7 +143,6 @@
this.data = data;
this.scope = scope;
- this.allocatorMap = data.getAllocatorMap();
}
@Override
@@ -253,7 +252,7 @@
assert !isBoundFunction(); // allocate never invoked on bound functions
- final ScriptObject object = data.allocate(allocatorMap);
+ final ScriptObject object = data.allocate(getAllocatorMap());
if (object != null) {
final Object prototype = getPrototype();
@@ -269,6 +268,13 @@
return object;
}
+ private PropertyMap getAllocatorMap() {
+ if (allocatorMap == null) {
+ allocatorMap = data.getAllocatorMap();
+ }
+ return allocatorMap;
+ }
+
/**
* Return Object.prototype - used by "allocate"
* @return Object.prototype
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java
index 38d4b85..502063b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java
@@ -484,6 +484,30 @@
* Constructor
*
* @param name source name
+ * @param path path from which source can be loaded
+ *
+ * @return source instance
+ *
+ * @throws IOException if source cannot be loaded
+ */
+ public static Source sourceFor(final String name, final Path path) throws IOException {
+ File file = null;
+ try {
+ file = path.toFile();
+ } catch (final UnsupportedOperationException uoe) {
+ }
+
+ if (file != null) {
+ return sourceFor(name, file);
+ } else {
+ return sourceFor(name, Files.newBufferedReader(path));
+ }
+ }
+
+ /**
+ * Constructor
+ *
+ * @param name source name
* @param file file from which source can be loaded
* @param cs Charset used to convert bytes to chars
*
@@ -601,7 +625,7 @@
/**
* Get explicit source URL.
- * @return URL set vial sourceURL directive
+ * @return URL set via sourceURL directive
*/
public String getExplicitURL() {
return explicitURL;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
index 7b42b2b..856504a 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
@@ -164,7 +164,14 @@
assert !OBJECT_FIELDS_ONLY || getLocalType() == Object.class;
}
- SpillProperty(final String key, final int flags, final int slot, final Class<?> initialType) {
+ /**
+ * Constructor for spill properties with an initial type.
+ * @param key the property key
+ * @param flags the property flags
+ * @param slot spill slot
+ * @param initialType initial type
+ */
+ public SpillProperty(final String key, final int flags, final int slot, final Class<?> initialType) {
this(key, flags, slot);
setType(OBJECT_FIELDS_ONLY ? Object.class : initialType);
}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java
index 6cb68ab..374e8f3 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java
@@ -429,6 +429,7 @@
while (!argList.isEmpty()) {
final String arg = argList.remove(0);
+ Objects.requireNonNull(arg);
// skip empty args
if (arg.isEmpty()) {
diff --git a/nashorn/test/script/basic/JDK-8074545.js b/nashorn/test/script/basic/JDK-8074545.js
new file mode 100644
index 0000000..e2ea38c
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8074545.js
@@ -0,0 +1,1038 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8074545: Undefined object values in object literals with spill properties
+ *
+ * @test
+ * @run
+ */
+
+var obj = {
+ "p0": { "x" : 0 },
+ "p1": { "x" : 1 },
+ "p2": { "x" : 2 },
+ "p3": { "x" : 3 },
+ "p4": { "x" : 4 },
+ "p5": { "x" : 5 },
+ "p6": { "x" : 6 },
+ "p7": { "x" : 7 },
+ "p8": { "x" : 8 },
+ "p9": { "x" : 9 },
+ "p10": { "x" : 10 },
+ "p11": { "x" : 11 },
+ "p12": { "x" : 12 },
+ "p13": { "x" : 13 },
+ "p14": { "x" : 14 },
+ "p15": { "x" : 15 },
+ "p16": { "x" : 16 },
+ "p17": { "x" : 17 },
+ "p18": { "x" : 18 },
+ "p19": { "x" : 19 },
+ "p20": { "x" : 20 },
+ "p21": { "x" : 21 },
+ "p22": { "x" : 22 },
+ "p23": { "x" : 23 },
+ "p24": { "x" : 24 },
+ "p25": { "x" : 25 },
+ "p26": { "x" : 26 },
+ "p27": { "x" : 27 },
+ "p28": { "x" : 28 },
+ "p29": { "x" : 29 },
+ "p30": { "x" : 30 },
+ "p31": { "x" : 31 },
+ "p32": { "x" : 32 },
+ "p33": { "x" : 33 },
+ "p34": { "x" : 34 },
+ "p35": { "x" : 35 },
+ "p36": { "x" : 36 },
+ "p37": { "x" : 37 },
+ "p38": { "x" : 38 },
+ "p39": { "x" : 39 },
+ "p40": { "x" : 40 },
+ "p41": { "x" : 41 },
+ "p42": { "x" : 42 },
+ "p43": { "x" : 43 },
+ "p44": { "x" : 44 },
+ "p45": { "x" : 45 },
+ "p46": { "x" : 46 },
+ "p47": { "x" : 47 },
+ "p48": { "x" : 48 },
+ "p49": { "x" : 49 },
+ "p50": { "x" : 50 },
+ "p51": { "x" : 51 },
+ "p52": { "x" : 52 },
+ "p53": { "x" : 53 },
+ "p54": { "x" : 54 },
+ "p55": { "x" : 55 },
+ "p56": { "x" : 56 },
+ "p57": { "x" : 57 },
+ "p58": { "x" : 58 },
+ "p59": { "x" : 59 },
+ "p60": { "x" : 60 },
+ "p61": { "x" : 61 },
+ "p62": { "x" : 62 },
+ "p63": { "x" : 63 },
+ "p64": { "x" : 64 },
+ "p65": { "x" : 65 },
+ "p66": { "x" : 66 },
+ "p67": { "x" : 67 },
+ "p68": { "x" : 68 },
+ "p69": { "x" : 69 },
+ "p70": { "x" : 70 },
+ "p71": { "x" : 71 },
+ "p72": { "x" : 72 },
+ "p73": { "x" : 73 },
+ "p74": { "x" : 74 },
+ "p75": { "x" : 75 },
+ "p76": { "x" : 76 },
+ "p77": { "x" : 77 },
+ "p78": { "x" : 78 },
+ "p79": { "x" : 79 },
+ "p80": { "x" : 80 },
+ "p81": { "x" : 81 },
+ "p82": { "x" : 82 },
+ "p83": { "x" : 83 },
+ "p84": { "x" : 84 },
+ "p85": { "x" : 85 },
+ "p86": { "x" : 86 },
+ "p87": { "x" : 87 },
+ "p88": { "x" : 88 },
+ "p89": { "x" : 89 },
+ "p90": { "x" : 90 },
+ "p91": { "x" : 91 },
+ "p92": { "x" : 92 },
+ "p93": { "x" : 93 },
+ "p94": { "x" : 94 },
+ "p95": { "x" : 95 },
+ "p96": { "x" : 96 },
+ "p97": { "x" : 97 },
+ "p98": { "x" : 98 },
+ "p99": { "x" : 99 },
+ "p100": { "x" : 100 },
+ "p101": { "x" : 101 },
+ "p102": { "x" : 102 },
+ "p103": { "x" : 103 },
+ "p104": { "x" : 104 },
+ "p105": { "x" : 105 },
+ "p106": { "x" : 106 },
+ "p107": { "x" : 107 },
+ "p108": { "x" : 108 },
+ "p109": { "x" : 109 },
+ "p110": { "x" : 110 },
+ "p111": { "x" : 111 },
+ "p112": { "x" : 112 },
+ "p113": { "x" : 113 },
+ "p114": { "x" : 114 },
+ "p115": { "x" : 115 },
+ "p116": { "x" : 116 },
+ "p117": { "x" : 117 },
+ "p118": { "x" : 118 },
+ "p119": { "x" : 119 },
+ "p120": { "x" : 120 },
+ "p121": { "x" : 121 },
+ "p122": { "x" : 122 },
+ "p123": { "x" : 123 },
+ "p124": { "x" : 124 },
+ "p125": { "x" : 125 },
+ "p126": { "x" : 126 },
+ "p127": { "x" : 127 },
+ "p128": { "x" : 128 },
+ "p129": { "x" : 129 },
+ "p130": { "x" : 130 },
+ "p131": { "x" : 131 },
+ "p132": { "x" : 132 },
+ "p133": { "x" : 133 },
+ "p134": { "x" : 134 },
+ "p135": { "x" : 135 },
+ "p136": { "x" : 136 },
+ "p137": { "x" : 137 },
+ "p138": { "x" : 138 },
+ "p139": { "x" : 139 },
+ "p140": { "x" : 140 },
+ "p141": { "x" : 141 },
+ "p142": { "x" : 142 },
+ "p143": { "x" : 143 },
+ "p144": { "x" : 144 },
+ "p145": { "x" : 145 },
+ "p146": { "x" : 146 },
+ "p147": { "x" : 147 },
+ "p148": { "x" : 148 },
+ "p149": { "x" : 149 },
+ "p150": { "x" : 150 },
+ "p151": { "x" : 151 },
+ "p152": { "x" : 152 },
+ "p153": { "x" : 153 },
+ "p154": { "x" : 154 },
+ "p155": { "x" : 155 },
+ "p156": { "x" : 156 },
+ "p157": { "x" : 157 },
+ "p158": { "x" : 158 },
+ "p159": { "x" : 159 },
+ "p160": { "x" : 160 },
+ "p161": { "x" : 161 },
+ "p162": { "x" : 162 },
+ "p163": { "x" : 163 },
+ "p164": { "x" : 164 },
+ "p165": { "x" : 165 },
+ "p166": { "x" : 166 },
+ "p167": { "x" : 167 },
+ "p168": { "x" : 168 },
+ "p169": { "x" : 169 },
+ "p170": { "x" : 170 },
+ "p171": { "x" : 171 },
+ "p172": { "x" : 172 },
+ "p173": { "x" : 173 },
+ "p174": { "x" : 174 },
+ "p175": { "x" : 175 },
+ "p176": { "x" : 176 },
+ "p177": { "x" : 177 },
+ "p178": { "x" : 178 },
+ "p179": { "x" : 179 },
+ "p180": { "x" : 180 },
+ "p181": { "x" : 181 },
+ "p182": { "x" : 182 },
+ "p183": { "x" : 183 },
+ "p184": { "x" : 184 },
+ "p185": { "x" : 185 },
+ "p186": { "x" : 186 },
+ "p187": { "x" : 187 },
+ "p188": { "x" : 188 },
+ "p189": { "x" : 189 },
+ "p190": { "x" : 190 },
+ "p191": { "x" : 191 },
+ "p192": { "x" : 192 },
+ "p193": { "x" : 193 },
+ "p194": { "x" : 194 },
+ "p195": { "x" : 195 },
+ "p196": { "x" : 196 },
+ "p197": { "x" : 197 },
+ "p198": { "x" : 198 },
+ "p199": { "x" : 199 },
+ "p200": { "x" : 200 },
+ "p201": { "x" : 201 },
+ "p202": { "x" : 202 },
+ "p203": { "x" : 203 },
+ "p204": { "x" : 204 },
+ "p205": { "x" : 205 },
+ "p206": { "x" : 206 },
+ "p207": { "x" : 207 },
+ "p208": { "x" : 208 },
+ "p209": { "x" : 209 },
+ "p210": { "x" : 210 },
+ "p211": { "x" : 211 },
+ "p212": { "x" : 212 },
+ "p213": { "x" : 213 },
+ "p214": { "x" : 214 },
+ "p215": { "x" : 215 },
+ "p216": { "x" : 216 },
+ "p217": { "x" : 217 },
+ "p218": { "x" : 218 },
+ "p219": { "x" : 219 },
+ "p220": { "x" : 220 },
+ "p221": { "x" : 221 },
+ "p222": { "x" : 222 },
+ "p223": { "x" : 223 },
+ "p224": { "x" : 224 },
+ "p225": { "x" : 225 },
+ "p226": { "x" : 226 },
+ "p227": { "x" : 227 },
+ "p228": { "x" : 228 },
+ "p229": { "x" : 229 },
+ "p230": { "x" : 230 },
+ "p231": { "x" : 231 },
+ "p232": { "x" : 232 },
+ "p233": { "x" : 233 },
+ "p234": { "x" : 234 },
+ "p235": { "x" : 235 },
+ "p236": { "x" : 236 },
+ "p237": { "x" : 237 },
+ "p238": { "x" : 238 },
+ "p239": { "x" : 239 },
+ "p240": { "x" : 240 },
+ "p241": { "x" : 241 },
+ "p242": { "x" : 242 },
+ "p243": { "x" : 243 },
+ "p244": { "x" : 244 },
+ "p245": { "x" : 245 },
+ "p246": { "x" : 246 },
+ "p247": { "x" : 247 },
+ "p248": { "x" : 248 },
+ "p249": { "x" : 249 },
+ "p250": { "x" : 250 },
+ "p251": { "x" : 251 },
+ "p252": { "x" : 252 },
+ "p253": { "x" : 253 },
+ "p254": { "x" : 254 },
+ "p255": { "x" : 255 },
+ "p256": { "x" : 256 },
+ "p257": { "x" : 257 },
+ "p258": { "x" : 258 },
+ "p259": { "x" : 259 },
+ "p260": { "x" : 260 },
+ "p261": { "x" : 261 },
+ "p262": { "x" : 262 },
+ "p263": { "x" : 263 },
+ "p264": { "x" : 264 },
+ "p265": { "x" : 265 },
+ "p266": { "x" : 266 },
+ "p267": { "x" : 267 },
+ "p268": { "x" : 268 },
+ "p269": { "x" : 269 },
+ "p270": { "x" : 270 },
+ "p271": { "x" : 271 },
+ "p272": { "x" : 272 },
+ "p273": { "x" : 273 },
+ "p274": { "x" : 274 },
+ "p275": { "x" : 275 },
+ "p276": { "x" : 276 },
+ "p277": { "x" : 277 },
+ "p278": { "x" : 278 },
+ "p279": { "x" : 279 },
+ "p280": { "x" : 280 },
+ "p281": { "x" : 281 },
+ "p282": { "x" : 282 },
+ "p283": { "x" : 283 },
+ "p284": { "x" : 284 },
+ "p285": { "x" : 285 },
+ "p286": { "x" : 286 },
+ "p287": { "x" : 287 },
+ "p288": { "x" : 288 },
+ "p289": { "x" : 289 },
+ "p290": { "x" : 290 },
+ "p291": { "x" : 291 },
+ "p292": { "x" : 292 },
+ "p293": { "x" : 293 },
+ "p294": { "x" : 294 },
+ "p295": { "x" : 295 },
+ "p296": { "x" : 296 },
+ "p297": { "x" : 297 },
+ "p298": { "x" : 298 },
+ "p299": { "x" : 299 },
+ "p300": { "x" : 300 },
+ "p301": { "x" : 301 },
+ "p302": { "x" : 302 },
+ "p303": { "x" : 303 },
+ "p304": { "x" : 304 },
+ "p305": { "x" : 305 },
+ "p306": { "x" : 306 },
+ "p307": { "x" : 307 },
+ "p308": { "x" : 308 },
+ "p309": { "x" : 309 },
+ "p310": { "x" : 310 },
+ "p311": { "x" : 311 },
+ "p312": { "x" : 312 },
+ "p313": { "x" : 313 },
+ "p314": { "x" : 314 },
+ "p315": { "x" : 315 },
+ "p316": { "x" : 316 },
+ "p317": { "x" : 317 },
+ "p318": { "x" : 318 },
+ "p319": { "x" : 319 },
+ "p320": { "x" : 320 },
+ "p321": { "x" : 321 },
+ "p322": { "x" : 322 },
+ "p323": { "x" : 323 },
+ "p324": { "x" : 324 },
+ "p325": { "x" : 325 },
+ "p326": { "x" : 326 },
+ "p327": { "x" : 327 },
+ "p328": { "x" : 328 },
+ "p329": { "x" : 329 },
+ "p330": { "x" : 330 },
+ "p331": { "x" : 331 },
+ "p332": { "x" : 332 },
+ "p333": { "x" : 333 },
+ "p334": { "x" : 334 },
+ "p335": { "x" : 335 },
+ "p336": { "x" : 336 },
+ "p337": { "x" : 337 },
+ "p338": { "x" : 338 },
+ "p339": { "x" : 339 },
+ "p340": { "x" : 340 },
+ "p341": { "x" : 341 },
+ "p342": { "x" : 342 },
+ "p343": { "x" : 343 },
+ "p344": { "x" : 344 },
+ "p345": { "x" : 345 },
+ "p346": { "x" : 346 },
+ "p347": { "x" : 347 },
+ "p348": { "x" : 348 },
+ "p349": { "x" : 349 },
+ "p350": { "x" : 350 },
+ "p351": { "x" : 351 },
+ "p352": { "x" : 352 },
+ "p353": { "x" : 353 },
+ "p354": { "x" : 354 },
+ "p355": { "x" : 355 },
+ "p356": { "x" : 356 },
+ "p357": { "x" : 357 },
+ "p358": { "x" : 358 },
+ "p359": { "x" : 359 },
+ "p360": { "x" : 360 },
+ "p361": { "x" : 361 },
+ "p362": { "x" : 362 },
+ "p363": { "x" : 363 },
+ "p364": { "x" : 364 },
+ "p365": { "x" : 365 },
+ "p366": { "x" : 366 },
+ "p367": { "x" : 367 },
+ "p368": { "x" : 368 },
+ "p369": { "x" : 369 },
+ "p370": { "x" : 370 },
+ "p371": { "x" : 371 },
+ "p372": { "x" : 372 },
+ "p373": { "x" : 373 },
+ "p374": { "x" : 374 },
+ "p375": { "x" : 375 },
+ "p376": { "x" : 376 },
+ "p377": { "x" : 377 },
+ "p378": { "x" : 378 },
+ "p379": { "x" : 379 },
+ "p380": { "x" : 380 },
+ "p381": { "x" : 381 },
+ "p382": { "x" : 382 },
+ "p383": { "x" : 383 },
+ "p384": { "x" : 384 },
+ "p385": { "x" : 385 },
+ "p386": { "x" : 386 },
+ "p387": { "x" : 387 },
+ "p388": { "x" : 388 },
+ "p389": { "x" : 389 },
+ "p390": { "x" : 390 },
+ "p391": { "x" : 391 },
+ "p392": { "x" : 392 },
+ "p393": { "x" : 393 },
+ "p394": { "x" : 394 },
+ "p395": { "x" : 395 },
+ "p396": { "x" : 396 },
+ "p397": { "x" : 397 },
+ "p398": { "x" : 398 },
+ "p399": { "x" : 399 },
+ "p400": { "x" : 400 },
+ "p401": { "x" : 401 },
+ "p402": { "x" : 402 },
+ "p403": { "x" : 403 },
+ "p404": { "x" : 404 },
+ "p405": { "x" : 405 },
+ "p406": { "x" : 406 },
+ "p407": { "x" : 407 },
+ "p408": { "x" : 408 },
+ "p409": { "x" : 409 },
+ "p410": { "x" : 410 },
+ "p411": { "x" : 411 },
+ "p412": { "x" : 412 },
+ "p413": { "x" : 413 },
+ "p414": { "x" : 414 },
+ "p415": { "x" : 415 },
+ "p416": { "x" : 416 },
+ "p417": { "x" : 417 },
+ "p418": { "x" : 418 },
+ "p419": { "x" : 419 },
+ "p420": { "x" : 420 },
+ "p421": { "x" : 421 },
+ "p422": { "x" : 422 },
+ "p423": { "x" : 423 },
+ "p424": { "x" : 424 },
+ "p425": { "x" : 425 },
+ "p426": { "x" : 426 },
+ "p427": { "x" : 427 },
+ "p428": { "x" : 428 },
+ "p429": { "x" : 429 },
+ "p430": { "x" : 430 },
+ "p431": { "x" : 431 },
+ "p432": { "x" : 432 },
+ "p433": { "x" : 433 },
+ "p434": { "x" : 434 },
+ "p435": { "x" : 435 },
+ "p436": { "x" : 436 },
+ "p437": { "x" : 437 },
+ "p438": { "x" : 438 },
+ "p439": { "x" : 439 },
+ "p440": { "x" : 440 },
+ "p441": { "x" : 441 },
+ "p442": { "x" : 442 },
+ "p443": { "x" : 443 },
+ "p444": { "x" : 444 },
+ "p445": { "x" : 445 },
+ "p446": { "x" : 446 },
+ "p447": { "x" : 447 },
+ "p448": { "x" : 448 },
+ "p449": { "x" : 449 },
+ "p450": { "x" : 450 },
+ "p451": { "x" : 451 },
+ "p452": { "x" : 452 },
+ "p453": { "x" : 453 },
+ "p454": { "x" : 454 },
+ "p455": { "x" : 455 },
+ "p456": { "x" : 456 },
+ "p457": { "x" : 457 },
+ "p458": { "x" : 458 },
+ "p459": { "x" : 459 },
+ "p460": { "x" : 460 },
+ "p461": { "x" : 461 },
+ "p462": { "x" : 462 },
+ "p463": { "x" : 463 },
+ "p464": { "x" : 464 },
+ "p465": { "x" : 465 },
+ "p466": { "x" : 466 },
+ "p467": { "x" : 467 },
+ "p468": { "x" : 468 },
+ "p469": { "x" : 469 },
+ "p470": { "x" : 470 },
+ "p471": { "x" : 471 },
+ "p472": { "x" : 472 },
+ "p473": { "x" : 473 },
+ "p474": { "x" : 474 },
+ "p475": { "x" : 475 },
+ "p476": { "x" : 476 },
+ "p477": { "x" : 477 },
+ "p478": { "x" : 478 },
+ "p479": { "x" : 479 },
+ "p480": { "x" : 480 },
+ "p481": { "x" : 481 },
+ "p482": { "x" : 482 },
+ "p483": { "x" : 483 },
+ "p484": { "x" : 484 },
+ "p485": { "x" : 485 },
+ "p486": { "x" : 486 },
+ "p487": { "x" : 487 },
+ "p488": { "x" : 488 },
+ "p489": { "x" : 489 },
+ "p490": { "x" : 490 },
+ "p491": { "x" : 491 },
+ "p492": { "x" : 492 },
+ "p493": { "x" : 493 },
+ "p494": { "x" : 494 },
+ "p495": { "x" : 495 },
+ "p496": { "x" : 496 },
+ "p497": { "x" : 497 },
+ "p498": { "x" : 498 },
+ "p499": { "x" : 499 },
+ "p500": { "x" : 500 },
+ "p501": { "x" : 501 },
+ "p502": { "x" : 502 },
+ "p503": { "x" : 503 },
+ "p504": { "x" : 504 },
+ "p505": { "x" : 505 },
+ "p506": { "x" : 506 },
+ "p507": { "x" : 507 },
+ "p508": { "x" : 508 },
+ "p509": { "x" : 509 },
+ "p510": { "x" : 510 },
+ "p511": { "x" : 511 },
+ "p512": { "x" : 512 },
+ "p513": { "x" : 513 },
+ "p514": { "x" : 514 },
+ "p515": { "x" : 515 },
+ "p516": { "x" : 516 },
+ "p517": { "x" : 517 },
+ "p518": { "x" : 518 },
+ "p519": { "x" : 519 },
+ "p520": { "x" : 520 },
+ "p521": { "x" : 521 },
+ "p522": { "x" : 522 },
+ "p523": { "x" : 523 },
+ "p524": { "x" : 524 },
+ "p525": { "x" : 525 },
+ "p526": { "x" : 526 },
+ "p527": { "x" : 527 },
+ "p528": { "x" : 528 },
+ "p529": { "x" : 529 },
+ "p530": { "x" : 530 },
+ "p531": { "x" : 531 },
+ "p532": { "x" : 532 },
+ "p533": { "x" : 533 },
+ "p534": { "x" : 534 },
+ "p535": { "x" : 535 },
+ "p536": { "x" : 536 },
+ "p537": { "x" : 537 },
+ "p538": { "x" : 538 },
+ "p539": { "x" : 539 },
+ "p540": { "x" : 540 },
+ "p541": { "x" : 541 },
+ "p542": { "x" : 542 },
+ "p543": { "x" : 543 },
+ "p544": { "x" : 544 },
+ "p545": { "x" : 545 },
+ "p546": { "x" : 546 },
+ "p547": { "x" : 547 },
+ "p548": { "x" : 548 },
+ "p549": { "x" : 549 },
+ "p550": { "x" : 550 },
+ "p551": { "x" : 551 },
+ "p552": { "x" : 552 },
+ "p553": { "x" : 553 },
+ "p554": { "x" : 554 },
+ "p555": { "x" : 555 },
+ "p556": { "x" : 556 },
+ "p557": { "x" : 557 },
+ "p558": { "x" : 558 },
+ "p559": { "x" : 559 },
+ "p560": { "x" : 560 },
+ "p561": { "x" : 561 },
+ "p562": { "x" : 562 },
+ "p563": { "x" : 563 },
+ "p564": { "x" : 564 },
+ "p565": { "x" : 565 },
+ "p566": { "x" : 566 },
+ "p567": { "x" : 567 },
+ "p568": { "x" : 568 },
+ "p569": { "x" : 569 },
+ "p570": { "x" : 570 },
+ "p571": { "x" : 571 },
+ "p572": { "x" : 572 },
+ "p573": { "x" : 573 },
+ "p574": { "x" : 574 },
+ "p575": { "x" : 575 },
+ "p576": { "x" : 576 },
+ "p577": { "x" : 577 },
+ "p578": { "x" : 578 },
+ "p579": { "x" : 579 },
+ "p580": { "x" : 580 },
+ "p581": { "x" : 581 },
+ "p582": { "x" : 582 },
+ "p583": { "x" : 583 },
+ "p584": { "x" : 584 },
+ "p585": { "x" : 585 },
+ "p586": { "x" : 586 },
+ "p587": { "x" : 587 },
+ "p588": { "x" : 588 },
+ "p589": { "x" : 589 },
+ "p590": { "x" : 590 },
+ "p591": { "x" : 591 },
+ "p592": { "x" : 592 },
+ "p593": { "x" : 593 },
+ "p594": { "x" : 594 },
+ "p595": { "x" : 595 },
+ "p596": { "x" : 596 },
+ "p597": { "x" : 597 },
+ "p598": { "x" : 598 },
+ "p599": { "x" : 599 },
+ "p600": { "x" : 600 },
+ "p601": { "x" : 601 },
+ "p602": { "x" : 602 },
+ "p603": { "x" : 603 },
+ "p604": { "x" : 604 },
+ "p605": { "x" : 605 },
+ "p606": { "x" : 606 },
+ "p607": { "x" : 607 },
+ "p608": { "x" : 608 },
+ "p609": { "x" : 609 },
+ "p610": { "x" : 610 },
+ "p611": { "x" : 611 },
+ "p612": { "x" : 612 },
+ "p613": { "x" : 613 },
+ "p614": { "x" : 614 },
+ "p615": { "x" : 615 },
+ "p616": { "x" : 616 },
+ "p617": { "x" : 617 },
+ "p618": { "x" : 618 },
+ "p619": { "x" : 619 },
+ "p620": { "x" : 620 },
+ "p621": { "x" : 621 },
+ "p622": { "x" : 622 },
+ "p623": { "x" : 623 },
+ "p624": { "x" : 624 },
+ "p625": { "x" : 625 },
+ "p626": { "x" : 626 },
+ "p627": { "x" : 627 },
+ "p628": { "x" : 628 },
+ "p629": { "x" : 629 },
+ "p630": { "x" : 630 },
+ "p631": { "x" : 631 },
+ "p632": { "x" : 632 },
+ "p633": { "x" : 633 },
+ "p634": { "x" : 634 },
+ "p635": { "x" : 635 },
+ "p636": { "x" : 636 },
+ "p637": { "x" : 637 },
+ "p638": { "x" : 638 },
+ "p639": { "x" : 639 },
+ "p640": { "x" : 640 },
+ "p641": { "x" : 641 },
+ "p642": { "x" : 642 },
+ "p643": { "x" : 643 },
+ "p644": { "x" : 644 },
+ "p645": { "x" : 645 },
+ "p646": { "x" : 646 },
+ "p647": { "x" : 647 },
+ "p648": { "x" : 648 },
+ "p649": { "x" : 649 },
+ "p650": { "x" : 650 },
+ "p651": { "x" : 651 },
+ "p652": { "x" : 652 },
+ "p653": { "x" : 653 },
+ "p654": { "x" : 654 },
+ "p655": { "x" : 655 },
+ "p656": { "x" : 656 },
+ "p657": { "x" : 657 },
+ "p658": { "x" : 658 },
+ "p659": { "x" : 659 },
+ "p660": { "x" : 660 },
+ "p661": { "x" : 661 },
+ "p662": { "x" : 662 },
+ "p663": { "x" : 663 },
+ "p664": { "x" : 664 },
+ "p665": { "x" : 665 },
+ "p666": { "x" : 666 },
+ "p667": { "x" : 667 },
+ "p668": { "x" : 668 },
+ "p669": { "x" : 669 },
+ "p670": { "x" : 670 },
+ "p671": { "x" : 671 },
+ "p672": { "x" : 672 },
+ "p673": { "x" : 673 },
+ "p674": { "x" : 674 },
+ "p675": { "x" : 675 },
+ "p676": { "x" : 676 },
+ "p677": { "x" : 677 },
+ "p678": { "x" : 678 },
+ "p679": { "x" : 679 },
+ "p680": { "x" : 680 },
+ "p681": { "x" : 681 },
+ "p682": { "x" : 682 },
+ "p683": { "x" : 683 },
+ "p684": { "x" : 684 },
+ "p685": { "x" : 685 },
+ "p686": { "x" : 686 },
+ "p687": { "x" : 687 },
+ "p688": { "x" : 688 },
+ "p689": { "x" : 689 },
+ "p690": { "x" : 690 },
+ "p691": { "x" : 691 },
+ "p692": { "x" : 692 },
+ "p693": { "x" : 693 },
+ "p694": { "x" : 694 },
+ "p695": { "x" : 695 },
+ "p696": { "x" : 696 },
+ "p697": { "x" : 697 },
+ "p698": { "x" : 698 },
+ "p699": { "x" : 699 },
+ "p700": { "x" : 700 },
+ "p701": { "x" : 701 },
+ "p702": { "x" : 702 },
+ "p703": { "x" : 703 },
+ "p704": { "x" : 704 },
+ "p705": { "x" : 705 },
+ "p706": { "x" : 706 },
+ "p707": { "x" : 707 },
+ "p708": { "x" : 708 },
+ "p709": { "x" : 709 },
+ "p710": { "x" : 710 },
+ "p711": { "x" : 711 },
+ "p712": { "x" : 712 },
+ "p713": { "x" : 713 },
+ "p714": { "x" : 714 },
+ "p715": { "x" : 715 },
+ "p716": { "x" : 716 },
+ "p717": { "x" : 717 },
+ "p718": { "x" : 718 },
+ "p719": { "x" : 719 },
+ "p720": { "x" : 720 },
+ "p721": { "x" : 721 },
+ "p722": { "x" : 722 },
+ "p723": { "x" : 723 },
+ "p724": { "x" : 724 },
+ "p725": { "x" : 725 },
+ "p726": { "x" : 726 },
+ "p727": { "x" : 727 },
+ "p728": { "x" : 728 },
+ "p729": { "x" : 729 },
+ "p730": { "x" : 730 },
+ "p731": { "x" : 731 },
+ "p732": { "x" : 732 },
+ "p733": { "x" : 733 },
+ "p734": { "x" : 734 },
+ "p735": { "x" : 735 },
+ "p736": { "x" : 736 },
+ "p737": { "x" : 737 },
+ "p738": { "x" : 738 },
+ "p739": { "x" : 739 },
+ "p740": { "x" : 740 },
+ "p741": { "x" : 741 },
+ "p742": { "x" : 742 },
+ "p743": { "x" : 743 },
+ "p744": { "x" : 744 },
+ "p745": { "x" : 745 },
+ "p746": { "x" : 746 },
+ "p747": { "x" : 747 },
+ "p748": { "x" : 748 },
+ "p749": { "x" : 749 },
+ "p750": { "x" : 750 },
+ "p751": { "x" : 751 },
+ "p752": { "x" : 752 },
+ "p753": { "x" : 753 },
+ "p754": { "x" : 754 },
+ "p755": { "x" : 755 },
+ "p756": { "x" : 756 },
+ "p757": { "x" : 757 },
+ "p758": { "x" : 758 },
+ "p759": { "x" : 759 },
+ "p760": { "x" : 760 },
+ "p761": { "x" : 761 },
+ "p762": { "x" : 762 },
+ "p763": { "x" : 763 },
+ "p764": { "x" : 764 },
+ "p765": { "x" : 765 },
+ "p766": { "x" : 766 },
+ "p767": { "x" : 767 },
+ "p768": { "x" : 768 },
+ "p769": { "x" : 769 },
+ "p770": { "x" : 770 },
+ "p771": { "x" : 771 },
+ "p772": { "x" : 772 },
+ "p773": { "x" : 773 },
+ "p774": { "x" : 774 },
+ "p775": { "x" : 775 },
+ "p776": { "x" : 776 },
+ "p777": { "x" : 777 },
+ "p778": { "x" : 778 },
+ "p779": { "x" : 779 },
+ "p780": { "x" : 780 },
+ "p781": { "x" : 781 },
+ "p782": { "x" : 782 },
+ "p783": { "x" : 783 },
+ "p784": { "x" : 784 },
+ "p785": { "x" : 785 },
+ "p786": { "x" : 786 },
+ "p787": { "x" : 787 },
+ "p788": { "x" : 788 },
+ "p789": { "x" : 789 },
+ "p790": { "x" : 790 },
+ "p791": { "x" : 791 },
+ "p792": { "x" : 792 },
+ "p793": { "x" : 793 },
+ "p794": { "x" : 794 },
+ "p795": { "x" : 795 },
+ "p796": { "x" : 796 },
+ "p797": { "x" : 797 },
+ "p798": { "x" : 798 },
+ "p799": { "x" : 799 },
+ "p800": { "x" : 800 },
+ "p801": { "x" : 801 },
+ "p802": { "x" : 802 },
+ "p803": { "x" : 803 },
+ "p804": { "x" : 804 },
+ "p805": { "x" : 805 },
+ "p806": { "x" : 806 },
+ "p807": { "x" : 807 },
+ "p808": { "x" : 808 },
+ "p809": { "x" : 809 },
+ "p810": { "x" : 810 },
+ "p811": { "x" : 811 },
+ "p812": { "x" : 812 },
+ "p813": { "x" : 813 },
+ "p814": { "x" : 814 },
+ "p815": { "x" : 815 },
+ "p816": { "x" : 816 },
+ "p817": { "x" : 817 },
+ "p818": { "x" : 818 },
+ "p819": { "x" : 819 },
+ "p820": { "x" : 820 },
+ "p821": { "x" : 821 },
+ "p822": { "x" : 822 },
+ "p823": { "x" : 823 },
+ "p824": { "x" : 824 },
+ "p825": { "x" : 825 },
+ "p826": { "x" : 826 },
+ "p827": { "x" : 827 },
+ "p828": { "x" : 828 },
+ "p829": { "x" : 829 },
+ "p830": { "x" : 830 },
+ "p831": { "x" : 831 },
+ "p832": { "x" : 832 },
+ "p833": { "x" : 833 },
+ "p834": { "x" : 834 },
+ "p835": { "x" : 835 },
+ "p836": { "x" : 836 },
+ "p837": { "x" : 837 },
+ "p838": { "x" : 838 },
+ "p839": { "x" : 839 },
+ "p840": { "x" : 840 },
+ "p841": { "x" : 841 },
+ "p842": { "x" : 842 },
+ "p843": { "x" : 843 },
+ "p844": { "x" : 844 },
+ "p845": { "x" : 845 },
+ "p846": { "x" : 846 },
+ "p847": { "x" : 847 },
+ "p848": { "x" : 848 },
+ "p849": { "x" : 849 },
+ "p850": { "x" : 850 },
+ "p851": { "x" : 851 },
+ "p852": { "x" : 852 },
+ "p853": { "x" : 853 },
+ "p854": { "x" : 854 },
+ "p855": { "x" : 855 },
+ "p856": { "x" : 856 },
+ "p857": { "x" : 857 },
+ "p858": { "x" : 858 },
+ "p859": { "x" : 859 },
+ "p860": { "x" : 860 },
+ "p861": { "x" : 861 },
+ "p862": { "x" : 862 },
+ "p863": { "x" : 863 },
+ "p864": { "x" : 864 },
+ "p865": { "x" : 865 },
+ "p866": { "x" : 866 },
+ "p867": { "x" : 867 },
+ "p868": { "x" : 868 },
+ "p869": { "x" : 869 },
+ "p870": { "x" : 870 },
+ "p871": { "x" : 871 },
+ "p872": { "x" : 872 },
+ "p873": { "x" : 873 },
+ "p874": { "x" : 874 },
+ "p875": { "x" : 875 },
+ "p876": { "x" : 876 },
+ "p877": { "x" : 877 },
+ "p878": { "x" : 878 },
+ "p879": { "x" : 879 },
+ "p880": { "x" : 880 },
+ "p881": { "x" : 881 },
+ "p882": { "x" : 882 },
+ "p883": { "x" : 883 },
+ "p884": { "x" : 884 },
+ "p885": { "x" : 885 },
+ "p886": { "x" : 886 },
+ "p887": { "x" : 887 },
+ "p888": { "x" : 888 },
+ "p889": { "x" : 889 },
+ "p890": { "x" : 890 },
+ "p891": { "x" : 891 },
+ "p892": { "x" : 892 },
+ "p893": { "x" : 893 },
+ "p894": { "x" : 894 },
+ "p895": { "x" : 895 },
+ "p896": { "x" : 896 },
+ "p897": { "x" : 897 },
+ "p898": { "x" : 898 },
+ "p899": { "x" : 899 },
+ "p900": { "x" : 900 },
+ "p901": { "x" : 901 },
+ "p902": { "x" : 902 },
+ "p903": { "x" : 903 },
+ "p904": { "x" : 904 },
+ "p905": { "x" : 905 },
+ "p906": { "x" : 906 },
+ "p907": { "x" : 907 },
+ "p908": { "x" : 908 },
+ "p909": { "x" : 909 },
+ "p910": { "x" : 910 },
+ "p911": { "x" : 911 },
+ "p912": { "x" : 912 },
+ "p913": { "x" : 913 },
+ "p914": { "x" : 914 },
+ "p915": { "x" : 915 },
+ "p916": { "x" : 916 },
+ "p917": { "x" : 917 },
+ "p918": { "x" : 918 },
+ "p919": { "x" : 919 },
+ "p920": { "x" : 920 },
+ "p921": { "x" : 921 },
+ "p922": { "x" : 922 },
+ "p923": { "x" : 923 },
+ "p924": { "x" : 924 },
+ "p925": { "x" : 925 },
+ "p926": { "x" : 926 },
+ "p927": { "x" : 927 },
+ "p928": { "x" : 928 },
+ "p929": { "x" : 929 },
+ "p930": { "x" : 930 },
+ "p931": { "x" : 931 },
+ "p932": { "x" : 932 },
+ "p933": { "x" : 933 },
+ "p934": { "x" : 934 },
+ "p935": { "x" : 935 },
+ "p936": { "x" : 936 },
+ "p937": { "x" : 937 },
+ "p938": { "x" : 938 },
+ "p939": { "x" : 939 },
+ "p940": { "x" : 940 },
+ "p941": { "x" : 941 },
+ "p942": { "x" : 942 },
+ "p943": { "x" : 943 },
+ "p944": { "x" : 944 },
+ "p945": { "x" : 945 },
+ "p946": { "x" : 946 },
+ "p947": { "x" : 947 },
+ "p948": { "x" : 948 },
+ "p949": { "x" : 949 },
+ "p950": { "x" : 950 },
+ "p951": { "x" : 951 },
+ "p952": { "x" : 952 },
+ "p953": { "x" : 953 },
+ "p954": { "x" : 954 },
+ "p955": { "x" : 955 },
+ "p956": { "x" : 956 },
+ "p957": { "x" : 957 },
+ "p958": { "x" : 958 },
+ "p959": { "x" : 959 },
+ "p960": { "x" : 960 },
+ "p961": { "x" : 961 },
+ "p962": { "x" : 962 },
+ "p963": { "x" : 963 },
+ "p964": { "x" : 964 },
+ "p965": { "x" : 965 },
+ "p966": { "x" : 966 },
+ "p967": { "x" : 967 },
+ "p968": { "x" : 968 },
+ "p969": { "x" : 969 },
+ "p970": { "x" : 970 },
+ "p971": { "x" : 971 },
+ "p972": { "x" : 972 },
+ "p973": { "x" : 973 },
+ "p974": { "x" : 974 },
+ "p975": { "x" : 975 },
+ "p976": { "x" : 976 },
+ "p977": { "x" : 977 },
+ "p978": { "x" : 978 },
+ "p979": { "x" : 979 },
+ "p980": { "x" : 980 },
+ "p981": { "x" : 981 },
+ "p982": { "x" : 982 },
+ "p983": { "x" : 983 },
+ "p984": { "x" : 984 },
+ "p985": { "x" : 985 },
+ "p986": { "x" : 986 },
+ "p987": { "x" : 987 },
+ "p988": { "x" : 988 },
+ "p989": { "x" : 989 },
+ "p990": { "x" : 990 },
+ "p991": { "x" : 991 },
+ "p992": { "x" : 992 },
+ "p993": { "x" : 993 },
+ "p994": { "x" : 994 },
+ "p995": { "x" : 995 },
+ "p996": { "x" : 996 },
+ "p997": { "x" : 997 },
+ "p998": { "x" : 998 },
+ "p999": { "x" : 999 }
+};
+
+for (var i = 0; i < 1000; i++) {
+ var value = obj["p" + i];
+ Assert.assertTrue(typeof value === "object");
+ Assert.assertTrue(value.x === i);
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/basic/JDK-8074556.js
similarity index 65%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/basic/JDK-8074556.js
index d24a6e7..e3fb0d9 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/basic/JDK-8074556.js
@@ -1,30 +1,52 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * JDK-8074556: Functions should not share allocator maps
+ *
+ * @test
+ * @run
*/
-public class C {
+
+function A () {
+ return this;
}
+
+function B() {
+ return this;
+}
+
+A.prototype.x = "x";
+A.prototype.y = "y";
+B.prototype.y = "y"; // same properties but different order
+B.prototype.x = "x";
+
+function test(o) {
+ Assert.assertEquals(o.x, "x");
+ Assert.assertEquals(o.y, "y");
+}
+
+test(new A());
+test(new B());
+test(new A());
+test(new B());
diff --git a/nashorn/test/script/basic/JDK-8074687.js b/nashorn/test/script/basic/JDK-8074687.js
new file mode 100644
index 0000000..9f67b24
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8074687.js
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8074687: Add tests for JSON parsing of numeric keys
+ *
+ * @test
+ * @run
+ */
+
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {} }')), '{"0":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1 }')), '{"0":1}');
+
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": {} }')), '{"65503":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": 1 }')), '{"65503":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "65503": {} }')), '{"0":{},"65503":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "65503": 1 }')), '{"0":1,"65503":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": {}, "0": {} }')), '{"0":{},"65503":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": 1, "0": 1 }')), '{"0":1,"65503":1}');
+
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": {} }')), '{"4294967295":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": 1 }')), '{"4294967295":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "4294967295": {} }')), '{"0":{},"4294967295":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "4294967295": 1 }')), '{"0":1,"4294967295":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": {}, "0": {} }')), '{"0":{},"4294967295":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": 1, "0": 1 }')), '{"0":1,"4294967295":1}');
+
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": {} }')), '{"100":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": 1 }')), '{"100":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "100": {} }')), '{"0":{},"100":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "100": 1 }')), '{"0":1,"100":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": {}, "0": {} }')), '{"0":{},"100":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": 1, "0": 1 }')), '{"0":1,"100":1}');
+
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": {} }')), '{"-100":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": 1 }')), '{"-100":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "-100": {} }')), '{"0":{},"-100":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "-100": 1 }')), '{"0":1,"-100":1}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": {}, "0": {} }')), '{"0":{},"-100":{}}');
+Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": 1, "0": 1 }')), '{"0":1,"-100":1}');
diff --git a/nashorn/test/script/basic/JDK-8074693.js b/nashorn/test/script/basic/JDK-8074693.js
new file mode 100644
index 0000000..111f21c
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8074693.js
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8074693: Different instances of same function use same allocator map
+ *
+ * @test
+ * @run
+ */
+
+var lib = {};
+
+lib.mixin = function(target, source) {
+ for (var p in source) {
+ if (source.hasOwnProperty(p) && !target.hasOwnProperty(p)) {
+ target.prototype[p] = source[p];
+ }
+ }
+};
+
+lib.declare = function(def) {
+ var className = def.name;
+
+ lib[className] = function() {
+ this.init.apply(this, arguments);
+ };
+
+ lib.mixin(lib[className], def.members);
+};
+
+
+lib.declare({
+ name: "ClassA",
+ members: {
+ init : function () {
+ print("init A called");
+ }
+ }
+});
+
+lib.declare({
+ name: "ClassB",
+ members: {
+ util : function () {
+ print("util called")
+ },
+ init : function() {
+ print("init B called");
+ }
+ }
+});
+
+var objA = new lib.ClassA();
+var objB = new lib.ClassB();
diff --git a/nashorn/test/script/basic/JDK-8074693.js.EXPECTED b/nashorn/test/script/basic/JDK-8074693.js.EXPECTED
new file mode 100644
index 0000000..42fb74c
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8074693.js.EXPECTED
@@ -0,0 +1,2 @@
+init A called
+init B called
diff --git a/nashorn/test/script/basic/parser/tryCatchStat.js.EXPECTED b/nashorn/test/script/basic/parser/tryCatchStat.js.EXPECTED
index 16075e1..cd3470c 100644
--- a/nashorn/test/script/basic/parser/tryCatchStat.js.EXPECTED
+++ b/nashorn/test/script/basic/parser/tryCatchStat.js.EXPECTED
@@ -2,31 +2,51 @@
"type": "Program",
"body": [
{
- "type": "BlockStatement",
+ "type": "TryStatement",
"block": {
"type": "BlockStatement",
- "body": [
- {
- "type": "TryStatement",
- "block": {
- "type": "BlockStatement",
- "body": []
- },
- "guardedHandlers": [],
- "handler": {
- "type": "CatchClause",
- "param": {
- "type": "Identifier",
- "name": "e"
- },
- "body": {
- "type": "BlockStatement",
- "body": []
- }
- },
- "finalizer": null
- }
- ]
+ "body": []
+ },
+ "guardedHandlers": [],
+ "handler": {
+ "type": "CatchClause",
+ "param": {
+ "type": "Identifier",
+ "name": "e"
+ },
+ "body": {
+ "type": "BlockStatement",
+ "body": []
+ }
+ },
+ "finalizer": null
+ }
+ ]
+}
+{
+ "type": "Program",
+ "body": [
+ {
+ "type": "TryStatement",
+ "block": {
+ "type": "BlockStatement",
+ "body": []
+ },
+ "guardedHandlers": [],
+ "handler": {
+ "type": "CatchClause",
+ "param": {
+ "type": "Identifier",
+ "name": "e"
+ },
+ "body": {
+ "type": "BlockStatement",
+ "body": []
+ }
+ },
+ "finalizer": {
+ "type": "BlockStatement",
+ "body": []
}
}
]
@@ -35,34 +55,16 @@
"type": "Program",
"body": [
{
- "type": "BlockStatement",
+ "type": "TryStatement",
"block": {
"type": "BlockStatement",
- "body": [
- {
- "type": "TryStatement",
- "block": {
- "type": "BlockStatement",
- "body": []
- },
- "guardedHandlers": [],
- "handler": {
- "type": "CatchClause",
- "param": {
- "type": "Identifier",
- "name": "e"
- },
- "body": {
- "type": "BlockStatement",
- "body": []
- }
- },
- "finalizer": {
- "type": "BlockStatement",
- "body": []
- }
- }
- ]
+ "body": []
+ },
+ "guardedHandlers": [],
+ "handler": null,
+ "finalizer": {
+ "type": "BlockStatement",
+ "body": []
}
}
]
@@ -71,235 +73,185 @@
"type": "Program",
"body": [
{
- "type": "BlockStatement",
+ "type": "TryStatement",
"block": {
"type": "BlockStatement",
- "body": [
- {
- "type": "TryStatement",
- "block": {
- "type": "BlockStatement",
- "body": []
- },
- "guardedHandlers": [],
- "handler": null,
- "finalizer": {
- "type": "BlockStatement",
- "body": []
- }
- }
- ]
- }
- }
- ]
-}
-{
- "type": "Program",
- "body": [
- {
- "type": "BlockStatement",
- "block": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "TryStatement",
- "block": {
- "type": "BlockStatement",
- "body": []
- },
- "guardedHandlers": [],
- "handler": {
- "type": "CatchClause",
- "param": {
- "type": "Identifier",
- "name": "e"
- },
- "body": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "ExpressionStatement",
- "expression": {
- "type": "CallExpression",
- "callee": {
- "type": "Identifier",
- "name": "handle"
- },
- "arguments": []
- }
- }
- ]
- }
- },
- "finalizer": null
- }
- ]
- }
- }
- ]
-}
-{
- "type": "Program",
- "body": [
- {
- "type": "BlockStatement",
- "block": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "TryStatement",
- "block": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "ExpressionStatement",
- "expression": {
- "type": "CallExpression",
- "callee": {
- "type": "Identifier",
- "name": "that"
- },
- "arguments": []
- }
- }
- ]
- },
- "guardedHandlers": [],
- "handler": {
- "type": "CatchClause",
- "param": {
- "type": "Identifier",
- "name": "e"
- },
- "body": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "ExpressionStatement",
- "expression": {
- "type": "CallExpression",
- "callee": {
- "type": "Identifier",
- "name": "handle"
- },
- "arguments": []
- }
- }
- ]
- }
- },
- "finalizer": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "ExpressionStatement",
- "expression": {
- "type": "CallExpression",
- "callee": {
- "type": "Identifier",
- "name": "clean"
- },
- "arguments": []
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
-}
-{
- "type": "Program",
- "body": [
- {
- "type": "BlockStatement",
- "block": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "TryStatement",
- "block": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "ExpressionStatement",
- "expression": {
- "type": "CallExpression",
- "callee": {
- "type": "Identifier",
- "name": "that"
- },
- "arguments": []
- }
- }
- ]
- },
- "guardedHandlers": [
- {
- "type": "CatchClause",
- "param": {
+ "body": []
+ },
+ "guardedHandlers": [],
+ "handler": {
+ "type": "CatchClause",
+ "param": {
+ "type": "Identifier",
+ "name": "e"
+ },
+ "body": {
+ "type": "BlockStatement",
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "expression": {
+ "type": "CallExpression",
+ "callee": {
"type": "Identifier",
- "name": "e"
+ "name": "handle"
},
- "guard": {
- "type": "BinaryExpression",
- "operator": "instanceof",
- "left": {
- "type": "Identifier",
- "name": "e"
- },
- "right": {
- "type": "Identifier",
- "name": "TypeError"
- }
- },
- "body": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "ExpressionStatement",
- "expression": {
- "type": "CallExpression",
- "callee": {
- "type": "Identifier",
- "name": "handle"
- },
- "arguments": []
- }
- }
- ]
- }
+ "arguments": []
}
- ],
- "handler": {
- "type": "CatchClause",
- "param": {
+ }
+ ]
+ }
+ },
+ "finalizer": null
+ }
+ ]
+}
+{
+ "type": "Program",
+ "body": [
+ {
+ "type": "TryStatement",
+ "block": {
+ "type": "BlockStatement",
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "expression": {
+ "type": "CallExpression",
+ "callee": {
"type": "Identifier",
- "name": "e"
+ "name": "that"
},
- "body": {
- "type": "BlockStatement",
- "body": [
- {
- "type": "ExpressionStatement",
- "expression": {
- "type": "CallExpression",
- "callee": {
- "type": "Identifier",
- "name": "rest"
- },
- "arguments": []
- }
- }
- ]
+ "arguments": []
+ }
+ }
+ ]
+ },
+ "guardedHandlers": [],
+ "handler": {
+ "type": "CatchClause",
+ "param": {
+ "type": "Identifier",
+ "name": "e"
+ },
+ "body": {
+ "type": "BlockStatement",
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "expression": {
+ "type": "CallExpression",
+ "callee": {
+ "type": "Identifier",
+ "name": "handle"
+ },
+ "arguments": []
}
- },
- "finalizer": null
+ }
+ ]
+ }
+ },
+ "finalizer": {
+ "type": "BlockStatement",
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "expression": {
+ "type": "CallExpression",
+ "callee": {
+ "type": "Identifier",
+ "name": "clean"
+ },
+ "arguments": []
+ }
}
]
}
}
]
}
+{
+ "type": "Program",
+ "body": [
+ {
+ "type": "TryStatement",
+ "block": {
+ "type": "BlockStatement",
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "expression": {
+ "type": "CallExpression",
+ "callee": {
+ "type": "Identifier",
+ "name": "that"
+ },
+ "arguments": []
+ }
+ }
+ ]
+ },
+ "guardedHandlers": [
+ {
+ "type": "CatchClause",
+ "param": {
+ "type": "Identifier",
+ "name": "e"
+ },
+ "guard": {
+ "type": "BinaryExpression",
+ "operator": "instanceof",
+ "left": {
+ "type": "Identifier",
+ "name": "e"
+ },
+ "right": {
+ "type": "Identifier",
+ "name": "TypeError"
+ }
+ },
+ "body": {
+ "type": "BlockStatement",
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "expression": {
+ "type": "CallExpression",
+ "callee": {
+ "type": "Identifier",
+ "name": "handle"
+ },
+ "arguments": []
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "handler": {
+ "type": "CatchClause",
+ "param": {
+ "type": "Identifier",
+ "name": "e"
+ },
+ "body": {
+ "type": "BlockStatement",
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "expression": {
+ "type": "CallExpression",
+ "callee": {
+ "type": "Identifier",
+ "name": "rest"
+ },
+ "arguments": []
+ }
+ }
+ ]
+ }
+ },
+ "finalizer": null
+ }
+ ]
+}
diff --git a/nashorn/test/script/basic/parser/util.js b/nashorn/test/script/basic/parser/util.js
index ce417d0..9c85c74 100644
--- a/nashorn/test/script/basic/parser/util.js
+++ b/nashorn/test/script/basic/parser/util.js
@@ -25,7 +25,7 @@
* @subtest
*/
-// utilitity for parser tests
+// utility for parser tests
load("nashorn:parser.js");
function printParse(code) {
diff --git a/nashorn/test/script/nosecurity/parserapi.js b/nashorn/test/script/nosecurity/parserapi.js
new file mode 100644
index 0000000..2f5fb87
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi.js
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Nashorn parser API usage.
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+function Parser() {
+ // create nashorn parser
+ this._parser = Parser.create();
+}
+
+// Java types used
+Parser.Diagnostic = Java.type("jdk.nashorn.api.tree.Diagnostic");
+Parser.SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+Parser.Tree = Java.type("jdk.nashorn.api.tree.Tree");
+Parser.List = Java.type("java.util.List");
+Parser.Enum = Java.type("java.lang.Enum");
+
+// function to parse the script and return script friendly object
+Parser.prototype.parse = function(name, script, listener) {
+ var tree = this._parser.parse(name, script, listener);
+ tree.accept(new Parser.SimpleTreeVisitor(), null);
+ return this.convert(tree);
+}
+
+Parser.create = function() {
+ return Java.type("jdk.nashorn.api.tree.Parser").create();
+}
+
+// convert Nashorn parser Tree, Diagnostic as a script friendly object
+Parser.prototype.convert = function(tree) {
+ if (!tree || typeof tree != 'object') {
+ return tree;
+ }
+
+ var obj = Object.bindProperties({}, tree);
+ var result = {};
+ for (var i in obj) {
+ var val = obj[i];
+ if (val instanceof Parser.Tree) {
+ result[i] = this.convert(val);
+ } else if (val instanceof Parser.List) {
+ var arr = new Array(val.size());
+ for (var j in val) {
+ arr[j] = this.convert(val[j]);
+ }
+
+ result[i] = arr;
+ } else {
+ switch (typeof val) {
+ case 'number':
+ case 'string':
+ case 'boolean':
+ result[i] = String(val);
+ default:
+ if (val instanceof Parser.Enum) {
+ result[i] = String(val);
+ }
+ }
+ }
+ }
+ return result;
+}
+
+function processFiles(subdir) {
+ var File = Java.type("java.io.File");
+ var files = new File(__DIR__ + subdir).listFiles();
+ java.util.Arrays.sort(files);
+ for each (var file in files) {
+ if (file.name.endsWith(".js")) {
+ var script = readFully(file);
+ var parser = new Parser();
+ var tree = parser.parse(subdir + "/" + file.name, script,
+ function(diagnostic) {
+ print(JSON.stringify(parser.convert(diagnostic), null, 2));
+ print(",");
+ });
+
+ if (tree != null) {
+ print(JSON.stringify(tree, null, 2));
+ print(",");
+ }
+ }
+ }
+}
+
+// parse files in parsertests directory
+function main() {
+ print("[");
+
+ processFiles("parsertests");
+ processFiles("parsernegativetests");
+
+ // parse this file first!
+ var script = readFully(__FILE__);
+ var tree = new Parser().parse("parserapi.js", script, null);
+ print(JSON.stringify(tree, null, 2));
+ print("]");
+}
+
+main();
diff --git a/nashorn/test/script/nosecurity/parserapi.js.EXPECTED b/nashorn/test/script/nosecurity/parserapi.js.EXPECTED
new file mode 100644
index 0000000..ec45a67
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi.js.EXPECTED
@@ -0,0 +1,7015 @@
+[
+{
+ "endPosition": "1113",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1123",
+ "kind": "VARIABLE",
+ "name": "x",
+ "startPosition": "1117",
+ "initializer": {
+ "endPosition": "1123",
+ "kind": "ARRAY_LITERAL",
+ "elements": [],
+ "startPosition": "1121"
+ }
+ },
+ {
+ "endPosition": "1147",
+ "kind": "VARIABLE",
+ "name": "y",
+ "startPosition": "1129",
+ "initializer": {
+ "endPosition": "1147",
+ "kind": "ARRAY_LITERAL",
+ "elements": [
+ {
+ "endPosition": "1135",
+ "kind": "NUMBER_LITERAL",
+ "value": "1",
+ "startPosition": "1134"
+ },
+ {
+ "endPosition": "1139",
+ "kind": "NUMBER_LITERAL",
+ "value": "43",
+ "startPosition": "1137"
+ },
+ {
+ "endPosition": "1142",
+ "kind": "NUMBER_LITERAL",
+ "value": "5",
+ "startPosition": "1141"
+ },
+ {
+ "endPosition": "1146",
+ "kind": "NUMBER_LITERAL",
+ "value": "45",
+ "startPosition": "1144"
+ }
+ ],
+ "startPosition": "1133"
+ }
+ },
+ {
+ "endPosition": "1165",
+ "kind": "VARIABLE",
+ "name": "z",
+ "startPosition": "1153",
+ "initializer": {
+ "endPosition": "1165",
+ "kind": "ARRAY_LITERAL",
+ "elements": [
+ {
+ "endPosition": "1160",
+ "kind": "NUMBER_LITERAL",
+ "value": "34",
+ "startPosition": "1158"
+ },
+ null,
+ null,
+ {
+ "endPosition": "1164",
+ "kind": "NUMBER_LITERAL",
+ "value": "4",
+ "startPosition": "1163"
+ }
+ ],
+ "startPosition": "1157"
+ }
+ },
+ {
+ "endPosition": "1200",
+ "kind": "VARIABLE",
+ "name": "k",
+ "startPosition": "1171",
+ "initializer": {
+ "endPosition": "1200",
+ "kind": "ARRAY_LITERAL",
+ "elements": [
+ {
+ "endPosition": "1179",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1177",
+ "properties": []
+ },
+ {
+ "endPosition": "1189",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1181",
+ "properties": [
+ {
+ "endPosition": "1185",
+ "kind": "PROPERTY",
+ "value": {
+ "endPosition": "1187",
+ "kind": "NUMBER_LITERAL",
+ "value": "3",
+ "startPosition": "1186"
+ },
+ "startPosition": "1183",
+ "key": {
+ "endPosition": "1184",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1183"
+ }
+ }
+ ]
+ },
+ {
+ "endPosition": "1197",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1192"
+ }
+ ],
+ "startPosition": "1175"
+ }
+ }
+ ],
+ "sourceName": "parsertests/array_literal.js",
+ "strict": "false",
+ "startPosition": "1113"
+}
+,
+{
+ "endPosition": "1126",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1135",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1132"
+ },
+ "endPosition": "1135",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1129",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1126"
+ },
+ "startPosition": "1126"
+ },
+ "endPosition": "1135",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1126"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1147",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1144"
+ },
+ "endPosition": "1147",
+ "kind": "PLUS_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1140",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1137"
+ },
+ "startPosition": "1137"
+ },
+ "endPosition": "1147",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1137"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1159",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1156"
+ },
+ "endPosition": "1159",
+ "kind": "MINUS_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1152",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1149"
+ },
+ "startPosition": "1149"
+ },
+ "endPosition": "1159",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1149"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1171",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1168"
+ },
+ "endPosition": "1171",
+ "kind": "MULTIPLY_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1164",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1161"
+ },
+ "startPosition": "1161"
+ },
+ "endPosition": "1171",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1161"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1183",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1180"
+ },
+ "endPosition": "1183",
+ "kind": "DIVIDE_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1176",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1173"
+ },
+ "startPosition": "1173"
+ },
+ "endPosition": "1183",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1173"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1195",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1192"
+ },
+ "endPosition": "1195",
+ "kind": "REMAINDER_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1188",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1185"
+ },
+ "startPosition": "1185"
+ },
+ "endPosition": "1195",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1185"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1208",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1205"
+ },
+ "endPosition": "1208",
+ "kind": "LEFT_SHIFT_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1200",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1197"
+ },
+ "startPosition": "1197"
+ },
+ "endPosition": "1208",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1197"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1221",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1218"
+ },
+ "endPosition": "1221",
+ "kind": "RIGHT_SHIFT_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1213",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1210"
+ },
+ "startPosition": "1210"
+ },
+ "endPosition": "1221",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1210"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1235",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1232"
+ },
+ "endPosition": "1235",
+ "kind": "UNSIGNED_RIGHT_SHIFT_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1226",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1223"
+ },
+ "startPosition": "1223"
+ },
+ "endPosition": "1235",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1223"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1247",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1244"
+ },
+ "endPosition": "1247",
+ "kind": "AND_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1240",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1237"
+ },
+ "startPosition": "1237"
+ },
+ "endPosition": "1247",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1237"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1259",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1256"
+ },
+ "endPosition": "1259",
+ "kind": "XOR_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1252",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1249"
+ },
+ "startPosition": "1249"
+ },
+ "endPosition": "1259",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1249"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1271",
+ "kind": "NUMBER_LITERAL",
+ "value": "314",
+ "startPosition": "1268"
+ },
+ "endPosition": "1271",
+ "kind": "OR_ASSIGNMENT",
+ "variable": {
+ "endPosition": "1264",
+ "kind": "IDENTIFIER",
+ "name": "xyz",
+ "startPosition": "1261"
+ },
+ "startPosition": "1261"
+ },
+ "endPosition": "1271",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1261"
+ }
+ ],
+ "sourceName": "parsertests/assignmentExpr.js",
+ "strict": "false",
+ "startPosition": "1126"
+}
+,
+{
+ "endPosition": "1116",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1117",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1116"
+ },
+ "endPosition": "1121",
+ "kind": "MULTIPLY",
+ "rightOperand": {
+ "endPosition": "1121",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1120"
+ },
+ "startPosition": "1116"
+ },
+ "endPosition": "1121",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1116"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1123",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1122"
+ },
+ "endPosition": "1127",
+ "kind": "DIVIDE",
+ "rightOperand": {
+ "endPosition": "1127",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1126"
+ },
+ "startPosition": "1122"
+ },
+ "endPosition": "1127",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1122"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1130",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1129"
+ },
+ "endPosition": "1134",
+ "kind": "REMAINDER",
+ "rightOperand": {
+ "endPosition": "1134",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1133"
+ },
+ "startPosition": "1129"
+ },
+ "endPosition": "1134",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1129"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1137",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1136"
+ },
+ "endPosition": "1141",
+ "kind": "PLUS",
+ "rightOperand": {
+ "endPosition": "1141",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1140"
+ },
+ "startPosition": "1136"
+ },
+ "endPosition": "1141",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1136"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1144",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1143"
+ },
+ "endPosition": "1148",
+ "kind": "MINUS",
+ "rightOperand": {
+ "endPosition": "1148",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1147"
+ },
+ "startPosition": "1143"
+ },
+ "endPosition": "1148",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1143"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1151",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1150"
+ },
+ "endPosition": "1156",
+ "kind": "LEFT_SHIFT",
+ "rightOperand": {
+ "endPosition": "1156",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1155"
+ },
+ "startPosition": "1150"
+ },
+ "endPosition": "1156",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1150"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1159",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1158"
+ },
+ "endPosition": "1164",
+ "kind": "RIGHT_SHIFT",
+ "rightOperand": {
+ "endPosition": "1164",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1163"
+ },
+ "startPosition": "1158"
+ },
+ "endPosition": "1164",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1158"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1167",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1166"
+ },
+ "endPosition": "1173",
+ "kind": "UNSIGNED_RIGHT_SHIFT",
+ "rightOperand": {
+ "endPosition": "1173",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1172"
+ },
+ "startPosition": "1166"
+ },
+ "endPosition": "1173",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1166"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1176",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1175"
+ },
+ "endPosition": "1180",
+ "kind": "LESS_THAN",
+ "rightOperand": {
+ "endPosition": "1180",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1179"
+ },
+ "startPosition": "1175"
+ },
+ "endPosition": "1180",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1175"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1183",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1182"
+ },
+ "endPosition": "1187",
+ "kind": "GREATER_THAN",
+ "rightOperand": {
+ "endPosition": "1187",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1186"
+ },
+ "startPosition": "1182"
+ },
+ "endPosition": "1187",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1182"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1190",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1189"
+ },
+ "endPosition": "1195",
+ "kind": "LESS_THAN_EQUAL",
+ "rightOperand": {
+ "endPosition": "1195",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1194"
+ },
+ "startPosition": "1189"
+ },
+ "endPosition": "1195",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1189"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1198",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1197"
+ },
+ "endPosition": "1203",
+ "kind": "GREATER_THAN_EQUAL",
+ "rightOperand": {
+ "endPosition": "1203",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1202"
+ },
+ "startPosition": "1197"
+ },
+ "endPosition": "1203",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1197"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1206",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1205"
+ },
+ "expression": {
+ "endPosition": "1206",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1205"
+ },
+ "endPosition": "1219",
+ "kind": "INSTANCE_OF",
+ "rightOperand": {
+ "endPosition": "1219",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1218"
+ },
+ "type": {
+ "endPosition": "1219",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1218"
+ },
+ "startPosition": "1205"
+ },
+ "endPosition": "1219",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1205"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1222",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1221"
+ },
+ "endPosition": "1227",
+ "kind": "EQUAL_TO",
+ "rightOperand": {
+ "endPosition": "1227",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1226"
+ },
+ "startPosition": "1221"
+ },
+ "endPosition": "1227",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1221"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1230",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1229"
+ },
+ "endPosition": "1235",
+ "kind": "NOT_EQUAL_TO",
+ "rightOperand": {
+ "endPosition": "1235",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1234"
+ },
+ "startPosition": "1229"
+ },
+ "endPosition": "1235",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1229"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1238",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1237"
+ },
+ "endPosition": "1244",
+ "kind": "STRICT_EQUAL_TO",
+ "rightOperand": {
+ "endPosition": "1244",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1243"
+ },
+ "startPosition": "1237"
+ },
+ "endPosition": "1244",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1237"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1247",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1246"
+ },
+ "endPosition": "1253",
+ "kind": "STRICT_NOT_EQUAL_TO",
+ "rightOperand": {
+ "endPosition": "1253",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1252"
+ },
+ "startPosition": "1246"
+ },
+ "endPosition": "1253",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1246"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1256",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1255"
+ },
+ "endPosition": "1260",
+ "kind": "AND",
+ "rightOperand": {
+ "endPosition": "1260",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1259"
+ },
+ "startPosition": "1255"
+ },
+ "endPosition": "1260",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1255"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1263",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1262"
+ },
+ "endPosition": "1267",
+ "kind": "XOR",
+ "rightOperand": {
+ "endPosition": "1267",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1266"
+ },
+ "startPosition": "1262"
+ },
+ "endPosition": "1267",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1262"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1270",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1269"
+ },
+ "endPosition": "1274",
+ "kind": "OR",
+ "rightOperand": {
+ "endPosition": "1274",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1273"
+ },
+ "startPosition": "1269"
+ },
+ "endPosition": "1274",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1269"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1277",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1276"
+ },
+ "endPosition": "1282",
+ "kind": "CONDITIONAL_AND",
+ "rightOperand": {
+ "endPosition": "1282",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1281"
+ },
+ "startPosition": "1276"
+ },
+ "endPosition": "1282",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1276"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1285",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1284"
+ },
+ "endPosition": "1290",
+ "kind": "CONDITIONAL_OR",
+ "rightOperand": {
+ "endPosition": "1290",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1289"
+ },
+ "startPosition": "1284"
+ },
+ "endPosition": "1290",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1284"
+ }
+ ],
+ "sourceName": "parsertests/binaryExpr.js",
+ "strict": "false",
+ "startPosition": "1116"
+}
+,
+{
+ "endPosition": "1117",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1119",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1117"
+ },
+ {
+ "endPosition": "1139",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1136",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1127",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1122"
+ },
+ "arguments": [
+ {
+ "endPosition": "1134",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1129"
+ }
+ ],
+ "startPosition": "1122"
+ },
+ "endPosition": "1136",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1122"
+ }
+ ],
+ "startPosition": "1120"
+ }
+ ],
+ "sourceName": "parsertests/block.js",
+ "strict": "false",
+ "startPosition": "1117"
+}
+,
+{
+ "endPosition": "1117",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "condition": {
+ "endPosition": "1128",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1124"
+ },
+ "endPosition": "1140",
+ "kind": "WHILE_LOOP",
+ "statement": {
+ "endPosition": "1140",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1138",
+ "kind": "BREAK",
+ "startPosition": "1132"
+ }
+ ],
+ "startPosition": "1130"
+ },
+ "startPosition": "1117"
+ },
+ {
+ "endPosition": "1179",
+ "kind": "LABELED_STATEMENT",
+ "statement": {
+ "endPosition": "1179",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "condition": {
+ "endPosition": "1161",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1157"
+ },
+ "endPosition": "1177",
+ "kind": "WHILE_LOOP",
+ "statement": {
+ "endPosition": "1177",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1175",
+ "kind": "BREAK",
+ "label": "loop",
+ "startPosition": "1165"
+ }
+ ],
+ "startPosition": "1163"
+ },
+ "startPosition": "1150"
+ }
+ ],
+ "startPosition": "1148"
+ },
+ "label": "loop",
+ "startPosition": "1142"
+ },
+ {
+ "endPosition": "1214",
+ "kind": "LABELED_STATEMENT",
+ "statement": {
+ "endPosition": "1214",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1212",
+ "kind": "FOR_LOOP",
+ "statement": {
+ "endPosition": "1212",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1210",
+ "kind": "BREAK",
+ "label": "loop",
+ "startPosition": "1200"
+ }
+ ],
+ "startPosition": "1198"
+ },
+ "startPosition": "1189"
+ }
+ ],
+ "startPosition": "1187"
+ },
+ "label": "loop",
+ "startPosition": "1181"
+ }
+ ],
+ "sourceName": "parsertests/breakStat.js",
+ "strict": "false",
+ "startPosition": "1117"
+}
+,
+{
+ "endPosition": "1117",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "condition": {
+ "endPosition": "1118",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1117"
+ },
+ "endPosition": "1125",
+ "kind": "CONDITIONAL_EXPRESSION",
+ "trueExpression": {
+ "endPosition": "1121",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1120"
+ },
+ "falseExpression": {
+ "endPosition": "1125",
+ "kind": "IDENTIFIER",
+ "name": "c",
+ "startPosition": "1124"
+ },
+ "startPosition": "1118"
+ },
+ "endPosition": "1125",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1117"
+ }
+ ],
+ "sourceName": "parsertests/condExpr.js",
+ "strict": "false",
+ "startPosition": "1117"
+}
+,
+{
+ "endPosition": "1120",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "condition": {
+ "endPosition": "1131",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1127"
+ },
+ "endPosition": "1146",
+ "kind": "WHILE_LOOP",
+ "statement": {
+ "endPosition": "1146",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1144",
+ "kind": "CONTINUE",
+ "startPosition": "1135"
+ }
+ ],
+ "startPosition": "1133"
+ },
+ "startPosition": "1120"
+ },
+ {
+ "endPosition": "1191",
+ "kind": "LABELED_STATEMENT",
+ "statement": {
+ "endPosition": "1191",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "condition": {
+ "endPosition": "1168",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1164"
+ },
+ "endPosition": "1189",
+ "kind": "WHILE_LOOP",
+ "statement": {
+ "endPosition": "1189",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1187",
+ "kind": "CONTINUE",
+ "label": "begin",
+ "startPosition": "1172"
+ }
+ ],
+ "startPosition": "1170"
+ },
+ "startPosition": "1157"
+ }
+ ],
+ "startPosition": "1155"
+ },
+ "label": "begin",
+ "startPosition": "1148"
+ },
+ {
+ "endPosition": "1231",
+ "kind": "LABELED_STATEMENT",
+ "statement": {
+ "endPosition": "1231",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1229",
+ "kind": "FOR_LOOP",
+ "statement": {
+ "endPosition": "1229",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1227",
+ "kind": "CONTINUE",
+ "label": "start",
+ "startPosition": "1212"
+ }
+ ],
+ "startPosition": "1210"
+ },
+ "startPosition": "1202"
+ }
+ ],
+ "startPosition": "1200"
+ },
+ "label": "start",
+ "startPosition": "1193"
+ }
+ ],
+ "sourceName": "parsertests/continueStat.js",
+ "strict": "false",
+ "startPosition": "1120"
+}
+,
+{
+ "endPosition": "1118",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1127",
+ "kind": "DEBUGGER",
+ "startPosition": "1118"
+ }
+ ],
+ "sourceName": "parsertests/debuggerStat.js",
+ "strict": "false",
+ "startPosition": "1118"
+}
+,
+{
+ "endPosition": "1137",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1172",
+ "kind": "FUNCTION",
+ "name": "hello",
+ "body": {
+ "endPosition": "1170",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1170",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1161",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1156"
+ },
+ "arguments": [
+ {
+ "endPosition": "1168",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1163"
+ }
+ ],
+ "startPosition": "1156"
+ },
+ "endPosition": "1170",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1156"
+ }
+ ],
+ "startPosition": "1154"
+ },
+ "strict": "false",
+ "startPosition": "1137",
+ "parameters": []
+ },
+ {
+ "endPosition": "1203",
+ "kind": "FUNCTION",
+ "name": "hello",
+ "body": {
+ "endPosition": "1201",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1201",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1198",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1193"
+ },
+ "arguments": [
+ {
+ "endPosition": "1200",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1199"
+ }
+ ],
+ "startPosition": "1193"
+ },
+ "endPosition": "1201",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1193"
+ }
+ ],
+ "startPosition": "1191"
+ },
+ "strict": "false",
+ "startPosition": "1173",
+ "parameters": [
+ {
+ "endPosition": "1189",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1188"
+ }
+ ]
+ },
+ {
+ "endPosition": "1240",
+ "kind": "FUNCTION",
+ "name": "hello",
+ "body": {
+ "endPosition": "1238",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1238",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1232",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1227"
+ },
+ "arguments": [
+ {
+ "endPosition": "1234",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1233"
+ },
+ {
+ "endPosition": "1237",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1236"
+ }
+ ],
+ "startPosition": "1227"
+ },
+ "endPosition": "1238",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1227"
+ }
+ ],
+ "startPosition": "1225"
+ },
+ "strict": "false",
+ "startPosition": "1204",
+ "parameters": [
+ {
+ "endPosition": "1220",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1219"
+ },
+ {
+ "endPosition": "1223",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1222"
+ }
+ ]
+ },
+ {
+ "endPosition": "1380",
+ "kind": "FUNCTION",
+ "name": "test",
+ "body": {
+ "endPosition": "1377",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1377",
+ "kind": "STRING_LITERAL",
+ "value": "use strict",
+ "startPosition": "1367"
+ },
+ "endPosition": "1377",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1367"
+ }
+ ],
+ "startPosition": "1364"
+ },
+ "strict": "true",
+ "startPosition": "1348",
+ "parameters": []
+ },
+ {
+ "endPosition": "1282",
+ "kind": "VARIABLE",
+ "name": "hello",
+ "startPosition": "1245",
+ "initializer": {
+ "endPosition": "1264",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1280",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1280",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1271",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1266"
+ },
+ "arguments": [
+ {
+ "endPosition": "1278",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1273"
+ }
+ ],
+ "startPosition": "1266"
+ },
+ "endPosition": "1280",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1266"
+ }
+ ],
+ "startPosition": "1264"
+ },
+ "strict": "false",
+ "startPosition": "1264",
+ "parameters": []
+ }
+ },
+ {
+ "endPosition": "1331",
+ "kind": "VARIABLE",
+ "name": "hello",
+ "startPosition": "1288",
+ "initializer": {
+ "endPosition": "1313",
+ "kind": "FUNCTION_EXPRESSION",
+ "name": "hello",
+ "body": {
+ "endPosition": "1329",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1329",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1320",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1315"
+ },
+ "arguments": [
+ {
+ "endPosition": "1327",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1322"
+ }
+ ],
+ "startPosition": "1315"
+ },
+ "endPosition": "1329",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1315"
+ }
+ ],
+ "startPosition": "1313"
+ },
+ "strict": "false",
+ "startPosition": "1313",
+ "parameters": []
+ }
+ },
+ {
+ "expression": {
+ "endPosition": "1344",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1345",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1344"
+ },
+ "strict": "false",
+ "startPosition": "1344",
+ "parameters": []
+ },
+ "endPosition": "1347",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1333"
+ }
+ ],
+ "sourceName": "parsertests/functions.js",
+ "strict": "false",
+ "startPosition": "1137"
+}
+,
+{
+ "endPosition": "1114",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "condition": {
+ "endPosition": "1120",
+ "kind": "IDENTIFIER",
+ "name": "js",
+ "startPosition": "1118"
+ },
+ "endPosition": "1135",
+ "kind": "IF",
+ "startPosition": "1114",
+ "thenStatement": {
+ "endPosition": "1135",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1133",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1131",
+ "kind": "IDENTIFIER",
+ "name": "nashorn",
+ "startPosition": "1124"
+ },
+ "arguments": [],
+ "startPosition": "1124"
+ },
+ "endPosition": "1133",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1124"
+ }
+ ],
+ "startPosition": "1122"
+ }
+ },
+ {
+ "condition": {
+ "endPosition": "1143",
+ "kind": "IDENTIFIER",
+ "name": "js",
+ "startPosition": "1141"
+ },
+ "elseStatement": {
+ "endPosition": "1174",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1172",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1170",
+ "kind": "IDENTIFIER",
+ "name": "java",
+ "startPosition": "1166"
+ },
+ "arguments": [],
+ "startPosition": "1166"
+ },
+ "endPosition": "1172",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1166"
+ }
+ ],
+ "startPosition": "1164"
+ },
+ "endPosition": "1174",
+ "kind": "IF",
+ "startPosition": "1137",
+ "thenStatement": {
+ "endPosition": "1158",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1156",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1154",
+ "kind": "IDENTIFIER",
+ "name": "nashorn",
+ "startPosition": "1147"
+ },
+ "arguments": [],
+ "startPosition": "1147"
+ },
+ "endPosition": "1156",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1147"
+ }
+ ],
+ "startPosition": "1145"
+ }
+ }
+ ],
+ "sourceName": "parsertests/ifStat.js",
+ "strict": "false",
+ "startPosition": "1114"
+}
+,
+{
+ "endPosition": "1113",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1144",
+ "kind": "LABELED_STATEMENT",
+ "statement": {
+ "endPosition": "1144",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1142",
+ "kind": "FOR_LOOP",
+ "statement": {
+ "endPosition": "1142",
+ "kind": "BREAK",
+ "label": "begin",
+ "startPosition": "1131"
+ },
+ "startPosition": "1122"
+ }
+ ],
+ "startPosition": "1120"
+ },
+ "label": "begin",
+ "startPosition": "1113"
+ },
+ {
+ "endPosition": "1181",
+ "kind": "LABELED_STATEMENT",
+ "statement": {
+ "endPosition": "1181",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "condition": {
+ "endPosition": "1166",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1162"
+ },
+ "endPosition": "1179",
+ "kind": "WHILE_LOOP",
+ "statement": {
+ "endPosition": "1179",
+ "kind": "BREAK",
+ "label": "begin",
+ "startPosition": "1168"
+ },
+ "startPosition": "1155"
+ }
+ ],
+ "startPosition": "1153"
+ },
+ "label": "begin",
+ "startPosition": "1146"
+ }
+ ],
+ "sourceName": "parsertests/labelledStat.js",
+ "strict": "false",
+ "startPosition": "1113"
+}
+,
+{
+ "endPosition": "1125",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1126",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1125"
+ },
+ "endPosition": "1129",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "1128",
+ "kind": "NUMBER_LITERAL",
+ "value": "3",
+ "startPosition": "1127"
+ },
+ "startPosition": "1125"
+ },
+ "endPosition": "1129",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1125"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1132",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1131"
+ },
+ "endPosition": "1135",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "1134",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1133"
+ },
+ "startPosition": "1131"
+ },
+ "endPosition": "1135",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1131"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1138",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1137"
+ },
+ "endPosition": "1145",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "1143",
+ "kind": "STRING_LITERAL",
+ "value": "foo",
+ "startPosition": "1140"
+ },
+ "startPosition": "1137"
+ },
+ "endPosition": "1145",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1137"
+ },
+ {
+ "expression": {
+ "identifier": "foo",
+ "expression": {
+ "endPosition": "1150",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1147"
+ },
+ "endPosition": "1154",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1147"
+ },
+ "endPosition": "1154",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1147"
+ },
+ {
+ "expression": {
+ "identifier": "bar",
+ "expression": {
+ "identifier": "foo",
+ "expression": {
+ "endPosition": "1159",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1156"
+ },
+ "endPosition": "1163",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1156"
+ },
+ "endPosition": "1167",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1156"
+ },
+ "endPosition": "1167",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1156"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1177",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1177",
+ "kind": "IDENTIFIER",
+ "name": "Type",
+ "startPosition": "1173"
+ },
+ "arguments": [],
+ "startPosition": "1173"
+ },
+ "endPosition": "1177",
+ "kind": "NEW",
+ "startPosition": "1169"
+ },
+ "endPosition": "1177",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1169"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1189",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1187",
+ "kind": "IDENTIFIER",
+ "name": "Type",
+ "startPosition": "1183"
+ },
+ "arguments": [],
+ "startPosition": "1183"
+ },
+ "endPosition": "1189",
+ "kind": "NEW",
+ "startPosition": "1179"
+ },
+ "endPosition": "1189",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1179"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1211",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1199",
+ "kind": "IDENTIFIER",
+ "name": "Type",
+ "startPosition": "1195"
+ },
+ "arguments": [
+ {
+ "endPosition": "1201",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1200"
+ },
+ {
+ "endPosition": "1209",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1204"
+ }
+ ],
+ "startPosition": "1195"
+ },
+ "endPosition": "1211",
+ "kind": "NEW",
+ "startPosition": "1191"
+ },
+ "endPosition": "1211",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1191"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1225",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "Type",
+ "expression": {
+ "endPosition": "1220",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1217"
+ },
+ "endPosition": "1225",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1217"
+ },
+ "arguments": [],
+ "startPosition": "1220"
+ },
+ "endPosition": "1225",
+ "kind": "NEW",
+ "startPosition": "1213"
+ },
+ "endPosition": "1225",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1213"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1241",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "Type",
+ "expression": {
+ "endPosition": "1234",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1231"
+ },
+ "endPosition": "1239",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1231"
+ },
+ "arguments": [],
+ "startPosition": "1234"
+ },
+ "endPosition": "1241",
+ "kind": "NEW",
+ "startPosition": "1227"
+ },
+ "endPosition": "1241",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1227"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1267",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "Type",
+ "expression": {
+ "endPosition": "1250",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1247"
+ },
+ "endPosition": "1255",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1247"
+ },
+ "arguments": [
+ {
+ "endPosition": "1257",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1256"
+ },
+ {
+ "endPosition": "1265",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1260"
+ }
+ ],
+ "startPosition": "1250"
+ },
+ "endPosition": "1267",
+ "kind": "NEW",
+ "startPosition": "1243"
+ },
+ "endPosition": "1267",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1243"
+ },
+ {
+ "expression": {
+ "endPosition": "1274",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1272",
+ "kind": "IDENTIFIER",
+ "name": "foo",
+ "startPosition": "1269"
+ },
+ "arguments": [],
+ "startPosition": "1269"
+ },
+ "endPosition": "1274",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1269"
+ },
+ {
+ "expression": {
+ "endPosition": "1284",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "foo",
+ "expression": {
+ "endPosition": "1278",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1275"
+ },
+ "endPosition": "1282",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1275"
+ },
+ "arguments": [],
+ "startPosition": "1275"
+ },
+ "endPosition": "1284",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1275"
+ },
+ {
+ "expression": {
+ "endPosition": "1294",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1289",
+ "kind": "IDENTIFIER",
+ "name": "foo",
+ "startPosition": "1286"
+ },
+ "arguments": [
+ {
+ "endPosition": "1291",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1290"
+ },
+ {
+ "endPosition": "1293",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1292"
+ }
+ ],
+ "startPosition": "1286"
+ },
+ "endPosition": "1294",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1286"
+ },
+ {
+ "expression": {
+ "endPosition": "1309",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "foo",
+ "expression": {
+ "endPosition": "1299",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1296"
+ },
+ "endPosition": "1303",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1296"
+ },
+ "arguments": [
+ {
+ "endPosition": "1305",
+ "kind": "IDENTIFIER",
+ "name": "a",
+ "startPosition": "1304"
+ },
+ {
+ "endPosition": "1308",
+ "kind": "IDENTIFIER",
+ "name": "b",
+ "startPosition": "1307"
+ }
+ ],
+ "startPosition": "1296"
+ },
+ "endPosition": "1309",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1296"
+ }
+ ],
+ "sourceName": "parsertests/lhsExpr.js",
+ "strict": "false",
+ "startPosition": "1125"
+}
+,
+{
+ "endPosition": "1110",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "condition": {
+ "endPosition": "1120",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1116"
+ },
+ "endPosition": "1140",
+ "kind": "WHILE_LOOP",
+ "statement": {
+ "endPosition": "1140",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1138",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1129",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1124"
+ },
+ "arguments": [
+ {
+ "endPosition": "1136",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1131"
+ }
+ ],
+ "startPosition": "1124"
+ },
+ "endPosition": "1138",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1124"
+ }
+ ],
+ "startPosition": "1122"
+ },
+ "startPosition": "1110"
+ },
+ {
+ "condition": {
+ "endPosition": "1173",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1169"
+ },
+ "endPosition": "1174",
+ "kind": "DO_WHILE_LOOP",
+ "statement": {
+ "endPosition": "1162",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1160",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1151",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1146"
+ },
+ "arguments": [
+ {
+ "endPosition": "1158",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1153"
+ }
+ ],
+ "startPosition": "1146"
+ },
+ "endPosition": "1160",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1146"
+ }
+ ],
+ "startPosition": "1144"
+ },
+ "startPosition": "1141"
+ },
+ {
+ "expression": {
+ "endPosition": "1188",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1185"
+ },
+ "endPosition": "1207",
+ "kind": "FOR_IN_LOOP",
+ "forEach": "false",
+ "variable": {
+ "endPosition": "1181",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1180"
+ },
+ "statement": {
+ "endPosition": "1207",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1205",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1197",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1192"
+ },
+ "arguments": [
+ {
+ "expression": {
+ "endPosition": "1201",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1198"
+ },
+ "endPosition": "1204",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "1203",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1202"
+ },
+ "startPosition": "1198"
+ }
+ ],
+ "startPosition": "1192"
+ },
+ "endPosition": "1205",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1192"
+ }
+ ],
+ "startPosition": "1190"
+ },
+ "startPosition": "1175"
+ },
+ {
+ "expression": {
+ "endPosition": "1226",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1223"
+ },
+ "endPosition": "1240",
+ "kind": "FOR_IN_LOOP",
+ "forEach": "true",
+ "variable": {
+ "endPosition": "1219",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1218"
+ },
+ "statement": {
+ "endPosition": "1240",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1238",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1235",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1230"
+ },
+ "arguments": [
+ {
+ "endPosition": "1237",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1236"
+ }
+ ],
+ "startPosition": "1230"
+ },
+ "endPosition": "1238",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1230"
+ }
+ ],
+ "startPosition": "1228"
+ },
+ "startPosition": "1208"
+ },
+ {
+ "condition": {
+ "leftOperand": {
+ "endPosition": "1254",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1253"
+ },
+ "endPosition": "1259",
+ "kind": "LESS_THAN",
+ "rightOperand": {
+ "endPosition": "1259",
+ "kind": "NUMBER_LITERAL",
+ "value": "10",
+ "startPosition": "1257"
+ },
+ "startPosition": "1253"
+ },
+ "endPosition": "1278",
+ "kind": "FOR_LOOP",
+ "statement": {
+ "endPosition": "1278",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1276",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1273",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1268"
+ },
+ "arguments": [
+ {
+ "endPosition": "1275",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1274"
+ }
+ ],
+ "startPosition": "1268"
+ },
+ "endPosition": "1276",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1268"
+ }
+ ],
+ "startPosition": "1266"
+ },
+ "update": {
+ "expression": {
+ "endPosition": "1262",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1261"
+ },
+ "endPosition": "1264",
+ "kind": "POSTFIX_INCREMENT",
+ "startPosition": "1261"
+ },
+ "startPosition": "1241",
+ "initializer": {
+ "expression": {
+ "endPosition": "1251",
+ "kind": "NUMBER_LITERAL",
+ "value": "0",
+ "startPosition": "1250"
+ },
+ "endPosition": "1251",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1247",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "1246"
+ },
+ "startPosition": "1246"
+ }
+ }
+ ],
+ "sourceName": "parsertests/loopStat.js",
+ "strict": "false",
+ "startPosition": "1110"
+}
+,
+{
+ "endPosition": "1125",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1133",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1131",
+ "properties": []
+ },
+ "endPosition": "1133",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1128",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "1125"
+ },
+ "startPosition": "1125"
+ },
+ "endPosition": "1133",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1125"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1154",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1139",
+ "properties": [
+ {
+ "endPosition": "1143",
+ "kind": "PROPERTY",
+ "value": {
+ "endPosition": "1146",
+ "kind": "NUMBER_LITERAL",
+ "value": "10",
+ "startPosition": "1144"
+ },
+ "startPosition": "1141",
+ "key": {
+ "endPosition": "1142",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1141"
+ }
+ },
+ {
+ "endPosition": "1150",
+ "kind": "PROPERTY",
+ "value": {
+ "endPosition": "1152",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "1151"
+ },
+ "startPosition": "1148",
+ "key": {
+ "endPosition": "1149",
+ "kind": "IDENTIFIER",
+ "name": "y",
+ "startPosition": "1148"
+ }
+ }
+ ]
+ },
+ "endPosition": "1154",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1136",
+ "kind": "IDENTIFIER",
+ "name": "p",
+ "startPosition": "1135"
+ },
+ "startPosition": "1135"
+ },
+ "endPosition": "1154",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1135"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1179",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1160",
+ "properties": [
+ {
+ "endPosition": "1166",
+ "kind": "PROPERTY",
+ "value": {
+ "endPosition": "1169",
+ "kind": "NUMBER_LITERAL",
+ "value": "10",
+ "startPosition": "1167"
+ },
+ "startPosition": "1163",
+ "key": {
+ "endPosition": "1164",
+ "kind": "STRING_LITERAL",
+ "value": "x",
+ "startPosition": "1163"
+ }
+ },
+ {
+ "endPosition": "1175",
+ "kind": "PROPERTY",
+ "value": {
+ "endPosition": "1177",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "1176"
+ },
+ "startPosition": "1172",
+ "key": {
+ "endPosition": "1173",
+ "kind": "STRING_LITERAL",
+ "value": "y",
+ "startPosition": "1172"
+ }
+ }
+ ]
+ },
+ "endPosition": "1179",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1157",
+ "kind": "IDENTIFIER",
+ "name": "p",
+ "startPosition": "1156"
+ },
+ "startPosition": "1156"
+ },
+ "endPosition": "1179",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1156"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1241",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1185",
+ "properties": [
+ {
+ "getter": {
+ "endPosition": "1195",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1210",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1210",
+ "kind": "IDENTIFIER",
+ "name": "xValue",
+ "startPosition": "1204"
+ },
+ "endPosition": "1210",
+ "kind": "RETURN",
+ "startPosition": "1197"
+ }
+ ],
+ "startPosition": "1195"
+ },
+ "strict": "false",
+ "startPosition": "1195",
+ "parameters": []
+ },
+ "endPosition": "1212",
+ "kind": "PROPERTY",
+ "startPosition": "1187",
+ "key": {
+ "endPosition": "1192",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1191"
+ }
+ },
+ {
+ "getter": {
+ "endPosition": "1222",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1237",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1237",
+ "kind": "IDENTIFIER",
+ "name": "yValue",
+ "startPosition": "1231"
+ },
+ "endPosition": "1237",
+ "kind": "RETURN",
+ "startPosition": "1224"
+ }
+ ],
+ "startPosition": "1222"
+ },
+ "strict": "false",
+ "startPosition": "1222",
+ "parameters": []
+ },
+ "endPosition": "1239",
+ "kind": "PROPERTY",
+ "startPosition": "1214",
+ "key": {
+ "endPosition": "1219",
+ "kind": "IDENTIFIER",
+ "name": "y",
+ "startPosition": "1218"
+ }
+ }
+ ]
+ },
+ "endPosition": "1241",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1182",
+ "kind": "IDENTIFIER",
+ "name": "p",
+ "startPosition": "1181"
+ },
+ "startPosition": "1181"
+ },
+ "endPosition": "1241",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1181"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1315",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1247",
+ "properties": [
+ {
+ "getter": {
+ "endPosition": "1259",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1277",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "identifier": "_foo",
+ "expression": {
+ "endPosition": "1272",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "1268"
+ },
+ "endPosition": "1277",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1268"
+ },
+ "endPosition": "1277",
+ "kind": "RETURN",
+ "startPosition": "1261"
+ }
+ ],
+ "startPosition": "1259"
+ },
+ "strict": "false",
+ "startPosition": "1259",
+ "parameters": []
+ },
+ "endPosition": "1279",
+ "kind": "PROPERTY",
+ "setter": {
+ "endPosition": "1294",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1311",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1311",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "1308"
+ },
+ "endPosition": "1311",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "_foo",
+ "expression": {
+ "endPosition": "1300",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "1296"
+ },
+ "endPosition": "1305",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1296"
+ },
+ "startPosition": "1296"
+ },
+ "endPosition": "1311",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1296"
+ }
+ ],
+ "startPosition": "1294"
+ },
+ "strict": "false",
+ "startPosition": "1294",
+ "parameters": [
+ {
+ "endPosition": "1292",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "1289"
+ }
+ ]
+ },
+ "startPosition": "1249",
+ "key": {
+ "endPosition": "1256",
+ "kind": "IDENTIFIER",
+ "name": "foo",
+ "startPosition": "1253"
+ }
+ }
+ ]
+ },
+ "endPosition": "1315",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1244",
+ "kind": "IDENTIFIER",
+ "name": "p",
+ "startPosition": "1243"
+ },
+ "startPosition": "1243"
+ },
+ "endPosition": "1315",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1243"
+ }
+ ],
+ "sourceName": "parsertests/objectLitExpr.js",
+ "strict": "false",
+ "startPosition": "1125"
+}
+,
+{
+ "endPosition": "1118",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "leftOperand": {
+ "leftOperand": {
+ "endPosition": "1120",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "1119"
+ },
+ "endPosition": "1126",
+ "kind": "PLUS",
+ "rightOperand": {
+ "endPosition": "1126",
+ "kind": "NUMBER_LITERAL",
+ "value": "1",
+ "startPosition": "1125"
+ },
+ "startPosition": "1119"
+ },
+ "endPosition": "1131",
+ "kind": "PLUS",
+ "rightOperand": {
+ "endPosition": "1131",
+ "kind": "NUMBER_LITERAL",
+ "value": "4",
+ "startPosition": "1130"
+ },
+ "startPosition": "1119"
+ },
+ "endPosition": "1131",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1118"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "leftOperand": {
+ "endPosition": "1134",
+ "kind": "NUMBER_LITERAL",
+ "value": "3",
+ "startPosition": "1133"
+ },
+ "endPosition": "1139",
+ "kind": "PLUS",
+ "rightOperand": {
+ "endPosition": "1139",
+ "kind": "NUMBER_LITERAL",
+ "value": "7",
+ "startPosition": "1138"
+ },
+ "startPosition": "1133"
+ },
+ "endPosition": "1146",
+ "kind": "LEFT_SHIFT",
+ "rightOperand": {
+ "endPosition": "1146",
+ "kind": "NUMBER_LITERAL",
+ "value": "5",
+ "startPosition": "1145"
+ },
+ "startPosition": "1133"
+ },
+ "endPosition": "1147",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1133"
+ }
+ ],
+ "sourceName": "parsertests/parenExpr.js",
+ "strict": "false",
+ "startPosition": "1118"
+}
+,
+{
+ "endPosition": "1119",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1123",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "1119"
+ },
+ "endPosition": "1123",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1119"
+ },
+ {
+ "expression": {
+ "endPosition": "1128",
+ "kind": "IDENTIFIER",
+ "name": "foo",
+ "startPosition": "1125"
+ },
+ "endPosition": "1128",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1125"
+ },
+ {
+ "expression": {
+ "endPosition": "1134",
+ "kind": "NULL_LITERAL",
+ "startPosition": "1130"
+ },
+ "endPosition": "1134",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1130"
+ },
+ {
+ "expression": {
+ "endPosition": "1140",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "true",
+ "startPosition": "1136"
+ },
+ "endPosition": "1140",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1136"
+ },
+ {
+ "expression": {
+ "endPosition": "1147",
+ "kind": "BOOLEAN_LITERAL",
+ "value": "false",
+ "startPosition": "1142"
+ },
+ "endPosition": "1147",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1142"
+ },
+ {
+ "expression": {
+ "endPosition": "1151",
+ "kind": "NUMBER_LITERAL",
+ "value": "33",
+ "startPosition": "1149"
+ },
+ "endPosition": "1151",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1149"
+ },
+ {
+ "expression": {
+ "endPosition": "1157",
+ "kind": "NUMBER_LITERAL",
+ "value": "3.14",
+ "startPosition": "1153"
+ },
+ "endPosition": "1157",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1153"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "leftOperand": {
+ "endPosition": "1162",
+ "kind": "NUMBER_LITERAL",
+ "value": "10",
+ "startPosition": "1160"
+ },
+ "endPosition": "1166",
+ "kind": "PLUS",
+ "rightOperand": {
+ "endPosition": "1166",
+ "kind": "NUMBER_LITERAL",
+ "value": "3",
+ "startPosition": "1165"
+ },
+ "startPosition": "1160"
+ },
+ "endPosition": "1169",
+ "kind": "MULTIPLY",
+ "rightOperand": {
+ "endPosition": "1169",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "1168"
+ },
+ "startPosition": "1160"
+ },
+ "endPosition": "1169",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1159"
+ },
+ {
+ "expression": {
+ "endPosition": "1174",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1172",
+ "properties": []
+ },
+ "endPosition": "1175",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1171"
+ },
+ {
+ "expression": {
+ "endPosition": "1186",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1178",
+ "properties": [
+ {
+ "endPosition": "1182",
+ "kind": "PROPERTY",
+ "value": {
+ "endPosition": "1184",
+ "kind": "NUMBER_LITERAL",
+ "value": "3",
+ "startPosition": "1183"
+ },
+ "startPosition": "1180",
+ "key": {
+ "endPosition": "1181",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1180"
+ }
+ }
+ ]
+ },
+ "endPosition": "1187",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1177"
+ },
+ {
+ "expression": {
+ "endPosition": "1191",
+ "kind": "ARRAY_LITERAL",
+ "elements": [],
+ "startPosition": "1189"
+ },
+ "endPosition": "1191",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1189"
+ },
+ {
+ "expression": {
+ "endPosition": "1197",
+ "kind": "ARRAY_LITERAL",
+ "elements": [
+ null,
+ null
+ ],
+ "startPosition": "1193"
+ },
+ "endPosition": "1197",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1193"
+ },
+ {
+ "expression": {
+ "endPosition": "1208",
+ "kind": "ARRAY_LITERAL",
+ "elements": [
+ {
+ "endPosition": "1201",
+ "kind": "NUMBER_LITERAL",
+ "value": "4",
+ "startPosition": "1200"
+ },
+ {
+ "endPosition": "1204",
+ "kind": "NUMBER_LITERAL",
+ "value": "5",
+ "startPosition": "1203"
+ },
+ {
+ "endPosition": "1207",
+ "kind": "NUMBER_LITERAL",
+ "value": "5",
+ "startPosition": "1206"
+ }
+ ],
+ "startPosition": "1199"
+ },
+ "endPosition": "1208",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1199"
+ }
+ ],
+ "sourceName": "parsertests/primaryExpr.js",
+ "strict": "false",
+ "startPosition": "1119"
+}
+,
+{
+ "endPosition": "1114",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1127",
+ "kind": "VARIABLE",
+ "name": "x",
+ "startPosition": "1118",
+ "initializer": {
+ "endPosition": "1127",
+ "kind": "REGEXP_LITERAL",
+ "options": "",
+ "pattern": "foo",
+ "startPosition": "1122"
+ }
+ },
+ {
+ "endPosition": "1143",
+ "kind": "VARIABLE",
+ "name": "y",
+ "startPosition": "1133",
+ "initializer": {
+ "endPosition": "1143",
+ "kind": "REGEXP_LITERAL",
+ "options": "g",
+ "pattern": "foo",
+ "startPosition": "1137"
+ }
+ },
+ {
+ "endPosition": "1168",
+ "kind": "VARIABLE",
+ "name": "z",
+ "startPosition": "1149",
+ "initializer": {
+ "endPosition": "1168",
+ "kind": "REGEXP_LITERAL",
+ "options": "",
+ "pattern": "[a-z]*[1-10]?",
+ "startPosition": "1153"
+ }
+ }
+ ],
+ "sourceName": "parsertests/regexp_literal.js",
+ "strict": "false",
+ "startPosition": "1114"
+}
+,
+{
+ "endPosition": "1118",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1130",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1138",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1138",
+ "kind": "RETURN",
+ "startPosition": "1132"
+ }
+ ],
+ "startPosition": "1130"
+ },
+ "strict": "false",
+ "startPosition": "1130",
+ "parameters": []
+ },
+ "endPosition": "1141",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1118"
+ },
+ {
+ "expression": {
+ "endPosition": "1155",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1167",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1167",
+ "kind": "IDENTIFIER",
+ "name": "res",
+ "startPosition": "1164"
+ },
+ "endPosition": "1167",
+ "kind": "RETURN",
+ "startPosition": "1157"
+ }
+ ],
+ "startPosition": "1155"
+ },
+ "strict": "false",
+ "startPosition": "1155",
+ "parameters": []
+ },
+ "endPosition": "1170",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1143"
+ },
+ {
+ "expression": {
+ "endPosition": "1184",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1198",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1198",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1196",
+ "kind": "IDENTIFIER",
+ "name": "foo",
+ "startPosition": "1193"
+ },
+ "arguments": [],
+ "startPosition": "1193"
+ },
+ "endPosition": "1198",
+ "kind": "RETURN",
+ "startPosition": "1186"
+ }
+ ],
+ "startPosition": "1184"
+ },
+ "strict": "false",
+ "startPosition": "1184",
+ "parameters": []
+ },
+ "endPosition": "1201",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1172"
+ }
+ ],
+ "sourceName": "parsertests/returnStat.js",
+ "strict": "false",
+ "startPosition": "1118"
+}
+,
+{
+ "endPosition": "1111",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "cases": [],
+ "expression": {
+ "endPosition": "1122",
+ "kind": "IDENTIFIER",
+ "name": "key",
+ "startPosition": "1119"
+ },
+ "endPosition": "1126",
+ "kind": "SWITCH",
+ "startPosition": "1111"
+ },
+ {
+ "cases": [
+ {
+ "expression": {
+ "endPosition": "1149",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "1148"
+ },
+ "endPosition": "1166",
+ "kind": "CASE",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1158",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1156",
+ "kind": "IDENTIFIER",
+ "name": "hello",
+ "startPosition": "1151"
+ },
+ "arguments": [],
+ "startPosition": "1151"
+ },
+ "endPosition": "1158",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1151"
+ },
+ {
+ "endPosition": "1166",
+ "kind": "BREAK",
+ "startPosition": "1160"
+ }
+ ],
+ "startPosition": "1143"
+ }
+ ],
+ "expression": {
+ "endPosition": "1139",
+ "kind": "IDENTIFIER",
+ "name": "key",
+ "startPosition": "1136"
+ },
+ "endPosition": "1168",
+ "kind": "SWITCH",
+ "startPosition": "1128"
+ },
+ {
+ "cases": [
+ {
+ "expression": {
+ "endPosition": "1191",
+ "kind": "NUMBER_LITERAL",
+ "value": "4",
+ "startPosition": "1190"
+ },
+ "endPosition": "1208",
+ "kind": "CASE",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1200",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1198",
+ "kind": "IDENTIFIER",
+ "name": "hello",
+ "startPosition": "1193"
+ },
+ "arguments": [],
+ "startPosition": "1193"
+ },
+ "endPosition": "1200",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1193"
+ },
+ {
+ "endPosition": "1208",
+ "kind": "BREAK",
+ "startPosition": "1202"
+ }
+ ],
+ "startPosition": "1185"
+ },
+ {
+ "expression": {
+ "endPosition": "1215",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "1214"
+ },
+ "endPosition": "1232",
+ "kind": "CASE",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1224",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1222",
+ "kind": "IDENTIFIER",
+ "name": "world",
+ "startPosition": "1217"
+ },
+ "arguments": [],
+ "startPosition": "1217"
+ },
+ "endPosition": "1224",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1217"
+ },
+ {
+ "endPosition": "1232",
+ "kind": "BREAK",
+ "startPosition": "1226"
+ }
+ ],
+ "startPosition": "1209"
+ },
+ {
+ "endPosition": "1247",
+ "kind": "CASE",
+ "statements": [
+ {
+ "endPosition": "1247",
+ "kind": "BREAK",
+ "startPosition": "1242"
+ }
+ ],
+ "startPosition": "1233"
+ }
+ ],
+ "expression": {
+ "endPosition": "1181",
+ "kind": "IDENTIFIER",
+ "name": "key",
+ "startPosition": "1178"
+ },
+ "endPosition": "1249",
+ "kind": "SWITCH",
+ "startPosition": "1170"
+ }
+ ],
+ "sourceName": "parsertests/switchStat.js",
+ "strict": "false",
+ "startPosition": "1111"
+}
+,
+{
+ "endPosition": "1110",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1119",
+ "kind": "IDENTIFIER",
+ "name": "err",
+ "startPosition": "1116"
+ },
+ "endPosition": "1120",
+ "kind": "THROW",
+ "startPosition": "1110"
+ },
+ {
+ "expression": {
+ "endPosition": "1133",
+ "kind": "STRING_LITERAL",
+ "value": "wrong",
+ "startPosition": "1128"
+ },
+ "endPosition": "1135",
+ "kind": "THROW",
+ "startPosition": "1121"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1155",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1155",
+ "kind": "IDENTIFIER",
+ "name": "TypeError",
+ "startPosition": "1146"
+ },
+ "arguments": [],
+ "startPosition": "1146"
+ },
+ "endPosition": "1155",
+ "kind": "NEW",
+ "startPosition": "1142"
+ },
+ "endPosition": "1156",
+ "kind": "THROW",
+ "startPosition": "1136"
+ },
+ {
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "1192",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1176",
+ "kind": "IDENTIFIER",
+ "name": "TypeError",
+ "startPosition": "1167"
+ },
+ "arguments": [
+ {
+ "endPosition": "1190",
+ "kind": "STRING_LITERAL",
+ "value": "not an array",
+ "startPosition": "1178"
+ }
+ ],
+ "startPosition": "1167"
+ },
+ "endPosition": "1192",
+ "kind": "NEW",
+ "startPosition": "1163"
+ },
+ "endPosition": "1193",
+ "kind": "THROW",
+ "startPosition": "1157"
+ },
+ {
+ "expression": {
+ "endPosition": "1217",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "1200",
+ "properties": [
+ {
+ "endPosition": "1206",
+ "kind": "PROPERTY",
+ "value": {
+ "endPosition": "1214",
+ "kind": "STRING_LITERAL",
+ "value": "wrong!",
+ "startPosition": "1208"
+ },
+ "startPosition": "1202",
+ "key": {
+ "endPosition": "1205",
+ "kind": "IDENTIFIER",
+ "name": "msg",
+ "startPosition": "1202"
+ }
+ }
+ ]
+ },
+ "endPosition": "1218",
+ "kind": "THROW",
+ "startPosition": "1194"
+ }
+ ],
+ "sourceName": "parsertests/throwStat.js",
+ "strict": "false",
+ "startPosition": "1110"
+}
+,
+{
+ "endPosition": "1121",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1142",
+ "kind": "TRY",
+ "catches": [
+ {
+ "endPosition": "1142",
+ "kind": "CATCH",
+ "parameter": {
+ "endPosition": "1137",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1136"
+ },
+ "block": {
+ "endPosition": "1142",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1139"
+ },
+ "startPosition": "1129"
+ }
+ ],
+ "block": {
+ "endPosition": "1128",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1125"
+ },
+ "startPosition": "1121"
+ },
+ {
+ "endPosition": "1175",
+ "kind": "TRY",
+ "catches": [
+ {
+ "endPosition": "1164",
+ "kind": "CATCH",
+ "parameter": {
+ "endPosition": "1159",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1158"
+ },
+ "block": {
+ "endPosition": "1164",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1161"
+ },
+ "startPosition": "1151"
+ }
+ ],
+ "block": {
+ "endPosition": "1150",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1147"
+ },
+ "finallyBlock": {
+ "endPosition": "1175",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1173"
+ },
+ "startPosition": "1143"
+ },
+ {
+ "endPosition": "1194",
+ "kind": "TRY",
+ "catches": [],
+ "block": {
+ "endPosition": "1183",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1180"
+ },
+ "finallyBlock": {
+ "endPosition": "1194",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1192"
+ },
+ "startPosition": "1176"
+ },
+ {
+ "endPosition": "1225",
+ "kind": "TRY",
+ "catches": [
+ {
+ "endPosition": "1225",
+ "kind": "CATCH",
+ "parameter": {
+ "endPosition": "1211",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1210"
+ },
+ "block": {
+ "endPosition": "1225",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1223",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1221",
+ "kind": "IDENTIFIER",
+ "name": "handle",
+ "startPosition": "1215"
+ },
+ "arguments": [],
+ "startPosition": "1215"
+ },
+ "endPosition": "1223",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1215"
+ }
+ ],
+ "startPosition": "1213"
+ },
+ "startPosition": "1203"
+ }
+ ],
+ "block": {
+ "endPosition": "1202",
+ "kind": "BLOCK",
+ "statements": [],
+ "startPosition": "1199"
+ },
+ "startPosition": "1195"
+ },
+ {
+ "endPosition": "1283",
+ "kind": "TRY",
+ "catches": [
+ {
+ "endPosition": "1263",
+ "kind": "CATCH",
+ "parameter": {
+ "endPosition": "1249",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1248"
+ },
+ "block": {
+ "endPosition": "1263",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1261",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1259",
+ "kind": "IDENTIFIER",
+ "name": "handle",
+ "startPosition": "1253"
+ },
+ "arguments": [],
+ "startPosition": "1253"
+ },
+ "endPosition": "1261",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1253"
+ }
+ ],
+ "startPosition": "1251"
+ },
+ "startPosition": "1241"
+ }
+ ],
+ "block": {
+ "endPosition": "1240",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1238",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1236",
+ "kind": "IDENTIFIER",
+ "name": "that",
+ "startPosition": "1232"
+ },
+ "arguments": [],
+ "startPosition": "1232"
+ },
+ "endPosition": "1238",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1232"
+ }
+ ],
+ "startPosition": "1230"
+ },
+ "finallyBlock": {
+ "endPosition": "1283",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1281",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1279",
+ "kind": "IDENTIFIER",
+ "name": "clean",
+ "startPosition": "1274"
+ },
+ "arguments": [],
+ "startPosition": "1274"
+ },
+ "endPosition": "1281",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1274"
+ }
+ ],
+ "startPosition": "1272"
+ },
+ "startPosition": "1226"
+ },
+ {
+ "endPosition": "1368",
+ "kind": "TRY",
+ "catches": [
+ {
+ "condition": {
+ "leftOperand": {
+ "endPosition": "1312",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1311"
+ },
+ "expression": {
+ "endPosition": "1312",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1311"
+ },
+ "endPosition": "1333",
+ "kind": "INSTANCE_OF",
+ "rightOperand": {
+ "endPosition": "1333",
+ "kind": "IDENTIFIER",
+ "name": "TypeError",
+ "startPosition": "1324"
+ },
+ "type": {
+ "endPosition": "1333",
+ "kind": "IDENTIFIER",
+ "name": "TypeError",
+ "startPosition": "1324"
+ },
+ "startPosition": "1311"
+ },
+ "endPosition": "1347",
+ "kind": "CATCH",
+ "parameter": {
+ "endPosition": "1307",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1306"
+ },
+ "block": {
+ "endPosition": "1347",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1345",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1343",
+ "kind": "IDENTIFIER",
+ "name": "handle",
+ "startPosition": "1337"
+ },
+ "arguments": [],
+ "startPosition": "1337"
+ },
+ "endPosition": "1345",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1337"
+ }
+ ],
+ "startPosition": "1335"
+ },
+ "startPosition": "1299"
+ },
+ {
+ "endPosition": "1368",
+ "kind": "CATCH",
+ "parameter": {
+ "endPosition": "1356",
+ "kind": "IDENTIFIER",
+ "name": "e",
+ "startPosition": "1355"
+ },
+ "block": {
+ "endPosition": "1368",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1366",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1364",
+ "kind": "IDENTIFIER",
+ "name": "rest",
+ "startPosition": "1360"
+ },
+ "arguments": [],
+ "startPosition": "1360"
+ },
+ "endPosition": "1366",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1360"
+ }
+ ],
+ "startPosition": "1358"
+ },
+ "startPosition": "1348"
+ }
+ ],
+ "block": {
+ "endPosition": "1298",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1296",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1294",
+ "kind": "IDENTIFIER",
+ "name": "that",
+ "startPosition": "1290"
+ },
+ "arguments": [],
+ "startPosition": "1290"
+ },
+ "endPosition": "1296",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1290"
+ }
+ ],
+ "startPosition": "1288"
+ },
+ "startPosition": "1284"
+ }
+ ],
+ "sourceName": "parsertests/tryCatchStat.js",
+ "strict": "false",
+ "startPosition": "1121"
+}
+,
+{
+ "endPosition": "1115",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1116",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1115"
+ },
+ "endPosition": "1118",
+ "kind": "POSTFIX_INCREMENT",
+ "startPosition": "1115"
+ },
+ "endPosition": "1118",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1115"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1121",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1120"
+ },
+ "endPosition": "1123",
+ "kind": "POSTFIX_DECREMENT",
+ "startPosition": "1120"
+ },
+ "endPosition": "1123",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1120"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1133",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1132"
+ },
+ "endPosition": "1133",
+ "kind": "DELETE",
+ "startPosition": "1125"
+ },
+ "endPosition": "1133",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1125"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1141",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1140"
+ },
+ "endPosition": "1141",
+ "kind": "VOID",
+ "startPosition": "1135"
+ },
+ "endPosition": "1141",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1135"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1151",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1150"
+ },
+ "endPosition": "1151",
+ "kind": "TYPEOF",
+ "startPosition": "1143"
+ },
+ "endPosition": "1151",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1143"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1156",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1155"
+ },
+ "endPosition": "1156",
+ "kind": "PREFIX_INCREMENT",
+ "startPosition": "1153"
+ },
+ "endPosition": "1156",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1153"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1161",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1160"
+ },
+ "endPosition": "1161",
+ "kind": "PREFIX_DECREMENT",
+ "startPosition": "1158"
+ },
+ "endPosition": "1161",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1158"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1165",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1164"
+ },
+ "endPosition": "1165",
+ "kind": "PLUS",
+ "startPosition": "1163"
+ },
+ "endPosition": "1165",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1163"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1169",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1168"
+ },
+ "endPosition": "1169",
+ "kind": "MINUS",
+ "startPosition": "1167"
+ },
+ "endPosition": "1169",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1167"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1173",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1172"
+ },
+ "endPosition": "1173",
+ "kind": "BITWISE_COMPLEMENT",
+ "startPosition": "1171"
+ },
+ "endPosition": "1173",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1171"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1177",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1176"
+ },
+ "endPosition": "1177",
+ "kind": "LOGICAL_COMPLEMENT",
+ "startPosition": "1175"
+ },
+ "endPosition": "1177",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1175"
+ }
+ ],
+ "sourceName": "parsertests/unaryExpr.js",
+ "strict": "false",
+ "startPosition": "1115"
+}
+,
+{
+ "endPosition": "1122",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1165",
+ "kind": "FUNCTION",
+ "name": "f",
+ "body": {
+ "endPosition": "1162",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1162",
+ "kind": "STRING_LITERAL",
+ "value": "use strict",
+ "startPosition": "1152"
+ },
+ "endPosition": "1162",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1152"
+ }
+ ],
+ "startPosition": "1149"
+ },
+ "strict": "true",
+ "startPosition": "1136",
+ "parameters": []
+ },
+ {
+ "expression": {
+ "endPosition": "1133",
+ "kind": "STRING_LITERAL",
+ "value": "use strict",
+ "startPosition": "1123"
+ },
+ "endPosition": "1133",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1123"
+ }
+ ],
+ "sourceName": "parsertests/useStrict.js",
+ "strict": "true",
+ "startPosition": "1122"
+}
+,
+{
+ "endPosition": "1143",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1148",
+ "kind": "VARIABLE",
+ "name": "a",
+ "startPosition": "1147"
+ },
+ {
+ "endPosition": "1155",
+ "kind": "VARIABLE",
+ "name": "a",
+ "startPosition": "1154"
+ },
+ {
+ "endPosition": "1158",
+ "kind": "VARIABLE",
+ "name": "b",
+ "startPosition": "1157"
+ },
+ {
+ "endPosition": "1200",
+ "kind": "VARIABLE",
+ "name": "a",
+ "startPosition": "1190",
+ "initializer": {
+ "endPosition": "1200",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1195"
+ }
+ },
+ {
+ "endPosition": "1212",
+ "kind": "VARIABLE",
+ "name": "a",
+ "startPosition": "1207",
+ "initializer": {
+ "endPosition": "1212",
+ "kind": "NUMBER_LITERAL",
+ "value": "1",
+ "startPosition": "1211"
+ }
+ },
+ {
+ "endPosition": "1219",
+ "kind": "VARIABLE",
+ "name": "b",
+ "startPosition": "1214",
+ "initializer": {
+ "endPosition": "1219",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "1218"
+ }
+ },
+ {
+ "endPosition": "1226",
+ "kind": "VARIABLE",
+ "name": "c",
+ "startPosition": "1221",
+ "initializer": {
+ "endPosition": "1226",
+ "kind": "NUMBER_LITERAL",
+ "value": "3",
+ "startPosition": "1225"
+ }
+ }
+ ],
+ "sourceName": "parsertests/varDecl.js",
+ "strict": "false",
+ "startPosition": "1143"
+}
+,
+{
+ "endPosition": "1111",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1133",
+ "kind": "WITH",
+ "scope": {
+ "endPosition": "1122",
+ "kind": "IDENTIFIER",
+ "name": "scope",
+ "startPosition": "1117"
+ },
+ "statement": {
+ "endPosition": "1133",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1131",
+ "kind": "IDENTIFIER",
+ "name": "y",
+ "startPosition": "1130"
+ },
+ "endPosition": "1131",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "endPosition": "1127",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1126"
+ },
+ "startPosition": "1126"
+ },
+ "endPosition": "1131",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1126"
+ }
+ ],
+ "startPosition": "1124"
+ },
+ "startPosition": "1111"
+ }
+ ],
+ "sourceName": "parsertests/withStat.js",
+ "strict": "false",
+ "startPosition": "1111"
+}
+,
+{
+ "fileName": "parsernegativetests/caseoutofswitch.js",
+ "code": "case (1090, 4)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1090",
+ "message": "parsernegativetests/caseoutofswitch.js:29:0 Expected an operand but found case\ncase 23:\n^",
+ "lineNumber": "29"
+}
+,
+{
+ "fileName": "parsernegativetests/caseoutofswitch.js",
+ "code": "default (1112, 7)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1112",
+ "message": "parsernegativetests/caseoutofswitch.js:31:0 Expected an operand but found default\ndefault:\n^",
+ "lineNumber": "31"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1098",
+ "kind": "ERROR",
+ "startPosition": "1090"
+ },
+ "endPosition": "1098",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1090"
+ },
+ {
+ "expression": {
+ "endPosition": "1110",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1104",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1099"
+ },
+ "arguments": [
+ {
+ "endPosition": "1108",
+ "kind": "STRING_LITERAL",
+ "value": "23",
+ "startPosition": "1106"
+ }
+ ],
+ "startPosition": "1099"
+ },
+ "endPosition": "1110",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1099"
+ },
+ {
+ "expression": {
+ "endPosition": "1120",
+ "kind": "ERROR",
+ "startPosition": "1112"
+ },
+ "endPosition": "1120",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1112"
+ },
+ {
+ "expression": {
+ "endPosition": "1135",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "1126",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "1121"
+ },
+ "arguments": [
+ {
+ "endPosition": "1133",
+ "kind": "STRING_LITERAL",
+ "value": "hello",
+ "startPosition": "1128"
+ }
+ ],
+ "startPosition": "1121"
+ },
+ "endPosition": "1135",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1121"
+ }
+ ],
+ "sourceName": "parsernegativetests/caseoutofswitch.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/illegalbreak.js",
+ "code": "break (1090, 5)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1090",
+ "message": "parsernegativetests/illegalbreak.js:29:0 Illegal break statement\nbreak;\n^",
+ "lineNumber": "29"
+}
+,
+{
+ "fileName": "parsernegativetests/illegalbreak.js",
+ "code": "ident (1103, 3)",
+ "columnNumber": "6",
+ "kind": "ERROR",
+ "position": "1103",
+ "message": "parsernegativetests/illegalbreak.js:30:6 Undefined Label \"foo\"\nbreak foo;\n ^",
+ "lineNumber": "30"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1096",
+ "kind": "ERROR",
+ "startPosition": "1095"
+ },
+ "endPosition": "1096",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1095"
+ },
+ {
+ "expression": {
+ "endPosition": "1107",
+ "kind": "ERROR",
+ "startPosition": "1106"
+ },
+ "endPosition": "1107",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1106"
+ }
+ ],
+ "sourceName": "parsernegativetests/illegalbreak.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/illegalcontinue.js",
+ "code": "continue (1090, 8)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1090",
+ "message": "parsernegativetests/illegalcontinue.js:29:0 Illegal continue statement\ncontinue;\n^",
+ "lineNumber": "29"
+}
+,
+{
+ "fileName": "parsernegativetests/illegalcontinue.js",
+ "code": "ident (1109, 3)",
+ "columnNumber": "9",
+ "kind": "ERROR",
+ "position": "1109",
+ "message": "parsernegativetests/illegalcontinue.js:30:9 Undefined Label \"foo\"\ncontinue foo;\n ^",
+ "lineNumber": "30"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1099",
+ "kind": "ERROR",
+ "startPosition": "1098"
+ },
+ "endPosition": "1099",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1098"
+ },
+ {
+ "expression": {
+ "endPosition": "1113",
+ "kind": "ERROR",
+ "startPosition": "1112"
+ },
+ "endPosition": "1113",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1112"
+ }
+ ],
+ "sourceName": "parsernegativetests/illegalcontinue.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/illegallvalue.js",
+ "code": "decimal (1090, 2)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1090",
+ "message": "parsernegativetests/illegallvalue.js:29:0 Invalid left hand side for assignment\n44 = 54;\n^",
+ "lineNumber": "29"
+}
+,
+{
+ "fileName": "parsernegativetests/illegallvalue.js",
+ "code": "decimal (1099, 3)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1099",
+ "message": "parsernegativetests/illegallvalue.js:30:0 Invalid left hand side for assignment\n233 += 33;\n^",
+ "lineNumber": "30"
+}
+,
+{
+ "fileName": "parsernegativetests/illegallvalue.js",
+ "code": "decimal (1110, 4)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1110",
+ "message": "parsernegativetests/illegallvalue.js:31:0 Invalid left hand side for assignment\n3423 -= 234;\n^",
+ "lineNumber": "31"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1098",
+ "kind": "ERROR",
+ "startPosition": "1097"
+ },
+ "endPosition": "1098",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1097"
+ },
+ {
+ "expression": {
+ "endPosition": "1109",
+ "kind": "ERROR",
+ "startPosition": "1108"
+ },
+ "endPosition": "1109",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1108"
+ },
+ {
+ "expression": {
+ "endPosition": "1122",
+ "kind": "ERROR",
+ "startPosition": "1121"
+ },
+ "endPosition": "1122",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1121"
+ }
+ ],
+ "sourceName": "parsernegativetests/illegallvalue.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/illegaloperator.js",
+ "code": "* (1093, 1)",
+ "columnNumber": "3",
+ "kind": "ERROR",
+ "position": "1093",
+ "message": "parsernegativetests/illegaloperator.js:29:3 Expected an operand but found *\nx ** y\n ^",
+ "lineNumber": "29"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1096",
+ "kind": "ERROR",
+ "startPosition": "1093"
+ },
+ "endPosition": "1096",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1093"
+ }
+ ],
+ "sourceName": "parsernegativetests/illegaloperator.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/keywordident.js",
+ "code": "var (1094, 3)",
+ "columnNumber": "4",
+ "kind": "ERROR",
+ "position": "1094",
+ "message": "parsernegativetests/keywordident.js:29:4 Expected ident but found var\nvar var = 23;\n ^",
+ "lineNumber": "29"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1103",
+ "kind": "ERROR",
+ "startPosition": "1094"
+ },
+ "endPosition": "1103",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1094"
+ },
+ {
+ "endPosition": "1115",
+ "kind": "VARIABLE",
+ "name": "x",
+ "startPosition": "1108",
+ "initializer": {
+ "endPosition": "1115",
+ "kind": "NUMBER_LITERAL",
+ "value": "223",
+ "startPosition": "1112"
+ }
+ }
+ ],
+ "sourceName": "parsernegativetests/keywordident.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/parenmissing.js",
+ "code": "; (1096, 1)",
+ "columnNumber": "6",
+ "kind": "ERROR",
+ "position": "1096",
+ "message": "parsernegativetests/parenmissing.js:29:6 Expected ) but found ;\n(1 + 2;\n ^",
+ "lineNumber": "29"
+}
+,
+{
+ "fileName": "parsernegativetests/parenmissing.js",
+ "code": ") (1103, 1)",
+ "columnNumber": "5",
+ "kind": "ERROR",
+ "position": "1103",
+ "message": "parsernegativetests/parenmissing.js:30:5 Expected ; but found )\nx * y);\n ^",
+ "lineNumber": "30"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1097",
+ "kind": "ERROR",
+ "startPosition": "1096"
+ },
+ "endPosition": "1097",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1096"
+ },
+ {
+ "expression": {
+ "leftOperand": {
+ "endPosition": "1099",
+ "kind": "IDENTIFIER",
+ "name": "x",
+ "startPosition": "1098"
+ },
+ "endPosition": "1103",
+ "kind": "MULTIPLY",
+ "rightOperand": {
+ "endPosition": "1103",
+ "kind": "IDENTIFIER",
+ "name": "y",
+ "startPosition": "1102"
+ },
+ "startPosition": "1098"
+ },
+ "endPosition": "1103",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1098"
+ },
+ {
+ "expression": {
+ "endPosition": "1105",
+ "kind": "ERROR",
+ "startPosition": "1103"
+ },
+ "endPosition": "1105",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1103"
+ }
+ ],
+ "sourceName": "parsernegativetests/parenmissing.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/repeatedproperty.js",
+ "code": "ident (1111, 3)",
+ "columnNumber": "21",
+ "kind": "ERROR",
+ "position": "1111",
+ "message": "parsernegativetests/repeatedproperty.js:29:21 Property \"foo\" already defined\nvar obj = { foo: 34, get foo() { return 'hello' } };\n ^",
+ "lineNumber": "29"
+}
+,
+{
+ "fileName": "parsernegativetests/repeatedproperty.js",
+ "code": "ident (1165, 3)",
+ "columnNumber": "22",
+ "kind": "ERROR",
+ "position": "1165",
+ "message": "parsernegativetests/repeatedproperty.js:30:22 Property \"foo\" already defined\nvar obj1 = { foo: 34, set foo(x) { } };\n ^",
+ "lineNumber": "30"
+}
+,
+{
+ "fileName": "parsernegativetests/repeatedproperty.js",
+ "code": "ident (1205, 3)",
+ "columnNumber": "22",
+ "kind": "ERROR",
+ "position": "1205",
+ "message": "parsernegativetests/repeatedproperty.js:31:22 Property \"foo\" already defined\nvar obj2 = { foo: 34, set foo(x) { } };\n ^",
+ "lineNumber": "31"
+}
+,
+{
+ "fileName": "parsernegativetests/repeatedproperty.js",
+ "code": "ident (1251, 3)",
+ "columnNumber": "28",
+ "kind": "ERROR",
+ "position": "1251",
+ "message": "parsernegativetests/repeatedproperty.js:32:28 Property \"bar\" already defined\nvar obj3 = { get bar() { }, get bar() {} };\n ^",
+ "lineNumber": "32"
+}
+,
+{
+ "fileName": "parsernegativetests/repeatedproperty.js",
+ "code": "ident (1296, 3)",
+ "columnNumber": "29",
+ "kind": "ERROR",
+ "position": "1296",
+ "message": "parsernegativetests/repeatedproperty.js:33:29 Property \"bar\" already defined\nvar obj4 = { set bar(x) { }, set bar(x) {} };\n ^",
+ "lineNumber": "33"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1141",
+ "kind": "ERROR",
+ "startPosition": "1140"
+ },
+ "endPosition": "1141",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1140"
+ },
+ {
+ "expression": {
+ "endPosition": "1181",
+ "kind": "ERROR",
+ "startPosition": "1180"
+ },
+ "endPosition": "1181",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1180"
+ },
+ {
+ "expression": {
+ "endPosition": "1221",
+ "kind": "ERROR",
+ "startPosition": "1220"
+ },
+ "endPosition": "1221",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1220"
+ },
+ {
+ "expression": {
+ "endPosition": "1265",
+ "kind": "ERROR",
+ "startPosition": "1264"
+ },
+ "endPosition": "1265",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1264"
+ },
+ {
+ "expression": {
+ "endPosition": "1311",
+ "kind": "ERROR",
+ "startPosition": "1310"
+ },
+ "endPosition": "1311",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1310"
+ }
+ ],
+ "sourceName": "parsernegativetests/repeatedproperty.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/strict_repeatedproperty.js",
+ "code": "ident (1126, 3)",
+ "columnNumber": "21",
+ "kind": "ERROR",
+ "position": "1126",
+ "message": "parsernegativetests/strict_repeatedproperty.js:31:21 Property \"foo\" already defined\nvar obj = { foo: 34, foo: 'hello' };\n ^",
+ "lineNumber": "31"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1101",
+ "kind": "STRING_LITERAL",
+ "value": "use strict",
+ "startPosition": "1091"
+ },
+ "endPosition": "1101",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1091"
+ },
+ {
+ "expression": {
+ "endPosition": "1140",
+ "kind": "ERROR",
+ "startPosition": "1139"
+ },
+ "endPosition": "1140",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1139"
+ }
+ ],
+ "sourceName": "parsernegativetests/strict_repeatedproperty.js",
+ "strict": "true",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/strict_repeatparam.js",
+ "code": "ident (1119, 1)",
+ "columnNumber": "14",
+ "kind": "ERROR",
+ "position": "1119",
+ "message": "parsernegativetests/strict_repeatparam.js:31:14 strict mode function cannot have duplicate parameter name \"x\"\nfunction func(x, x) {}\n ^",
+ "lineNumber": "31"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1101",
+ "kind": "STRING_LITERAL",
+ "value": "use strict",
+ "startPosition": "1091"
+ },
+ "endPosition": "1101",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1091"
+ },
+ {
+ "expression": {
+ "endPosition": "1127",
+ "kind": "ERROR",
+ "startPosition": "1128"
+ },
+ "endPosition": "1127",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1128"
+ }
+ ],
+ "sourceName": "parsernegativetests/strict_repeatparam.js",
+ "strict": "true",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/strict_with.js",
+ "code": "with (1105, 4)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1105",
+ "message": "parsernegativetests/strict_with.js:31:0 \"with\" statement cannot be used in strict mode\nwith({}) {}\n^",
+ "lineNumber": "31"
+}
+,
+{
+ "fileName": "parsernegativetests/strict_with.js",
+ "code": ") (1112, 1)",
+ "columnNumber": "7",
+ "kind": "ERROR",
+ "position": "1112",
+ "message": "parsernegativetests/strict_with.js:31:7 Expected ; but found )\nwith({}) {}\n ^",
+ "lineNumber": "31"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1101",
+ "kind": "STRING_LITERAL",
+ "value": "use strict",
+ "startPosition": "1091"
+ },
+ "endPosition": "1101",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1091"
+ },
+ {
+ "expression": {
+ "endPosition": "1112",
+ "kind": "ERROR",
+ "startPosition": "1109"
+ },
+ "endPosition": "1112",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1109"
+ },
+ {
+ "expression": {
+ "endPosition": "1116",
+ "kind": "ERROR",
+ "startPosition": "1112"
+ },
+ "endPosition": "1116",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1112"
+ }
+ ],
+ "sourceName": "parsernegativetests/strict_with.js",
+ "strict": "true",
+ "startPosition": "1090"
+}
+,
+{
+ "fileName": "parsernegativetests/toplevelreturn.js",
+ "code": "return (1090, 6)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1090",
+ "message": "parsernegativetests/toplevelreturn.js:29:0 Invalid return statement\nreturn;\n^",
+ "lineNumber": "29"
+}
+,
+{
+ "fileName": "parsernegativetests/toplevelreturn.js",
+ "code": "return (1098, 6)",
+ "columnNumber": "0",
+ "kind": "ERROR",
+ "position": "1098",
+ "message": "parsernegativetests/toplevelreturn.js:30:0 Invalid return statement\nreturn 23;\n^",
+ "lineNumber": "30"
+}
+,
+{
+ "endPosition": "1090",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "expression": {
+ "endPosition": "1097",
+ "kind": "ERROR",
+ "startPosition": "1090"
+ },
+ "endPosition": "1097",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1090"
+ },
+ {
+ "expression": {
+ "endPosition": "1108",
+ "kind": "ERROR",
+ "startPosition": "1098"
+ },
+ "endPosition": "1108",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1098"
+ }
+ ],
+ "sourceName": "parsernegativetests/toplevelreturn.js",
+ "strict": "false",
+ "startPosition": "1090"
+}
+,
+{
+ "endPosition": "1136",
+ "kind": "COMPILATION_UNIT",
+ "sourceElements": [
+ {
+ "endPosition": "1240",
+ "kind": "FUNCTION",
+ "name": "Parser",
+ "body": {
+ "endPosition": "1218",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1217",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "create",
+ "expression": {
+ "endPosition": "1208",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1202"
+ },
+ "endPosition": "1215",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1202"
+ },
+ "arguments": [],
+ "startPosition": "1202"
+ },
+ "endPosition": "1217",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "_parser",
+ "expression": {
+ "endPosition": "1191",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "1187"
+ },
+ "endPosition": "1199",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1187"
+ },
+ "startPosition": "1187"
+ },
+ "endPosition": "1217",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1187"
+ }
+ ],
+ "startPosition": "1154"
+ },
+ "strict": "false",
+ "startPosition": "1136",
+ "parameters": []
+ },
+ {
+ "endPosition": "3598",
+ "kind": "FUNCTION",
+ "name": "processFiles",
+ "body": {
+ "endPosition": "3555",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "2938",
+ "kind": "VARIABLE",
+ "name": "File",
+ "startPosition": "2906",
+ "initializer": {
+ "endPosition": "2938",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "type",
+ "expression": {
+ "endPosition": "2917",
+ "kind": "IDENTIFIER",
+ "name": "Java",
+ "startPosition": "2913"
+ },
+ "endPosition": "2922",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2913"
+ },
+ "arguments": [
+ {
+ "endPosition": "2936",
+ "kind": "STRING_LITERAL",
+ "value": "java.io.File",
+ "startPosition": "2924"
+ }
+ ],
+ "startPosition": "2913"
+ }
+ },
+ {
+ "endPosition": "2993",
+ "kind": "VARIABLE",
+ "name": "files",
+ "startPosition": "2947",
+ "initializer": {
+ "endPosition": "2993",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "listFiles",
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "2981",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "2963",
+ "kind": "IDENTIFIER",
+ "name": "File",
+ "startPosition": "2959"
+ },
+ "arguments": [
+ {
+ "leftOperand": {
+ "endPosition": "2971",
+ "kind": "IDENTIFIER",
+ "name": "__DIR__",
+ "startPosition": "2964"
+ },
+ "endPosition": "2980",
+ "kind": "PLUS",
+ "rightOperand": {
+ "endPosition": "2980",
+ "kind": "IDENTIFIER",
+ "name": "subdir",
+ "startPosition": "2974"
+ },
+ "startPosition": "2964"
+ }
+ ],
+ "startPosition": "2959"
+ },
+ "endPosition": "2981",
+ "kind": "NEW",
+ "startPosition": "2955"
+ },
+ "endPosition": "2991",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2955"
+ },
+ "arguments": [],
+ "startPosition": "2955"
+ }
+ },
+ {
+ "expression": {
+ "endPosition": "3026",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "sort",
+ "expression": {
+ "identifier": "Arrays",
+ "expression": {
+ "identifier": "util",
+ "expression": {
+ "endPosition": "3002",
+ "kind": "IDENTIFIER",
+ "name": "java",
+ "startPosition": "2998"
+ },
+ "endPosition": "3007",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2998"
+ },
+ "endPosition": "3014",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2998"
+ },
+ "endPosition": "3019",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2998"
+ },
+ "arguments": [
+ {
+ "endPosition": "3025",
+ "kind": "IDENTIFIER",
+ "name": "files",
+ "startPosition": "3020"
+ }
+ ],
+ "startPosition": "2998"
+ },
+ "endPosition": "3026",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "2998"
+ },
+ {
+ "endPosition": "3049",
+ "kind": "VARIABLE",
+ "name": "file",
+ "startPosition": "3045"
+ },
+ {
+ "expression": {
+ "endPosition": "3058",
+ "kind": "IDENTIFIER",
+ "name": "files",
+ "startPosition": "3053"
+ },
+ "endPosition": "3555",
+ "kind": "FOR_IN_LOOP",
+ "forEach": "true",
+ "variable": {
+ "endPosition": "3049",
+ "kind": "IDENTIFIER",
+ "name": "file",
+ "startPosition": "3045"
+ },
+ "statement": {
+ "endPosition": "3555",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "condition": {
+ "endPosition": "3098",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "endsWith",
+ "expression": {
+ "identifier": "name",
+ "expression": {
+ "endPosition": "3077",
+ "kind": "IDENTIFIER",
+ "name": "file",
+ "startPosition": "3073"
+ },
+ "endPosition": "3082",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3073"
+ },
+ "endPosition": "3091",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3073"
+ },
+ "arguments": [
+ {
+ "endPosition": "3096",
+ "kind": "STRING_LITERAL",
+ "value": ".js",
+ "startPosition": "3093"
+ }
+ ],
+ "startPosition": "3073"
+ },
+ "endPosition": "3550",
+ "kind": "IF",
+ "startPosition": "3069",
+ "thenStatement": {
+ "endPosition": "3550",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "3141",
+ "kind": "VARIABLE",
+ "name": "script",
+ "startPosition": "3117",
+ "initializer": {
+ "endPosition": "3141",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3135",
+ "kind": "IDENTIFIER",
+ "name": "readFully",
+ "startPosition": "3126"
+ },
+ "arguments": [
+ {
+ "endPosition": "3140",
+ "kind": "IDENTIFIER",
+ "name": "file",
+ "startPosition": "3136"
+ }
+ ],
+ "startPosition": "3126"
+ }
+ },
+ {
+ "endPosition": "3179",
+ "kind": "VARIABLE",
+ "name": "parser",
+ "startPosition": "3158",
+ "initializer": {
+ "constructorExpression": {
+ "endPosition": "3179",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3177",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "3171"
+ },
+ "arguments": [],
+ "startPosition": "3171"
+ },
+ "endPosition": "3179",
+ "kind": "NEW",
+ "startPosition": "3167"
+ }
+ },
+ {
+ "endPosition": "3415",
+ "kind": "VARIABLE",
+ "name": "tree",
+ "startPosition": "3196",
+ "initializer": {
+ "endPosition": "3415",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "parse",
+ "expression": {
+ "endPosition": "3209",
+ "kind": "IDENTIFIER",
+ "name": "parser",
+ "startPosition": "3203"
+ },
+ "endPosition": "3215",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3203"
+ },
+ "arguments": [
+ {
+ "leftOperand": {
+ "leftOperand": {
+ "endPosition": "3222",
+ "kind": "IDENTIFIER",
+ "name": "subdir",
+ "startPosition": "3216"
+ },
+ "endPosition": "3227",
+ "kind": "PLUS",
+ "rightOperand": {
+ "endPosition": "3227",
+ "kind": "STRING_LITERAL",
+ "value": "/",
+ "startPosition": "3226"
+ },
+ "startPosition": "3216"
+ },
+ "endPosition": "3240",
+ "kind": "PLUS",
+ "rightOperand": {
+ "identifier": "name",
+ "expression": {
+ "endPosition": "3235",
+ "kind": "IDENTIFIER",
+ "name": "file",
+ "startPosition": "3231"
+ },
+ "endPosition": "3240",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3231"
+ },
+ "startPosition": "3216"
+ },
+ {
+ "endPosition": "3248",
+ "kind": "IDENTIFIER",
+ "name": "script",
+ "startPosition": "3242"
+ },
+ {
+ "endPosition": "3286",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "3397",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "3365",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3312",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "3307"
+ },
+ "arguments": [
+ {
+ "endPosition": "3364",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "stringify",
+ "expression": {
+ "endPosition": "3317",
+ "kind": "IDENTIFIER",
+ "name": "JSON",
+ "startPosition": "3313"
+ },
+ "endPosition": "3327",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3313"
+ },
+ "arguments": [
+ {
+ "endPosition": "3354",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "convert",
+ "expression": {
+ "endPosition": "3334",
+ "kind": "IDENTIFIER",
+ "name": "parser",
+ "startPosition": "3328"
+ },
+ "endPosition": "3342",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3328"
+ },
+ "arguments": [
+ {
+ "endPosition": "3353",
+ "kind": "IDENTIFIER",
+ "name": "diagnostic",
+ "startPosition": "3343"
+ }
+ ],
+ "startPosition": "3328"
+ },
+ {
+ "endPosition": "3360",
+ "kind": "NULL_LITERAL",
+ "startPosition": "3356"
+ },
+ {
+ "endPosition": "3363",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "3362"
+ }
+ ],
+ "startPosition": "3313"
+ }
+ ],
+ "startPosition": "3307"
+ },
+ "endPosition": "3365",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3307"
+ },
+ {
+ "expression": {
+ "endPosition": "3396",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3391",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "3386"
+ },
+ "arguments": [
+ {
+ "endPosition": "3394",
+ "kind": "STRING_LITERAL",
+ "value": ",",
+ "startPosition": "3393"
+ }
+ ],
+ "startPosition": "3386"
+ },
+ "endPosition": "3396",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3386"
+ }
+ ],
+ "startPosition": "3286"
+ },
+ "strict": "false",
+ "startPosition": "3286",
+ "parameters": [
+ {
+ "endPosition": "3284",
+ "kind": "IDENTIFIER",
+ "name": "diagnostic",
+ "startPosition": "3274"
+ }
+ ]
+ }
+ ],
+ "startPosition": "3203"
+ }
+ },
+ {
+ "condition": {
+ "leftOperand": {
+ "endPosition": "3437",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "3433"
+ },
+ "endPosition": "3445",
+ "kind": "NOT_EQUAL_TO",
+ "rightOperand": {
+ "endPosition": "3445",
+ "kind": "NULL_LITERAL",
+ "startPosition": "3441"
+ },
+ "startPosition": "3433"
+ },
+ "endPosition": "3541",
+ "kind": "IF",
+ "startPosition": "3429",
+ "thenStatement": {
+ "endPosition": "3541",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "3500",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3469",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "3464"
+ },
+ "arguments": [
+ {
+ "endPosition": "3499",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "stringify",
+ "expression": {
+ "endPosition": "3474",
+ "kind": "IDENTIFIER",
+ "name": "JSON",
+ "startPosition": "3470"
+ },
+ "endPosition": "3484",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3470"
+ },
+ "arguments": [
+ {
+ "endPosition": "3489",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "3485"
+ },
+ {
+ "endPosition": "3495",
+ "kind": "NULL_LITERAL",
+ "startPosition": "3491"
+ },
+ {
+ "endPosition": "3498",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "3497"
+ }
+ ],
+ "startPosition": "3470"
+ }
+ ],
+ "startPosition": "3464"
+ },
+ "endPosition": "3500",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3464"
+ },
+ {
+ "expression": {
+ "endPosition": "3527",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3522",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "3517"
+ },
+ "arguments": [
+ {
+ "endPosition": "3525",
+ "kind": "STRING_LITERAL",
+ "value": ",",
+ "startPosition": "3524"
+ }
+ ],
+ "startPosition": "3517"
+ },
+ "endPosition": "3527",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3517"
+ }
+ ],
+ "startPosition": "3447"
+ }
+ }
+ ],
+ "startPosition": "3100"
+ }
+ }
+ ],
+ "startPosition": "3060"
+ },
+ "startPosition": "3031"
+ }
+ ],
+ "startPosition": "2897"
+ },
+ "strict": "false",
+ "startPosition": "2867",
+ "parameters": [
+ {
+ "endPosition": "2895",
+ "kind": "IDENTIFIER",
+ "name": "subdir",
+ "startPosition": "2889"
+ }
+ ]
+ },
+ {
+ "endPosition": "3901",
+ "kind": "FUNCTION",
+ "name": "main",
+ "body": {
+ "endPosition": "3899",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "3631",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3626",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "3621"
+ },
+ "arguments": [
+ {
+ "endPosition": "3629",
+ "kind": "STRING_LITERAL",
+ "value": "[",
+ "startPosition": "3628"
+ }
+ ],
+ "startPosition": "3621"
+ },
+ "endPosition": "3631",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3621"
+ },
+ {
+ "expression": {
+ "endPosition": "3665",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3650",
+ "kind": "IDENTIFIER",
+ "name": "processFiles",
+ "startPosition": "3638"
+ },
+ "arguments": [
+ {
+ "endPosition": "3663",
+ "kind": "STRING_LITERAL",
+ "value": "parsertests",
+ "startPosition": "3652"
+ }
+ ],
+ "startPosition": "3638"
+ },
+ "endPosition": "3665",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3638"
+ },
+ {
+ "expression": {
+ "endPosition": "3706",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3683",
+ "kind": "IDENTIFIER",
+ "name": "processFiles",
+ "startPosition": "3671"
+ },
+ "arguments": [
+ {
+ "endPosition": "3704",
+ "kind": "STRING_LITERAL",
+ "value": "parsernegativetests",
+ "startPosition": "3685"
+ }
+ ],
+ "startPosition": "3671"
+ },
+ "endPosition": "3706",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3671"
+ },
+ {
+ "endPosition": "3775",
+ "kind": "VARIABLE",
+ "name": "script",
+ "startPosition": "3747",
+ "initializer": {
+ "endPosition": "3775",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3765",
+ "kind": "IDENTIFIER",
+ "name": "readFully",
+ "startPosition": "3756"
+ },
+ "arguments": [
+ {
+ "endPosition": "3774",
+ "kind": "IDENTIFIER",
+ "name": "__FILE__",
+ "startPosition": "3766"
+ }
+ ],
+ "startPosition": "3756"
+ }
+ },
+ {
+ "endPosition": "3840",
+ "kind": "VARIABLE",
+ "name": "tree",
+ "startPosition": "3785",
+ "initializer": {
+ "endPosition": "3840",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "parse",
+ "expression": {
+ "constructorExpression": {
+ "endPosition": "3804",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3802",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "3796"
+ },
+ "arguments": [],
+ "startPosition": "3796"
+ },
+ "endPosition": "3804",
+ "kind": "NEW",
+ "startPosition": "3792"
+ },
+ "endPosition": "3810",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3792"
+ },
+ "arguments": [
+ {
+ "endPosition": "3824",
+ "kind": "STRING_LITERAL",
+ "value": "parserapi.js",
+ "startPosition": "3812"
+ },
+ {
+ "endPosition": "3833",
+ "kind": "IDENTIFIER",
+ "name": "script",
+ "startPosition": "3827"
+ },
+ {
+ "endPosition": "3839",
+ "kind": "NULL_LITERAL",
+ "startPosition": "3835"
+ }
+ ],
+ "startPosition": "3792"
+ }
+ },
+ {
+ "expression": {
+ "endPosition": "3882",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3851",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "3846"
+ },
+ "arguments": [
+ {
+ "endPosition": "3881",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "stringify",
+ "expression": {
+ "endPosition": "3856",
+ "kind": "IDENTIFIER",
+ "name": "JSON",
+ "startPosition": "3852"
+ },
+ "endPosition": "3866",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3852"
+ },
+ "arguments": [
+ {
+ "endPosition": "3871",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "3867"
+ },
+ {
+ "endPosition": "3877",
+ "kind": "NULL_LITERAL",
+ "startPosition": "3873"
+ },
+ {
+ "endPosition": "3880",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "3879"
+ }
+ ],
+ "startPosition": "3852"
+ }
+ ],
+ "startPosition": "3846"
+ },
+ "endPosition": "3882",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3846"
+ },
+ {
+ "expression": {
+ "endPosition": "3898",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3893",
+ "kind": "IDENTIFIER",
+ "name": "print",
+ "startPosition": "3888"
+ },
+ "arguments": [
+ {
+ "endPosition": "3896",
+ "kind": "STRING_LITERAL",
+ "value": "]",
+ "startPosition": "3895"
+ }
+ ],
+ "startPosition": "3888"
+ },
+ "endPosition": "3898",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3888"
+ }
+ ],
+ "startPosition": "3615"
+ },
+ "strict": "false",
+ "startPosition": "3599",
+ "parameters": []
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1305",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "type",
+ "expression": {
+ "endPosition": "1265",
+ "kind": "IDENTIFIER",
+ "name": "Java",
+ "startPosition": "1261"
+ },
+ "endPosition": "1270",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1261"
+ },
+ "arguments": [
+ {
+ "endPosition": "1303",
+ "kind": "STRING_LITERAL",
+ "value": "jdk.nashorn.api.tree.Diagnostic",
+ "startPosition": "1272"
+ }
+ ],
+ "startPosition": "1261"
+ },
+ "endPosition": "1305",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "Diagnostic",
+ "expression": {
+ "endPosition": "1247",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1241"
+ },
+ "endPosition": "1258",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1241"
+ },
+ "startPosition": "1241"
+ },
+ "endPosition": "1305",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1241"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1390",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "type",
+ "expression": {
+ "endPosition": "1338",
+ "kind": "IDENTIFIER",
+ "name": "Java",
+ "startPosition": "1334"
+ },
+ "endPosition": "1343",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1334"
+ },
+ "arguments": [
+ {
+ "endPosition": "1388",
+ "kind": "STRING_LITERAL",
+ "value": "jdk.nashorn.api.tree.SimpleTreeVisitorES5_1",
+ "startPosition": "1345"
+ }
+ ],
+ "startPosition": "1334"
+ },
+ "endPosition": "1390",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "SimpleTreeVisitor",
+ "expression": {
+ "endPosition": "1313",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1307"
+ },
+ "endPosition": "1331",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1307"
+ },
+ "startPosition": "1307"
+ },
+ "endPosition": "1390",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1307"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1444",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "type",
+ "expression": {
+ "endPosition": "1410",
+ "kind": "IDENTIFIER",
+ "name": "Java",
+ "startPosition": "1406"
+ },
+ "endPosition": "1415",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1406"
+ },
+ "arguments": [
+ {
+ "endPosition": "1442",
+ "kind": "STRING_LITERAL",
+ "value": "jdk.nashorn.api.tree.Tree",
+ "startPosition": "1417"
+ }
+ ],
+ "startPosition": "1406"
+ },
+ "endPosition": "1444",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "Tree",
+ "expression": {
+ "endPosition": "1398",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1392"
+ },
+ "endPosition": "1403",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1392"
+ },
+ "startPosition": "1392"
+ },
+ "endPosition": "1444",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1392"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1487",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "type",
+ "expression": {
+ "endPosition": "1464",
+ "kind": "IDENTIFIER",
+ "name": "Java",
+ "startPosition": "1460"
+ },
+ "endPosition": "1469",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1460"
+ },
+ "arguments": [
+ {
+ "endPosition": "1485",
+ "kind": "STRING_LITERAL",
+ "value": "java.util.List",
+ "startPosition": "1471"
+ }
+ ],
+ "startPosition": "1460"
+ },
+ "endPosition": "1487",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "List",
+ "expression": {
+ "endPosition": "1452",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1446"
+ },
+ "endPosition": "1457",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1446"
+ },
+ "startPosition": "1446"
+ },
+ "endPosition": "1487",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1446"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1530",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "type",
+ "expression": {
+ "endPosition": "1507",
+ "kind": "IDENTIFIER",
+ "name": "Java",
+ "startPosition": "1503"
+ },
+ "endPosition": "1512",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1503"
+ },
+ "arguments": [
+ {
+ "endPosition": "1528",
+ "kind": "STRING_LITERAL",
+ "value": "java.lang.Enum",
+ "startPosition": "1514"
+ }
+ ],
+ "startPosition": "1503"
+ },
+ "endPosition": "1530",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "Enum",
+ "expression": {
+ "endPosition": "1495",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1489"
+ },
+ "endPosition": "1500",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1489"
+ },
+ "startPosition": "1489"
+ },
+ "endPosition": "1530",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1489"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1657",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1803",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "1716",
+ "kind": "VARIABLE",
+ "name": "tree",
+ "startPosition": "1667",
+ "initializer": {
+ "endPosition": "1716",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "parse",
+ "expression": {
+ "identifier": "_parser",
+ "expression": {
+ "endPosition": "1678",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "1674"
+ },
+ "endPosition": "1686",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1674"
+ },
+ "endPosition": "1692",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1674"
+ },
+ "arguments": [
+ {
+ "endPosition": "1697",
+ "kind": "IDENTIFIER",
+ "name": "name",
+ "startPosition": "1693"
+ },
+ {
+ "endPosition": "1705",
+ "kind": "IDENTIFIER",
+ "name": "script",
+ "startPosition": "1699"
+ },
+ {
+ "endPosition": "1715",
+ "kind": "IDENTIFIER",
+ "name": "listener",
+ "startPosition": "1707"
+ }
+ ],
+ "startPosition": "1674"
+ }
+ },
+ {
+ "expression": {
+ "endPosition": "1771",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "accept",
+ "expression": {
+ "endPosition": "1726",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "1722"
+ },
+ "endPosition": "1733",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1722"
+ },
+ "arguments": [
+ {
+ "constructorExpression": {
+ "endPosition": "1764",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "SimpleTreeVisitor",
+ "expression": {
+ "endPosition": "1744",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1738"
+ },
+ "endPosition": "1762",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1738"
+ },
+ "arguments": [],
+ "startPosition": "1744"
+ },
+ "endPosition": "1764",
+ "kind": "NEW",
+ "startPosition": "1734"
+ },
+ {
+ "endPosition": "1770",
+ "kind": "NULL_LITERAL",
+ "startPosition": "1766"
+ }
+ ],
+ "startPosition": "1722"
+ },
+ "endPosition": "1771",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1722"
+ },
+ {
+ "expression": {
+ "endPosition": "1802",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "convert",
+ "expression": {
+ "endPosition": "1788",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "1784"
+ },
+ "endPosition": "1796",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1784"
+ },
+ "arguments": [
+ {
+ "endPosition": "1801",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "1797"
+ }
+ ],
+ "startPosition": "1784"
+ },
+ "endPosition": "1803",
+ "kind": "RETURN",
+ "startPosition": "1777"
+ }
+ ],
+ "startPosition": "1657"
+ },
+ "strict": "false",
+ "startPosition": "1657",
+ "parameters": [
+ {
+ "endPosition": "1637",
+ "kind": "IDENTIFIER",
+ "name": "name",
+ "startPosition": "1633"
+ },
+ {
+ "endPosition": "1645",
+ "kind": "IDENTIFIER",
+ "name": "script",
+ "startPosition": "1639"
+ },
+ {
+ "endPosition": "1655",
+ "kind": "IDENTIFIER",
+ "name": "listener",
+ "startPosition": "1647"
+ }
+ ]
+ },
+ "endPosition": "1657",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "parse",
+ "expression": {
+ "identifier": "prototype",
+ "expression": {
+ "endPosition": "1605",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1599"
+ },
+ "endPosition": "1615",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1599"
+ },
+ "endPosition": "1621",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1599"
+ },
+ "startPosition": "1599"
+ },
+ "endPosition": "1805",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1599"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "1834",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "1897",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "1896",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "create",
+ "expression": {
+ "endPosition": "1887",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "type",
+ "expression": {
+ "endPosition": "1851",
+ "kind": "IDENTIFIER",
+ "name": "Java",
+ "startPosition": "1847"
+ },
+ "endPosition": "1856",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1847"
+ },
+ "arguments": [
+ {
+ "endPosition": "1885",
+ "kind": "STRING_LITERAL",
+ "value": "jdk.nashorn.api.tree.Parser",
+ "startPosition": "1858"
+ }
+ ],
+ "startPosition": "1847"
+ },
+ "endPosition": "1894",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1847"
+ },
+ "arguments": [],
+ "startPosition": "1894"
+ },
+ "endPosition": "1897",
+ "kind": "RETURN",
+ "startPosition": "1840"
+ }
+ ],
+ "startPosition": "1834"
+ },
+ "strict": "false",
+ "startPosition": "1834",
+ "parameters": []
+ },
+ "endPosition": "1834",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "create",
+ "expression": {
+ "endPosition": "1813",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1807"
+ },
+ "endPosition": "1820",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1807"
+ },
+ "startPosition": "1807"
+ },
+ "endPosition": "1971",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1807"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "2014",
+ "kind": "FUNCTION_EXPRESSION",
+ "body": {
+ "endPosition": "2863",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "condition": {
+ "leftOperand": {
+ "expression": {
+ "endPosition": "2029",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "2025"
+ },
+ "endPosition": "2029",
+ "kind": "LOGICAL_COMPLEMENT",
+ "startPosition": "2024"
+ },
+ "endPosition": "2055",
+ "kind": "CONDITIONAL_OR",
+ "rightOperand": {
+ "leftOperand": {
+ "expression": {
+ "endPosition": "2044",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "2040"
+ },
+ "endPosition": "2044",
+ "kind": "TYPEOF",
+ "startPosition": "2033"
+ },
+ "endPosition": "2055",
+ "kind": "NOT_EQUAL_TO",
+ "rightOperand": {
+ "endPosition": "2055",
+ "kind": "STRING_LITERAL",
+ "value": "object",
+ "startPosition": "2049"
+ },
+ "startPosition": "2033"
+ },
+ "startPosition": "2024"
+ },
+ "endPosition": "2086",
+ "kind": "IF",
+ "startPosition": "2020",
+ "thenStatement": {
+ "endPosition": "2086",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "endPosition": "2079",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "2075"
+ },
+ "endPosition": "2080",
+ "kind": "RETURN",
+ "startPosition": "2068"
+ }
+ ],
+ "startPosition": "2058"
+ }
+ },
+ {
+ "endPosition": "2133",
+ "kind": "VARIABLE",
+ "name": "obj",
+ "startPosition": "2096",
+ "initializer": {
+ "endPosition": "2133",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "bindProperties",
+ "expression": {
+ "endPosition": "2108",
+ "kind": "IDENTIFIER",
+ "name": "Object",
+ "startPosition": "2102"
+ },
+ "endPosition": "2123",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2102"
+ },
+ "arguments": [
+ {
+ "endPosition": "2126",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "2124",
+ "properties": []
+ },
+ {
+ "endPosition": "2132",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "2128"
+ }
+ ],
+ "startPosition": "2102"
+ }
+ },
+ {
+ "endPosition": "2154",
+ "kind": "VARIABLE",
+ "name": "result",
+ "startPosition": "2143",
+ "initializer": {
+ "endPosition": "2154",
+ "kind": "OBJECT_LITERAL",
+ "startPosition": "2152",
+ "properties": []
+ }
+ },
+ {
+ "endPosition": "2170",
+ "kind": "VARIABLE",
+ "name": "i",
+ "startPosition": "2169"
+ },
+ {
+ "expression": {
+ "endPosition": "2177",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "2174"
+ },
+ "endPosition": "2845",
+ "kind": "FOR_IN_LOOP",
+ "forEach": "false",
+ "variable": {
+ "endPosition": "2170",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "2169"
+ },
+ "statement": {
+ "endPosition": "2845",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "2204",
+ "kind": "VARIABLE",
+ "name": "val",
+ "startPosition": "2192",
+ "initializer": {
+ "expression": {
+ "endPosition": "2201",
+ "kind": "IDENTIFIER",
+ "name": "obj",
+ "startPosition": "2198"
+ },
+ "endPosition": "2204",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "2203",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "2202"
+ },
+ "startPosition": "2198"
+ }
+ },
+ {
+ "condition": {
+ "leftOperand": {
+ "endPosition": "2220",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2217"
+ },
+ "expression": {
+ "endPosition": "2220",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2217"
+ },
+ "endPosition": "2243",
+ "kind": "INSTANCE_OF",
+ "rightOperand": {
+ "identifier": "Tree",
+ "expression": {
+ "endPosition": "2238",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "2232"
+ },
+ "endPosition": "2243",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2232"
+ },
+ "type": {
+ "identifier": "Tree",
+ "expression": {
+ "endPosition": "2238",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "2232"
+ },
+ "endPosition": "2243",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2232"
+ },
+ "startPosition": "2217"
+ },
+ "elseStatement": {
+ "condition": {
+ "leftOperand": {
+ "endPosition": "2309",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2306"
+ },
+ "expression": {
+ "endPosition": "2309",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2306"
+ },
+ "endPosition": "2332",
+ "kind": "INSTANCE_OF",
+ "rightOperand": {
+ "identifier": "List",
+ "expression": {
+ "endPosition": "2327",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "2321"
+ },
+ "endPosition": "2332",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2321"
+ },
+ "type": {
+ "identifier": "List",
+ "expression": {
+ "endPosition": "2327",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "2321"
+ },
+ "endPosition": "2332",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2321"
+ },
+ "startPosition": "2306"
+ },
+ "elseStatement": {
+ "endPosition": "2840",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "cases": [
+ {
+ "expression": {
+ "endPosition": "2574",
+ "kind": "STRING_LITERAL",
+ "value": "number",
+ "startPosition": "2568"
+ },
+ "endPosition": "2576",
+ "kind": "CASE",
+ "statements": [],
+ "startPosition": "2562"
+ },
+ {
+ "expression": {
+ "endPosition": "2603",
+ "kind": "STRING_LITERAL",
+ "value": "string",
+ "startPosition": "2597"
+ },
+ "endPosition": "2605",
+ "kind": "CASE",
+ "statements": [],
+ "startPosition": "2591"
+ },
+ {
+ "expression": {
+ "endPosition": "2633",
+ "kind": "STRING_LITERAL",
+ "value": "boolean",
+ "startPosition": "2626"
+ },
+ "endPosition": "2678",
+ "kind": "CASE",
+ "statements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "2677",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "2672",
+ "kind": "IDENTIFIER",
+ "name": "String",
+ "startPosition": "2666"
+ },
+ "arguments": [
+ {
+ "endPosition": "2676",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2673"
+ }
+ ],
+ "startPosition": "2666"
+ },
+ "endPosition": "2677",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "expression": {
+ "endPosition": "2660",
+ "kind": "IDENTIFIER",
+ "name": "result",
+ "startPosition": "2654"
+ },
+ "endPosition": "2663",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "2662",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "2661"
+ },
+ "startPosition": "2654"
+ },
+ "startPosition": "2654"
+ },
+ "endPosition": "2677",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "2654"
+ }
+ ],
+ "startPosition": "2620"
+ },
+ {
+ "endPosition": "2820",
+ "kind": "CASE",
+ "statements": [
+ {
+ "condition": {
+ "leftOperand": {
+ "endPosition": "2727",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2724"
+ },
+ "expression": {
+ "endPosition": "2727",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2724"
+ },
+ "endPosition": "2750",
+ "kind": "INSTANCE_OF",
+ "rightOperand": {
+ "identifier": "Enum",
+ "expression": {
+ "endPosition": "2745",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "2739"
+ },
+ "endPosition": "2750",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2739"
+ },
+ "type": {
+ "identifier": "Enum",
+ "expression": {
+ "endPosition": "2745",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "2739"
+ },
+ "endPosition": "2750",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2739"
+ },
+ "startPosition": "2724"
+ },
+ "endPosition": "2820",
+ "kind": "IF",
+ "startPosition": "2720",
+ "thenStatement": {
+ "endPosition": "2820",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "2799",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "2794",
+ "kind": "IDENTIFIER",
+ "name": "String",
+ "startPosition": "2788"
+ },
+ "arguments": [
+ {
+ "endPosition": "2798",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2795"
+ }
+ ],
+ "startPosition": "2788"
+ },
+ "endPosition": "2799",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "expression": {
+ "endPosition": "2782",
+ "kind": "IDENTIFIER",
+ "name": "result",
+ "startPosition": "2776"
+ },
+ "endPosition": "2785",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "2784",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "2783"
+ },
+ "startPosition": "2776"
+ },
+ "startPosition": "2776"
+ },
+ "endPosition": "2799",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "2776"
+ }
+ ],
+ "startPosition": "2752"
+ }
+ }
+ ],
+ "startPosition": "2693"
+ }
+ ],
+ "expression": {
+ "expression": {
+ "endPosition": "2544",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2541"
+ },
+ "endPosition": "2544",
+ "kind": "TYPEOF",
+ "startPosition": "2534"
+ },
+ "endPosition": "2832",
+ "kind": "SWITCH",
+ "startPosition": "2526"
+ }
+ ],
+ "startPosition": "2514"
+ },
+ "endPosition": "2840",
+ "kind": "IF",
+ "startPosition": "2302",
+ "thenStatement": {
+ "endPosition": "2508",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "endPosition": "2377",
+ "kind": "VARIABLE",
+ "name": "arr",
+ "startPosition": "2350",
+ "initializer": {
+ "constructorExpression": {
+ "endPosition": "2377",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "2365",
+ "kind": "IDENTIFIER",
+ "name": "Array",
+ "startPosition": "2360"
+ },
+ "arguments": [
+ {
+ "endPosition": "2376",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "size",
+ "expression": {
+ "endPosition": "2369",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2366"
+ },
+ "endPosition": "2374",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2366"
+ },
+ "arguments": [],
+ "startPosition": "2366"
+ }
+ ],
+ "startPosition": "2360"
+ },
+ "endPosition": "2377",
+ "kind": "NEW",
+ "startPosition": "2356"
+ }
+ },
+ {
+ "endPosition": "2399",
+ "kind": "VARIABLE",
+ "name": "j",
+ "startPosition": "2398"
+ },
+ {
+ "expression": {
+ "endPosition": "2406",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2403"
+ },
+ "endPosition": "2466",
+ "kind": "FOR_IN_LOOP",
+ "forEach": "false",
+ "variable": {
+ "endPosition": "2399",
+ "kind": "IDENTIFIER",
+ "name": "j",
+ "startPosition": "2398"
+ },
+ "statement": {
+ "endPosition": "2466",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "2453",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "convert",
+ "expression": {
+ "endPosition": "2437",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "2433"
+ },
+ "endPosition": "2445",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2433"
+ },
+ "arguments": [
+ {
+ "expression": {
+ "endPosition": "2449",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2446"
+ },
+ "endPosition": "2452",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "2451",
+ "kind": "IDENTIFIER",
+ "name": "j",
+ "startPosition": "2450"
+ },
+ "startPosition": "2446"
+ }
+ ],
+ "startPosition": "2433"
+ },
+ "endPosition": "2453",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "expression": {
+ "endPosition": "2427",
+ "kind": "IDENTIFIER",
+ "name": "arr",
+ "startPosition": "2424"
+ },
+ "endPosition": "2430",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "2429",
+ "kind": "IDENTIFIER",
+ "name": "j",
+ "startPosition": "2428"
+ },
+ "startPosition": "2424"
+ },
+ "startPosition": "2424"
+ },
+ "endPosition": "2453",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "2424"
+ }
+ ],
+ "startPosition": "2408"
+ },
+ "startPosition": "2389"
+ },
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "2499",
+ "kind": "IDENTIFIER",
+ "name": "arr",
+ "startPosition": "2496"
+ },
+ "endPosition": "2499",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "expression": {
+ "endPosition": "2490",
+ "kind": "IDENTIFIER",
+ "name": "result",
+ "startPosition": "2484"
+ },
+ "endPosition": "2493",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "2492",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "2491"
+ },
+ "startPosition": "2484"
+ },
+ "startPosition": "2484"
+ },
+ "endPosition": "2499",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "2484"
+ }
+ ],
+ "startPosition": "2334"
+ }
+ },
+ "endPosition": "2840",
+ "kind": "IF",
+ "startPosition": "2213",
+ "thenStatement": {
+ "endPosition": "2296",
+ "kind": "BLOCK",
+ "statements": [
+ {
+ "expression": {
+ "expression": {
+ "endPosition": "2286",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "convert",
+ "expression": {
+ "endPosition": "2273",
+ "kind": "IDENTIFIER",
+ "name": "this",
+ "startPosition": "2269"
+ },
+ "endPosition": "2281",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "2269"
+ },
+ "arguments": [
+ {
+ "endPosition": "2285",
+ "kind": "IDENTIFIER",
+ "name": "val",
+ "startPosition": "2282"
+ }
+ ],
+ "startPosition": "2269"
+ },
+ "endPosition": "2286",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "expression": {
+ "endPosition": "2263",
+ "kind": "IDENTIFIER",
+ "name": "result",
+ "startPosition": "2257"
+ },
+ "endPosition": "2266",
+ "kind": "ARRAY_ACCESS",
+ "index": {
+ "endPosition": "2265",
+ "kind": "IDENTIFIER",
+ "name": "i",
+ "startPosition": "2264"
+ },
+ "startPosition": "2257"
+ },
+ "startPosition": "2257"
+ },
+ "endPosition": "2286",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "2257"
+ }
+ ],
+ "startPosition": "2245"
+ }
+ }
+ ],
+ "startPosition": "2179"
+ },
+ "startPosition": "2160"
+ },
+ {
+ "expression": {
+ "endPosition": "2862",
+ "kind": "IDENTIFIER",
+ "name": "result",
+ "startPosition": "2856"
+ },
+ "endPosition": "2863",
+ "kind": "RETURN",
+ "startPosition": "2849"
+ }
+ ],
+ "startPosition": "2014"
+ },
+ "strict": "false",
+ "startPosition": "2014",
+ "parameters": [
+ {
+ "endPosition": "2012",
+ "kind": "IDENTIFIER",
+ "name": "tree",
+ "startPosition": "2008"
+ }
+ ]
+ },
+ "endPosition": "2014",
+ "kind": "ASSIGNMENT",
+ "variable": {
+ "identifier": "convert",
+ "expression": {
+ "identifier": "prototype",
+ "expression": {
+ "endPosition": "1978",
+ "kind": "IDENTIFIER",
+ "name": "Parser",
+ "startPosition": "1972"
+ },
+ "endPosition": "1988",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1972"
+ },
+ "endPosition": "1996",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "1972"
+ },
+ "startPosition": "1972"
+ },
+ "endPosition": "2865",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "1972"
+ },
+ {
+ "expression": {
+ "endPosition": "3909",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "endPosition": "3907",
+ "kind": "IDENTIFIER",
+ "name": "main",
+ "startPosition": "3903"
+ },
+ "arguments": [],
+ "startPosition": "3903"
+ },
+ "endPosition": "3909",
+ "kind": "EXPRESSION_STATEMENT",
+ "startPosition": "3903"
+ }
+ ],
+ "sourceName": "parserapi.js",
+ "strict": "false",
+ "startPosition": "1136"
+}
+]
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parserapi_const_as_var.js
similarity index 65%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parserapi_const_as_var.js
index d24a6e7..8cfe4a3 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parserapi_const_as_var.js
@@ -1,30 +1,39 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Nashorn parser API --const-as-var option test.
+ *
+ * @test
+ * @run
*/
-public class C {
-}
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var constAsVarParser = Parser.create("--const-as-var");
+var parser = Parser.create();
+
+var constStr = "const PI = 3.14;";
+// this one should not report error
+constAsVarParser.parse("const_as_var.js", constStr, print);
+// default parser should report error
+parser.parse("const_as_var1.js", constStr, print);
diff --git a/nashorn/test/script/nosecurity/parserapi_const_as_var.js.EXPECTED b/nashorn/test/script/nosecurity/parserapi_const_as_var.js.EXPECTED
new file mode 100644
index 0000000..1c99e5b
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_const_as_var.js.EXPECTED
@@ -0,0 +1,3 @@
+const_as_var1.js:1:0 Expected an operand but found const
+const PI = 3.14;
+^
diff --git a/nashorn/test/script/nosecurity/parserapi_empty_stat.js b/nashorn/test/script/nosecurity/parserapi_empty_stat.js
new file mode 100644
index 0000000..8d5755f
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_empty_stat.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Nashorn parser API --empty-statements option test.
+ *
+ * @test
+ * @run
+ */
+
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+
+// with --empty-statements parse tree should contain
+// EmptyStatement tree nodes. Without this option, empty
+// statement Tree nodes may be optimized away by Parser.
+var emptyStatParser = Parser.create("--empty-statements");
+
+var emptyStat = ";";
+emptyStatParser.parse("empty.js", emptyStat, print).
+ accept(new (Java.extend(SimpleTreeVisitor)) {
+ visitEmptyStatement: function(node, p) {
+ print("inside EmptyStatement visit");
+ }
+ }, null);
diff --git a/nashorn/test/script/nosecurity/parserapi_empty_stat.js.EXPECTED b/nashorn/test/script/nosecurity/parserapi_empty_stat.js.EXPECTED
new file mode 100644
index 0000000..0ea3e42
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_empty_stat.js.EXPECTED
@@ -0,0 +1 @@
+inside EmptyStatement visit
diff --git a/nashorn/test/script/nosecurity/parserapi_nse.js b/nashorn/test/script/nosecurity/parserapi_nse.js
new file mode 100644
index 0000000..d33674f
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_nse.js
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Nashorn parser API -nse option test.
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var noExtParser = Parser.create("-nse");
+var parser = Parser.create();
+var scriptingParser = Parser.create("-scripting");
+
+var condCatch = <<EOF
+
+try {
+ that();
+} catch (e if e instanceof ReferenceError) {}
+
+EOF;
+
+noExtParser.parse("cond_catch.js", condCatch, print);
+parser.parse("cond_catch1.js", condCatch, print);
+
+var funcClosure = <<EOF
+
+function square(x) x*x;
+
+EOF;
+
+noExtParser.parse("func_closure.js", funcClosure, print);
+parser.parse("func_closure1.js", funcClosure, print);
+
+var forEach = <<EOF
+
+for each (arg in arguments) print(arg);
+
+EOF;
+
+noExtParser.parse("for_each.js", forEach, print);
+parser.parse("for_each1.js", forEach, print);
+
+var anonNew = <<EOF
+
+var r = new java.lang.Runnable() {
+ run: function() { print("hello") }
+};
+
+EOF;
+
+noExtParser.parse("anon_new.js", anonNew, print);
+parser.parse("anon_new1.js", anonNew, print);
+
+var anonFuncStat = <<EOF
+
+function () { print("hello") }
+
+EOF;
+
+noExtParser.parse("anon_func_stat.js", anonFuncStat, print);
+parser.parse("anon_func_stat1.js", anonFuncStat, print);
+
+// These lexer (scripting) extensions should also be not parsed
+// by "no extensions parser" ( as well as "default" parser )
+
+var backquote = "`ls`";
+noExtParser.parse("backquote.js", backquote, print);
+parser.parse("backquote1.js", backquote, print);
+scriptingParser.parse("backquote2.js", backquote, print);
+
+var heredoc = "var str = <<EOF\nprint('hello')\nEOF\n";
+noExtParser.parse("heredoc.js", heredoc, print);
+parser.parse("heredoc1.js", heredoc, print);
+scriptingParser.parse("heredoc2.js", heredoc, print);
+
+var hashComment = "#comment\nprint('hello')";
+noExtParser.parse("hashcomment.js", hashComment, print);
+parser.parse("hashcomment1.js", hashComment, print);
+scriptingParser.parse("hashcomment2.js", hashComment, print);
diff --git a/nashorn/test/script/nosecurity/parserapi_nse.js.EXPECTED b/nashorn/test/script/nosecurity/parserapi_nse.js.EXPECTED
new file mode 100644
index 0000000..7f73435
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_nse.js.EXPECTED
@@ -0,0 +1,43 @@
+cond_catch.js:4:11 Expected ) but found if
+} catch (e if e instanceof ReferenceError) {}
+ ^
+func_closure.js:2:19 Expected { but found x
+
+function square(x) x*x;
+ ^
+for_each.js:2:4 Expected ( but found each
+
+for each (arg in arguments) print(arg);
+ ^
+anon_new.js:2:33 Expected ; but found {
+
+var r = new java.lang.Runnable() {
+ ^
+anon_new.js:3:18 Expected ident but found (
+ run: function() { print("hello") }
+ ^
+anon_new.js:4:0 Expected eof but found }
+};
+^
+anon_func_stat.js:2:9 Expected ident but found (
+
+function () { print("hello") }
+ ^
+backquote.js:1:0 Expected an operand but found error
+`ls`
+^
+backquote1.js:1:0 Expected an operand but found error
+`ls`
+^
+heredoc.js:1:10 Expected an operand but found <<
+var str = <<EOF
+ ^
+heredoc1.js:1:10 Expected an operand but found <<
+var str = <<EOF
+ ^
+hashcomment.js:1:0 Expected an operand but found error
+#comment
+^
+hashcomment1.js:1:0 Expected an operand but found error
+#comment
+^
diff --git a/nashorn/test/script/nosecurity/parserapi_scripting.js b/nashorn/test/script/nosecurity/parserapi_scripting.js
new file mode 100644
index 0000000..5ad8ba2
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_scripting.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Nashorn parser API -scripting option test.
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var scriptingParser = Parser.create("-scripting");
+var parser = Parser.create();
+
+var backquote = "`ls`";
+scriptingParser.parse("backquote.js", backquote, print);
+parser.parse("backquote1.js", backquote, print);
+
+var heredoc = "var str = <<EOF\nprint('hello')\nEOF\n";
+scriptingParser.parse("heredoc.js", heredoc, print);
+parser.parse("heredoc1.js", heredoc, print);
+
+var hashComment = "#comment\nprint('hello')";
+scriptingParser.parse("hashcomment.js", hashComment, print);
+parser.parse("hashcomment1.js", hashComment, print);
+
diff --git a/nashorn/test/script/nosecurity/parserapi_scripting.js.EXPECTED b/nashorn/test/script/nosecurity/parserapi_scripting.js.EXPECTED
new file mode 100644
index 0000000..b156c6f
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_scripting.js.EXPECTED
@@ -0,0 +1,9 @@
+backquote1.js:1:0 Expected an operand but found error
+`ls`
+^
+heredoc1.js:1:10 Expected an operand but found <<
+var str = <<EOF
+ ^
+hashcomment1.js:1:0 Expected an operand but found error
+#comment
+^
diff --git a/nashorn/test/script/nosecurity/parserapi_strict.js b/nashorn/test/script/nosecurity/parserapi_strict.js
new file mode 100644
index 0000000..12956ea
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_strict.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Nashorn parser API -strict option test.
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var strictParser = Parser.create("-strict");
+var parser = Parser.create();
+
+var withStat = <<EOF
+
+with({}) {}
+EOF;
+
+strictParser.parse("with_stat.js", withStat, print);
+parser.parse("with_stat1.js", withStat, print);
+
+var repeatParam = <<EOF
+
+function func(x, x) {}
+EOF;
+
+strictParser.parse("repeat_param.js", repeatParam, print);
+parser.parse("repeat_param1.js", repeatParam, print);
+
+var repeatProp = <<EOF
+
+var obj = { foo: 34, foo: 'hello' };
+
+EOF
+
+strictParser.parse("repeat_prop.js", repeatProp, print);
+parser.parse("repeat_prop1.js", repeatProp, print);
diff --git a/nashorn/test/script/nosecurity/parserapi_strict.js.EXPECTED b/nashorn/test/script/nosecurity/parserapi_strict.js.EXPECTED
new file mode 100644
index 0000000..833637a
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parserapi_strict.js.EXPECTED
@@ -0,0 +1,16 @@
+with_stat.js:2:1 "with" statement cannot be used in strict mode
+
+with({}) {}
+ ^
+with_stat.js:2:7 Expected ; but found )
+
+with({}) {}
+ ^
+repeat_param.js:2:15 strict mode function cannot have duplicate parameter name "x"
+
+function func(x, x) {}
+ ^
+repeat_prop.js:2:22 Property "foo" already defined
+
+var obj = { foo: 34, foo: 'hello' };
+ ^
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/caseoutofswitch.js
similarity index 85%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/caseoutofswitch.js
index d24a6e7..0f8a7b1 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/caseoutofswitch.js
@@ -1,30 +1,32 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+case 23:
+print("23");
+default:
+print("hello");
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/illegalbreak.js
similarity index 87%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/illegalbreak.js
index d24a6e7..f7d9f83 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/illegalbreak.js
@@ -1,30 +1,30 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+break;
+break foo;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/illegalcontinue.js
similarity index 87%
rename from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
rename to nashorn/test/script/nosecurity/parsernegativetests/illegalcontinue.js
index d24a6e7..3670427 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/illegalcontinue.js
@@ -1,30 +1,30 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+continue;
+continue foo;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/illegallvalue.js
similarity index 86%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/illegallvalue.js
index d24a6e7..571fd3d 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/illegallvalue.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+44 = 54;
+233 += 33;
+3423 -= 234;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/illegaloperator.js
similarity index 87%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/illegaloperator.js
index d24a6e7..97f22b2 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/illegaloperator.js
@@ -1,30 +1,29 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+x ** y
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/keywordident.js
similarity index 87%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/keywordident.js
index d24a6e7..8224b1d 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/keywordident.js
@@ -1,30 +1,30 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+var var = 23;
+var x = 223;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/parenmissing.js
similarity index 87%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/parenmissing.js
index d24a6e7..d190624 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/parenmissing.js
@@ -1,30 +1,30 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+(1 + 2;
+x * y);
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/repeatedproperty.js
similarity index 74%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/repeatedproperty.js
index d24a6e7..6c9ed9a 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/repeatedproperty.js
@@ -1,30 +1,33 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+var obj = { foo: 34, get foo() { return 'hello' } };
+var obj1 = { foo: 34, set foo(x) { } };
+var obj2 = { foo: 34, set foo(x) { } };
+var obj3 = { get bar() { }, get bar() {} };
+var obj4 = { set bar(x) { }, set bar(x) {} };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/strict_repeatedproperty.js
similarity index 85%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/strict_repeatedproperty.js
index d24a6e7..30c7fba 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/strict_repeatedproperty.js
@@ -1,30 +1,32 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+'use strict';
+
+var obj = { foo: 34, foo: 'hello' };
+
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/strict_repeatparam.js
similarity index 86%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/strict_repeatparam.js
index d24a6e7..2074e96 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/strict_repeatparam.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+'use strict';
+
+function func(x, x) {}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/strict_with.js
similarity index 87%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/strict_with.js
index d24a6e7..af12620 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/strict_with.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+'use strict';
+
+with({}) {}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsernegativetests/toplevelreturn.js
similarity index 87%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsernegativetests/toplevelreturn.js
index d24a6e7..7c6764f 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsernegativetests/toplevelreturn.js
@@ -1,30 +1,30 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * @subtest
+ * @negative
*/
-public class C {
-}
+
+return;
+return 23;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/array_literal.js
similarity index 81%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/array_literal.js
index d24a6e7..45c0d17 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/array_literal.js
@@ -1,30 +1,33 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check array literal.
+ *
+ * @subtest
*/
-public class C {
-}
+
+var x = [];
+var y = [1, 43, 5, 45];
+var z = [34,,,4];
+var k = [ {}, { x: 3 }, "hello" ];
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/assignmentExpr.js
similarity index 76%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/assignmentExpr.js
index d24a6e7..ff61f7b 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/assignmentExpr.js
@@ -1,30 +1,42 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check assignment e xyzpressions.
+ *
+ * @subtest
*/
-public class C {
-}
+
+
+xyz = 314;
+xyz += 314;
+xyz -= 314;
+xyz *= 314;
+xyz /= 314;
+xyz %= 314;
+xyz <<= 314;
+xyz >>= 314;
+xyz >>>= 314;
+xyz &= 314;
+xyz ^= 314;
+xyz |= 314;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/binaryExpr.js
similarity index 75%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/binaryExpr.js
index d24a6e7..146fa6a 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/binaryExpr.js
@@ -1,30 +1,51 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check binary operators.
+ *
+ * @subtest
*/
-public class C {
-}
+
+a * b
+a / b;
+a % b;
+a + b;
+a - b;
+a << b;
+a >> b;
+a >>> b;
+a < b;
+a > b;
+a <= b;
+a >= b;
+a instanceof b;
+a == b;
+a != b;
+a === b;
+a !== b;
+a & b;
+a ^ b;
+a | b;
+a && b;
+a || b;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/block.js
similarity index 85%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/block.js
index d24a6e7..bb64d47 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/block.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check 'block' statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+{}
+{ print("hello"); }
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/breakStat.js
similarity index 80%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/breakStat.js
index d24a6e7..24e98078 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/breakStat.js
@@ -1,30 +1,32 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check 'break' statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+while (true) { break; };
+loop: { while (true) { break loop } };
+loop: { for (;;) { break loop } };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/condExpr.js
similarity index 86%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/condExpr.js
index d24a6e7..c80103c 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/condExpr.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check ternary operator.
+ *
+ * @subtest
*/
-public class C {
-}
+
+
+a? b : c;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/continueStat.js
similarity index 79%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/continueStat.js
index d24a6e7..bef5be0 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/continueStat.js
@@ -1,30 +1,32 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check 'continue' statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+while (true) { continue; };
+begin: { while (true) { continue begin; } };
+start: { for(;;) { continue start; } };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/debuggerStat.js
similarity index 86%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/debuggerStat.js
index d24a6e7..9708529 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/debuggerStat.js
@@ -1,30 +1,30 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check debugger statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+debugger;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/functions.js
similarity index 70%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/functions.js
index d24a6e7..bf5ff98 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/functions.js
@@ -1,30 +1,36 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check 'function' statements and expressions.
+ *
+ * @subtest
*/
-public class C {
-}
+
+function hello() { print('hello') }
+function hello(a) { print(a) }
+function hello(a, b) { print(a, b) }
+var hello = function() { print('hello') };
+var hello = function hello() { print('hello') };
+(function(){})
+function test() { 'use strict' };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/ifStat.js
similarity index 83%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/ifStat.js
index d24a6e7..ed19812 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/ifStat.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check 'if' statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+if (js) { nashorn() };
+if (js) { nashorn() } else { java() };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/labelledStat.js
similarity index 82%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/labelledStat.js
index d24a6e7..fe49087 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/labelledStat.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Test for labelled statements.
+ *
+ * @subtest
*/
-public class C {
-}
+
+begin: { for (;;) break begin };
+begin: { while (true) break begin };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/lhsExpr.js
similarity index 74%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/lhsExpr.js
index d24a6e7..a0bb3ae 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/lhsExpr.js
@@ -1,30 +1,44 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check left-hand-side expressions
+ *
+ * @subtest
*/
-public class C {
-}
+
+a[3];
+a[b];
+a['foo'];
+obj.foo;
+obj.foo.bar;
+new Type;
+new Type();
+new Type(a, 'hello');
+new obj.Type;
+new obj.Type();
+new obj.Type(a, 'hello');
+foo()
+obj.foo();
+foo(a,b);
+obj.foo(a, b);
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/loopStat.js
similarity index 76%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/loopStat.js
index d24a6e7..4ab349e 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/loopStat.js
@@ -1,30 +1,34 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests for loop statements.
+ *
+ * @subtest
*/
-public class C {
-}
+
+while(true) { print('hello') }
+do { print('hello') } while(true)
+for (i in obj) { print(obj[i]) }
+for each (i in obj) { print(i) }
+for (i = 0; i < 10; i++) { print(i) }
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/objectLitExpr.js
similarity index 74%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/objectLitExpr.js
index d24a6e7..7c02cbf 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/objectLitExpr.js
@@ -1,30 +1,34 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check assignment e xyzpressions.
+ *
+ * @subtest
*/
-public class C {
-}
+
+obj = {};
+p = { x: 10, y: 2 };
+p = { 'x': 10, 'y': 2 };
+p = { get x() { return xValue }, get y() { return yValue } };
+p = { get foo() { return this._foo }, set foo(val) { this._foo = val } };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/parenExpr.js
similarity index 85%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/parenExpr.js
index d24a6e7..a413ef6 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/parenExpr.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests for parenthesis expressions.
+ *
+ * @subtest
*/
-public class C {
-}
+
+(2) + (1) + 4;
+3 + (7) << (5);
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/primaryExpr.js
similarity index 80%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/primaryExpr.js
index d24a6e7..e69c4ce 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/primaryExpr.js
@@ -1,30 +1,42 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check primary expressions.
+ *
+ * @subtest
*/
-public class C {
-}
+
+this;
+foo;
+null;
+true;
+false;
+33;
+3.14;
+(10 + 3)*2;
+({});
+({ x: 3 });
+[];
+[,,];
+[4, 5, 5];
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/regexp_literal.js
similarity index 83%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/regexp_literal.js
index d24a6e7..725fb2e 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/regexp_literal.js
@@ -1,30 +1,32 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check regexp literal.
+ *
+ * @subtest
*/
-public class C {
-}
+
+var x = /foo/;
+var y = /foo/g;
+var z = /[a-z]*[1-10]?/;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/returnStat.js
similarity index 81%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/returnStat.js
index d24a6e7..0aed625 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/returnStat.js
@@ -1,30 +1,32 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check 'return' statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+(function() { return });
+(function() { return res });
+(function() { return foo() });
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/switchStat.js
similarity index 78%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/switchStat.js
index d24a6e7..0ae9af4 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/switchStat.js
@@ -1,30 +1,32 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests for switch statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+switch (key) {};
+switch (key) { case 2: hello(); break; };
+switch (key) { case 4: hello(); break; case 2: world(); break; default: break };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/throwStat.js
similarity index 80%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/throwStat.js
index d24a6e7..4edc828 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/throwStat.js
@@ -1,30 +1,34 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests for throw statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+throw err;
+throw 'wrong';
+throw new TypeError;
+throw new TypeError('not an array');
+throw { msg: 'wrong!' };
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/tryCatchStat.js
similarity index 71%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/tryCatchStat.js
index d24a6e7..6c899f6 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/tryCatchStat.js
@@ -1,30 +1,35 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check try..catch statements.
+ *
+ * @subtest
*/
-public class C {
-}
+
+try { } catch (e) { }
+try { } catch (e) { } finally {}
+try { } finally {}
+try { } catch (e) { handle() }
+try { that() } catch (e) { handle() } finally { clean() }
+try { that() } catch (e if e instanceof TypeError) { handle() } catch (e) { rest() }
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/unaryExpr.js
similarity index 82%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/unaryExpr.js
index d24a6e7..1c26e93 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/unaryExpr.js
@@ -1,30 +1,40 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check unary operators.
+ *
+ * @subtest
*/
-public class C {
-}
+
+x++;
+x--;
+delete x;
+void x;
+typeof x;
+++x;
+--x;
++x;
+-x;
+~x;
+!x;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/useStrict.js
similarity index 83%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/useStrict.js
index d24a6e7..c1f4a22 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/useStrict.js
@@ -1,30 +1,31 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check 'use strict' directive.
+ *
+ * @subtest
*/
-public class C {
-}
+
+'use strict';
+function f() { 'use strict' }
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/varDecl.js
similarity index 79%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/varDecl.js
index d24a6e7..bad7a00 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/varDecl.js
@@ -1,30 +1,37 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests to check variable declarations.
+ *
+ * @subtest
*/
-public class C {
-}
+
+
+// no initialization
+var a;
+var a, b;
+
+// init single, multiple
+var a = 'hello';
+var a = 1, b = 2, c = 3;
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/nashorn/test/script/nosecurity/parsertests/withStat.js
similarity index 86%
copy from langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
copy to nashorn/test/script/nosecurity/parsertests/withStat.js
index d24a6e7..6290f77 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java
+++ b/nashorn/test/script/nosecurity/parsertests/withStat.js
@@ -1,30 +1,30 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
- *
+ *
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
- *
+ *
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package pkg;
-
/**
- * Source file for C
+ * Tests for 'with' statement.
+ *
+ * @subtest
*/
-public class C {
-}
+
+with (scope) { x = y };
diff --git a/nashorn/test/script/nosecurity/parservisitor.js b/nashorn/test/script/nosecurity/parservisitor.js
new file mode 100644
index 0000000..069f50f
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parservisitor.js
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Nashorn parser API - Basic TreeVisitor tests.
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+// Java types used
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+
+function parse(name, script, visitor) {
+ var parser = Parser.create("--empty-statements");
+ var tree = parser.parse(name, script, null);
+ return tree.accept(visitor, print);
+}
+
+parse("arrayaccess.js", "this['eval']",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitArrayAccess: function(aa) {
+ print("in visitArrayAccess " +
+ aa.expression.name + " " + aa.index.value);
+ }
+ });
+
+parse("arrayliteral.js", "[2, 3, 22]",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitArrayLiteral: function(al) {
+ print("in visitArrayLiteral");
+ for each (var e in al.elements) {
+ print(e.value);
+ }
+ }
+ });
+
+parse("assign.js", "x = 33",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitAssignment: function(an) {
+ print("in visitAssignment " +
+ an.variable.name + " " + an.expression.value);
+ }
+ });
+
+function binaryExpr(name, code) {
+ parse(name, code,
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitBinary: function(bn) {
+ print("in visitBinary " + bn.kind + " " +
+ bn.leftOperand.value + ", " + bn.rightOperand.value);
+ }
+ });
+}
+
+binaryExpr("add.js", "3 + 4");
+binaryExpr("sub.js", "3 - 4");
+binaryExpr("mul.js", "3 * 4");
+binaryExpr("div.js", "3 / 4");
+binaryExpr("rem.js", "3 % 4");
+binaryExpr("rshift.js", "3 >> 4");
+binaryExpr("rshift.js", "3 >>> 4");
+binaryExpr("lshift.js", "3 << 4");
+binaryExpr("less.js", "3 < 4");
+binaryExpr("lessOrEq.js", "3 <= 4");
+binaryExpr("greater.js", "3 > 4");
+binaryExpr("greaterOrEq.js", "3 >= 4");
+binaryExpr("in.js", "3 in this");
+binaryExpr("eq.js", "3 == 3");
+binaryExpr("ne.js", "3 != 2");
+binaryExpr("seq.js", "3 === 2");
+binaryExpr("sne.js", "3 !== 2");
+binaryExpr("and.js", "3 & 2");
+binaryExpr("or.js", "3 | 2");
+binaryExpr("xor.js", "3 ^ 2");
+binaryExpr("cond_and.js", "3 && 2");
+binaryExpr("cond_or.js", "3 || 2");
+binaryExpr("comma", "3, 2");
+
+parse("block.js", "{ print('hello'); }",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitBlock: function() {
+ print("in visitBlock");
+ }
+ });
+
+
+parse("break.js", "while(true) { break; }",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitBreak: function() {
+ print("in visitBreak");
+ }
+ });
+
+function compAssignExpr(name, code) {
+ parse(name, code,
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitCompoundAssignment: function(bn) {
+ print("in visitCompoundAssignment " + bn.kind + " " +
+ bn.variable.name + " " + bn.expression.value);
+ }
+ });
+}
+
+compAssignExpr("mult_assign.js", "x *= 3");
+compAssignExpr("div_assign.js", "x /= 3");
+compAssignExpr("rem_assign.js", "x %= 3");
+compAssignExpr("add_assign.js", "x += 3");
+compAssignExpr("sub_assign.js", "x -= 3");
+compAssignExpr("lshift_assign.js", "x <<= 3");
+compAssignExpr("rshift_assign.js", "x >>= 3");
+compAssignExpr("urshift_assign.js", "x >>>= 3");
+compAssignExpr("and_assign.js", "x &= 3");
+compAssignExpr("xor_assign.js", "x ^= 3");
+compAssignExpr("or_assign.js", "x |= 3");
+
+parse("condexpr.js", "foo? x : y",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitConditionalExpression: function() {
+ print("in visitConditionalExpression");
+ }
+ });
+
+parse("continue.js", "while(true) { continue; }",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitContinue: function() {
+ print("in visitContinue");
+ }
+ });
+
+parse("debugger.js", "debugger;",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitDebugger: function() {
+ print("in visitDebugger");
+ }
+ });
+
+parse("dowhile.js", "do {} while(true)",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitDoWhileLoop: function() {
+ print("in visitDoWhileLoop");
+ }
+ });
+
+parse("empty.js", ";",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitEmptyStatement: function() {
+ print("in visitEmptyStatement");
+ }
+ });
+
+parse("exprstat.js", "2+3;",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitExpressionStatement: function() {
+ print("in visitExpressionStatement");
+ }
+ });
+
+parse("forin.js", "for(i in this) {}",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitForInLoop: function() {
+ print("in visitForInLoop");
+ }
+ });
+
+parse("for.js", "for(;;) {}",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitForLoop: function() {
+ print("in visitForLoop");
+ }
+ });
+
+parse("funccall.js", "func()",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitFunctionCall: function(fc) {
+ print("in visitFunctionCall " + fc.functionSelect.name);
+ }
+ });
+
+parse("funcdecl.js", "function func() {}",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitFunctionDeclaration: function(fd) {
+ print("in visitFunctionDeclaration " + fd.name);
+ }
+ });
+
+parse("funcexpr.js", "x = function() {}",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitFunctionExpression: function() {
+ print("in visitFunctionExpression");
+ }
+ });
+
+parse("ident.js", "this",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitIdentifier: function(ident) {
+ print("in visitIdentifier " + ident.name);
+ }
+ });
+
+parse("if.js", "if (true) {}",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitIf: function() {
+ print("in visitIf");
+ }
+ });
+
+parse("if2.js", "if (true) print('yes')",
+ new (visitor = Java.extend(SimpleTreeVisitor))() {
+ visitBlock: function(node, extra) {
+ print("ERROR: No block expected here!");
+ Error.dumpStack();
+ }
+ });
+
+parse("instanceof.js", "this instanceof Object",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitInstanceOf: function() {
+ print("in visitInstanceOf");
+ }
+ });
+
+parse("labeled.js", "foo: print('hello');",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitLabeledStatement: function() {
+ print("in visitLabeledStatement");
+ }
+ });
+
+function literalExpr(name, code) {
+ parse(name, code,
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitLiteral: function(ln) {
+ print("in visitLiteral " + ln.kind + " " + ln.value);
+ }
+ });
+}
+
+literalExpr("bool.js", "true");
+literalExpr("num.js", "3.14");
+literalExpr("str.js", "'hello'");
+literalExpr("null.js", "null");
+
+parse("memselect.js", "this.foo",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitMemberSelect: function(ms) {
+ print("in visitMemberSelect " + ms.identifier);
+ }
+ });
+
+parse("new.js", "new Object()",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitNew: function() {
+ print("in visitNew");
+ }
+ });
+
+parse("obj_literal.js", "({ foo: 343 })",
+ visitor = new (Java.extend(SimpleTreeVisitor))() {
+ visitObjectLiteral: function(ol) {
+ print("in visitObjectLiteral");
+ Java.super(visitor).visitObjectLiteral(ol, null);
+ },
+
+ visitProperty: function(pn) {
+ print("in visitProperty " + pn.key.name);
+ }
+ });
+
+parse("regexp.js", "/[a-b]/i",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitRegExpLiteral: function(re) {
+ print("in visitRegExpLiteral " + re.pattern + " " + re.options);
+ }
+ });
+
+parse("ret.js", "function func() { return 33 }",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitReturn: function(ret) {
+ print("in visitReturn " + ret.expression.value);
+ }
+ });
+
+parse("switch.js", "switch(c) { case '1': break; default: }",
+ visitor = new (Java.extend(SimpleTreeVisitor))() {
+ visitSwitch: function(sn) {
+ print("in visitSwitch");
+ Java.super(visitor).visitSwitch(sn, null);
+ },
+
+ visitCase: function(cn) {
+ if (cn.expression) {
+ print("in visitCase");
+ } else {
+ print("in visitCase (default)");
+ }
+ }
+ });
+
+parse("throw.js", "throw 2",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitThrow: function(tn) {
+ print("in visitThrow " + tn.expression.value);
+ }
+ });
+
+parse("try.js", "try { func() } catch(e) {}",
+ visitor = new (Java.extend(SimpleTreeVisitor))() {
+ visitTry: function(tn) {
+ print("in visitTry");
+ Java.super(visitor).visitTry(tn, null);
+ },
+ visitCatch: function(cn) {
+ print("in visitCatch " + cn.parameter.name);
+ }
+ });
+
+function unaryExpr(name, code) {
+ parse(name, code,
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitUnary: function(un) {
+ print("in visitUnary " + un.kind + " " + un.expression.name);
+ }
+ });
+}
+
+unaryExpr("postincr.js", "x++");
+unaryExpr("postdecr.js", "x--");
+unaryExpr("preincr.js", "++x");
+unaryExpr("predecr.js", "--x");
+unaryExpr("plus.js", "+x");
+unaryExpr("minus.js", "-x");
+unaryExpr("complement.js", "~x");
+unaryExpr("logical_compl.js", "!x");
+unaryExpr("delete.js", "delete x");
+unaryExpr("typeof.js", "typeof x");
+unaryExpr("void.js", "void x");
+
+parse("var.js", "var x = 34;",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitVariable: function(vn) {
+ print("in visitVariable " + vn.name + " = " + vn.initializer.value);
+ }
+ });
+
+parse("while.js", "while(true) {}",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitWhileLoop: function() {
+ print("in visitWhileLoop");
+ }
+ });
+
+parse("with.js", "with({}) {}",
+ new (Java.extend(SimpleTreeVisitor))() {
+ visitWith: function() {
+ print("in visitWith");
+ }
+ });
diff --git a/nashorn/test/script/nosecurity/parservisitor.js.EXPECTED b/nashorn/test/script/nosecurity/parservisitor.js.EXPECTED
new file mode 100644
index 0000000..5fbb7e3
--- /dev/null
+++ b/nashorn/test/script/nosecurity/parservisitor.js.EXPECTED
@@ -0,0 +1,87 @@
+in visitArrayAccess this eval
+in visitArrayLiteral
+2
+3
+22
+in visitAssignment x 33
+in visitBinary PLUS 3, 4
+in visitBinary MINUS 3, 4
+in visitBinary MULTIPLY 3, 4
+in visitBinary DIVIDE 3, 4
+in visitBinary REMAINDER 3, 4
+in visitBinary RIGHT_SHIFT 3, 4
+in visitBinary UNSIGNED_RIGHT_SHIFT 3, 4
+in visitBinary LEFT_SHIFT 3, 4
+in visitBinary LESS_THAN 3, 4
+in visitBinary LESS_THAN_EQUAL 3, 4
+in visitBinary GREATER_THAN 3, 4
+in visitBinary GREATER_THAN_EQUAL 3, 4
+in visitBinary IN 3, undefined
+in visitBinary EQUAL_TO 3, 3
+in visitBinary NOT_EQUAL_TO 3, 2
+in visitBinary STRICT_EQUAL_TO 3, 2
+in visitBinary STRICT_NOT_EQUAL_TO 3, 2
+in visitBinary AND 3, 2
+in visitBinary OR 3, 2
+in visitBinary XOR 3, 2
+in visitBinary CONDITIONAL_AND 3, 2
+in visitBinary CONDITIONAL_OR 3, 2
+in visitBinary COMMA 3, 2
+in visitBlock
+in visitBreak
+in visitCompoundAssignment MULTIPLY_ASSIGNMENT x 3
+in visitCompoundAssignment DIVIDE_ASSIGNMENT x 3
+in visitCompoundAssignment REMAINDER_ASSIGNMENT x 3
+in visitCompoundAssignment PLUS_ASSIGNMENT x 3
+in visitCompoundAssignment MINUS_ASSIGNMENT x 3
+in visitCompoundAssignment LEFT_SHIFT_ASSIGNMENT x 3
+in visitCompoundAssignment RIGHT_SHIFT_ASSIGNMENT x 3
+in visitCompoundAssignment UNSIGNED_RIGHT_SHIFT_ASSIGNMENT x 3
+in visitCompoundAssignment AND_ASSIGNMENT x 3
+in visitCompoundAssignment XOR_ASSIGNMENT x 3
+in visitCompoundAssignment OR_ASSIGNMENT x 3
+in visitConditionalExpression
+in visitContinue
+in visitDebugger
+in visitDoWhileLoop
+in visitEmptyStatement
+in visitExpressionStatement
+in visitForInLoop
+in visitForLoop
+in visitFunctionCall func
+in visitFunctionDeclaration func
+in visitFunctionExpression
+in visitIdentifier this
+in visitIf
+in visitInstanceOf
+in visitLabeledStatement
+in visitLiteral BOOLEAN_LITERAL true
+in visitLiteral NUMBER_LITERAL 3.14
+in visitLiteral STRING_LITERAL hello
+in visitLiteral NULL_LITERAL null
+in visitMemberSelect foo
+in visitNew
+in visitObjectLiteral
+in visitProperty foo
+in visitRegExpLiteral [a-b] i
+in visitReturn 33
+in visitSwitch
+in visitCase
+in visitCase (default)
+in visitThrow 2
+in visitTry
+in visitCatch e
+in visitUnary POSTFIX_INCREMENT x
+in visitUnary POSTFIX_DECREMENT x
+in visitUnary PREFIX_INCREMENT x
+in visitUnary PREFIX_DECREMENT x
+in visitUnary PLUS x
+in visitUnary MINUS x
+in visitUnary BITWISE_COMPLEMENT x
+in visitUnary LOGICAL_COMPLEMENT x
+in visitUnary DELETE x
+in visitUnary TYPEOF x
+in visitUnary VOID x
+in visitVariable x = 34
+in visitWhileLoop
+in visitWith
diff --git a/nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java b/nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java
new file mode 100644
index 0000000..e1985129
--- /dev/null
+++ b/nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.api.tree;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Test for nashorn Parser API (jdk.nashorn.api.tree.*)
+ */
+public class ParseAPITest {
+
+ private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("parserapitest.verbose"));
+ private static final boolean TEST262 = Boolean.valueOf(System.getProperty("parserapitest.test262"));
+
+ private static final String TEST_BASIC_DIR = System.getProperty("test.basic.dir");
+ private static final String TEST_MAPTESTS_DIR = System.getProperty("test.maptests.dir");
+ private static final String TEST_SANDBOX_DIR = System.getProperty("test.sandbox.dir");
+ private static final String TEST_TRUSTED_DIR = System.getProperty("test.trusted.dir");
+ private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
+
+ interface TestFilter {
+ public boolean exclude(File file, String content);
+ }
+
+ private void log(String msg) {
+ org.testng.Reporter.log(msg, true);
+ }
+
+ private static final String[] options = new String[] {
+ "-scripting", "--const-as-var"
+ };
+
+ @Test
+ public void parseAllTests() {
+ if (TEST262) {
+ parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
+ @Override
+ public boolean exclude(final File file, final String content) {
+ return content.indexOf("@negative") != -1;
+ }
+ });
+ }
+ parseTestSet(TEST_BASIC_DIR, new TestFilter() {
+ @Override
+ public boolean exclude(final File file, final String content) {
+ return file.getParentFile().getName().equals("es6");
+ }
+ });
+ parseTestSet(TEST_MAPTESTS_DIR, null);
+ parseTestSet(TEST_SANDBOX_DIR, null);
+ parseTestSet(TEST_TRUSTED_DIR, null);
+ }
+
+ private void parseTestSet(final String testSet, final TestFilter filter) {
+ passed = 0;
+ failed = 0;
+ skipped = 0;
+
+ final File testSetDir = new File(testSet);
+ if (! testSetDir.isDirectory()) {
+ log("WARNING: " + testSetDir + " not found or not a directory");
+ return;
+ }
+ log(testSetDir.getAbsolutePath());
+ parseJSDirectory(testSetDir, filter);
+
+ log(testSet + " parse API done!");
+ log("parse API ok: " + passed);
+ log("parse API failed: " + failed);
+ log("parse API skipped: " + skipped);
+ if (failed != 0) {
+ Assert.fail(failed + " tests failed to parse in " + testSetDir.getAbsolutePath());
+ }
+ }
+
+ // number of scripts that parsed fine
+ private int passed;
+ // number of scripts resulting in parse failure
+ private int failed;
+ // scripts that were skipped - all tests with @negative are
+ // skipped for now.
+ private int skipped;
+
+ private void parseJSDirectory(final File dir, final TestFilter filter) {
+ for (final File f : dir.listFiles()) {
+ if (f.isDirectory()) {
+ parseJSDirectory(f, filter);
+ } else if (f.getName().endsWith(".js")) {
+ parseJSFile(f, filter);
+ }
+ }
+ }
+
+ private void parseJSFile(final File file, final TestFilter filter) {
+ if (VERBOSE) {
+ log("Begin parsing " + file.getAbsolutePath());
+ }
+
+ try {
+ final char[] buffer = readFully(file);
+ final String content = new String(buffer);
+ boolean excluded = false;
+ if (filter != null) {
+ excluded = filter.exclude(file, content);
+ }
+
+ if (excluded) {
+ if (VERBOSE) {
+ log("Skipping " + file.getAbsolutePath());
+ }
+ skipped++;
+ return;
+ }
+
+ final Parser parser = Parser.create(options);
+ final Tree tree = parser.parse(file.getAbsolutePath(), content, null);
+ tree.accept(new SimpleTreeVisitorES5_1<Void, Void>(), null);
+ passed++;
+ } catch (final Throwable exp) {
+ log("Parse API failed: " + file.getAbsolutePath() + " : " + exp);
+ //if (VERBOSE) {
+ exp.printStackTrace(System.out);
+ //}
+ failed++;
+ }
+
+ if (VERBOSE) {
+ log("Done parsing via parser API " + file.getAbsolutePath());
+ }
+ }
+
+ private static char[] byteToCharArray(final byte[] bytes) {
+ Charset cs = StandardCharsets.UTF_8;
+ int start = 0;
+ // BOM detection.
+ if (bytes.length > 1 && bytes[0] == (byte) 0xFE && bytes[1] == (byte) 0xFF) {
+ start = 2;
+ cs = StandardCharsets.UTF_16BE;
+ } else if (bytes.length > 1 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE) {
+ start = 2;
+ cs = StandardCharsets.UTF_16LE;
+ } else if (bytes.length > 2 && bytes[0] == (byte) 0xEF && bytes[1] == (byte) 0xBB && bytes[2] == (byte) 0xBF) {
+ start = 3;
+ cs = StandardCharsets.UTF_8;
+ } else if (bytes.length > 3 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE && bytes[2] == 0 && bytes[3] == 0) {
+ start = 4;
+ cs = Charset.forName("UTF-32LE");
+ } else if (bytes.length > 3 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == (byte) 0xFE && bytes[3] == (byte) 0xFF) {
+ start = 4;
+ cs = Charset.forName("UTF-32BE");
+ }
+
+ return new String(bytes, start, bytes.length - start, cs).toCharArray();
+ }
+
+ private static char[] readFully(final File file) throws IOException {
+ final byte[] buf = Files.readAllBytes(file.toPath());
+ return byteToCharArray(buf);
+ }
+}
diff --git a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java b/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java
index 61d896b..0c67af8 100644
--- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java
@@ -66,7 +66,6 @@
@BeforeClass
public void setupTest() {
final Options options = new Options("nashorn");
- options.set("anon.functions", true);
options.set("compile.only", true);
options.set("print.ast", true);
options.set("print.parse", true);
diff --git a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java b/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java
index 110f623..24d507a 100644
--- a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java
@@ -62,7 +62,6 @@
@BeforeClass
public void setupTest() {
final Options options = new Options("nashorn");
- options.set("anon.functions", true);
options.set("parse.only", true);
options.set("scripting", true);
options.set("const.as.var", true);
diff --git a/test/lib/sun/hotspot/WhiteBox.java b/test/lib/sun/hotspot/WhiteBox.java
index f8120f1..b14626c 100644
--- a/test/lib/sun/hotspot/WhiteBox.java
+++ b/test/lib/sun/hotspot/WhiteBox.java
@@ -110,7 +110,6 @@
public native void NMTUncommitMemory(long addr, long size);
public native void NMTReleaseMemory(long addr, long size);
public native long NMTMallocWithPseudoStack(long size, int index);
- public native boolean NMTIsDetailSupported();
public native boolean NMTChangeTrackingLevel();
public native int NMTGetHashSize();