--- a/.hgtags Thu Aug 27 14:40:21 2015 -0700
+++ b/.hgtags Mon Aug 31 11:26:11 2015 -0700
@@ -321,3 +321,4 @@
eeea9adfd1e3d075ef82148c00a4847a1aab4d26 jdk9-b76
c25e882cee9622ec75c4e9d60633539a2f0a8809 jdk9-b77
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
+3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
--- a/.hgtags-top-repo Thu Aug 27 14:40:21 2015 -0700
+++ b/.hgtags-top-repo Mon Aug 31 11:26:11 2015 -0700
@@ -321,3 +321,4 @@
d82072b699b880a1f647a5e2d7c0f86cec958941 jdk9-b76
7972dc8f2a47f0c4cd8f02fa5662af41f028aa14 jdk9-b77
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
+ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
--- a/corba/.hgtags Thu Aug 27 14:40:21 2015 -0700
+++ b/corba/.hgtags Mon Aug 31 11:26:11 2015 -0700
@@ -321,3 +321,4 @@
d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
8bb2441c0fec8b28f7bf11a0ca3ec1642e7ef457 jdk9-b77
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
+4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
--- a/hotspot/.hgtags Thu Aug 27 14:40:21 2015 -0700
+++ b/hotspot/.hgtags Mon Aug 31 11:26:11 2015 -0700
@@ -481,3 +481,4 @@
0bc8d1656d6f2b1fdfe803c1305a108bb9939f35 jdk9-b76
e66c3813789debfc06f206afde1bf7a84cb08451 jdk9-b77
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
+e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
--- a/jaxp/.hgtags Thu Aug 27 14:40:21 2015 -0700
+++ b/jaxp/.hgtags Mon Aug 31 11:26:11 2015 -0700
@@ -321,3 +321,4 @@
36801a89a04201b59874ec776ffe85d6253c9ab5 jdk9-b76
be357705874c4ba1a69c38fb211e5e31e35bf9cb jdk9-b77
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
+cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java Mon Aug 31 11:26:11 2015 -0700
@@ -1,15 +1,15 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*/
+
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: MultiDOM.java,v 1.5 2005/09/28 13:48:36 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.dom;
@@ -35,6 +32,7 @@
import com.sun.org.apache.xml.internal.dtm.DTMManager;
import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase;
import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIterNodeList;
import com.sun.org.apache.xml.internal.utils.SuballocatedIntVector;
import org.w3c.dom.Node;
@@ -569,7 +567,7 @@
public NodeList makeNodeList(DTMAxisIterator iter) {
int index = iter.next();
if (index == DTM.NULL) {
- return null;
+ return new DTMAxisIterNodeList(null, null);
}
iter.reset();
return _adapters[getDTMId(index)].makeNodeList(iter);
--- a/jaxws/.hgtags Thu Aug 27 14:40:21 2015 -0700
+++ b/jaxws/.hgtags Mon Aug 31 11:26:11 2015 -0700
@@ -324,3 +324,4 @@
55bb88306dc57d07f2c854803465f6d9a7eb4aba jdk9-b76
bd6ece68cf8aca34c8d992569892060c82cfd3f1 jdk9-b77
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
+42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
--- a/jdk/make/lib/Awt2dLibraries.gmk Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk Mon Aug 31 11:26:11 2015 -0700
@@ -887,7 +887,8 @@
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
DISABLED_WARNINGS_clang := incompatible-pointer-types, \
- DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE, \
+ DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
+ E_STATEMENT_NOT_REACHED, \
DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/jdk/make/lib/CoreLibraries.gmk Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/make/lib/CoreLibraries.gmk Mon Aug 31 11:26:11 2015 -0700
@@ -146,6 +146,7 @@
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
+ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -307,7 +308,9 @@
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
- DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \
+ DISABLED_WARNINGS_solstudio := \
+ E_ASM_DISABLES_OPTIMIZATION \
+ E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/lib/NetworkingLibraries.gmk Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/make/lib/NetworkingLibraries.gmk Mon Aug 31 11:26:11 2015 -0700
@@ -35,6 +35,7 @@
DISABLED_WARNINGS_gcc := format-nonliteral, \
DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
+ DISABLED_WARNINGS_solstudio := E_ARG_INCOMPATIBLE_WITH_ARG_L, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/lib/NioLibraries.gmk Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/make/lib/NioLibraries.gmk Mon Aug 31 11:26:11 2015 -0700
@@ -47,7 +47,7 @@
ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
BUILD_LIBNIO_EXFILES += \
- GnomeFileTypeDetector.c \
+ GioFileTypeDetector.c \
#
endif
--- a/jdk/make/mapfiles/libnio/mapfile-linux Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/make/mapfiles/libnio/mapfile-linux Mon Aug 31 11:26:11 2015 -0700
@@ -135,8 +135,8 @@
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
- Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeGio;
+ Java_sun_nio_fs_GioFileTypeDetector_initializeGio;
+ Java_sun_nio_fs_GioFileTypeDetector_probeGio;
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
Java_sun_nio_fs_LinuxWatchService_eventSize;
--- a/jdk/make/mapfiles/libnio/mapfile-solaris Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/make/mapfiles/libnio/mapfile-solaris Mon Aug 31 11:26:11 2015 -0700
@@ -130,8 +130,8 @@
Java_sun_nio_ch_SolarisEventPort_port_1get;
Java_sun_nio_ch_SolarisEventPort_port_1getn;
Java_sun_nio_ch_SolarisEventPort_port_1send;
- Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeGio;
+ Java_sun_nio_fs_GioFileTypeDetector_initializeGio;
+ Java_sun_nio_fs_GioFileTypeDetector_probeGio;
Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
--- a/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Mon Aug 31 11:26:11 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -106,7 +106,7 @@
new GetPropertyAction("user.home")), ".mime.types");
Path etcMimeTypes = Paths.get("/etc/mime.types");
- return chain(new GnomeFileTypeDetector(),
+ return chain(new GioFileTypeDetector(),
new MimeTypesFileTypeDetector(userMimeTypes),
new MimeTypesFileTypeDetector(etcMimeTypes),
new MagicFileTypeDetector());
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java Mon Aug 31 11:26:11 2015 -0700
@@ -1611,8 +1611,13 @@
* First the keystore type is determined by probing the specified file.
* Then a keystore object is instantiated and loaded using the data from
* that file.
- * A password may be supplied to unlock the keystore data or perform an
- * integrity check.
+ *
+ * <p>
+ * A password may be given to unlock the keystore
+ * (e.g. the keystore resides on a hardware token device),
+ * or to check the integrity of the keystore data.
+ * If a password is not given for integrity checking,
+ * then integrity checking is not performed.
*
* <p>
* This method traverses the list of registered security
--- a/jdk/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Mon Aug 31 11:26:11 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* 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 @@
new GetPropertyAction("user.home")), ".mime.types");
Path etcMimeTypes = Paths.get("/etc/mime.types");
- return chain(new GnomeFileTypeDetector(),
+ return chain(new GioFileTypeDetector(),
new MimeTypesFileTypeDetector(userMimeTypes),
new MimeTypesFileTypeDetector(etcMimeTypes));
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/GioFileTypeDetector.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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 sun.nio.fs;
+
+import java.nio.file.Path;
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * File type detector that uses the GNOME I/O library to guess the
+ * MIME type of a file.
+ */
+
+public class GioFileTypeDetector
+ extends AbstractFileTypeDetector
+{
+ // true if GIO is available
+ private final boolean gioAvailable;
+
+ public GioFileTypeDetector() {
+ gioAvailable = initializeGio();
+ }
+
+ @Override
+ public String implProbeContentType(Path obj) throws IOException {
+ if (!gioAvailable)
+ return null;
+ if (!(obj instanceof UnixPath))
+ return null;
+
+ UnixPath path = (UnixPath)obj;
+ NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
+ try {
+ // GIO may access file so need permission check
+ path.checkRead();
+ byte[] type = probeGio(buffer.address());
+ return (type == null) ? null : Util.toString(type);
+ } finally {
+ buffer.release();
+ }
+
+ }
+
+ // GIO
+ private static native boolean initializeGio();
+ //
+ // The probeGIO() method is synchronized to avert potential problems
+ // such as crashes due to a suspected lack of thread safety in GIO.
+ //
+ private static synchronized native byte[] probeGio(long pathAddress);
+
+ static {
+ AccessController.doPrivileged(new PrivilegedAction<>() {
+ public Void run() {
+ System.loadLibrary("nio");
+ return null;
+ }});
+ }
+}
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/GnomeFileTypeDetector.java Thu Aug 27 14:40:21 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
- * 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 sun.nio.fs;
-
-import java.nio.file.Path;
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * File type detector that uses the GNOME I/O library to guess the
- * MIME type of a file.
- */
-
-public class GnomeFileTypeDetector
- extends AbstractFileTypeDetector
-{
- // true if GIO is available
- private final boolean gioAvailable;
-
- public GnomeFileTypeDetector() {
- gioAvailable = initializeGio();
- }
-
- @Override
- public String implProbeContentType(Path obj) throws IOException {
- if (!gioAvailable)
- return null;
- if (!(obj instanceof UnixPath))
- return null;
-
- UnixPath path = (UnixPath)obj;
- NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
- try {
- // GIO may access file so need permission check
- path.checkRead();
- byte[] type = probeGio(buffer.address());
- return (type == null) ? null : Util.toString(type);
- } finally {
- buffer.release();
- }
-
- }
-
- // GIO
- private static native boolean initializeGio();
- private static synchronized native byte[] probeGio(long pathAddress);
-
- static {
- AccessController.doPrivileged(new PrivilegedAction<>() {
- public Void run() {
- System.loadLibrary("nio");
- return null;
- }});
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/native/libnio/fs/GioFileTypeDetector.c Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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 "jni.h"
+#include "jni_util.h"
+#include "jvm.h"
+#include "jlong.h"
+
+#include <stdlib.h>
+#include <dlfcn.h>
+
+#ifdef __solaris__
+#include <strings.h>
+#endif
+
+#if defined(__linux__)
+#include <string.h>
+#endif
+
+/*
+ * For reference see for example the GFileInfo section at
+ * https://developer.gnome.org/gio/unstable/.
+ */
+
+/* Definitions for GIO */
+
+#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type"
+
+typedef void* gpointer;
+typedef struct _GFile GFile;
+typedef struct _GFileInfo GFileInfo;
+typedef struct _GCancellable GCancellable;
+typedef struct _GError GError;
+
+typedef enum {
+ G_FILE_QUERY_INFO_NONE = 0
+} GFileQueryInfoFlags;
+
+typedef void (*g_type_init_func)(void);
+typedef void (*g_object_unref_func)(gpointer object);
+typedef GFile* (*g_file_new_for_path_func)(const char* path);
+typedef GFileInfo* (*g_file_query_info_func)(GFile *file,
+ const char *attributes, GFileQueryInfoFlags flags,
+ GCancellable *cancellable, GError **error);
+typedef char* (*g_file_info_get_content_type_func)(GFileInfo *info);
+
+static g_type_init_func g_type_init;
+static g_object_unref_func g_object_unref;
+static g_file_new_for_path_func g_file_new_for_path;
+static g_file_query_info_func g_file_query_info;
+static g_file_info_get_content_type_func g_file_info_get_content_type;
+
+
+#include "sun_nio_fs_GioFileTypeDetector.h"
+
+
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_fs_GioFileTypeDetector_initializeGio
+ (JNIEnv* env, jclass this)
+{
+ void* gio_handle;
+
+ gio_handle = dlopen("libgio-2.0.so", RTLD_LAZY);
+ if (gio_handle == NULL) {
+ gio_handle = dlopen("libgio-2.0.so.0", RTLD_LAZY);
+ if (gio_handle == NULL) {
+ return JNI_FALSE;
+ }
+ }
+
+ g_type_init = (g_type_init_func)dlsym(gio_handle, "g_type_init");
+ (*g_type_init)();
+
+ g_object_unref = (g_object_unref_func)dlsym(gio_handle, "g_object_unref");
+
+ g_file_new_for_path =
+ (g_file_new_for_path_func)dlsym(gio_handle, "g_file_new_for_path");
+
+ g_file_query_info =
+ (g_file_query_info_func)dlsym(gio_handle, "g_file_query_info");
+
+ g_file_info_get_content_type = (g_file_info_get_content_type_func)
+ dlsym(gio_handle, "g_file_info_get_content_type");
+
+
+ if (g_type_init == NULL ||
+ g_object_unref == NULL ||
+ g_file_new_for_path == NULL ||
+ g_file_query_info == NULL ||
+ g_file_info_get_content_type == NULL)
+ {
+ dlclose(gio_handle);
+ return JNI_FALSE;
+ }
+
+ (*g_type_init)();
+ return JNI_TRUE;
+}
+
+JNIEXPORT jbyteArray JNICALL
+Java_sun_nio_fs_GioFileTypeDetector_probeGio
+ (JNIEnv* env, jclass this, jlong pathAddress)
+{
+ char* path = (char*)jlong_to_ptr(pathAddress);
+ GFile* gfile;
+ GFileInfo* gfileinfo;
+ jbyteArray result = NULL;
+
+ gfile = (*g_file_new_for_path)(path);
+ gfileinfo = (*g_file_query_info)(gfile, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ if (gfileinfo != NULL) {
+ const char* mime = (*g_file_info_get_content_type)(gfileinfo);
+ if (mime != NULL) {
+ jsize len = strlen(mime);
+ result = (*env)->NewByteArray(env, len);
+ if (result != NULL) {
+ (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)mime);
+ }
+ }
+ (*g_object_unref)(gfileinfo);
+ }
+ (*g_object_unref)(gfile);
+
+ return result;
+}
--- a/jdk/src/java.base/unix/native/libnio/fs/GnomeFileTypeDetector.c Thu Aug 27 14:40:21 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
- * 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 "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "jlong.h"
-
-#include <stdlib.h>
-#include <dlfcn.h>
-
-#ifdef __solaris__
-#include <strings.h>
-#endif
-
-#if defined(__linux__)
-#include <string.h>
-#endif
-
-/*
- * For reference see for example the GFileInfo section at
- * https://developer.gnome.org/gio/unstable/.
- */
-
-/* Definitions for GIO */
-
-#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type"
-
-typedef void* gpointer;
-typedef struct _GFile GFile;
-typedef struct _GFileInfo GFileInfo;
-typedef struct _GCancellable GCancellable;
-typedef struct _GError GError;
-
-typedef enum {
- G_FILE_QUERY_INFO_NONE = 0
-} GFileQueryInfoFlags;
-
-typedef void (*g_type_init_func)(void);
-typedef void (*g_object_unref_func)(gpointer object);
-typedef GFile* (*g_file_new_for_path_func)(const char* path);
-typedef GFileInfo* (*g_file_query_info_func)(GFile *file,
- const char *attributes, GFileQueryInfoFlags flags,
- GCancellable *cancellable, GError **error);
-typedef char* (*g_file_info_get_content_type_func)(GFileInfo *info);
-
-static g_type_init_func g_type_init;
-static g_object_unref_func g_object_unref;
-static g_file_new_for_path_func g_file_new_for_path;
-static g_file_query_info_func g_file_query_info;
-static g_file_info_get_content_type_func g_file_info_get_content_type;
-
-
-#include "sun_nio_fs_GnomeFileTypeDetector.h"
-
-
-JNIEXPORT jboolean JNICALL
-Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio
- (JNIEnv* env, jclass this)
-{
- void* gio_handle;
-
- gio_handle = dlopen("libgio-2.0.so", RTLD_LAZY);
- if (gio_handle == NULL) {
- gio_handle = dlopen("libgio-2.0.so.0", RTLD_LAZY);
- if (gio_handle == NULL) {
- return JNI_FALSE;
- }
- }
-
- g_type_init = (g_type_init_func)dlsym(gio_handle, "g_type_init");
- (*g_type_init)();
-
- g_object_unref = (g_object_unref_func)dlsym(gio_handle, "g_object_unref");
-
- g_file_new_for_path =
- (g_file_new_for_path_func)dlsym(gio_handle, "g_file_new_for_path");
-
- g_file_query_info =
- (g_file_query_info_func)dlsym(gio_handle, "g_file_query_info");
-
- g_file_info_get_content_type = (g_file_info_get_content_type_func)
- dlsym(gio_handle, "g_file_info_get_content_type");
-
-
- if (g_type_init == NULL ||
- g_object_unref == NULL ||
- g_file_new_for_path == NULL ||
- g_file_query_info == NULL ||
- g_file_info_get_content_type == NULL)
- {
- dlclose(gio_handle);
- return JNI_FALSE;
- }
-
- (*g_type_init)();
- return JNI_TRUE;
-}
-
-JNIEXPORT jbyteArray JNICALL
-Java_sun_nio_fs_GnomeFileTypeDetector_probeGio
- (JNIEnv* env, jclass this, jlong pathAddress)
-{
- char* path = (char*)jlong_to_ptr(pathAddress);
- GFile* gfile;
- GFileInfo* gfileinfo;
- jbyteArray result = NULL;
-
- gfile = (*g_file_new_for_path)(path);
- gfileinfo = (*g_file_query_info)(gfile, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NONE, NULL, NULL);
- if (gfileinfo != NULL) {
- const char* mime = (*g_file_info_get_content_type)(gfileinfo);
- if (mime != NULL) {
- jsize len = strlen(mime);
- result = (*env)->NewByteArray(env, len);
- if (result != NULL) {
- (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)mime);
- }
- }
- (*g_object_unref)(gfileinfo);
- }
- (*g_object_unref)(gfile);
-
- return result;
-}
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Mon Aug 31 11:26:11 2015 -0700
@@ -65,8 +65,9 @@
// only support legacy JAR URL syntax jar:{uri}!/{entry} for now
String spec = uri.getRawSchemeSpecificPart();
int sep = spec.indexOf("!/");
- if (sep != -1)
+ if (sep != -1) {
spec = spec.substring(0, sep);
+ }
return Paths.get(new URI(spec)).toAbsolutePath();
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e.getMessage(), e);
@@ -107,6 +108,9 @@
// assume NOT a zip/jar file
throw new UnsupportedOperationException();
}
+ if (realPath == null) { // newly created
+ realPath = path.toRealPath();
+ }
filesystems.put(realPath, zipfs);
return zipfs;
}
@@ -132,7 +136,6 @@
@Override
public Path getPath(URI uri) {
-
String spec = uri.getSchemeSpecificPart();
int sep = spec.indexOf("!/");
if (sep == -1)
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Mon Aug 31 11:26:11 2015 -0700
@@ -32,10 +32,10 @@
import java.nio.file.DirectoryStream.Filter;
import java.nio.file.attribute.*;
import java.util.*;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardOpenOption.*;
import static java.nio.file.StandardCopyOption.*;
-
/**
*
* @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal
@@ -180,7 +180,7 @@
public URI toUri() {
try {
return new URI("jar",
- zfs.getZipFile().toUri() +
+ decodeUri(zfs.getZipFile().toUri().toString()) +
"!" +
zfs.getString(toAbsolutePath().path),
null);
@@ -866,4 +866,57 @@
}
}
}
+
+ private static int decode(char c) {
+ if ((c >= '0') && (c <= '9'))
+ return c - '0';
+ if ((c >= 'a') && (c <= 'f'))
+ return c - 'a' + 10;
+ if ((c >= 'A') && (c <= 'F'))
+ return c - 'A' + 10;
+ assert false;
+ return -1;
+ }
+
+ // to avoid double escape
+ static String decodeUri(String s) {
+ if (s == null)
+ return s;
+ int n = s.length();
+ if (n == 0)
+ return s;
+ if (s.indexOf('%') < 0)
+ return s;
+
+ StringBuilder sb = new StringBuilder(n);
+ byte[] bb = new byte[n];
+ boolean betweenBrackets = false;
+
+ for (int i = 0; i < n;) {
+ char c = s.charAt(i);
+ if (c == '[') {
+ betweenBrackets = true;
+ } else if (betweenBrackets && c == ']') {
+ betweenBrackets = false;
+ }
+ if (c != '%' || betweenBrackets ) {
+ sb.append(c);
+ i++;
+ continue;
+ }
+ int nb = 0;
+ while (c == '%') {
+ assert (n - i >= 2);
+ bb[nb++] = (byte)(((decode(s.charAt(++i)) & 0xf) << 4) |
+ (decode(s.charAt(++i)) & 0xf));
+ if (++i >= n) {
+ break;
+ }
+ c = s.charAt(i);
+ }
+ sb.append(new String(bb, 0, nb, UTF_8));
+ }
+ return sb.toString();
+ }
+
}
--- a/jdk/test/ProblemList.txt Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/test/ProblemList.txt Mon Aug 31 11:26:11 2015 -0700
@@ -136,6 +136,9 @@
# 8133552
java/lang/ProcessHandle/InfoTest.java generic-all
+# 8134677
+java/lang/SecurityManager/CheckPackageMatching.java windows-all
+
############################################################################
# jdk_instrument
@@ -384,6 +387,11 @@
# 6456333
sun/tools/jps/TestJpsJarRelative.java generic-all
+# 8134420
+sun/tools/jps/TestJpsClass.java generic-all
+sun/tools/jps/TestJpsJar.java generic-all
+sun/tools/jps/TestJpsSanity.java generic-all
+
# 6734748
sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
--- a/jdk/test/TEST.ROOT Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/test/TEST.ROOT Mon Aug 31 11:26:11 2015 -0700
@@ -18,7 +18,7 @@
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 java/lang/ProcessHandle
# 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 javax/rmi sun/tools/jps
+exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi
# Group definitions
groups=TEST.groups [closed/TEST.groups]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/Blowfish/TestCipherBlowfish.java Mon Aug 31 11:26:11 2015 -0700
@@ -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.
+ *
+ * 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.NoSuchAlgorithmException;
+
+/*
+ * @test
+ * @bug 8048601
+ * @library ../
+ * @summary Test Blowfish cipher with different MODES and padding
+ */
+
+public class TestCipherBlowfish extends TestCipher {
+
+ TestCipherBlowfish() throws NoSuchAlgorithmException {
+ super("Blowfish",
+ new String[]{"CBC", "CTR", "CTS", "ECB", "PCBC",
+ //CFBx
+ "CFB", "CFB8", "CFB16", "CFB24", "CFB32", "CFB40", "CFB48", "CFB56",
+ "CFB64",
+ //OFBx
+ "OFB", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40", "OFB48", "OFB56",
+ "OFB64"},
+ new String[]{"NoPaDDing", "PKCS5Padding"},
+ true);
+ }
+
+ public static void main(String[] args) throws Exception {
+ new TestCipherBlowfish().runAll();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/TestCipherDES.java Mon Aug 31 11:26:11 2015 -0700
@@ -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.
+ *
+ * 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 8048601
+ * @library ../
+ * @summary Test DES/DESede cipher with different MODES and padding
+ */
+
+public class TestCipherDES extends TestCipher {
+
+ TestCipherDES() {
+ super("DES",
+ new String[]{"CBC", "CTR", "CTS", "ECB", "PCBC",
+ //CFBx
+ "CFB", "CFB8", "CFB16", "CFB24", "CFB32", "CFB40", "CFB48", "CFB56",
+ "CFB64",
+ //OFBx
+ "OFB", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40", "OFB48", "OFB56",
+ "OFB64"},
+ new String[]{"NoPaDDing", "PKCS5Padding"});
+ }
+
+ public static void main(String[] args) throws Exception {
+ new TestCipherDES().runAll();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/TestCipherDESede.java Mon Aug 31 11:26:11 2015 -0700
@@ -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.
+ *
+ * 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 8048601
+ * @library ../
+ * @summary Test DES/DESede cipher with different MODES and padding
+ */
+
+public class TestCipherDESede extends TestCipher {
+
+ TestCipherDESede() {
+ super("DESede",
+ new String[]{"CBC", "CTR", "CTS", "ECB", "PCBC",
+ //CFBx
+ "CFB", "CFB8", "CFB16", "CFB24", "CFB32", "CFB40", "CFB48", "CFB56",
+ "CFB64",
+ //OFBx
+ "OFB", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40", "OFB48", "OFB56",
+ "OFB64"},
+ new String[]{"NoPaDDing", "PKCS5Padding"});
+ }
+
+ public static void main(String[] args) throws Exception {
+ new TestCipherDESede().runAll();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBE.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,128 @@
+/*
+ * 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 static java.lang.System.out;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.InvalidKeySpecException;
+import java.util.Arrays;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.ShortBufferException;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+
+/*
+ * @test
+ * @bug 8048601
+ * @summary Tests for PBE ciphers
+ */
+public class TestCipherPBE {
+
+ private static final String[] ALGORITHMS = {"PBEWithMD5AndDES",
+ "PBEWithMD5AndDES/CBC/PKCS5Padding", "PBEWithMD5AndTripleDES",
+ "PBEWithMD5AndTripleDES/CBC/PKCS5Padding"};
+
+ private static final String KEY_ALGO = "pbeWithMD5ANDdes";
+ private final byte[] SALT;
+ private final byte[] PLAIN_TEXT;
+
+ public TestCipherPBE() {
+ SALT = generateBytes(8);
+ PLAIN_TEXT = generateBytes(200);
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ new TestCipherPBE().runAll();
+ }
+
+ private void runAll() throws Exception {
+ for (String algorithm : ALGORITHMS) {
+ runTest(algorithm);
+ }
+ }
+
+ private void runTest(String algorithm)
+ throws InvalidKeySpecException, NoSuchAlgorithmException,
+ InvalidAlgorithmParameterException, ShortBufferException,
+ NoSuchPaddingException, IllegalBlockSizeException,
+ BadPaddingException, InvalidKeyException {
+
+ out.println("=> Testing: " + algorithm);
+
+ try {
+ // Initialization
+ AlgorithmParameterSpec algoParamSpec
+ = new PBEParameterSpec(SALT, 6);
+
+ SecretKey secretKey
+ = SecretKeyFactory.getInstance(KEY_ALGO).generateSecret(
+ new PBEKeySpec(("Secret Key Value").toCharArray()));
+
+ Cipher ci = Cipher.getInstance(algorithm);
+ ci.init(Cipher.ENCRYPT_MODE, secretKey, algoParamSpec);
+
+ // Encryption
+ byte[] cipherText = ci.doFinal(PLAIN_TEXT);
+
+ // Decryption
+ ci.init(Cipher.DECRYPT_MODE, secretKey, algoParamSpec);
+ byte[] recoveredText = ci.doFinal(cipherText);
+
+ if (algorithm.contains("TripleDES")) {
+ throw new RuntimeException(
+ "Expected InvalidKeyException exception uncaugh");
+ }
+
+ // Comparison
+ if (!Arrays.equals(PLAIN_TEXT, recoveredText)) {
+ throw new RuntimeException(
+ "Test failed: plainText is not equal to recoveredText");
+ }
+ out.println("Test Passed.");
+ } catch (InvalidKeyException ex) {
+ if (algorithm.contains("TripleDES")) {
+ out.println("Expected InvalidKeyException raised");
+ } else {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+
+ public static byte[] generateBytes(int length) {
+ byte[] bytes = new byte[length];
+ for (int i = 0; i < length; i++) {
+ bytes[i] = (byte) (i & 0xff);
+ }
+ return bytes;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/TestCipher.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,220 @@
+/*
+ * 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 static java.lang.System.out;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.spec.AlgorithmParameterSpec;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.KeyGenerator;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.SecretKey;
+import javax.crypto.ShortBufferException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * This is a abstract class used to test various ciphers
+ */
+public abstract class TestCipher {
+
+ private final String SUNJCE = "SunJCE";
+ private final String ALGORITHM;
+ private final String[] MODES;
+ private final String[] PADDINGS;
+
+ /* Used to test cipher with different key strengths
+ Key size tested is increment of KEYCUTTER from MINIMUM_KEY_SIZE to
+ maximum allowed keysize.
+ DES/DESede/Blowfish work with currently selected key sizes.
+ */
+ private final int variousKeySize;
+ private final int KEYCUTTER = 8;
+ private final int MINIMUM_KEY_SIZE = 32;
+
+ // Used to assert that Encryption/Decryption works with same buffer
+ // TEXT_LEN is multiple of blocks in order to work against ciphers w/ NoPadding
+ private final int TEXT_LEN = 800;
+ private final int ENC_OFFSET = 6;
+ private final int STORAGE_OFFSET = 3;
+ private final int PAD_BYTES = 16;
+
+ private final byte[] IV;
+ private final byte[] INPUT_TEXT;
+
+ TestCipher(String algo, String[] modes, String[] paddings,
+ boolean keyStrength) throws NoSuchAlgorithmException {
+ ALGORITHM = algo;
+ MODES = modes;
+ PADDINGS = paddings;
+ this.variousKeySize
+ = keyStrength ? Cipher.getMaxAllowedKeyLength(ALGORITHM) : 0;
+
+ IV = generateBytes(8);
+ INPUT_TEXT = generateBytes(TEXT_LEN + PAD_BYTES + ENC_OFFSET);
+ }
+
+ TestCipher(String algo, String[] modes, String[] paddings) {
+ ALGORITHM = algo;
+ MODES = modes;
+ PADDINGS = paddings;
+ variousKeySize = 0;
+
+ IV = generateBytes(8);
+ INPUT_TEXT = generateBytes(TEXT_LEN + PAD_BYTES + ENC_OFFSET);
+ }
+
+ private static byte[] generateBytes(int length) {
+ byte[] bytes = new byte[length];
+ for (int i = 0; i < length; i++) {
+ bytes[i] = (byte) (i & 0xff);
+ }
+ return bytes;
+ }
+
+ private boolean isKeyStrenthSupported() {
+ return (variousKeySize != 0);
+ }
+
+ public void runAll() throws InvalidKeyException,
+ NoSuchPaddingException, InvalidAlgorithmParameterException,
+ ShortBufferException, IllegalBlockSizeException,
+ BadPaddingException, NoSuchAlgorithmException,
+ NoSuchProviderException {
+
+ for (String mode : MODES) {
+ for (String padding : PADDINGS) {
+ if (!isKeyStrenthSupported()) {
+ runTest(mode, padding, 0);
+ } else {
+ int keySize = variousKeySize;
+ while (keySize >= MINIMUM_KEY_SIZE) {
+ out.println("With Key Strength: " + keySize);
+ runTest(mode, padding, keySize);
+ keySize -= KEYCUTTER;
+ }
+ }
+ }
+ }
+ }
+
+ private void runTest(String mo, String pad, int keySize)
+ throws NoSuchPaddingException, BadPaddingException,
+ ShortBufferException, IllegalBlockSizeException,
+ InvalidAlgorithmParameterException, InvalidKeyException,
+ NoSuchAlgorithmException, NoSuchProviderException {
+
+ String TRANSFORMATION = ALGORITHM + "/" + mo + "/" + pad;
+ out.println("Testing: " + TRANSFORMATION);
+
+ // Initialization
+ Cipher ci = Cipher.getInstance(TRANSFORMATION, SUNJCE);
+ KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM, SUNJCE);
+ if (keySize != 0) {
+ kg.init(keySize);
+ }
+ SecretKey key = kg.generateKey();
+ SecretKeySpec skeySpec = new SecretKeySpec(key.getEncoded(), ALGORITHM);
+
+ AlgorithmParameterSpec aps = new IvParameterSpec(IV);
+ if (mo.equalsIgnoreCase("ECB")) {
+ ci.init(Cipher.ENCRYPT_MODE, key);
+ } else {
+ ci.init(Cipher.ENCRYPT_MODE, key, aps);
+ }
+
+ // Encryption
+ int PAD_LEN = 0;
+ if (pad.equalsIgnoreCase("PKCS5Padding")) {
+ // Need to consider pad bytes
+ PAD_LEN = 8;
+ }
+
+ byte[] plainText = INPUT_TEXT.clone();
+
+ // Generate cipher and save to separate buffer
+ byte[] cipherText = ci.doFinal(INPUT_TEXT, ENC_OFFSET, TEXT_LEN);
+
+ // Generate cipher and save to same buffer
+ int offset = ci.update(
+ INPUT_TEXT, ENC_OFFSET, TEXT_LEN, INPUT_TEXT, STORAGE_OFFSET);
+ ci.doFinal(INPUT_TEXT, offset + STORAGE_OFFSET);
+
+ if (!equalsBlock(
+ INPUT_TEXT, STORAGE_OFFSET, cipherText, 0, cipherText.length)) {
+ throw new RuntimeException(
+ "Different ciphers generated with same buffer");
+ }
+
+ // Decryption
+ if (mo.equalsIgnoreCase("ECB")) {
+ ci.init(Cipher.DECRYPT_MODE, skeySpec);
+ } else {
+ ci.init(Cipher.DECRYPT_MODE, skeySpec, aps);
+ }
+
+ // Recover text from cipher and save to separate buffer
+ byte[] recoveredText = ci.doFinal(cipherText, 0, cipherText.length);
+
+ if (!equalsBlock(
+ plainText, ENC_OFFSET, recoveredText, 0,
+ recoveredText.length)) {
+ throw new RuntimeException(
+ "Recovered text not same as plain text");
+ } else {
+ out.println("Recovered and plain text are same");
+ }
+
+ // Recover text from cipher and save to same buffer
+ ci.update(INPUT_TEXT, STORAGE_OFFSET, TEXT_LEN + PAD_LEN, INPUT_TEXT,
+ ENC_OFFSET);
+ ci.doFinal(INPUT_TEXT, ENC_OFFSET);
+
+ if (!equalsBlock(
+ plainText, ENC_OFFSET, recoveredText, 0,
+ recoveredText.length)) {
+ throw new RuntimeException(
+ "Recovered text not same as plain text with same buffer");
+ } else {
+ out.println("Recovered and plain text are same with same buffer");
+ }
+
+ out.println("Test Passed.");
+ }
+
+ private static boolean equalsBlock(byte[] b1, int off1, byte[] b2, int off2,
+ int len) {
+ for (int i = off1, j = off2, k = 0; k < len; i++, j++, k++) {
+ if (b1[i] != b2[j]) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/TextLength/DESCipherWrapper.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,172 @@
+/*
+ * 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 static java.lang.System.out;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.SecretKey;
+import javax.crypto.ShortBufferException;
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.IvParameterSpec;
+
+/**
+ * Wrapper class to test a given DES algorithm.
+ */
+public class DESCipherWrapper {
+
+ private final Cipher ci;
+ private final byte[] iv;
+ private final SecretKey key;
+ private final String algo;
+ private final String mode;
+ private final String pad;
+ private final int keyStrength;
+ private byte[] resultText = null;
+
+ public DESCipherWrapper(String algo, String mode, String pad)
+ throws NoSuchAlgorithmException, NoSuchPaddingException {
+ ci = Cipher.getInstance(algo + "/" + mode + "/" + pad);
+
+ iv = new byte[8];
+ for (int i = 0; i < 8; i++) {
+ iv[i] = (byte) (i & 0xff);
+ }
+
+ KeyGenerator kg = KeyGenerator.getInstance(algo);
+ key = kg.generateKey();
+ keyStrength = algo.equalsIgnoreCase("DESede") ? 112
+ : key.getEncoded().length * 8;
+
+ this.algo = algo;
+ this.mode = mode;
+ this.pad = pad;
+ }
+
+ public byte[] getResult() {
+ return resultText.clone();
+ }
+
+ public void execute(int edMode, byte[] inputText)
+ throws InvalidKeyException, InvalidAlgorithmParameterException,
+ IllegalBlockSizeException, BadPaddingException,
+ ShortBufferException, NoSuchAlgorithmException {
+ AlgorithmParameterSpec aps = null;
+
+ try {
+ if (!mode.equalsIgnoreCase("ECB")) {
+ aps = new IvParameterSpec(iv);
+ }
+ ci.init(edMode, key, aps);
+
+ // Generate a resultText using a single-part enc/dec
+ resultText = ci.doFinal(inputText);
+
+ // Generate outputText for each multi-part en/de-cryption
+ /* Combination #1:
+ update(byte[], int, int)
+ doFinal(byte[], int, int)
+ */
+ byte[] part11 = ci.update(inputText, 0, inputText.length);
+ byte[] part12 = ci.doFinal();
+ byte[] outputText1 = new byte[part11.length + part12.length];
+ System.arraycopy(part11, 0, outputText1, 0, part11.length);
+ System.arraycopy(part12, 0, outputText1, part11.length,
+ part12.length);
+
+ List<byte[]> outputTexts = new ArrayList<>(4);
+ outputTexts.add(outputText1);
+
+ /* Combination #2:
+ update(byte[], int, int)
+ doFinal(byte[], int, int, byte[], int)
+ */
+ byte[] part21 = ci.update(inputText, 0, inputText.length - 5);
+ byte[] part22 = new byte[ci.getOutputSize(inputText.length)];
+ int len2 = ci
+ .doFinal(inputText, inputText.length - 5, 5, part22, 0);
+ byte[] outputText2 = new byte[part21.length + len2];
+ System.arraycopy(part21, 0, outputText2, 0, part21.length);
+ System.arraycopy(part22, 0, outputText2, part21.length, len2);
+
+ outputTexts.add(outputText2);
+
+ /* Combination #3:
+ update(byte[], int, int, byte[], int)
+ doFinal(byte[], int, int)
+ */
+ byte[] part31 = new byte[ci.getOutputSize(inputText.length)];
+ int len3 = ci.update(inputText, 0, inputText.length - 8, part31, 0);
+ byte[] part32 = ci.doFinal(inputText, inputText.length - 8, 8);
+ byte[] outputText3 = new byte[len3 + part32.length];
+ System.arraycopy(part31, 0, outputText3, 0, len3);
+ System.arraycopy(part32, 0, outputText3, len3, part32.length);
+
+ outputTexts.add(outputText3);
+
+ /* Combination #4:
+ update(byte[], int, int, byte[], int)
+ doFinal(byte[], int, int, byte[], int)
+ */
+ byte[] part41 = new byte[ci.getOutputSize(inputText.length)];
+ int len4 = ci.update(inputText, 0, inputText.length - 8, part41, 0);
+ int rest4 = ci.doFinal(inputText, inputText.length - 8, 8, part41,
+ len4);
+ byte[] outputText4 = new byte[len4 + rest4];
+ System.arraycopy(part41, 0, outputText4, 0, outputText4.length);
+
+ outputTexts.add(outputText4);
+
+ // Compare results
+ for (int k = 0; k < outputTexts.size(); k++) {
+ if (!Arrays.equals(resultText, outputTexts.get(k))) {
+ out.println(" Testing: " + algo + "/" + mode + "/" + pad);
+ throw new RuntimeException(
+ "Compare value of resultText and combination " + k
+ + " are not same. Test failed.");
+ }
+ }
+ if (keyStrength > Cipher.getMaxAllowedKeyLength(algo)) {
+ throw new RuntimeException(
+ "Expected exception uncaught, keyStrength "
+ + keyStrength);
+ }
+ } catch (InvalidKeyException ex) {
+ if (keyStrength <= Cipher.getMaxAllowedKeyLength(algo)) {
+ out.println("Unexpected exception in " + algo + "/" + mode
+ + "/" + pad + " , KeySize " + keyStrength);
+ throw ex;
+ }
+ out.println("Caught InvalidKeyException as expected");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/TextLength/PBECipherWrapper.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,258 @@
+/*
+ * 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.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.InvalidParameterSpecException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.ShortBufferException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * PBECipherWrapper is the abstract class for all concrete PBE Cipher wrappers.
+ */
+public abstract class PBECipherWrapper {
+
+ public static final int ITERATION_COUNT = 1000;
+ private final String algorithm;
+ private final byte[] salt;
+ protected SecretKey key;
+ protected Cipher ci;
+ protected String baseAlgo;
+ protected byte[] resultText = null;
+ protected AlgorithmParameterSpec aps = null;
+
+ public PBECipherWrapper(String algorithm, int saltSize) {
+ this.algorithm = algorithm;
+ baseAlgo = algorithm.split("/")[0].toUpperCase();
+ salt = generateSalt(saltSize);
+ }
+
+ protected abstract void initCipher(int mode) throws InvalidKeyException,
+ InvalidAlgorithmParameterException, InvalidParameterSpecException;
+
+ public void execute(int edMode, byte[] inputText)
+ throws InvalidAlgorithmParameterException,
+ InvalidParameterSpecException, IllegalBlockSizeException,
+ BadPaddingException, ShortBufferException, InvalidKeyException {
+ // Initialize
+ initCipher(edMode);
+
+ // Generate a resultText using a single-part enc/dec
+ resultText = ci.doFinal(inputText);
+
+ // Generate outputText for each multi-part en/de-cryption
+ /* Combination #1:
+ update(byte[], int, int)
+ doFinal(byte[], int, int)
+ */
+ byte[] part11 = ci.update(inputText, 0, inputText.length);
+ byte[] part12 = ci.doFinal();
+ byte[] outputText1 = new byte[part11.length + part12.length];
+ System.arraycopy(part11, 0, outputText1, 0, part11.length);
+ System.arraycopy(part12, 0, outputText1, part11.length, part12.length);
+
+ List<byte[]> outputTexts = new ArrayList<>(4);
+ outputTexts.add(outputText1);
+
+ /* Combination #2:
+ update(byte[], int, int)
+ doFinal(byte[], int, int, byte[], int)
+ */
+ byte[] part21 = ci.update(inputText, 0, inputText.length - 5);
+ byte[] part22 = new byte[ci.getOutputSize(inputText.length)];
+ int len2 = ci.doFinal(inputText, inputText.length - 5, 5, part22, 0);
+ byte[] outputText2 = new byte[part21.length + len2];
+ System.arraycopy(part21, 0, outputText2, 0, part21.length);
+ System.arraycopy(part22, 0, outputText2, part21.length, len2);
+
+ outputTexts.add(outputText2);
+
+ /* Combination #3:
+ update(byte[], int, int, byte[], int)
+ doFinal(byte[], int, int)
+ */
+ byte[] part31 = new byte[ci.getOutputSize(inputText.length)];
+ int len3 = ci.update(inputText, 0, inputText.length - 8, part31, 0);
+ byte[] part32 = ci.doFinal(inputText, inputText.length - 8, 8);
+ byte[] outputText3 = new byte[len3 + part32.length];
+ System.arraycopy(part31, 0, outputText3, 0, len3);
+ System.arraycopy(part32, 0, outputText3, len3, part32.length);
+
+ outputTexts.add(outputText3);
+
+ /* Combination #4:
+ update(byte[], int, int, byte[], int)
+ doFinal(byte[], int, int, byte[], int)
+ */
+ byte[] part41 = new byte[ci.getOutputSize(inputText.length)];
+ int len4 = ci.update(inputText, 0, inputText.length - 8, part41, 0);
+ int rest4 = ci
+ .doFinal(inputText, inputText.length - 8, 8, part41, len4);
+ byte[] outputText4 = new byte[len4 + rest4];
+ System.arraycopy(part41, 0, outputText4, 0, outputText4.length);
+
+ outputTexts.add(outputText4);
+
+ // Compare results
+ for (int k = 0; k < outputTexts.size(); k++) {
+ if (!Arrays.equals(resultText, outputTexts.get(k))) {
+ throw new RuntimeException(
+ "Compare value of resultText and combination " + k
+ + " are not same. Test failed.");
+ }
+ }
+
+ }
+
+ public final byte[] generateSalt(int numberOfBytes) {
+ byte[] aSalt = new byte[numberOfBytes];
+ for (int i = 0; i < numberOfBytes; i++) {
+ aSalt[i] = (byte) (i & 0xff);
+ }
+ return aSalt;
+ }
+
+ public byte[] getResult() {
+ return resultText;
+ }
+
+ public String getAlgorithm() {
+ return algorithm;
+ }
+
+ public byte[] getSalt() {
+ return salt;
+ }
+
+ /**
+ * Wrapper class to test a given SecretKeyFactory.PBKDF2 algorithm.
+ */
+ public static class PBKDF2 extends PBECipherWrapper {
+
+ private static final int PBKDF2_SALT_SIZE = 64;
+ private static final int CIPHER_KEY_SIZE = 128;
+ private static final String CIPHER_TRANSFORMATION = "AES/CBC/PKCS5Padding";
+ private static final String KEY_ALGORITHM = "AES";
+ private byte[] iv = null;
+
+ public PBKDF2(String algo, String passwd)
+ throws InvalidKeySpecException, NoSuchAlgorithmException,
+ NoSuchPaddingException {
+ super(algo, PBKDF2_SALT_SIZE);
+
+ ci = Cipher.getInstance(CIPHER_TRANSFORMATION);
+
+ PBEKeySpec pbeKeySpec = new PBEKeySpec(passwd.toCharArray(), getSalt(),
+ ITERATION_COUNT, CIPHER_KEY_SIZE);
+ SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(algo);
+ key = keyFactory.generateSecret(pbeKeySpec);
+ }
+
+ @Override
+ protected void initCipher(int mode) throws InvalidKeyException,
+ InvalidAlgorithmParameterException, InvalidParameterSpecException {
+ if (Cipher.ENCRYPT_MODE == mode) {
+ ci.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getEncoded(),
+ KEY_ALGORITHM));
+ iv = ci.getParameters().getParameterSpec(IvParameterSpec.class)
+ .getIV();
+ } else {
+ ci.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key.getEncoded(),
+ KEY_ALGORITHM), new IvParameterSpec(iv));
+ }
+ }
+ }
+
+ /**
+ * Wrapper class to test a given AES-based PBE algorithm.
+ */
+ public static class AES extends PBECipherWrapper {
+
+ private AlgorithmParameters pbeParams;
+
+ public AES(String algo, String passwd)
+ throws NoSuchAlgorithmException, NoSuchPaddingException,
+ InvalidKeySpecException {
+ super(algo, 0);
+
+ ci = Cipher.getInstance(algo);
+
+ SecretKeyFactory skf = SecretKeyFactory.getInstance(algo);
+ key = skf.generateSecret(new PBEKeySpec(passwd.toCharArray()));
+ }
+
+ @Override
+ protected void initCipher(int mode) throws InvalidKeyException,
+ InvalidAlgorithmParameterException, InvalidParameterSpecException {
+ if (Cipher.ENCRYPT_MODE == mode) {
+ ci.init(Cipher.ENCRYPT_MODE, key);
+ pbeParams = ci.getParameters();
+ } else {
+ ci.init(Cipher.DECRYPT_MODE, key, pbeParams);
+ }
+ }
+ }
+
+ /**
+ * Wrapper class to test a given PBE algorithm.
+ */
+ public static class Legacy extends PBECipherWrapper {
+
+ private static final int PBE_SALT_SIZE = 8;
+
+ public Legacy(String algo, String passwd)
+ throws NoSuchAlgorithmException, NoSuchPaddingException,
+ InvalidKeySpecException {
+ super(algo, PBE_SALT_SIZE);
+
+ SecretKeyFactory skf = SecretKeyFactory.getInstance(algo.split("/")[0]);
+ key = skf.generateSecret(new PBEKeySpec(passwd.toCharArray()));
+
+ aps = new PBEParameterSpec(getSalt(), ITERATION_COUNT);
+
+ ci = Cipher.getInstance(algo);
+ }
+
+ @Override
+ protected void initCipher(int mode) throws InvalidKeyException,
+ InvalidAlgorithmParameterException, InvalidParameterSpecException {
+ ci.init(mode, key, aps);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/TextLength/TestCipherTextLength.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,136 @@
+/*
+ * 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 static java.lang.System.out;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.util.Arrays;
+import javax.crypto.Cipher;
+import javax.crypto.NoSuchPaddingException;
+
+/*
+ * @test
+ * @bug 8048601
+ * @summary Performs multiple-part encryption/decryption depending on the
+ * specified encryption mode and check if the results obtained by
+ * different ways are the same.
+ */
+public class TestCipherTextLength {
+
+ /* Algorithms tested by DESCipherWrapper */
+ private static final String[] DES_ALGORITHMS = {"DES", "DESede",
+ "Blowfish"};
+ private static final String[] DES_MODES = {"ECB", "CBC", "PCBC"};
+ private static final String[] DES_PADDING = {"PKCS5Padding"};
+
+ /* Algorithms tested by PBECipherWrapper */
+ private static final String[] PBE_ALGORITHMS = {"PBEWithMD5AndDES",
+ "PBEWithMD5AndDES/CBC/PKCS5Padding", "PBEWithMD5ANDTripleDES",
+ "PBEWithMD5AndTripleDES/CBC/PKCS5Padding", "PBEwithSHA1AndDESede",
+ "PBEwithSHA1AndDESede/CBC/PKCS5Padding", "PBEwithSHA1AndRC2_40",
+ "PBEwithSHA1Andrc2_40/CBC/PKCS5Padding", "PBEWithSHA1AndRC2_128",
+ "PBEWithSHA1andRC2_128/CBC/PKCS5Padding", "PBEWithSHA1AndRC4_40",
+ "PBEWithsha1AndRC4_40/ECB/NoPadding", "PBEWithSHA1AndRC4_128",
+ "PBEWithSHA1AndRC4_128/ECB/NoPadding", "PBEWithHmacSHA1AndAES_128",
+ "PBEWithHmacSHA224AndAES_128", "PBEWithHmacSHA256AndAES_128",
+ "PBEWithHmacSHA384AndAES_128", "PBEWithHmacSHA512AndAES_128",
+ "PBEWithHmacSHA1AndAES_256", "PBEWithHmacSHA224AndAES_256",
+ "PBEWithHmacSHA256AndAES_256", "PBEWithHmacSHA384AndAES_256",
+ "PBEWithHmacSHA512AndAES_256", "PBKDF2WithHmacSHA1",
+ "PBKDF2WithHmacSHA224", "PBKDF2WithHmacSHA256",
+ "PBKDF2WithHmacSHA384", "PBKDF2WithHmacSHA512"};
+ private static final String PBE_PASSWORD = "Hush, it's a secret!!";
+
+ // Algorithm tested by PBKDF2Wrappter
+ private static final String PBKDF2 = "PBKDF2";
+
+ // Algorithm tested by AESPBEWrapper
+ private static final String AES = "AES";
+
+ public static void main(String[] args) throws Exception {
+ byte[] plainText = new byte[64];
+ for (int i = 0; i < 64; i++) {
+ plainText[i] = (byte) (i & 0xff);
+ }
+
+ new TestCipherTextLength().runAll(plainText);
+ }
+
+ public void runAll(byte[] plainText) throws Exception {
+
+ // Testing DES/Blowfish Cipher
+ for (String algorithm : DES_ALGORITHMS) {
+ for (String desMode : DES_MODES) {
+ for (String padding : DES_PADDING) {
+ out.println("=>Testing: " + algorithm + "/" + desMode
+ + "/" + padding);
+ DESCipherWrapper desCi = new DESCipherWrapper(algorithm,
+ desMode, padding);
+ desCi.execute(Cipher.ENCRYPT_MODE, plainText);
+ desCi.execute(Cipher.DECRYPT_MODE, desCi.getResult());
+ if (!Arrays.equals(plainText, desCi.getResult())) {
+ throw new RuntimeException(
+ "Plain and recovered texts are not same for:"
+ + algorithm + "/" + desMode + "/"
+ + padding);
+ }
+ }
+ }
+ }
+
+ // Testing PBE Cipher
+ for (String algorithm : PBE_ALGORITHMS) {
+ int maxKeyLen = Cipher.getMaxAllowedKeyLength(algorithm);
+ boolean isUnlimited = maxKeyLen == Integer.MAX_VALUE;
+ if (!isUnlimited
+ && (algorithm.contains("TripleDES") || algorithm
+ .contains("AES_256"))) {
+ out.println("Test " + algorithm + " will be ignored");
+ continue;
+ }
+
+ out.println("=>Testing: " + algorithm);
+ PBECipherWrapper pbeCi = createWrapper(algorithm, PBE_PASSWORD);
+ pbeCi.execute(Cipher.ENCRYPT_MODE, plainText);
+ pbeCi.execute(Cipher.DECRYPT_MODE, pbeCi.getResult());
+ if (!Arrays.equals(plainText, pbeCi.getResult())) {
+ throw new RuntimeException(
+ "Plain and recovered texts are not same for:"
+ + algorithm);
+ }
+ }
+ }
+
+ private PBECipherWrapper createWrapper(String algo, String passwd)
+ throws InvalidKeySpecException, NoSuchAlgorithmException,
+ NoSuchPaddingException {
+ if (algo.contains(PBKDF2)) {
+ return new PBECipherWrapper.PBKDF2(algo, passwd);
+ } else if (algo.contains(AES)) {
+ return new PBECipherWrapper.AES(algo, passwd);
+ } else {
+ return new PBECipherWrapper.Legacy(algo, passwd);
+ }
+ }
+}
--- a/jdk/test/java/lang/SecurityManager/RestrictedPackages.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/test/java/lang/SecurityManager/RestrictedPackages.java Mon Aug 31 11:26:11 2015 -0700
@@ -77,7 +77,8 @@
"jdk.nashorn.internal.",
"jdk.nashorn.tools.",
"jdk.tools.jimage.",
- "com.sun.activation.registries."
+ "com.sun.activation.registries.",
+ "com.sun.java.accessibility.util.internal."
};
/*
@@ -126,6 +127,9 @@
if (OS_NAME.contains("OS X")) {
pkgs.add("apple."); // add apple package for OS X
}
+ if (OS_NAME.contains("Win")) {
+ pkgs.add("com.sun.java.accessibility.internal."); // add Win only package
+ }
return pkgs;
}
--- a/jdk/test/java/nio/file/Files/probeContentType/ParallelProbes.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/test/java/nio/file/Files/probeContentType/ParallelProbes.java Mon Aug 31 11:26:11 2015 -0700
@@ -21,17 +21,18 @@
* questions.
*/
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-
/* @test
* @summary Test probing content type simultaneously from multiple threads.
* @requires (os.family == "linux") | (os.family == "solaris")
* @build ParallelProbes SimpleFileTypeDetector
* @run main/othervm ParallelProbes 10
*/
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+
public class ParallelProbes {
private static final int REPEATS = 1000;
--- a/jdk/test/javax/sound/midi/Devices/InitializationHang.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/test/javax/sound/midi/Devices/InitializationHang.java Mon Aug 31 11:26:11 2015 -0700
@@ -28,6 +28,7 @@
/**
* @test
* @bug 8068412
+ * @key headful
* @author Sergey Bylokhov
*/
public final class InitializationHang {
--- a/jdk/test/jdk/nio/zipfs/ZipFSTester.java Thu Aug 27 14:40:21 2015 -0700
+++ b/jdk/test/jdk/nio/zipfs/ZipFSTester.java Mon Aug 31 11:26:11 2015 -0700
@@ -26,6 +26,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
+import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.SeekableByteChannel;
@@ -69,6 +70,7 @@
* @test
* @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596
* 7157656 8002390 7012868 7012856 8015728 8038500 8040059 8069211
+ * 8131067
* @summary Test Zip filesystem provider
* @run main ZipFSTester
* @run main/othervm/java.security.policy=test.policy ZipFSTester
@@ -91,6 +93,7 @@
}
testTime(jarFile);
test8069211();
+ test8131067();
}
static void test0(FileSystem fs)
@@ -441,11 +444,34 @@
}
}
+ static void test8131067() throws Exception {
+ Map<String, Object> env = new HashMap<String, Object>();
+ env.put("create", "true");
+
+ // file name with space character for URI to quote it
+ File tmp = File.createTempFile("test zipfs", "zip");
+ tmp.delete(); // we need a clean path, no file
+ Path fsPath = tmp.toPath();
+ try (FileSystem fs = newZipFileSystem(fsPath, env);) {
+ Files.write(fs.getPath("/foo"), "hello".getBytes());
+ URI fooUri = fs.getPath("/foo").toUri();
+ if (!Arrays.equals(Files.readAllBytes(Paths.get(fooUri)),
+ "hello".getBytes())) {
+ throw new RuntimeException("entry close() failed");
+ }
+ } finally {
+ Files.delete(fsPath);
+ }
+ }
+
private static FileSystem newZipFileSystem(Path path, Map<String, ?> env)
throws Exception
{
+ // Use URLDecoder (for test only) to remove the double escaped space
+ // character
return FileSystems.newFileSystem(
- new URI("jar", path.toUri().toString(), null), env, null);
+ new URI("jar", URLDecoder.decode(path.toUri().toString(), "utf8"),
+ null), env, null);
}
private static Path getTempPath() throws IOException
--- a/langtools/.hgtags Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/.hgtags Mon Aug 31 11:26:11 2015 -0700
@@ -321,3 +321,4 @@
80ab772222fb6b85f8174bf97261178ee4026620 jdk9-b76
6ec3d5cb1bfcfba135c8d18866e567f1b1ada861 jdk9-b77
7fd155b7041c8aba7084f03e2fd1d6f74cceda75 jdk9-b78
+eaab8a16dcfb807acacdb6d133f3ecd502667a8c jdk9-b79
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Mon Aug 31 11:26:11 2015 -0700
@@ -138,7 +138,7 @@
/** The bootstrap methods to be written in the corresponding class attribute
* (one for each invokedynamic)
*/
- Map<DynamicMethod, MethodHandle> bootstrapMethods;
+ Map<DynamicMethod.BootstrapMethodsKey, DynamicMethod.BootstrapMethodsValue> bootstrapMethods;
/** The log to use for verbose output.
*/
@@ -401,8 +401,16 @@
//invokedynamic
DynamicMethodSymbol dynSym = (DynamicMethodSymbol)m;
MethodHandle handle = new MethodHandle(dynSym.bsmKind, dynSym.bsm, types);
- DynamicMethod dynMeth = new DynamicMethod(dynSym, types);
- bootstrapMethods.put(dynMeth, handle);
+ DynamicMethod.BootstrapMethodsKey key = new DynamicMethod.BootstrapMethodsKey(dynSym, types);
+
+ // Figure out the index for existing BSM; create a new BSM if no key
+ DynamicMethod.BootstrapMethodsValue val = bootstrapMethods.get(key);
+ if (val == null) {
+ int index = bootstrapMethods.size();
+ val = new DynamicMethod.BootstrapMethodsValue(handle, index);
+ bootstrapMethods.put(key, val);
+ }
+
//init cp entries
pool.put(names.BootstrapMethods);
pool.put(handle);
@@ -410,7 +418,7 @@
pool.put(staticArg);
}
poolbuf.appendByte(CONSTANT_InvokeDynamic);
- poolbuf.appendChar(bootstrapMethods.size() - 1);
+ poolbuf.appendChar(val.index);
poolbuf.appendChar(pool.put(nameType(dynSym)));
}
} else if (value instanceof VarSymbol) {
@@ -1024,15 +1032,14 @@
void writeBootstrapMethods() {
int alenIdx = writeAttr(names.BootstrapMethods);
databuf.appendChar(bootstrapMethods.size());
- for (Map.Entry<DynamicMethod, MethodHandle> entry : bootstrapMethods.entrySet()) {
- DynamicMethod dmeth = entry.getKey();
- DynamicMethodSymbol dsym = (DynamicMethodSymbol)dmeth.baseSymbol();
+ for (Map.Entry<DynamicMethod.BootstrapMethodsKey, DynamicMethod.BootstrapMethodsValue> entry : bootstrapMethods.entrySet()) {
+ DynamicMethod.BootstrapMethodsKey bsmKey = entry.getKey();
//write BSM handle
- databuf.appendChar(pool.get(entry.getValue()));
+ databuf.appendChar(pool.get(entry.getValue().mh));
+ Object[] uniqueArgs = bsmKey.getUniqueArgs();
//write static args length
- databuf.appendChar(dsym.staticArgs.length);
+ databuf.appendChar(uniqueArgs.length);
//write static args array
- Object[] uniqueArgs = dmeth.uniqueStaticArgs;
for (Object o : uniqueArgs) {
databuf.appendChar(pool.get(o));
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java Mon Aug 31 11:26:11 2015 -0700
@@ -190,7 +190,11 @@
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public boolean equals(Object any) {
- if (!super.equals(any)) return false;
+ return equalsImpl(any, true);
+ }
+
+ protected boolean equalsImpl(Object any, boolean includeDynamicArgs) {
+ if (includeDynamicArgs && !super.equals(any)) return false;
if (!(any instanceof DynamicMethod)) return false;
DynamicMethodSymbol dm1 = (DynamicMethodSymbol)other;
DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)any).other;
@@ -202,7 +206,11 @@
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public int hashCode() {
- int hash = super.hashCode();
+ return hashCodeImpl(true);
+ }
+
+ protected int hashCodeImpl(boolean includeDynamicArgs) {
+ int hash = includeDynamicArgs ? super.hashCode() : 0;
DynamicMethodSymbol dm = (DynamicMethodSymbol)other;
hash += dm.bsmKind * 7 +
dm.bsm.hashCode() * 11;
@@ -223,6 +231,36 @@
}
return result;
}
+
+ static class BootstrapMethodsKey extends DynamicMethod {
+ BootstrapMethodsKey(DynamicMethodSymbol m, Types types) {
+ super(m, types);
+ }
+
+ @Override @DefinedBy(Api.LANGUAGE_MODEL)
+ public boolean equals(Object any) {
+ return equalsImpl(any, false);
+ }
+
+ @Override @DefinedBy(Api.LANGUAGE_MODEL)
+ public int hashCode() {
+ return hashCodeImpl(false);
+ }
+
+ Object[] getUniqueArgs() {
+ return uniqueStaticArgs;
+ }
+ }
+
+ static class BootstrapMethodsValue {
+ final MethodHandle mh;
+ final int index;
+
+ public BootstrapMethodsValue(MethodHandle mh, int index) {
+ this.mh = mh;
+ this.index = index;
+ }
+ }
}
static class Variable extends DelegatedSymbol<VarSymbol> {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CleanProperties.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CleanProperties.java Mon Aug 31 11:26:11 2015 -0700
@@ -42,9 +42,9 @@
import java.util.Properties;
import java.util.Set;
+import com.sun.tools.sjavac.comp.CompilationService;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.pubapi.PubApi;
-import com.sun.tools.sjavac.server.Sjavac;
/**
* The clean properties transform should not be necessary.
@@ -64,7 +64,7 @@
// Any extra information is ignored for clean properties.
}
- public boolean transform(Sjavac sjavac,
+ public boolean transform(CompilationService sjavac,
Map<String,Set<URI>> pkgSrcs,
Set<URI> visibleSrcs,
Map<URI,Set<String>> visibleClasses,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Mon Aug 31 11:26:11 2015 -0700
@@ -32,12 +32,13 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.Random;
import java.util.Set;
+import com.sun.tools.sjavac.comp.CompilationService;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.pubapi.PubApi;
-import com.sun.tools.sjavac.server.CompilationResult;
-import com.sun.tools.sjavac.server.Sjavac;
+import com.sun.tools.sjavac.server.CompilationSubResult;
import com.sun.tools.sjavac.server.SysInfo;
/**
@@ -68,7 +69,7 @@
args = a;
}
- public boolean transform(final Sjavac sjavac,
+ public boolean transform(final CompilationService sjavac,
Map<String,Set<URI>> pkgSrcs,
final Set<URI> visibleSources,
final Map<URI,Set<String>> visibleClasses,
@@ -91,16 +92,11 @@
boolean concurrentCompiles = true;
// Fetch the id.
- final String id = Util.extractStringOption("id", sjavac.serverSettings());
+ final String id = String.valueOf(new Random().nextInt());
// Only keep portfile and sjavac settings..
//String psServerSettings = Util.cleanSubOptions(Util.set("portfile","sjavac","background","keepalive"), sjavac.serverSettings());
- // Get maximum heap size from the server!
SysInfo sysinfo = sjavac.getSysInfo();
- if (sysinfo == null) {
- Log.error("Could not query server for sysinfo!");
- return false;
- }
int numMBytes = (int)(sysinfo.maxMemory / ((long)(1024*1024)));
Log.debug("Server reports "+numMBytes+"MiB of memory and "+sysinfo.numCores+" cores");
@@ -205,7 +201,7 @@
}
// The return values for each chunked compile.
- final CompilationResult[] rn = new CompilationResult[numCompiles];
+ final CompilationSubResult[] rn = new CompilationSubResult[numCompiles];
// The requets, might or might not run as a background thread.
final Thread[] requests = new Thread[numCompiles];
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileProperties.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileProperties.java Mon Aug 31 11:26:11 2015 -0700
@@ -44,9 +44,9 @@
import java.util.Properties;
import java.util.Set;
+import com.sun.tools.sjavac.comp.CompilationService;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.pubapi.PubApi;
-import com.sun.tools.sjavac.server.Sjavac;
/**
* Compile properties transform a properties file into a Java source file.
@@ -71,7 +71,7 @@
public void setExtra(Options a) {
}
- public boolean transform(Sjavac sjavac,
+ public boolean transform(CompilationService compilationService,
Map<String,Set<URI>> pkgSrcs,
Set<URI> visibleSrcs,
Map<URI,Set<String>> visibleClasses,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CopyFile.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CopyFile.java Mon Aug 31 11:26:11 2015 -0700
@@ -37,9 +37,9 @@
import java.util.Map;
import java.util.Set;
+import com.sun.tools.sjavac.comp.CompilationService;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.pubapi.PubApi;
-import com.sun.tools.sjavac.server.Sjavac;
/**
* The copy file transform simply copies a matching file from -src to -d .
@@ -58,7 +58,7 @@
public void setExtra(Options a) {
}
- public boolean transform(Sjavac sjavac,
+ public boolean transform(CompilationService compilationService,
Map<String,Set<URI>> pkgSrcs,
Set<URI> visibleSrcs,
Map<URI,Set<String>> visibleClasses,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java Mon Aug 31 11:26:11 2015 -0700
@@ -45,9 +45,9 @@
import java.util.Set;
import java.util.stream.Collectors;
+import com.sun.tools.sjavac.comp.CompilationService;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.pubapi.PubApi;
-import com.sun.tools.sjavac.server.Sjavac;
/**
* The javac state class maintains the previous (prev) and the current (now)
@@ -748,7 +748,7 @@
/**
* Compile all the java sources. Return true, if it needs to be called again!
*/
- public boolean performJavaCompilations(Sjavac sjavac,
+ public boolean performJavaCompilations(CompilationService sjavac,
Options args,
Set<String> recentlyCompiled,
boolean[] rcValue) {
@@ -790,7 +790,7 @@
* For all packages, find all sources belonging to the package, group the sources
* based on their transformers and apply the transformers on each source code group.
*/
- private boolean perform(Sjavac sjavac,
+ private boolean perform(CompilationService sjavac,
File outputDir,
Map<String,Transformer> suffixRules) {
boolean rc = true;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Transformer.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Transformer.java Mon Aug 31 11:26:11 2015 -0700
@@ -30,9 +30,9 @@
import java.util.Map;
import java.util.Set;
+import com.sun.tools.sjavac.comp.CompilationService;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.pubapi.PubApi;
-import com.sun.tools.sjavac.server.Sjavac;
/**
* The transform interface is used to transform content inside a package, from one form to another.
@@ -83,7 +83,7 @@
* If num_cores is set to a non-zero value. The transform should attempt to use no more than these
* number of threads for heavy work.
*/
- boolean transform(Sjavac sjavac,
+ boolean transform(CompilationService sjavac,
Map<String,Set<URI>> pkgSrcs,
Set<URI> visibleSources,
Map<URI,Set<String>> visibleClasses,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java Mon Aug 31 11:26:11 2015 -0700
@@ -25,29 +25,13 @@
package com.sun.tools.sjavac.client;
-import java.io.IOException;
import java.io.PrintStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import com.sun.tools.sjavac.JavacState;
import com.sun.tools.sjavac.Log;
-import com.sun.tools.sjavac.Module;
-import com.sun.tools.sjavac.ProblemException;
-import com.sun.tools.sjavac.Source;
-import com.sun.tools.sjavac.Transformer;
import com.sun.tools.sjavac.Util;
-import com.sun.tools.sjavac.comp.PooledSjavac;
import com.sun.tools.sjavac.comp.SjavacImpl;
import com.sun.tools.sjavac.options.Options;
-import com.sun.tools.sjavac.options.SourceLocation;
+import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
/**
@@ -74,282 +58,34 @@
return -1;
}
- Log.setLogLevel(options.getLogLevel());
-
- if (!validateOptions(options))
- return -1;
-
- if (!createIfMissing(options.getDestDir()))
- return -1;
-
- if (!createIfMissing(options.getStateDir()))
- return -1;
-
- Path gensrc = options.getGenSrcDir();
- if (gensrc != null && !createIfMissing(gensrc))
- return -1;
-
- Path hdrdir = options.getHeaderDir();
- if (hdrdir != null && !createIfMissing(hdrdir))
- return -1;
-
Log.debug("==========================================================");
Log.debug("Launching sjavac client with the following parameters:");
Log.debug(" " + options.getStateArgsString());
Log.debug("==========================================================");
- // Load the prev build state database.
- JavacState javac_state = JavacState.load(options, out, err);
-
- // Setup the suffix rules from the command line.
- Map<String, Transformer> suffixRules = new HashMap<>();
-
- // Handling of .java-compilation
- suffixRules.putAll(javac_state.getJavaSuffixRule());
-
- // Handling of -copy and -tr
- suffixRules.putAll(options.getTranslationRules());
-
- // All found modules are put here.
- Map<String,Module> modules = new HashMap<>();
- // We start out in the legacy empty no-name module.
- // As soon as we stumble on a module-info.java file we change to that module.
- Module current_module = new Module("", "");
- modules.put("", current_module);
-
- // Find all sources, use the suffix rules to know which files are sources.
- Map<String,Source> sources = new HashMap<>();
-
- // Find the files, this will automatically populate the found modules
- // with found packages where the sources are found!
- findSourceFiles(options.getSources(),
- suffixRules.keySet(),
- sources,
- modules,
- current_module,
- options.isDefaultPackagePermitted(),
- false);
-
- if (sources.isEmpty()) {
- Log.error("Found nothing to compile!");
- return -1;
+ // Prepare sjavac object
+ boolean background = Util.extractBooleanOption("background", options.getServerConf(), true);
+ Sjavac sjavac;
+ // Create an sjavac implementation to be used for compilation
+ if (background) {
+ try {
+ sjavac = new SjavacClient(options);
+ } catch (PortFileInaccessibleException e) {
+ Log.error("Port file inaccessible.");
+ return -1;
+ }
+ } else {
+ sjavac = new SjavacImpl();
}
- // Create a map of all source files that are available for linking. Both -src and
- // -sourcepath point to such files. It is possible to specify multiple
- // -sourcepath options to enable different filtering rules. If the
- // filters are the same for multiple sourcepaths, they may be concatenated
- // using :(;). Before sending the list of sourcepaths to javac, they are
- // all concatenated. The list created here is used by the SmartFileWrapper to
- // make sure only the correct sources are actually available.
- // We might find more modules here as well.
- Map<String,Source> sources_to_link_to = new HashMap<>();
-
- List<SourceLocation> sourceResolutionLocations = new ArrayList<>();
- sourceResolutionLocations.addAll(options.getSources());
- sourceResolutionLocations.addAll(options.getSourceSearchPaths());
- findSourceFiles(sourceResolutionLocations,
- Collections.singleton(".java"),
- sources_to_link_to,
- modules,
- current_module,
- options.isDefaultPackagePermitted(),
- true);
-
- // Find all class files allowable for linking.
- // And pickup knowledge of all modules found here.
- // This cannot currently filter classes inside jar files.
-// Map<String,Source> classes_to_link_to = new HashMap<String,Source>();
-// findFiles(args, "-classpath", Util.set(".class"), classes_to_link_to, modules, current_module, true);
-
- // Find all module sources allowable for linking.
-// Map<String,Source> modules_to_link_to = new HashMap<String,Source>();
-// findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true);
-
- // Add the set of sources to the build database.
- javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
- javac_state.now().checkInternalState("checking sources", false, sources);
- javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
- javac_state.setVisibleSources(sources_to_link_to);
-
- int round = 0;
- printRound(round);
-
- // If there is any change in the source files, taint packages
- // and mark the database in need of saving.
- javac_state.checkSourceStatus(false);
-
- // Find all existing artifacts. Their timestamp will match the last modified timestamps stored
- // in javac_state, simply because loading of the JavacState will clean out all artifacts
- // that do not match the javac_state database.
- javac_state.findAllArtifacts();
+ CompilationResult cr = sjavac.compile(args);
- // Remove unidentified artifacts from the bin, gensrc and header dirs.
- // (Unless we allow them to be there.)
- // I.e. artifacts that are not known according to the build database (javac_state).
- // For examples, files that have been manually copied into these dirs.
- // Artifacts with bad timestamps (ie the on disk timestamp does not match the timestamp
- // in javac_state) have already been removed when the javac_state was loaded.
- if (!options.areUnidentifiedArtifactsPermitted()) {
- javac_state.removeUnidentifiedArtifacts();
- }
- // Go through all sources and taint all packages that miss artifacts.
- javac_state.taintPackagesThatMissArtifacts();
-
- // Check recorded classpath public apis. Taint packages that depend on
- // classpath classes whose public apis have changed.
- javac_state.taintPackagesDependingOnChangedClasspathPackages();
-
- // Now clean out all known artifacts belonging to tainted packages.
- javac_state.deleteClassArtifactsInTaintedPackages();
- // Copy files, for example property files, images files, xml files etc etc.
- javac_state.performCopying(Util.pathToFile(options.getDestDir()), suffixRules);
- // Translate files, for example compile properties or compile idls.
- javac_state.performTranslation(Util.pathToFile(gensrc), suffixRules);
- // Add any potentially generated java sources to the tobe compiled list.
- // (Generated sources must always have a package.)
- Map<String,Source> generated_sources = new HashMap<>();
-
- try {
-
- Source.scanRoot(Util.pathToFile(options.getGenSrcDir()), Util.set(".java"), null, null, null, null,
- generated_sources, modules, current_module, false, true, false);
- javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
- // Recheck the the source files and their timestamps again.
- javac_state.checkSourceStatus(true);
-
- // Now do a safety check that the list of source files is identical
- // to the list Make believes we are compiling. If we do not get this
- // right, then incremental builds will fail with subtility.
- // If any difference is detected, then we will fail hard here.
- // This is an important safety net.
- javac_state.compareWithMakefileList(Util.pathToFile(options.getSourceReferenceList()));
-
- // Do the compilations, repeatedly until no tainted packages exist.
- boolean again;
- // Collect the name of all compiled packages.
- Set<String> recently_compiled = new HashSet<>();
- boolean[] rc = new boolean[1];
- boolean background = Util.extractBooleanOption("background", options.getServerConf(), true);
- Sjavac sjavac;
- // Create an sjavac implementation to be used for compilation
- if (background) {
- sjavac = new SjavacClient(options);
- } else {
- int poolsize = Util.extractIntOption("poolsize", options.getServerConf());
- if (poolsize <= 0)
- poolsize = Runtime.getRuntime().availableProcessors();
- sjavac = new PooledSjavac(new SjavacImpl(), poolsize);
- }
+ out.print(cr.stdout);
+ err.print(cr.stderr);
- do {
- if (round > 0)
- printRound(round);
- // Clean out artifacts in tainted packages.
- javac_state.deleteClassArtifactsInTaintedPackages();
- again = javac_state.performJavaCompilations(sjavac, options, recently_compiled, rc);
- if (!rc[0]) {
- Log.debug("Compilation failed.");
- break;
- }
- if (!again) {
- Log.debug("Nothing left to do.");
- }
- round++;
- } while (again);
- Log.debug("No need to do another round.");
-
- // Only update the state if the compile went well.
- if (rc[0]) {
- javac_state.save();
- // Reflatten only the artifacts.
- javac_state.now().flattenArtifacts(modules);
- // Remove artifacts that were generated during the last compile, but not this one.
- javac_state.removeSuperfluousArtifacts(recently_compiled);
- }
- if (!background)
- sjavac.shutdown();
-
- return rc[0] ? 0 : -1;
- } catch (ProblemException e) {
- Log.error(e.getMessage());
- return -1;
- } catch (Exception e) {
- e.printStackTrace(err);
- return -1;
- }
- }
-
- private static boolean validateOptions(Options options) {
-
- String err = null;
+ if (!background)
+ sjavac.shutdown();
- if (options.getDestDir() == null) {
- err = "Please specify output directory.";
- } else if (options.isJavaFilesAmongJavacArgs()) {
- err = "Sjavac does not handle explicit compilation of single .java files.";
- } else if (options.getServerConf() == null) {
- err = "No server configuration provided.";
- } else if (!options.getImplicitPolicy().equals("none")) {
- err = "The only allowed setting for sjavac is -implicit:none";
- } else if (options.getSources().isEmpty()) {
- err = "You have to specify -src.";
- } else if (options.getTranslationRules().size() > 1
- && options.getGenSrcDir() == null) {
- err = "You have translators but no gensrc dir (-s) specified!";
- }
-
- if (err != null)
- Log.error(err);
-
- return err == null;
-
+ return cr.returnCode;
}
-
- private static boolean createIfMissing(Path dir) {
-
- if (Files.isDirectory(dir))
- return true;
-
- if (Files.exists(dir)) {
- Log.error(dir + " is not a directory.");
- return false;
- }
-
- try {
- Files.createDirectories(dir);
- } catch (IOException e) {
- Log.error("Could not create directory: " + e.getMessage());
- return false;
- }
-
- return true;
- }
-
-
- /** Find source files in the given source locations. */
- public static void findSourceFiles(List<SourceLocation> sourceLocations,
- Set<String> sourceTypes,
- Map<String,Source> foundFiles,
- Map<String, Module> foundModules,
- Module currentModule,
- boolean permitSourcesInDefaultPackage,
- boolean inLinksrc) {
-
- for (SourceLocation source : sourceLocations) {
- source.findSourceFiles(sourceTypes,
- foundFiles,
- foundModules,
- currentModule,
- permitSourcesInDefaultPackage,
- inLinksrc);
- }
- }
-
- private static void printRound(int round) {
- Log.debug("****************************************");
- Log.debug("* Round " + round + " *");
- Log.debug("****************************************");
- }
-
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/PortFileInaccessibleException.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,36 @@
+/*
+ * 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 com.sun.tools.sjavac.client;
+
+import java.io.IOException;
+
+public class PortFileInaccessibleException extends IOException {
+
+ private static final long serialVersionUID = -4755261881545398973L;
+
+ public PortFileInaccessibleException(Throwable cause) {
+ super(cause);
+ }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java Mon Aug 31 11:26:11 2015 -0700
@@ -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,32 +26,27 @@
package com.sun.tools.sjavac.client;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
-import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
-import java.util.Set;
import com.sun.tools.sjavac.Log;
import com.sun.tools.sjavac.Util;
import com.sun.tools.sjavac.options.OptionHelper;
import com.sun.tools.sjavac.options.Options;
+import com.sun.tools.sjavac.server.CompilationSubResult;
import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.PortFile;
import com.sun.tools.sjavac.server.Sjavac;
import com.sun.tools.sjavac.server.SjavacServer;
-import com.sun.tools.sjavac.server.SysInfo;
/**
* Sjavac implementation that delegates requests to a SjavacServer.
@@ -89,9 +84,7 @@
// Store the server conf settings here.
private final String settings;
- // This constructor should not throw FileNotFoundException (to be resolved
- // in JDK-8060030)
- public SjavacClient(Options options) throws FileNotFoundException {
+ public SjavacClient(Options options) throws PortFileInaccessibleException {
String tmpServerConf = options.getServerConf();
String serverConf = (tmpServerConf!=null)? tmpServerConf : "";
String tmpId = Util.extractStringOption("id", serverConf);
@@ -103,8 +96,7 @@
String portfileName = Util.extractStringOption("portfile", serverConf, defaultPortfile);
try {
portFile = SjavacServer.getPortFile(portfileName);
- } catch (FileNotFoundException e) {
- // Reached for instance if directory of port file does not exist
+ } catch (PortFileInaccessibleException e) {
Log.error("Port file inaccessable: " + e);
throw e;
}
@@ -126,40 +118,8 @@
return settings;
}
- /**
- * Make a request to the server only to get the maximum possible heap size to use for compilations.
- */
@Override
- public SysInfo getSysInfo() {
- try (Socket socket = tryConnect()) {
- // The ObjectInputStream constructor will block until the
- // corresponding ObjectOutputStream has written and flushed the
- // header, so it is important that the ObjectOutputStreams on server
- // and client are opened before the ObjectInputStreams.
- ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
- ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
- oos.writeObject(id);
- oos.writeObject(SjavacServer.CMD_SYS_INFO);
- oos.flush();
- return (SysInfo) ois.readObject();
- } catch (IOException | ClassNotFoundException ex) {
- Log.error("[CLIENT] Exception caught: " + ex);
- Log.debug(Util.getStackTrace(ex));
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt(); // Restore interrupt
- Log.error("[CLIENT] getSysInfo interrupted.");
- Log.debug(Util.getStackTrace(ie));
- }
- return null;
- }
-
- @Override
- public CompilationResult compile(String protocolId,
- String invocationId,
- String[] args,
- List<File> explicitSources,
- Set<URI> sourcesToCompile,
- Set<URI> visibleSources) {
+ public CompilationResult compile(String[] args) {
CompilationResult result;
try (Socket socket = tryConnect()) {
// The ObjectInputStream constructor will block until the
@@ -170,22 +130,17 @@
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
oos.writeObject(id);
oos.writeObject(SjavacServer.CMD_COMPILE);
- oos.writeObject(protocolId);
- oos.writeObject(invocationId);
oos.writeObject(args);
- oos.writeObject(explicitSources);
- oos.writeObject(sourcesToCompile);
- oos.writeObject(visibleSources);
oos.flush();
result = (CompilationResult) ois.readObject();
} catch (IOException | ClassNotFoundException ex) {
Log.error("[CLIENT] Exception caught: " + ex);
- result = new CompilationResult(CompilationResult.ERROR_FATAL);
+ result = new CompilationResult(CompilationSubResult.ERROR_FATAL);
result.stderr = Util.getStackTrace(ex);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt(); // Restore interrupt
Log.error("[CLIENT] compile interrupted.");
- result = new CompilationResult(CompilationResult.ERROR_FATAL);
+ result = new CompilationResult(CompilationSubResult.ERROR_FATAL);
result.stderr = Util.getStackTrace(ie);
}
return result;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/CompilationService.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,171 @@
+/*
+ * 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 com.sun.tools.sjavac.comp;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Dependencies;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.sjavac.Log;
+import com.sun.tools.sjavac.Util;
+import com.sun.tools.sjavac.comp.dependencies.NewDependencyCollector;
+import com.sun.tools.sjavac.comp.dependencies.PublicApiCollector;
+import com.sun.tools.sjavac.server.CompilationSubResult;
+import com.sun.tools.sjavac.server.SysInfo;
+
+/**
+ * <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 CompilationService {
+
+ public SysInfo getSysInfo() {
+ return new SysInfo(Runtime.getRuntime().availableProcessors(),
+ Runtime.getRuntime().maxMemory());
+ }
+
+ public CompilationSubResult compile(String protocolId,
+ String invocationId,
+ String[] args,
+ List<File> explicitSources,
+ Set<URI> sourcesToCompile,
+ Set<URI> visibleSources) {
+
+ JavacTool compiler = (JavacTool) ToolProvider.getSystemJavaCompiler();
+ try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
+ SmartFileManager sfm = new SmartFileManager(fm);
+ Context context = new Context();
+
+ Dependencies.GraphDependencies.preRegister(context);
+
+ // Now setup the actual compilation
+ CompilationSubResult compilationResult = new CompilationSubResult(0);
+
+ // First deal with explicit source files on cmdline and in at file
+ ListBuffer<JavaFileObject> explicitJFOs = new ListBuffer<>();
+ for (JavaFileObject jfo : fm.getJavaFileObjectsFromFiles(explicitSources)) {
+ explicitJFOs.append(SmartFileManager.locWrap(jfo, StandardLocation.SOURCE_PATH));
+ }
+ // Now deal with sources supplied as source_to_compile
+ ListBuffer<File> sourcesToCompileFiles = new ListBuffer<>();
+ for (URI u : sourcesToCompile)
+ sourcesToCompileFiles.append(new File(u));
+
+ for (JavaFileObject jfo : fm.getJavaFileObjectsFromFiles(sourcesToCompileFiles))
+ explicitJFOs.append(SmartFileManager.locWrap(jfo, StandardLocation.SOURCE_PATH));
+
+ // Create a new logger
+ StringWriter stdoutLog = new StringWriter();
+ StringWriter stderrLog = new StringWriter();
+ PrintWriter stdout = new PrintWriter(stdoutLog);
+ PrintWriter stderr = new PrintWriter(stderrLog);
+ com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK;
+ PublicApiCollector pubApiCollector = new PublicApiCollector(context, explicitJFOs);
+ PathAndPackageVerifier papVerifier = new PathAndPackageVerifier();
+ NewDependencyCollector depsCollector = new NewDependencyCollector(context, explicitJFOs);
+ try {
+ if (explicitJFOs.size() > 0) {
+ sfm.setVisibleSources(visibleSources);
+ sfm.cleanArtifacts();
+ sfm.setLog(stdout);
+
+ // Do the compilation!
+ JavacTaskImpl task =
+ (JavacTaskImpl) compiler.getTask(stderr,
+ sfm,
+ null,
+ Arrays.asList(args),
+ null,
+ explicitJFOs,
+ context);
+ sfm.setSymbolFileEnabled(!com.sun.tools.javac.util.Options.instance(context).isSet("ignore.symbol.file"));
+ task.addTaskListener(depsCollector);
+ task.addTaskListener(pubApiCollector);
+ task.addTaskListener(papVerifier);
+ logJavacInvocation(args);
+ rc = task.doCall();
+ Log.debug("javac returned with code " + rc);
+ sfm.flush();
+ }
+ } catch (Exception e) {
+ Log.error(Util.getStackTrace(e));
+ stderrLog.append(Util.getStackTrace(e));
+ rc = com.sun.tools.javac.main.Main.Result.ERROR;
+ }
+
+ compilationResult.packageArtifacts = sfm.getPackageArtifacts();
+
+ if (papVerifier.errorsDiscovered())
+ rc = com.sun.tools.javac.main.Main.Result.ERROR;
+
+ compilationResult.packageDependencies = depsCollector.getDependencies(false);
+ compilationResult.packageCpDependencies = depsCollector.getDependencies(true);
+
+ compilationResult.packagePubapis = pubApiCollector.getPubApis(true);
+ compilationResult.dependencyPubapis = pubApiCollector.getPubApis(false);
+ compilationResult.stdout = stdoutLog.toString();
+ compilationResult.stderr = stderrLog.toString();
+ compilationResult.returnCode = rc.exitCode;
+
+ return compilationResult;
+ } catch (IOException e) {
+ throw new Error(e);
+ }
+ }
+
+ private void logJavacInvocation(String[] args) {
+ Log.debug("Invoking javac with args");
+ Iterator<String> argIter = Arrays.asList(args).iterator();
+ while (argIter.hasNext()) {
+ String arg = argIter.next();
+ String line = " " + arg;
+ if (arg.matches("\\-(d|cp|classpath|sourcepath|source|target)")
+ && argIter.hasNext()) {
+ line += " " + argIter.next();
+ }
+ Log.debug(line);
+ }
+ }
+
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PooledSjavac.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PooledSjavac.java Mon Aug 31 11:26:11 2015 -0700
@@ -24,11 +24,7 @@
*/
package com.sun.tools.sjavac.comp;
-import java.io.File;
-import java.net.URI;
-import java.util.List;
import java.util.Objects;
-import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
@@ -36,7 +32,6 @@
import com.sun.tools.sjavac.Log;
import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
-import com.sun.tools.sjavac.server.SysInfo;
/**
* An sjavac implementation that limits the number of concurrent calls by
@@ -59,30 +54,10 @@
}
@Override
- public SysInfo getSysInfo() {
- try {
- return pool.submit(() -> delegate.getSysInfo()).get();
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("Error during getSysInfo", e);
- }
- }
-
- @Override
- public CompilationResult compile(final String protocolId,
- final String invocationId,
- final String[] args,
- final List<File> explicitSources,
- final Set<URI> sourcesToCompile,
- final Set<URI> visibleSources) {
+ public CompilationResult compile(String[] args) {
try {
return pool.submit(() -> {
- return delegate.compile(protocolId,
- invocationId,
- args,
- explicitSources,
- sourcesToCompile,
- visibleSources);
+ return delegate.compile(args);
}).get();
} catch (Exception e) {
e.printStackTrace();
@@ -112,8 +87,4 @@
delegate.shutdown();
}
- @Override
- public String serverSettings() {
- return delegate.serverSettings();
- }
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java Mon Aug 31 11:26:11 2015 -0700
@@ -24,34 +24,33 @@
*/
package com.sun.tools.sjavac.comp;
-import java.io.File;
+import static com.sun.tools.sjavac.server.CompilationResult.ERROR_FATAL;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Iterator;
+import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-
-import com.sun.tools.javac.api.JavacTaskImpl;
-import com.sun.tools.javac.api.JavacTool;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Dependencies;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Options;
+import com.sun.tools.sjavac.JavacState;
import com.sun.tools.sjavac.Log;
+import com.sun.tools.sjavac.Module;
+import com.sun.tools.sjavac.ProblemException;
+import com.sun.tools.sjavac.Source;
+import com.sun.tools.sjavac.Transformer;
import com.sun.tools.sjavac.Util;
-import com.sun.tools.sjavac.comp.dependencies.NewDependencyCollector;
-import com.sun.tools.sjavac.comp.dependencies.PublicApiCollector;
+import com.sun.tools.sjavac.options.Options;
+import com.sun.tools.sjavac.options.SourceLocation;
import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
-import com.sun.tools.sjavac.server.SysInfo;
/**
* The sjavac implementation that interacts with javac and performs the actual
@@ -65,123 +64,282 @@
public class SjavacImpl implements Sjavac {
@Override
- public SysInfo getSysInfo() {
- return new SysInfo(Runtime.getRuntime().availableProcessors(),
- Runtime.getRuntime().maxMemory());
- }
+ public CompilationResult compile(String[] args) {
+
+ ByteArrayOutputStream outBaos = new ByteArrayOutputStream();
+ ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
+ PrintStream out = new PrintStream(outBaos);
+ PrintStream err = new PrintStream(errBaos);
+
+ Options options;
+ try {
+ options = Options.parseArgs(args);
+ } catch (IllegalArgumentException e) {
+ Log.error(e.getMessage());
+ return new CompilationResult(ERROR_FATAL);
+ }
+
+ Log.setLogLevel(options.getLogLevel());
+
+ if (!validateOptions(options))
+ return new CompilationResult(ERROR_FATAL);
- @Override
- public CompilationResult compile(String protocolId,
- String invocationId,
- String[] args,
- List<File> explicitSources,
- Set<URI> sourcesToCompile,
- Set<URI> visibleSources) {
+ if (!createIfMissing(options.getDestDir()))
+ return new CompilationResult(ERROR_FATAL);
+
+ if (!createIfMissing(options.getStateDir()))
+ return new CompilationResult(ERROR_FATAL);
+
+ Path gensrc = options.getGenSrcDir();
+ if (gensrc != null && !createIfMissing(gensrc))
+ return new CompilationResult(ERROR_FATAL);
- JavacTool compiler = (JavacTool) ToolProvider.getSystemJavaCompiler();
- try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
- SmartFileManager sfm = new SmartFileManager(fm);
- Context context = new Context();
+ Path hdrdir = options.getHeaderDir();
+ if (hdrdir != null && !createIfMissing(hdrdir))
+ return new CompilationResult(ERROR_FATAL);
+
+ // Load the prev build state database.
+ JavacState javac_state = JavacState.load(options, out, err);
+
+ // Setup the suffix rules from the command line.
+ Map<String, Transformer> suffixRules = new HashMap<>();
- Dependencies.GraphDependencies.preRegister(context);
+ // Handling of .java-compilation
+ suffixRules.putAll(javac_state.getJavaSuffixRule());
+
+ // Handling of -copy and -tr
+ suffixRules.putAll(options.getTranslationRules());
- // Now setup the actual compilation
- CompilationResult compilationResult = new CompilationResult(0);
+ // All found modules are put here.
+ Map<String,Module> modules = new HashMap<>();
+ // We start out in the legacy empty no-name module.
+ // As soon as we stumble on a module-info.java file we change to that module.
+ Module current_module = new Module("", "");
+ modules.put("", current_module);
+
+ // Find all sources, use the suffix rules to know which files are sources.
+ Map<String,Source> sources = new HashMap<>();
- // First deal with explicit source files on cmdline and in at file
- ListBuffer<JavaFileObject> explicitJFOs = new ListBuffer<>();
- for (JavaFileObject jfo : fm.getJavaFileObjectsFromFiles(explicitSources)) {
- explicitJFOs.append(SmartFileManager.locWrap(jfo, StandardLocation.SOURCE_PATH));
- }
- // Now deal with sources supplied as source_to_compile
- ListBuffer<File> sourcesToCompileFiles = new ListBuffer<>();
- for (URI u : sourcesToCompile)
- sourcesToCompileFiles.append(new File(u));
+ // Find the files, this will automatically populate the found modules
+ // with found packages where the sources are found!
+ findSourceFiles(options.getSources(),
+ suffixRules.keySet(),
+ sources,
+ modules,
+ current_module,
+ options.isDefaultPackagePermitted(),
+ false);
- for (JavaFileObject jfo : fm.getJavaFileObjectsFromFiles(sourcesToCompileFiles))
- explicitJFOs.append(SmartFileManager.locWrap(jfo, StandardLocation.SOURCE_PATH));
+ if (sources.isEmpty()) {
+ Log.error("Found nothing to compile!");
+ return new CompilationResult(CompilationResult.ERROR_FATAL,
+ new String(outBaos.toByteArray(), UTF_8),
+ new String(errBaos.toByteArray(), UTF_8));
+ }
+
+
+ // Create a map of all source files that are available for linking. Both -src and
+ // -sourcepath point to such files. It is possible to specify multiple
+ // -sourcepath options to enable different filtering rules. If the
+ // filters are the same for multiple sourcepaths, they may be concatenated
+ // using :(;). Before sending the list of sourcepaths to javac, they are
+ // all concatenated. The list created here is used by the SmartFileWrapper to
+ // make sure only the correct sources are actually available.
+ // We might find more modules here as well.
+ Map<String,Source> sources_to_link_to = new HashMap<>();
- // Create a new logger
- StringWriter stdoutLog = new StringWriter();
- StringWriter stderrLog = new StringWriter();
- PrintWriter stdout = new PrintWriter(stdoutLog);
- PrintWriter stderr = new PrintWriter(stderrLog);
- com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK;
- PublicApiCollector pubApiCollector = new PublicApiCollector(context, explicitJFOs);
- PathAndPackageVerifier papVerifier = new PathAndPackageVerifier();
- NewDependencyCollector depsCollector = new NewDependencyCollector(context, explicitJFOs);
- try {
- if (explicitJFOs.size() > 0) {
- sfm.setVisibleSources(visibleSources);
- sfm.cleanArtifacts();
- sfm.setLog(stdout);
+ List<SourceLocation> sourceResolutionLocations = new ArrayList<>();
+ sourceResolutionLocations.addAll(options.getSources());
+ sourceResolutionLocations.addAll(options.getSourceSearchPaths());
+ findSourceFiles(sourceResolutionLocations,
+ Collections.singleton(".java"),
+ sources_to_link_to,
+ modules,
+ current_module,
+ options.isDefaultPackagePermitted(),
+ true);
+
+ // Add the set of sources to the build database.
+ javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
+ javac_state.now().checkInternalState("checking sources", false, sources);
+ javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
+ javac_state.setVisibleSources(sources_to_link_to);
+
+ int round = 0;
+ printRound(round);
+
+ // If there is any change in the source files, taint packages
+ // and mark the database in need of saving.
+ javac_state.checkSourceStatus(false);
+
+ // Find all existing artifacts. Their timestamp will match the last modified timestamps stored
+ // in javac_state, simply because loading of the JavacState will clean out all artifacts
+ // that do not match the javac_state database.
+ javac_state.findAllArtifacts();
+
+ // Remove unidentified artifacts from the bin, gensrc and header dirs.
+ // (Unless we allow them to be there.)
+ // I.e. artifacts that are not known according to the build database (javac_state).
+ // For examples, files that have been manually copied into these dirs.
+ // Artifacts with bad timestamps (ie the on disk timestamp does not match the timestamp
+ // in javac_state) have already been removed when the javac_state was loaded.
+ if (!options.areUnidentifiedArtifactsPermitted()) {
+ javac_state.removeUnidentifiedArtifacts();
+ }
+ // Go through all sources and taint all packages that miss artifacts.
+ javac_state.taintPackagesThatMissArtifacts();
+
+ // Check recorded classpath public apis. Taint packages that depend on
+ // classpath classes whose public apis have changed.
+ javac_state.taintPackagesDependingOnChangedClasspathPackages();
- // Do the compilation!
- JavacTaskImpl task =
- (JavacTaskImpl) compiler.getTask(stderr,
- sfm,
- null,
- Arrays.asList(args),
- null,
- explicitJFOs,
- context);
- sfm.setSymbolFileEnabled(!Options.instance(context).isSet("ignore.symbol.file"));
- task.addTaskListener(depsCollector);
- task.addTaskListener(pubApiCollector);
- task.addTaskListener(papVerifier);
- logJavacInvocation(args);
- rc = task.doCall();
- Log.debug("javac returned with code " + rc);
- sfm.flush();
+ // Now clean out all known artifacts belonging to tainted packages.
+ javac_state.deleteClassArtifactsInTaintedPackages();
+ // Copy files, for example property files, images files, xml files etc etc.
+ javac_state.performCopying(Util.pathToFile(options.getDestDir()), suffixRules);
+ // Translate files, for example compile properties or compile idls.
+ javac_state.performTranslation(Util.pathToFile(gensrc), suffixRules);
+ // Add any potentially generated java sources to the tobe compiled list.
+ // (Generated sources must always have a package.)
+ Map<String,Source> generated_sources = new HashMap<>();
+
+ try {
+
+ Source.scanRoot(Util.pathToFile(options.getGenSrcDir()), Util.set(".java"), null, null, null, null,
+ generated_sources, modules, current_module, false, true, false);
+ javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
+ // Recheck the the source files and their timestamps again.
+ javac_state.checkSourceStatus(true);
+
+ // Now do a safety check that the list of source files is identical
+ // to the list Make believes we are compiling. If we do not get this
+ // right, then incremental builds will fail with subtility.
+ // If any difference is detected, then we will fail hard here.
+ // This is an important safety net.
+ javac_state.compareWithMakefileList(Util.pathToFile(options.getSourceReferenceList()));
+
+ // Do the compilations, repeatedly until no tainted packages exist.
+ boolean again;
+ // Collect the name of all compiled packages.
+ Set<String> recently_compiled = new HashSet<>();
+ boolean[] rc = new boolean[1];
+
+ CompilationService compilationService = new CompilationService();
+ do {
+ if (round > 0)
+ printRound(round);
+ // Clean out artifacts in tainted packages.
+ javac_state.deleteClassArtifactsInTaintedPackages();
+ again = javac_state.performJavaCompilations(compilationService, options, recently_compiled, rc);
+ if (!rc[0]) {
+ Log.debug("Compilation failed.");
+ break;
}
- } catch (Exception e) {
- Log.error(Util.getStackTrace(e));
- stderrLog.append(Util.getStackTrace(e));
- rc = com.sun.tools.javac.main.Main.Result.ERROR;
+ if (!again) {
+ Log.debug("Nothing left to do.");
+ }
+ round++;
+ } while (again);
+ Log.debug("No need to do another round.");
+
+ // Only update the state if the compile went well.
+ if (rc[0]) {
+ javac_state.save();
+ // Reflatten only the artifacts.
+ javac_state.now().flattenArtifacts(modules);
+ // Remove artifacts that were generated during the last compile, but not this one.
+ javac_state.removeSuperfluousArtifacts(recently_compiled);
}
- compilationResult.packageArtifacts = sfm.getPackageArtifacts();
-
- if (papVerifier.errorsDiscovered())
- rc = com.sun.tools.javac.main.Main.Result.ERROR;
-
- compilationResult.packageDependencies = depsCollector.getDependencies(false);
- compilationResult.packageCpDependencies = depsCollector.getDependencies(true);
-
- compilationResult.packagePubapis = pubApiCollector.getPubApis(true); // pubApis.getPubapis(explicitJFOs, true);
- compilationResult.dependencyPubapis = pubApiCollector.getPubApis(false); // pubApis.getPubapis(explicitJFOs, false);
- compilationResult.stdout = stdoutLog.toString();
- compilationResult.stderr = stderrLog.toString();
- compilationResult.returnCode = rc.exitCode;
-
- return compilationResult;
- } catch (IOException e) {
- throw new Error(e);
+ return new CompilationResult(rc[0] ? 0 : ERROR_FATAL,
+ new String(outBaos.toByteArray(), UTF_8),
+ new String(errBaos.toByteArray(), UTF_8));
+ } catch (ProblemException e) {
+ Log.error(e.getMessage());
+ return new CompilationResult(ERROR_FATAL,
+ new String(outBaos.toByteArray(), UTF_8),
+ new String(errBaos.toByteArray(), UTF_8));
+ } catch (Exception e) {
+ e.printStackTrace(err);
+ return new CompilationResult(ERROR_FATAL,
+ new String(outBaos.toByteArray(), UTF_8),
+ new String(errBaos.toByteArray(), UTF_8));
}
}
@Override
public void shutdown() {
// Nothing to clean up
- // ... maybe we should wait for any current request to finish?
}
- @Override
- public String serverSettings() {
- return "";
+ private static boolean validateOptions(Options options) {
+
+ String err = null;
+
+ if (options.getDestDir() == null) {
+ err = "Please specify output directory.";
+ } else if (options.isJavaFilesAmongJavacArgs()) {
+ err = "Sjavac does not handle explicit compilation of single .java files.";
+ } else if (options.getServerConf() == null) {
+ err = "No server configuration provided.";
+ } else if (!options.getImplicitPolicy().equals("none")) {
+ err = "The only allowed setting for sjavac is -implicit:none";
+ } else if (options.getSources().isEmpty()) {
+ err = "You have to specify -src.";
+ } else if (options.getTranslationRules().size() > 1
+ && options.getGenSrcDir() == null) {
+ err = "You have translators but no gensrc dir (-s) specified!";
+ }
+
+ if (err != null)
+ Log.error(err);
+
+ return err == null;
+
}
- private void logJavacInvocation(String[] args) {
- Log.debug("Invoking javac with args");
- Iterator<String> argIter = Arrays.asList(args).iterator();
- while (argIter.hasNext()) {
- String arg = argIter.next();
- String line = " " + arg;
- if (arg.matches("\\-(d|cp|classpath|sourcepath|source|target)")
- && argIter.hasNext()) {
- line += " " + argIter.next();
- }
- Log.debug(line);
+ private static boolean createIfMissing(Path dir) {
+
+ if (Files.isDirectory(dir))
+ return true;
+
+ if (Files.exists(dir)) {
+ Log.error(dir + " is not a directory.");
+ return false;
+ }
+
+ try {
+ Files.createDirectories(dir);
+ } catch (IOException e) {
+ Log.error("Could not create directory: " + e.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+
+ /** Find source files in the given source locations. */
+ public static void findSourceFiles(List<SourceLocation> sourceLocations,
+ Set<String> sourceTypes,
+ Map<String,Source> foundFiles,
+ Map<String, Module> foundModules,
+ Module currentModule,
+ boolean permitSourcesInDefaultPackage,
+ boolean inLinksrc) {
+
+ for (SourceLocation source : sourceLocations) {
+ source.findSourceFiles(sourceTypes,
+ foundFiles,
+ foundModules,
+ currentModule,
+ permitSourcesInDefaultPackage,
+ inLinksrc);
}
}
+
+ private static void printRound(int round) {
+ Log.debug("****************************************");
+ Log.debug("* Round " + round + " *");
+ Log.debug("****************************************");
+ }
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/CompilationResult.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/CompilationResult.java Mon Aug 31 11:26:11 2015 -0700
@@ -26,15 +26,8 @@
package com.sun.tools.sjavac.server;
import java.io.Serializable;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import com.sun.tools.sjavac.pubapi.PubApi;
/**
- *
* <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
@@ -47,17 +40,18 @@
// Return code constants
public final static int ERROR_FATAL = -1;
+ public String stdout;
+ public String stderr;
public int returnCode;
- public Map<String, Set<URI>> packageArtifacts = new HashMap<>();
- public Map<String, Map<String, Set<String>>> packageDependencies = new HashMap<>();
- public Map<String, Map<String, Set<String>>> packageCpDependencies = new HashMap<>();
- public Map<String, PubApi> packagePubapis = new HashMap<>();
- public Map<String, PubApi> dependencyPubapis = new HashMap<>();
- public String stdout = "";
- public String stderr = "";
public CompilationResult(int returnCode) {
+ this(returnCode, "", "");
+ }
+
+ public CompilationResult(int returnCode, String stdout, String stderr) {
this.returnCode = returnCode;
+ this.stdout = stdout;
+ this.stderr = stderr;
}
public void setReturnCode(int returnCode) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/CompilationSubResult.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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
+ * 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.sjavac.server;
+
+import java.io.Serializable;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import com.sun.tools.sjavac.pubapi.PubApi;
+
+/**
+ *
+ * <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 CompilationSubResult implements Serializable {
+
+ static final long serialVersionUID = 46739181113L;
+
+ // Return code constants
+ public final static int ERROR_FATAL = -1;
+
+ public int returnCode;
+ public Map<String, Set<URI>> packageArtifacts = new HashMap<>();
+ public Map<String, Map<String, Set<String>>> packageDependencies = new HashMap<>();
+ public Map<String, Map<String, Set<String>>> packageCpDependencies = new HashMap<>();
+ public Map<String, PubApi> packagePubapis = new HashMap<>();
+ public Map<String, PubApi> dependencyPubapis = new HashMap<>();
+ public String stdout = "";
+ public String stderr = "";
+
+ public CompilationSubResult(int returnCode) {
+ this.returnCode = returnCode;
+ }
+
+ public void setReturnCode(int returnCode) {
+ this.returnCode = returnCode;
+ }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/IdleResetSjavac.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/IdleResetSjavac.java Mon Aug 31 11:26:11 2015 -0700
@@ -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
@@ -24,10 +24,6 @@
*/
package com.sun.tools.sjavac.server;
-import java.io.File;
-import java.net.URI;
-import java.util.List;
-import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
@@ -64,30 +60,10 @@
}
@Override
- public SysInfo getSysInfo() {
+ public CompilationResult compile(String[] args) {
startCall();
try {
- return delegate.getSysInfo();
- } finally {
- endCall();
- }
- }
-
- @Override
- public CompilationResult compile(String protocolId,
- String invocationId,
- String[] args,
- List<File> explicitSources,
- Set<URI> sourcesToCompile,
- Set<URI> visibleSources) {
- startCall();
- try {
- return delegate.compile(protocolId,
- invocationId,
- args,
- explicitSources,
- sourcesToCompile,
- visibleSources);
+ return delegate.compile(args);
} finally {
endCall();
}
@@ -129,8 +105,4 @@
delegate.shutdown();
}
- @Override
- public String serverSettings() {
- return delegate.serverSettings();
- }
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java Mon Aug 31 11:26:11 2015 -0700
@@ -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
@@ -37,6 +37,7 @@
import com.sun.tools.javac.util.Assert;
import com.sun.tools.sjavac.Log;
+import com.sun.tools.sjavac.client.PortFileInaccessibleException;
/**
* The PortFile class mediates access to a short binary file containing the tcp/ip port (for the localhost)
@@ -80,11 +81,16 @@
* Create a new portfile.
* @param fn is the path to the file.
*/
- public PortFile(String fn) throws FileNotFoundException {
+ public PortFile(String fn) throws PortFileInaccessibleException {
filename = fn;
file = new File(filename);
stopFile = new File(filename+".stop");
- rwfile = new RandomAccessFile(file, "rw");
+ try {
+ rwfile = new RandomAccessFile(file, "rw");
+ } catch (FileNotFoundException e) {
+ // Reached if file for instance already exists and is a directory
+ throw new PortFileInaccessibleException(e);
+ }
// The rwfile should only be readable by the owner of the process
// and no other! How do we do that on a RandomAccessFile?
channel = rwfile.getChannel();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/RequestHandler.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/RequestHandler.java Mon Aug 31 11:26:11 2015 -0700
@@ -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
@@ -24,16 +24,12 @@
*/
package com.sun.tools.sjavac.server;
-import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.Socket;
-import java.net.URI;
-import java.util.List;
-import java.util.Set;
import com.sun.tools.sjavac.Log;
@@ -71,8 +67,7 @@
String cmd = (String) oin.readObject();
Log.info("Handling request, id: " + id + " cmd: " + cmd);
switch (cmd) {
- case SjavacServer.CMD_SYS_INFO: handleSysInfoRequest(oin, oout); break;
- case SjavacServer.CMD_COMPILE: handleCompileRequest(oin, oout); break;
+ case SjavacServer.CMD_COMPILE: handleCompileRequest(oin, oout); break;
default: Log.error("Unknown command: " + cmd);
}
} catch (Exception ex) {
@@ -85,31 +80,15 @@
}
}
- private void handleSysInfoRequest(ObjectInputStream oin,
- ObjectOutputStream oout) throws IOException {
- oout.writeObject(sjavac.getSysInfo());
- oout.flush();
- }
-
- @SuppressWarnings("unchecked")
private void handleCompileRequest(ObjectInputStream oin,
ObjectOutputStream oout) throws IOException {
try {
// Read request arguments
- String protocolId = (String) oin.readObject();
- String invocationId = (String) oin.readObject();
String[] args = (String[]) oin.readObject();
- List<File> explicitSources = (List<File>) oin.readObject();
- Set<URI> sourcesToCompile = (Set<URI>) oin.readObject();
- Set<URI> visibleSources = (Set<URI>) oin.readObject();
// Perform compilation
- CompilationResult cr = sjavac.compile(protocolId,
- invocationId,
- args,
- explicitSources,
- sourcesToCompile,
- visibleSources);
+ CompilationResult cr = sjavac.compile(args);
+
// Write request response
oout.writeObject(cr);
oout.flush();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/Sjavac.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/Sjavac.java Mon Aug 31 11:26:11 2015 -0700
@@ -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
@@ -24,10 +24,6 @@
*/
package com.sun.tools.sjavac.server;
-import java.io.File;
-import java.net.URI;
-import java.util.List;
-import java.util.Set;
/**
* Interface of the SjavacImpl, the sjavac client and all wrappers such as
@@ -39,16 +35,6 @@
* deletion without notice.</b>
*/
public interface Sjavac {
-
- SysInfo getSysInfo();
-
- CompilationResult compile(String protocolId,
- String invocationId,
- String[] args,
- List<File> explicitSources,
- Set<URI> sourcesToCompile,
- Set<URI> visibleSources);
-
+ CompilationResult compile(String[] args);
void shutdown();
- String serverSettings();
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java Mon Aug 31 11:26:11 2015 -0700
@@ -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,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import com.sun.tools.sjavac.Util;
+import com.sun.tools.sjavac.client.PortFileInaccessibleException;
import com.sun.tools.sjavac.comp.PooledSjavac;
import com.sun.tools.sjavac.comp.SjavacImpl;
@@ -54,7 +55,6 @@
// Used in protocol to indicate which method to invoke
public final static String CMD_COMPILE = "compile";
- public final static String CMD_SYS_INFO = "sys-info";
final private String portfilename;
final private String logfile;
@@ -122,7 +122,7 @@
/**
* Acquire the port file. Synchronized since several threads inside an smart javac wrapper client acquires the same port file at the same time.
*/
- public static synchronized PortFile getPortFile(String filename) throws FileNotFoundException {
+ public static synchronized PortFile getPortFile(String filename) throws PortFileInaccessibleException {
if (allPortFiles == null) {
allPortFiles = new HashMap<>();
}
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C3.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C3.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C4.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C4.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C5.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C5.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/C3.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/C3.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/C4.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/C4.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlTag/pkg1/C1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTag/pkg1/C1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlTag/pkg2/C2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTag/pkg2/C2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/pkg/TestError.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/pkg/TestError.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/pkg/TestException.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/pkg/TestException.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/NestedInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/NestedInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/PrivateIncludeInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/PrivateIncludeInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/ProtectedInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/ProtectedInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/PublicExcludeInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/pkg1/PublicExcludeInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testProfiles/pkg2/Anno1Pkg2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/Anno1Pkg2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testProfiles/pkg2/Anno2Pkg2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/Anno2Pkg2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testProfiles/pkg4/Anno1Pkg4.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg4/Anno1Pkg4.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/NestedInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/NestedInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/PrivateIncludeInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/PrivateIncludeInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/ProtectedInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/ProtectedInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/PublicExcludeInnerClass.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedForm/pkg1/PublicExcludeInnerClass.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C3.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C3.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testSinceTag/pkg1/C1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testSinceTag/pkg1/C1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/6668794/badClass/A.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/6668794/badClass/A.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/6668794/badClass/Test.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/6668794/badClass/Test.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/6668794/badSource/p/A.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/6668794/badSource/p/A.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/7129225/Anno.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/7129225/Anno.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/7129225/AnnoProcessor.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/7129225/AnnoProcessor.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/7153958/pkg/ClassToBeStaticallyImportedA.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/7153958/pkg/ClassToBeStaticallyImportedA.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/7153958/pkg/ClassToBeStaticallyImportedB.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/7153958/pkg/ClassToBeStaticallyImportedB.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T6668802.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T6668802.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8009640/CheckRejectProfileBCPOptionsIfUsedTogetherTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8009640/CheckRejectProfileBCPOptionsIfUsedTogetherTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8010659/CompilerCrashWhenMixingBinariesAndSourcesTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8010659/CompilerCrashWhenMixingBinariesAndSourcesTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8013394/CompileErrorWithIteratorTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8013394/CompileErrorWithIteratorTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -1,30 +1,5 @@
/*
- * Copyright (c) 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. 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 8022316
* @summary Generic throws, overriding and method reference
* @compile/fail/ref=CompilerErrorGenericThrowPlusMethodRefTest.out -XDrawDiagnostics CompilerErrorGenericThrowPlusMethodRefTest.java
--- a/langtools/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.out Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.out Mon Aug 31 11:26:11 2015 -0700
@@ -1,2 +1,2 @@
-CompilerErrorGenericThrowPlusMethodRefTest.java:55:26: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
+CompilerErrorGenericThrowPlusMethodRefTest.java:30:26: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
1 error
--- a/langtools/test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8024398/NPETryTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8024398/NPETryTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TestBootstrapMethodsCount.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,236 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8129547
+ * @summary Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
+ * @library lib
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.jvm
+ * jdk.compiler/com.sun.tools.javac.tree
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm TestBootstrapMethodsCount
+ */
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Locale;
+
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+import com.sun.source.tree.MethodInvocationTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.source.util.TreeScanner;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.BootstrapMethods_attribute;
+import com.sun.tools.classfile.ClassFile;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
+import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.tree.JCTree.JCIdent;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Names;
+
+import static com.sun.tools.javac.jvm.ClassFile.*;
+
+public class TestBootstrapMethodsCount
+ extends JavacTestingAbstractThreadedTest
+ implements Runnable {
+
+
+ public static void main(String... args) throws Exception {
+ pool.execute(new TestBootstrapMethodsCount());
+ checkAfterExec();
+ }
+
+ DiagChecker dc;
+
+ TestBootstrapMethodsCount() {
+ dc = new DiagChecker();
+ }
+
+ public void run() {
+ int id = checkCount.incrementAndGet();
+ JavaSource source = new JavaSource(id);
+ JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
+ Arrays.asList("-g"), null, Arrays.asList(source));
+ Context context = ct.getContext();
+ Symtab syms = Symtab.instance(context);
+ Names names = Names.instance(context);
+ Types types = Types.instance(context);
+ ct.addTaskListener(new Indifier(syms, names, types));
+ try {
+ ct.generate();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ throw new AssertionError(
+ String.format("Error thrown when compiling following code\n%s",
+ source.source));
+ }
+ if (dc.diagFound) {
+ throw new AssertionError(
+ String.format("Diags found when compiling following code\n%s\n\n%s",
+ source.source, dc.printDiags()));
+ }
+ verifyBytecode(id);
+ }
+
+ void verifyBytecode(int id) {
+ File compiledTest = new File(String.format("Test%d.class", id));
+ try {
+ ClassFile cf = ClassFile.read(compiledTest);
+ BootstrapMethods_attribute bsm_attr =
+ (BootstrapMethods_attribute)cf
+ .getAttribute(Attribute.BootstrapMethods);
+ int length = bsm_attr.bootstrap_method_specifiers.length;
+ if (length != 1) {
+ throw new Error("Bad number of method specifiers " +
+ "in BootstrapMethods attribute: " + length);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new Error("error reading " + compiledTest +": " + e);
+ }
+ }
+
+ class JavaSource extends SimpleJavaFileObject {
+
+ static final String source_template = "import java.lang.invoke.*;\n" +
+ "class Bootstrap {\n" +
+ " public static CallSite bsm(MethodHandles.Lookup lookup, " +
+ "String name, MethodType methodType) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n" +
+ "class Test#ID {\n" +
+ " void m1() { }\n" +
+ " void m2(Object arg1) { }\n" +
+ " void test1() {\n" +
+ " Object o = this; // marker statement \n" +
+ " m1();\n" +
+ " }\n" +
+ " void test2(Object arg1) {\n" +
+ " Object o = this; // marker statement \n" +
+ " m2(arg1);\n" +
+ " }\n" +
+ "}";
+
+ String source;
+
+ JavaSource(int id) {
+ super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+ source = source_template.replace("#ID", String.valueOf(id));
+ }
+
+ @Override
+ public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+ return source;
+ }
+ }
+
+ class Indifier extends TreeScanner<Void, Void> implements TaskListener {
+
+ MethodSymbol bsm;
+ Symtab syms;
+ Names names;
+ Types types;
+
+ Indifier(Symtab syms, Names names, Types types) {
+ this.syms = syms;
+ this.names = names;
+ this.types = types;
+ }
+
+ @Override
+ public void started(TaskEvent e) {
+ //do nothing
+ }
+
+ @Override
+ public void finished(TaskEvent e) {
+ if (e.getKind() == TaskEvent.Kind.ANALYZE) {
+ scan(e.getCompilationUnit(), null);
+ }
+ }
+
+ @Override
+ public Void visitMethodInvocation(MethodInvocationTree node, Void p) {
+ super.visitMethodInvocation(node, p);
+ JCMethodInvocation apply = (JCMethodInvocation)node;
+ JCIdent ident = (JCIdent)apply.meth;
+ Symbol oldSym = ident.sym;
+ if (!oldSym.isConstructor()) {
+ ident.sym = new Symbol.DynamicMethodSymbol(oldSym.name,
+ oldSym.owner, REF_invokeStatic, bsm, oldSym.type, new Object[0]);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visitMethod(MethodTree node, Void p) {
+ super.visitMethod(node, p);
+ if (node.getName().toString().equals("bsm")) {
+ bsm = ((JCMethodDecl)node).sym;
+ }
+ return null;
+ }
+ }
+
+ static class DiagChecker
+ implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+ boolean diagFound;
+ ArrayList<String> diags = new ArrayList<>();
+
+ public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+ diags.add(diagnostic.getMessage(Locale.getDefault()));
+ diagFound = true;
+ }
+
+ String printDiags() {
+ StringBuilder buf = new StringBuilder();
+ for (String s : diags) {
+ buf.append(s);
+ buf.append("\n");
+ }
+ return buf.toString();
+ }
+ }
+
+}
--- a/langtools/test/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/diags/examples/BadSourceFileHeader/sourcepath/p/A.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/diags/examples/BadSourceFileHeader/sourcepath/p/A.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/diags/examples/MethodRedundantTypeargs.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/diags/examples/MethodRedundantTypeargs.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/6987475/T6987475pos.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/6987475/T6987475pos.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/8064803/T8064803.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/8064803/T8064803.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8048838/T8048838.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8048838/T8048838.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8055963/T8055963.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8055963/T8055963.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8058199/T8058199.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8058199/T8058199.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8058511/T8058511a.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8058511/T8058511a.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8058511/T8058511b.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8058511/T8058511b.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8058511/T8058511c.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8058511/T8058511c.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8078024/T8078024.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8078024/T8078024.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/8130304/T8130304.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/8130304/T8130304.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/typevars/8129214/T8129214.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/typevars/8129214/T8129214.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/generics/typevars/8129214/pkg/Foo.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/generics/typevars/8129214/pkg/Foo.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/8051958/T8051958.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/8051958/T8051958.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/8068399/T8068399.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/8068399/T8068399.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/8068430/T8068430.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/8068430/T8068430.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/8073842/T8073842.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/8073842/T8073842.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8134329/T8134329.java Mon Aug 31 11:26:11 2015 -0700
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8134329
+ * @summary TeeOpTest.java fails across platforms after fix for JDK-8129547
+ */
+import java.util.function.Supplier;
+
+public class T8134329 {
+
+ static void assertEquals(Object o1, Object o2) {
+ if (!o1.equals(o2)) {
+ throw new AssertionError(String.format("Expected %s - found %s", o2, o1));
+ }
+ }
+
+ public static void main(String[] args) {
+ Supplier<String> s1 = new T8134329() { }::m;
+ assertEquals(s1.get(), "m");
+ Supplier<String> s2 = new T8134329() { }::g;
+ assertEquals(s2.get(), "g");
+ Supplier<String> s3 = new T8134329() { }::m;
+ assertEquals(s3.get(), "m");
+ }
+
+ String m() { return "m"; }
+ String g() { return "g"; }
+}
--- a/langtools/test/tools/javac/lambda/LambdaInterfaceStaticField.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/LambdaInterfaceStaticField.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/LambdaMultiCatchTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/LambdaMultiCatchTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/T8038420/LambdaIncrement.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/T8038420/LambdaIncrement.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/T8057800/NPEMethodReferenceAndGenericsTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/T8057800/NPEMethodReferenceAndGenericsTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/lambdaExecution/InInterface.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/InInterface.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/lambdaExecution/InnerConstructor.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/InnerConstructor.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/lambdaExecution/LambdaTranslationTest1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/LambdaTranslationTest1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/lambdaExecution/LambdaTranslationTest2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/LambdaTranslationTest2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/lambdaExecution/TMapper.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/TMapper.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/lambdaExecution/TPredicate.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/TPredicate.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReference/MethodReferenceComplexNullCheckTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReference/MethodReferenceComplexNullCheckTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection3.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection3.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferencePackagePrivateQualifier.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferencePackagePrivateQualifier.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestFDCCE.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestFDCCE.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerDefault.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerDefault.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerInstance.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerInstance.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerVarArgsThis.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerVarArgsThis.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInstance.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInstance.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestKinds.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestKinds.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestMethodHandle.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestMethodHandle.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestNew.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestNew.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestNewInner.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestNewInner.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestNewInnerImplicitArgs.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestNewInnerImplicitArgs.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSueCase1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSueCase1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSueCase2.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSueCase2.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSueCase4.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSueCase4.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSuper.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSuper.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSuperDefault.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestSuperDefault.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestTypeConversion.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestTypeConversion.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgs.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgs.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsExt.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsExt.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsSuper.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsSuper.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsSuperDefault.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsSuperDefault.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsThis.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestVarArgsThis.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambda/methodReferenceExecution/pkg/B.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/pkg/B.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/AttributeInjector.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/AttributeInjector.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/ClassFile.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/ClassFile.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/ClassFilePreprocessor.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/ClassFilePreprocessor.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/ClassToInterfaceConverter.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/ClassToInterfaceConverter.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/Compiler.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/Compiler.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/DirectedClassLoader.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/DirectedClassLoader.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/SourceModel.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/SourceModel.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/ClassCase.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/ClassCase.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/Hierarchy.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/Hierarchy.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/HierarchyGenerator.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/HierarchyGenerator.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/Rule.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/Rule.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/RuleGroup.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/RuleGroup.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/TTNode.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/TTNode.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/TTParser.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/TTParser.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/TTShape.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/shapegen/TTShape.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/linenumbers/NestedLineNumberTest.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/linenumbers/NestedLineNumberTest.java Mon Aug 31 11:26:11 2015 -0700
@@ -1,30 +1,5 @@
/*
- * 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
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 8061778
* @summary Wrong LineNumberTable for default constructors
* @modules jdk.jdeps/com.sun.tools.classfile
@@ -50,8 +25,8 @@
}
int line = lines[0].line_number;
- if (line != 79) {
- error(String.format("LineNumberTable contains wrong line number - expected %d, found %d", 79, line));
+ if (line != 54) {
+ error(String.format("LineNumberTable contains wrong line number - expected %d, found %d", 54, line));
}
}
--- a/langtools/test/tools/javac/processing/messager/MessagerDiags.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/processing/messager/MessagerDiags.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javac/unicode/Wrapper.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javac/unicode/Wrapper.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javap/T4884240.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javap/T4884240.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javap/classfile/deps/GetDeps.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javap/classfile/deps/GetDeps.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javap/classfile/deps/T6907575.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javap/classfile/deps/T6907575.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/javap/classfile/deps/p/C1.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/javap/classfile/deps/p/C1.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/ApiExtraction.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/ApiExtraction.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/ClasspathDependencies.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/ClasspathDependencies.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/CompileCircularSources.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/CompileCircularSources.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/CompileExcludingDependency.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/CompileExcludingDependency.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/CompileWithAtFile.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/CompileWithAtFile.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/CompileWithInvisibleSources.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/CompileWithInvisibleSources.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/CompileWithOverrideSources.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/CompileWithOverrideSources.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/ExclPattern.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/ExclPattern.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/IdleShutdown.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/IdleShutdown.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
@@ -31,17 +29,11 @@
* @build Wrapper
* @run main Wrapper IdleShutdown
*/
-import java.io.File;
-import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.IdleResetSjavac;
import com.sun.tools.sjavac.server.Sjavac;
-import com.sun.tools.sjavac.server.SysInfo;
import com.sun.tools.sjavac.server.Terminable;
@@ -70,35 +62,14 @@
if (timeoutTimestamp.get() != -1)
throw new AssertionError("Premature timeout detected.");
- // Call various methods and wait less than TIMEOUT_MS in between
- Thread.sleep(TIMEOUT_MS - 1000);
- log("Getting sys info");
- service.getSysInfo();
-
+ // Use Sjavac object and wait less than TIMEOUT_MS in between calls
Thread.sleep(TIMEOUT_MS - 1000);
- log("Getting sys info");
- service.getSysInfo();
-
- if (timeoutTimestamp.get() != -1)
- throw new AssertionError("Premature timeout detected.");
+ log("Compiling");
+ service.compile(new String[0]);
Thread.sleep(TIMEOUT_MS - 1000);
log("Compiling");
- service.compile("",
- "",
- new String[0],
- Collections.<File>emptyList(),
- Collections.<URI>emptySet(),
- Collections.<URI>emptySet());
-
- Thread.sleep(TIMEOUT_MS - 1000);
- log("Compiling");
- service.compile("",
- "",
- new String[0],
- Collections.<File>emptyList(),
- Collections.<URI>emptySet(),
- Collections.<URI>emptySet());
+ service.compile(new String[0]);
if (timeoutTimestamp.get() != -1)
throw new AssertionError("Premature timeout detected.");
@@ -129,7 +100,10 @@
private static class NoopJavacService implements Sjavac {
@Override
- public SysInfo getSysInfo() {
+ public void shutdown() {
+ }
+ @Override
+ public CompilationResult compile(String[] args) {
// Attempt to trigger idle timeout during a call by sleeping
try {
Thread.sleep(TIMEOUT_MS + 1000);
@@ -137,21 +111,5 @@
}
return null;
}
- @Override
- public void shutdown() {
- }
- @Override
- public CompilationResult compile(String protocolId,
- String invocationId,
- String[] args,
- List<File> explicitSources,
- Set<URI> sourcesToCompile,
- Set<URI> visibleSources) {
- return null;
- }
- @Override
- public String serverSettings() {
- return "";
- }
}
}
--- a/langtools/test/tools/sjavac/IgnoreSymbolFile.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/IgnoreSymbolFile.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/IncCompInheritance.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/IncCompInheritance.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/JavacOptionPrep.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/JavacOptionPrep.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/OptionDecoding.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/OptionDecoding.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
@@ -51,10 +49,10 @@
import java.util.Map;
import com.sun.tools.sjavac.CopyFile;
-import com.sun.tools.sjavac.Main;
import com.sun.tools.sjavac.Module;
import com.sun.tools.sjavac.Source;
import com.sun.tools.sjavac.client.ClientMain;
+import com.sun.tools.sjavac.comp.SjavacImpl;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.options.SourceLocation;
@@ -136,7 +134,7 @@
Options options = Options.parseArgs("-if", "root/pkg1/ClassA1.java", "root");
Map<String, Source> foundFiles = new HashMap<>();
- ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
+ SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
new HashMap<String, Module>(), new Module("", ""), false, true);
checkFilesFound(foundFiles.keySet(), a1);
@@ -148,7 +146,7 @@
Options options = Options.parseArgs("-i", "pkg1/*", "root");
Map<String, Source> foundFiles = new HashMap<>();
- ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
+ SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
new HashMap<String, Module>(), new Module("", ""), false, true);
checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
@@ -160,7 +158,7 @@
Options options = Options.parseArgs("-xf", "root/pkg1/ClassA1.java", "root");
Map<String, Source> foundFiles = new HashMap<>();
- ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
+ SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
new HashMap<String, Module>(), new Module("", ""), false, true);
checkFilesFound(foundFiles.keySet(), a2, b1, b2, c1, c2);
@@ -171,7 +169,7 @@
Options options = Options.parseArgs("-i", "pkg1/*", "root");
Map<String, Source> foundFiles = new HashMap<>();
- ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
+ SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
new HashMap<String, Module>(), new Module("", ""), false, true);
checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
@@ -182,7 +180,7 @@
Options options = Options.parseArgs("-i", "pkg1/*", "-x", "pkg1/pkg2/*", "root");
Map<String, Source> foundFiles = new HashMap<>();
- ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
+ SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
new HashMap<String, Module>(), new Module("", ""), false, true);
checkFilesFound(foundFiles.keySet(), a1, a2);
--- a/langtools/test/tools/sjavac/PackagePathMismatch.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/PackagePathMismatch.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/ParallelCompilations.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/ParallelCompilations.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/PermittedArtifact.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/PermittedArtifact.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/PooledExecution.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/PooledExecution.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
@@ -32,18 +30,12 @@
* @build Wrapper
* @run main Wrapper PooledExecution
*/
-import java.io.File;
-import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import com.sun.tools.sjavac.comp.PooledSjavac;
import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
-import com.sun.tools.sjavac.server.SysInfo;
public class PooledExecution {
@@ -75,12 +67,7 @@
for (int i = 0; i < NUM_REQUESTS; i++) {
tasks[i] = new Thread() {
public void run() {
- service.compile("",
- "",
- new String[0],
- Collections.<File>emptyList(),
- Collections.<URI>emptySet(),
- Collections.<URI>emptySet());
+ service.compile(new String[0]);
tasksFinished.incrementAndGet();
}
};
@@ -122,12 +109,7 @@
AtomicInteger activeRequests = new AtomicInteger(0);
@Override
- public CompilationResult compile(String protocolId,
- String invocationId,
- String[] args,
- List<File> explicitSources,
- Set<URI> sourcesToCompile,
- Set<URI> visibleSources) {
+ public CompilationResult compile(String[] args) {
leftToStart.countDown();
int numActiveRequests = activeRequests.incrementAndGet();
System.out.printf("Left to start: %2d / Currently active: %2d%n",
@@ -145,18 +127,8 @@
}
@Override
- public SysInfo getSysInfo() {
- return null;
- }
-
- @Override
public void shutdown() {
}
-
- @Override
- public String serverSettings() {
- return "";
- }
}
}
}
--- a/langtools/test/tools/sjavac/SjavacBase.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/SjavacBase.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/StateDir.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/StateDir.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/Wrapper.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/Wrapper.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/langtools/test/tools/sjavac/util/OptionTestUtil.java Thu Aug 27 14:40:21 2015 -0700
+++ b/langtools/test/tools/sjavac/util/OptionTestUtil.java Mon Aug 31 11:26:11 2015 -0700
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
--- a/make/Images.gmk Thu Aug 27 14:40:21 2015 -0700
+++ b/make/Images.gmk Mon Aug 31 11:26:11 2015 -0700
@@ -39,14 +39,14 @@
MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
jdk.security.auth jdk.security.jgss jdk.pack200 jdk.xml.dom \
- jdk.accessibility
+ jdk.accessibility jdk.internal.le jdk.scripting.nashorn.shell
# providers
PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
jdk.naming.dns jdk.naming.rmi jdk.scripting.nashorn jdk.zipfs
# tools
-TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.internal.le jdk.scripting.nashorn.shell \
+TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev \
jdk.javadoc jdk.jcmd jdk.jconsole jdk.hotspot.agent jdk.jartool \
jdk.jdeps jdk.jdi jdk.jdwp.agent jdk.policytool jdk.rmic jdk.xml.bind jdk.xml.ws
--- a/modules.xml Thu Aug 27 14:40:21 2015 -0700
+++ b/modules.xml Mon Aug 31 11:26:11 2015 -0700
@@ -1652,6 +1652,10 @@
<name>jdk.internal.jline.console.history</name>
<to>jdk.scripting.nashorn.shell</to>
</export>
+ <export>
+ <name>jdk.internal.jline.internal</name>
+ <to>jdk.scripting.nashorn.shell</to>
+ </export>
</module>
<module>
<name>jdk.jartool</name>
@@ -1818,7 +1822,9 @@
<name>jdk.scripting.nashorn.shell</name>
<depend>java.base</depend>
<depend>jdk.scripting.nashorn</depend>
- <depend>jdk.internal.le</depend>
+ <depend>jdk.internal.le</depend> <!-- jline -->
+ <depend>java.desktop</depend> <!-- EditPad -->
+ <depend>java.compiler</depend> <!-- java package completion -->
</module>
<module>
<name>jdk.sctp</name>
--- a/nashorn/.hgtags Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/.hgtags Mon Aug 31 11:26:11 2015 -0700
@@ -312,3 +312,4 @@
ab231613d7206431ba31917a02e7cedd70e88e70 jdk9-b76
33cecbc59f2ad78ac0934cbc3e014d346077e848 jdk9-b77
6f634e84387e97b2421d5e776e46935784156d1c jdk9-b78
+9b3eca69b88b2d1bebce92d58280ae66fc0b6091 jdk9-b79
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/classes.js Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,47 @@
+// Usage: jjs classes.js [ -- <java_package_name > ]
+
+/*
+ * 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.
+ */
+
+// print all Java classes of the given package and its subpackages.
+var pkg = arguments.length > 0? arguments[0] : "java.lang";
+
+with (new JavaImporter(javax.tools, java.util)) {
+ var compiler = ToolProvider.systemJavaCompiler;
+ var fm = compiler.getStandardFileManager(null, null, null);
+ var kinds = EnumSet.of(JavaFileObject.Kind.CLASS);
+ var loc = StandardLocation.PLATFORM_CLASS_PATH;
+ var itr = fm.list(loc, pkg, kinds, true).iterator();
+ while(itr.hasNext()) {
+ print(fm.inferBinaryName(loc, itr.next()));
+ }
+ fm.close();
+}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Mon Aug 31 11:26:11 2015 -0700
@@ -34,6 +34,11 @@
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import jdk.internal.jline.NoInterruptUnixTerminal;
+import jdk.internal.jline.Terminal;
+import jdk.internal.jline.TerminalFactory;
+import jdk.internal.jline.TerminalFactory.Flavor;
+import jdk.internal.jline.WindowsTerminal;
import jdk.internal.jline.console.ConsoleReader;
import jdk.internal.jline.console.completer.Completer;
import jdk.internal.jline.console.history.FileHistory;
@@ -45,6 +50,8 @@
Console(final InputStream cmdin, final PrintStream cmdout, final File historyFile,
final Completer completer) throws IOException {
in = new ConsoleReader(cmdin, cmdout);
+ TerminalFactory.registerFlavor(Flavor.WINDOWS, JJSWindowsTerminal :: new);
+ TerminalFactory.registerFlavor(Flavor.UNIX, JJSUnixTerminal :: new);
in.setExpandEvents(false);
in.setHandleUserInterrupt(true);
in.setBellEnabled(true);
@@ -71,4 +78,60 @@
FileHistory getHistory() {
return (FileHistory) in.getHistory();
}
+
+ boolean terminalEditorRunning() {
+ Terminal terminal = in.getTerminal();
+ if (terminal instanceof JJSUnixTerminal) {
+ return ((JJSUnixTerminal) terminal).isRaw();
+ }
+ return false;
+ }
+
+ void suspend() {
+ try {
+ in.getTerminal().restore();
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ void resume() {
+ try {
+ in.getTerminal().init();
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ static final class JJSUnixTerminal extends NoInterruptUnixTerminal {
+ JJSUnixTerminal() throws Exception {
+ }
+
+ boolean isRaw() {
+ try {
+ return getSettings().get("-a").contains("-icanon");
+ } catch (IOException | InterruptedException ex) {
+ return false;
+ }
+ }
+
+ @Override
+ public void disableInterruptCharacter() {
+ }
+
+ @Override
+ public void enableInterruptCharacter() {
+ }
+ }
+
+ static final class JJSWindowsTerminal extends WindowsTerminal {
+ public JJSWindowsTerminal() throws Exception {
+ }
+
+ @Override
+ public void init() throws Exception {
+ super.init();
+ setAnsiSupported(false);
+ }
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/EditObject.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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.tools.jjs;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.function.Consumer;
+import jdk.nashorn.api.scripting.AbstractJSObject;
+import jdk.nashorn.internal.runtime.JSType;
+import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
+/*
+ * "edit" top level script function which shows an external Window
+ * for editing and evaluating scripts from it.
+ */
+final class EditObject extends AbstractJSObject {
+ private static final Set<String> props;
+ static {
+ final HashSet<String> s = new HashSet<>();
+ s.add("editor");
+ props = Collections.unmodifiableSet(s);
+ }
+
+ private final Console console;
+ private final Consumer<String> errorHandler;
+ private final Consumer<String> evaluator;
+ private String editor;
+
+ EditObject(final Console console, final Consumer<String> errorHandler,
+ final Consumer<String> evaluator) {
+ this.console = console;
+ this.errorHandler = errorHandler;
+ this.evaluator = evaluator;
+ }
+
+ @Override
+ public Object getDefaultValue(final Class<?> hint) {
+ if (hint == String.class) {
+ return toString();
+ }
+ return UNDEFINED;
+ }
+
+ @Override
+ public String toString() {
+ return "function edit() { [native code] }";
+ }
+
+ @Override
+ public Set<String> keySet() {
+ return props;
+ }
+
+ @Override
+ public Object getMember(final String name) {
+ if (name.equals("editor")) {
+ return editor;
+ }
+ return UNDEFINED;
+ }
+
+ @Override
+ public void setMember(final String name, final Object value) {
+ if (name.equals("editor")) {
+ this.editor = value != null && value != UNDEFINED? JSType.toString(value) : "";
+ }
+ }
+
+ // called whenever user 'saves' script in editor
+ class SaveHandler implements Consumer<String> {
+ private String lastStr; // last seen code
+
+ SaveHandler(final String str) {
+ this.lastStr = str;
+ }
+
+ @Override
+ public void accept(final String str) {
+ // ignore repeated save of the same code!
+ if (! str.equals(lastStr)) {
+ this.lastStr = str;
+ // evaluate the new code
+ evaluator.accept(str);
+ }
+ }
+ }
+
+ @Override
+ public Object call(final Object thiz, final Object... args) {
+ final String initText = args.length > 0? JSType.toString(args[0]) : "";
+ final SaveHandler saveHandler = new SaveHandler(initText);
+ if (editor != null && !editor.isEmpty()) {
+ ExternalEditor.edit(editor, errorHandler, initText, saveHandler, console);
+ } else if (! Main.HEADLESS) {
+ EditPad.edit(errorHandler, initText, saveHandler);
+ } else {
+ errorHandler.accept(Main.getMessage("no.editor"));
+ }
+ return UNDEFINED;
+ }
+
+ @Override
+ public boolean isFunction() {
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/EditPad.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,136 @@
+/*
+ * 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.tools.jjs;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.function.Consumer;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+/**
+ * A minimal Swing editor as a fallback when the user does not specify an
+ * external editor.
+ */
+final class EditPad extends JFrame implements Runnable {
+ private static final long serialVersionUID = 1;
+ private final Consumer<String> errorHandler;
+ private final String initialText;
+ private final boolean[] closeLock;
+ private final Consumer<String> saveHandler;
+
+ EditPad(Consumer<String> errorHandler, String initialText,
+ boolean[] closeLock, Consumer<String> saveHandler) {
+ super("Edit Pad (Experimental)");
+ this.errorHandler = errorHandler;
+ this.initialText = initialText;
+ this.closeLock = closeLock;
+ this.saveHandler = saveHandler;
+ }
+
+ @Override
+ public void run() {
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ EditPad.this.dispose();
+ notifyClose();
+ }
+ });
+ setLocationRelativeTo(null);
+ setLayout(new BorderLayout());
+ JTextArea textArea = new JTextArea(initialText);
+ add(new JScrollPane(textArea), BorderLayout.CENTER);
+ add(buttons(textArea), BorderLayout.SOUTH);
+
+ setSize(800, 600);
+ setVisible(true);
+ }
+
+ private JPanel buttons(JTextArea textArea) {
+ FlowLayout flow = new FlowLayout();
+ flow.setHgap(35);
+ JPanel buttons = new JPanel(flow);
+ JButton cancel = new JButton("Cancel");
+ cancel.setMnemonic(KeyEvent.VK_C);
+ JButton accept = new JButton("Accept");
+ accept.setMnemonic(KeyEvent.VK_A);
+ JButton exit = new JButton("Exit");
+ exit.setMnemonic(KeyEvent.VK_X);
+ buttons.add(cancel);
+ buttons.add(accept);
+ buttons.add(exit);
+
+ cancel.addActionListener(e -> {
+ close();
+ });
+ accept.addActionListener(e -> {
+ saveHandler.accept(textArea.getText());
+ });
+ exit.addActionListener(e -> {
+ saveHandler.accept(textArea.getText());
+ close();
+ });
+
+ return buttons;
+ }
+
+ private void close() {
+ setVisible(false);
+ dispose();
+ notifyClose();
+ }
+
+ private void notifyClose() {
+ synchronized (closeLock) {
+ closeLock[0] = true;
+ closeLock.notify();
+ }
+ }
+
+ static void edit(Consumer<String> errorHandler, String initialText,
+ Consumer<String> saveHandler) {
+ boolean[] closeLock = new boolean[1];
+ SwingUtilities.invokeLater(
+ new EditPad(errorHandler, initialText, closeLock, saveHandler));
+ synchronized (closeLock) {
+ while (!closeLock[0]) {
+ try {
+ closeLock.wait();
+ } catch (InterruptedException ex) {
+ // ignore and loop
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/ExternalEditor.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,152 @@
+/*
+ * 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.tools.jjs;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.ClosedWatchServiceException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.WatchKey;
+import java.nio.file.WatchService;
+import java.util.List;
+import java.util.function.Consumer;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
+
+final class ExternalEditor {
+ private final Consumer<String> errorHandler;
+ private final Consumer<String> saveHandler;
+ private final Console input;
+
+ private WatchService watcher;
+ private Thread watchedThread;
+ private Path dir;
+ private Path tmpfile;
+
+ ExternalEditor(Consumer<String> errorHandler, Consumer<String> saveHandler, Console input) {
+ this.errorHandler = errorHandler;
+ this.saveHandler = saveHandler;
+ this.input = input;
+ }
+
+ private void edit(String cmd, String initialText) {
+ try {
+ setupWatch(initialText);
+ launch(cmd);
+ } catch (IOException ex) {
+ errorHandler.accept(ex.getMessage());
+ }
+ }
+
+ /**
+ * Creates a WatchService and registers the given directory
+ */
+ private void setupWatch(String initialText) throws IOException {
+ this.watcher = FileSystems.getDefault().newWatchService();
+ this.dir = Files.createTempDirectory("REPL");
+ this.tmpfile = Files.createTempFile(dir, null, ".js");
+ Files.write(tmpfile, initialText.getBytes(Charset.forName("UTF-8")));
+ dir.register(watcher,
+ ENTRY_CREATE,
+ ENTRY_DELETE,
+ ENTRY_MODIFY);
+ watchedThread = new Thread(() -> {
+ for (;;) {
+ WatchKey key;
+ try {
+ key = watcher.take();
+ } catch (ClosedWatchServiceException ex) {
+ break;
+ } catch (InterruptedException ex) {
+ continue; // tolerate an intrupt
+ }
+
+ if (!key.pollEvents().isEmpty()) {
+ if (!input.terminalEditorRunning()) {
+ saveFile();
+ }
+ }
+
+ boolean valid = key.reset();
+ if (!valid) {
+ errorHandler.accept("Invalid key");
+ break;
+ }
+ }
+ });
+ watchedThread.start();
+ }
+
+ private void launch(String cmd) throws IOException {
+ ProcessBuilder pb = new ProcessBuilder(cmd, tmpfile.toString());
+ pb = pb.inheritIO();
+
+ try {
+ input.suspend();
+ Process process = pb.start();
+ process.waitFor();
+ } catch (IOException ex) {
+ errorHandler.accept("process IO failure: " + ex.getMessage());
+ } catch (InterruptedException ex) {
+ errorHandler.accept("process interrupt: " + ex.getMessage());
+ } finally {
+ try {
+ watcher.close();
+ watchedThread.join(); //so that saveFile() is finished.
+ saveFile();
+ } catch (InterruptedException ex) {
+ errorHandler.accept("process interrupt: " + ex.getMessage());
+ } finally {
+ input.resume();
+ }
+ }
+ }
+
+ private void saveFile() {
+ List<String> lines;
+ try {
+ lines = Files.readAllLines(tmpfile);
+ } catch (IOException ex) {
+ errorHandler.accept("Failure read edit file: " + ex.getMessage());
+ return ;
+ }
+ StringBuilder sb = new StringBuilder();
+ for (String ln : lines) {
+ sb.append(ln);
+ sb.append('\n');
+ }
+ saveHandler.accept(sb.toString());
+ }
+
+ static void edit(String cmd, Consumer<String> errorHandler, String initialText,
+ Consumer<String> saveHandler, Console input) {
+ ExternalEditor ed = new ExternalEditor(errorHandler, saveHandler, input);
+ ed.edit(cmd, initialText);
+ }
+}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/HistoryObject.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/HistoryObject.java Mon Aug 31 11:26:11 2015 -0700
@@ -25,16 +25,23 @@
package jdk.nashorn.tools.jjs;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
import java.io.IOException;
+import java.io.PrintWriter;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import java.util.function.Consumer;
import java.util.function.Function;
+import java.util.function.Supplier;
import jdk.internal.jline.console.history.FileHistory;
import jdk.internal.jline.console.history.History;
import jdk.nashorn.api.scripting.AbstractJSObject;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.internal.runtime.JSType;
+import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
/*
@@ -46,15 +53,51 @@
final HashSet<String> s = new HashSet<>();
s.add("clear");
s.add("forEach");
+ s.add("load");
s.add("print");
+ s.add("save");
s.add("size");
+ s.add("toString");
props = Collections.unmodifiableSet(s);
}
private final FileHistory hist;
+ private final PrintWriter err;
+ private final Consumer<String> evaluator;
- HistoryObject(final FileHistory hist) {
+ HistoryObject(final FileHistory hist, final PrintWriter err,
+ final Consumer<String> evaluator) {
this.hist = hist;
+ this.err = err;
+ this.evaluator = evaluator;
+ }
+
+ @Override
+ public boolean isFunction() {
+ return true;
+ }
+
+ @Override
+ public Object call(final Object thiz, final Object... args) {
+ if (args.length > 0) {
+ int index = JSType.toInteger(args[0]);
+ if (index < 0) {
+ index += (hist.size() - 1);
+ } else {
+ index--;
+ }
+
+ if (index >= 0 && index < (hist.size() - 1)) {
+ final CharSequence src = hist.get(index);
+ hist.replace(src);
+ err.println(src);
+ evaluator.accept(src.toString());
+ } else {
+ hist.removeLast();
+ err.println("no history entry @ " + (index + 1));
+ }
+ }
+ return UNDEFINED;
}
@Override
@@ -64,10 +107,16 @@
return (Runnable)hist::clear;
case "forEach":
return (Function<JSObject, Object>)this::iterate;
+ case "load":
+ return (Consumer<Object>)this::load;
case "print":
return (Runnable)this::print;
+ case "save":
+ return (Consumer<Object>)this::save;
case "size":
return hist.size();
+ case "toString":
+ return (Supplier<String>)this::toString;
}
return UNDEFINED;
}
@@ -82,7 +131,11 @@
@Override
public String toString() {
- return "[object history]";
+ final StringBuilder buf = new StringBuilder();
+ for (History.Entry e : hist) {
+ buf.append(e.value()).append('\n');
+ }
+ return buf.toString();
}
@Override
@@ -90,9 +143,32 @@
return props;
}
+ private void save(final Object obj) {
+ final File file = getFile(obj);
+ try (final PrintWriter pw = new PrintWriter(file)) {
+ for (History.Entry e : hist) {
+ pw.println(e.value());
+ }
+ } catch (final IOException exp) {
+ throw new RuntimeException(exp);
+ }
+ }
+
+ private void load(final Object obj) {
+ final File file = getFile(obj);
+ String item = null;
+ try (final BufferedReader r = new BufferedReader(new FileReader(file))) {
+ while ((item = r.readLine()) != null) {
+ hist.add(item);
+ }
+ } catch (final IOException exp) {
+ throw new RuntimeException(exp);
+ }
+ }
+
private void print() {
for (History.Entry e : hist) {
- System.out.println(e.value());
+ System.out.printf("%3d %s\n", e.index() + 1, e.value());
}
}
@@ -104,4 +180,17 @@
}
return UNDEFINED;
}
+
+ private static File getFile(final Object obj) {
+ File file = null;
+ if (obj instanceof String) {
+ file = new File((String)obj);
+ } else if (obj instanceof File) {
+ file = (File)obj;
+ } else {
+ throw typeError("not.a.file", JSType.toString(obj));
+ }
+
+ return file;
+ }
}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Mon Aug 31 11:26:11 2015 -0700
@@ -25,6 +25,7 @@
package jdk.nashorn.tools.jjs;
+import java.awt.GraphicsEnvironment;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
@@ -32,12 +33,14 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
+import java.util.function.Consumer;
import jdk.internal.jline.console.completer.Completer;
import jdk.internal.jline.console.UserInterruptException;
import jdk.nashorn.api.scripting.NashornException;
import jdk.nashorn.internal.objects.Global;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.Property;
import jdk.nashorn.internal.runtime.ScriptEnvironment;
import jdk.nashorn.internal.runtime.ScriptRuntime;
import jdk.nashorn.tools.Shell;
@@ -48,6 +51,9 @@
public final class Main extends Shell {
private Main() {}
+ static final boolean DEBUG = Boolean.getBoolean("nashorn.jjs.debug");
+ static final boolean HEADLESS = GraphicsEnvironment.isHeadless();
+
// file where history is persisted.
private static final File HIST_FILE = new File(new File(System.getProperty("user.home")), ".jjs.history");
@@ -96,10 +102,12 @@
protected int readEvalPrint(final Context context, final Global global) {
final ScriptEnvironment env = context.getEnv();
final String prompt = bundle.getString("shell.prompt");
+ final String prompt2 = bundle.getString("shell.prompt2");
final PrintWriter err = context.getErr();
final Global oldGlobal = Context.getGlobal();
final boolean globalChanged = (oldGlobal != global);
- final Completer completer = new NashornCompleter(context, global, this);
+ final PropertiesHelper propsHelper = new PropertiesHelper(env._classpath);
+ final NashornCompleter completer = new NashornCompleter(context, global, this, propsHelper);
try (final Console in = new Console(System.in, System.out, HIST_FILE, completer)) {
if (globalChanged) {
@@ -107,8 +115,30 @@
}
global.addShellBuiltins();
- // expose history object for reflecting on command line history
- global.put("history", new HistoryObject(in.getHistory()), false);
+
+ if (System.getSecurityManager() == null) {
+ final Consumer<String> evaluator = str -> {
+ // could be called from different thread (GUI), we need to handle Context set/reset
+ final Global _oldGlobal = Context.getGlobal();
+ final boolean _globalChanged = (oldGlobal != global);
+ if (_globalChanged) {
+ Context.setGlobal(global);
+ }
+ try {
+ evalImpl(context, global, str, err, env._dump_on_error);
+ } finally {
+ if (_globalChanged) {
+ Context.setGlobal(_oldGlobal);
+ }
+ }
+ };
+
+ // expose history object for reflecting on command line history
+ global.addOwnProperty("history", Property.NOT_ENUMERABLE, new HistoryObject(in.getHistory(), err, evaluator));
+
+ // 'edit' command
+ global.addOwnProperty("edit", Property.NOT_ENUMERABLE, new EditObject(in, err::println, evaluator));
+ }
while (true) {
String source = "";
@@ -133,10 +163,25 @@
if (res != ScriptRuntime.UNDEFINED) {
err.println(JSType.toString(res));
}
- } catch (final Exception e) {
- err.println(e);
- if (env._dump_on_error) {
- e.printStackTrace(err);
+ } catch (final Exception exp) {
+ // Is this a ECMAScript SyntaxError at last column (of the single line)?
+ // If so, it is because parser expected more input but got EOF. Try to
+ // to more lines from the user (multiline edit support).
+
+ if (completer.isSyntaxErrorAt(exp, 1, source.length())) {
+ final String fullSrc = completer.readMoreLines(source, exp, in, prompt2, err);
+
+ // check if we succeeded in getting complete code.
+ if (fullSrc != null && !fullSrc.isEmpty()) {
+ evalImpl(context, global, fullSrc, err, env._dump_on_error);
+ } // else ignore, error reported already by 'completer.readMoreLines'
+ } else {
+
+ // can't read more lines to have parseable/complete code.
+ err.println(exp);
+ if (env._dump_on_error) {
+ exp.printStackTrace(err);
+ }
}
}
}
@@ -149,8 +194,34 @@
if (globalChanged) {
Context.setGlobal(oldGlobal);
}
+ try {
+ propsHelper.close();
+ } catch (final Exception exp) {
+ if (DEBUG) {
+ exp.printStackTrace();
+ }
+ }
}
return SUCCESS;
}
+
+ static String getMessage(final String id) {
+ return bundle.getString(id);
+ }
+
+ private void evalImpl(final Context context, final Global global, final String source,
+ final PrintWriter err, final boolean doe) {
+ try {
+ final Object res = context.eval(global, source, global, "<shell>");
+ if (res != ScriptRuntime.UNDEFINED) {
+ err.println(JSType.toString(res));
+ }
+ } catch (final Exception e) {
+ err.println(e);
+ if (doe) {
+ e.printStackTrace(err);
+ }
+ }
+ }
}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/NashornCompleter.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/NashornCompleter.java Mon Aug 31 11:26:11 2015 -0700
@@ -25,9 +25,18 @@
package jdk.nashorn.tools.jjs;
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.FutureTask;
import java.util.regex.Pattern;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import javax.swing.SwingUtilities;
import jdk.internal.jline.console.completer.Completer;
+import jdk.internal.jline.console.UserInterruptException;
import jdk.nashorn.api.tree.AssignmentTree;
import jdk.nashorn.api.tree.BinaryTree;
import jdk.nashorn.api.tree.CompilationUnitTree;
@@ -46,28 +55,143 @@
import jdk.nashorn.api.tree.Parser;
import jdk.nashorn.api.scripting.NashornException;
import jdk.nashorn.tools.PartialParser;
+import jdk.nashorn.internal.objects.NativeSyntaxError;
import jdk.nashorn.internal.objects.Global;
+import jdk.nashorn.internal.runtime.ECMAException;
import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ScriptEnvironment;
import jdk.nashorn.internal.runtime.ScriptRuntime;
-// A simple source completer for nashorn
+/**
+ * A simple source completer for nashorn. Handles code completion for
+ * expressions as well as handles incomplete single line code.
+ */
final class NashornCompleter implements Completer {
private final Context context;
private final Global global;
+ private final ScriptEnvironment env;
private final PartialParser partialParser;
+ private final PropertiesHelper propsHelper;
private final Parser parser;
+ private static final boolean BACKSLASH_FILE_SEPARATOR = File.separatorChar == '\\';
- NashornCompleter(final Context context, final Global global, final PartialParser partialParser) {
+ NashornCompleter(final Context context, final Global global,
+ final PartialParser partialParser, final PropertiesHelper propsHelper) {
this.context = context;
this.global = global;
+ this.env = context.getEnv();
this.partialParser = partialParser;
- this.parser = Parser.create();
+ this.propsHelper = propsHelper;
+ this.parser = createParser(env);
+ }
+
+
+ /**
+ * Is this a ECMAScript SyntaxError thrown for parse issue at the given line and column?
+ *
+ * @param exp Throwable to check
+ * @param line line number to check
+ * @param column column number to check
+ *
+ * @return true if the given Throwable is a ECMAScript SyntaxError at given line, column
+ */
+ boolean isSyntaxErrorAt(final Throwable exp, final int line, final int column) {
+ if (exp instanceof ECMAException) {
+ final ECMAException eexp = (ECMAException)exp;
+ if (eexp.getThrown() instanceof NativeSyntaxError) {
+ return isParseErrorAt(eexp.getCause(), line, column);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Is this a parse error at the given line and column?
+ *
+ * @param exp Throwable to check
+ * @param line line number to check
+ * @param column column number to check
+ *
+ * @return true if the given Throwable is a parser error at given line, column
+ */
+ boolean isParseErrorAt(final Throwable exp, final int line, final int column) {
+ if (exp instanceof NashornException) {
+ final NashornException nexp = (NashornException)exp;
+ return nexp.getLineNumber() == line && nexp.getColumnNumber() == column;
+ }
+ return false;
+ }
+
+
+ /**
+ * Read more lines of code if we got SyntaxError at EOF and we can it fine by
+ * by reading more lines of code from the user. This is used for multiline editing.
+ *
+ * @param firstLine First line of code from the user
+ * @param exp Exception thrown by evaluting first line code
+ * @param in Console to get read more lines from the user
+ * @param prompt Prompt to be printed to read more lines from the user
+ * @param err PrintWriter to print any errors in the proecess of reading
+ *
+ * @return Complete code read from the user including the first line. This is null
+ * if any error or the user discarded multiline editing by Ctrl-C.
+ */
+ String readMoreLines(final String firstLine, final Exception exp, final Console in,
+ final String prompt, final PrintWriter err) {
+ int line = 1;
+ final StringBuilder buf = new StringBuilder(firstLine);
+ while (true) {
+ buf.append('\n');
+ String curLine = null;
+ try {
+ curLine = in.readLine(prompt);
+ buf.append(curLine);
+ line++;
+ } catch (final Throwable th) {
+ if (th instanceof UserInterruptException) {
+ // Ctrl-C from user - discard the whole thing silently!
+ return null;
+ } else {
+ // print anything else -- but still discard the code
+ err.println(th);
+ if (env._dump_on_error) {
+ th.printStackTrace(err);
+ }
+ return null;
+ }
+ }
+
+ final String allLines = buf.toString();
+ try {
+ parser.parse("<shell>", allLines, null);
+ } catch (final Exception pexp) {
+ // Do we have a parse error at the end of current line?
+ // If so, read more lines from the console.
+ if (isParseErrorAt(pexp, line, curLine.length())) {
+ continue;
+ } else {
+ // print anything else and bail out!
+ err.println(pexp);
+ if (env._dump_on_error) {
+ pexp.printStackTrace(err);
+ }
+ return null;
+ }
+ }
+
+ // We have complete parseable code!
+ return buf.toString();
+ }
}
// Pattern to match a unfinished member selection expression. object part and "."
// but property name missing pattern.
private static final Pattern SELECT_PROP_MISSING = Pattern.compile(".*\\.\\s*");
+ // Pattern to match load call
+ private static final Pattern LOAD_CALL = Pattern.compile("\\s*load\\s*\\(\\s*");
+
@Override
public int complete(final String test, final int cursor, final List<CharSequence> result) {
// check that cursor is at the end of test string. Do not complete in the middle!
@@ -96,6 +220,19 @@
final ExpressionTree topExpr = getTopLevelExpression(parser, completeExpr);
if (topExpr == null) {
+ // special case for load call that looks like "load(" with optional whitespaces
+ if (LOAD_CALL.matcher(test).matches()) {
+ String name = readFileName(context.getErr());
+ if (name != null) {
+ // handle '\' file separator
+ if (BACKSLASH_FILE_SEPARATOR) {
+ name = name.replace("\\", "\\\\");
+ }
+ result.add("\"" + name + "\")");
+ return cursor + name.length() + 3;
+ }
+ }
+
// did not parse to be a top level expression, no suggestions!
return cursor;
}
@@ -113,6 +250,38 @@
}
}
+ // Internals only below this point
+
+ // read file name from the user using by showing a swing file chooser diablog
+ private static String readFileName(final PrintWriter err) {
+ // if running on AWT Headless mode, don't attempt swing dialog box!
+ if (Main.HEADLESS) {
+ return null;
+ }
+
+ final FutureTask<String> fileChooserTask = new FutureTask<String>(() -> {
+ // show a file chooser dialog box
+ final JFileChooser chooser = new JFileChooser();
+ chooser.setFileFilter(new FileNameExtensionFilter("JavaScript Files", "js"));
+ final int retVal = chooser.showOpenDialog(null);
+ return retVal == JFileChooser.APPROVE_OPTION ?
+ chooser.getSelectedFile().getAbsolutePath() : null;
+ });
+
+ SwingUtilities.invokeLater(fileChooserTask);
+
+ try {
+ return fileChooserTask.get();
+ } catch (final ExecutionException | InterruptedException e) {
+ err.println(e);
+ if (Main.DEBUG) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ // fill properties of the incomplete member expression
private int completeMemberSelect(final String exprStr, final int cursor, final List<CharSequence> result,
final MemberSelectTree select, final boolean endsWithDot) {
final ExpressionTree objExpr = select.getExpression();
@@ -122,19 +291,22 @@
Object obj = null;
try {
obj = context.eval(global, objExprCode, global, "<suggestions>");
- } catch (Exception ignored) {
- // throw the exception - this is during tab-completion
+ } catch (Exception exp) {
+ // throw away the exception - this is during tab-completion
+ if (Main.DEBUG) {
+ exp.printStackTrace();
+ }
}
if (obj != null && obj != ScriptRuntime.UNDEFINED) {
if (endsWithDot) {
// no user specified "prefix". List all properties of the object
- result.addAll(PropertiesHelper.getProperties(obj));
+ result.addAll(propsHelper.getProperties(obj));
return cursor;
} else {
// list of properties matching the user specified prefix
final String prefix = select.getIdentifier();
- result.addAll(PropertiesHelper.getProperties(obj, prefix));
+ result.addAll(propsHelper.getProperties(obj, prefix));
return cursor - prefix.length();
}
}
@@ -142,10 +314,11 @@
return cursor;
}
+ // fill properties for the given (partial) identifer
private int completeIdentifier(final String test, final int cursor, final List<CharSequence> result,
final IdentifierTree ident) {
final String name = ident.getName();
- result.addAll(PropertiesHelper.getProperties(global, name));
+ result.addAll(propsHelper.getProperties(global, name));
return cursor - name.length();
}
@@ -169,6 +342,7 @@
return null;
}
+ // get the right most expreesion of the given expression
private Tree getRightMostExpression(final ExpressionTree expr) {
return expr.accept(new SimpleTreeVisitorES5_1<Tree, Void>() {
@Override
@@ -228,4 +402,27 @@
}
}, null);
}
+
+ // create a Parser instance that uses compatible command line options of the
+ // current ScriptEnvironment being used for REPL.
+ private static Parser createParser(final ScriptEnvironment env) {
+ final List<String> args = new ArrayList<>();
+ if (env._const_as_var) {
+ args.add("--const-as-var");
+ }
+
+ if (env._no_syntax_extensions) {
+ args.add("-nse");
+ }
+
+ if (env._scripting) {
+ args.add("-scripting");
+ }
+
+ if (env._strict) {
+ args.add("-strict");
+ }
+
+ return Parser.create(args.toArray(new String[0]));
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PackagesHelper.java Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,171 @@
+/*
+ * 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.tools.jjs;
+
+import java.io.IOException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+/**
+ * A helper class to compute properties of a Java package object. Properties of
+ * package object are (simple) top level class names in that java package and
+ * immediate subpackages of that package.
+ */
+final class PackagesHelper {
+ // JavaCompiler may be null on certain platforms (eg. JRE)
+ private static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+
+ /**
+ * Is Java package properties helper available?
+ *
+ * @return true if package properties support is available
+ */
+ static boolean isAvailable() {
+ return compiler != null;
+ }
+
+ private final StandardJavaFileManager fm;
+ private final Set<JavaFileObject.Kind> fileKinds;
+
+ /**
+ * Construct a new PackagesHelper.
+ *
+ * @param classPath Class path to compute properties of java package objects
+ */
+ PackagesHelper(final String classPath) throws IOException {
+ assert isAvailable() : "no java compiler found!";
+
+ fm = compiler.getStandardFileManager(null, null, null);
+ fileKinds = EnumSet.of(JavaFileObject.Kind.CLASS);
+
+ if (classPath != null && !classPath.isEmpty()) {
+ fm.setLocation(StandardLocation.CLASS_PATH, getFiles(classPath));
+ } else {
+ // no classpath set. Make sure that it is empty and not any default like "."
+ fm.setLocation(StandardLocation.CLASS_PATH, Collections.<File>emptyList());
+ }
+ }
+
+ // LRU cache for java package properties lists
+ private final LinkedHashMap<String, List<String>> propsCache =
+ new LinkedHashMap<String, List<String>>(32, 0.75f, true) {
+ private static final int CACHE_SIZE = 100;
+ private static final long serialVersionUID = 1;
+
+ @Override
+ protected boolean removeEldestEntry(final Map.Entry<String, List<String>> eldest) {
+ return size() > CACHE_SIZE;
+ }
+ };
+
+ /**
+ * Return the list of properties of the given Java package or package prefix
+ *
+ * @param pkg Java package name or package prefix name
+ * @return the list of properties of the given Java package or package prefix
+ */
+ List<String> getPackageProperties(final String pkg) {
+ // check the cache first
+ if (propsCache.containsKey(pkg)) {
+ return propsCache.get(pkg);
+ }
+
+ try {
+ // make sorted list of properties
+ final List<String> props = new ArrayList<>(listPackage(pkg));
+ Collections.sort(props);
+ propsCache.put(pkg, props);
+ return props;
+ } catch (final IOException exp) {
+ if (Main.DEBUG) {
+ exp.printStackTrace();
+ }
+ return Collections.<String>emptyList();
+ }
+ }
+
+ public void close() throws IOException {
+ fm.close();
+ }
+
+ private Set<String> listPackage(final String pkg) throws IOException {
+ final Set<String> props = new HashSet<>();
+ listPackage(StandardLocation.PLATFORM_CLASS_PATH, pkg, props);
+ listPackage(StandardLocation.CLASS_PATH, pkg, props);
+ return props;
+ }
+
+ private void listPackage(final Location loc, final String pkg, final Set<String> props)
+ throws IOException {
+ for (JavaFileObject file : fm.list(loc, pkg, fileKinds, true)) {
+ final String binaryName = fm.inferBinaryName(loc, file);
+ // does not start with the given package prefix
+ if (!binaryName.startsWith(pkg + ".")) {
+ continue;
+ }
+
+ final int nextDot = binaryName.indexOf('.', pkg.length() + 1);
+ final int start = pkg.length() + 1;
+
+ if (nextDot != -1) {
+ // subpackage - eg. "regex" for "java.util"
+ props.add(binaryName.substring(start, nextDot));
+ } else {
+ // class - filter out nested, inner, anonymous, local classes.
+ // Dynalink supported public nested classes as properties of
+ // StaticClass object anyway. We don't want to expose those
+ // "$" internal names as properties of package object.
+
+ final String clsName = binaryName.substring(start);
+ if (clsName.indexOf('$') == -1) {
+ props.add(clsName);
+ }
+ }
+ }
+ }
+
+ // return list of File objects for the given class path
+ private static List<File> getFiles(final String classPath) {
+ return Stream.of(classPath.split(File.pathSeparator))
+ .map(File::new)
+ .collect(Collectors.toList());
+ }
+}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PropertiesHelper.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PropertiesHelper.java Mon Aug 31 11:26:11 2015 -0700
@@ -25,6 +25,7 @@
package jdk.nashorn.tools.jjs;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -32,6 +33,7 @@
import java.util.WeakHashMap;
import java.util.stream.Collectors;
import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.NativeJavaPackage;
import jdk.nashorn.internal.runtime.PropertyMap;
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -41,19 +43,59 @@
* A helper class to get properties of a given object for source code completion.
*/
final class PropertiesHelper {
- private PropertiesHelper() {}
-
+ // Java package properties helper, may be null
+ private PackagesHelper pkgsHelper;
// cached properties list
- private static final WeakHashMap<Object, List<String>> propsCache = new WeakHashMap<>();
+ private final WeakHashMap<Object, List<String>> propsCache = new WeakHashMap<>();
- // returns the list of properties of the given object
- static List<String> getProperties(final Object obj) {
+ /**
+ * Construct a new PropertiesHelper.
+ *
+ * @param classPath Class path to compute properties of java package objects
+ */
+ PropertiesHelper(final String classPath) {
+ if (PackagesHelper.isAvailable()) {
+ try {
+ this.pkgsHelper = new PackagesHelper(classPath);
+ } catch (final IOException exp) {
+ if (Main.DEBUG) {
+ exp.printStackTrace();
+ }
+ this.pkgsHelper = null;
+ }
+ }
+ }
+
+ void close() throws Exception {
+ propsCache.clear();
+ pkgsHelper.close();
+ }
+
+ /**
+ * returns the list of properties of the given object.
+ *
+ * @param obj object whose property list is returned
+ * @return the list of properties of the given object
+ */
+ List<String> getProperties(final Object obj) {
assert obj != null && obj != ScriptRuntime.UNDEFINED;
+ // wrap JS primitives as objects before gettting properties
if (JSType.isPrimitive(obj)) {
return getProperties(JSType.toScriptObject(obj));
}
+ // Handle Java package prefix case first. Should do it before checking
+ // for its super class ScriptObject!
+ if (obj instanceof NativeJavaPackage) {
+ if (pkgsHelper != null) {
+ return pkgsHelper.getPackageProperties(((NativeJavaPackage)obj).getName());
+ } else {
+ return Collections.<String>emptyList();
+ }
+ }
+
+ // script object - all inherited and non-enumerable, non-index properties
if (obj instanceof ScriptObject) {
final ScriptObject sobj = (ScriptObject)obj;
final PropertyMap pmap = sobj.getMap();
@@ -71,6 +113,7 @@
return props;
}
+ // java class case - don't refer to StaticClass directly
if (NativeJava.isType(ScriptRuntime.UNDEFINED, obj)) {
if (propsCache.containsKey(obj)) {
return propsCache.get(obj);
@@ -82,6 +125,7 @@
return props;
}
+ // any other Java object
final Class<?> clazz = obj.getClass();
if (propsCache.containsKey(clazz)) {
return propsCache.get(clazz);
@@ -94,8 +138,14 @@
return props;
}
- // returns the list of properties of the given object that start with the given prefix
- static List<String> getProperties(final Object obj, final String prefix) {
+ /**
+ * Returns the list of properties of the given object that start with the given prefix.
+ *
+ * @param obj object whose property list is returned
+ * @param prefix property prefix to be matched
+ * @return the list of properties of the given object
+ */
+ List<String> getProperties(final Object obj, final String prefix) {
assert prefix != null && !prefix.isEmpty();
return getProperties(obj).stream()
.filter(s -> s.startsWith(prefix))
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Mon Aug 31 11:26:11 2015 -0700
@@ -249,7 +249,7 @@
private final Set<String> emittedMethods = new HashSet<>();
// Function Id -> ContinuationInfo. Used by compilation of rest-of function only.
- private final Map<Integer, ContinuationInfo> fnIdToContinuationInfo = new HashMap<>();
+ private ContinuationInfo continuationInfo;
private final Deque<Label> scopeEntryLabels = new ArrayDeque<>();
@@ -349,11 +349,20 @@
final int flags = getScopeCallSiteFlags(symbol);
if (isFastScope(symbol)) {
// Only generate shared scope getter for fast-scope symbols so we know we can dial in correct scope.
- if (symbol.getUseCount() > SharedScopeCall.FAST_SCOPE_GET_THRESHOLD && !isOptimisticOrRestOf()) {
- method.loadCompilerConstant(SCOPE);
- // As shared scope vars are only used in non-optimistic compilation, we switch from using TypeBounds to
+ if (symbol.getUseCount() > SharedScopeCall.FAST_SCOPE_GET_THRESHOLD && !identNode.isOptimistic()) {
+ // As shared scope vars are only used with non-optimistic identifiers, we switch from using TypeBounds to
// just a single definitive type, resultBounds.widest.
- loadSharedScopeVar(resultBounds.widest, symbol, flags);
+ new OptimisticOperation(identNode, TypeBounds.OBJECT) {
+ @Override
+ void loadStack() {
+ method.loadCompilerConstant(SCOPE);
+ }
+
+ @Override
+ void consumeStack() {
+ loadSharedScopeVar(resultBounds.widest, symbol, flags);
+ }
+ }.emit();
} else {
new LoadFastScopeVar(identNode, resultBounds, flags).emit();
}
@@ -384,10 +393,6 @@
return continuationEntryPoints != null;
}
- private boolean isOptimisticOrRestOf() {
- return useOptimisticTypes() || isRestOf();
- }
-
private boolean isCurrentContinuationEntryPoint(final int programPoint) {
return isRestOf() && getCurrentContinuationEntryPoint() == programPoint;
}
@@ -464,12 +469,8 @@
}
private MethodEmitter loadSharedScopeVar(final Type valueType, final Symbol symbol, final int flags) {
- assert !isOptimisticOrRestOf();
- if (isFastScope(symbol)) {
- method.load(getScopeProtoDepth(lc.getCurrentBlock(), symbol));
- } else {
- method.load(-1);
- }
+ assert isFastScope(symbol);
+ method.load(getScopeProtoDepth(lc.getCurrentBlock(), symbol));
return lc.getScopeGet(unit, symbol, valueType, flags).generateInvoke(method);
}
@@ -1573,7 +1574,7 @@
} else if (useCount <= SharedScopeCall.FAST_SCOPE_CALL_THRESHOLD
|| !isFastScope(symbol) && useCount <= SharedScopeCall.SLOW_SCOPE_CALL_THRESHOLD
|| CodeGenerator.this.lc.inDynamicScope()
- || isOptimisticOrRestOf()) {
+ || callNode.isOptimistic()) {
scopeCall(node, flags);
} else {
sharedScopeCall(node, flags);
@@ -2070,8 +2071,6 @@
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
- final int fnId = functionNode.getId();
-
if (skipFunction(functionNode)) {
// In case we are not generating code for the function, we must create or retrieve the function object and
// load it on the stack here.
@@ -2109,9 +2108,9 @@
method.begin();
if (isRestOf()) {
- final ContinuationInfo ci = new ContinuationInfo();
- fnIdToContinuationInfo.put(fnId, ci);
- method.gotoLoopStart(ci.getHandlerLabel());
+ assert continuationInfo == null;
+ continuationInfo = new ContinuationInfo();
+ method.gotoLoopStart(continuationInfo.getHandlerLabel());
}
}
@@ -5308,7 +5307,7 @@
}
private ContinuationInfo getContinuationInfo() {
- return fnIdToContinuationInfo.get(lc.getCurrentFunction().getId());
+ return continuationInfo;
}
private void generateContinuationHandler() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Mon Aug 31 11:26:11 2015 -0700
@@ -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
@@ -1451,9 +1451,22 @@
skip(3);
}
- // Scan identifier.
+ // Scan identifier. It might be quoted, indicating that no string editing should take place.
+ final char quoteChar = ch0;
+ final boolean noStringEditing = quoteChar == '"' || quoteChar == '\'';
+ if (noStringEditing) {
+ skip(1);
+ }
final int identStart = position;
final int identLength = scanIdentifier();
+ if (noStringEditing) {
+ if (ch0 != quoteChar) {
+ error(Lexer.message("here.non.matching.delimiter"), last, position, position);
+ restoreState(saved);
+ return false;
+ }
+ skip(1);
+ }
// Check for identifier.
if (identLength == 0) {
@@ -1523,7 +1536,7 @@
}
// Edit string if appropriate.
- if (scripting && !stringState.isEmpty()) {
+ if (!noStringEditing && !stringState.isEmpty()) {
editString(STRING, stringState);
} else {
// Add here string.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java Mon Aug 31 11:26:11 2015 -0700
@@ -46,6 +46,11 @@
* and output and error writers, top level Namespace etc.
*/
public final class ScriptEnvironment {
+ // Primarily intended to be used in test environments so that eager compilation tests work without an
+ // error when tested with optimistic compilation.
+ private static final boolean ALLOW_EAGER_COMPILATION_SILENT_OVERRIDE = Options.getBooleanProperty(
+ "nashorn.options.allowEagerCompilationSilentOverride", false);
+
/** Output writer for this environment */
private final PrintWriter out;
@@ -61,6 +66,9 @@
/** Size of the per-global Class cache size */
public final int _class_cache_size;
+ /** -classpath value. */
+ public final String _classpath;
+
/** Only compile script, do not run it or generate other ScriptObjects */
public final boolean _compile_only;
@@ -220,6 +228,7 @@
this.options = options;
_class_cache_size = options.getInteger("class.cache.size");
+ _classpath = options.getString("classpath");
_compile_only = options.getBoolean("compile.only");
_const_as_var = options.getBoolean("const.as.var");
_debug_lines = options.getBoolean("debug.lines");
@@ -237,8 +246,20 @@
}
_fx = options.getBoolean("fx");
_global_per_engine = options.getBoolean("global.per.engine");
- _lazy_compilation = options.getBoolean("lazy.compilation");
_optimistic_types = options.getBoolean("optimistic.types");
+ final boolean lazy_compilation = options.getBoolean("lazy.compilation");
+ if (!lazy_compilation && _optimistic_types) {
+ if (!ALLOW_EAGER_COMPILATION_SILENT_OVERRIDE) {
+ throw new IllegalStateException(
+ ECMAErrors.getMessage(
+ "config.error.eagerCompilationConflictsWithOptimisticTypes",
+ options.getOptionTemplateByKey("lazy.compilation").getName(),
+ options.getOptionTemplateByKey("optimistic.types").getName()));
+ }
+ _lazy_compilation = true;
+ } else {
+ _lazy_compilation = lazy_compilation;
+ }
_loader_per_compile = options.getBoolean("loader.per.compile");
_no_java = options.getBoolean("no.java");
_no_syntax_extensions = options.getBoolean("no.syntax.extensions");
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Timing.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Timing.java Mon Aug 31 11:26:11 2015 -0700
@@ -28,12 +28,14 @@
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.function.Function;
import java.util.function.Supplier;
-
import jdk.nashorn.internal.codegen.CompileUnit;
import jdk.nashorn.internal.runtime.logging.DebugLogger;
import jdk.nashorn.internal.runtime.logging.Loggable;
@@ -156,11 +158,12 @@
}
final class TimeSupplier implements Supplier<String> {
- private final Map<String, Long> timings;
-
- TimeSupplier() {
- timings = new LinkedHashMap<>();
- }
+ private final Map<String, LongAdder> timings = new ConcurrentHashMap<>();
+ private final LinkedBlockingQueue<String> orderedTimingNames = new LinkedBlockingQueue<>();
+ private final Function<String, LongAdder> newTimingCreator = s -> {
+ orderedTimingNames.add(s);
+ return new LongAdder();
+ };
String[] getStrings() {
final List<String> strs = new ArrayList<>();
@@ -184,26 +187,26 @@
int maxKeyLength = 0;
int maxValueLength = 0;
- for (final Map.Entry<String, Long> entry : timings.entrySet()) {
+ for (final Map.Entry<String, LongAdder> entry : timings.entrySet()) {
maxKeyLength = Math.max(maxKeyLength, entry.getKey().length());
- maxValueLength = Math.max(maxValueLength, toMillisPrint(entry.getValue()).length());
+ maxValueLength = Math.max(maxValueLength, toMillisPrint(entry.getValue().longValue()).length());
}
maxKeyLength++;
final StringBuilder sb = new StringBuilder();
sb.append("Accumulated compilation phase timings:\n\n");
- for (final Map.Entry<String, Long> entry : timings.entrySet()) {
+ for (final String timingName: orderedTimingNames) {
int len;
len = sb.length();
- sb.append(entry.getKey());
+ sb.append(timingName);
len = sb.length() - len;
while (len++ < maxKeyLength) {
sb.append(' ');
}
- final Long duration = entry.getValue();
+ final long duration = timings.get(timingName).longValue();
final String strDuration = toMillisPrint(duration);
len = strDuration.length();
for (int i = 0; i < maxValueLength - len; i++) {
@@ -233,11 +236,7 @@
}
private void accumulateTime(final String module, final long duration) {
- Long accumulatedTime = timings.get(module);
- if (accumulatedTime == null) {
- accumulatedTime = 0L;
- }
- timings.put(module, accumulatedTime + duration);
+ timings.computeIfAbsent(module, newTimingCreator).add(duration);
}
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UserAccessorProperty.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UserAccessorProperty.java Mon Aug 31 11:26:11 2015 -0700
@@ -24,7 +24,6 @@
*/
package jdk.nashorn.internal.runtime;
-
import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
@@ -34,6 +33,7 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
+import java.util.concurrent.Callable;
import jdk.nashorn.internal.lookup.Lookup;
import jdk.nashorn.internal.runtime.linker.Bootstrap;
import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
@@ -80,6 +80,15 @@
private final static MethodHandle INVOKE_LONG_SETTER = findOwnMH_S("invokeLongSetter", void.class, Accessors.class, MethodHandle.class, String.class, Object.class, long.class);
private final static MethodHandle INVOKE_NUMBER_SETTER = findOwnMH_S("invokeNumberSetter", void.class, Accessors.class, MethodHandle.class, String.class, Object.class, double.class);
+ private static final Object OBJECT_GETTER_INVOKER_KEY = new Object();
+ private static MethodHandle getObjectGetterInvoker() {
+ return Context.getGlobal().getDynamicInvoker(OBJECT_GETTER_INVOKER_KEY, new Callable<MethodHandle>() {
+ @Override
+ public MethodHandle call() throws Exception {
+ return getINVOKE_UA_GETTER(Object.class, INVALID_PROGRAM_POINT);
+ }
+ });
+ }
static MethodHandle getINVOKE_UA_GETTER(final Class<?> returnType, final int programPoint) {
if (UnwarrantedOptimismException.isValid(programPoint)) {
@@ -90,6 +99,16 @@
}
}
+ private static final Object OBJECT_SETTER_INVOKER_KEY = new Object();
+ private static MethodHandle getObjectSetterInvoker() {
+ return Context.getGlobal().getDynamicInvoker(OBJECT_SETTER_INVOKER_KEY, new Callable<MethodHandle>() {
+ @Override
+ public MethodHandle call() throws Exception {
+ return getINVOKE_UA_SETTER(Object.class);
+ }
+ });
+ }
+
static MethodHandle getINVOKE_UA_SETTER(final Class<?> valueType) {
return Bootstrap.createDynamicInvoker("dyn:call", void.class, Object.class, Object.class, valueType);
}
@@ -181,7 +200,7 @@
@Override
public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
try {
- return invokeObjectGetter(getAccessors((owner != null) ? owner : self), getINVOKE_UA_GETTER(Object.class, INVALID_PROGRAM_POINT), self);
+ return invokeObjectGetter(getAccessors((owner != null) ? owner : self), getObjectGetterInvoker(), self);
} catch (final Error | RuntimeException t) {
throw t;
} catch (final Throwable t) {
@@ -207,7 +226,7 @@
@Override
public void setValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
try {
- invokeObjectSetter(getAccessors((owner != null) ? owner : self), getINVOKE_UA_SETTER(Object.class), strict ? getKey() : null, self, value);
+ invokeObjectSetter(getAccessors((owner != null) ? owner : self), getObjectSetterInvoker(), strict ? getKey() : null, self, value);
} catch (final Error | RuntimeException t) {
throw t;
} catch (final Throwable t) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/OptionTemplate.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/OptionTemplate.java Mon Aug 31 11:26:11 2015 -0700
@@ -304,8 +304,8 @@
}
}
- boolean matches(final String key0) {
- return key0.equals(this.shortName) || key0.equals(this.name);
+ boolean nameMatches(final String aName) {
+ return aName.equals(this.shortName) || aName.equals(this.name);
}
private static final int LINE_BREAK = 64;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java Mon Aug 31 11:26:11 2015 -0700
@@ -520,9 +520,25 @@
}
}
- private static OptionTemplate getOptionTemplate(final String key) {
+ /**
+ * Retrieves an option template identified by key.
+ * @param shortKey the short (that is without the e.g. "nashorn.option." part) key
+ * @return the option template identified by the key
+ * @throws IllegalArgumentException if the key doesn't specify an existing template
+ */
+ public OptionTemplate getOptionTemplateByKey(final String shortKey) {
+ final String fullKey = key(shortKey);
+ for(final OptionTemplate t: validOptions) {
+ if(t.getKey().equals(fullKey)) {
+ return t;
+ }
+ }
+ throw new IllegalArgumentException(shortKey);
+ }
+
+ private static OptionTemplate getOptionTemplateByName(final String name) {
for (final OptionTemplate t : Options.validOptions) {
- if (t.matches(key)) {
+ if (t.nameMatches(name)) {
return t;
}
}
@@ -682,7 +698,7 @@
}
final String token = st.nextToken();
- this.template = Options.getOptionTemplate(token);
+ this.template = getOptionTemplateByName(token);
if (this.template == null) {
throw new IllegalArgumentException(argument);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Mon Aug 31 11:26:11 2015 -0700
@@ -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
@@ -31,6 +31,7 @@
lexer.error.json.invalid.number=Invalid JSON number format
lexer.error.invalid.escape.char=Invalid escape character
lexer.error.illegal.identifier.character=Illegal character in identifier
+lexer.error.here.non.matching.delimiter=Quoted here string end marker must have matching delimiters
parser.error.illegal.continue.stmt=Illegal continue statement
parser.error.illegal.break.stmt=Illegal break statement
@@ -172,7 +173,9 @@
syntax.error.unprotected.switch.declaration=Unsupported {0} declaration in unprotected switch statement
io.error.cant.write=cannot write "{0}"
+
config.error.no.dest=no destination directory supplied
+config.error.eagerCompilationConflictsWithOptimisticTypes={0}=false (eager compilation) is not compatible with {1}=true.
uri.error.bad.uri=Bad URI "{0}" near offset {1}
list.adapter.null.global=Attempted to create the adapter from outside a JavaScript execution context.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/resources/Shell.properties Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/resources/Shell.properties Mon Aug 31 11:26:11 2015 -0700
@@ -29,4 +29,6 @@
shell.prompt=jjs>
+shell.prompt2=...>
+no.editor=AWT Headless mode set and no external editor is configured!
--- a/nashorn/test/script/basic/JDK-8053905.js Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8053905.js Mon Aug 31 11:26:11 2015 -0700
@@ -28,6 +28,7 @@
* @runif external.octane
* @fork
* @option -Dnashorn.compiler.splitter.threshold=1000
+ * @option -Dnashorn.options.allowEagerCompilationSilentOverride
* @option -scripting
* @option --lazy-compilation=false
*/
--- a/nashorn/test/script/basic/JDK-8058561.js Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8058561.js Mon Aug 31 11:26:11 2015 -0700
@@ -26,7 +26,9 @@
*
* @test
* @run
+ * @fork
* @option --lazy-compilation=false
+ * @option -Dnashorn.options.allowEagerCompilationSilentOverride
*/
// Just attempting to compile this caused the NPE
--- a/nashorn/test/script/basic/JDK-8078612_eager_1a.js Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8078612_eager_1a.js Mon Aug 31 11:26:11 2015 -0700
@@ -29,6 +29,7 @@
* @option -pcc
* @option --lazy-compilation=false
* @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @option -Dnashorn.options.allowEagerCompilationSilentOverride
* @fork
*/
--- a/nashorn/test/script/basic/JDK-8078612_eager_1b.js Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8078612_eager_1b.js Mon Aug 31 11:26:11 2015 -0700
@@ -29,6 +29,7 @@
* @option -pcc
* @option --lazy-compilation=false
* @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @option -Dnashorn.options.allowEagerCompilationSilentOverride
* @fork
*/
--- a/nashorn/test/script/basic/JDK-8078612_eager_2a.js Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8078612_eager_2a.js Mon Aug 31 11:26:11 2015 -0700
@@ -29,6 +29,7 @@
* @option -pcc
* @option --lazy-compilation=false
* @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @option -Dnashorn.options.allowEagerCompilationSilentOverride
* @fork
*/
--- a/nashorn/test/script/basic/JDK-8078612_eager_2b.js Thu Aug 27 14:40:21 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8078612_eager_2b.js Mon Aug 31 11:26:11 2015 -0700
@@ -29,6 +29,7 @@
* @option -pcc
* @option --lazy-compilation=false
* @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @option -Dnashorn.options.allowEagerCompilationSilentOverride
* @fork
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/JDK-8073613.js Mon Aug 31 11:26:11 2015 -0700
@@ -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.
+ *
+ * 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-8073613: Here documents: how to avoid string interpolation?
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var a = 2,
+ b = 3
+
+print(<<EOD)
+${a}${b}
+EOD
+
+print(<<"EOD")
+${a}${b}
+EOD
+
+print(<<'EOM')
+${a}${b}
+EOM
+
+print(<<"EOM")
+$\{a}
+EOM
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/JDK-8073613.js.EXPECTED Mon Aug 31 11:26:11 2015 -0700
@@ -0,0 +1,4 @@
+23
+${a}${b}
+${a}${b}
+$\{a}