8049367: Modular Run-Time Images
Co-authored-by: Alan Bateman <alan.bateman@oracle.com> Co-authored-by: Alex Buckley <alex.buckley@oracle.com> Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com> Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com> Co-authored-by: James Laskey <james.laskey@oracle.com> Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com> Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com> Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com> Co-authored-by: Mandy Chung <mandy.chung@oracle.com> Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com> Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com> Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com> Reviewed-by: jlahoda, ksrini
This commit is contained in:
parent
f141ae6666
commit
8bc2b3ff3a
@ -29,9 +29,9 @@ default: all
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include JavaCompilation.gmk
|
||||
include SetupJavaCompilers.gmk
|
||||
|
||||
include CommonLangtools.gmk
|
||||
|
||||
################################################################################
|
||||
# Setup the rules to build the interim langtools jar, which is compiled by
|
||||
# the boot javac and can be run on the boot jdk. This will be used to compile
|
||||
# the rest of the product. Include the Genstubs build tool in this compilation
|
||||
@ -44,12 +44,12 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_LANGTOOLS, \
|
||||
$(LANGTOOLS_TOPDIR)/src/jdk.dev/share/classes \
|
||||
$(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes \
|
||||
$(LANGTOOLS_TOPDIR)/src/java.base/share/classes \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc, \
|
||||
EXCLUDES := com/sun/tools/javac/nio compileproperties anttasks crules, \
|
||||
COPY := $(RESOURCE_SUFFIXES) jdeps.properties jdkinternals.properties version.properties, \
|
||||
BIN := $(LANGTOOLS_OUTPUTDIR)/interim_classes, \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.compiler \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.dev \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.javadoc, \
|
||||
EXCLUDES := sun jdk, \
|
||||
COPY := .gif .xml .css .js javax.tools.JavaCompilerTool, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_interim_classes, \
|
||||
JAR := $(INTERIM_LANGTOOLS_JAR)))
|
||||
|
||||
all: $(BUILD_INTERIM_LANGTOOLS)
|
||||
|
@ -1,111 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# This must be the first rule
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include JavaCompilation.gmk
|
||||
|
||||
include CommonLangtools.gmk
|
||||
|
||||
################################################################################
|
||||
# Setup the compilation of the properties compilation tool. You can depend
|
||||
# upon $(BUILD_TOOLS_LANGTOOLS) to trigger a compilation of the tools. Note that
|
||||
# we add src/share/classes to the sourcepath. This is necessary since the
|
||||
# GenStubs program needs to be linked and run with the new javac sources.
|
||||
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_LANGTOOLS, \
|
||||
SETUP := BOOT_JAVAC, \
|
||||
DISABLE_SJAVAC := true, \
|
||||
ADD_JAVAC_FLAGS := -Xprefer:source, \
|
||||
SRC := $(LANGTOOLS_TOPDIR)/make/tools, \
|
||||
INCLUDES := compileproperties, \
|
||||
BIN := $(LANGTOOLS_OUTPUTDIR)/buildtools_classes))
|
||||
|
||||
################################################################################
|
||||
# The compileprops tools compiles a properties file into a resource bundle.
|
||||
TOOL_COMPILEPROPS_CMD := $(JAVA) -cp $(LANGTOOLS_OUTPUTDIR)/buildtools_classes \
|
||||
compileproperties.CompileProperties -quiet
|
||||
|
||||
# Lookup the properties that need to be compiled into resource bundles.
|
||||
PROPSOURCES := $(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/*/share/classes -name "*.properties")
|
||||
|
||||
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
|
||||
# to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
|
||||
# Strip away prefix and suffix, leaving for example only:
|
||||
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
|
||||
PROPJAVAS := $(patsubst $(LANGTOOLS_TOPDIR)/src/%.properties, \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/%.java, \
|
||||
$(subst /share/classes,,$(PROPSOURCES)))
|
||||
|
||||
# Generate the package dirs for the tobe generated java files. Sort to remove
|
||||
# duplicates.
|
||||
PROPDIRS := $(sort $(dir $(PROPJAVAS)))
|
||||
|
||||
# Now generate a sequence of:
|
||||
# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
|
||||
# suitable to be fed into the CompileProperties command.
|
||||
PROPCMDLINE := $(subst _SPACE_, $(SPACE), \
|
||||
$(join $(addprefix -compile_SPACE_, $(PROPSOURCES)), \
|
||||
$(addsuffix _SPACE_java.util.ListResourceBundle, \
|
||||
$(addprefix _SPACE_, $(PROPJAVAS)))))
|
||||
|
||||
# Now setup the rule for the generation of the resource bundles.
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props: $(PROPSOURCES) $(BUILD_TOOLS_LANGTOOLS)
|
||||
$(RM) -r $(@D)/*
|
||||
$(MKDIR) -p $(@D) $(PROPDIRS)
|
||||
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
|
||||
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.properties
|
||||
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
|
||||
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.properties
|
||||
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
|
||||
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.properties
|
||||
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
|
||||
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.properties
|
||||
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
|
||||
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.properties
|
||||
$(ECHO) Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles
|
||||
$(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \
|
||||
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.properties \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.java \
|
||||
java.util.ListResourceBundle \
|
||||
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.properties \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.java \
|
||||
java.util.ListResourceBundle \
|
||||
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.properties \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.java \
|
||||
java.util.ListResourceBundle \
|
||||
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.properties \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.java \
|
||||
java.util.ListResourceBundle \
|
||||
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.properties \
|
||||
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.java \
|
||||
java.util.ListResourceBundle
|
||||
$(TOUCH) $@
|
||||
|
||||
all: $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props
|
||||
|
||||
################################################################################
|
45
langtools/make/Tools.gmk
Normal file
45
langtools/make/Tools.gmk
Normal file
@ -0,0 +1,45 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# This must be the first rule
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include JavaCompilation.gmk
|
||||
include SetupJavaCompilers.gmk
|
||||
|
||||
################################################################################
|
||||
# Setup the compilation of the properties compilation tool. You can depend
|
||||
# upon $(BUILD_TOOLS_LANGTOOLS) to trigger a compilation of the tools.
|
||||
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_LANGTOOLS, \
|
||||
SETUP := BOOT_JAVAC, \
|
||||
DISABLE_SJAVAC := true, \
|
||||
ADD_JAVAC_FLAGS := -Xprefer:source, \
|
||||
SRC := $(LANGTOOLS_TOPDIR)/make/tools, \
|
||||
INCLUDES := compileproperties, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes))
|
||||
|
||||
all: $(BUILD_TOOLS_LANGTOOLS)
|
@ -23,13 +23,18 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
|
||||
# and the interim javac, to be run by the boot jdk.
|
||||
$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
|
||||
JAVAC := $(JAVAC), \
|
||||
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
|
||||
SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
|
||||
FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror))
|
||||
include GensrcCommon.gmk
|
||||
|
||||
# javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied.
|
||||
RESOURCE_SUFFIXES := .gif .xml .css .js javax.tools.JavaCompilerTool
|
||||
$(eval $(call SetupVersionProperties,JAVAC_VERSION,\
|
||||
com/sun/tools/javac/resources/version.properties))
|
||||
|
||||
$(eval $(call SetupVersionProperties,JAVAH_VERSION,\
|
||||
com/sun/tools/javah/resources/version.properties))
|
||||
|
||||
$(eval $(call SetupVersionProperties,JAVAP_VERSION,\
|
||||
com/sun/tools/javap/resources/version.properties))
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES,\
|
||||
$(JAVAC_VERSION) $(JAVAH_VERSION) $(JAVAP_VERSION)))
|
||||
|
||||
all: $(COMPILE_PROPERTIES)
|
@ -1,11 +1,12 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
# published by the Free Software 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
|
||||
@ -22,22 +23,11 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
jdk=${1:-/opt/jdk/1.6.0}
|
||||
javah=${jdk}/bin/javah
|
||||
rtjar=${jdk}/jre/lib/rt.jar
|
||||
include GensrcCommon.gmk
|
||||
|
||||
# compile test
|
||||
mkdir -p build/compareTest
|
||||
/opt/jdk/1.7.0/bin/javac -classpath build/classes -d build/compareTest test/tools/javah/compareTest/*.java
|
||||
$(eval $(call SetupVersionProperties,JDEPS_VERSION,\
|
||||
com/sun/tools/jdeps/resources/version.properties))
|
||||
|
||||
# run test
|
||||
/opt/jdk/1.7.0/bin/java -classpath build/compareTest:build/classes CompareTest $javah $rtjar 2>&1 | tee CompareTest.out
|
||||
|
||||
# show diffs for tests that failed
|
||||
grep 'error:' CompareTest.out | sed -e 's|.*new/||' -e 's/\.h$//' -e 's|_|.|g' > CompareTest.classes.fail
|
||||
|
||||
for i in $(cat CompareTest.classes.fail) ; do
|
||||
/opt/jdk/1.7.0/bin/java -classpath compareTest:build/classes CompareTest $javah $rtjar $i
|
||||
diff -r old new
|
||||
done
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, $(JDEPS_VERSION)))
|
||||
|
||||
all: $(COMPILE_PROPERTIES)
|
33
langtools/make/gensrc/Gensrc-jdk.javadoc.gmk
Normal file
33
langtools/make/gensrc/Gensrc-jdk.javadoc.gmk
Normal file
@ -0,0 +1,33 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
include GensrcCommon.gmk
|
||||
|
||||
$(eval $(call SetupVersionProperties,JAVADOC_VERSION,\
|
||||
com/sun/tools/javadoc/resources/version.properties))
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, $(JAVADOC_VERSION)))
|
||||
|
||||
all: $(COMPILE_PROPERTIES)
|
95
langtools/make/gensrc/GensrcCommon.gmk
Normal file
95
langtools/make/gensrc/GensrcCommon.gmk
Normal file
@ -0,0 +1,95 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# This must be the first rule
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include JavaCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# The compileprops tools compiles a properties file into a resource bundle.
|
||||
TOOL_COMPILEPROPS_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes \
|
||||
compileproperties.CompileProperties -quiet
|
||||
|
||||
|
||||
################################################################################
|
||||
# Sets up a rule that creates a version.properties file in the gensrc output
|
||||
# directory.
|
||||
# Param 1 - Variable to add generated file name to
|
||||
# Param 2 - Name of version.properties file including packages from the src
|
||||
# root.
|
||||
define SetupVersionProperties
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2):
|
||||
$(MKDIR) -p $$(@D)
|
||||
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
|
||||
> $$@
|
||||
|
||||
$$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2)
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# Finds all properties files in the module source and creates a rule that runs
|
||||
# CompileProperties on them into the gensrc dir.
|
||||
# Param 1 - Variable to add targets to
|
||||
# Param 2 - Extra properties files to process
|
||||
define SetupCompileProperties
|
||||
# Lookup the properties that need to be compiled into resource bundles.
|
||||
PROPSOURCES := $2 $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
|
||||
|
||||
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
|
||||
# to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
|
||||
# Strip away prefix and suffix, leaving for example only:
|
||||
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
|
||||
PROPJAVAS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/%, \
|
||||
$$(patsubst %.properties, %.java, \
|
||||
$$(subst /share/classes,, $$(PROPSOURCES))))
|
||||
|
||||
# Generate the package dirs for the tobe generated java files. Sort to remove
|
||||
# duplicates.
|
||||
PROPDIRS := $$(sort $$(dir $$(PROPJAVAS)))
|
||||
|
||||
# Now generate a sequence of:
|
||||
# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
|
||||
# suitable to be fed into the CompileProperties command.
|
||||
PROPCMDLINE := $$(subst _SPACE_, $(SPACE), \
|
||||
$$(join $$(addprefix -compile_SPACE_, $$(PROPSOURCES)), \
|
||||
$$(addsuffix _SPACE_java.util.ListResourceBundle, \
|
||||
$$(addprefix _SPACE_, $$(PROPJAVAS)))))
|
||||
|
||||
# Now setup the rule for the generation of the resource bundles.
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
|
||||
$(FIND) $$(@D) -name "*.java" $(FIND_DELETE)
|
||||
$(MKDIR) -p $$(@D) $$(PROPDIRS)
|
||||
$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
|
||||
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
|
||||
$(TOUCH) $$@
|
||||
|
||||
$$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props
|
||||
endef
|
||||
|
||||
################################################################################
|
@ -102,6 +102,9 @@ public class MutableFieldsAnalyzer extends AbstractCodingRulesAnalyzer {
|
||||
classFieldsToIgnoreMap.
|
||||
put("com.sun.tools.javac.file.ZipFileIndexCache",
|
||||
Arrays.asList("sharedInstance"));
|
||||
classFieldsToIgnoreMap.
|
||||
put("com.sun.tools.javac.file.JRTIndex",
|
||||
Arrays.asList("sharedInstance"));
|
||||
classFieldsToIgnoreMap.
|
||||
put("com.sun.tools.javac.main.JavaCompiler",
|
||||
Arrays.asList("versionRB"));
|
||||
|
@ -25,17 +25,14 @@
|
||||
|
||||
package javax.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static java.util.logging.Level.*;
|
||||
|
||||
/**
|
||||
@ -89,7 +86,7 @@ public class ToolProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String defaultJavaCompilerName
|
||||
private static final String systemJavaCompilerName
|
||||
= "com.sun.tools.javac.api.JavacTool";
|
||||
|
||||
/**
|
||||
@ -99,10 +96,10 @@ public class ToolProvider {
|
||||
* {@code null} if no compiler is provided
|
||||
*/
|
||||
public static JavaCompiler getSystemJavaCompiler() {
|
||||
return instance().getSystemTool(JavaCompiler.class, defaultJavaCompilerName);
|
||||
return instance().getSystemTool(JavaCompiler.class, systemJavaCompilerName);
|
||||
}
|
||||
|
||||
private static final String defaultDocumentationToolName
|
||||
private static final String systemDocumentationToolName
|
||||
= "com.sun.tools.javadoc.api.JavadocTool";
|
||||
|
||||
/**
|
||||
@ -112,7 +109,7 @@ public class ToolProvider {
|
||||
* {@code null} if no documentation tool is provided
|
||||
*/
|
||||
public static DocumentationTool getSystemDocumentationTool() {
|
||||
return instance().getSystemTool(DocumentationTool.class, defaultDocumentationToolName);
|
||||
return instance().getSystemTool(DocumentationTool.class, systemDocumentationToolName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,13 +122,7 @@ public class ToolProvider {
|
||||
* or {@code null} if no tools are provided
|
||||
*/
|
||||
public static ClassLoader getSystemToolClassLoader() {
|
||||
try {
|
||||
Class<? extends JavaCompiler> c =
|
||||
instance().getSystemToolClass(JavaCompiler.class, defaultJavaCompilerName);
|
||||
return c.getClassLoader();
|
||||
} catch (Throwable e) {
|
||||
return trace(WARNING, e);
|
||||
}
|
||||
return ClassLoader.getSystemClassLoader();
|
||||
}
|
||||
|
||||
|
||||
@ -145,12 +136,7 @@ public class ToolProvider {
|
||||
|
||||
// Cache for tool classes.
|
||||
// Use weak references to avoid keeping classes around unnecessarily
|
||||
private Map<String, Reference<Class<?>>> toolClasses = new HashMap<>();
|
||||
|
||||
// Cache for tool classloader.
|
||||
// Use a weak reference to avoid keeping it around unnecessarily
|
||||
private Reference<ClassLoader> refToolClassLoader = null;
|
||||
|
||||
private final Map<String, Reference<Class<?>>> toolClasses = new HashMap<>();
|
||||
|
||||
private ToolProvider() { }
|
||||
|
||||
@ -158,9 +144,8 @@ public class ToolProvider {
|
||||
Class<? extends T> c = getSystemToolClass(clazz, name);
|
||||
try {
|
||||
return c.asSubclass(clazz).newInstance();
|
||||
} catch (Throwable e) {
|
||||
trace(WARNING, e);
|
||||
return null;
|
||||
} catch (InstantiationException | IllegalAccessException | RuntimeException | Error e) {
|
||||
return trace(WARNING, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,48 +154,12 @@ public class ToolProvider {
|
||||
Class<?> c = (refClass == null ? null : refClass.get());
|
||||
if (c == null) {
|
||||
try {
|
||||
c = findSystemToolClass(name);
|
||||
} catch (Throwable e) {
|
||||
c = Class.forName(name, false, ClassLoader.getSystemClassLoader());
|
||||
} catch (ClassNotFoundException | RuntimeException | Error e) {
|
||||
return trace(WARNING, e);
|
||||
}
|
||||
toolClasses.put(name, new WeakReference<Class<?>>(c));
|
||||
toolClasses.put(name, new WeakReference<>(c));
|
||||
}
|
||||
return c.asSubclass(clazz);
|
||||
}
|
||||
|
||||
private static final String[] defaultToolsLocation = { "lib", "tools.jar" };
|
||||
|
||||
private Class<?> findSystemToolClass(String toolClassName)
|
||||
throws MalformedURLException, ClassNotFoundException
|
||||
{
|
||||
// try loading class directly, in case tool is on the bootclasspath
|
||||
try {
|
||||
return Class.forName(toolClassName, false, null);
|
||||
} catch (ClassNotFoundException e) {
|
||||
trace(FINE, e);
|
||||
|
||||
// if tool not on bootclasspath, look in default tools location (tools.jar)
|
||||
ClassLoader cl = (refToolClassLoader == null ? null : refToolClassLoader.get());
|
||||
if (cl == null) {
|
||||
File file = new File(System.getProperty("java.home"));
|
||||
if (file.getName().equalsIgnoreCase("jre"))
|
||||
file = file.getParentFile();
|
||||
for (String name : defaultToolsLocation)
|
||||
file = new File(file, name);
|
||||
|
||||
// if tools not found, no point in trying a URLClassLoader
|
||||
// so rethrow the original exception.
|
||||
if (!file.exists())
|
||||
throw e;
|
||||
|
||||
URL[] urls = { file.toURI().toURL() };
|
||||
trace(FINE, urls[0].toString());
|
||||
|
||||
cl = URLClassLoader.newInstance(urls);
|
||||
refToolClassLoader = new WeakReference<>(cl);
|
||||
}
|
||||
|
||||
return Class.forName(toolClassName, false, cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
package com.sun.tools.javac.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -55,6 +56,7 @@ import javax.tools.JavaFileManager;
|
||||
import javax.tools.JavaFileManager.Location;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.JavaFileObject.Kind;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
|
||||
import com.sun.source.util.TaskEvent;
|
||||
import com.sun.source.util.TaskListener;
|
||||
@ -115,11 +117,13 @@ public class ClientCodeWrapper {
|
||||
public JavaFileManager wrap(JavaFileManager fm) {
|
||||
if (isTrusted(fm))
|
||||
return fm;
|
||||
if (fm instanceof StandardJavaFileManager)
|
||||
return new WrappedStandardJavaFileManager((StandardJavaFileManager) fm);
|
||||
return new WrappedJavaFileManager(fm);
|
||||
}
|
||||
|
||||
public FileObject wrap(FileObject fo) {
|
||||
if (isTrusted(fo))
|
||||
if (fo == null || isTrusted(fo))
|
||||
return fo;
|
||||
return new WrappedFileObject(fo);
|
||||
}
|
||||
@ -132,7 +136,7 @@ public class ClientCodeWrapper {
|
||||
}
|
||||
|
||||
public JavaFileObject wrap(JavaFileObject fo) {
|
||||
if (isTrusted(fo))
|
||||
if (fo == null || isTrusted(fo))
|
||||
return fo;
|
||||
return new WrappedJavaFileObject(fo);
|
||||
}
|
||||
@ -360,6 +364,79 @@ public class ClientCodeWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
protected class WrappedStandardJavaFileManager extends WrappedJavaFileManager
|
||||
implements StandardJavaFileManager {
|
||||
WrappedStandardJavaFileManager(StandardJavaFileManager clientJavaFileManager) {
|
||||
super(clientJavaFileManager);
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
|
||||
try {
|
||||
return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjectsFromFiles(files);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
|
||||
try {
|
||||
return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjects(files);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
|
||||
try {
|
||||
return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjectsFromStrings(names);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
|
||||
try {
|
||||
return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjects(names);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public void setLocation(Location location, Iterable<? extends File> path) throws IOException {
|
||||
try {
|
||||
((StandardJavaFileManager)clientJavaFileManager).setLocation(location, path);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends File> getLocation(Location location) {
|
||||
try {
|
||||
return ((StandardJavaFileManager)clientJavaFileManager).getLocation(location);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected class WrappedFileObject implements FileObject {
|
||||
protected FileObject clientFileObject;
|
||||
WrappedFileObject(FileObject clientFileObject) {
|
||||
@ -558,47 +635,47 @@ public class ClientCodeWrapper {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Diagnostic.Kind getKind() {
|
||||
return d.getKind();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public JavaFileObject getSource() {
|
||||
return unwrap(d.getSource());
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public long getPosition() {
|
||||
return d.getPosition();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public long getStartPosition() {
|
||||
return d.getStartPosition();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public long getEndPosition() {
|
||||
return d.getEndPosition();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public long getLineNumber() {
|
||||
return d.getLineNumber();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public long getColumnNumber() {
|
||||
return d.getColumnNumber();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public String getCode() {
|
||||
return d.getCode();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public String getMessage(Locale locale) {
|
||||
return d.getMessage(locale);
|
||||
}
|
||||
|
@ -27,21 +27,33 @@ package com.sun.tools.javac.code;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.JavaFileManager;
|
||||
import javax.tools.JavaFileManager.Location;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
|
||||
import static javax.tools.StandardLocation.*;
|
||||
|
||||
import com.sun.tools.javac.comp.Annotate;
|
||||
import com.sun.tools.javac.code.Scope.WriteableScope;
|
||||
import com.sun.tools.javac.code.Symbol.*;
|
||||
import com.sun.tools.javac.code.Symbol.ClassSymbol;
|
||||
import com.sun.tools.javac.code.Symbol.Completer;
|
||||
import com.sun.tools.javac.code.Symbol.CompletionFailure;
|
||||
import com.sun.tools.javac.code.Symbol.PackageSymbol;
|
||||
import com.sun.tools.javac.code.Symbol.TypeSymbol;
|
||||
import com.sun.tools.javac.comp.Annotate;
|
||||
import com.sun.tools.javac.file.JRTIndex;
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
|
||||
import com.sun.tools.javac.jvm.ClassReader;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.javac.util.*;
|
||||
|
||||
import static javax.tools.StandardLocation.*;
|
||||
|
||||
import static com.sun.tools.javac.code.Flags.*;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.*;
|
||||
|
||||
@ -125,6 +137,18 @@ public class ClassFinder {
|
||||
*/
|
||||
protected Symbol currentOwner = null;
|
||||
|
||||
/**
|
||||
* The currently selected profile.
|
||||
*/
|
||||
private final Profile profile;
|
||||
|
||||
/**
|
||||
* Use direct access to the JRTIndex to access the temporary
|
||||
* replacement for the info that used to be in ct.sym.
|
||||
* In time, this will go away and be replaced by the module system.
|
||||
*/
|
||||
private final JRTIndex jrtIndex;
|
||||
|
||||
/**
|
||||
* Completer that delegates to the complete-method of this class.
|
||||
*/
|
||||
@ -168,13 +192,73 @@ public class ClassFinder {
|
||||
preferSource = "source".equals(options.get("-Xprefer"));
|
||||
userPathsFirst = options.isSet(XXUSERPATHSFIRST);
|
||||
|
||||
|
||||
completionFailureName =
|
||||
options.isSet("failcomplete")
|
||||
? names.fromString(options.get("failcomplete"))
|
||||
: null;
|
||||
|
||||
// Temporary, until more info is available from the module system.
|
||||
boolean useCtProps;
|
||||
JavaFileManager fm = context.get(JavaFileManager.class);
|
||||
if (fm instanceof JavacFileManager) {
|
||||
JavacFileManager jfm = (JavacFileManager) fm;
|
||||
useCtProps = jfm.isDefaultBootClassPath() && jfm.isSymbolFileEnabled();
|
||||
} else if (fm.getClass().getName().equals("com.sun.tools.sjavac.comp.SmartFileManager")) {
|
||||
useCtProps = !options.isSet("ignore.symbol.file");
|
||||
} else {
|
||||
useCtProps = false;
|
||||
}
|
||||
jrtIndex = useCtProps && JRTIndex.isAvailable() ? JRTIndex.getSharedInstance() : null;
|
||||
|
||||
profile = Profile.instance(context);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Temporary ct.sym replacement
|
||||
*
|
||||
* The following code is a temporary substitute for the ct.sym mechanism
|
||||
* used in JDK 6 thru JDK 8.
|
||||
* This mechanism will eventually be superseded by the Jigsaw module system.
|
||||
***********************************************************************/
|
||||
|
||||
/**
|
||||
* Returns any extra flags for a class symbol.
|
||||
* This information used to be provided using private annotations
|
||||
* in the class file in ct.sym; in time, this information will be
|
||||
* available from the module system.
|
||||
*/
|
||||
long getSupplementaryFlags(ClassSymbol c) {
|
||||
if (jrtIndex == null || !jrtIndex.isInJRT(c.classfile)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (supplementaryFlags == null) {
|
||||
supplementaryFlags = new HashMap<>();
|
||||
}
|
||||
|
||||
Long flags = supplementaryFlags.get(c.packge());
|
||||
if (flags == null) {
|
||||
long newFlags = 0;
|
||||
try {
|
||||
JRTIndex.CtSym ctSym = jrtIndex.getCtSym(c.packge().flatName());
|
||||
Profile minProfile = Profile.DEFAULT;
|
||||
if (ctSym.proprietary)
|
||||
newFlags |= PROPRIETARY;
|
||||
if (ctSym.minProfile != null)
|
||||
minProfile = Profile.lookup(ctSym.minProfile);
|
||||
if (profile != Profile.DEFAULT && minProfile.value > profile.value) {
|
||||
newFlags |= NOT_IN_PROFILE;
|
||||
}
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
supplementaryFlags.put(c.packge(), flags = newFlags);
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
private Map<PackageSymbol, Long> supplementaryFlags;
|
||||
|
||||
/************************************************************************
|
||||
* Loading Classes
|
||||
***********************************************************************/
|
||||
@ -259,6 +343,7 @@ public class ClassFinder {
|
||||
}
|
||||
if (classfile.getKind() == JavaFileObject.Kind.CLASS) {
|
||||
reader.readClassFile(c);
|
||||
c.flags_field |= getSupplementaryFlags(c);
|
||||
} else {
|
||||
if (sourceCompleter != null) {
|
||||
sourceCompleter.complete(c);
|
||||
@ -271,13 +356,15 @@ public class ClassFinder {
|
||||
currentClassFile = previousClassFile;
|
||||
}
|
||||
} else {
|
||||
JCDiagnostic diag =
|
||||
diagFactory.fragment("class.file.not.found", c.flatname);
|
||||
throw
|
||||
newCompletionFailure(c, diag);
|
||||
throw classFileNotFound(c);
|
||||
}
|
||||
}
|
||||
// where
|
||||
private CompletionFailure classFileNotFound(ClassSymbol c) {
|
||||
JCDiagnostic diag =
|
||||
diagFactory.fragment("class.file.not.found", c.flatname);
|
||||
return newCompletionFailure(c, diag);
|
||||
}
|
||||
/** Static factory for CompletionFailure objects.
|
||||
* In practice, only one can be used at a time, so we share one
|
||||
* to reduce the expense of allocating new exception objects.
|
||||
@ -296,7 +383,7 @@ public class ClassFinder {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
private CompletionFailure cachedCompletionFailure =
|
||||
private final CompletionFailure cachedCompletionFailure =
|
||||
new CompletionFailure(null, (JCDiagnostic) null);
|
||||
{
|
||||
cachedCompletionFailure.setStackTrace(new StackTraceElement[0]);
|
||||
|
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package com.sun.tools.javac.file;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.net.URI;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.spi.FileSystemProvider;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.tools.FileObject;
|
||||
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
|
||||
import com.sun.tools.javac.nio.PathFileObject;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
|
||||
/**
|
||||
* A package-oriented index into the jrt: filesystem.
|
||||
*/
|
||||
public class JRTIndex {
|
||||
/** Get a shared instance of the cache. */
|
||||
private static JRTIndex sharedInstance;
|
||||
public synchronized static JRTIndex getSharedInstance() {
|
||||
if (sharedInstance == null) {
|
||||
try {
|
||||
sharedInstance = new JRTIndex();
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
/** Get a context-specific instance of a cache. */
|
||||
public static JRTIndex instance(Context context) {
|
||||
try {
|
||||
JRTIndex instance = context.get(JRTIndex.class);
|
||||
if (instance == null)
|
||||
context.put(JRTIndex.class, instance = new JRTIndex());
|
||||
return instance;
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAvailable() {
|
||||
for (FileSystemProvider p: FileSystemProvider.installedProviders()) {
|
||||
if (p.getScheme().equals("jrt"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The jrt: file system.
|
||||
*/
|
||||
private final FileSystem jrtfs;
|
||||
|
||||
/**
|
||||
* The set of module directories within the jrt: file system.
|
||||
*/
|
||||
private final Set<Path> jrtModules;
|
||||
|
||||
/**
|
||||
* A lazily evaluated set of entries about the contents of the jrt: file system.
|
||||
*/
|
||||
private final Map<RelativeDirectory, SoftReference<Entry>> entries;
|
||||
|
||||
/**
|
||||
* An entry provides cached info about a specific package directory within jrt:.
|
||||
*/
|
||||
class Entry {
|
||||
/**
|
||||
* The regular files for this package.
|
||||
* For now, assume just one instance of each file across all modules.
|
||||
*/
|
||||
final Map<String, Path> files;
|
||||
|
||||
/**
|
||||
* The set of subdirectories in jrt: for this package.
|
||||
*/
|
||||
final Set<RelativeDirectory> subdirs;
|
||||
|
||||
/**
|
||||
* The info that used to be in ct.sym for classes in this package.
|
||||
*/
|
||||
final CtSym ctSym;
|
||||
|
||||
private Entry(Map<String, Path> files, Set<RelativeDirectory> subdirs, CtSym ctSym) {
|
||||
this.files = files;
|
||||
this.subdirs = subdirs;
|
||||
this.ctSym = ctSym;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The info that used to be in ct.sym for classes in a package.
|
||||
*/
|
||||
public static class CtSym {
|
||||
/**
|
||||
* The classes in this package are internal and not visible.
|
||||
*/
|
||||
public final boolean hidden;
|
||||
/**
|
||||
* The classes in this package are proprietary and will generate a warning.
|
||||
*/
|
||||
public final boolean proprietary;
|
||||
/**
|
||||
* The minimum profile in which classes in this package are available.
|
||||
*/
|
||||
public final String minProfile;
|
||||
|
||||
CtSym(boolean hidden, boolean proprietary, String minProfile) {
|
||||
this.hidden = hidden;
|
||||
this.proprietary = proprietary;
|
||||
this.minProfile = minProfile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("CtSym[");
|
||||
boolean needSep = false;
|
||||
if (hidden) {
|
||||
sb.append("hidden");
|
||||
needSep = true;
|
||||
}
|
||||
if (proprietary) {
|
||||
if (needSep) sb.append(",");
|
||||
sb.append("proprietary");
|
||||
needSep = true;
|
||||
}
|
||||
if (minProfile != null) {
|
||||
if (needSep) sb.append(",");
|
||||
sb.append(minProfile);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
static final CtSym EMPTY = new CtSym(false, false, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and initialize the index.
|
||||
*/
|
||||
private JRTIndex() throws IOException {
|
||||
jrtfs = FileSystems.getFileSystem(URI.create("jrt:/"));
|
||||
jrtModules = new LinkedHashSet<>();
|
||||
Path root = jrtfs.getPath("/");
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {
|
||||
for (Path entry: stream) {
|
||||
if (Files.isDirectory(entry))
|
||||
jrtModules.add(entry);
|
||||
}
|
||||
}
|
||||
entries = new HashMap<>();
|
||||
}
|
||||
|
||||
public CtSym getCtSym(CharSequence packageName) throws IOException {
|
||||
return getEntry(RelativeDirectory.forPackage(packageName)).ctSym;
|
||||
}
|
||||
|
||||
synchronized Entry getEntry(RelativeDirectory rd) throws IOException {
|
||||
SoftReference<Entry> ref = entries.get(rd);
|
||||
Entry e = (ref == null) ? null : ref.get();
|
||||
if (e == null) {
|
||||
Map<String, Path> files = new LinkedHashMap<>();
|
||||
Set<RelativeDirectory> subdirs = new LinkedHashSet<>();
|
||||
for (Path module: jrtModules) {
|
||||
Path p = rd.getFile(module);
|
||||
if (!Files.exists(p))
|
||||
continue;
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(p)) {
|
||||
for (Path entry: stream) {
|
||||
String name = entry.getFileName().toString();
|
||||
if (Files.isRegularFile(entry)) {
|
||||
// TODO: consider issue of files with same name in different modules
|
||||
files.put(name, entry);
|
||||
} else if (Files.isDirectory(entry)) {
|
||||
subdirs.add(new RelativeDirectory(rd, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
e = new Entry(Collections.unmodifiableMap(files),
|
||||
Collections.unmodifiableSet(subdirs),
|
||||
getCtInfo(rd));
|
||||
entries.put(rd, new SoftReference<>(e));
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public boolean isInJRT(FileObject fo) {
|
||||
if (fo instanceof PathFileObject) {
|
||||
Path path = ((PathFileObject) fo).getPath();
|
||||
return (path.getFileSystem() == jrtfs);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private CtSym getCtInfo(RelativeDirectory dir) {
|
||||
if (dir.path.isEmpty())
|
||||
return CtSym.EMPTY;
|
||||
// It's a side-effect of the default build rules that ct.properties
|
||||
// ends up as a resource bundle.
|
||||
if (ctBundle == null) {
|
||||
final String bundleName = "com.sun.tools.javac.resources.ct";
|
||||
ctBundle = ResourceBundle.getBundle(bundleName);
|
||||
}
|
||||
try {
|
||||
String attrs = ctBundle.getString(dir.path.replace('/', '.') + '*');
|
||||
boolean hidden = false;
|
||||
boolean proprietary = false;
|
||||
String minProfile = null;
|
||||
for (String attr: attrs.split(" +", 0)) {
|
||||
switch (attr) {
|
||||
case "hidden":
|
||||
hidden = true;
|
||||
break;
|
||||
case "proprietary":
|
||||
proprietary = true;
|
||||
break;
|
||||
default:
|
||||
minProfile = attr;
|
||||
}
|
||||
}
|
||||
return new CtSym(hidden, proprietary, minProfile);
|
||||
} catch (MissingResourceException e) {
|
||||
return CtSym.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ResourceBundle ctBundle;
|
||||
}
|
@ -25,17 +25,16 @@
|
||||
|
||||
package com.sun.tools.javac.file;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -54,8 +53,9 @@ import javax.tools.JavaFileManager;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeFile;
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeFile;
|
||||
import com.sun.tools.javac.nio.PathFileObject;
|
||||
import com.sun.tools.javac.util.BaseFileManager;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.DefinedBy;
|
||||
@ -65,6 +65,8 @@ import com.sun.tools.javac.util.ListBuffer;
|
||||
|
||||
import static javax.tools.StandardLocation.*;
|
||||
|
||||
import static com.sun.tools.javac.util.BaseFileManager.getKind;
|
||||
|
||||
/**
|
||||
* This class provides access to the source, class and other files
|
||||
* used by the compiler and related tools.
|
||||
@ -97,11 +99,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
|
||||
protected enum SortFiles implements Comparator<File> {
|
||||
FORWARD {
|
||||
@Override
|
||||
public int compare(File f1, File f2) {
|
||||
return f1.getName().compareTo(f2.getName());
|
||||
}
|
||||
},
|
||||
REVERSE {
|
||||
@Override
|
||||
public int compare(File f1, File f2) {
|
||||
return -f1.getName().compareTo(f2.getName());
|
||||
}
|
||||
@ -115,6 +119,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
*/
|
||||
public static void preRegister(Context context) {
|
||||
context.put(JavaFileManager.class, new Context.Factory<JavaFileManager>() {
|
||||
@Override
|
||||
public JavaFileManager make(Context c) {
|
||||
return new JavacFileManager(c, true, null);
|
||||
}
|
||||
@ -161,6 +166,10 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
symbolFileEnabled = b;
|
||||
}
|
||||
|
||||
public boolean isSymbolFileEnabled() {
|
||||
return symbolFileEnabled;
|
||||
}
|
||||
|
||||
public JavaFileObject getFileForInput(String name) {
|
||||
return getRegularFile(new File(name));
|
||||
}
|
||||
@ -177,7 +186,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return getJavaFileForOutput(CLASS_OUTPUT, classname, kind, sibling);
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
|
||||
ListBuffer<File> files = new ListBuffer<>();
|
||||
for (String name : names)
|
||||
@ -185,7 +194,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return getJavaFileObjectsFromFiles(files.toList());
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
|
||||
return getJavaFileObjectsFromStrings(Arrays.asList(nullCheck(names)));
|
||||
}
|
||||
@ -250,6 +259,40 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert all files in a subdirectory of the platform image
|
||||
* which match fileKinds into resultList.
|
||||
*/
|
||||
private void listJRTImage(RelativeDirectory subdirectory,
|
||||
Set<JavaFileObject.Kind> fileKinds,
|
||||
boolean recurse,
|
||||
ListBuffer<JavaFileObject> resultList) throws IOException {
|
||||
JRTIndex.Entry e = getJRTIndex().getEntry(subdirectory);
|
||||
if (symbolFileEnabled && e.ctSym.hidden)
|
||||
return;
|
||||
for (Path file: e.files.values()) {
|
||||
if (fileKinds.contains(getKind(file))) {
|
||||
JavaFileObject fe
|
||||
= PathFileObject.createJRTPathFileObject(JavacFileManager.this, file);
|
||||
resultList.append(fe);
|
||||
}
|
||||
}
|
||||
|
||||
if (recurse) {
|
||||
for (RelativeDirectory rd: e.subdirs) {
|
||||
listJRTImage(rd, fileKinds, recurse, resultList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized JRTIndex getJRTIndex() {
|
||||
if (jrtIndex == null)
|
||||
jrtIndex = JRTIndex.getSharedInstance();
|
||||
return jrtIndex;
|
||||
}
|
||||
|
||||
private JRTIndex jrtIndex;
|
||||
|
||||
|
||||
/**
|
||||
* Insert all files in subdirectory subdirectory of directory directory
|
||||
@ -334,7 +377,29 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
ListBuffer<JavaFileObject> resultList) {
|
||||
Archive archive = archives.get(container);
|
||||
if (archive == null) {
|
||||
// archives are not created for directories.
|
||||
// Very temporary and obnoxious interim hack
|
||||
if (container.getName().equals("bootmodules.jimage")) {
|
||||
System.err.println("Warning: reference to bootmodules.jimage replaced by jrt:");
|
||||
container = Locations.JRT_MARKER_FILE;
|
||||
} else if (container.getName().endsWith(".jimage")) {
|
||||
System.err.println("Warning: reference to " + container + " ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
// archives are not created for directories or jrt: images
|
||||
if (container == Locations.JRT_MARKER_FILE) {
|
||||
try {
|
||||
listJRTImage(subdirectory,
|
||||
fileKinds,
|
||||
recurse,
|
||||
resultList);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace(System.err);
|
||||
log.error("error.reading.file", container, getMessage(ex));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (fsInfo.isDirectory(container)) {
|
||||
listDirectory(container,
|
||||
subdirectory,
|
||||
@ -348,8 +413,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
try {
|
||||
archive = openArchive(container);
|
||||
} catch (IOException ex) {
|
||||
log.error("error.reading.file",
|
||||
container, getMessage(ex));
|
||||
log.error("error.reading.file", container, getMessage(ex));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -419,21 +483,26 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
public MissingArchive(File name) {
|
||||
zipFileName = name;
|
||||
}
|
||||
@Override
|
||||
public boolean contains(RelativePath name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaFileObject getFileObject(RelativeDirectory subdirectory, String file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getFiles(RelativeDirectory subdirectory) {
|
||||
return List.nil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RelativeDirectory> getSubdirectories() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
@ -448,10 +517,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
*/
|
||||
Map<File, Archive> archives = new HashMap<>();
|
||||
|
||||
private static final String[] symbolFileLocation = { "lib", "ct.sym" };
|
||||
private static final RelativeDirectory symbolFilePrefix
|
||||
= new RelativeDirectory("META-INF/sym/rt.jar/");
|
||||
|
||||
/*
|
||||
* This method looks for a ZipFormatException and takes appropriate
|
||||
* evasive action. If there is a failure in the fast mode then we
|
||||
@ -473,19 +538,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
/** Open a new zip file directory, and cache it.
|
||||
*/
|
||||
private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
|
||||
File origZipFileName = zipFileName;
|
||||
if (symbolFileEnabled && locations.isDefaultBootClassPathRtJar(zipFileName)) {
|
||||
File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
|
||||
if (new File(file.getName()).equals(new File("jre")))
|
||||
file = file.getParentFile();
|
||||
// file == ${jdk.home}
|
||||
for (String name : symbolFileLocation)
|
||||
file = new File(file, name);
|
||||
// file == ${jdk.home}/lib/ct.sym
|
||||
if (file.exists())
|
||||
zipFileName = file;
|
||||
}
|
||||
|
||||
Archive archive;
|
||||
try {
|
||||
|
||||
@ -522,7 +574,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
}
|
||||
}
|
||||
|
||||
if (origZipFileName == zipFileName) {
|
||||
if (!useOptimizedZip) {
|
||||
archive = new ZipArchive(this, zdir);
|
||||
} else {
|
||||
@ -533,18 +584,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
preindexCacheLocation,
|
||||
options.isSet("writezipindexfiles")));
|
||||
}
|
||||
} else {
|
||||
if (!useOptimizedZip) {
|
||||
archive = new SymbolArchive(this, origZipFileName, zdir, symbolFilePrefix);
|
||||
} else {
|
||||
archive = new ZipFileIndexArchive(this,
|
||||
zipFileIndexCache.getZipFileIndex(zipFileName,
|
||||
symbolFilePrefix,
|
||||
usePreindexedCache,
|
||||
preindexCacheLocation,
|
||||
options.isSet("writezipindexfiles")));
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
archive = new MissingArchive(zipFileName);
|
||||
} catch (ZipFileIndex.ZipFormatException zfe) {
|
||||
@ -555,13 +594,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
archive = new MissingArchive(zipFileName);
|
||||
}
|
||||
|
||||
archives.put(origZipFileName, archive);
|
||||
archives.put(zipFileName, archive);
|
||||
return archive;
|
||||
}
|
||||
|
||||
/** Flush any output resources.
|
||||
*/
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public void flush() {
|
||||
contentCache.clear();
|
||||
}
|
||||
@ -569,19 +608,19 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
/**
|
||||
* Close the JavaFileManager, releasing resources.
|
||||
*/
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public void close() {
|
||||
for (Iterator<Archive> i = archives.values().iterator(); i.hasNext(); ) {
|
||||
Archive a = i.next();
|
||||
i.remove();
|
||||
try {
|
||||
a.close();
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public ClassLoader getClassLoader(Location location) {
|
||||
nullCheck(location);
|
||||
Iterable<? extends File> path = getLocation(location);
|
||||
@ -599,7 +638,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return getClassLoader(lb.toArray(new URL[lb.size()]));
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<JavaFileObject> list(Location location,
|
||||
String packageName,
|
||||
Set<JavaFileObject.Kind> kinds,
|
||||
@ -621,7 +660,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return results.toList();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public String inferBinaryName(Location location, JavaFileObject file) {
|
||||
file.getClass(); // null check
|
||||
location.getClass(); // null check
|
||||
@ -633,27 +672,32 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
|
||||
if (file instanceof BaseFileObject) {
|
||||
return ((BaseFileObject) file).inferBinaryName(path);
|
||||
} else if (file instanceof PathFileObject) {
|
||||
return ((PathFileObject) file).inferBinaryName(null);
|
||||
} else
|
||||
throw new IllegalArgumentException(file.getClass().getName());
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public boolean isSameFile(FileObject a, FileObject b) {
|
||||
nullCheck(a);
|
||||
nullCheck(b);
|
||||
if (!(a instanceof BaseFileObject))
|
||||
if (a instanceof PathFileObject && b instanceof PathFileObject)
|
||||
return ((PathFileObject) a).isSameFile((PathFileObject) b);
|
||||
// In time, we should phase out BaseFileObject in favor of PathFileObject
|
||||
if (!(a instanceof BaseFileObject || a instanceof PathFileObject))
|
||||
throw new IllegalArgumentException("Not supported: " + a);
|
||||
if (!(b instanceof BaseFileObject))
|
||||
if (!(b instanceof BaseFileObject || b instanceof PathFileObject))
|
||||
throw new IllegalArgumentException("Not supported: " + b);
|
||||
return a.equals(b);
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public boolean hasLocation(Location location) {
|
||||
return getLocation(location) != null;
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public JavaFileObject getJavaFileForInput(Location location,
|
||||
String className,
|
||||
JavaFileObject.Kind kind)
|
||||
@ -668,7 +712,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return getFileForInput(location, RelativeFile.forClass(className, kind));
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public FileObject getFileForInput(Location location,
|
||||
String packageName,
|
||||
String relativeName)
|
||||
@ -690,17 +734,26 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
if (path == null)
|
||||
return null;
|
||||
|
||||
for (File dir: path) {
|
||||
Archive a = archives.get(dir);
|
||||
for (File file: path) {
|
||||
Archive a = archives.get(file);
|
||||
if (a == null) {
|
||||
if (fsInfo.isDirectory(dir)) {
|
||||
File f = name.getFile(dir);
|
||||
// archives are not created for directories or jrt: images
|
||||
if (file == Locations.JRT_MARKER_FILE) {
|
||||
JRTIndex.Entry e = getJRTIndex().getEntry(name.dirname());
|
||||
if (symbolFileEnabled && e.ctSym.hidden)
|
||||
continue;
|
||||
Path p = e.files.get(name.basename());
|
||||
if (p != null)
|
||||
return PathFileObject.createJRTPathFileObject(this, p);
|
||||
continue;
|
||||
} else if (fsInfo.isDirectory(file)) {
|
||||
File f = name.getFile(file);
|
||||
if (f.exists())
|
||||
return new RegularFileObject(this, f);
|
||||
continue;
|
||||
}
|
||||
// Not a directory, create the archive
|
||||
a = openArchive(dir);
|
||||
a = openArchive(file);
|
||||
}
|
||||
// Process the archive
|
||||
if (a.contains(name)) {
|
||||
@ -710,7 +763,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return null;
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public JavaFileObject getJavaFileForOutput(Location location,
|
||||
String className,
|
||||
JavaFileObject.Kind kind,
|
||||
@ -726,7 +779,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return getFileForOutput(location, RelativeFile.forClass(className, kind), sibling);
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public FileObject getFileForOutput(Location location,
|
||||
String packageName,
|
||||
String relativeName,
|
||||
@ -776,7 +829,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(
|
||||
Iterable<? extends File> files)
|
||||
{
|
||||
@ -790,12 +843,12 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
return result;
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
|
||||
return getJavaFileObjectsFromFiles(Arrays.asList(nullCheck(files)));
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public void setLocation(Location location,
|
||||
Iterable<? extends File> path)
|
||||
throws IOException
|
||||
@ -804,7 +857,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
locations.setLocation(location, path);
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public Iterable<? extends File> getLocation(Location location) {
|
||||
nullCheck(location);
|
||||
return locations.getLocation(location);
|
||||
|
@ -27,8 +27,12 @@ package com.sun.tools.javac.file;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -41,6 +45,8 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import javax.tools.JavaFileManager;
|
||||
@ -94,6 +100,12 @@ public class Locations {
|
||||
*/
|
||||
private boolean warn;
|
||||
|
||||
// Used by Locations(for now) to indicate that the PLATFORM_CLASS_PATH
|
||||
// should use the jrt: file system.
|
||||
// When Locations has been converted to use java.nio.file.Path,
|
||||
// Locations can use Paths.get(URI.create("jrt:"))
|
||||
static final File JRT_MARKER_FILE = new File("JRT_MARKER_FILE");
|
||||
|
||||
public Locations() {
|
||||
initHandlers();
|
||||
}
|
||||
@ -115,12 +127,6 @@ public class Locations {
|
||||
return h.isDefault();
|
||||
}
|
||||
|
||||
boolean isDefaultBootClassPathRtJar(File file) {
|
||||
BootClassPathLocationHandler h
|
||||
= (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH);
|
||||
return h.isDefaultRtJar(file);
|
||||
}
|
||||
|
||||
public Collection<File> userClassPath() {
|
||||
return getLocation(CLASS_PATH);
|
||||
}
|
||||
@ -283,7 +289,7 @@ public class Locations {
|
||||
|
||||
if (fsInfo.isFile(file)) {
|
||||
/* File is an ordinary file. */
|
||||
if (!isArchive(file)) {
|
||||
if (!isArchive(file) && !file.getName().endsWith(".jimage")) {
|
||||
/* Not a recognized extension; open it to see if
|
||||
it looks like a valid zip file. */
|
||||
try {
|
||||
@ -309,7 +315,7 @@ public class Locations {
|
||||
super.add(file);
|
||||
canonicalValues.add(canonFile);
|
||||
|
||||
if (expandJarClassPaths && fsInfo.isFile(file)) {
|
||||
if (expandJarClassPaths && fsInfo.isFile(file) && !file.getName().endsWith(".jimage")) {
|
||||
addJarClassPath(file, warn);
|
||||
}
|
||||
}
|
||||
@ -543,15 +549,9 @@ public class Locations {
|
||||
final Map<Option, String> optionValues = new EnumMap<>(Option.class);
|
||||
|
||||
/**
|
||||
* rt.jar as found on the default bootclasspath. If the user specified a bootclasspath, null
|
||||
* is used.
|
||||
* Is the bootclasspath the default?
|
||||
*/
|
||||
private File defaultBootClassPathRtJar = null;
|
||||
|
||||
/**
|
||||
* Is bootclasspath the default?
|
||||
*/
|
||||
private boolean isDefaultBootClassPath;
|
||||
private boolean isDefault;
|
||||
|
||||
BootClassPathLocationHandler() {
|
||||
super(StandardLocation.PLATFORM_CLASS_PATH,
|
||||
@ -564,12 +564,7 @@ public class Locations {
|
||||
|
||||
boolean isDefault() {
|
||||
lazy();
|
||||
return isDefaultBootClassPath;
|
||||
}
|
||||
|
||||
boolean isDefaultRtJar(File file) {
|
||||
lazy();
|
||||
return file.equals(defaultBootClassPathRtJar);
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -614,16 +609,16 @@ public class Locations {
|
||||
if (files == null) {
|
||||
searchPath = null; // reset to "uninitialized"
|
||||
} else {
|
||||
defaultBootClassPathRtJar = null;
|
||||
isDefaultBootClassPath = false;
|
||||
isDefault = false;
|
||||
SearchPath p = new SearchPath().addFiles(files, false);
|
||||
searchPath = Collections.unmodifiableCollection(p);
|
||||
optionValues.clear();
|
||||
}
|
||||
}
|
||||
|
||||
SearchPath computePath() {
|
||||
defaultBootClassPathRtJar = null;
|
||||
SearchPath computePath() throws IOException {
|
||||
String java_home = System.getProperty("java.home");
|
||||
|
||||
SearchPath path = new SearchPath();
|
||||
|
||||
String bootclasspathOpt = optionValues.get(BOOTCLASSPATH);
|
||||
@ -643,13 +638,13 @@ public class Locations {
|
||||
path.addFiles(bootclasspathOpt);
|
||||
} else {
|
||||
// Standard system classes for this compiler's release.
|
||||
String files = System.getProperty("sun.boot.class.path");
|
||||
path.addFiles(files, false);
|
||||
File rt_jar = new File("rt.jar");
|
||||
for (File file : getPathEntries(files)) {
|
||||
if (new File(file.getName()).equals(rt_jar)) {
|
||||
defaultBootClassPathRtJar = file;
|
||||
}
|
||||
Collection<File> systemClasses = systemClasses(java_home);
|
||||
if (systemClasses != null) {
|
||||
path.addFiles(systemClasses, false);
|
||||
} else {
|
||||
// fallback to the value of sun.boot.class.path
|
||||
String files = System.getProperty("sun.boot.class.path");
|
||||
path.addFiles(files, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,20 +656,69 @@ public class Locations {
|
||||
if (extdirsOpt != null) {
|
||||
path.addDirectories(extdirsOpt);
|
||||
} else {
|
||||
// Add lib/jfxrt.jar to the search path
|
||||
File jfxrt = new File(new File(java_home, "lib"), "jfxrt.jar");
|
||||
if (jfxrt.exists()) {
|
||||
path.addFile(jfxrt, false);
|
||||
}
|
||||
path.addDirectories(System.getProperty("java.ext.dirs"), false);
|
||||
}
|
||||
|
||||
isDefaultBootClassPath
|
||||
= (xbootclasspathPrependOpt == null)
|
||||
isDefault =
|
||||
(xbootclasspathPrependOpt == null)
|
||||
&& (bootclasspathOpt == null)
|
||||
&& (xbootclasspathAppendOpt == null);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a collection of files containing system classes.
|
||||
* Returns {@code null} if not running on a modular image.
|
||||
*
|
||||
* @throws UncheckedIOException if an I/O errors occurs
|
||||
*/
|
||||
private Collection<File> systemClasses(String java_home) throws IOException {
|
||||
// Return .jimage files if available
|
||||
Path libModules = Paths.get(java_home, "lib", "modules");
|
||||
if (Files.exists(libModules)) {
|
||||
try (Stream<Path> files = Files.list(libModules)) {
|
||||
boolean haveJImageFiles =
|
||||
files.anyMatch(f -> f.getFileName().toString().endsWith(".jimage"));
|
||||
if (haveJImageFiles) {
|
||||
return Collections.singleton(JRT_MARKER_FILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary: if no .jimage files, return individual modules
|
||||
if (Files.exists(libModules.resolve("java.base"))) {
|
||||
return Files.list(libModules)
|
||||
.map(d -> d.resolve("classes"))
|
||||
.map(Path::toFile)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// Exploded module image
|
||||
Path modules = Paths.get(java_home, "modules");
|
||||
if (Files.isDirectory(modules.resolve("java.base"))) {
|
||||
return Files.list(modules)
|
||||
.map(Path::toFile)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// not a modular image that we know about
|
||||
return null;
|
||||
}
|
||||
|
||||
private void lazy() {
|
||||
if (searchPath == null) {
|
||||
try {
|
||||
searchPath = Collections.unmodifiableCollection(computePath());
|
||||
} catch (IOException e) {
|
||||
// TODO: need better handling here, e.g. javac Abort?
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,8 +26,13 @@
|
||||
package com.sun.tools.javac.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import javax.tools.JavaFileObject;
|
||||
|
||||
/**
|
||||
@ -58,6 +63,16 @@ public abstract class RelativePath implements Comparable<RelativePath> {
|
||||
return new File(directory, path.replace('/', File.separatorChar));
|
||||
}
|
||||
|
||||
public Path getFile(Path directory) throws /*unchecked*/ InvalidPathException {
|
||||
if (directory == null) {
|
||||
String sep = FileSystems.getDefault().getSeparator();
|
||||
return Paths.get(path.replace("/", sep));
|
||||
} else {
|
||||
String sep = directory.getFileSystem().getSeparator();
|
||||
return directory.resolve(path.replace("/", sep));
|
||||
}
|
||||
}
|
||||
|
||||
public int compareTo(RelativePath other) {
|
||||
return path.compareTo(other.path);
|
||||
}
|
||||
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.javac.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import javax.tools.JavaFileObject;
|
||||
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeFile;
|
||||
import com.sun.tools.javac.util.List;
|
||||
|
||||
/**
|
||||
* <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 SymbolArchive extends ZipArchive {
|
||||
|
||||
final File origFile;
|
||||
final RelativeDirectory prefix;
|
||||
|
||||
public SymbolArchive(JavacFileManager fileManager, File orig, ZipFile zdir, RelativeDirectory prefix) throws IOException {
|
||||
super(fileManager, zdir, false);
|
||||
this.origFile = orig;
|
||||
this.prefix = prefix;
|
||||
initMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
void addZipEntry(ZipEntry entry) {
|
||||
String name = entry.getName();
|
||||
if (!name.startsWith(prefix.path)) {
|
||||
return;
|
||||
}
|
||||
name = name.substring(prefix.path.length());
|
||||
int i = name.lastIndexOf('/');
|
||||
RelativeDirectory dirname = new RelativeDirectory(name.substring(0, i+1));
|
||||
String basename = name.substring(i + 1);
|
||||
if (basename.length() == 0) {
|
||||
return;
|
||||
}
|
||||
List<String> list = map.get(dirname);
|
||||
if (list == null)
|
||||
list = List.nil();
|
||||
list = list.prepend(basename);
|
||||
map.put(dirname, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaFileObject getFileObject(RelativeDirectory subdirectory, String file) {
|
||||
RelativeDirectory prefix_subdir = new RelativeDirectory(prefix, subdirectory.path);
|
||||
ZipEntry ze = new RelativeFile(prefix_subdir, file).getZipEntry(zfile);
|
||||
return new SymbolFileObject(this, file, ze);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SymbolArchive[" + zfile.getName() + "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* A subclass of JavaFileObject representing zip entries in a symbol file.
|
||||
*/
|
||||
public static class SymbolFileObject extends ZipFileObject {
|
||||
protected SymbolFileObject(SymbolArchive zarch, String name, ZipEntry entry) {
|
||||
super(zarch, name, entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String inferBinaryName(Iterable<? extends File> path) {
|
||||
String entryName = entry.getName();
|
||||
String prefix = ((SymbolArchive) zarch).prefix.path;
|
||||
if (entryName.startsWith(prefix))
|
||||
entryName = entryName.substring(prefix.length());
|
||||
return removeExtension(entryName).replace('/', '.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1299,21 +1299,7 @@ public class ClassReader {
|
||||
ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
|
||||
for (int i = 0; i<numAttributes; i++) {
|
||||
CompoundAnnotationProxy proxy = readCompoundAnnotation();
|
||||
if (proxy.type.tsym == syms.proprietaryType.tsym)
|
||||
sym.flags_field |= PROPRIETARY;
|
||||
else if (proxy.type.tsym == syms.profileType.tsym) {
|
||||
if (profile != Profile.DEFAULT) {
|
||||
for (Pair<Name,Attribute> v: proxy.values) {
|
||||
if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
|
||||
Attribute.Constant c = (Attribute.Constant) v.snd;
|
||||
if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
|
||||
sym.flags_field |= NOT_IN_PROFILE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
proxies.append(proxy);
|
||||
proxies.append(proxy);
|
||||
}
|
||||
annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
|
||||
Path name = dir.getFileName();
|
||||
if (name == null || SourceVersion.isIdentifier(name.toString())) // JSR 292?
|
||||
if (name == null || SourceVersion.isIdentifier(name.toString()))
|
||||
return FileVisitResult.CONTINUE;
|
||||
else
|
||||
return FileVisitResult.SKIP_SUBTREE;
|
||||
@ -377,6 +377,9 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
if (attrs.isRegularFile() && kinds.contains(getKind(file.getFileName().toString()))) {
|
||||
// WORKAROUND for .jimage files
|
||||
if (!file.isAbsolute())
|
||||
file = pathDir.resolve(file);
|
||||
JavaFileObject fe =
|
||||
PathFileObject.createDirectoryPathFileObject(
|
||||
JavacPathFileManager.this, file, pathDir);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -62,19 +62,19 @@ import com.sun.tools.javac.util.DefinedBy.Api;
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
abstract class PathFileObject implements JavaFileObject {
|
||||
private JavacPathFileManager fileManager;
|
||||
private Path path;
|
||||
public abstract class PathFileObject implements JavaFileObject {
|
||||
private final BaseFileManager fileManager;
|
||||
private final Path path;
|
||||
|
||||
/**
|
||||
* Create a PathFileObject within a directory, such that the binary name
|
||||
* can be inferred from the relationship to the parent directory.
|
||||
*/
|
||||
static PathFileObject createDirectoryPathFileObject(JavacPathFileManager fileManager,
|
||||
static PathFileObject createDirectoryPathFileObject(BaseFileManager fileManager,
|
||||
final Path path, final Path dir) {
|
||||
return new PathFileObject(fileManager, path) {
|
||||
@Override
|
||||
String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
public String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
return toBinaryName(dir.relativize(path));
|
||||
}
|
||||
};
|
||||
@ -84,25 +84,40 @@ abstract class PathFileObject implements JavaFileObject {
|
||||
* Create a PathFileObject in a file system such as a jar file, such that
|
||||
* the binary name can be inferred from its position within the filesystem.
|
||||
*/
|
||||
static PathFileObject createJarPathFileObject(JavacPathFileManager fileManager,
|
||||
public static PathFileObject createJarPathFileObject(BaseFileManager fileManager,
|
||||
final Path path) {
|
||||
return new PathFileObject(fileManager, path) {
|
||||
@Override
|
||||
String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
public String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
return toBinaryName(path);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a PathFileObject in a modular file system, such as jrt:, such that
|
||||
* the binary name can be inferred from its position within the filesystem.
|
||||
*/
|
||||
public static PathFileObject createJRTPathFileObject(BaseFileManager fileManager,
|
||||
final Path path) {
|
||||
return new PathFileObject(fileManager, path) {
|
||||
@Override
|
||||
public String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
// use subpath to ignore the leading component containing the module name
|
||||
return toBinaryName(path.subpath(1, path.getNameCount()));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a PathFileObject whose binary name can be inferred from the
|
||||
* relative path to a sibling.
|
||||
*/
|
||||
static PathFileObject createSiblingPathFileObject(JavacPathFileManager fileManager,
|
||||
static PathFileObject createSiblingPathFileObject(BaseFileManager fileManager,
|
||||
final Path path, final String relativePath) {
|
||||
return new PathFileObject(fileManager, path) {
|
||||
@Override
|
||||
String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
public String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
return toBinaryName(relativePath, "/");
|
||||
}
|
||||
};
|
||||
@ -112,11 +127,11 @@ abstract class PathFileObject implements JavaFileObject {
|
||||
* Create a PathFileObject whose binary name might be inferred from its
|
||||
* position on a search path.
|
||||
*/
|
||||
static PathFileObject createSimplePathFileObject(JavacPathFileManager fileManager,
|
||||
static PathFileObject createSimplePathFileObject(BaseFileManager fileManager,
|
||||
final Path path) {
|
||||
return new PathFileObject(fileManager, path) {
|
||||
@Override
|
||||
String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
public String inferBinaryName(Iterable<? extends Path> paths) {
|
||||
Path absPath = path.toAbsolutePath();
|
||||
for (Path p: paths) {
|
||||
Path ap = p.toAbsolutePath();
|
||||
@ -135,20 +150,20 @@ abstract class PathFileObject implements JavaFileObject {
|
||||
};
|
||||
}
|
||||
|
||||
protected PathFileObject(JavacPathFileManager fileManager, Path path) {
|
||||
protected PathFileObject(BaseFileManager fileManager, Path path) {
|
||||
fileManager.getClass(); // null check
|
||||
path.getClass(); // null check
|
||||
this.fileManager = fileManager;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
abstract String inferBinaryName(Iterable<? extends Path> paths);
|
||||
public abstract String inferBinaryName(Iterable<? extends Path> paths);
|
||||
|
||||
/**
|
||||
* Return the Path for this object.
|
||||
* @return the Path for this object.
|
||||
*/
|
||||
Path getPath() {
|
||||
public Path getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,749 @@
|
||||
apple.applescript.*: hidden
|
||||
apple.laf.*: hidden
|
||||
apple.security.*: hidden
|
||||
com.apple.concurrent.*: hidden
|
||||
com.apple.eawt.*: hidden
|
||||
com.apple.eawt.event.*: hidden
|
||||
com.apple.eio.*: hidden
|
||||
com.apple.laf.*: hidden
|
||||
com.oracle.webservices.internal.api.*: hidden
|
||||
com.oracle.webservices.internal.api.databinding.*: hidden
|
||||
com.oracle.webservices.internal.api.message.*: hidden
|
||||
com.oracle.webservices.internal.impl.encoding.*: hidden
|
||||
com.oracle.webservices.internal.impl.internalspi.encoding.*: hidden
|
||||
com.oracle.xmlns.internal.webservices.jaxws_databinding.*: hidden
|
||||
com.sun.accessibility.internal.resources.*: proprietary
|
||||
com.sun.activation.registries.*: hidden
|
||||
com.sun.awt.*: proprietary
|
||||
com.sun.beans.*: proprietary
|
||||
com.sun.beans.decoder.*: hidden
|
||||
com.sun.beans.editors.*: hidden
|
||||
com.sun.beans.finder.*: hidden
|
||||
com.sun.beans.infos.*: hidden
|
||||
com.sun.beans.introspect.*: hidden
|
||||
com.sun.beans.util.*: hidden
|
||||
com.sun.corba.se.impl.activation.*: proprietary
|
||||
com.sun.corba.se.impl.copyobject.*: proprietary
|
||||
com.sun.corba.se.impl.corba.*: proprietary
|
||||
com.sun.corba.se.impl.dynamicany.*: proprietary
|
||||
com.sun.corba.se.impl.encoding.*: proprietary
|
||||
com.sun.corba.se.impl.interceptors.*: proprietary
|
||||
com.sun.corba.se.impl.io.*: proprietary
|
||||
com.sun.corba.se.impl.ior.*: proprietary
|
||||
com.sun.corba.se.impl.ior.iiop.*: proprietary
|
||||
com.sun.corba.se.impl.javax.rmi.*: proprietary
|
||||
com.sun.corba.se.impl.javax.rmi.CORBA.*: proprietary
|
||||
com.sun.corba.se.impl.legacy.connection.*: proprietary
|
||||
com.sun.corba.se.impl.logging.*: proprietary
|
||||
com.sun.corba.se.impl.monitoring.*: proprietary
|
||||
com.sun.corba.se.impl.naming.cosnaming.*: proprietary
|
||||
com.sun.corba.se.impl.naming.namingutil.*: proprietary
|
||||
com.sun.corba.se.impl.naming.pcosnaming.*: proprietary
|
||||
com.sun.corba.se.impl.oa.*: proprietary
|
||||
com.sun.corba.se.impl.oa.poa.*: proprietary
|
||||
com.sun.corba.se.impl.oa.toa.*: proprietary
|
||||
com.sun.corba.se.impl.orb.*: proprietary
|
||||
com.sun.corba.se.impl.orbutil.*: proprietary
|
||||
com.sun.corba.se.impl.orbutil.closure.*: proprietary
|
||||
com.sun.corba.se.impl.orbutil.concurrent.*: proprietary
|
||||
com.sun.corba.se.impl.orbutil.fsm.*: proprietary
|
||||
com.sun.corba.se.impl.orbutil.graph.*: proprietary
|
||||
com.sun.corba.se.impl.orbutil.threadpool.*: proprietary
|
||||
com.sun.corba.se.impl.presentation.rmi.*: proprietary
|
||||
com.sun.corba.se.impl.protocol.*: proprietary
|
||||
com.sun.corba.se.impl.protocol.giopmsgheaders.*: proprietary
|
||||
com.sun.corba.se.impl.resolver.*: proprietary
|
||||
com.sun.corba.se.impl.transport.*: proprietary
|
||||
com.sun.corba.se.impl.util.*: proprietary
|
||||
com.sun.corba.se.internal.CosNaming.*: proprietary
|
||||
com.sun.corba.se.internal.Interceptors.*: proprietary
|
||||
com.sun.corba.se.internal.POA.*: proprietary
|
||||
com.sun.corba.se.internal.corba.*: proprietary
|
||||
com.sun.corba.se.internal.iiop.*: proprietary
|
||||
com.sun.corba.se.org.omg.CORBA.*: proprietary
|
||||
com.sun.corba.se.pept.broker.*: proprietary
|
||||
com.sun.corba.se.pept.encoding.*: proprietary
|
||||
com.sun.corba.se.pept.protocol.*: proprietary
|
||||
com.sun.corba.se.pept.transport.*: proprietary
|
||||
com.sun.corba.se.spi.activation.*: proprietary
|
||||
com.sun.corba.se.spi.activation.InitialNameServicePackage.*: proprietary
|
||||
com.sun.corba.se.spi.activation.LocatorPackage.*: proprietary
|
||||
com.sun.corba.se.spi.activation.RepositoryPackage.*: proprietary
|
||||
com.sun.corba.se.spi.copyobject.*: proprietary
|
||||
com.sun.corba.se.spi.encoding.*: proprietary
|
||||
com.sun.corba.se.spi.extension.*: proprietary
|
||||
com.sun.corba.se.spi.ior.*: proprietary
|
||||
com.sun.corba.se.spi.ior.iiop.*: proprietary
|
||||
com.sun.corba.se.spi.legacy.connection.*: proprietary
|
||||
com.sun.corba.se.spi.legacy.interceptor.*: proprietary
|
||||
com.sun.corba.se.spi.logging.*: proprietary
|
||||
com.sun.corba.se.spi.monitoring.*: proprietary
|
||||
com.sun.corba.se.spi.oa.*: proprietary
|
||||
com.sun.corba.se.spi.orb.*: proprietary
|
||||
com.sun.corba.se.spi.orbutil.closure.*: proprietary
|
||||
com.sun.corba.se.spi.orbutil.fsm.*: proprietary
|
||||
com.sun.corba.se.spi.orbutil.proxy.*: proprietary
|
||||
com.sun.corba.se.spi.orbutil.threadpool.*: proprietary
|
||||
com.sun.corba.se.spi.presentation.rmi.*: proprietary
|
||||
com.sun.corba.se.spi.protocol.*: proprietary
|
||||
com.sun.corba.se.spi.resolver.*: proprietary
|
||||
com.sun.corba.se.spi.servicecontext.*: proprietary
|
||||
com.sun.corba.se.spi.transport.*: proprietary
|
||||
com.sun.demo.jvmti.hprof.*: hidden
|
||||
com.sun.imageio.plugins.bmp.*: proprietary
|
||||
com.sun.imageio.plugins.common.*: proprietary
|
||||
com.sun.imageio.plugins.gif.*: proprietary
|
||||
com.sun.imageio.plugins.jpeg.*: proprietary
|
||||
com.sun.imageio.plugins.png.*: proprietary
|
||||
com.sun.imageio.plugins.wbmp.*: proprietary
|
||||
com.sun.imageio.spi.*: proprietary
|
||||
com.sun.imageio.stream.*: hidden
|
||||
com.sun.istack.internal.*: hidden
|
||||
com.sun.istack.internal.localization.*: hidden
|
||||
com.sun.istack.internal.logging.*: hidden
|
||||
com.sun.java.swing.*: proprietary
|
||||
com.sun.java.swing.plaf.gtk.resources.*: proprietary
|
||||
com.sun.java.swing.plaf.motif.resources.*: proprietary
|
||||
com.sun.java.swing.plaf.nimbus.*: proprietary
|
||||
com.sun.java.swing.plaf.windows.resources.*: proprietary
|
||||
com.sun.java.util.jar.pack.*: proprietary compact1
|
||||
com.sun.java_cup.internal.runtime.*: proprietary compact2
|
||||
com.sun.jmx.defaults.*: proprietary compact3
|
||||
com.sun.jmx.interceptor.*: proprietary compact3
|
||||
com.sun.jmx.mbeanserver.*: proprietary compact3
|
||||
com.sun.jmx.remote.internal.*: proprietary compact3
|
||||
com.sun.jmx.remote.protocol.rmi.*: proprietary compact3
|
||||
com.sun.jmx.remote.security.*: proprietary compact3
|
||||
com.sun.jmx.remote.util.*: proprietary compact3
|
||||
com.sun.jndi.cosnaming.*: proprietary
|
||||
com.sun.jndi.dns.*: proprietary compact3
|
||||
com.sun.jndi.ldap.*: proprietary compact3
|
||||
com.sun.jndi.ldap.ext.*: proprietary compact3
|
||||
com.sun.jndi.ldap.pool.*: proprietary compact3
|
||||
com.sun.jndi.ldap.sasl.*: proprietary compact3
|
||||
com.sun.jndi.rmi.registry.*: proprietary compact3
|
||||
com.sun.jndi.toolkit.corba.*: proprietary
|
||||
com.sun.jndi.toolkit.ctx.*: proprietary compact3
|
||||
com.sun.jndi.toolkit.dir.*: proprietary compact3
|
||||
com.sun.jndi.toolkit.url.*: proprietary compact3
|
||||
com.sun.jndi.url.corbaname.*: proprietary
|
||||
com.sun.jndi.url.dns.*: proprietary compact3
|
||||
com.sun.jndi.url.iiop.*: proprietary
|
||||
com.sun.jndi.url.iiopname.*: proprietary
|
||||
com.sun.jndi.url.ldap.*: proprietary compact3
|
||||
com.sun.jndi.url.ldaps.*: proprietary compact3
|
||||
com.sun.jndi.url.rmi.*: proprietary compact3
|
||||
com.sun.management.*: compact3
|
||||
com.sun.media.sound.*: proprietary
|
||||
com.sun.naming.internal.*: proprietary compact3
|
||||
com.sun.net.httpserver.*: compact2
|
||||
com.sun.net.httpserver.spi.*: compact2
|
||||
com.sun.net.ssl.*: compact1
|
||||
com.sun.net.ssl.internal.www.protocol.https.*: proprietary compact1
|
||||
com.sun.nio.file.*: compact1
|
||||
com.sun.nio.sctp.*: compact3
|
||||
com.sun.org.apache.bcel.internal.*: proprietary compact2
|
||||
com.sun.org.apache.bcel.internal.classfile.*: proprietary compact2
|
||||
com.sun.org.apache.bcel.internal.generic.*: proprietary compact2
|
||||
com.sun.org.apache.bcel.internal.util.*: proprietary compact2
|
||||
com.sun.org.apache.regexp.internal.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.extensions.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.lib.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.res.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.templates.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.utils.*: hidden
|
||||
com.sun.org.apache.xalan.internal.xslt.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.cmdline.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.compiler.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.compiler.util.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.dom.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.runtime.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.runtime.output.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.trax.*: proprietary compact2
|
||||
com.sun.org.apache.xalan.internal.xsltc.util.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.dom.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.dom.events.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.dtd.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.dtd.models.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.dv.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.dv.dtd.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.dv.util.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.dv.xs.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.io.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.msg.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.validation.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xpath.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xpath.regex.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xs.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xs.identity.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xs.models.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xs.opti.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xs.traversers.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.impl.xs.util.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.jaxp.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.jaxp.datatype.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.jaxp.validation.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.parsers.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.util.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.utils.*: hidden
|
||||
com.sun.org.apache.xerces.internal.xinclude.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.xni.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.xni.grammars.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.xni.parser.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.xpointer.*: hidden
|
||||
com.sun.org.apache.xerces.internal.xs.*: proprietary compact2
|
||||
com.sun.org.apache.xerces.internal.xs.datatypes.*: hidden
|
||||
com.sun.org.apache.xml.internal.dtm.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.dtm.ref.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.res.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.resolver.*: hidden
|
||||
com.sun.org.apache.xml.internal.resolver.helpers.*: hidden
|
||||
com.sun.org.apache.xml.internal.resolver.readers.*: hidden
|
||||
com.sun.org.apache.xml.internal.resolver.tools.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.algorithms.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.algorithms.implementations.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.c14n.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.c14n.helper.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.c14n.implementations.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.encryption.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.exceptions.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.content.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.content.keyvalues.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.content.x509.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.keyresolver.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.storage.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.keys.storage.implementations.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.signature.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.signature.reference.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.transforms.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.transforms.implementations.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.transforms.params.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.utils.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.utils.resolver.*: hidden
|
||||
com.sun.org.apache.xml.internal.security.utils.resolver.implementations.*: hidden
|
||||
com.sun.org.apache.xml.internal.serialize.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.serializer.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.serializer.dom3.*: hidden
|
||||
com.sun.org.apache.xml.internal.serializer.utils.*: hidden
|
||||
com.sun.org.apache.xml.internal.utils.*: proprietary compact2
|
||||
com.sun.org.apache.xml.internal.utils.res.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.axes.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.compiler.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.domapi.*: hidden
|
||||
com.sun.org.apache.xpath.internal.functions.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.jaxp.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.objects.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.operations.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.patterns.*: proprietary compact2
|
||||
com.sun.org.apache.xpath.internal.res.*: proprietary compact2
|
||||
com.sun.org.glassfish.external.amx.*: hidden
|
||||
com.sun.org.glassfish.external.arc.*: hidden
|
||||
com.sun.org.glassfish.external.probe.provider.*: hidden
|
||||
com.sun.org.glassfish.external.probe.provider.annotations.*: hidden
|
||||
com.sun.org.glassfish.external.statistics.*: hidden
|
||||
com.sun.org.glassfish.external.statistics.annotations.*: hidden
|
||||
com.sun.org.glassfish.external.statistics.impl.*: hidden
|
||||
com.sun.org.glassfish.gmbal.*: hidden
|
||||
com.sun.org.glassfish.gmbal.util.*: hidden
|
||||
com.sun.org.omg.CORBA.*: proprietary
|
||||
com.sun.org.omg.CORBA.ValueDefPackage.*: proprietary
|
||||
com.sun.org.omg.CORBA.portable.*: proprietary
|
||||
com.sun.org.omg.SendingContext.*: proprietary
|
||||
com.sun.org.omg.SendingContext.CodeBasePackage.*: proprietary
|
||||
com.sun.rmi.rmid.*: proprietary compact2
|
||||
com.sun.rowset.*: proprietary compact3
|
||||
com.sun.rowset.internal.*: proprietary compact3
|
||||
com.sun.rowset.providers.*: proprietary compact3
|
||||
com.sun.security.auth.*: compact3
|
||||
com.sun.security.auth.callback.*: compact3
|
||||
com.sun.security.auth.login.*: compact3
|
||||
com.sun.security.auth.module.*: compact3
|
||||
com.sun.security.cert.internal.x509.*: proprietary compact1
|
||||
com.sun.security.jgss.*: compact3
|
||||
com.sun.security.ntlm.*: hidden
|
||||
com.sun.security.sasl.*: proprietary compact3
|
||||
com.sun.security.sasl.digest.*: proprietary compact3
|
||||
com.sun.security.sasl.gsskerb.*: proprietary compact3
|
||||
com.sun.security.sasl.ntlm.*: hidden
|
||||
com.sun.security.sasl.util.*: proprietary compact3
|
||||
com.sun.swing.internal.plaf.basic.resources.*: proprietary
|
||||
com.sun.swing.internal.plaf.metal.resources.*: proprietary
|
||||
com.sun.swing.internal.plaf.synth.resources.*: proprietary
|
||||
com.sun.tracing.*: proprietary compact3
|
||||
com.sun.tracing.dtrace.*: proprietary compact3
|
||||
com.sun.xml.internal.bind.*: hidden
|
||||
com.sun.xml.internal.bind.annotation.*: hidden
|
||||
com.sun.xml.internal.bind.api.*: hidden
|
||||
com.sun.xml.internal.bind.api.impl.*: hidden
|
||||
com.sun.xml.internal.bind.marshaller.*: hidden
|
||||
com.sun.xml.internal.bind.unmarshaller.*: hidden
|
||||
com.sun.xml.internal.bind.util.*: hidden
|
||||
com.sun.xml.internal.bind.v2.*: hidden
|
||||
com.sun.xml.internal.bind.v2.bytecode.*: hidden
|
||||
com.sun.xml.internal.bind.v2.model.annotation.*: hidden
|
||||
com.sun.xml.internal.bind.v2.model.core.*: hidden
|
||||
com.sun.xml.internal.bind.v2.model.impl.*: hidden
|
||||
com.sun.xml.internal.bind.v2.model.nav.*: hidden
|
||||
com.sun.xml.internal.bind.v2.model.runtime.*: hidden
|
||||
com.sun.xml.internal.bind.v2.model.util.*: hidden
|
||||
com.sun.xml.internal.bind.v2.runtime.*: hidden
|
||||
com.sun.xml.internal.bind.v2.runtime.output.*: hidden
|
||||
com.sun.xml.internal.bind.v2.runtime.property.*: hidden
|
||||
com.sun.xml.internal.bind.v2.runtime.reflect.*: hidden
|
||||
com.sun.xml.internal.bind.v2.runtime.reflect.opt.*: hidden
|
||||
com.sun.xml.internal.bind.v2.runtime.unmarshaller.*: hidden
|
||||
com.sun.xml.internal.bind.v2.schemagen.*: hidden
|
||||
com.sun.xml.internal.bind.v2.schemagen.episode.*: hidden
|
||||
com.sun.xml.internal.bind.v2.schemagen.xmlschema.*: hidden
|
||||
com.sun.xml.internal.bind.v2.util.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.algorithm.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.alphabet.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.dom.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.org.apache.xerces.util.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.sax.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.stax.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.stax.events.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.stax.factory.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.stax.util.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.tools.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.util.*: hidden
|
||||
com.sun.xml.internal.fastinfoset.vocab.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.client.p2p.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.packaging.mime.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.packaging.mime.internet.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.packaging.mime.util.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.soap.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.soap.dynamic.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.soap.impl.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.soap.name.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.soap.ver1_1.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.soap.ver1_2.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.util.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.util.stax.*: hidden
|
||||
com.sun.xml.internal.messaging.saaj.util.transform.*: hidden
|
||||
com.sun.xml.internal.org.jvnet.fastinfoset.*: hidden
|
||||
com.sun.xml.internal.org.jvnet.fastinfoset.sax.*: hidden
|
||||
com.sun.xml.internal.org.jvnet.fastinfoset.sax.helpers.*: hidden
|
||||
com.sun.xml.internal.org.jvnet.fastinfoset.stax.*: hidden
|
||||
com.sun.xml.internal.org.jvnet.mimepull.*: hidden
|
||||
com.sun.xml.internal.org.jvnet.staxex.*: hidden
|
||||
com.sun.xml.internal.org.jvnet.staxex.util.*: hidden
|
||||
com.sun.xml.internal.stream.*: hidden
|
||||
com.sun.xml.internal.stream.buffer.*: hidden
|
||||
com.sun.xml.internal.stream.buffer.sax.*: hidden
|
||||
com.sun.xml.internal.stream.buffer.stax.*: hidden
|
||||
com.sun.xml.internal.stream.dtd.*: hidden
|
||||
com.sun.xml.internal.stream.dtd.nonvalidating.*: hidden
|
||||
com.sun.xml.internal.stream.events.*: hidden
|
||||
com.sun.xml.internal.stream.util.*: hidden
|
||||
com.sun.xml.internal.stream.writers.*: hidden
|
||||
com.sun.xml.internal.txw2.*: hidden
|
||||
com.sun.xml.internal.txw2.annotation.*: hidden
|
||||
com.sun.xml.internal.txw2.output.*: hidden
|
||||
com.sun.xml.internal.ws.*: hidden
|
||||
com.sun.xml.internal.ws.addressing.*: hidden
|
||||
com.sun.xml.internal.ws.addressing.model.*: hidden
|
||||
com.sun.xml.internal.ws.addressing.policy.*: hidden
|
||||
com.sun.xml.internal.ws.addressing.v200408.*: hidden
|
||||
com.sun.xml.internal.ws.api.*: hidden
|
||||
com.sun.xml.internal.ws.api.addressing.*: hidden
|
||||
com.sun.xml.internal.ws.api.client.*: hidden
|
||||
com.sun.xml.internal.ws.api.config.management.*: hidden
|
||||
com.sun.xml.internal.ws.api.config.management.policy.*: hidden
|
||||
com.sun.xml.internal.ws.api.databinding.*: hidden
|
||||
com.sun.xml.internal.ws.api.fastinfoset.*: hidden
|
||||
com.sun.xml.internal.ws.api.ha.*: hidden
|
||||
com.sun.xml.internal.ws.api.handler.*: hidden
|
||||
com.sun.xml.internal.ws.api.message.*: hidden
|
||||
com.sun.xml.internal.ws.api.message.saaj.*: hidden
|
||||
com.sun.xml.internal.ws.api.message.stream.*: hidden
|
||||
com.sun.xml.internal.ws.api.model.*: hidden
|
||||
com.sun.xml.internal.ws.api.model.soap.*: hidden
|
||||
com.sun.xml.internal.ws.api.model.wsdl.*: hidden
|
||||
com.sun.xml.internal.ws.api.model.wsdl.editable.*: hidden
|
||||
com.sun.xml.internal.ws.api.pipe.*: hidden
|
||||
com.sun.xml.internal.ws.api.pipe.helper.*: hidden
|
||||
com.sun.xml.internal.ws.api.policy.*: hidden
|
||||
com.sun.xml.internal.ws.api.policy.subject.*: hidden
|
||||
com.sun.xml.internal.ws.api.server.*: hidden
|
||||
com.sun.xml.internal.ws.api.streaming.*: hidden
|
||||
com.sun.xml.internal.ws.api.wsdl.parser.*: hidden
|
||||
com.sun.xml.internal.ws.api.wsdl.writer.*: hidden
|
||||
com.sun.xml.internal.ws.assembler.*: hidden
|
||||
com.sun.xml.internal.ws.assembler.dev.*: hidden
|
||||
com.sun.xml.internal.ws.assembler.jaxws.*: hidden
|
||||
com.sun.xml.internal.ws.binding.*: hidden
|
||||
com.sun.xml.internal.ws.client.*: hidden
|
||||
com.sun.xml.internal.ws.client.dispatch.*: hidden
|
||||
com.sun.xml.internal.ws.client.sei.*: hidden
|
||||
com.sun.xml.internal.ws.commons.xmlutil.*: hidden
|
||||
com.sun.xml.internal.ws.config.management.policy.*: hidden
|
||||
com.sun.xml.internal.ws.config.metro.dev.*: hidden
|
||||
com.sun.xml.internal.ws.config.metro.util.*: hidden
|
||||
com.sun.xml.internal.ws.db.*: hidden
|
||||
com.sun.xml.internal.ws.db.glassfish.*: hidden
|
||||
com.sun.xml.internal.ws.developer.*: hidden
|
||||
com.sun.xml.internal.ws.dump.*: hidden
|
||||
com.sun.xml.internal.ws.encoding.*: hidden
|
||||
com.sun.xml.internal.ws.encoding.fastinfoset.*: hidden
|
||||
com.sun.xml.internal.ws.encoding.policy.*: hidden
|
||||
com.sun.xml.internal.ws.encoding.soap.*: hidden
|
||||
com.sun.xml.internal.ws.encoding.soap.streaming.*: hidden
|
||||
com.sun.xml.internal.ws.encoding.xml.*: hidden
|
||||
com.sun.xml.internal.ws.fault.*: hidden
|
||||
com.sun.xml.internal.ws.handler.*: hidden
|
||||
com.sun.xml.internal.ws.message.*: hidden
|
||||
com.sun.xml.internal.ws.message.jaxb.*: hidden
|
||||
com.sun.xml.internal.ws.message.saaj.*: hidden
|
||||
com.sun.xml.internal.ws.message.source.*: hidden
|
||||
com.sun.xml.internal.ws.message.stream.*: hidden
|
||||
com.sun.xml.internal.ws.model.*: hidden
|
||||
com.sun.xml.internal.ws.model.soap.*: hidden
|
||||
com.sun.xml.internal.ws.model.wsdl.*: hidden
|
||||
com.sun.xml.internal.ws.org.objectweb.asm.*: hidden
|
||||
com.sun.xml.internal.ws.policy.*: hidden
|
||||
com.sun.xml.internal.ws.policy.jaxws.*: hidden
|
||||
com.sun.xml.internal.ws.policy.jaxws.spi.*: hidden
|
||||
com.sun.xml.internal.ws.policy.privateutil.*: hidden
|
||||
com.sun.xml.internal.ws.policy.sourcemodel.*: hidden
|
||||
com.sun.xml.internal.ws.policy.sourcemodel.attach.*: hidden
|
||||
com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.*: hidden
|
||||
com.sun.xml.internal.ws.policy.spi.*: hidden
|
||||
com.sun.xml.internal.ws.policy.subject.*: hidden
|
||||
com.sun.xml.internal.ws.protocol.soap.*: hidden
|
||||
com.sun.xml.internal.ws.protocol.xml.*: hidden
|
||||
com.sun.xml.internal.ws.resources.*: hidden
|
||||
com.sun.xml.internal.ws.runtime.config.*: hidden
|
||||
com.sun.xml.internal.ws.server.*: hidden
|
||||
com.sun.xml.internal.ws.server.provider.*: hidden
|
||||
com.sun.xml.internal.ws.server.sei.*: hidden
|
||||
com.sun.xml.internal.ws.spi.*: hidden
|
||||
com.sun.xml.internal.ws.spi.db.*: hidden
|
||||
com.sun.xml.internal.ws.streaming.*: hidden
|
||||
com.sun.xml.internal.ws.transport.*: hidden
|
||||
com.sun.xml.internal.ws.transport.http.*: hidden
|
||||
com.sun.xml.internal.ws.transport.http.client.*: hidden
|
||||
com.sun.xml.internal.ws.transport.http.server.*: hidden
|
||||
com.sun.xml.internal.ws.util.*: hidden
|
||||
com.sun.xml.internal.ws.util.exception.*: hidden
|
||||
com.sun.xml.internal.ws.util.pipe.*: hidden
|
||||
com.sun.xml.internal.ws.util.xml.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.parser.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.writer.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.writer.document.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.writer.document.http.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.writer.document.soap.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.writer.document.soap12.*: hidden
|
||||
com.sun.xml.internal.ws.wsdl.writer.document.xsd.*: hidden
|
||||
java.awt.dnd.peer.*: proprietary
|
||||
java.awt.peer.*: proprietary
|
||||
java.desktop.macosx.classes.com.apple.laf.resources.*: hidden
|
||||
java.desktop.macosx.classes.sun.awt.resources.*: hidden
|
||||
java.desktop.windows.classes.sun.awt.windows.*: hidden
|
||||
java.io.*: compact1
|
||||
java.lang.*: compact1
|
||||
java.lang.annotation.*: compact1
|
||||
java.lang.instrument.*: compact3
|
||||
java.lang.invoke.*: compact1
|
||||
java.lang.management.*: compact3
|
||||
java.lang.ref.*: compact1
|
||||
java.lang.reflect.*: compact1
|
||||
java.math.*: compact1
|
||||
java.net.*: compact1
|
||||
java.nio.*: compact1
|
||||
java.nio.channels.*: compact1
|
||||
java.nio.channels.spi.*: compact1
|
||||
java.nio.charset.*: compact1
|
||||
java.nio.charset.spi.*: compact1
|
||||
java.nio.file.*: compact1
|
||||
java.nio.file.attribute.*: compact1
|
||||
java.nio.file.spi.*: compact1
|
||||
java.rmi.*: compact2
|
||||
java.rmi.activation.*: compact2
|
||||
java.rmi.dgc.*: compact2
|
||||
java.rmi.registry.*: compact2
|
||||
java.rmi.server.*: compact2
|
||||
java.security.*: compact1
|
||||
java.security.acl.*: compact3
|
||||
java.security.cert.*: compact1
|
||||
java.security.interfaces.*: compact1
|
||||
java.security.spec.*: compact1
|
||||
java.sql.*: compact2
|
||||
java.text.*: compact1
|
||||
java.text.spi.*: compact1
|
||||
java.time.*: compact1
|
||||
java.time.chrono.*: compact1
|
||||
java.time.format.*: compact1
|
||||
java.time.temporal.*: compact1
|
||||
java.time.zone.*: compact1
|
||||
java.util.*: compact1
|
||||
java.util.concurrent.*: compact1
|
||||
java.util.concurrent.atomic.*: compact1
|
||||
java.util.concurrent.locks.*: compact1
|
||||
java.util.function.*: compact1
|
||||
java.util.jar.*: compact1
|
||||
java.util.logging.*: compact1
|
||||
java.util.prefs.*: compact3
|
||||
java.util.regex.*: compact1
|
||||
java.util.spi.*: compact1
|
||||
java.util.stream.*: compact1
|
||||
java.util.zip.*: compact1
|
||||
javax.annotation.processing.*: compact3
|
||||
javax.lang.model.*: compact3
|
||||
javax.lang.model.element.*: compact3
|
||||
javax.lang.model.type.*: compact3
|
||||
javax.lang.model.util.*: compact3
|
||||
javax.management.*: compact3
|
||||
javax.management.loading.*: compact3
|
||||
javax.management.modelmbean.*: compact3
|
||||
javax.management.monitor.*: compact3
|
||||
javax.management.openmbean.*: compact3
|
||||
javax.management.relation.*: compact3
|
||||
javax.management.remote.*: compact3
|
||||
javax.management.remote.rmi.*: compact3
|
||||
javax.management.timer.*: compact3
|
||||
javax.naming.*: compact3
|
||||
javax.naming.directory.*: compact3
|
||||
javax.naming.event.*: compact3
|
||||
javax.naming.ldap.*: compact3
|
||||
javax.naming.spi.*: compact3
|
||||
javax.net.*: compact1
|
||||
javax.net.ssl.*: compact1
|
||||
javax.rmi.ssl.*: compact2
|
||||
javax.script.*: compact1
|
||||
javax.security.auth.*: compact1
|
||||
javax.security.auth.callback.*: compact1
|
||||
javax.security.auth.kerberos.*: compact3
|
||||
javax.security.auth.login.*: compact1
|
||||
javax.security.auth.spi.*: compact1
|
||||
javax.security.auth.x500.*: compact1
|
||||
javax.security.cert.*: compact1
|
||||
javax.security.sasl.*: compact3
|
||||
javax.smartcardio.*: compact3
|
||||
javax.sql.*: compact2
|
||||
javax.sql.rowset.*: compact3
|
||||
javax.sql.rowset.serial.*: compact3
|
||||
javax.sql.rowset.spi.*: compact3
|
||||
javax.tools.*: compact3
|
||||
javax.transaction.xa.*: compact2
|
||||
javax.xml.*: compact2
|
||||
javax.xml.crypto.*: compact3
|
||||
javax.xml.crypto.dom.*: compact3
|
||||
javax.xml.crypto.dsig.*: compact3
|
||||
javax.xml.crypto.dsig.dom.*: compact3
|
||||
javax.xml.crypto.dsig.keyinfo.*: compact3
|
||||
javax.xml.crypto.dsig.spec.*: compact3
|
||||
javax.xml.datatype.*: compact2
|
||||
javax.xml.namespace.*: compact2
|
||||
javax.xml.parsers.*: compact2
|
||||
javax.xml.stream.*: compact2
|
||||
javax.xml.stream.events.*: compact2
|
||||
javax.xml.stream.util.*: compact2
|
||||
javax.xml.transform.*: compact2
|
||||
javax.xml.transform.dom.*: compact2
|
||||
javax.xml.transform.sax.*: compact2
|
||||
javax.xml.transform.stax.*: compact2
|
||||
javax.xml.transform.stream.*: compact2
|
||||
javax.xml.validation.*: compact2
|
||||
javax.xml.xpath.*: compact2
|
||||
jdk.*: compact1
|
||||
jdk.internal.org.objectweb.asm.*: hidden
|
||||
jdk.internal.org.objectweb.asm.commons.*: hidden
|
||||
jdk.internal.org.objectweb.asm.signature.*: hidden
|
||||
jdk.internal.org.objectweb.asm.tree.*: hidden
|
||||
jdk.internal.org.objectweb.asm.tree.analysis.*: hidden
|
||||
jdk.internal.org.objectweb.asm.util.*: hidden
|
||||
jdk.internal.org.xml.sax.*: hidden
|
||||
jdk.internal.org.xml.sax.helpers.*: hidden
|
||||
jdk.internal.util.xml.*: hidden
|
||||
jdk.internal.util.xml.impl.*: hidden
|
||||
jdk.net.*: compact1
|
||||
org.ietf.jgss.*: compact3
|
||||
org.jcp.xml.dsig.internal.*: hidden
|
||||
org.jcp.xml.dsig.internal.dom.*: hidden
|
||||
org.w3c.dom.*: compact2
|
||||
org.w3c.dom.bootstrap.*: compact2
|
||||
org.w3c.dom.css.*: compact2
|
||||
org.w3c.dom.events.*: compact2
|
||||
org.w3c.dom.html.*: compact2
|
||||
org.w3c.dom.ls.*: compact2
|
||||
org.w3c.dom.ranges.*: compact2
|
||||
org.w3c.dom.stylesheets.*: compact2
|
||||
org.w3c.dom.traversal.*: compact2
|
||||
org.w3c.dom.views.*: compact2
|
||||
org.w3c.dom.xpath.*: hidden
|
||||
org.xml.sax.*: compact2
|
||||
org.xml.sax.ext.*: compact2
|
||||
org.xml.sax.helpers.*: compact2
|
||||
sun.applet.*: proprietary
|
||||
sun.applet.resources.*: proprietary
|
||||
sun.awt.*: proprietary
|
||||
sun.awt.X11.*: proprietary
|
||||
sun.awt.datatransfer.*: proprietary
|
||||
sun.awt.dnd.*: proprietary
|
||||
sun.awt.event.*: hidden
|
||||
sun.awt.geom.*: proprietary
|
||||
sun.awt.im.*: proprietary
|
||||
sun.awt.image.*: proprietary
|
||||
sun.awt.motif.*: proprietary
|
||||
sun.awt.resources.*: proprietary
|
||||
sun.awt.shell.*: proprietary
|
||||
sun.awt.util.*: hidden
|
||||
sun.awt.windows.*: proprietary
|
||||
sun.corba.*: proprietary
|
||||
sun.datatransfer.*: hidden
|
||||
sun.font.*: proprietary
|
||||
sun.instrument.*: proprietary compact3
|
||||
sun.invoke.*: hidden
|
||||
sun.invoke.anon.*: hidden
|
||||
sun.invoke.empty.*: hidden
|
||||
sun.invoke.util.*: hidden
|
||||
sun.io.*: proprietary compact1
|
||||
sun.java2d.*: proprietary
|
||||
sun.java2d.cmm.*: hidden
|
||||
sun.java2d.cmm.lcms.*: hidden
|
||||
sun.java2d.d3d.*: hidden
|
||||
sun.java2d.jules.*: hidden
|
||||
sun.java2d.loops.*: proprietary
|
||||
sun.java2d.opengl.*: proprietary
|
||||
sun.java2d.pipe.*: proprietary
|
||||
sun.java2d.pipe.hw.*: hidden
|
||||
sun.java2d.pisces.*: hidden
|
||||
sun.java2d.windows.*: hidden
|
||||
sun.java2d.x11.*: hidden
|
||||
sun.java2d.xr.*: hidden
|
||||
sun.launcher.*: hidden
|
||||
sun.launcher.resources.*: hidden
|
||||
sun.lwawt.*: hidden
|
||||
sun.lwawt.macosx.*: hidden
|
||||
sun.management.*: proprietary compact3
|
||||
sun.management.counter.*: proprietary compact3
|
||||
sun.management.counter.perf.*: proprietary compact3
|
||||
sun.management.jdp.*: hidden
|
||||
sun.management.jmxremote.*: proprietary compact3
|
||||
sun.management.resources.*: proprietary compact3
|
||||
sun.misc.*: proprietary compact1
|
||||
sun.misc.resources.*: proprietary compact1
|
||||
sun.net.*: proprietary compact1
|
||||
sun.net.dns.*: proprietary compact3
|
||||
sun.net.ftp.*: proprietary
|
||||
sun.net.ftp.impl.*: hidden
|
||||
sun.net.httpserver.*: hidden
|
||||
sun.net.idn.*: hidden
|
||||
sun.net.sdp.*: hidden
|
||||
sun.net.smtp.*: proprietary
|
||||
sun.net.spi.*: proprietary compact1
|
||||
sun.net.spi.nameservice.*: proprietary compact1
|
||||
sun.net.util.*: proprietary compact1
|
||||
sun.net.www.*: proprietary compact1
|
||||
sun.net.www.content.audio.*: proprietary
|
||||
sun.net.www.content.image.*: proprietary
|
||||
sun.net.www.content.text.*: proprietary
|
||||
sun.net.www.http.*: proprietary compact1
|
||||
sun.net.www.protocol.file.*: proprietary compact1
|
||||
sun.net.www.protocol.ftp.*: proprietary
|
||||
sun.net.www.protocol.http.*: proprietary compact1
|
||||
sun.net.www.protocol.http.logging.*: hidden
|
||||
sun.net.www.protocol.http.ntlm.*: hidden
|
||||
sun.net.www.protocol.http.spnego.*: hidden
|
||||
sun.net.www.protocol.https.*: proprietary compact1
|
||||
sun.net.www.protocol.jar.*: proprietary compact1
|
||||
sun.net.www.protocol.mailto.*: proprietary
|
||||
sun.net.www.protocol.netdoc.*: proprietary
|
||||
sun.nio.*: proprietary compact1
|
||||
sun.nio.ch.*: proprietary compact1
|
||||
sun.nio.ch.sctp.*: hidden
|
||||
sun.nio.cs.*: proprietary compact1
|
||||
sun.nio.fs.*: hidden
|
||||
sun.print.*: proprietary
|
||||
sun.print.resources.*: proprietary
|
||||
sun.reflect.*: proprietary compact1
|
||||
sun.reflect.annotation.*: proprietary compact1
|
||||
sun.reflect.generics.factory.*: proprietary compact1
|
||||
sun.reflect.generics.parser.*: proprietary compact1
|
||||
sun.reflect.generics.reflectiveObjects.*: proprietary compact1
|
||||
sun.reflect.generics.repository.*: proprietary compact1
|
||||
sun.reflect.generics.scope.*: proprietary compact1
|
||||
sun.reflect.generics.tree.*: proprietary compact1
|
||||
sun.reflect.generics.visitor.*: proprietary compact1
|
||||
sun.reflect.misc.*: hidden
|
||||
sun.rmi.log.*: proprietary compact2
|
||||
sun.rmi.registry.*: proprietary compact2
|
||||
sun.rmi.runtime.*: proprietary compact2
|
||||
sun.rmi.server.*: proprietary compact2
|
||||
sun.rmi.transport.*: proprietary compact2
|
||||
sun.rmi.transport.proxy.*: proprietary compact2
|
||||
sun.rmi.transport.tcp.*: proprietary compact2
|
||||
sun.security.acl.*: proprietary compact3
|
||||
sun.security.action.*: proprietary compact1
|
||||
sun.security.jca.*: proprietary compact1
|
||||
sun.security.jgss.*: proprietary compact3
|
||||
sun.security.jgss.krb5.*: proprietary compact3
|
||||
sun.security.jgss.spi.*: proprietary compact3
|
||||
sun.security.jgss.spnego.*: hidden
|
||||
sun.security.jgss.wrapper.*: hidden
|
||||
sun.security.krb5.*: proprietary compact3
|
||||
sun.security.krb5.internal.*: proprietary compact3
|
||||
sun.security.krb5.internal.ccache.*: proprietary compact3
|
||||
sun.security.krb5.internal.crypto.*: proprietary compact3
|
||||
sun.security.krb5.internal.crypto.dk.*: proprietary compact3
|
||||
sun.security.krb5.internal.ktab.*: proprietary compact3
|
||||
sun.security.krb5.internal.rcache.*: proprietary compact3
|
||||
sun.security.krb5.internal.tools.*: proprietary compact3
|
||||
sun.security.krb5.internal.util.*: proprietary compact3
|
||||
sun.security.pkcs.*: proprietary compact1
|
||||
sun.security.pkcs10.*: hidden
|
||||
sun.security.pkcs12.*: hidden
|
||||
sun.security.provider.*: proprietary compact1
|
||||
sun.security.provider.certpath.*: proprietary compact1
|
||||
sun.security.provider.certpath.ldap.*: hidden
|
||||
sun.security.provider.certpath.ssl.*: hidden
|
||||
sun.security.rsa.*: proprietary compact1
|
||||
sun.security.smartcardio.*: hidden
|
||||
sun.security.timestamp.*: proprietary compact1
|
||||
sun.security.tools.*: proprietary compact1
|
||||
sun.security.tools.keytool.*: hidden
|
||||
sun.security.tools.policytool.*: hidden
|
||||
sun.security.util.*: proprietary compact1
|
||||
sun.security.validator.*: proprietary compact1
|
||||
sun.security.x509.*: proprietary compact1
|
||||
sun.swing.*: proprietary
|
||||
sun.swing.icon.*: hidden
|
||||
sun.swing.plaf.*: hidden
|
||||
sun.swing.plaf.synth.*: proprietary
|
||||
sun.swing.plaf.windows.*: hidden
|
||||
sun.swing.table.*: hidden
|
||||
sun.swing.text.*: hidden
|
||||
sun.swing.text.html.*: hidden
|
||||
sun.text.*: proprietary compact1
|
||||
sun.text.bidi.*: hidden
|
||||
sun.text.normalizer.*: hidden
|
||||
sun.text.resources.*: proprietary compact1
|
||||
sun.text.resources.en.*: hidden
|
||||
sun.tools.jar.*: proprietary
|
||||
sun.tools.jar.resources.*: proprietary
|
||||
sun.tracing.*: hidden
|
||||
sun.tracing.dtrace.*: hidden
|
||||
sun.util.*: proprietary compact1
|
||||
sun.util.calendar.*: proprietary compact1
|
||||
sun.util.cldr.*: hidden
|
||||
sun.util.locale.*: proprietary compact1
|
||||
sun.util.locale.provider.*: hidden
|
||||
sun.util.logging.*: hidden
|
||||
sun.util.logging.resources.*: proprietary compact1
|
||||
sun.util.resources.*: hidden
|
||||
sun.util.resources.en.*: hidden
|
||||
sun.util.spi.*: hidden
|
@ -41,6 +41,7 @@ import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -414,6 +415,10 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
public static Kind getKind(Path path) {
|
||||
return getKind(path.getFileName().toString());
|
||||
}
|
||||
|
||||
public static Kind getKind(String name) {
|
||||
if (name.endsWith(Kind.CLASS.extension))
|
||||
return Kind.CLASS;
|
||||
|
@ -681,6 +681,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
|
||||
final URI uri = new URI(className);
|
||||
final URL url = uri.toURL();
|
||||
final URLConnection conn = url.openConnection();
|
||||
conn.setUseCaches(false);
|
||||
return new JavaFileObject() {
|
||||
@DefinedBy(Api.COMPILER)
|
||||
public Kind getKind() {
|
||||
@ -709,7 +710,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
public String getName() {
|
||||
return url.toString();
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.COMPILER)
|
||||
|
@ -56,6 +56,7 @@ import com.sun.tools.javac.util.ListBuffer;
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
@com.sun.tools.javac.api.ClientCodeWrapper.Trusted
|
||||
public class SmartFileManager extends ForwardingJavaFileManager<JavaFileManager> {
|
||||
|
||||
// Set of sources that can be seen by javac.
|
||||
|
@ -28,6 +28,7 @@ import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.Dependency.Location;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@ -38,8 +39,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* Represents the source of the class files.
|
||||
*/
|
||||
public class Archive {
|
||||
public static Archive getInstance(Path p) throws IOException {
|
||||
return new Archive(p, ClassFileReader.newInstance(p));
|
||||
public static Archive getInstance(Path p) {
|
||||
try {
|
||||
return new Archive(p, ClassFileReader.newInstance(p));
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private final Path path;
|
||||
|
@ -27,7 +27,12 @@ package com.sun.tools.jdeps;
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPoolException;
|
||||
import com.sun.tools.classfile.Dependencies.ClassFileError;
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -36,6 +41,8 @@ import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* ClassFileReader reads ClassFile(s) of a given path that can be
|
||||
@ -159,18 +166,23 @@ public class ClassFileReader {
|
||||
}
|
||||
|
||||
private static class DirectoryReader extends ClassFileReader {
|
||||
protected final String fsSep;
|
||||
DirectoryReader(Path path) throws IOException {
|
||||
this(FileSystems.getDefault(), path);
|
||||
}
|
||||
DirectoryReader(FileSystem fs, Path path) throws IOException {
|
||||
super(path);
|
||||
this.fsSep = fs.getSeparator();
|
||||
}
|
||||
|
||||
public ClassFile getClassFile(String name) throws IOException {
|
||||
if (name.indexOf('.') > 0) {
|
||||
int i = name.lastIndexOf('.');
|
||||
String pathname = name.replace('.', File.separatorChar) + ".class";
|
||||
String pathname = name.replace(".", fsSep) + ".class";
|
||||
Path p = path.resolve(pathname);
|
||||
if (!Files.exists(p)) {
|
||||
p = path.resolve(pathname.substring(0, i) + "$" +
|
||||
pathname.substring(i+1, pathname.length()));
|
||||
pathname.substring(i+1, pathname.length()));
|
||||
}
|
||||
if (Files.exists(p)) {
|
||||
return readClassFile(p);
|
||||
@ -193,25 +205,28 @@ public class ClassFileReader {
|
||||
};
|
||||
}
|
||||
|
||||
private List<Path> walkTree(Path dir) throws IOException {
|
||||
final List<Path> files = new ArrayList<>();
|
||||
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
||||
throws IOException {
|
||||
if (file.getFileName().toString().endsWith(".class")) {
|
||||
files.add(file);
|
||||
private List<Path> entries;
|
||||
protected synchronized List<Path> walkTree() throws IOException {
|
||||
if (entries == null) {
|
||||
entries = new ArrayList<>();
|
||||
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
||||
throws IOException {
|
||||
if (file.getFileName().toString().endsWith(".class")) {
|
||||
entries.add(file);
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
return files;
|
||||
});
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
class DirectoryIterator implements Iterator<ClassFile> {
|
||||
private List<Path> entries;
|
||||
private int index = 0;
|
||||
DirectoryIterator() throws IOException {
|
||||
entries = walkTree(path);
|
||||
entries = walkTree();
|
||||
index = 0;
|
||||
}
|
||||
|
||||
@ -355,4 +370,29 @@ public class ClassFileReader {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ClassFileReader for modules.
|
||||
*/
|
||||
static class ModuleClassReader extends DirectoryReader {
|
||||
final String modulename;
|
||||
ModuleClassReader(FileSystem fs, String mn, Path root) throws IOException {
|
||||
super(fs, root);
|
||||
this.modulename = mn;
|
||||
}
|
||||
|
||||
public Set<String> packages() throws IOException {
|
||||
return walkTree().stream()
|
||||
.map(this::toPackageName)
|
||||
.sorted()
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
String toPackageName(Path p) {
|
||||
if (p.getParent() == null) {
|
||||
return "";
|
||||
}
|
||||
return path.relativize(p.getParent()).toString().replace(fsSep, ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -551,10 +551,11 @@ class JdepsTask {
|
||||
if (options.includePattern != null) {
|
||||
initialArchives.addAll(classpaths);
|
||||
}
|
||||
classpaths.addAll(PlatformClassPath.getArchives(options.mpath));
|
||||
classpaths.addAll(PlatformClassPath.getModules(options.mpath));
|
||||
if (options.mpath != null) {
|
||||
initialArchives.addAll(PlatformClassPath.getArchives(options.mpath));
|
||||
initialArchives.addAll(PlatformClassPath.getModules(options.mpath));
|
||||
}
|
||||
classpaths.addAll(PlatformClassPath.getJarFiles());
|
||||
// add all classpath archives to the source locations for reporting
|
||||
sourceLocations.addAll(classpaths);
|
||||
}
|
||||
|
@ -173,8 +173,8 @@ final class Module extends Archive {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder include(String p) {
|
||||
packages.add(p);
|
||||
public Builder packages(Set<String> pkgs) {
|
||||
packages.addAll(pkgs);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -184,10 +184,11 @@ final class Module extends Archive {
|
||||
exports.put(p, new HashSet<>(ms));
|
||||
return this;
|
||||
}
|
||||
public Builder classes(ClassFileReader reader) {
|
||||
public Builder classes(ClassFileReader.ModuleClassReader reader) {
|
||||
this.reader = reader;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Module build() {
|
||||
Module m = new Module(reader, name, requires, exports, packages);
|
||||
return m;
|
||||
|
@ -24,15 +24,9 @@
|
||||
*/
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.jdeps.PlatformClassPath.LegacyImageHelper;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
@ -40,73 +34,15 @@ import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.events.Attribute;
|
||||
import javax.xml.stream.events.XMLEvent;
|
||||
import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
|
||||
import com.sun.tools.jdeps.PlatformClassPath.ImageHelper;
|
||||
|
||||
abstract class ModulesXmlReader {
|
||||
abstract ClassFileReader getClassFileReader(String modulename, Set<String> packages)
|
||||
throws IOException;
|
||||
|
||||
static class ImageReader extends ModulesXmlReader {
|
||||
final LegacyImageHelper helper;
|
||||
ImageReader(LegacyImageHelper helper) {
|
||||
this.helper = helper;
|
||||
}
|
||||
ClassFileReader getClassFileReader(String modulename, Set<String> packages)
|
||||
throws IOException
|
||||
{
|
||||
return helper.getClassReader(modulename, packages);
|
||||
}
|
||||
}
|
||||
|
||||
static class ModulePathReader extends ModulesXmlReader {
|
||||
final Path mpath;
|
||||
final ClassFileReader defaultReader;
|
||||
ModulePathReader(Path mp) throws IOException {
|
||||
this.mpath = mp;
|
||||
this.defaultReader = new NonExistModuleReader(mpath);
|
||||
}
|
||||
ClassFileReader getClassFileReader(String modulename, Set<String> packages)
|
||||
throws IOException
|
||||
{
|
||||
Path mdir = mpath.resolve(modulename);
|
||||
if (Files.exists(mdir) && Files.isDirectory(mdir)) {
|
||||
return ClassFileReader.newInstance(mdir);
|
||||
} else {
|
||||
// aggregator module or os-specific module in jdeps-modules.xml
|
||||
// mdir not exist
|
||||
return defaultReader;
|
||||
}
|
||||
}
|
||||
class NonExistModuleReader extends ClassFileReader {
|
||||
private final List<ClassFile> classes = Collections.emptyList();
|
||||
private NonExistModuleReader(Path mpath) {
|
||||
super(mpath);
|
||||
}
|
||||
|
||||
public ClassFile getClassFile(String name) throws IOException {
|
||||
return null;
|
||||
}
|
||||
public Iterable<ClassFile> getClassFiles() throws IOException {
|
||||
return classes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<Module> load(Path mpath, InputStream in)
|
||||
final class ModulesXmlReader {
|
||||
public static Set<Module> load(ImageHelper helper,InputStream in)
|
||||
throws IOException
|
||||
{
|
||||
try {
|
||||
ModulePathReader reader = new ModulePathReader(mpath);
|
||||
return reader.load(in);
|
||||
} catch (XMLStreamException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<Module> loadFromImage(LegacyImageHelper helper, InputStream in)
|
||||
throws IOException
|
||||
{
|
||||
try {
|
||||
ImageReader reader = new ImageReader(helper);
|
||||
ModulesXmlReader reader = new ModulesXmlReader(helper);
|
||||
return reader.load(in);
|
||||
} catch (XMLStreamException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -119,8 +55,12 @@ abstract class ModulesXmlReader {
|
||||
private static final String DEPEND = "depend";
|
||||
private static final String EXPORT = "export";
|
||||
private static final String TO = "to";
|
||||
private static final String INCLUDE = "include";
|
||||
private static final QName REEXPORTS = new QName("re-exports");
|
||||
private final ImageHelper helper;
|
||||
ModulesXmlReader(ImageHelper helper) {
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
public Set<Module> load(InputStream in) throws XMLStreamException, IOException {
|
||||
Set<Module> modules = new HashSet<>();
|
||||
if (in == null) {
|
||||
@ -162,9 +102,6 @@ abstract class ModulesXmlReader {
|
||||
}
|
||||
mb.require(getData(reader), reexports);
|
||||
break;
|
||||
case INCLUDE:
|
||||
mb.include(getData(reader));
|
||||
break;
|
||||
case EXPORT:
|
||||
exportedPackage = getNextTag(reader, NAME);
|
||||
break;
|
||||
@ -178,8 +115,9 @@ abstract class ModulesXmlReader {
|
||||
String endTag = event.asEndElement().getName().getLocalPart();
|
||||
switch (endTag) {
|
||||
case MODULE:
|
||||
ClassFileReader cfr = getClassFileReader(modulename, mb.packages);
|
||||
ModuleClassReader cfr = helper.getModuleClassReader(modulename);
|
||||
mb.classes(cfr);
|
||||
mb.packages(cfr.packages());
|
||||
modules.add(mb.build());
|
||||
mb = null;
|
||||
break;
|
||||
|
@ -24,39 +24,48 @@
|
||||
*/
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import com.sun.tools.classfile.Annotation;
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPool;
|
||||
import com.sun.tools.classfile.ConstantPoolException;
|
||||
import com.sun.tools.classfile.RuntimeAnnotations_attribute;
|
||||
import com.sun.tools.classfile.Dependencies.ClassFileError;
|
||||
import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.net.URI;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.*;
|
||||
import java.util.jar.*;
|
||||
|
||||
import static com.sun.tools.classfile.Attribute.*;
|
||||
import static com.sun.tools.jdeps.ClassFileReader.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ClassPath for Java SE and JDK
|
||||
*/
|
||||
class PlatformClassPath {
|
||||
private static List<Archive> modules;
|
||||
static synchronized List<Archive> getArchives(Path mpath) throws IOException {
|
||||
static synchronized List<Archive> getModules(Path mpath) throws IOException {
|
||||
if (modules == null) {
|
||||
initPlatformArchives(mpath);
|
||||
initPlatformModules(mpath);
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
private static void initPlatformModules(Path mpath) throws IOException {
|
||||
ImageHelper helper = ImageHelper.getInstance(mpath);
|
||||
String fn = System.getProperty("jdeps.modules.xml");
|
||||
if (fn != null) {
|
||||
Path p = Paths.get(fn);
|
||||
try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
|
||||
modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
|
||||
}
|
||||
} else {
|
||||
try (InputStream in = PlatformClassPath.class
|
||||
.getResourceAsStream("resources/jdeps-modules.xml")) {
|
||||
modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
|
||||
}
|
||||
}
|
||||
if (findModule("java.base") != null) {
|
||||
Profile.initProfiles(modules);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the module with the given name. Returns null
|
||||
* if such module doesn't exist.
|
||||
@ -75,237 +84,86 @@ class PlatformClassPath {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<Archive> initPlatformArchives(Path mpath) throws IOException {
|
||||
Path home = Paths.get(System.getProperty("java.home"));
|
||||
if (mpath == null && !home.endsWith("jre")) {
|
||||
// jdk build
|
||||
Path p = home.resolve("modules");
|
||||
if (Files.isDirectory(p)) {
|
||||
mpath = p;
|
||||
}
|
||||
}
|
||||
modules = mpath != null ? initModules(mpath) : initLegacyImage(home);
|
||||
if (findModule("java.base") != null) {
|
||||
Profile.initProfiles();
|
||||
}
|
||||
return modules;
|
||||
/**
|
||||
* Returns JAR files in $java.home/lib. This is for transition until
|
||||
* all components are linked into jimage.
|
||||
*/
|
||||
static List<Archive> getJarFiles() throws IOException {
|
||||
Path home = Paths.get(System.getProperty("java.home"), "lib");
|
||||
return Files.find(home, 1, (Path p, BasicFileAttributes attr)
|
||||
-> p.getFileName().toString().endsWith(".jar"))
|
||||
.map(Archive::getInstance)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static List<Archive> initModules(Path mpath) throws IOException {
|
||||
String fn = System.getProperty("jdeps.modules.xml");
|
||||
if (fn!= null) {
|
||||
Path p = Paths.get(fn);
|
||||
try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
|
||||
return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
|
||||
static class ImageHelper {
|
||||
static ImageHelper getInstance(Path mpath) throws IOException {
|
||||
if (mpath != null) {
|
||||
return new ImageHelper(mpath);
|
||||
}
|
||||
} else {
|
||||
try (InputStream in = PlatformClassPath.class
|
||||
.getResourceAsStream("resources/jdeps-modules.xml")) {
|
||||
return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Archive> initLegacyImage(Path home) throws IOException {
|
||||
LegacyImageHelper cfr = new LegacyImageHelper(home);
|
||||
List<Archive> archives = new ArrayList<>(cfr.nonPlatformArchives);
|
||||
try (InputStream in = PlatformClassPath.class
|
||||
.getResourceAsStream("resources/jdeps-modules.xml")) {
|
||||
archives.addAll(ModulesXmlReader.loadFromImage(cfr, in));
|
||||
return archives;
|
||||
}
|
||||
}
|
||||
|
||||
static class LegacyImageHelper {
|
||||
private static final List<String> NON_PLATFORM_JARFILES =
|
||||
Arrays.asList("alt-rt.jar", "jfxrt.jar", "ant-javafx.jar", "javafx-mx.jar");
|
||||
final List<Archive> nonPlatformArchives = new ArrayList<>();
|
||||
final List<JarFile> jarfiles = new ArrayList<>();
|
||||
final Path home;
|
||||
|
||||
LegacyImageHelper(Path home) {
|
||||
this.home = home;
|
||||
try {
|
||||
if (home.endsWith("jre")) {
|
||||
// jar files in <javahome>/jre/lib
|
||||
addJarFiles(home.resolve("lib"));
|
||||
if (home.getParent() != null) {
|
||||
// add tools.jar and other JDK jar files
|
||||
Path lib = home.getParent().resolve("lib");
|
||||
if (Files.exists(lib)) {
|
||||
addJarFiles(lib);
|
||||
}
|
||||
}
|
||||
} else if (Files.exists(home.resolve("lib"))) {
|
||||
// add other JAR files
|
||||
addJarFiles(home.resolve("lib"));
|
||||
} else {
|
||||
throw new RuntimeException("\"" + home + "\" not a JDK home");
|
||||
Path home = Paths.get(System.getProperty("java.home"));
|
||||
Path mlib = home.resolve("lib").resolve("modules");
|
||||
if (Files.isDirectory(mlib)) {
|
||||
// jimage
|
||||
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
|
||||
return new ImageHelper(fs, fs.getPath("/"));
|
||||
} else {
|
||||
// exploded modules
|
||||
mlib = home.resolve("modules");
|
||||
if (!Files.isDirectory(mlib)) {
|
||||
throw new InternalError(home + " not a modular image");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new Error(e);
|
||||
return new ImageHelper(mlib);
|
||||
}
|
||||
}
|
||||
|
||||
private final FileSystem fs;
|
||||
private final Path mpath;
|
||||
|
||||
ImageHelper(Path path) throws IOException {
|
||||
this(FileSystems.getDefault(), path);
|
||||
}
|
||||
|
||||
ImageHelper(FileSystem fs, Path path) throws IOException {
|
||||
this.fs = fs;
|
||||
this.mpath = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a ClassFileReader that only reads classes for the given modulename.
|
||||
* Returns a ModuleClassReader that only reads classes for the given modulename.
|
||||
*/
|
||||
ClassFileReader getClassReader(String modulename, Set<String> packages) throws IOException {
|
||||
return new ModuleClassReader(modulename, packages);
|
||||
public ModuleClassReader getModuleClassReader(String modulename)
|
||||
throws IOException
|
||||
{
|
||||
Path mp = mpath.resolve(modulename);
|
||||
if (Files.exists(mp) && Files.isDirectory(mp)) {
|
||||
return new ModuleClassReader(fs, modulename, mp);
|
||||
} else {
|
||||
// aggregator module or os-specific module in jdeps-modules.xml
|
||||
// mdir not exist
|
||||
return new NonExistModuleReader(fs, modulename, mp);
|
||||
}
|
||||
}
|
||||
|
||||
private void addJarFiles(final Path root) throws IOException {
|
||||
final Path ext = root.resolve("ext");
|
||||
Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
|
||||
throws IOException
|
||||
{
|
||||
if (dir.equals(root) || dir.equals(ext)) {
|
||||
return FileVisitResult.CONTINUE;
|
||||
} else {
|
||||
// skip other cobundled JAR files
|
||||
return FileVisitResult.SKIP_SUBTREE;
|
||||
}
|
||||
}
|
||||
static class NonExistModuleReader extends ModuleClassReader {
|
||||
private final List<ClassFile> classes = Collections.emptyList();
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path p, BasicFileAttributes attrs)
|
||||
throws IOException
|
||||
{
|
||||
String fn = p.getFileName().toString();
|
||||
if (fn.endsWith(".jar")) {
|
||||
// JDK may cobundle with JavaFX that doesn't belong to any profile
|
||||
// Treat jfxrt.jar as regular Archive
|
||||
if (NON_PLATFORM_JARFILES.contains(fn)) {
|
||||
nonPlatformArchives.add(Archive.getInstance(p));
|
||||
} else {
|
||||
jarfiles.add(new JarFile(p.toFile()));
|
||||
}
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ModuleClassFile reads classes for the specified module from the legacy image.
|
||||
*
|
||||
*/
|
||||
class ModuleClassReader extends JarFileReader {
|
||||
private JarFile cachedJarFile = getJarFile(0);
|
||||
private final Set<String> packages;
|
||||
private final String module;
|
||||
ModuleClassReader(String module, Set<String> packages) throws IOException {
|
||||
super(home, null);
|
||||
this.module = module;
|
||||
this.packages = packages;
|
||||
private NonExistModuleReader(FileSystem fs, String mn, Path mpath)
|
||||
throws IOException
|
||||
{
|
||||
super(fs, mn, mpath);
|
||||
}
|
||||
|
||||
private boolean includes(String name) {
|
||||
String cn = name.replace('/', '.');
|
||||
int i = cn.lastIndexOf('.');
|
||||
String pn = i > 0 ? cn.substring(0, i) : "";
|
||||
return packages.contains(pn);
|
||||
}
|
||||
|
||||
private JarEntry findJarEntry(JarFile jarfile, String entryName1, String entryName2) {
|
||||
JarEntry e = jarfile.getJarEntry(entryName1);
|
||||
if (e == null) {
|
||||
e = jarfile.getJarEntry(entryName2);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return module + " " + packages.size() + " " + packages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassFile getClassFile(String name) throws IOException {
|
||||
if (jarfiles.isEmpty() || !includes(name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (name.indexOf('.') > 0) {
|
||||
int i = name.lastIndexOf('.');
|
||||
String entryName = name.replace('.', '/') + ".class";
|
||||
String innerClassName = entryName.substring(0, i) + "$"
|
||||
+ entryName.substring(i + 1, entryName.length());
|
||||
JarEntry e = findJarEntry(cachedJarFile, entryName, innerClassName);
|
||||
if (e != null) {
|
||||
return readClassFile(cachedJarFile, e);
|
||||
}
|
||||
for (JarFile jf : jarfiles) {
|
||||
if (jf == cachedJarFile) {
|
||||
continue;
|
||||
}
|
||||
System.err.format("find jar entry %s at %s%n", entryName, jf);
|
||||
e = findJarEntry(jf, entryName, innerClassName);
|
||||
if (e != null) {
|
||||
cachedJarFile = jf;
|
||||
return readClassFile(jf, e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String entryName = name + ".class";
|
||||
JarEntry e = cachedJarFile.getJarEntry(entryName);
|
||||
if (e != null) {
|
||||
return readClassFile(cachedJarFile, e);
|
||||
}
|
||||
for (JarFile jf : jarfiles) {
|
||||
if (jf == cachedJarFile) {
|
||||
continue;
|
||||
}
|
||||
e = jf.getJarEntry(entryName);
|
||||
if (e != null) {
|
||||
cachedJarFile = jf;
|
||||
return readClassFile(jf, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ClassFile> getClassFiles() throws IOException {
|
||||
final Iterator<ClassFile> iter = new ModuleClassIterator(this);
|
||||
return new Iterable<ClassFile>() {
|
||||
public Iterator<ClassFile> iterator() {
|
||||
return iter;
|
||||
}
|
||||
};
|
||||
return classes;
|
||||
}
|
||||
|
||||
private JarFile getJarFile(int index) {
|
||||
return index < jarfiles.size() ? jarfiles.get(index) : null;
|
||||
}
|
||||
|
||||
class ModuleClassIterator extends JarFileIterator {
|
||||
private int index;
|
||||
ModuleClassIterator(ModuleClassReader reader) {
|
||||
super(reader);
|
||||
this.index = 0;
|
||||
this.jf = getJarFile(0);
|
||||
this.entries = jf != null ? jf.entries() : null;
|
||||
this.nextEntry = nextEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JarEntry nextEntry() {
|
||||
while (jf != null) {
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry e = entries.nextElement();
|
||||
String name = e.getName();
|
||||
if (name.endsWith(".class") && includes(name)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
jf = getJarFile(++index);
|
||||
entries = jf != null ? jf.entries() : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public Set<String> packages() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,23 +28,28 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Build the profile information from ct.sym if exists.
|
||||
* Build the profile information.
|
||||
*/
|
||||
enum Profile {
|
||||
COMPACT1("compact1", 1, "java.compact1"),
|
||||
COMPACT2("compact2", 2, "java.compact2"),
|
||||
COMPACT3("compact3", 3, "java.compact3"),
|
||||
FULL_JRE("Full JRE", 4, "java.se");
|
||||
COMPACT3("compact3", 3, "java.compact3", "java.smartcardio", "jdk.sctp",
|
||||
"jdk.httpserver", "jdk.security.auth",
|
||||
"jdk.naming.dns", "jdk.naming.rmi"),
|
||||
FULL_JRE("Full JRE", 4, "java.se", "jdk.deploy.osx", "jdk.charsets",
|
||||
"jdk.crypto.ec", "jdk.crypto.pkcs11",
|
||||
"jdk.crypto.mscapi", "jdk.crypto.ucrypto", "jdk.jvmstat",
|
||||
"jdk.localedata", "jdk.scripting.nashorn", "jdk.zipfs");
|
||||
|
||||
final String name;
|
||||
final int profile;
|
||||
final String moduleName;
|
||||
final String[] mnames;
|
||||
final Set<Module> modules = new HashSet<>();
|
||||
|
||||
Profile(String name, int profile, String moduleName) {
|
||||
Profile(String name, int profile, String... mnames) {
|
||||
this.name = name;
|
||||
this.profile = profile;
|
||||
this.moduleName = moduleName;
|
||||
this.mnames = mnames;
|
||||
}
|
||||
|
||||
public String profileName() {
|
||||
@ -53,7 +58,7 @@ enum Profile {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return moduleName;
|
||||
return mnames[0];
|
||||
}
|
||||
|
||||
public static int getProfileCount() {
|
||||
@ -86,27 +91,37 @@ enum Profile {
|
||||
return null;
|
||||
}
|
||||
|
||||
final static Set<Module> JDK = new HashSet<>();
|
||||
static void initProfiles() {
|
||||
private final static Set<Module> JDK = new HashSet<>();
|
||||
static void initProfiles(List<Archive> modules) {
|
||||
// add all modules into JDK
|
||||
modules.forEach(m -> JDK.add((Module)m));
|
||||
|
||||
for (Profile p : Profile.values()) {
|
||||
Module m = PlatformClassPath.findModule(p.moduleName);
|
||||
if (m == null)
|
||||
throw new Error(p.moduleName + " doesn't exist");
|
||||
p.modules.add(m);
|
||||
JDK.add(m);
|
||||
for (String n : m.requires().keySet()) {
|
||||
Module d = PlatformClassPath.findModule(n);
|
||||
if (d == null)
|
||||
throw new Error(n + " doesn't exist");
|
||||
p.modules.add(d);
|
||||
JDK.add(d);
|
||||
for (String mn : p.mnames) {
|
||||
// this includes platform-dependent module that may not exist
|
||||
Module m = PlatformClassPath.findModule(mn);
|
||||
if (m != null) {
|
||||
p.addModule(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addModule(Module m) {
|
||||
modules.add(m);
|
||||
for (String n : m.requires().keySet()) {
|
||||
Module d = PlatformClassPath.findModule(n);
|
||||
if (d == null) {
|
||||
throw new InternalError("module " + n + " required by " +
|
||||
m.name() + " doesn't exist");
|
||||
}
|
||||
modules.add(d);
|
||||
}
|
||||
}
|
||||
// for debugging
|
||||
public static void main(String[] args) throws IOException {
|
||||
// find platform modules
|
||||
PlatformClassPath.getArchives(null);
|
||||
PlatformClassPath.getModules(null);
|
||||
if (Profile.getProfileCount() == 0) {
|
||||
System.err.println("No profile is present in this JDK");
|
||||
}
|
||||
|
@ -46,8 +46,6 @@ public class TestCompletionFailure extends JavadocTester {
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput(Output.STDERR, false,
|
||||
"TestCompletionFailure: error - "
|
||||
+ "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for "
|
||||
+ "sun.util.locale.provider.LocaleProviderAdapter not found");
|
||||
"sun.util.locale.provider.LocaleProviderAdapter");
|
||||
}
|
||||
}
|
||||
|
@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249
|
||||
* @summary Make sure apt is removed and doesn't come back
|
||||
* @library /tools/lib
|
||||
* @build ToolBox
|
||||
* @run main CheckAptIsRemovedTest
|
||||
*/
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
// Original test: test/tools/apt/Basics/apt.sh
|
||||
public class CheckAptIsRemovedTest {
|
||||
//I think this class can be let with the imports only and that should be enough for as test's purpose
|
||||
private static final String NullAPFSrc =
|
||||
"import com.sun.mirror.apt.*;\n" +
|
||||
"import com.sun.mirror.declaration.*;\n" +
|
||||
"import com.sun.mirror.type.*;\n" +
|
||||
"import com.sun.mirror.util.*;\n" +
|
||||
"import java.util.Collection;\n" +
|
||||
"import java.util.Set;\n\n" +
|
||||
|
||||
"public class NullAPF implements AnnotationProcessorFactory {\n" +
|
||||
" static class NullAP implements AnnotationProcessor {\n" +
|
||||
" NullAP(AnnotationProcessorEnvironment ape) {}\n" +
|
||||
" public void process() {return;}\n" +
|
||||
" }\n\n" +
|
||||
|
||||
" static Collection<String> supportedTypes;\n\n" +
|
||||
" static {\n" +
|
||||
" String types[] = {\"*\"};\n" +
|
||||
" supportedTypes = java.util.Arrays.asList(types);\n" +
|
||||
" }\n\n" +
|
||||
|
||||
" public Collection<String> supportedOptions() {\n" +
|
||||
" return java.util.Collections.emptySet();\n" +
|
||||
" }\n\n" +
|
||||
|
||||
" public Collection<String> supportedAnnotationTypes() {\n" +
|
||||
" return supportedTypes;\n" +
|
||||
" }\n\n" +
|
||||
|
||||
" public AnnotationProcessor getProcessorFor(" +
|
||||
" Set<AnnotationTypeDeclaration> atds,\n" +
|
||||
" AnnotationProcessorEnvironment env) {\n" +
|
||||
" return new NullAP(env);\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String testJDK = System.getProperty("test.jdk");
|
||||
Path aptLin = Paths.get(testJDK, "bin", "apt");
|
||||
Path aptWin = Paths.get(testJDK, "bin", "apt.exe");
|
||||
|
||||
if (Files.exists(aptLin) || Files.exists(aptWin)) {
|
||||
throw new AssertionError("apt executable should not exist");
|
||||
}
|
||||
|
||||
Path classpath = Paths.get(testJDK, "lib", "tools.jar");
|
||||
ToolBox tb = new ToolBox();
|
||||
tb.new JavacTask()
|
||||
.classpath(classpath.toString()) // TODO: add overload
|
||||
.sourcepath(".")
|
||||
.sources(NullAPFSrc)
|
||||
.run(ToolBox.Expect.FAIL)
|
||||
.writeAll();
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,8 +25,13 @@
|
||||
* @test
|
||||
* @bug 8006263
|
||||
* @summary Supplementary test cases needed for doclint
|
||||
* @library /tools/lib
|
||||
* @build ToolBox
|
||||
* @run main PathsTest
|
||||
*/
|
||||
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.doclint.DocLint;
|
||||
import com.sun.tools.doclint.DocLint.BadArgs;
|
||||
import java.io.File;
|
||||
@ -35,6 +40,8 @@ import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.tools.StandardLocation;
|
||||
import javax.tools.JavaFileManager;
|
||||
|
||||
public class PathsTest {
|
||||
public static void main(String... args) throws Exception {
|
||||
@ -56,9 +63,11 @@ public class PathsTest {
|
||||
|
||||
test("src/Test.java", "-sourcepath", "src1" + PS + "src2");
|
||||
test("src/Test.java", "-classpath", "classes1" + PS + "classes2");
|
||||
|
||||
File testJar = createJar();
|
||||
String sysBootClassPath = System.getProperty("sun.boot.class.path");
|
||||
test("src/Test.java", "-bootclasspath",
|
||||
sysBootClassPath + PS + "classes1" + PS + "classes2");
|
||||
testJar + PS + "classes1" + PS + "classes2");
|
||||
|
||||
if (errors > 0)
|
||||
throw new Exception(errors + " errors found");
|
||||
@ -87,6 +96,17 @@ public class PathsTest {
|
||||
}
|
||||
}
|
||||
|
||||
File createJar() throws IOException {
|
||||
File f = new File("test.jar");
|
||||
try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
|
||||
ToolBox tb = new ToolBox();
|
||||
tb.new JarTask(f.getPath())
|
||||
.files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*")
|
||||
.run();
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
void compile(String... args) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i].equals("-d")) {
|
||||
|
@ -49,8 +49,6 @@ import static javax.tools.StandardLocation.*;
|
||||
* the impl of inferBinaryName for that file object.
|
||||
*/
|
||||
public class TestInferBinaryName {
|
||||
static final boolean IGNORE_SYMBOL_FILE = false;
|
||||
static final boolean USE_SYMBOL_FILE = true;
|
||||
static final boolean DONT_USE_ZIP_FILE_INDEX = false;
|
||||
static final boolean USE_ZIP_FILE_INDEX = true;
|
||||
|
||||
@ -59,15 +57,14 @@ public class TestInferBinaryName {
|
||||
}
|
||||
|
||||
void run() throws Exception {
|
||||
//System.err.println(System.getProperties());
|
||||
testDirectory();
|
||||
testSymbolArchive();
|
||||
|
||||
File testJar = createJar();
|
||||
|
||||
testZipArchive(testJar);
|
||||
testZipFileIndexArchive(testJar);
|
||||
testZipFileIndexArchive2(testJar);
|
||||
|
||||
if (errors > 0)
|
||||
throw new Exception(errors + " error found");
|
||||
}
|
||||
@ -87,27 +84,17 @@ public class TestInferBinaryName {
|
||||
String testClassName = "p.A";
|
||||
List<File> testClasses = Arrays.asList(new File(System.getProperty("test.classes")));
|
||||
try (JavaFileManager fm =
|
||||
getFileManager(testClasses, USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
|
||||
getFileManager(testClasses, USE_ZIP_FILE_INDEX)) {
|
||||
test("testDirectory",
|
||||
fm, testClassName, "com.sun.tools.javac.file.RegularFileObject");
|
||||
}
|
||||
}
|
||||
|
||||
void testSymbolArchive() throws IOException {
|
||||
String testClassName = "java.lang.String";
|
||||
List<File> path = getPath(System.getProperty("sun.boot.class.path"));
|
||||
try (JavaFileManager fm =
|
||||
getFileManager(path, USE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX)) {
|
||||
test("testSymbolArchive",
|
||||
fm, testClassName, "com.sun.tools.javac.file.SymbolArchive$SymbolFileObject");
|
||||
}
|
||||
}
|
||||
|
||||
void testZipArchive(File testJar) throws IOException {
|
||||
String testClassName = "java.lang.String";
|
||||
List<File> path = Arrays.asList(testJar);
|
||||
try (JavaFileManager fm =
|
||||
getFileManager(path, IGNORE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX)) {
|
||||
getFileManager(path, DONT_USE_ZIP_FILE_INDEX)) {
|
||||
test("testZipArchive",
|
||||
fm, testClassName, "com.sun.tools.javac.file.ZipArchive$ZipFileObject");
|
||||
}
|
||||
@ -117,7 +104,7 @@ public class TestInferBinaryName {
|
||||
String testClassName = "java.lang.String";
|
||||
List<File> path = Arrays.asList(testJar);
|
||||
try (JavaFileManager fm =
|
||||
getFileManager(path, USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
|
||||
getFileManager(path, USE_ZIP_FILE_INDEX)) {
|
||||
test("testZipFileIndexArchive",
|
||||
fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
|
||||
}
|
||||
@ -127,7 +114,7 @@ public class TestInferBinaryName {
|
||||
String testClassName = "java.lang.String";
|
||||
List<File> path = Arrays.asList(testJar);
|
||||
try (JavaFileManager fm =
|
||||
getFileManager(path, IGNORE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
|
||||
getFileManager(path, USE_ZIP_FILE_INDEX)) {
|
||||
test("testZipFileIndexArchive2",
|
||||
fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
|
||||
}
|
||||
@ -159,7 +146,6 @@ public class TestInferBinaryName {
|
||||
}
|
||||
|
||||
JavaFileManager getFileManager(List<File> path,
|
||||
boolean symFileKind,
|
||||
boolean zipFileIndexKind)
|
||||
throws IOException {
|
||||
Context ctx = new Context();
|
||||
@ -167,8 +153,6 @@ public class TestInferBinaryName {
|
||||
options.put("useOptimizedZip",
|
||||
Boolean.toString(zipFileIndexKind == USE_ZIP_FILE_INDEX));
|
||||
|
||||
if (symFileKind == IGNORE_SYMBOL_FILE)
|
||||
options.put("ignore.symbol.file", "true");
|
||||
JavacFileManager fm = new JavacFileManager(ctx, false, null);
|
||||
fm.setLocation(CLASS_PATH, path);
|
||||
return fm;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,14 +37,8 @@ public class EarlyAssertWrapper {
|
||||
void run() throws Exception {
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
File java_home = new File(System.getProperty("java.home"));
|
||||
if (java_home.getName().equals("jre"))
|
||||
java_home = java_home.getParentFile();
|
||||
cmd.add(new File(new File(java_home, "bin"), "java").getPath());
|
||||
|
||||
// ensure we run with the same bootclasspath as this test,
|
||||
// in case this test is being run with -Xbootclasspath
|
||||
cmd.add("-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
|
||||
|
||||
// propogate classpath
|
||||
cmd.add("-classpath");
|
||||
cmd.add(System.getProperty("java.class.path"));
|
||||
|
@ -97,13 +97,13 @@ Success "$java" ${TESTVMOPTS} -cp "jars/A.jar${PS}." Main
|
||||
Success "$javac" ${TESTTOOLVMOPTS} -cp "jars/B.zip" Main.java
|
||||
Success "$java" ${TESTVMOPTS} -cp "jars/B.zip${PS}." Main
|
||||
|
||||
Success "$javac" ${TESTTOOLVMOPTS} -extdirs "jars" -cp None Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="jars" -cp None Main.java
|
||||
Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars" -cp . Main
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} -extdirs "jars" -cp None Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="jars" -cp None Main.java
|
||||
# Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars" -cp . Main
|
||||
|
||||
Success "$javac" ${TESTTOOLVMOPTS} -endorseddirs "jars" -cp None Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} -Djava.endorsed.dirs="jars" -cp None Main.java
|
||||
Success "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="jars" -cp . Main
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} -endorseddirs "jars" -cp None Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} -Djava.endorsed.dirs="jars" -cp None Main.java
|
||||
# Success "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="jars" -cp . Main
|
||||
|
||||
Failure "$java" ${TESTVMOPTS} -Xbootclasspath/p:"jars/A.jar" -cp . Main
|
||||
Failure "$java" ${TESTVMOPTS} -Xbootclasspath/a:"jars/B.zip" -cp . Main
|
||||
|
@ -100,11 +100,11 @@ Success "$java" ${TESTVMOPTS} -cp "jars/sub/B.zip${PS}." Main
|
||||
# Test 2: Use of extension directories is incorrect
|
||||
#
|
||||
|
||||
Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars -cp None Main.java
|
||||
Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars" -cp . Main
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars -cp None Main.java
|
||||
# Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars" -cp . Main
|
||||
|
||||
Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars/sub -cp None Main.java
|
||||
Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars/sub" -cp . Main
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars/sub -cp None Main.java
|
||||
# Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars/sub" -cp . Main
|
||||
|
||||
Cleanup
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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 5071352
|
||||
* @summary Make sure compiler closes all open files on Windows
|
||||
* @author Martin Buchholz
|
||||
*
|
||||
* @run main/othervm -Xms200m -Xmx200m CompileClose
|
||||
*/
|
||||
|
||||
// -Xms120m is sufficient to inhibit a gc during a compile.
|
||||
// -Xms200m leaves room for expansion and was used by the customer.
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class CompileClose {
|
||||
static void writeFile(String f, String contents) throws IOException {
|
||||
PrintStream s = new PrintStream(new FileOutputStream(f));
|
||||
s.println(contents);
|
||||
s.close();
|
||||
}
|
||||
|
||||
static void rm(String filename) throws Exception {
|
||||
File f = new File(filename);
|
||||
f.delete();
|
||||
if (f.exists())
|
||||
throw new Exception(filename + ": couldn't remove");
|
||||
}
|
||||
|
||||
static void clean() throws Exception {
|
||||
rm("tmpCompileClose.java");
|
||||
rm("tmpCompileClose.class");
|
||||
rm("tmpCompileClose.jar");
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
try {
|
||||
clean();
|
||||
main1();
|
||||
} finally {
|
||||
clean();
|
||||
}
|
||||
}
|
||||
|
||||
static void main1() throws Exception {
|
||||
writeFile("tmpCompileClose.java",
|
||||
"public class tmpCompileClose {}");
|
||||
// Any old jar file will do
|
||||
SameJVM.jar("cf", "tmpCompileClose.jar", "tmpCompileClose.java");
|
||||
System.gc(); // Inhibit gc during next compile
|
||||
SameJVM.javac("-cp", "tmpCompileClose.jar", "tmpCompileClose.java");
|
||||
// The following rm is the actual test!
|
||||
rm("tmpCompileClose.jar");
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,11 +37,11 @@
|
||||
|
||||
set -u
|
||||
|
||||
BCP=`DefaultBootClassPath`
|
||||
# BCP=`DefaultBootClassPath`
|
||||
|
||||
DiagnosticsInEnglishPlease
|
||||
|
||||
No() { NO="no"; "$@"; NO=""; } # No means NO!
|
||||
No() { NO="no"; "$@"; NO=""; } # No means NO!
|
||||
|
||||
Warning() {
|
||||
HorizontalRule
|
||||
@ -52,9 +52,9 @@ Warning() {
|
||||
case "$output" in *warning:*) gotwarning="yes";; *) gotwarning="no";; esac
|
||||
|
||||
if test "$gotwarning" = "yes" -a "$NO" = "no"; then
|
||||
Fail "Command \"$*\" printed an unexpected warning"
|
||||
Fail "Command \"$*\" printed an unexpected warning"
|
||||
elif test "$gotwarning" = "no" -a "$NO" != "no"; then
|
||||
Fail "Command \"$*\" did not generate the expected warning"
|
||||
Fail "Command \"$*\" did not generate the expected warning"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -66,20 +66,20 @@ Error() {
|
||||
case "$output" in *error:*) goterror="yes";; *) goterror="no";; esac
|
||||
|
||||
if test "$NO" = "no"; then
|
||||
test "$rc" -ne 0 && \
|
||||
Fail "Command \"$*\" failed with return code $rc"
|
||||
test "$goterror" = "yes" && \
|
||||
Fail "Command \"$*\" did not generate any error message"
|
||||
test "$rc" -ne 0 && \
|
||||
Fail "Command \"$*\" failed with return code $rc"
|
||||
test "$goterror" = "yes" && \
|
||||
Fail "Command \"$*\" did not generate any error message"
|
||||
else
|
||||
test "$rc" -eq 0 && \
|
||||
Fail "Command \"$*\" was supposed to Die with fatal error";
|
||||
test "$goterror" = "no" && \
|
||||
Fail "Command \"$*\" printed an unexpected error message"
|
||||
test "$rc" -eq 0 && \
|
||||
Fail "Command \"$*\" was supposed to Die with fatal error";
|
||||
test "$goterror" = "no" && \
|
||||
Fail "Command \"$*\" printed an unexpected error message"
|
||||
fi
|
||||
}
|
||||
|
||||
Cleanup() {
|
||||
Sys rm -rf Main.java Main.class
|
||||
Sys rm -rf Main.java Main.class
|
||||
Sys rm -rf classes classes.foo classes.jar classes.war classes.zip
|
||||
Sys rm -rf MANIFEST.MF classesRef.jar classesRefRef.jar jars
|
||||
}
|
||||
@ -99,18 +99,19 @@ No Warning "$javac" ${TESTTOOLVMOPTS} -cp ".${PS}classes" Main.java
|
||||
Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path -cp ".${PS}classes" Main.java
|
||||
Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath/p:classes" Main.java
|
||||
Warning "$javac" ${TESTTOOLVMOPTS} -Xlint "-Xbootclasspath/a:classes" Main.java
|
||||
|
||||
Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-endorseddirs" "classes" Main.java
|
||||
Warning "$javac" ${TESTTOOLVMOPTS} -Xlint "-extdirs" "classes" Main.java
|
||||
Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
|
||||
# Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# No warning for missing elts in "system" paths
|
||||
#----------------------------------------------------------------
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.endorsed.dirs=classes" Main.java
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.ext.dirs=classes" Main.java
|
||||
# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.endorsed.dirs=classes" Main.java
|
||||
# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.ext.dirs=classes" Main.java
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath/p:classes" Main.java
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath/a:classes" Main.java
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath:classes${PS}${BCP}" Main.java
|
||||
# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath:classes${PS}${BCP}" Main.java
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# No warning if class path element exists
|
||||
@ -121,7 +122,7 @@ No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-endorseddirs" "classes" Ma
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-extdirs" "classes" Main.java
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath/p:classes" Main.java
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath/a:classes" Main.java
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
|
||||
# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
|
||||
|
||||
Sys "$jar" cf classes.jar Main.class
|
||||
Sys cp classes.jar classes.war
|
||||
@ -131,7 +132,7 @@ No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path -cp ".${PS}classes.jar" Ma
|
||||
No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path -cp ".${PS}classes.zip" Main.java
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Warn if -Xlint is used and if class path element refers to
|
||||
# Warn if -Xlint is used and if class path element refers to
|
||||
# regular file which doesn't look like a zip file, but is
|
||||
#----------------------------------------------------------------
|
||||
Sys cp classes.war classes.foo
|
||||
@ -146,7 +147,7 @@ No Error "$javac" ${TESTTOOLVMOPTS} -cp Main.java Main.java # Main.java is NOT a
|
||||
No Error "$javac" ${TESTTOOLVMOPTS} Main.java
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Warn if -Xlint is used and if class path element refers to
|
||||
# Warn if -Xlint is used and if class path element refers to
|
||||
# regular file which is not a zip file
|
||||
#----------------------------------------------------------------
|
||||
Warning "$javac" ${TESTTOOLVMOPTS} -Xlint -cp Main.java Main.java # Main.java is NOT a jar file
|
||||
@ -193,8 +194,8 @@ Sys cp -p classesRefRef.jar jars/.
|
||||
# Bad Jar file in extdirs and endorseddirs should not be ignored
|
||||
#----------------------------------------------------------------
|
||||
BadJarFile jars/classesRef.jar
|
||||
Error "$javac" ${TESTTOOLVMOPTS} -Xlint -extdirs jars Main.java
|
||||
Error "$javac" ${TESTTOOLVMOPTS} -Xlint -endorseddirs jars Main.java
|
||||
Error "$javac" ${TESTTOOLVMOPTS} -Xlint -extdirs jars Main.java
|
||||
Error "$javac" ${TESTTOOLVMOPTS} -Xlint -endorseddirs jars Main.java
|
||||
|
||||
Cleanup
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
set -u
|
||||
|
||||
BCP=`DefaultBootClassPath`
|
||||
# BCP=`DefaultBootClassPath`
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Prepare the "Minefield"
|
||||
@ -91,62 +91,62 @@ echo 'public class Main {public static void main(String[] a) {Lib.f();}}' > Main
|
||||
#----------------------------------------------------------------
|
||||
# Verify that javac class search order is the same as java's
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
-J-Djava.endorsed.dirs="GooJar" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
-J-Djava.endorsed.dirs="BadJar${PS}GooZip" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
-Djava.endorsed.dirs="GooJar" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
-Djava.endorsed.dirs="BadJar${PS}GooZip" \
|
||||
Main
|
||||
# Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# -J-Djava.endorsed.dirs="GooJar" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
# -J-Djava.endorsed.dirs="BadJar${PS}GooZip" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# -Djava.endorsed.dirs="GooJar" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
# -Djava.endorsed.dirs="BadJar${PS}GooZip" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass" \
|
||||
-bootclasspath "$BCP${PS}BadZip/Lib.zip" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass${PS}GooClass" \
|
||||
-bootclasspath "$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"BadJar/Lib.jar" \
|
||||
-Xbootclasspath:"$BCP${PS}GooClass" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass" \
|
||||
-Xbootclasspath:"$BCP${PS}BadZip/Lib.zip" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass${PS}GooClass" \
|
||||
-Xbootclasspath:"$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
|
||||
Main
|
||||
# Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass" \
|
||||
# -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass${PS}GooClass" \
|
||||
# -bootclasspath "$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadJar/Lib.jar" \
|
||||
# -Xbootclasspath:"$BCP${PS}GooClass" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass" \
|
||||
# -Xbootclasspath:"$BCP${PS}BadZip/Lib.zip" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass${PS}GooClass" \
|
||||
# -Xbootclasspath:"$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
-bootclasspath "$BCP${PS}GooZip/Lib.zip" \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-bootclasspath "$BCP${PS}BadZip/Lib.zip" \
|
||||
-Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath:"$BCP${PS}GooClass" \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath:"$BCP${PS}BadClass" \
|
||||
-Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
Main
|
||||
# Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -bootclasspath "$BCP${PS}GooZip/Lib.zip" \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
|
||||
# -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath:"$BCP${PS}GooClass" \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath:"$BCP${PS}BadClass" \
|
||||
# -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
@ -167,74 +167,74 @@ Success "$java" ${TESTVMOPTS} \
|
||||
Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass" \
|
||||
-J-Djava.endorsed.dirs="BadZip" \
|
||||
-bootclasspath "GooClass${PS}$BCP" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
-J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
-bootclasspath "BadClass${PS}$BCP" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass" \
|
||||
-Djava.endorsed.dirs="BadZip" \
|
||||
-Xbootclasspath:"GooClass${PS}$BCP" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
-Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
Main
|
||||
# Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass" \
|
||||
# -J-Djava.endorsed.dirs="BadZip" \
|
||||
# -bootclasspath "GooClass${PS}$BCP" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
# -bootclasspath "BadClass${PS}$BCP" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass" \
|
||||
# -Djava.endorsed.dirs="BadZip" \
|
||||
# -Xbootclasspath:"GooClass${PS}$BCP" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
# -Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass" \
|
||||
-Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
-Xbootclasspath/a:"GooClass" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
-Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
|
||||
-Xbootclasspath/a:"BadClass" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"GooClass" \
|
||||
-Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
-Xbootclasspath/a:"GooClass" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/p:"BadClass" \
|
||||
-Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
|
||||
-Xbootclasspath/a:"BadClass" \
|
||||
Main
|
||||
# Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass" \
|
||||
# -Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
# -Xbootclasspath/a:"GooClass" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
|
||||
# -Xbootclasspath/a:"BadClass" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"GooClass" \
|
||||
# -Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
# -Xbootclasspath/a:"GooClass" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/p:"BadClass" \
|
||||
# -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
|
||||
# -Xbootclasspath/a:"BadClass" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
-J-Djava.endorsed.dirs="BadZip" \
|
||||
-Xbootclasspath:"GooClass${PS}$BCP" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-endorseddirs "BadClass${PS}GooZip${PS}BadJar" \
|
||||
-Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
-Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
-Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Djava.endorsed.dirs="BadZip" \
|
||||
-Xbootclasspath:"GooClass${PS}$BCP" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
-Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
Main
|
||||
# Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -J-Djava.endorsed.dirs="BadZip" \
|
||||
# -Xbootclasspath:"GooClass${PS}$BCP" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -endorseddirs "BadClass${PS}GooZip${PS}BadJar" \
|
||||
# -Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
# -Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
# -Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Djava.endorsed.dirs="BadZip" \
|
||||
# -Xbootclasspath:"GooClass${PS}$BCP" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
|
||||
# -Xbootclasspath:"BadClass${PS}$BCP" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
@ -245,32 +245,32 @@ Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Xbootclasspath/a:"GooClass${PS}BadClass" \
|
||||
-extdirs "BadZip" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/a:"BadClass" \
|
||||
-Djava.ext.dirs="GooZip" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath/a:"GooClass${PS}BadClass" \
|
||||
-Djava.ext.dirs="BadZip" \
|
||||
Main
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/a:"BadClass" \
|
||||
# -Djava.ext.dirs="GooZip" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath/a:"GooClass${PS}BadClass" \
|
||||
# -Djava.ext.dirs="BadZip" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
-bootclasspath "$BCP${PS}BadJar/Lib.jar" \
|
||||
-J-Djava.ext.dir="GooJar" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-bootclasspath "$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
|
||||
-J-Djava.ext.dir="BadJar" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath:"$BCP${PS}BadJar/Lib.jar" \
|
||||
-Djava.ext.dirs="GooJar" \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Xbootclasspath:"$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
|
||||
-Djava.ext.dirs="BadJar" \
|
||||
Main
|
||||
# Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -bootclasspath "$BCP${PS}BadJar/Lib.jar" \
|
||||
# -J-Djava.ext.dir="GooJar" \
|
||||
# Main.java
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -bootclasspath "$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
|
||||
# -J-Djava.ext.dir="BadJar" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath:"$BCP${PS}BadJar/Lib.jar" \
|
||||
# -Djava.ext.dirs="GooJar" \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Xbootclasspath:"$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
|
||||
# -Djava.ext.dirs="BadJar" \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} \
|
||||
@ -285,18 +285,18 @@ Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-Djava.ext.dirs="GooZip${PS}BadJar" \
|
||||
-classpath "BadZip/Lib.zip" \
|
||||
Main.java
|
||||
Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
-J-Djava.ext.dirs="GooZip${PS}BadJar" \
|
||||
-classpath "BadZip/Lib.zip" \
|
||||
Main.java
|
||||
Failure "$java" ${TESTVMOPTS} \
|
||||
-Djava.ext.dirs="GooClass${PS}BadZip" \
|
||||
-cp "GooZip/Lib.zip${PS}." \
|
||||
Main
|
||||
Success "$java" ${TESTVMOPTS} \
|
||||
-Djava.ext.dirs="GooZip${PS}BadJar" \
|
||||
-cp "BadZip/Lib.zip${PS}." \
|
||||
Main
|
||||
# Success "$javac" ${TESTTOOLVMOPTS} \
|
||||
# -J-Djava.ext.dirs="GooZip${PS}BadJar" \
|
||||
# -classpath "BadZip/Lib.zip" \
|
||||
# Main.java
|
||||
# Failure "$java" ${TESTVMOPTS} \
|
||||
# -Djava.ext.dirs="GooClass${PS}BadZip" \
|
||||
# -cp "GooZip/Lib.zip${PS}." \
|
||||
# Main
|
||||
# Success "$java" ${TESTVMOPTS} \
|
||||
# -Djava.ext.dirs="GooZip${PS}BadJar" \
|
||||
# -cp "BadZip/Lib.zip${PS}." \
|
||||
# Main
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Failure "$javac" ${TESTTOOLVMOPTS} -classpath "BadClass${PS}GooClass" Main.java
|
||||
@ -339,27 +339,27 @@ In GooClass Success "$java" ${TESTVMOPTS} -cp "..${PS}${PS}/xyzzy" Main
|
||||
|
||||
# All other empty path elements are ignored.
|
||||
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -extdirs "" -cp ".." ../Main.java
|
||||
In GooJar Failure "$java" ${TESTVMOPTS} -Djava.ext.dirs="" -cp ".." Main
|
||||
# In GooJar Failure "$java" ${TESTVMOPTS} -Djava.ext.dirs="" -cp ".." Main
|
||||
|
||||
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -extdirs "${PS}" -cp ".." ../Main.java
|
||||
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="${PS}" -cp ".." ../Main.java
|
||||
In GooJar Failure "$java" ${TESTVMOPTS} -Djava.ext.dirs="${PS}" -cp ".." Main
|
||||
# In GooJar Failure "$java" ${TESTVMOPTS} -Djava.ext.dirs="${PS}" -cp ".." Main
|
||||
|
||||
In GooJar Success "$javac" ${TESTTOOLVMOPTS} -extdirs "." -cp ".." ../Main.java
|
||||
In GooJar Success "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="." -cp ".." ../Main.java
|
||||
In GooJar Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="." -cp ".." Main
|
||||
# In GooJar Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="." -cp ".." Main
|
||||
|
||||
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="" -cp ".." ../Main.java
|
||||
# In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="" -cp ".." ../Main.java
|
||||
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -Djava.endorsed.dirs="" -cp ".." ../Main.java
|
||||
In GooJar Failure "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="" -cp ".." Main
|
||||
# In GooJar Failure "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="" -cp ".." Main
|
||||
|
||||
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="${PS}" -cp ".." ../Main.java
|
||||
# In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="${PS}" -cp ".." ../Main.java
|
||||
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -endorseddirs "${PS}" -cp ".." ../Main.java
|
||||
In GooJar Failure "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="${PS}" -cp ".." Main
|
||||
# In GooJar Failure "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="${PS}" -cp ".." Main
|
||||
|
||||
In GooJar Success "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="." -cp ".." ../Main.java
|
||||
# In GooJar Success "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="." -cp ".." ../Main.java
|
||||
In GooJar Success "$javac" ${TESTTOOLVMOPTS} -Djava.endorsed.dirs="." -cp ".." ../Main.java
|
||||
In GooJar Success "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="." -cp ".." Main
|
||||
# In GooJar Success "$java" ${TESTVMOPTS} -Djava.endorsed.dirs="." -cp ".." Main
|
||||
|
||||
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/p: -cp ".." ../Main.java
|
||||
In GooClass Failure "$java" ${TESTVMOPTS} -Xbootclasspath/p: -cp ".." Main
|
||||
@ -367,11 +367,11 @@ In GooClass Failure "$java" ${TESTVMOPTS} -Xbootclasspath/p: -cp ".." Main
|
||||
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/p:. -cp ".." ../Main.java
|
||||
In GooClass Success "$java" ${TESTVMOPTS} -Xbootclasspath/p:. -cp ".." Main
|
||||
|
||||
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP" -cp ".." ../Main.java
|
||||
In GooClass Failure "$java" ${TESTVMOPTS} -Xbootclasspath:"$BCP" -cp ".." Main
|
||||
# In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP" -cp ".." ../Main.java
|
||||
# In GooClass Failure "$java" ${TESTVMOPTS} -Xbootclasspath:"$BCP" -cp ".." Main
|
||||
|
||||
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP${PS}." -cp ".." ../Main.java
|
||||
In GooClass Success "$java" ${TESTVMOPTS} -Xbootclasspath:"$BCP${PS}." -cp ".." Main
|
||||
# In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP${PS}." -cp ".." ../Main.java
|
||||
# In GooClass Success "$java" ${TESTVMOPTS} -Xbootclasspath:"$BCP${PS}." -cp ".." Main
|
||||
|
||||
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/a: -cp ".." ../Main.java
|
||||
In GooClass Failure "$java" ${TESTVMOPTS} -Xbootclasspath/a: -cp ".." Main
|
||||
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Support routines to allow running `javac' or `jar' within the same JVM.
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
class SameJVM {
|
||||
|
||||
private static ClassLoader toolsClassLoader() {
|
||||
File javaHome = new File(System.getProperty("java.home"));
|
||||
File classesDir = new File(javaHome, "classes");
|
||||
File libDir = new File(javaHome.getParentFile(), "lib");
|
||||
File toolsJar = new File(libDir, "tools.jar");
|
||||
try {
|
||||
return new URLClassLoader(
|
||||
new URL[] {classesDir.toURL(), toolsJar.toURL()});
|
||||
} catch (MalformedURLException e) { throw new AssertionError(e); }
|
||||
}
|
||||
private static final ClassLoader cl = toolsClassLoader();
|
||||
|
||||
static void javac(String... args) throws Exception {
|
||||
Class c = Class.forName("com.sun.tools.javac.Main", true, cl);
|
||||
int status = (Integer)
|
||||
c.getMethod("compile", new Class[] {String[].class})
|
||||
.invoke(c.newInstance(), new Object[] {args});
|
||||
if (status != 0)
|
||||
throw new Exception("javac failed: status=" + status);
|
||||
}
|
||||
|
||||
static void jar(String... args) throws Exception {
|
||||
Class c = Class.forName("sun.tools.jar.Main", true, cl);
|
||||
Object instance = c.getConstructor(
|
||||
new Class[] {PrintStream.class, PrintStream.class, String.class})
|
||||
.newInstance(System.out, System.err, "jar");
|
||||
boolean result = (Boolean)
|
||||
c.getMethod("run", new Class[] {String[].class})
|
||||
.invoke(instance, new Object[] {args});
|
||||
if (! result)
|
||||
throw new Exception("jar failed");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,15 +57,15 @@ Report() {
|
||||
test "$#" != 2 && Die "Usage: Report success|failure rc"
|
||||
|
||||
if test "$1" = "success" -a "$2" = 0; then
|
||||
echo "PASS: succeeded as expected"
|
||||
echo "PASS: succeeded as expected"
|
||||
elif test "$1" = "failure" -a "$2" != 0; then
|
||||
echo "PASS: failed as expected"
|
||||
echo "PASS: failed as expected"
|
||||
elif test "$1" = "success" -a "$2" != 0; then
|
||||
Fail "test failed unexpectedly"
|
||||
Fail "test failed unexpectedly"
|
||||
elif test "$1" = "failure" -a "$2" = 0; then
|
||||
Fail "test succeeded unexpectedly"
|
||||
Fail "test succeeded unexpectedly"
|
||||
else
|
||||
Die "Usage: Report success|failure rc"
|
||||
Die "Usage: Report success|failure rc"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -92,12 +92,12 @@ Bottom() {
|
||||
test "$#" = 1 -a "$1" = "Line" || Die "Usage: Bottom Line"
|
||||
|
||||
if test -n "$failed"; then
|
||||
count=`printf "%s" "$failed" | wc -c | tr -d ' '`
|
||||
echo "FAIL: $count tests failed"
|
||||
exit 1
|
||||
count=`printf "%s" "$failed" | wc -c | tr -d ' '`
|
||||
echo "FAIL: $count tests failed"
|
||||
exit 1
|
||||
else
|
||||
echo "PASS: all tests gave expected results"
|
||||
exit 0
|
||||
echo "PASS: all tests gave expected results"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
@ -105,21 +105,21 @@ BadJarFile() {
|
||||
for jarfilename in "$@"; do pwd > "$jarfilename"; done
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Usage: BCP=`DefaultBootClassPath`
|
||||
# Returns default bootclasspath, discarding non-existent entries
|
||||
#----------------------------------------------------------------
|
||||
DefaultBootClassPath() {
|
||||
echo 'public class B {public static void main(String[] a) {
|
||||
System.out.println(System.getProperty("sun.boot.class.path"));}}' > B.java
|
||||
"$javac" ${TESTTOOLVMOPTS} B.java
|
||||
_BCP_=""
|
||||
for elt in `"$java" ${TESTVMOPTS} B | tr "${PS}" " "`; do
|
||||
test -r "$elt" -a -n "$elt" && _BCP_="${_BCP_:+${_BCP_}${PS}}${elt}"
|
||||
done
|
||||
rm -f B.java B.class
|
||||
printf "%s" "$_BCP_" # Don't use echo -- unsafe on Windows
|
||||
}
|
||||
# #----------------------------------------------------------------
|
||||
# # Usage: BCP=`DefaultBootClassPath`
|
||||
# # Returns default bootclasspath, discarding non-existent entries
|
||||
# #----------------------------------------------------------------
|
||||
# DefaultBootClassPath() {
|
||||
# echo 'public class B {public static void main(String[] a) {
|
||||
# System.out.println(System.getProperty("sun.boot.class.path"));}}' > B.java
|
||||
# "$javac" ${TESTTOOLVMOPTS} B.java
|
||||
# _BCP_=""
|
||||
# for elt in `"$java" ${TESTVMOPTS} B | tr "${PS}" " "`; do
|
||||
# test -r "$elt" -a -n "$elt" && _BCP_="${_BCP_:+${_BCP_}${PS}}${elt}"
|
||||
# done
|
||||
# rm -f B.java B.class
|
||||
# printf "%s" "$_BCP_" # Don't use echo -- unsafe on Windows
|
||||
# }
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Foil message localization
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,13 +44,12 @@ import javax.tools.ToolProvider;
|
||||
public class T6654037 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
|
||||
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||
assert tool != null;
|
||||
|
||||
String code = "package test; public class Test {private void test() {Object o = null; boolean b = o != null && o instanceof String;} private Test() {}}";
|
||||
|
||||
JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-bootclasspath", bootPath, "-Xjcov"), null, Arrays.asList(new MyFileObject(code)));
|
||||
JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-Xjcov"), null, Arrays.asList(new MyFileObject(code)));
|
||||
CompilationUnitTree cut = ct.parse().iterator().next();
|
||||
ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
|
||||
MethodTree method = (MethodTree) clazz.getMembers().get(0);
|
||||
|
@ -41,8 +41,6 @@ public class T6705935 {
|
||||
|
||||
public void run() throws Exception {
|
||||
File java_home = new File(System.getProperty("java.home"));
|
||||
if (java_home.getName().equals("jre"))
|
||||
java_home = java_home.getParentFile();
|
||||
|
||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||
try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,13 +26,17 @@
|
||||
* @bug 6725036 8016760
|
||||
* @summary javac returns incorrect value for lastModifiedTime() when
|
||||
* source is a zip file archive
|
||||
* @library /tools/lib
|
||||
* @build ToolBox
|
||||
* @run main T6725036
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.*;
|
||||
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.file.RelativePath.RelativeFile;
|
||||
@ -49,33 +53,43 @@ public class T6725036 {
|
||||
void run() throws Exception {
|
||||
RelativeFile TEST_ENTRY_NAME = new RelativeFile("java/lang/String.class");
|
||||
|
||||
File f = new File(System.getProperty("java.home"));
|
||||
if (!f.getName().equals("jre"))
|
||||
f = new File(f, "jre");
|
||||
File rt_jar = new File(new File(f, "lib"), "rt.jar");
|
||||
File testJar = createJar("test.jar", "java.lang.*");
|
||||
|
||||
JarFile j = new JarFile(rt_jar);
|
||||
JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
|
||||
long jarEntryTime = je.getTime();
|
||||
try (JarFile j = new JarFile(testJar)) {
|
||||
JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
|
||||
long jarEntryTime = je.getTime();
|
||||
|
||||
ZipFileIndexCache zfic = ZipFileIndexCache.getSharedInstance();
|
||||
ZipFileIndex zfi = zfic.getZipFileIndex(rt_jar, null, false, null, false);
|
||||
long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);
|
||||
ZipFileIndexCache zfic = ZipFileIndexCache.getSharedInstance();
|
||||
ZipFileIndex zfi = zfic.getZipFileIndex(testJar, null, false, null, false);
|
||||
long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);
|
||||
|
||||
check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);
|
||||
check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);
|
||||
|
||||
Context context = new Context();
|
||||
JavacFileManager fm = new JavacFileManager(context, false, null);
|
||||
ZipFileIndexArchive zfia = new ZipFileIndexArchive(fm, zfi);
|
||||
JavaFileObject jfo =
|
||||
zfia.getFileObject(TEST_ENTRY_NAME.dirname(),
|
||||
TEST_ENTRY_NAME.basename());
|
||||
long jfoTime = jfo.getLastModified();
|
||||
Context context = new Context();
|
||||
JavacFileManager fm = new JavacFileManager(context, false, null);
|
||||
ZipFileIndexArchive zfia = new ZipFileIndexArchive(fm, zfi);
|
||||
JavaFileObject jfo =
|
||||
zfia.getFileObject(TEST_ENTRY_NAME.dirname(),
|
||||
TEST_ENTRY_NAME.basename());
|
||||
long jfoTime = jfo.getLastModified();
|
||||
|
||||
check(je, jarEntryTime, jfo, jfoTime);
|
||||
check(je, jarEntryTime, jfo, jfoTime);
|
||||
|
||||
if (errors > 0)
|
||||
throw new Exception(errors + " occurred");
|
||||
if (errors > 0)
|
||||
throw new Exception(errors + " occurred");
|
||||
}
|
||||
}
|
||||
|
||||
File createJar(String name, String... paths) throws IOException {
|
||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||
try (JavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||
File f = new File(name);
|
||||
ToolBox tb = new ToolBox();
|
||||
tb.new JarTask(f.getPath())
|
||||
.files(fm, StandardLocation.PLATFORM_CLASS_PATH, paths)
|
||||
.run();
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
void check(Object ref, long refTime, Object test, long testTime) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import sun.misc.*;
|
||||
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6873845
|
||||
* @summary refine access to symbol file
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import sun.misc.*;
|
||||
|
||||
public class T6873845 {
|
||||
public static void main(String... args) throws Exception {
|
||||
new T6873845().run();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,7 +51,6 @@ public class TestAnnotationPackageInfo {
|
||||
}
|
||||
|
||||
public void run() throws Exception {
|
||||
final String bootPath = System.getProperty("sun.boot.class.path");
|
||||
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||
assert tool != null;
|
||||
|
||||
@ -65,9 +64,8 @@ public class TestAnnotationPackageInfo {
|
||||
|
||||
DiagnosticCollector<JavaFileObject> coll = new DiagnosticCollector<JavaFileObject>();
|
||||
|
||||
List<String> options = Arrays.asList("-bootclasspath", bootPath);
|
||||
List<? extends JavaFileObject> files = Arrays.asList(test_java, package_info_java);
|
||||
JavacTask ct = (JavacTask)tool.getTask(null, null, coll, options, null, files);
|
||||
JavacTask ct = (JavacTask)tool.getTask(null, null, coll, null, null, files);
|
||||
ct.analyze();
|
||||
|
||||
String expectedCode = "compiler.err.annotation.missing.default.value";
|
||||
|
@ -1,232 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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 6410367 6411310
|
||||
* @summary FileObject should support user-friendly names via getName()
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.jar.*;
|
||||
import java.util.zip.*;
|
||||
import javax.tools.*;
|
||||
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.Options;
|
||||
|
||||
// Test FileObject.getName returned from JavacFileManager and its support classes.
|
||||
|
||||
public class Test {
|
||||
public static void main(String... args) throws Exception {
|
||||
new Test().run();
|
||||
}
|
||||
|
||||
Set<String> foundClasses = new TreeSet<String>();
|
||||
Set<String> foundJars = new TreeSet<String>();
|
||||
|
||||
void run() throws Exception {
|
||||
File rt_jar = findRtJar();
|
||||
|
||||
// names for entries to be created in directories and jar files
|
||||
String[] entries = { "p/A.java", "p/A.class", "p/resources/A-1.html" };
|
||||
|
||||
// test various combinations of directories and jar files, intended to
|
||||
// cover all sources of file objects within JavacFileManager's support classes
|
||||
|
||||
test(createFileManager(), createDir("dir", entries), "p", entries);
|
||||
test(createFileManager(), createDir("a b/dir", entries), "p", entries);
|
||||
|
||||
for (boolean useOptimizedZip: new boolean[] { false, true }) {
|
||||
test(createFileManager(useOptimizedZip), createJar("jar", entries), "p", entries);
|
||||
test(createFileManager(useOptimizedZip), createJar("jar jar", entries), "p", entries);
|
||||
|
||||
for (boolean useSymbolFile: new boolean[] { false, true }) {
|
||||
test(createFileManager(useOptimizedZip, useSymbolFile), rt_jar, "java.lang.ref", null);
|
||||
}
|
||||
}
|
||||
|
||||
if (errors > 0)
|
||||
throw new Exception(errors + " errors found");
|
||||
|
||||
// Verify that we hit all the impl classes we intended
|
||||
checkCoverage("classes", foundClasses,
|
||||
"RegularFileObject", "SymbolFileObject", "ZipFileIndexFileObject", "ZipFileObject");
|
||||
|
||||
// Verify that we hit the jar files we intended, specifically ct.sym as well as rt.jar
|
||||
checkCoverage("jar files", foundJars,
|
||||
"ct.sym", "jar", "jar jar", "rt.jar");
|
||||
}
|
||||
|
||||
// use a new file manager for each test
|
||||
void test(StandardJavaFileManager fm, File f, String pkg, String[] entries) throws Exception {
|
||||
System.err.println("Test " + f);
|
||||
try {
|
||||
if (f.isDirectory()) {
|
||||
for (File dir: new File[] { f, f.getAbsoluteFile() }) {
|
||||
for (String e: entries) {
|
||||
JavaFileObject fo = fm.getJavaFileObjects(new File(dir, e)).iterator().next();
|
||||
test(fo, dir, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fm.setLocation(StandardLocation.CLASS_PATH, Collections.singleton(f));
|
||||
fm.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(f.getAbsoluteFile()));
|
||||
for (StandardLocation l: EnumSet.of(StandardLocation.CLASS_PATH, StandardLocation.SOURCE_PATH)) {
|
||||
for (JavaFileObject fo: fm.list(l, pkg, EnumSet.allOf(JavaFileObject.Kind.class), true)) {
|
||||
// we could use fm.getLocation but the following guarantees we preserve the original filename
|
||||
File dir = (l == StandardLocation.CLASS_PATH ? f : f.getAbsoluteFile());
|
||||
char sep = (dir.isDirectory() ? File.separatorChar : '/');
|
||||
String b = fm.inferBinaryName(l, fo);
|
||||
String e = fo.getKind().extension;
|
||||
test(fo, dir, b.replace('.', sep) + e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
fm.close();
|
||||
}
|
||||
}
|
||||
|
||||
void test(JavaFileObject fo, File dir, String p) {
|
||||
System.err.println("Test: " + fo);
|
||||
String expect = dir.isDirectory() ? new File(dir, p).getPath() : (dir.getPath() + "(" + p + ")");
|
||||
String found = fo.getName();
|
||||
// if ct.sym is found, replace it with the equivalent rt.jar
|
||||
String found2 = found.replaceAll("lib([\\\\/])ct.sym\\(META-INF/sym/rt.jar/", "jre$1lib$1rt.jar(");
|
||||
if (!expect.equals(found2)) {
|
||||
System.err.println("expected: " + expect);
|
||||
System.err.println(" found: " + found);
|
||||
if (!found.equals(found2))
|
||||
System.err.println(" found2: " + found2);
|
||||
error("Failed: " + fo);
|
||||
}
|
||||
|
||||
// record the file object class name for coverage checks later
|
||||
foundClasses.add(fo.getClass().getSimpleName());
|
||||
|
||||
if (found.contains("(")) {
|
||||
// record access to the jar file for coverage checks later
|
||||
foundJars.add(new File(found.substring(0, found.indexOf("("))).getName());
|
||||
}
|
||||
}
|
||||
|
||||
void checkCoverage(String label, Set<String> found, String... expect) throws Exception {
|
||||
Set<String> e = new TreeSet<String>(Arrays.asList(expect));
|
||||
if (!found.equals(e)) {
|
||||
e.removeAll(found);
|
||||
throw new Exception("expected " + label + " not used: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
JavacFileManager createFileManager() {
|
||||
return createFileManager(false, false);
|
||||
}
|
||||
|
||||
JavacFileManager createFileManager(boolean useOptimizedZip) {
|
||||
return createFileManager(useOptimizedZip, false);
|
||||
}
|
||||
|
||||
JavacFileManager createFileManager(boolean useOptimizedZip, boolean useSymbolFile) {
|
||||
Context c = new Context();
|
||||
Options options = Options.instance(c);
|
||||
|
||||
options.put("useOptimizedZip", Boolean.toString(useOptimizedZip));
|
||||
|
||||
if (!useSymbolFile) {
|
||||
options.put("ignore.symbol.file", "true");
|
||||
}
|
||||
return new JavacFileManager(c, false, null);
|
||||
}
|
||||
|
||||
File createDir(String name, String... entries) throws Exception {
|
||||
File dir = new File(name);
|
||||
if (!dir.mkdirs())
|
||||
throw new Exception("cannot create directories " + dir);
|
||||
for (String e: entries) {
|
||||
writeFile(new File(dir, e), e);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
File createJar(String name, String... entries) throws IOException {
|
||||
File jar = new File(name);
|
||||
OutputStream out = new FileOutputStream(jar);
|
||||
try {
|
||||
JarOutputStream jos = new JarOutputStream(out);
|
||||
for (String e: entries) {
|
||||
jos.putNextEntry(new ZipEntry(e));
|
||||
jos.write(e.getBytes());
|
||||
}
|
||||
jos.close();
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
return jar;
|
||||
}
|
||||
|
||||
File findRtJar() throws Exception {
|
||||
File java_home = new File(System.getProperty("java.home"));
|
||||
if (java_home.getName().equals("jre"))
|
||||
java_home = java_home.getParentFile();
|
||||
File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
|
||||
if (!rt_jar.exists())
|
||||
throw new Exception("can't find rt.jar");
|
||||
return rt_jar;
|
||||
}
|
||||
|
||||
byte[] read(InputStream in) throws IOException {
|
||||
byte[] data = new byte[1024];
|
||||
int offset = 0;
|
||||
try {
|
||||
int n;
|
||||
while ((n = in.read(data, offset, data.length - offset)) != -1) {
|
||||
offset += n;
|
||||
if (offset == data.length)
|
||||
data = Arrays.copyOf(data, 2 * data.length);
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
return Arrays.copyOf(data, offset);
|
||||
}
|
||||
|
||||
void writeFile(File f, String s) throws IOException {
|
||||
f.getParentFile().mkdirs();
|
||||
FileWriter out = new FileWriter(f);
|
||||
try {
|
||||
out.write(s);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
void error(String msg) {
|
||||
System.err.println(msg);
|
||||
errors++;
|
||||
}
|
||||
|
||||
int errors;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -43,10 +43,9 @@ import javax.tools.ToolProvider;
|
||||
|
||||
public class T6598108 {
|
||||
public static void main(String[] args) throws Exception {
|
||||
final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
|
||||
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||
assert tool != null;
|
||||
final JavacTask ct = (JavacTask)tool.getTask(null, null, null, Arrays.asList("-bootclasspath", bootPath), null, Arrays.asList(new MyFileObject()));
|
||||
final JavacTask ct = (JavacTask)tool.getTask(null, null, null, null, null, Arrays.asList(new MyFileObject()));
|
||||
|
||||
CompilationUnitTree cut = ct.parse().iterator().next();
|
||||
TreePath tp = new TreePath(new TreePath(cut), cut.getTypeDecls().get(0));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -47,8 +47,7 @@ public class T6608214 {
|
||||
}
|
||||
};
|
||||
List<? extends JavaFileObject> files = Arrays.asList(sfo);
|
||||
String bootPath = System.getProperty("sun.boot.class.path");
|
||||
List<String> opts = Arrays.asList("-bootclasspath", bootPath, "-Xjcov");
|
||||
List<String> opts = Arrays.asList("-Xjcov");
|
||||
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||
JavacTask ct = (JavacTask)tool.getTask(null, null, null,opts,null,files);
|
||||
ct.analyze();
|
||||
|
@ -44,28 +44,9 @@ public class T6412669 extends AbstractProcessor {
|
||||
File testSrc = new File(System.getProperty("test.src", "."));
|
||||
File testClasses = new File(System.getProperty("test.classes", "."));
|
||||
|
||||
// Determine location of necessary tools classes. Assume all in one place.
|
||||
// Likely candidates are typically tools.jar (when testing JDK build)
|
||||
// or build/classes or dist/javac.jar (when testing langtools, using -Xbootclasspath/p:)
|
||||
File toolsClasses;
|
||||
URL u = T6412669.class.getClassLoader().getResource("com/sun/source/util/JavacTask.class");
|
||||
switch (u.getProtocol()) {
|
||||
case "file":
|
||||
toolsClasses = new File(u.toURI());
|
||||
break;
|
||||
case "jar":
|
||||
String s = u.getFile(); // will be file:path!/entry
|
||||
int sep = s.indexOf("!");
|
||||
toolsClasses = new File(new URI(s.substring(0, sep)));
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError("Cannot locate tools classes");
|
||||
}
|
||||
//System.err.println("toolsClasses: " + toolsClasses);
|
||||
|
||||
JavacTool tool = JavacTool.create();
|
||||
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses, toolsClasses));
|
||||
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses));
|
||||
Iterable<? extends JavaFileObject> files =
|
||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6412669.class.getName()+".java")));
|
||||
String[] opts = { "-proc:only", "-processor", T6412669.class.getName()};
|
||||
|
@ -1,238 +1,255 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6430241
|
||||
* @summary Hard to disable symbol file feature through API
|
||||
*/
|
||||
/*
|
||||
* @test
|
||||
* @bug 6430241
|
||||
* @summary Hard to disable symbol file feature through API
|
||||
* @library /tools/lib
|
||||
* @build ToolBox
|
||||
* @run main T6430241
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import javax.tools.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.source.util.JavacTask;
|
||||
import com.sun.tools.javac.api.JavacTool;
|
||||
import javax.tools.*;
|
||||
|
||||
public class T6430241 {
|
||||
public static void main(String... args) throws Exception {
|
||||
new T6430241().run();
|
||||
import com.sun.source.util.JavacTask;
|
||||
import com.sun.tools.javac.api.JavacTool;
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
|
||||
public class T6430241 {
|
||||
public static void main(String... args) throws Exception {
|
||||
new T6430241().run();
|
||||
}
|
||||
|
||||
void run() throws Exception {
|
||||
setup();
|
||||
testCommandLine();
|
||||
testSimpleAPI();
|
||||
testTaskAPI();
|
||||
|
||||
if (errors > 0)
|
||||
throw new Exception(errors + " errors found");
|
||||
}
|
||||
|
||||
void setup() throws Exception {
|
||||
classesDir = new File("classes");
|
||||
classesDir.mkdirs();
|
||||
|
||||
emptyDir = new File("empty");
|
||||
emptyDir.mkdirs();
|
||||
|
||||
bootClassPath = createJar().getPath();
|
||||
|
||||
File srcDir = new File("src");
|
||||
String test = "import sun.misc.Unsafe; class Test { }";
|
||||
testFile = writeFile(srcDir, "Test.java", test);
|
||||
}
|
||||
|
||||
//----- tests for command line invocation
|
||||
|
||||
void testCommandLine() throws Exception {
|
||||
testCommandLine(true);
|
||||
testCommandLine(false, "-Xbootclasspath/p:" + emptyDir);
|
||||
testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
|
||||
testCommandLine(false, "-Xbootclasspath/a:" + emptyDir);
|
||||
testCommandLine(false, "-XDignore.symbol.file");
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
|
||||
System.err.println("test command line: " + Arrays.asList(opts));
|
||||
|
||||
String[] args = initArgs(opts);
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
int rc = com.sun.tools.javac.Main.compile(args, pw);
|
||||
String out = showOutput(sw.toString());
|
||||
|
||||
checkCompilationOK(rc);
|
||||
checkOutput(out, expectWarnings);
|
||||
}
|
||||
|
||||
//----- tests for simple API invocation
|
||||
|
||||
void testSimpleAPI() {
|
||||
testSimpleAPI(true);
|
||||
testSimpleAPI(false, "-Xbootclasspath/p:" + emptyDir);
|
||||
testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
|
||||
testSimpleAPI(false, "-Xbootclasspath/a:" + emptyDir);
|
||||
testSimpleAPI(false, "-XDignore.symbol.file");
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testSimpleAPI(boolean expectWarnings, String... opts) {
|
||||
System.err.println("test simple API: " + Arrays.asList(opts));
|
||||
|
||||
String[] args = initArgs(opts);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(baos);
|
||||
|
||||
JavacTool tool = JavacTool.create();
|
||||
int rc = tool.run(null, null, ps, args);
|
||||
|
||||
String out = showOutput(baos.toString());
|
||||
|
||||
checkCompilationOK(rc);
|
||||
checkOutput(out, expectWarnings);
|
||||
}
|
||||
|
||||
//----- tests for CompilationTask API invocation
|
||||
|
||||
void testTaskAPI() throws Exception {
|
||||
List<File> bcp = new ArrayList<File>();
|
||||
for (String f: bootClassPath.split(File.pathSeparator)) {
|
||||
if (!f.isEmpty())
|
||||
bcp.add(new File(f));
|
||||
}
|
||||
|
||||
void run() throws Exception {
|
||||
setup();
|
||||
testCommandLine();
|
||||
testSimpleAPI();
|
||||
testTaskAPI();
|
||||
testTaskAPI(true, null);
|
||||
testTaskAPI(false, bcp);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
if (errors > 0)
|
||||
throw new Exception(errors + " errors found");
|
||||
}
|
||||
void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
|
||||
System.err.println("test task API: " + pcp);
|
||||
|
||||
void setup() throws Exception {
|
||||
classesDir = new File("classes");
|
||||
classesDir.mkdirs();
|
||||
JavacTool tool = JavacTool.create();
|
||||
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||
|
||||
emptyDir = new File("empty");
|
||||
emptyDir.mkdirs();
|
||||
if (pcp != null)
|
||||
fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
|
||||
|
||||
bootClassPath = System.getProperty("sun.boot.class.path");
|
||||
|
||||
File srcDir = new File("src");
|
||||
String test = "import sun.misc.Unsafe; class Test { }";
|
||||
testFile = writeFile(srcDir, "Test.java", test);
|
||||
}
|
||||
|
||||
//----- tests for command line invocation
|
||||
|
||||
void testCommandLine() throws Exception {
|
||||
testCommandLine(true);
|
||||
testCommandLine(true, "-Xbootclasspath/p:" + emptyDir);
|
||||
testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
|
||||
testCommandLine(true, "-Xbootclasspath/a:" + emptyDir);
|
||||
testCommandLine(false, "-XDignore.symbol.file");
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
|
||||
System.err.println("test command line: " + Arrays.asList(opts));
|
||||
|
||||
String[] args = initArgs(opts);
|
||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
int rc = com.sun.tools.javac.Main.compile(args, pw);
|
||||
JavacTask task = tool.getTask(pw, fm, null, null, null, files);
|
||||
boolean ok = task.call();
|
||||
String out = showOutput(sw.toString());
|
||||
|
||||
checkCompilationOK(rc);
|
||||
checkCompilationOK(ok);
|
||||
checkOutput(out, expectWarnings);
|
||||
}
|
||||
|
||||
//----- tests for simple API invocation
|
||||
|
||||
void testSimpleAPI() {
|
||||
testSimpleAPI(true);
|
||||
testSimpleAPI(true, "-Xbootclasspath/p:" + emptyDir);
|
||||
testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
|
||||
testSimpleAPI(true, "-Xbootclasspath/a:" + emptyDir);
|
||||
testSimpleAPI(false, "-XDignore.symbol.file");
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testSimpleAPI(boolean expectWarnings, String... opts) {
|
||||
System.err.println("test simple API: " + Arrays.asList(opts));
|
||||
|
||||
String[] args = initArgs(opts);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(baos);
|
||||
|
||||
JavacTool tool = JavacTool.create();
|
||||
int rc = tool.run(null, null, ps, args);
|
||||
|
||||
String out = showOutput(baos.toString());
|
||||
|
||||
checkCompilationOK(rc);
|
||||
checkOutput(out, expectWarnings);
|
||||
}
|
||||
|
||||
//----- tests for CompilationTask API invocation
|
||||
|
||||
void testTaskAPI() throws Exception {
|
||||
List<File> bcp = new ArrayList<File>();
|
||||
for (String f: bootClassPath.split(File.pathSeparator)) {
|
||||
if (!f.isEmpty())
|
||||
bcp.add(new File(f));
|
||||
}
|
||||
|
||||
testTaskAPI(true, null);
|
||||
testTaskAPI(false, bcp);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
|
||||
System.err.println("test task API: " + pcp);
|
||||
|
||||
JavacTool tool = JavacTool.create();
|
||||
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||
|
||||
if (pcp != null)
|
||||
fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
|
||||
|
||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
JavacTask task = tool.getTask(pw, fm, null, null, null, files);
|
||||
boolean ok = task.call();
|
||||
String out = showOutput(sw.toString());
|
||||
|
||||
checkCompilationOK(ok);
|
||||
checkOutput(out, expectWarnings);
|
||||
}
|
||||
}
|
||||
|
||||
//----- utility methods
|
||||
|
||||
/**
|
||||
* Create a file with given content.
|
||||
*/
|
||||
File writeFile(File dir, String path, String content) throws IOException {
|
||||
File f = new File(dir, path);
|
||||
f.getParentFile().mkdirs();
|
||||
FileWriter out = new FileWriter(f);
|
||||
try {
|
||||
out.write(content);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize args for compilation with given opts.
|
||||
* @return opts -d classesDir testFile
|
||||
*/
|
||||
String[] initArgs(String[] opts) {
|
||||
List<String> args = new ArrayList<String>();
|
||||
args.addAll(Arrays.asList(opts));
|
||||
args.add("-d");
|
||||
args.add(classesDir.getPath());
|
||||
args.add(testFile.getPath());
|
||||
return args.toArray(new String[args.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show output from compilation if non empty.
|
||||
*/
|
||||
String showOutput(String out) {
|
||||
if (!out.isEmpty())
|
||||
System.err.println(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify compilation succeeeded.
|
||||
*/
|
||||
void checkCompilationOK(boolean ok) {
|
||||
if (!ok)
|
||||
error("compilation failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify compilation succeeeded.
|
||||
*/
|
||||
void checkCompilationOK(int rc) {
|
||||
if (rc != 0)
|
||||
error("compilation failed, rc: " + rc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether output contains warnings if and only if warnings
|
||||
* are expected.
|
||||
*/
|
||||
void checkOutput(String out, boolean expectWarnings) {
|
||||
boolean foundWarnings = out.contains("warning");
|
||||
if (foundWarnings) {
|
||||
if (!expectWarnings)
|
||||
error("unexpected warnings found");
|
||||
} else {
|
||||
if (expectWarnings)
|
||||
error("expected warnings not found");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an error.
|
||||
*/
|
||||
void error(String msg) {
|
||||
System.err.println("error: " + msg);
|
||||
errors++;
|
||||
}
|
||||
|
||||
String bootClassPath;
|
||||
File classesDir;
|
||||
File emptyDir;
|
||||
File testFile;
|
||||
int errors;
|
||||
}
|
||||
|
||||
//----- utility methods
|
||||
|
||||
File createJar() throws IOException {
|
||||
File f = new File("test.jar");
|
||||
try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
|
||||
ToolBox tb = new ToolBox();
|
||||
tb.new JarTask(f.getPath())
|
||||
.files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*", "sun.misc.*")
|
||||
.run();
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a file with given content.
|
||||
*/
|
||||
File writeFile(File dir, String path, String content) throws IOException {
|
||||
File f = new File(dir, path);
|
||||
f.getParentFile().mkdirs();
|
||||
FileWriter out = new FileWriter(f);
|
||||
try {
|
||||
out.write(content);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize args for compilation with given opts.
|
||||
* @return opts -d classesDir testFile
|
||||
*/
|
||||
String[] initArgs(String[] opts) {
|
||||
List<String> args = new ArrayList<String>();
|
||||
args.addAll(Arrays.asList(opts));
|
||||
args.add("-d");
|
||||
args.add(classesDir.getPath());
|
||||
args.add(testFile.getPath());
|
||||
return args.toArray(new String[args.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show output from compilation if non empty.
|
||||
*/
|
||||
String showOutput(String out) {
|
||||
if (!out.isEmpty())
|
||||
System.err.println(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify compilation succeeded.
|
||||
*/
|
||||
void checkCompilationOK(boolean ok) {
|
||||
if (!ok)
|
||||
error("compilation failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify compilation succeeded.
|
||||
*/
|
||||
void checkCompilationOK(int rc) {
|
||||
if (rc != 0)
|
||||
error("compilation failed, rc: " + rc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether output contains warnings if and only if warnings
|
||||
* are expected.
|
||||
*/
|
||||
void checkOutput(String out, boolean expectWarnings) {
|
||||
boolean foundWarnings = out.contains("warning");
|
||||
if (foundWarnings) {
|
||||
if (!expectWarnings)
|
||||
error("unexpected warnings found");
|
||||
} else {
|
||||
if (expectWarnings)
|
||||
error("expected warnings not found");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an error.
|
||||
*/
|
||||
void error(String msg) {
|
||||
System.err.println("error: " + msg);
|
||||
errors++;
|
||||
}
|
||||
|
||||
String bootClassPath;
|
||||
File classesDir;
|
||||
File emptyDir;
|
||||
File testFile;
|
||||
int errors;
|
||||
}
|
||||
|
@ -52,8 +52,6 @@ public class T6877206 {
|
||||
Set<String> foundJars = new TreeSet<String>();
|
||||
|
||||
void run() throws Exception {
|
||||
File rt_jar = findRtJar();
|
||||
|
||||
// names for entries to be created in directories and jar files
|
||||
String[] entries = { "p/A.class", "p/resources/A-1.jpg" };
|
||||
|
||||
@ -66,19 +64,14 @@ public class T6877206 {
|
||||
for (boolean useOptimizedZip: new boolean[] { false, true }) {
|
||||
test(createFileManager(useOptimizedZip), createJar("jar", entries), "p", entries.length);
|
||||
test(createFileManager(useOptimizedZip), createJar("jar jar", entries), "p", entries.length);
|
||||
|
||||
for (boolean useSymbolFile: new boolean[] { false, true }) {
|
||||
test(createFileManager(useOptimizedZip, useSymbolFile), rt_jar, "java.lang.ref", -1);
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that we hit all the impl classes we intended
|
||||
// Verify that we hit the files we intended
|
||||
checkCoverage("classes", foundClasses,
|
||||
"RegularFileObject", "SymbolFileObject", "ZipFileIndexFileObject", "ZipFileObject");
|
||||
"RegularFileObject", "ZipFileIndexFileObject", "ZipFileObject");
|
||||
|
||||
// Verify that we hit the jar files we intended, specifically ct.sym as well as rt.jar
|
||||
checkCoverage("jar files", foundJars,
|
||||
"ct.sym", "jar", "jar jar", "rt.jar");
|
||||
// Verify that we hit the jar files we intended
|
||||
checkCoverage("jar files", foundJars, "jar", "jar jar");
|
||||
}
|
||||
|
||||
// use a new file manager for each test
|
||||
@ -201,16 +194,6 @@ public class T6877206 {
|
||||
return jar;
|
||||
}
|
||||
|
||||
File findRtJar() throws Exception {
|
||||
File java_home = new File(System.getProperty("java.home"));
|
||||
if (java_home.getName().equals("jre"))
|
||||
java_home = java_home.getParentFile();
|
||||
File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
|
||||
if (!rt_jar.exists())
|
||||
throw new Exception("can't find rt.jar");
|
||||
return rt_jar;
|
||||
}
|
||||
|
||||
byte[] read(InputStream in) throws IOException {
|
||||
byte[] data = new byte[1024];
|
||||
int offset = 0;
|
||||
|
@ -89,7 +89,7 @@ public class TestJavacTaskScanner extends ToolTester {
|
||||
System.out.println("#parseTypeElements: " + numParseTypeElements);
|
||||
System.out.println("#allMembers: " + numAllMembers);
|
||||
|
||||
check(numTokens, "#Tokens", 1222);
|
||||
check(numTokens, "#Tokens", 1054);
|
||||
check(numParseTypeElements, "#parseTypeElements", 158);
|
||||
check(numAllMembers, "#allMembers", 52);
|
||||
}
|
||||
@ -138,30 +138,10 @@ public class TestJavacTaskScanner extends ToolTester {
|
||||
public StandardJavaFileManager getLocalFileManager(JavaCompiler tool,
|
||||
DiagnosticListener<JavaFileObject> dl,
|
||||
Charset encoding) {
|
||||
File javac_classes;
|
||||
try {
|
||||
final String javacMainClass = "com/sun/tools/javac/Main.class";
|
||||
URL url = getClass().getClassLoader().getResource(javacMainClass);
|
||||
if (url == null)
|
||||
throw new Error("can't locate javac classes");
|
||||
URI uri = url.toURI();
|
||||
String scheme = uri.getScheme();
|
||||
String ssp = uri.getSchemeSpecificPart();
|
||||
if (scheme.equals("jar")) {
|
||||
javac_classes = new File(new URI(ssp.substring(0, ssp.indexOf("!/"))));
|
||||
} else if (scheme.equals("file")) {
|
||||
javac_classes = new File(ssp.substring(0, ssp.indexOf(javacMainClass)));
|
||||
} else
|
||||
throw new Error("unknown URL: " + url);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
System.err.println("javac_classes: " + javac_classes);
|
||||
|
||||
StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, encoding);
|
||||
try {
|
||||
fm.setLocation(SOURCE_PATH, Arrays.asList(test_src));
|
||||
fm.setLocation(CLASS_PATH, join(test_class_path, Arrays.asList(javac_classes)));
|
||||
fm.setLocation(CLASS_PATH, test_class_path);
|
||||
fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
|
@ -108,6 +108,7 @@ public class TestSearchPaths {
|
||||
|
||||
void testClassOutput() throws IOException {
|
||||
String test = "testClassOutput";
|
||||
System.err.println("test: " + test);
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
File classes = createDir(test + "/" + i + "/classes");
|
||||
@ -133,6 +134,7 @@ public class TestSearchPaths {
|
||||
|
||||
void testClassPath() throws IOException {
|
||||
String test = "testClassPath";
|
||||
System.err.println("test: " + test);
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
File classes = createDir(test + "/" + i + "/classes");
|
||||
@ -159,10 +161,12 @@ public class TestSearchPaths {
|
||||
}
|
||||
|
||||
tested.add(CLASS_PATH);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testSourcePath() throws IOException {
|
||||
String test = "testSourcePath";
|
||||
System.err.println("test: " + test);
|
||||
setLocation(CLASS_PATH); // empty
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
@ -188,10 +192,12 @@ public class TestSearchPaths {
|
||||
}
|
||||
|
||||
tested.add(SOURCE_PATH);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testPlatformClassPath() throws IOException {
|
||||
String test = "testPlatformClassPath";
|
||||
System.err.println("test: " + test);
|
||||
|
||||
List<File> defaultPath = getLocation(PLATFORM_CLASS_PATH);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@ -205,7 +211,10 @@ public class TestSearchPaths {
|
||||
setLocation(CLASS_PATH); // empty
|
||||
setLocation(SOURCE_PATH); // empty
|
||||
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
// FIXME: temporarily exclude cases referring to default bootclasspath
|
||||
// for (int i = 1; i <= 10; i++) {
|
||||
int[] cases = new int[] { 1, 2, 4, 5, 6, 7 };
|
||||
for (int i : cases) {
|
||||
File classes = createDir(test + "/" + i + "/classes");
|
||||
File testJars = createDir(test + "/" + i + "/testJars");
|
||||
File testClasses = createDir(test + "/" + i + "/testClasses");
|
||||
@ -302,10 +311,14 @@ public class TestSearchPaths {
|
||||
}
|
||||
|
||||
tested.add(PLATFORM_CLASS_PATH);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testAnnotationProcessorPath() throws IOException {
|
||||
String test = "testAnnotationProcessorPath";
|
||||
System.err.println("test: " + test);
|
||||
|
||||
fileManager.setLocation(PLATFORM_CLASS_PATH, null);
|
||||
|
||||
String template =
|
||||
"import java.util.*;\n"
|
||||
@ -348,10 +361,12 @@ public class TestSearchPaths {
|
||||
}
|
||||
|
||||
tested.add(ANNOTATION_PROCESSOR_PATH);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testSourceOutput() throws IOException {
|
||||
String test = "testAnnotationProcessorPath";
|
||||
System.err.println("test: " + test);
|
||||
|
||||
String source =
|
||||
"import java.io.*;\n"
|
||||
@ -407,10 +422,12 @@ public class TestSearchPaths {
|
||||
checkFile(CLASS_OUTPUT, "G" + i + ".class");
|
||||
}
|
||||
tested.add(SOURCE_OUTPUT);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
void testNativeHeaderOutput() throws IOException {
|
||||
String test = "testNativeHeaderOutput";
|
||||
System.err.println("test: " + test);
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
File classes = createDir(test + "/" + i + "/classes");
|
||||
@ -433,6 +450,7 @@ public class TestSearchPaths {
|
||||
}
|
||||
|
||||
tested.add(StandardLocation.NATIVE_HEADER_OUTPUT);
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
List<String> getOptions(String... args) {
|
||||
|
@ -282,7 +282,8 @@ public class CheckResourceKeys {
|
||||
// file names
|
||||
"ct.sym",
|
||||
"rt.jar",
|
||||
"tools.jar",
|
||||
"jfxrt.jar",
|
||||
"bootmodules.jimage",
|
||||
// -XD option names
|
||||
"process.packages",
|
||||
"ignore.symbol.file",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,7 +37,6 @@ public class CompileFail {
|
||||
|
||||
List<String> javacArgs = new ArrayList<>();
|
||||
javacArgs.addAll(Arrays.asList(
|
||||
"-bootclasspath", System.getProperty("sun.boot.class.path"),
|
||||
"-d", "."
|
||||
));
|
||||
|
||||
|
@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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 6906175 6915476 6915497 7006564
|
||||
* @summary Path-based JavaFileManager
|
||||
* @compile -g CompileTest.java HelloPathWorld.java
|
||||
* @run main CompileTest
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import java.util.jar.*;
|
||||
import javax.tools.*;
|
||||
|
||||
import com.sun.tools.javac.nio.*;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import java.nio.file.spi.FileSystemProvider;
|
||||
|
||||
|
||||
public class CompileTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
new CompileTest().run();
|
||||
}
|
||||
|
||||
public void run() throws Exception {
|
||||
File rtDir = new File("rt.dir");
|
||||
File javaHome = new File(System.getProperty("java.home"));
|
||||
if (javaHome.getName().equals("jre"))
|
||||
javaHome = javaHome.getParentFile();
|
||||
File rtJar = new File(new File(new File(javaHome, "jre"), "lib"), "rt.jar");
|
||||
expand(rtJar, rtDir);
|
||||
|
||||
String[] rtDir_opts = {
|
||||
"-bootclasspath", rtDir.toString(),
|
||||
"-classpath", "",
|
||||
"-sourcepath", "",
|
||||
"-extdirs", ""
|
||||
};
|
||||
test(rtDir_opts, "HelloPathWorld");
|
||||
|
||||
if (isJarFileSystemAvailable()) {
|
||||
String[] rtJar_opts = {
|
||||
"-bootclasspath", rtJar.toString(),
|
||||
"-classpath", "",
|
||||
"-sourcepath", "",
|
||||
"-extdirs", ""
|
||||
};
|
||||
test(rtJar_opts, "HelloPathWorld");
|
||||
|
||||
String[] default_opts = { };
|
||||
test(default_opts, "HelloPathWorld");
|
||||
|
||||
// finally, a non-trivial program
|
||||
test(default_opts, "CompileTest");
|
||||
} else
|
||||
System.err.println("jar file system not available: test skipped");
|
||||
}
|
||||
|
||||
void test(String[] opts, String className) throws Exception {
|
||||
count++;
|
||||
System.err.println("Test " + count + " " + Arrays.asList(opts) + " " + className);
|
||||
Path testSrcDir = Paths.get(System.getProperty("test.src"));
|
||||
Path testClassesDir = Paths.get(System.getProperty("test.classes"));
|
||||
Path classes = Files.createDirectory(Paths.get("classes." + count));
|
||||
|
||||
Context ctx = new Context();
|
||||
PathFileManager fm = new JavacPathFileManager(ctx, true, null);
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
List<String> options = new ArrayList<String>();
|
||||
options.addAll(Arrays.asList(opts));
|
||||
options.addAll(Arrays.asList(
|
||||
"-verbose", "-XDverboseCompilePolicy",
|
||||
"-d", classes.toString(),
|
||||
"-g"
|
||||
));
|
||||
Iterable<? extends JavaFileObject> compilationUnits =
|
||||
fm.getJavaFileObjects(testSrcDir.resolve(className + ".java"));
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter out = new PrintWriter(sw);
|
||||
JavaCompiler.CompilationTask t =
|
||||
compiler.getTask(out, fm, null, options, null, compilationUnits);
|
||||
boolean ok = t.call();
|
||||
System.err.println(sw.toString());
|
||||
if (!ok) {
|
||||
throw new Exception("compilation failed");
|
||||
}
|
||||
|
||||
File expect = new File("classes." + count + "/" + className + ".class");
|
||||
if (!expect.exists())
|
||||
throw new Exception("expected file not found: " + expect);
|
||||
// Note that we explicitly specify -g for compiling both the actual class and the expected class.
|
||||
// This isolates the expected class from javac options that might be given to jtreg.
|
||||
long expectedSize = new File(testClassesDir.toString(), className + ".class").length();
|
||||
long actualSize = expect.length();
|
||||
if (expectedSize != actualSize)
|
||||
throw new Exception("wrong size found: " + actualSize + "; expected: " + expectedSize);
|
||||
}
|
||||
|
||||
boolean isJarFileSystemAvailable() {
|
||||
boolean result = false;
|
||||
for (FileSystemProvider fsp: FileSystemProvider.installedProviders()) {
|
||||
String scheme = fsp.getScheme();
|
||||
System.err.println("Provider: " + scheme + " " + fsp);
|
||||
if (scheme.equalsIgnoreCase("jar") || scheme.equalsIgnoreCase("zip"))
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void expand(File jar, File dir) throws IOException {
|
||||
JarFile jarFile = new JarFile(jar);
|
||||
try {
|
||||
Enumeration<JarEntry> entries = jarFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry je = entries.nextElement();
|
||||
if (!je.isDirectory()) {
|
||||
copy(jarFile.getInputStream(je), new File(dir, je.getName()));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
jarFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
void copy(InputStream in, File dest) throws IOException {
|
||||
dest.getParentFile().mkdirs();
|
||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
|
||||
try {
|
||||
byte[] data = new byte[8192];
|
||||
int n;
|
||||
while ((n = in.read(data, 0, data.length)) > 0)
|
||||
out.write(data, 0, n);
|
||||
} finally {
|
||||
out.close();
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
void error(String message) {
|
||||
System.err.println("Error: " + message);
|
||||
errors++;
|
||||
}
|
||||
|
||||
int errors;
|
||||
int count;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class HelloPathWorld {
|
||||
public static void main(String... args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
@ -59,10 +59,6 @@ public class Main {
|
||||
static Elements elements;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (haveAltRt()) {
|
||||
System.out.println("Warning: alt-rt.jar detected, test skipped");
|
||||
return;
|
||||
}
|
||||
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||
fm.setLocation(CLASS_PATH, Collections.<File>emptyList());
|
||||
@ -126,23 +122,4 @@ public class Main {
|
||||
throw new AssertionError("Too few nested classes in PLATFORM_CLASS_PATH ;-)");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If -XX:+AggressiveOpts has been used to test, the option currently
|
||||
* instructs the VM to prepend alt-rt.jar onto the bootclasspath. This
|
||||
* overrides the default TreeMap implemation in rt.jar causing symbol
|
||||
* resolution problems (caused by inconsistent inner class), although
|
||||
* alt-rt.jar is being eliminated, we have this sanity check to detect this
|
||||
* case and skip the test.
|
||||
*/
|
||||
static boolean haveAltRt() {
|
||||
String bootClassPath = System.getProperty("sun.boot.class.path");
|
||||
for (String cp : bootClassPath.split(File.pathSeparator)) {
|
||||
if (cp.endsWith("alt-rt.jar")) {
|
||||
System.err.println("Warning: detected alt-rt.jar in "
|
||||
+ "sun.boot.class.path");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,6 @@ public class TestWithXstdout {
|
||||
|
||||
static void run_javac(String... args) throws IOException, InterruptedException {
|
||||
File javaHome = new File(System.getProperty("java.home"));
|
||||
if (javaHome.getName().equals("jre"))
|
||||
javaHome = javaHome.getParentFile();
|
||||
File javac = new File(new File(javaHome, "bin"), "javac");
|
||||
|
||||
List<String> opts = new ArrayList<>();
|
||||
|
@ -105,14 +105,18 @@ public class ProfileOptionTest {
|
||||
JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
|
||||
for (Target t: Target.values()) {
|
||||
switch (t) {
|
||||
case JDK1_1: case JDK1_2: // no equivalent -source
|
||||
case JDK1_1:
|
||||
case JDK1_2:
|
||||
case JDK1_3:
|
||||
case JDK1_4:
|
||||
case JDK1_5: // not supported
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Profile p: Profile.values()) {
|
||||
List<String> opts = new ArrayList<>();
|
||||
opts.addAll(Arrays.asList("-source", t.name, "-target", t.name));
|
||||
opts.add("-Xlint:-options"); // dont warn about no -bootclasspath
|
||||
opts.add("-Xlint:-options"); // don't warn about no -bootclasspath
|
||||
if (p != Profile.DEFAULT)
|
||||
opts.addAll(Arrays.asList("-profile", p.name));
|
||||
|
||||
|
@ -76,14 +76,6 @@ public class T6942366 {
|
||||
args.add(".");
|
||||
}
|
||||
|
||||
// use a very simple bootclasspath to avoid stuff jtreg might have put on path
|
||||
File javaHome = new File(System.getProperty("java.home"));
|
||||
File rt_jar = new File(javaHome, "lib/rt.jar");
|
||||
if (!rt_jar.exists())
|
||||
throw new Exception("rt.jar not found");
|
||||
args.add("-bootclasspath");
|
||||
args.add(rt_jar.getPath());
|
||||
|
||||
args.add(new File(testSrc, "Test.java").getPath());
|
||||
System.out.println("javadoc: " + args);
|
||||
|
||||
|
@ -47,8 +47,6 @@ public class TestUserDoclet extends Doclet {
|
||||
/** Main test method. */
|
||||
void run() throws Exception {
|
||||
File javaHome = new File(System.getProperty("java.home"));
|
||||
if (javaHome.getName().equals("jre"))
|
||||
javaHome = javaHome.getParentFile();
|
||||
File javadoc = new File(new File(javaHome, "bin"), "javadoc");
|
||||
File testSrc = new File(System.getProperty("test.src"));
|
||||
File testClasses = new File(System.getProperty("test.classes"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,7 @@
|
||||
* @run main GetTask_FileManagerTest
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
@ -36,10 +37,14 @@ import java.util.Set;
|
||||
|
||||
import javax.tools.DocumentationTool;
|
||||
import javax.tools.DocumentationTool.DocumentationTask;
|
||||
import javax.tools.FileObject;
|
||||
import javax.tools.ForwardingJavaFileManager;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.JavaFileObject.Kind;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
import javax.tools.ToolProvider;
|
||||
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.nio.JavacPathFileManager;
|
||||
import com.sun.tools.javac.nio.PathFileManager;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
@ -60,11 +65,11 @@ public class GetTask_FileManagerTest extends APITest {
|
||||
public void testFileManager() throws Exception {
|
||||
JavaFileObject srcFile = createSimpleJavaFileObject();
|
||||
DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
|
||||
PathFileManager fm = new JavacPathFileManager(new Context(), false, null);
|
||||
Path outDir = getOutDir().toPath();
|
||||
StandardJavaFileManager fm = new TestFileManager();
|
||||
File outDir = getOutDir();
|
||||
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
|
||||
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
|
||||
DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
|
||||
DocumentationTask t = tool.getTask(null, fm, null, null, Arrays.asList("-verbose"), files);
|
||||
if (t.call()) {
|
||||
System.err.println("task succeeded");
|
||||
checkFiles(outDir, standardExpectFiles);
|
||||
@ -80,7 +85,7 @@ public class GetTask_FileManagerTest extends APITest {
|
||||
public void testBadFileManager() throws Exception {
|
||||
JavaFileObject srcFile = createSimpleJavaFileObject();
|
||||
DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
|
||||
PathFileManager fm = new JavacPathFileManager(new Context(), false, null) {
|
||||
StandardJavaFileManager fm = new TestFileManager() {
|
||||
@Override
|
||||
public Iterable<JavaFileObject> list(Location location,
|
||||
String packageName,
|
||||
@ -90,8 +95,7 @@ public class GetTask_FileManagerTest extends APITest {
|
||||
throw new UnexpectedError();
|
||||
}
|
||||
};
|
||||
Path outDir = getOutDir().toPath();
|
||||
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
|
||||
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(getOutDir()));
|
||||
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
|
||||
DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
|
||||
try {
|
||||
@ -108,4 +112,45 @@ public class GetTask_FileManagerTest extends APITest {
|
||||
|
||||
public static class UnexpectedError extends Error { }
|
||||
|
||||
/*
|
||||
* A JavaFileManager which is not a JavacFileManager, even though it uses one internally for
|
||||
* convenience.
|
||||
*/
|
||||
static class TestFileManager extends ForwardingJavaFileManager<StandardJavaFileManager>
|
||||
implements StandardJavaFileManager {
|
||||
TestFileManager() {
|
||||
super(new JavacFileManager(new Context(), false, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
|
||||
return fileManager.getJavaFileObjectsFromFiles(files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
|
||||
return fileManager.getJavaFileObjects(files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
|
||||
return fileManager.getJavaFileObjectsFromStrings(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
|
||||
return fileManager.getJavaFileObjects(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocation(Location location, Iterable<? extends File> path) throws IOException {
|
||||
fileManager.setLocation(location, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends File> getLocation(Location location) {
|
||||
return fileManager.getLocation(location);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,14 +73,8 @@ public class T5070898
|
||||
int runJavah() throws Exception {
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
File java_home = new File(System.getProperty("java.home"));
|
||||
if (java_home.getName().equals("jre"))
|
||||
java_home = java_home.getParentFile();
|
||||
cmd.add(new File(new File(java_home, "bin"), "javah").getPath());
|
||||
|
||||
// ensure we run with the same bootclasspath as this test,
|
||||
// in case this test is being run with -Xbootclasspath
|
||||
cmd.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
|
||||
|
||||
cmd.add("JavahTest");
|
||||
|
||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -58,12 +58,8 @@ public class T6893943 {
|
||||
void testCommand(String[] args, int expect_rc) throws Exception {
|
||||
System.err.println("Test command: " + Arrays.asList(args));
|
||||
File javaHome = new File(System.getProperty("java.home"));
|
||||
if (javaHome.getName().equals("jre"))
|
||||
javaHome = javaHome.getParentFile();
|
||||
|
||||
List<String> command = new ArrayList<String>();
|
||||
command.add(new File(new File(javaHome, "bin"), "javah").getPath());
|
||||
command.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
|
||||
command.addAll(Arrays.asList(args));
|
||||
//System.err.println("command: " + command);
|
||||
|
||||
|
@ -1,265 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import com.sun.tools.classfile.AccessFlags;
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPoolException;
|
||||
import com.sun.tools.classfile.Method;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class CompareTest {
|
||||
String[][] testCases = {
|
||||
{ },
|
||||
{ "-jni" },
|
||||
// { "-llni" },
|
||||
};
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
new CompareTest().run(args);
|
||||
}
|
||||
|
||||
public void run(String... args) throws Exception {
|
||||
old_javah_cmd = new File(args[0]);
|
||||
rt_jar = new File(args[1]);
|
||||
|
||||
Set<String> testClasses;
|
||||
if (args.length > 2) {
|
||||
testClasses = new LinkedHashSet<String>(Arrays.asList(Arrays.copyOfRange(args, 2, args.length)));
|
||||
} else
|
||||
testClasses = getNativeClasses(new JarFile(rt_jar));
|
||||
|
||||
for (String[] options: testCases) {
|
||||
for (String name: testClasses) {
|
||||
test(Arrays.asList(options), rt_jar, name);
|
||||
}
|
||||
}
|
||||
|
||||
if (errors == 0)
|
||||
System.out.println(count + " tests passed");
|
||||
else
|
||||
throw new Exception(errors + "/" + count + " tests failed");
|
||||
}
|
||||
|
||||
public void test(List<String> options, File bootclasspath, String className)
|
||||
throws IOException, InterruptedException {
|
||||
System.err.println("test: " + options + " " + className);
|
||||
count++;
|
||||
|
||||
testOptions = options;
|
||||
testClassName = className;
|
||||
|
||||
File oldOutDir = initDir(file(new File("old"), className));
|
||||
int old_rc = old_javah(options, oldOutDir, bootclasspath, className);
|
||||
|
||||
File newOutDir = initDir(file(new File("new"), className));
|
||||
int new_rc = new_javah(options, newOutDir, bootclasspath, className);
|
||||
|
||||
if (old_rc != new_rc)
|
||||
error("return codes differ; old: " + old_rc + ", new: " + new_rc);
|
||||
|
||||
compare(oldOutDir, newOutDir);
|
||||
}
|
||||
|
||||
int old_javah(List<String> options, File outDir, File bootclasspath, String className)
|
||||
throws IOException, InterruptedException {
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
cmd.add(old_javah_cmd.getPath());
|
||||
cmd.addAll(options);
|
||||
cmd.add("-d");
|
||||
cmd.add(outDir.getPath());
|
||||
cmd.add("-bootclasspath");
|
||||
cmd.add(bootclasspath.getPath());
|
||||
cmd.add(className);
|
||||
System.err.println("old_javah: " + cmd);
|
||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||
pb.redirectErrorStream(true);
|
||||
Process p = pb.start();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
String line;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((line = in.readLine()) != null) {
|
||||
sb.append(line);
|
||||
sb.append("\n");
|
||||
}
|
||||
System.err.println("old javah out: " + sb.toString());
|
||||
return p.waitFor();
|
||||
}
|
||||
|
||||
int new_javah(List<String> options, File outDir, File bootclasspath, String className) {
|
||||
List<String> args = new ArrayList<String>();
|
||||
args.addAll(options);
|
||||
args.add("-d");
|
||||
args.add(outDir.getPath());
|
||||
args.add("-bootclasspath");
|
||||
args.add(bootclasspath.getPath());
|
||||
args.add(className);
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
int rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), pw);
|
||||
pw.close();
|
||||
System.err.println("new javah out: " + sw.toString());
|
||||
return rc;
|
||||
}
|
||||
|
||||
Set<String> getNativeClasses(JarFile jar) throws IOException, ConstantPoolException {
|
||||
System.err.println("getNativeClasses: " + jar.getName());
|
||||
Set<String> results = new TreeSet<String>();
|
||||
Enumeration<JarEntry> e = jar.entries();
|
||||
while (e.hasMoreElements()) {
|
||||
JarEntry je = e.nextElement();
|
||||
if (isNativeClass(jar, je)) {
|
||||
String name = je.getName();
|
||||
results.add(name.substring(0, name.length() - 6).replace("/", "."));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
boolean isNativeClass(JarFile jar, JarEntry entry) throws IOException, ConstantPoolException {
|
||||
String name = entry.getName();
|
||||
if (name.startsWith("META-INF") || !name.endsWith(".class"))
|
||||
return false;
|
||||
//String className = name.substring(0, name.length() - 6).replace("/", ".");
|
||||
//System.err.println("check " + className);
|
||||
InputStream in = jar.getInputStream(entry);
|
||||
ClassFile cf = ClassFile.read(in);
|
||||
for (int i = 0; i < cf.methods.length; i++) {
|
||||
Method m = cf.methods[i];
|
||||
if (m.access_flags.is(AccessFlags.ACC_NATIVE)) {
|
||||
// System.err.println(className);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void compare(File f1, File f2) throws IOException {
|
||||
if (f1.isFile() && f2.isFile())
|
||||
compareFiles(f1, f2);
|
||||
else if (f1.isDirectory() && f2.isDirectory())
|
||||
compareDirectories(f1, f2);
|
||||
else
|
||||
error("files differ: "
|
||||
+ f1 + " (" + getFileType(f1) + "), "
|
||||
+ f2 + " (" + getFileType(f2) + ")");
|
||||
}
|
||||
|
||||
void compareDirectories(File d1, File d2) throws IOException {
|
||||
Set<String> list = new TreeSet<String>();
|
||||
list.addAll(Arrays.asList(d1.list()));
|
||||
list.addAll(Arrays.asList(d2.list()));
|
||||
for (String c: list)
|
||||
compare(new File(d1, c), new File(d2, c));
|
||||
}
|
||||
|
||||
void compareFiles(File f1, File f2) throws IOException {
|
||||
byte[] c1 = readFile(f1);
|
||||
byte[] c2 = readFile(f2);
|
||||
if (!Arrays.equals(c1, c2))
|
||||
error("files differ: " + f1 + ", " + f2);
|
||||
}
|
||||
|
||||
byte[] readFile(File file) throws IOException {
|
||||
int size = (int) file.length();
|
||||
byte[] data = new byte[size];
|
||||
DataInputStream in = new DataInputStream(new FileInputStream(file));
|
||||
try {
|
||||
in.readFully(data);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
String getFileType(File f) {
|
||||
return f.isDirectory() ? "directory"
|
||||
: f.isFile() ? "file"
|
||||
: f.exists() ? "other"
|
||||
: "not found";
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up an empty directory.
|
||||
*/
|
||||
public File initDir(File dir) {
|
||||
if (dir.exists())
|
||||
deleteAll(dir);
|
||||
dir.mkdirs();
|
||||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file or a directory (including all its contents).
|
||||
*/
|
||||
boolean deleteAll(File file) {
|
||||
if (file.isDirectory()) {
|
||||
for (File f: file.listFiles())
|
||||
deleteAll(f);
|
||||
}
|
||||
return file.delete();
|
||||
}
|
||||
|
||||
File file(File dir, String... path) {
|
||||
File f = dir;
|
||||
for (String p: path)
|
||||
f = new File(f, p);
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an error.
|
||||
*/
|
||||
void error(String msg, String... more) {
|
||||
System.err.println("test: " + testOptions + " " + testClassName);
|
||||
System.err.println("error: " + msg);
|
||||
for (String s: more)
|
||||
System.err.println(s);
|
||||
errors++;
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
File old_javah_cmd;
|
||||
File rt_jar;
|
||||
List<String> testOptions;
|
||||
String testClassName;
|
||||
int count;
|
||||
int errors;
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import com.sun.tools.classfile.AccessFlags;
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPoolException;
|
||||
import com.sun.tools.classfile.Method;
|
||||
import java.util.Comparator;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class FindNativeFiles {
|
||||
public static void main(String[] args) throws IOException, ConstantPoolException {
|
||||
new FindNativeFiles().run(args);
|
||||
}
|
||||
|
||||
public void run(String[] args) throws IOException, ConstantPoolException {
|
||||
JarFile jar = new JarFile(args[0]);
|
||||
Set<JarEntry> entries = getNativeClasses(jar);
|
||||
for (JarEntry e: entries) {
|
||||
String name = e.getName();
|
||||
String className = name.substring(0, name.length() - 6).replace("/", ".");
|
||||
System.out.println(className);
|
||||
}
|
||||
}
|
||||
|
||||
Set<JarEntry> getNativeClasses(JarFile jar) throws IOException, ConstantPoolException {
|
||||
Set<JarEntry> results = new TreeSet<JarEntry>(new Comparator<JarEntry>() {
|
||||
public int compare(JarEntry o1, JarEntry o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
});
|
||||
Enumeration<JarEntry> e = jar.entries();
|
||||
while (e.hasMoreElements()) {
|
||||
JarEntry je = e.nextElement();
|
||||
if (isNativeClass(jar, je))
|
||||
results.add(je);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
boolean isNativeClass(JarFile jar, JarEntry entry) throws IOException, ConstantPoolException {
|
||||
String name = entry.getName();
|
||||
if (name.startsWith("META-INF") || !name.endsWith(".class"))
|
||||
return false;
|
||||
//String className = name.substring(0, name.length() - 6).replace("/", ".");
|
||||
//System.err.println("check " + className);
|
||||
InputStream in = jar.getInputStream(entry);
|
||||
ClassFile cf = ClassFile.read(in);
|
||||
in.close();
|
||||
for (int i = 0; i < cf.methods.length; i++) {
|
||||
Method m = cf.methods[i];
|
||||
if (m.access_flags.is(AccessFlags.ACC_NATIVE)) {
|
||||
// System.err.println(className);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
test/tools/javah/compareTest/README
|
||||
|
||||
This directory contains a program for comparing the output of new javah against the
|
||||
output of JDK 6 or other older versions of javah.
|
||||
|
||||
It cannot be run automatically because of the need for the older version of javah
|
||||
to compare against.
|
||||
|
||||
The test works by scanning a jar file, such as rt.jar, looking for all files with
|
||||
native methods. It then runs both the old and new versions of javah on those
|
||||
classes with native methods, and verifies that the results are character-for-character
|
||||
identical.
|
||||
|
||||
To run the test, build langtools, then execute the script in the root langtools
|
||||
directory, providing the location of the JDK to be tested. The default is
|
||||
/opt/jdk/1.6.0.
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,19 +26,23 @@
|
||||
* @test
|
||||
* @bug 6729471
|
||||
* @summary javap does not output inner interfaces of an interface
|
||||
* @library /tools/lib
|
||||
* @build ToolBox
|
||||
* @run main T6729471
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import javax.tools.*;
|
||||
|
||||
public class T6729471
|
||||
{
|
||||
public static void main(String... args) {
|
||||
public static void main(String... args) throws IOException {
|
||||
new T6729471().run();
|
||||
}
|
||||
|
||||
void run() {
|
||||
void run() throws IOException {
|
||||
File testClasses = new File(System.getProperty("test.classes"));
|
||||
|
||||
// simple class
|
||||
@ -57,34 +61,31 @@ public class T6729471
|
||||
verify(new File(testClasses, "T6729471.class").toURI().toString(),
|
||||
"public static void main(java.lang.String...)");
|
||||
|
||||
// jar url: rt.jar
|
||||
File java_home = new File(System.getProperty("java.home"));
|
||||
if (java_home.getName().equals("jre"))
|
||||
java_home = java_home.getParentFile();
|
||||
File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
|
||||
// jar url
|
||||
File testJar = createJar("test.jar", "java.util.*");
|
||||
try {
|
||||
verify("jar:" + rt_jar.toURL() + "!/java/util/Map.class",
|
||||
verify("jar:" + testJar.toURL() + "!/java/util/Map.class",
|
||||
"public abstract boolean containsKey(java.lang.Object)");
|
||||
} catch (MalformedURLException e) {
|
||||
error(e.toString());
|
||||
}
|
||||
|
||||
// jar url: ct.sym, if it exists
|
||||
File ct_sym = new File(new File(java_home, "lib"), "ct.sym");
|
||||
if (ct_sym.exists()) {
|
||||
try {
|
||||
verify("jar:" + ct_sym.toURL() + "!/META-INF/sym/rt.jar/java/util/Map.class",
|
||||
"public abstract boolean containsKey(java.lang.Object)");
|
||||
} catch (MalformedURLException e) {
|
||||
error(e.toString());
|
||||
}
|
||||
} else
|
||||
System.err.println("warning: ct.sym not found");
|
||||
|
||||
if (errors > 0)
|
||||
throw new Error(errors + " found.");
|
||||
}
|
||||
|
||||
File createJar(String name, String... paths) throws IOException {
|
||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||
try (JavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||
File f = new File(name);
|
||||
ToolBox tb = new ToolBox();
|
||||
tb.new JarTask(f.getPath())
|
||||
.files(fm, StandardLocation.PLATFORM_CLASS_PATH, paths)
|
||||
.run();
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
void verify(String className, String... expects) {
|
||||
String output = javap(className);
|
||||
for (String expect: expects) {
|
||||
|
@ -57,8 +57,11 @@ public class WhitespaceTest {
|
||||
if (line.endsWith(" "))
|
||||
error("line has trailing whitespace: " + line);
|
||||
int comment = line.indexOf(doubleSlash);
|
||||
if (comment > 0 && line.charAt(comment - 1) != ' ')
|
||||
error("no space before comment: " + line);
|
||||
if (comment > 0 && line.charAt(comment - 1) != ' ') {
|
||||
// make allowance for URLs
|
||||
if (!line.matches(".*\\bfile:/{3}.*"))
|
||||
error("no space before comment: " + line);
|
||||
}
|
||||
if (line.matches(" +}"))
|
||||
error("bad indentation: " + line);
|
||||
}
|
||||
|
@ -39,27 +39,6 @@ import java.util.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class APIDeps {
|
||||
private static boolean symbolFileExist = initProfiles();
|
||||
private static boolean initProfiles() {
|
||||
// check if ct.sym exists; if not use the profiles.properties file
|
||||
Path home = Paths.get(System.getProperty("java.home"));
|
||||
if (home.endsWith("jre")) {
|
||||
home = home.getParent();
|
||||
}
|
||||
Path ctsym = home.resolve("lib").resolve("ct.sym");
|
||||
boolean symbolExists = ctsym.toFile().exists();
|
||||
if (!symbolExists) {
|
||||
Path testSrcProfiles =
|
||||
Paths.get(System.getProperty("test.src", "."), "profiles.properties");
|
||||
if (!testSrcProfiles.toFile().exists())
|
||||
throw new Error(testSrcProfiles + " does not exist");
|
||||
System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
|
||||
ctsym, testSrcProfiles);
|
||||
System.setProperty("jdeps.profiles", testSrcProfiles.toString());
|
||||
}
|
||||
return symbolExists;
|
||||
}
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
int errors = 0;
|
||||
errors += new APIDeps().run();
|
||||
|
@ -41,27 +41,6 @@ import java.util.regex.*;
|
||||
import static java.nio.file.StandardCopyOption.*;
|
||||
|
||||
public class Basic {
|
||||
private static boolean symbolFileExist = initProfiles();
|
||||
private static boolean initProfiles() {
|
||||
// check if ct.sym exists; if not use the profiles.properties file
|
||||
Path home = Paths.get(System.getProperty("java.home"));
|
||||
if (home.endsWith("jre")) {
|
||||
home = home.getParent();
|
||||
}
|
||||
Path ctsym = home.resolve("lib").resolve("ct.sym");
|
||||
boolean symbolExists = ctsym.toFile().exists();
|
||||
if (!symbolExists) {
|
||||
Path testSrcProfiles =
|
||||
Paths.get(System.getProperty("test.src", "."), "profiles.properties");
|
||||
if (!testSrcProfiles.toFile().exists())
|
||||
throw new Error(testSrcProfiles + " does not exist");
|
||||
System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
|
||||
ctsym, testSrcProfiles);
|
||||
System.setProperty("jdeps.profiles", testSrcProfiles.toString());
|
||||
}
|
||||
return symbolExists;
|
||||
}
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
int errors = 0;
|
||||
errors += new Basic().run();
|
||||
|
@ -41,27 +41,6 @@ import java.util.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class DotFileTest {
|
||||
private static boolean symbolFileExist = initProfiles();
|
||||
private static boolean initProfiles() {
|
||||
// check if ct.sym exists; if not use the profiles.properties file
|
||||
Path home = Paths.get(System.getProperty("java.home"));
|
||||
if (home.endsWith("jre")) {
|
||||
home = home.getParent();
|
||||
}
|
||||
Path ctsym = home.resolve("lib").resolve("ct.sym");
|
||||
boolean symbolExists = ctsym.toFile().exists();
|
||||
if (!symbolExists) {
|
||||
Path testSrcProfiles =
|
||||
Paths.get(System.getProperty("test.src", "."), "profiles.properties");
|
||||
if (!testSrcProfiles.toFile().exists())
|
||||
throw new Error(testSrcProfiles + " does not exist");
|
||||
System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
|
||||
ctsym, testSrcProfiles);
|
||||
System.setProperty("jdeps.profiles", testSrcProfiles.toString());
|
||||
}
|
||||
return symbolExists;
|
||||
}
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
int errors = 0;
|
||||
errors += new DotFileTest().run();
|
||||
|
@ -1,263 +0,0 @@
|
||||
# This properties file is used for testing a JDK development build.
|
||||
# No need to keep this properties file up to date as long as it covers
|
||||
# the APIs used by the jdeps regression test.
|
||||
profile.1.name = compact1
|
||||
profile.1.packages = \
|
||||
java.io \
|
||||
java.lang \
|
||||
java.lang.annotation \
|
||||
java.lang.invoke \
|
||||
java.lang.ref \
|
||||
java.lang.reflect \
|
||||
java.math \
|
||||
java.net \
|
||||
java.nio \
|
||||
java.nio.channels \
|
||||
java.nio.channels.spi \
|
||||
java.nio.charset \
|
||||
java.nio.charset.spi \
|
||||
java.nio.file \
|
||||
java.nio.file.attribute \
|
||||
java.nio.file.spi \
|
||||
java.security \
|
||||
java.security.cert \
|
||||
java.security.interfaces \
|
||||
java.security.spec \
|
||||
java.text \
|
||||
java.text.spi \
|
||||
java.util \
|
||||
java.util.concurrent \
|
||||
java.util.concurrent.atomic \
|
||||
java.util.concurrent.locks \
|
||||
java.util.jar \
|
||||
java.util.logging \
|
||||
java.util.regex \
|
||||
java.util.spi \
|
||||
java.util.zip \
|
||||
javax.crypto \
|
||||
javax.crypto.interfaces \
|
||||
javax.crypto.spec \
|
||||
javax.security.auth \
|
||||
javax.security.auth.callback \
|
||||
javax.security.auth.login \
|
||||
javax.security.auth.spi \
|
||||
javax.security.auth.x500 \
|
||||
javax.net \
|
||||
javax.net.ssl \
|
||||
javax.security.cert \
|
||||
\
|
||||
com.sun.net.ssl \
|
||||
com.sun.nio.file \
|
||||
com.sun.nio.sctp \
|
||||
com.sun.security.auth \
|
||||
com.sun.security.auth.login
|
||||
|
||||
profile.2.name = compact2
|
||||
profile.2.packages = \
|
||||
java.sql \
|
||||
javax.sql \
|
||||
javax.xml \
|
||||
javax.xml.datatype \
|
||||
javax.xml.namespace \
|
||||
javax.xml.parsers \
|
||||
javax.xml.stream \
|
||||
javax.xml.stream.events \
|
||||
javax.xml.stream.util \
|
||||
javax.xml.transform \
|
||||
javax.xml.transform.dom \
|
||||
javax.xml.transform.sax \
|
||||
javax.xml.transform.stax \
|
||||
javax.xml.transform.stream \
|
||||
javax.xml.validation \
|
||||
javax.xml.xpath \
|
||||
org.w3c.dom \
|
||||
org.w3c.dom.bootstrap \
|
||||
org.w3c.dom.events \
|
||||
org.w3c.dom.ls \
|
||||
org.xml.sax \
|
||||
org.xml.sax.ext \
|
||||
org.xml.sax.helpers \
|
||||
java.rmi \
|
||||
java.rmi.activation \
|
||||
java.rmi.dgc \
|
||||
java.rmi.registry \
|
||||
java.rmi.server \
|
||||
javax.rmi.ssl \
|
||||
javax.transaction \
|
||||
javax.transaction.xa \
|
||||
\
|
||||
com.sun.net.httpserver \
|
||||
com.sun.net.httpserver.spi
|
||||
|
||||
profile.3.name = compact3
|
||||
profile.3.packages = \
|
||||
java.lang.instrument \
|
||||
java.lang.management \
|
||||
java.security.acl \
|
||||
java.util.prefs \
|
||||
javax.management \
|
||||
javax.management.loading \
|
||||
javax.management.modelmbean \
|
||||
javax.management.monitor \
|
||||
javax.management.openmbean \
|
||||
javax.management.relation \
|
||||
javax.management.remote \
|
||||
javax.management.remote.rmi \
|
||||
javax.management.timer \
|
||||
javax.naming \
|
||||
javax.naming.directory \
|
||||
javax.naming.event \
|
||||
javax.naming.ldap \
|
||||
javax.naming.spi \
|
||||
javax.sql.rowset \
|
||||
javax.sql.rowset.serial \
|
||||
javax.sql.rowset.spi \
|
||||
javax.security.auth.kerberos \
|
||||
javax.security.sasl \
|
||||
javax.script \
|
||||
javax.smartcardio \
|
||||
javax.xml.crypto \
|
||||
javax.xml.crypto.dom \
|
||||
javax.xml.crypto.dsig \
|
||||
javax.xml.crypto.dsig.dom \
|
||||
javax.xml.crypto.dsig.keyinfo \
|
||||
javax.xml.crypto.dsig.spec \
|
||||
javax.annotation.processing \
|
||||
javax.lang.model \
|
||||
javax.lang.model.element \
|
||||
javax.lang.model.type \
|
||||
javax.lang.model.util \
|
||||
javax.tools \
|
||||
javax.tools.annotation \
|
||||
org.ietf.jgss \
|
||||
\
|
||||
com.sun.management \
|
||||
com.sun.security.auth.callback \
|
||||
com.sun.security.auth.module \
|
||||
com.sun.security.jgss
|
||||
|
||||
profile.4.name = Full JRE
|
||||
profile.4.packages = \
|
||||
java.applet \
|
||||
java.awt \
|
||||
java.awt.color \
|
||||
java.awt.datatransfer \
|
||||
java.awt.dnd \
|
||||
java.awt.dnd.peer \
|
||||
java.awt.event \
|
||||
java.awt.font \
|
||||
java.awt.geom \
|
||||
java.awt.im \
|
||||
java.awt.im.spi \
|
||||
java.awt.image \
|
||||
java.awt.image.renderable \
|
||||
java.awt.peer \
|
||||
java.awt.print \
|
||||
java.beans \
|
||||
java.beans.beancontext \
|
||||
javax.accessibility \
|
||||
javax.imageio \
|
||||
javax.imageio.event \
|
||||
javax.imageio.metadata \
|
||||
javax.imageio.plugins.bmp \
|
||||
javax.imageio.plugins.jpeg \
|
||||
javax.imageio.spi \
|
||||
javax.imageio.stream \
|
||||
javax.print \
|
||||
javax.print.attribute \
|
||||
javax.print.attribute.standard \
|
||||
javax.print.event \
|
||||
javax.sound.midi \
|
||||
javax.sound.midi.spi \
|
||||
javax.sound.sampled \
|
||||
javax.sound.sampled.spi \
|
||||
javax.swing \
|
||||
javax.swing.border \
|
||||
javax.swing.colorchooser \
|
||||
javax.swing.event \
|
||||
javax.swing.filechooser \
|
||||
javax.swing.plaf \
|
||||
javax.swing.plaf.basic \
|
||||
javax.swing.plaf.metal \
|
||||
javax.swing.plaf.multi \
|
||||
javax.swing.plaf.nimbus \
|
||||
javax.swing.plaf.synth \
|
||||
javax.swing.table \
|
||||
javax.swing.text \
|
||||
javax.swing.text.html \
|
||||
javax.swing.text.html.parser \
|
||||
javax.swing.text.rtf \
|
||||
javax.swing.tree \
|
||||
javax.swing.undo \
|
||||
javax.activation \
|
||||
javax.jws \
|
||||
javax.jws.soap \
|
||||
javax.rmi \
|
||||
javax.rmi.CORBA \
|
||||
javax.xml.bind \
|
||||
javax.xml.bind.annotation \
|
||||
javax.xml.bind.annotation.adapters \
|
||||
javax.xml.bind.attachment \
|
||||
javax.xml.bind.helpers \
|
||||
javax.xml.bind.util \
|
||||
javax.xml.soap \
|
||||
javax.xml.ws \
|
||||
javax.xml.ws.handler \
|
||||
javax.xml.ws.handler.soap \
|
||||
javax.xml.ws.http \
|
||||
javax.xml.ws.soap \
|
||||
javax.xml.ws.spi \
|
||||
javax.xml.ws.spi.http \
|
||||
javax.xml.ws.wsaddressing \
|
||||
javax.annotation \
|
||||
org.omg.CORBA \
|
||||
org.omg.CORBA.DynAnyPackage \
|
||||
org.omg.CORBA.ORBPackage \
|
||||
org.omg.CORBA.TypeCodePackage \
|
||||
org.omg.CORBA.portable \
|
||||
org.omg.CORBA_2_3 \
|
||||
org.omg.CORBA_2_3.portable \
|
||||
org.omg.CosNaming \
|
||||
org.omg.CosNaming.NamingContextExtPackage \
|
||||
org.omg.CosNaming.NamingContextPackage \
|
||||
org.omg.Dynamic \
|
||||
org.omg.DynamicAny \
|
||||
org.omg.DynamicAny.DynAnyFactoryPackage \
|
||||
org.omg.DynamicAny.DynAnyPackage \
|
||||
org.omg.IOP \
|
||||
org.omg.IOP.CodecFactoryPackage \
|
||||
org.omg.IOP.CodecPackage \
|
||||
org.omg.Messaging \
|
||||
org.omg.PortableInterceptor \
|
||||
org.omg.PortableInterceptor.ORBInitInfoPackage \
|
||||
org.omg.PortableServer \
|
||||
org.omg.PortableServer.CurrentPackage \
|
||||
org.omg.PortableServer.POAManagerPackage \
|
||||
org.omg.PortableServer.POAPackage \
|
||||
org.omg.PortableServer.ServantLocatorPackage \
|
||||
org.omg.PortableServer.portable \
|
||||
org.omg.SendingContext \
|
||||
org.omg.stub.java.rmi \
|
||||
org.omg.stub.javax.management.remote.rmi
|
||||
|
||||
# Remaining JDK supported API
|
||||
profile.5.name = JDK tools
|
||||
profile.5.packages = \
|
||||
com.sun.jdi \
|
||||
com.sun.jdi.connect \
|
||||
com.sun.jdi.connect.spi \
|
||||
com.sun.jdi.event \
|
||||
com.sun.jdi.request \
|
||||
com.sun.javadoc \
|
||||
com.sun.tools.doclets \
|
||||
com.sun.tools.doctree \
|
||||
com.sun.source.tree \
|
||||
com.sun.source.util \
|
||||
com.sun.tools.attach \
|
||||
com.sun.tools.attach.spi \
|
||||
com.sun.tools.jconsole \
|
||||
com.sun.tools.javac \
|
||||
com.sun.tools.javah \
|
||||
com.sun.tools.javap \
|
||||
com.sun.tools.javadoc \
|
||||
com.sun.servicetag
|
@ -1546,31 +1546,31 @@ public class ToolBox {
|
||||
}
|
||||
|
||||
private void writeFiles(JarOutputStream jos) throws IOException {
|
||||
Path base = (baseDir == null) ? currDir : baseDir;
|
||||
for (Path path : paths) {
|
||||
Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
try {
|
||||
Path base = (baseDir == null) ? currDir : baseDir;
|
||||
for (Path path : paths) {
|
||||
Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
try {
|
||||
String p = base.relativize(file)
|
||||
.normalize()
|
||||
.toString()
|
||||
.replace(File.separatorChar, '/');
|
||||
JarEntry e = new JarEntry(p);
|
||||
jos.putNextEntry(e);
|
||||
jos.putNextEntry(e);
|
||||
try {
|
||||
jos.write(Files.readAllBytes(file));
|
||||
} finally {
|
||||
jos.closeEntry();
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
} catch (IOException e) {
|
||||
return FileVisitResult.CONTINUE;
|
||||
} catch (IOException e) {
|
||||
error("Exception while adding " + file + " to jar file", e);
|
||||
return FileVisitResult.TERMINATE;
|
||||
return FileVisitResult.TERMINATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void writeFileObjects(JarOutputStream jos) throws IOException {
|
||||
@ -1587,9 +1587,9 @@ public class ToolBox {
|
||||
} catch (IOException ex) {
|
||||
error("Exception while adding " + fo.getName() + " to jar file", ex);
|
||||
}
|
||||
} finally {
|
||||
} finally {
|
||||
jos.closeEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1599,17 +1599,30 @@ public class ToolBox {
|
||||
*/
|
||||
private final Pattern jarEntry = Pattern.compile(".*!/(?:META-INF/sym/[^/]+/)?(.*)");
|
||||
|
||||
/*
|
||||
* A jrt: URL is of the form jrt:/module/package/file
|
||||
*/
|
||||
private final Pattern jrtEntry = Pattern.compile("/([^/]+)/(.*)");
|
||||
|
||||
private String guessPath(FileObject fo) {
|
||||
URI u = fo.toUri();
|
||||
switch (u.getScheme()) {
|
||||
case "jar":
|
||||
case "jar": {
|
||||
Matcher m = jarEntry.matcher(u.getSchemeSpecificPart());
|
||||
if (m.matches()) {
|
||||
return m.group(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "jrt": {
|
||||
Matcher m = jrtEntry.matcher(u.getSchemeSpecificPart());
|
||||
if (m.matches()) {
|
||||
return m.group(2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException(fo.getName());
|
||||
throw new IllegalArgumentException(fo.getName() + "--" + fo.toUri());
|
||||
}
|
||||
|
||||
private void error(String message, Throwable t) {
|
||||
|
@ -35,6 +35,7 @@
|
||||
import static util.OptionTestUtil.assertEquals;
|
||||
import static util.OptionTestUtil.checkFilesFound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -218,20 +219,20 @@ public class OptionDecoding {
|
||||
|
||||
// Test input paths
|
||||
static void testSearchPaths() {
|
||||
|
||||
List<String> i, x, iF, xF;
|
||||
i = x = iF = xF = new ArrayList<>();
|
||||
|
||||
SourceLocation dir1 = new SourceLocation(Paths.get("dir1"), i, x, iF, xF);
|
||||
SourceLocation dir2 = new SourceLocation(Paths.get("dir2"), i, x, iF, xF);
|
||||
String dir1_PS_dir2 = "dir1" + File.pathSeparator + "dir2";
|
||||
|
||||
Options options = Options.parseArgs("-sourcepath", "dir1:dir2");
|
||||
Options options = Options.parseArgs("-sourcepath", dir1_PS_dir2);
|
||||
assertEquals(options.getSourceSearchPaths(), Arrays.asList(dir1, dir2));
|
||||
|
||||
options = Options.parseArgs("-modulepath", "dir1:dir2");
|
||||
options = Options.parseArgs("-modulepath", dir1_PS_dir2);
|
||||
assertEquals(options.getModuleSearchPaths(), Arrays.asList(dir1, dir2));
|
||||
|
||||
options = Options.parseArgs("-classpath", "dir1:dir2");
|
||||
options = Options.parseArgs("-classpath", dir1_PS_dir2);
|
||||
assertEquals(options.getClassSearchPath(), Arrays.asList(dir1, dir2));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user