--- a/jdk/make/mapfiles/libjava/mapfile-vers Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Sat Mar 19 01:23:44 2016 +0100
@@ -227,8 +227,7 @@
Java_java_lang_System_setOut0;
Java_java_lang_Thread_registerNatives;
Java_java_lang_Throwable_fillInStackTrace;
- Java_java_lang_Throwable_getStackTraceDepth;
- Java_java_lang_Throwable_getStackTraceElement;
+ Java_java_lang_Throwable_getStackTraceElements;
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
--- a/jdk/make/mapfiles/libjava/reorder-sparc Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/make/mapfiles/libjava/reorder-sparc Sat Mar 19 01:23:44 2016 +0100
@@ -78,8 +78,7 @@
text: .text%JNU_GetEnv;
text: .text%Java_java_io_UnixFileSystem_checkAccess;
text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
text: .text%throwFileNotFoundException;
text: .text%JNU_NotifyAll;
# Test LoadFrame
--- a/jdk/make/mapfiles/libjava/reorder-sparcv9 Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/make/mapfiles/libjava/reorder-sparcv9 Sat Mar 19 01:23:44 2016 +0100
@@ -74,8 +74,7 @@
text: .text%JNU_GetEnv;
text: .text%Java_java_io_UnixFileSystem_checkAccess;
text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
text: .text%throwFileNotFoundException: OUTPUTDIR/io_util.o;
text: .text%JNU_NotifyAll;
# Test LoadFrame
--- a/jdk/make/mapfiles/libjava/reorder-x86 Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/make/mapfiles/libjava/reorder-x86 Sat Mar 19 01:23:44 2016 +0100
@@ -78,8 +78,7 @@
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
text: .text%Java_java_io_FileInputStream_available;
text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
text: .text%Java_java_lang_System_identityHashCode;
text: .text%JNU_NotifyAll;
# Test LoadFrame
--- a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java Sat Mar 19 01:23:44 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -74,6 +74,12 @@
this.lineNumber = lineNumber;
}
+
+ /**
+ * Creates an empty stack frame element to be filled in by Throwable.
+ */
+ StackTraceElement() { }
+
/**
* Returns the name of the source file containing the execution point
* represented by this stack trace element. Generally, this corresponds
--- a/jdk/src/java.base/share/classes/java/lang/Throwable.java Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Throwable.java Sat Mar 19 01:23:44 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
private static final long serialVersionUID = -3042686055658047285L;
/**
- * Native code saves some indication of the stack backtrace in this slot.
+ * The JVM saves some indication of the stack backtrace in this slot.
*/
private transient Object backtrace;
@@ -211,6 +211,11 @@
*/
private StackTraceElement[] stackTrace = UNASSIGNED_STACK;
+ /**
+ * The JVM code sets the depth of the backtrace for later retrieval
+ */
+ private transient int depth;
+
// Setting this static field introduces an acceptable
// initialization dependency on a few java.util classes.
private static final List<Throwable> SUPPRESSED_SENTINEL = Collections.emptyList();
@@ -828,10 +833,11 @@
if (backtrace instanceof StackStreamFactory.StackTrace) {
stackTrace = ((StackStreamFactory.StackTrace)backtrace).getStackTraceElements();
} else {
- int depth = getStackTraceDepth();
stackTrace = new StackTraceElement[depth];
- for (int i = 0; i < depth; i++)
- stackTrace[i] = getStackTraceElement(i);
+ for (int i = 0; i < depth; i++) {
+ stackTrace[i] = new StackTraceElement();
+ }
+ getStackTraceElements(stackTrace);
}
} else if (stackTrace == null) {
return UNASSIGNED_STACK;
@@ -884,23 +890,11 @@
}
/**
- * Returns the number of elements in the stack trace (or 0 if the stack
- * trace is unavailable).
- *
- * package-protection for use by SharedSecrets.
+ * Gets the stack trace elements.
+ * @param elements
+ * @throws IndexOutOfBoundsException if {@code elements.length != depth }
*/
- native int getStackTraceDepth();
-
- /**
- * Returns the specified element of the stack trace.
- *
- * package-protection for use by SharedSecrets.
- *
- * @param index index of the element to return.
- * @throws IndexOutOfBoundsException if {@code index < 0 ||
- * index >= getStackTraceDepth() }
- */
- native StackTraceElement getStackTraceElement(int index);
+ private native void getStackTraceElements(StackTraceElement[] elements);
/**
* Reads a {@code Throwable} from a stream, enforcing
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Sat Mar 19 01:23:44 2016 +0100
@@ -34,11 +34,11 @@
import java.lang.invoke.MethodHandles.Lookup;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;
+import sun.security.action.GetPropertyAction;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
@@ -188,20 +188,14 @@
private static final ProxyClassesDumper DUMPER;
static {
- // Poke the privileged block once, taking everything we need:
- final Object[] values = new Object[4];
- AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
- values[0] = System.getProperty("java.lang.invoke.stringConcat");
- values[1] = Boolean.getBoolean("java.lang.invoke.stringConcat.cache");
- values[2] = Boolean.getBoolean("java.lang.invoke.stringConcat.debug");
- values[3] = System.getProperty("java.lang.invoke.stringConcat.dumpClasses");
- return null;
- });
-
- final String strategy = (String) values[0];
- CACHE_ENABLE = (Boolean) values[1];
- DEBUG = (Boolean) values[2];
- final String dumpPath = (String) values[3];
+ final String strategy = AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat"));
+ CACHE_ENABLE = Boolean.parseBoolean(AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.cache")));
+ DEBUG = Boolean.parseBoolean(AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.debug")));
+ final String dumpPath = AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.dumpClasses"));
STRATEGY = (strategy == null) ? DEFAULT_STRATEGY : Strategy.valueOf(strategy);
CACHE = CACHE_ENABLE ? new ConcurrentHashMap<>() : null;
--- a/jdk/src/java.base/share/native/include/jvm.h Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/src/java.base/share/native/include/jvm.h Sat Mar 19 01:23:44 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -171,11 +171,8 @@
JNIEXPORT void JNICALL
JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
-JNIEXPORT jint JNICALL
-JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
-
-JNIEXPORT jobject JNICALL
-JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
+JNIEXPORT void JNICALL
+JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray elements);
/*
* java.lang.StackWalker
--- a/jdk/src/java.base/share/native/libjava/Throwable.c Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/src/java.base/share/native/libjava/Throwable.c Sat Mar 19 01:23:44 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +50,9 @@
return throwable;
}
-JNIEXPORT jint JNICALL
-Java_java_lang_Throwable_getStackTraceDepth(JNIEnv *env, jobject throwable)
+JNIEXPORT void JNICALL
+Java_java_lang_Throwable_getStackTraceElements(JNIEnv *env,
+ jobject throwable, jobjectArray elements)
{
- return JVM_GetStackTraceDepth(env, throwable);
+ JVM_GetStackTraceElements(env, throwable, elements);
}
-
-JNIEXPORT jobject JNICALL
-Java_java_lang_Throwable_getStackTraceElement(JNIEnv *env,
- jobject throwable, jint index)
-{
- return JVM_GetStackTraceElement(env, throwable, index);
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/Format/DateFormat/DFSConstructorCloneTest.java Sat Mar 19 01:23:44 2016 +0100
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8087104
+ * @summary Make sure that clone() method is not called from DateFormatSymbols constructor.
+ */
+import java.text.DateFormatSymbols;
+
+public class DFSymbolsCloneTest extends DateFormatSymbols {
+
+ private Foo foo;
+
+ public DFSymbolsCloneTest(Foo fooObj) {
+ if (fooObj == null) {
+ this.foo = new Foo();
+ } else {
+ this.foo = fooObj;
+ }
+ }
+
+ @Override
+ public Object clone() {
+ DFSymbolsCloneTest dfsclone = (DFSymbolsCloneTest) super.clone();
+ if (this.foo == null) {
+ throw new RuntimeException("Clone method should not be called from "
+ + " Superclass(DateFormatSymbols) Constructor...");
+ } else {
+ dfsclone.foo = (Foo) this.foo.clone();
+ }
+ return dfsclone;
+ }
+
+ public static void main(String[] args) {
+ DFSymbolsCloneTest dfsctest = new DFSymbolsCloneTest(new Foo());
+ }
+}
+
+class Foo {
+
+ public Foo() {
+ }
+
+ @Override
+ protected Object clone() {
+ return new Foo();
+ }
+
+}
--- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Sat Mar 19 01:23:44 2016 +0100
@@ -143,6 +143,7 @@
launch("No deadlocks found", "jstack");
launch("compiler detected", "jmap");
launch("Java System Properties", "jinfo");
+ launch("java.threads", "jsnap");
// The test throws RuntimeException on error.
// IOException is thrown if LingeredApp can't start because of some bad
--- a/jdk/test/sun/tools/jhsdb/SAGetoptTest.java Wed Mar 16 14:31:32 2016 +0100
+++ b/jdk/test/sun/tools/jhsdb/SAGetoptTest.java Sat Mar 19 01:23:44 2016 +0100
@@ -152,5 +152,8 @@
String[] optionSet6 = {"--exe", "--core", "bla_core"};
badOptionsTest(6, optionSet6, "Argument is expected for 'exe'");
+
+ String[] optionSet7 = {"--exe"};
+ badOptionsTest(7, optionSet7, "Argument is expected for 'exe'");
}
}