From 23ac573ae78bf64891fa9b448c6e58b9810090de Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:30:26 -0800 Subject: [PATCH 01/59] 6910834: TEST: java/io/File/Basic.java fails on Windows CYGWIN environment Reviewed-by: tbell, alanb --- jdk/test/java/io/File/Basic.java | 4 ++-- jdk/test/java/io/File/basic.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/io/File/Basic.java b/jdk/test/java/io/File/Basic.java index a57c6ccddef..cbb8259e5fe 100644 --- a/jdk/test/java/io/File/Basic.java +++ b/jdk/test/java/io/File/Basic.java @@ -75,7 +75,7 @@ public class Basic { if (!f.canRead()) fail(f, "is not readable"); if (f.canWrite() != writeable) fail(f, writeable ? "is not writeable" : "is writeable"); - int rwLen = (File.separatorChar == '/' ? 6 : 7); + int rwLen = 6; if (f.length() != length) fail(f, "has wrong length"); } @@ -89,7 +89,7 @@ public class Basic { if (nonExistantFile.exists()) fail(nonExistantFile, "exists"); show(rwFile); - testFile(rwFile, true, File.separatorChar == '/' ? 6 : 7); + testFile(rwFile, true, 6); rwFile.delete(); if (rwFile.exists()) fail(rwFile, "could not delete"); diff --git a/jdk/test/java/io/File/basic.sh b/jdk/test/java/io/File/basic.sh index fa11c66536b..cc87ac32e84 100644 --- a/jdk/test/java/io/File/basic.sh +++ b/jdk/test/java/io/File/basic.sh @@ -32,10 +32,10 @@ fi rm -rf x.Basic.* rm -f x.Basic.non -echo xyzzy > x.Basic.rw +printf "%s" "xyzzyN" > x.Basic.rw touch x.Basic.ro; chmod ugo-w x.Basic.ro mkdir x.Basic.dir -if $TESTJAVA/bin/java $* -classpath $TESTCLASSES Basic; then +if $TESTJAVA/bin/java $* -classpath "$TESTCLASSES" Basic; then [ -f x.Basic.rw ] && (echo "x.Basic.rw not deleted"; exit 1) ([ -d x.Basic.dir ] || [ \! -d x.Basic.dir2 ]) \ && (echo "x.Basic.dir not renamed"; exit 1) From 4ae2047584d07a62b0967802a7a477690e0e8479 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:33:19 -0800 Subject: [PATCH 02/59] 6910835: TESTS: 3 java/io run.sh tests fail when run on Windows XP CYGWIN Reviewed-by: tbell, alanb --- .../io/Serializable/evolution/RenamePackage/run.sh | 10 +++++----- .../java/io/Serializable/serialver/classpath/run.sh | 2 +- jdk/test/java/io/Serializable/serialver/nested/run.sh | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh b/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh index 2f194c06123..df76b738308 100644 --- a/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh +++ b/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh @@ -43,7 +43,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) PS=":" ;; -Windows* ) +Windows* | CYGWIN* ) PS=";" ;; * ) echo "Unrecognized system!" @@ -85,14 +85,14 @@ CLASSPATH=${TESTCLASSES}/share; export CLASSPATH; ${JAVAC} -d ${TESTCLASSES}/nclasses ${TESTSRC}/install/SerialDriver.java # Run Case 1. Map test.SerialDriver within stream to install.SerialDriver. -CLASSPATH=${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} test.SerialDriver -s -CLASSPATH=${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} install.SerialDriver -d rm stream.ser # Run Case 2. Map install.SerialDriver within stream to test.SerialDriver. -CLASSPATH=${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} install.SerialDriver -s -CLASSPATH=${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} test.SerialDriver -d diff --git a/jdk/test/java/io/Serializable/serialver/classpath/run.sh b/jdk/test/java/io/Serializable/serialver/classpath/run.sh index aa3251e4798..6fb127f89fa 100644 --- a/jdk/test/java/io/Serializable/serialver/classpath/run.sh +++ b/jdk/test/java/io/Serializable/serialver/classpath/run.sh @@ -49,7 +49,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) PS=":" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" ;; * ) echo "Unrecognized system!" diff --git a/jdk/test/java/io/Serializable/serialver/nested/run.sh b/jdk/test/java/io/Serializable/serialver/nested/run.sh index 57b0ca0a759..9b53f756f1e 100644 --- a/jdk/test/java/io/Serializable/serialver/nested/run.sh +++ b/jdk/test/java/io/Serializable/serialver/nested/run.sh @@ -49,7 +49,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) PS=":" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" ;; * ) echo "Unrecognized system!" From a59db62f0719549cdb6ee981b8817426a7644b20 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:36:06 -0800 Subject: [PATCH 03/59] 6911113: These tests do not work with CYGWIN: java/nio Reviewed-by: tbell, alanb --- jdk/test/java/nio/channels/Selector/lots_of_updates.sh | 2 +- .../channels/spi/AsynchronousChannelProvider/custom_provider.sh | 2 +- jdk/test/java/nio/file/Files/walk_file_tree.sh | 2 +- jdk/test/java/nio/file/Path/delete_on_close.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/nio/channels/Selector/lots_of_updates.sh b/jdk/test/java/nio/channels/Selector/lots_of_updates.sh index 5054f18cc32..7b3bf0ee0e2 100644 --- a/jdk/test/java/nio/channels/Selector/lots_of_updates.sh +++ b/jdk/test/java/nio/channels/Selector/lots_of_updates.sh @@ -30,7 +30,7 @@ OS=`uname -s` case "$OS" in - Windows_* ) + Windows_* | CYGWIN* ) echo "ulimit not on Windows" exit 0 ;; diff --git a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh b/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh index 13fb2a2fae0..5d12f532d3d 100644 --- a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh +++ b/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh @@ -38,7 +38,7 @@ fi OS=`uname -s` case "$OS" in - Windows_* ) + Windows_* | CYGWIN* ) CLASSPATH="${TESTCLASSES};${TESTSRC}" ;; * ) diff --git a/jdk/test/java/nio/file/Files/walk_file_tree.sh b/jdk/test/java/nio/file/Files/walk_file_tree.sh index 73022d31d58..897625d46ac 100644 --- a/jdk/test/java/nio/file/Files/walk_file_tree.sh +++ b/jdk/test/java/nio/file/Files/walk_file_tree.sh @@ -39,7 +39,7 @@ fi OS=`uname -s` case "$OS" in - Windows_* ) + Windows_* | CYGWIN* ) echo "This test does not run on Windows" exit 0 ;; diff --git a/jdk/test/java/nio/file/Path/delete_on_close.sh b/jdk/test/java/nio/file/Path/delete_on_close.sh index 198e99d7201..c7f3299e144 100644 --- a/jdk/test/java/nio/file/Path/delete_on_close.sh +++ b/jdk/test/java/nio/file/Path/delete_on_close.sh @@ -40,7 +40,7 @@ fi OS=`uname -s` case "$OS" in - Windows_* ) + Windows_* | CYGWIN* ) CLASSPATH="${TESTCLASSES};${TESTSRC}" ;; * ) From a1ddf1b5050a200dff7b9aa9afee9586b7170681 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:38:30 -0800 Subject: [PATCH 04/59] 6911117: These tests do not work with CYGWIN: com/sun/jdi Reviewed-by: tbell, alanb --- jdk/test/com/sun/jdi/ProcessAttachTest.sh | 29 +++++++++++++------ .../connect/spi/JdiLoadedByCustomLoader.sh | 4 +-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/jdk/test/com/sun/jdi/ProcessAttachTest.sh b/jdk/test/com/sun/jdi/ProcessAttachTest.sh index 38ce59fc240..e1ec05996f7 100644 --- a/jdk/test/com/sun/jdi/ProcessAttachTest.sh +++ b/jdk/test/com/sun/jdi/ProcessAttachTest.sh @@ -54,10 +54,14 @@ JAVA="${TESTJAVA}/bin/java" OS=`uname -s` case "$OS" in - Windows* | CYGWIN_NT*) + Windows*) PS=";" OS="Windows" ;; + CYGWIN*) + PS=";" + OS="CYGWIN" + ;; * ) PS=":" ;; @@ -67,16 +71,23 @@ startDebuggee() { OUTPUTFILE=${TESTCLASSES}/Debuggee.out ${JAVA} "$@" > ${OUTPUTFILE} & - pid="$!" + startpid="$!" + pid="${startpid}" + # CYGWIN startpid is not the native windows PID we want, get the WINPID + if [ "${OS}" = "CYGWIN" ]; then + sleep 2 + ps -l -p ${startpid} + pid=`ps -l -p ${startpid} | tail -1 | awk '{print $4;}'` + fi + # MKS creates an intermediate shell to launch ${JAVA} so - # ${pid} is not the actual pid. We have put in a small sleep + # ${startpid} is not the actual pid. We have put in a small sleep # to give the intermediate shell process time to launch the # "java" process. if [ "$OS" = "Windows" ]; then sleep 2 - realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` - pid=${realpid} + pid=`ps -o pid,ppid,comm|grep ${startpid}|grep "java"|cut -c1-6` fi echo "Waiting for Debuggee to initialize..." @@ -91,7 +102,7 @@ startDebuggee() echo "Waiting $attempts second(s) ..." done - echo "Debuggee is process $pid" + echo "Debuggee is process $pid (startpid=${startpid})" } stopDebuggee() @@ -100,7 +111,7 @@ stopDebuggee() if [ $? != 0 ] ; then echo "Error: ShutdownDebuggee failed" failures=`expr $failures + 1` - kill -9 $pid + kill -9 ${startpid} fi } @@ -123,7 +134,7 @@ startDebuggee \ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n \ -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}" -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ ProcessAttachDebugger $pid 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi @@ -141,7 +152,7 @@ startDebuggee \ -agentlib:jdwp=transport=dt_socket,server=y,suspend=y \ -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}" -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ ProcessAttachDebugger $pid 2>&1 # The debuggee is suspended and doesn't run until the debugger diff --git a/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh b/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh index 6331d562987..c9570cd0b35 100644 --- a/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh +++ b/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh @@ -51,7 +51,7 @@ case "$OS" in Linux ) PS=":" ;; - Windows* ) + Windows* | CYGWIN*) PS=";" ;; * ) @@ -71,7 +71,7 @@ SOMEOTHERDIR="${TESTCLASSES}"/someotherdir $JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/JdiLoadedByCustomLoader.java mkdir "${SOMEOTHERDIR}" -$JAVAC -d "${SOMEOTHERDIR}" -classpath ${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVAC -d "${SOMEOTHERDIR}" -classpath "${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar" \ "${TESTSRC}"/ListConnectors.java # Run the test From 67582cd0a5aab741f5164857f26acc0c463d0bcb Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:41:54 -0800 Subject: [PATCH 05/59] 6911131: Test does not work with CYGWIN: sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh Reviewed-by: tbell, alanb --- .../management/jmxremote/bootstrap/GeneratePropertyPassword.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh b/jdk/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh index b06a4073b61..283c6cde2ab 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh +++ b/jdk/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh @@ -45,7 +45,7 @@ cat < ${TMP_FILE} s^@TEST-SRC@/^${TESTCLASSES}${DFILESEP}^g EOF ;; -Windows_95 | Windows_98 | Windows_NT | Windows_ME) +Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN*) PATHSEP=";" FILESEP="\\" DFILESEP=$FILESEP$FILESEP From 5b5ca23ef0865ac951760d0ad14bcb40dd26bc6b Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:45:30 -0800 Subject: [PATCH 06/59] 6911112: Tests do not work with CYGWIN: javax/imageio/, javax/script/, and sun/misc/ Reviewed-by: tbell, alanb --- jdk/test/javax/imageio/stream/StreamCloserLeak/run_test.sh | 2 +- jdk/test/javax/script/CommonSetup.sh | 6 ++++++ jdk/test/javax/script/ProviderTest.sh | 2 +- jdk/test/sun/misc/URLClassPath/ClassnameCharTest.sh | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/jdk/test/javax/imageio/stream/StreamCloserLeak/run_test.sh b/jdk/test/javax/imageio/stream/StreamCloserLeak/run_test.sh index af3e428cb30..f60cfd5d52a 100644 --- a/jdk/test/javax/imageio/stream/StreamCloserLeak/run_test.sh +++ b/jdk/test/javax/imageio/stream/StreamCloserLeak/run_test.sh @@ -92,7 +92,7 @@ case "$OS" in TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME ) + Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN* ) VAR="A different value for Win32" DEFAULT_JDK=/usr/local/java/jdk1.2/win32 FILESEP="\\" diff --git a/jdk/test/javax/script/CommonSetup.sh b/jdk/test/javax/script/CommonSetup.sh index e76da82125b..4a66829131f 100644 --- a/jdk/test/javax/script/CommonSetup.sh +++ b/jdk/test/javax/script/CommonSetup.sh @@ -49,6 +49,12 @@ case "$OS" in OS="Windows" FS="\\" ;; + CYGWIN* ) + PS=";" + OS="Windows" + FS="\\" + isCygwin=true + ;; * ) echo "Unrecognized system!" exit 1; diff --git a/jdk/test/javax/script/ProviderTest.sh b/jdk/test/javax/script/ProviderTest.sh index 211d9edc1d9..a32383e4078 100644 --- a/jdk/test/javax/script/ProviderTest.sh +++ b/jdk/test/javax/script/ProviderTest.sh @@ -46,5 +46,5 @@ $JAR -cf ${TESTCLASSES}/dummy.jar \ echo "Running test ..." $JAVA -classpath \ - ${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar \ + "${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar" \ ProviderTest diff --git a/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.sh b/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.sh index 9cc5c58b555..3e1db07e017 100644 --- a/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.sh +++ b/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.sh @@ -44,7 +44,7 @@ case "$OS" in PS=":" FS="/" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" FS="\\" ;; @@ -59,6 +59,6 @@ cd ${TESTCLASSES} ${TESTJAVA}${FS}bin${FS}jar xvf testclasses.jar "fo o.class" ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES} ${TESTSRC}${FS}ClassnameCharTest.java -${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES}${PS}${TESTCLASSES}${FS}sun${FS}misc${FS}URLClassPath ClassnameCharTest +${TESTJAVA}${FS}bin${FS}java -classpath "${TESTCLASSES}${PS}${TESTCLASSES}${FS}sun${FS}misc${FS}URLClassPath" ClassnameCharTest rm -rf "fo o.class" testclasses.jar From 2e5624299a4e343f914eb7df6744fc504f0fe32e Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:49:34 -0800 Subject: [PATCH 07/59] 6911129: These tests do not work with CYGWIN: java/lang Reviewed-by: tbell, alanb --- jdk/test/java/beans/Introspector/Test5102804.java | 1 + .../java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh | 2 +- jdk/test/java/lang/StringCoding/CheckEncodings.sh | 2 +- jdk/test/java/lang/System/finalization/FinExit.sh | 4 +++- jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh | 5 +++++ .../instrument/appendToClassLoaderSearch/CommonSetup.sh | 8 +++++++- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/beans/Introspector/Test5102804.java b/jdk/test/java/beans/Introspector/Test5102804.java index 71f23f92941..cc207bdc80b 100644 --- a/jdk/test/java/beans/Introspector/Test5102804.java +++ b/jdk/test/java/beans/Introspector/Test5102804.java @@ -24,6 +24,7 @@ /* * @test * @bug 5102804 + * @ignore This test is not predictable with regards to GC * @summary Tests memory leak * @author Sergey Malenkov */ diff --git a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh index 1f6a08ff342..e4aac0ddd60 100644 --- a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh +++ b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh @@ -55,7 +55,7 @@ case "$OS" in Linux ) FS="/" ;; - Windows* ) + Windows* | CYGWIN* ) FS="\\" ;; esac diff --git a/jdk/test/java/lang/StringCoding/CheckEncodings.sh b/jdk/test/java/lang/StringCoding/CheckEncodings.sh index 6fa20c4d5a6..9bfe2f7aad6 100644 --- a/jdk/test/java/lang/StringCoding/CheckEncodings.sh +++ b/jdk/test/java/lang/StringCoding/CheckEncodings.sh @@ -31,7 +31,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) ;; - Windows* ) + Windows* | CYGWIN* ) echo "Passed"; exit 0 ;; * ) echo "Unrecognized system!" ; exit 1 ;; esac diff --git a/jdk/test/java/lang/System/finalization/FinExit.sh b/jdk/test/java/lang/System/finalization/FinExit.sh index d2e48da8fe3..c08fb6fdd5d 100644 --- a/jdk/test/java/lang/System/finalization/FinExit.sh +++ b/jdk/test/java/lang/System/finalization/FinExit.sh @@ -24,7 +24,9 @@ # # -x=`$TESTJAVA/bin/java -cp $TESTCLASSES FinExit` + +# We only want the first character, Windows might add CRLF +x=`$TESTJAVA/bin/java -cp "$TESTCLASSES" FinExit | cut -c1` echo $x if [ "x$x" != "x1" ]; then echo On-exit finalizer invoked twice diff --git a/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh b/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh index d8a47462f9b..28ac016d423 100644 --- a/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh +++ b/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh @@ -49,6 +49,11 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" diff --git a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh index 0fdce4ba0a4..c2b1a763bb8 100644 --- a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh +++ b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh @@ -43,11 +43,17 @@ case "$OS" in PS=":" FS="/" ;; - Windows* | CYGWIN*) + Windows*) PS=";" OS="Windows" FS="\\" ;; + CYGWIN*) + PS=";" + OS="Windows" + FS="\\" + isCygwin=true + ;; * ) echo "Unrecognized system!" exit 1; From c49eb02208dfa642bdde0ac002d02ecceb4f0e34 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:52:38 -0800 Subject: [PATCH 08/59] 6911108: These tests do not work with CYGWIN: java/util Reviewed-by: tbell, alanb --- jdk/test/java/util/Currency/PropertiesTest.sh | 2 +- jdk/test/java/util/PluggableLocale/ExecTest.sh | 2 +- jdk/test/java/util/ResourceBundle/Bug6299235Test.sh | 4 ++-- jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh | 2 +- jdk/test/java/util/ServiceLoader/basic.sh | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jdk/test/java/util/Currency/PropertiesTest.sh b/jdk/test/java/util/Currency/PropertiesTest.sh index b058c3d8534..420e9f92cea 100644 --- a/jdk/test/java/util/Currency/PropertiesTest.sh +++ b/jdk/test/java/util/Currency/PropertiesTest.sh @@ -34,7 +34,7 @@ case "$OS" in PS=":" FS="/" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" FS="\\" ;; diff --git a/jdk/test/java/util/PluggableLocale/ExecTest.sh b/jdk/test/java/util/PluggableLocale/ExecTest.sh index b68a28cd848..76b339ee4c3 100644 --- a/jdk/test/java/util/PluggableLocale/ExecTest.sh +++ b/jdk/test/java/util/PluggableLocale/ExecTest.sh @@ -62,7 +62,7 @@ case "$OS" in PS=":" FS="/" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" FS="\\" ;; diff --git a/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh b/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh index 6da631ebe4c..bb2d6a69165 100644 --- a/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh +++ b/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh @@ -35,7 +35,7 @@ case "$OS" in PATHSEP=":" FILESEP="/" ;; - Windows* ) + Windows* | CYGWIN* ) PATHSEP=";" FILESEP="\\" ;; @@ -63,7 +63,7 @@ else fi if [ -d "${JRE_EXT_DIR}" ]; then - NEW_EXT_DIR=${JRE_EXT_DIR}${PATHSEP}${TESTSRC} + NEW_EXT_DIR="${JRE_EXT_DIR}${PATHSEP}${TESTSRC}" else NEW_EXT_DIR=${TESTSRC} fi diff --git a/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh b/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh index 449162ccc54..ac89bc136c6 100644 --- a/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh +++ b/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh @@ -69,7 +69,7 @@ export LC_ALL HAS_S=NO case "`uname`" in -Windows*) +Windows* | CYGWIN* ) DEL=";" ;; SunOS) diff --git a/jdk/test/java/util/ServiceLoader/basic.sh b/jdk/test/java/util/ServiceLoader/basic.sh index 4f80b17f553..68695678738 100644 --- a/jdk/test/java/util/ServiceLoader/basic.sh +++ b/jdk/test/java/util/ServiceLoader/basic.sh @@ -50,9 +50,9 @@ case "$OS" in SEP='\;' ;; esac -JARD=`pwd`/x.jar -EXTD=`pwd`/x.ext -TESTD=`pwd`/x.test +JARD=x.jar +EXTD=x.ext +TESTD=x.test if [ \! -d $EXTD ]; then # Initialize From 5870e852d51433b864631c96f4f2bf5a47fb895e Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Jan 2010 15:56:42 -0800 Subject: [PATCH 09/59] 6911104: Tests do not work with CYGWIN: tools, sun/tools, and com/sun/tools Reviewed-by: tbell, alanb --- .../com/sun/tools/attach/ApplicationSetup.sh | 8 ++++++-- jdk/test/com/sun/tools/attach/BasicTests.sh | 2 +- jdk/test/com/sun/tools/attach/CommonSetup.sh | 6 ++++++ .../com/sun/tools/attach/PermissionTests.sh | 4 ++-- jdk/test/com/sun/tools/attach/ProviderTests.sh | 2 +- jdk/test/sun/jvmstat/testlibrary/utils.sh | 4 ++-- jdk/test/sun/tools/common/ApplicationSetup.sh | 6 +++++- jdk/test/sun/tools/common/CommonSetup.sh | 5 +++++ jdk/test/sun/tools/jps/jps-help.sh | 4 ++-- jdk/test/sun/tools/jstat/jstatHelp.sh | 4 ++-- jdk/test/sun/tools/jstat/jstatOptions1.sh | 2 +- jdk/test/sun/tools/jstatd/jstatdUsage1.sh | 4 ++-- .../tools/native2ascii/Native2AsciiTests.sh | 10 ++++++---- jdk/test/tools/launcher/ChangeDataModel.sh | 15 +++++++++------ jdk/test/tools/launcher/ClassPathWildCard.sh | 2 +- jdk/test/tools/launcher/DefaultLocaleTest.sh | 18 +++++++++++++++++- jdk/test/tools/launcher/UnicodeTest.sh | 2 +- 17 files changed, 69 insertions(+), 29 deletions(-) diff --git a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh index fa8509ec394..0bd7a1b5693 100644 --- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh +++ b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh @@ -49,7 +49,11 @@ startApplication() # "java" process. if [ "$OS" = "Windows" ]; then sleep 2 - realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + if [ "${isCygwin}" = "true" ] ; then + realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'` + else + realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + fi pid=${realpid} fi @@ -57,7 +61,7 @@ startApplication() attempts=0 while true; do sleep 1 - port=`tail -1 ${OUTPUTFILE}` + port=`tail -1 ${OUTPUTFILE} | sed -e 's@\\r@@g' ` if [ ! -z "$port" ]; then # In case of errors wait time for output to be flushed sleep 1 diff --git a/jdk/test/com/sun/tools/attach/BasicTests.sh b/jdk/test/com/sun/tools/attach/BasicTests.sh index a960b40e15d..f5c4076581e 100644 --- a/jdk/test/com/sun/tools/attach/BasicTests.sh +++ b/jdk/test/com/sun/tools/attach/BasicTests.sh @@ -48,7 +48,7 @@ failures=0 echo "Running tests ..." -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ BasicTests $pid $agent $badagent $redefineagent 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi diff --git a/jdk/test/com/sun/tools/attach/CommonSetup.sh b/jdk/test/com/sun/tools/attach/CommonSetup.sh index 1520ca72b57..66d90fafddd 100644 --- a/jdk/test/com/sun/tools/attach/CommonSetup.sh +++ b/jdk/test/com/sun/tools/attach/CommonSetup.sh @@ -49,6 +49,12 @@ case "$OS" in OS="Windows" FS="\\" ;; + CYGWIN* ) + PS=";" + OS="Windows" + FS="\\" + isCygwin=true + ;; * ) echo "Unrecognized system!" exit 1; diff --git a/jdk/test/com/sun/tools/attach/PermissionTests.sh b/jdk/test/com/sun/tools/attach/PermissionTests.sh index 908e93ec077..54a7e61a7e0 100644 --- a/jdk/test/com/sun/tools/attach/PermissionTests.sh +++ b/jdk/test/com/sun/tools/attach/PermissionTests.sh @@ -48,7 +48,7 @@ startApplication echo "Deny test" # deny -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}/java.policy.deny \ PermissionTest $pid true 2>&1 @@ -56,7 +56,7 @@ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # allow echo "Allow test" -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}/java.policy.allow \ PermissionTest $pid false 2>&1 diff --git a/jdk/test/com/sun/tools/attach/ProviderTests.sh b/jdk/test/com/sun/tools/attach/ProviderTests.sh index caca75af0e7..36a90b13535 100644 --- a/jdk/test/com/sun/tools/attach/ProviderTests.sh +++ b/jdk/test/com/sun/tools/attach/ProviderTests.sh @@ -46,6 +46,6 @@ $JAR -cf ${TESTCLASSES}/SimpleProvider.jar \ echo "Running test ..." $JAVA -classpath \ - ${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar \ + "${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar" \ ProviderTest diff --git a/jdk/test/sun/jvmstat/testlibrary/utils.sh b/jdk/test/sun/jvmstat/testlibrary/utils.sh index d3b04956373..8bd4215d088 100644 --- a/jdk/test/sun/jvmstat/testlibrary/utils.sh +++ b/jdk/test/sun/jvmstat/testlibrary/utils.sh @@ -40,7 +40,7 @@ setup() { OS=`uname -s` case ${OS} in - Windows_*) + Windows_* | CYGWIN*) PS=";" FS="\\" ;; @@ -54,7 +54,7 @@ setup() { verify_os() { OS=`uname -s` case ${OS} in - Windows_95 | Windows_98 | Windows_ME) + Windows_95 | Windows_98 | Windows_ME | CYGWIN* ) echo "Test bypassed: jvmstat feature not supported on ${OS}" exit 0 ;; diff --git a/jdk/test/sun/tools/common/ApplicationSetup.sh b/jdk/test/sun/tools/common/ApplicationSetup.sh index b5c0ad2314d..9c8e9d2bbc6 100644 --- a/jdk/test/sun/tools/common/ApplicationSetup.sh +++ b/jdk/test/sun/tools/common/ApplicationSetup.sh @@ -45,7 +45,11 @@ startApplication() # "java" process. if [ "$OS" = "Windows" ]; then sleep 2 - realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + if [ "${isCygwin}" = "true" ] ; then + realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'` + else + realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + fi pid=${realpid} fi diff --git a/jdk/test/sun/tools/common/CommonSetup.sh b/jdk/test/sun/tools/common/CommonSetup.sh index 861289c08d9..3876affc5ac 100644 --- a/jdk/test/sun/tools/common/CommonSetup.sh +++ b/jdk/test/sun/tools/common/CommonSetup.sh @@ -67,6 +67,11 @@ case "$OS" in PS=";" OS="Windows" ;; + CYGWIN* ) + PS=";" + OS="Windows" + isCygwin=true + ;; * ) PS=":" ;; diff --git a/jdk/test/sun/tools/jps/jps-help.sh b/jdk/test/sun/tools/jps/jps-help.sh index 28a47864280..0303954343a 100644 --- a/jdk/test/sun/tools/jps/jps-help.sh +++ b/jdk/test/sun/tools/jps/jps-help.sh @@ -35,7 +35,7 @@ JPS="${TESTJAVA}/bin/jps" rm -f jps.out 2>/dev/null ${JPS} -? > jps.out 2>&1 -diff jps.out ${TESTSRC}/usage.out +diff -w jps.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jps -? differ from expected output. Failed." @@ -46,7 +46,7 @@ fi rm -f jps.out 2>/dev/null ${JPS} -help > jps.out 2>&1 -diff jps.out ${TESTSRC}/usage.out +diff -w jps.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jps -help differ from expected output. Failed." diff --git a/jdk/test/sun/tools/jstat/jstatHelp.sh b/jdk/test/sun/tools/jstat/jstatHelp.sh index 545970e3110..3ec7906c0e3 100644 --- a/jdk/test/sun/tools/jstat/jstatHelp.sh +++ b/jdk/test/sun/tools/jstat/jstatHelp.sh @@ -35,7 +35,7 @@ JSTAT="${TESTJAVA}/bin/jstat" rm -f jstat.out 2>/dev/null ${JSTAT} -? > jstat.out 2>&1 -diff jstat.out ${TESTSRC}/usage.out +diff -w jstat.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstat -? differ from expected output. Failed." @@ -45,7 +45,7 @@ fi rm -f jstat.out 2>/dev/null ${JSTAT} -help > jstat.out 2>&1 -diff jstat.out ${TESTSRC}/usage.out +diff -w jstat.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstat -help differ from expected output. Failed." diff --git a/jdk/test/sun/tools/jstat/jstatOptions1.sh b/jdk/test/sun/tools/jstat/jstatOptions1.sh index e38c413790f..ad3df13ca30 100644 --- a/jdk/test/sun/tools/jstat/jstatOptions1.sh +++ b/jdk/test/sun/tools/jstat/jstatOptions1.sh @@ -35,4 +35,4 @@ JSTAT="${TESTJAVA}/bin/jstat" rm -f jstat.out 2>/dev/null ${JSTAT} -options > jstat.out 2>&1 -diff jstat.out ${TESTSRC}/options1.out +diff -w jstat.out ${TESTSRC}/options1.out diff --git a/jdk/test/sun/tools/jstatd/jstatdUsage1.sh b/jdk/test/sun/tools/jstatd/jstatdUsage1.sh index 22d309b62c8..074ec5ce2ba 100644 --- a/jdk/test/sun/tools/jstatd/jstatdUsage1.sh +++ b/jdk/test/sun/tools/jstatd/jstatdUsage1.sh @@ -37,7 +37,7 @@ JSTATD_2_OUT="jstatd_$$_2.out" ${JSTATD} -? > ${JSTATD_1_OUT} 2>&1 -diff ${JSTATD_1_OUT} ${TESTSRC}/usage.out +diff -w ${JSTATD_1_OUT} ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstatd -? differs from expected output. Failed." @@ -46,7 +46,7 @@ fi ${JSTATD} -help > ${JSTATD_2_OUT} 2>&1 -diff ${JSTATD_2_OUT} ${TESTSRC}/usage.out +diff -w ${JSTATD_2_OUT} ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstatd -help differs from expected output. Failed." diff --git a/jdk/test/sun/tools/native2ascii/Native2AsciiTests.sh b/jdk/test/sun/tools/native2ascii/Native2AsciiTests.sh index 1fa7f6c0004..26281ba7241 100644 --- a/jdk/test/sun/tools/native2ascii/Native2AsciiTests.sh +++ b/jdk/test/sun/tools/native2ascii/Native2AsciiTests.sh @@ -32,7 +32,7 @@ if [ "${TESTSRC}" = "" ]; then TESTSRC=.; fi if [ "${TESTJAVA}" = "" ]; then TESTJAVA=$1; shift; fi case `uname -s` in - Windows*) OS=Windows;; + Windows* | CYGWIN*) OS=Windows;; SunOS|Linux) OS=Unix;; esac @@ -45,12 +45,14 @@ check() { # Strip carriage returns from output when comparing with n2a test output # on win32 systems - if [ OS = Windows ]; then - tr -d '\015' <$out >$out.1 + if [ ${OS} = Windows ]; then + sed -e 's@\\r@@g' $out >$out.1 + sed -e 's@\\r@@g' $expected >$out.expected else cp $out $out.1 + cp $expected $out.expected fi - if (set -x; diff -c $expected $out.1); then + if (set -x; diff -c $out.expected $out.1); then echo "$bug passed" else echo "$bug failed" diff --git a/jdk/test/tools/launcher/ChangeDataModel.sh b/jdk/test/tools/launcher/ChangeDataModel.sh index eddc38d7cfc..1fc689f403b 100644 --- a/jdk/test/tools/launcher/ChangeDataModel.sh +++ b/jdk/test/tools/launcher/ChangeDataModel.sh @@ -29,6 +29,9 @@ OS=`uname -s`; +# To remove CR from output, needed for java apps in CYGWIN, harmless otherwise +SED_CR="sed -e s@\\r@@g" + case "$OS" in Windows* | CYGWIN* ) PATHSEP=";" @@ -79,10 +82,10 @@ $JAVAC GetDataModel.java # Verify data model flag for default data model is accepted -DM=`$JAVA GetDataModel` +DM=`$JAVA GetDataModel | ${SED_CR}` case "$DM" in 32 ) - DM2=`${JAVA} -d32 GetDataModel` + DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}` if [ "${DM2}" != "32" ] then echo "Data model flag -d32 not accepted or had improper effect." @@ -91,7 +94,7 @@ case "$DM" in ;; 64 ) - DM2=`${JAVA} -d64 GetDataModel` + DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}` if [ "${DM2}" != "64" ] then echo "Data model flag -d64 not accepted or had improper effect." @@ -227,10 +230,10 @@ then else # Negative tests for non-dual mode platforms to ensure the other data model is # rejected - DM=`$JAVA GetDataModel` + DM=`$JAVA GetDataModel | ${SED_CR}` case "$DM" in 32 ) - DM2=`${JAVA} -d64 GetDataModel` + DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}` if [ "x${DM2}" != "x" ] then echo "Data model flag -d64 was accepted." @@ -239,7 +242,7 @@ else ;; 64 ) - DM2=`${JAVA} -d32 GetDataModel` + DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}` if [ "x${DM2}" != "x" ] then echo "Data model flag -d32 was accepted." diff --git a/jdk/test/tools/launcher/ClassPathWildCard.sh b/jdk/test/tools/launcher/ClassPathWildCard.sh index 46a4866e486..4b3b0dfb5e1 100644 --- a/jdk/test/tools/launcher/ClassPathWildCard.sh +++ b/jdk/test/tools/launcher/ClassPathWildCard.sh @@ -145,7 +145,7 @@ CreateClassFiles D OS=`uname -s` case $OS in - Windows*|Cygwin*) + Windows*|CYGWIN*) PATHSEP=";" ExecJava "" "${PATHSEP}NOOPDIR" ExecJava "w" "${PATHSEP}NOOPDIR" diff --git a/jdk/test/tools/launcher/DefaultLocaleTest.sh b/jdk/test/tools/launcher/DefaultLocaleTest.sh index 97eddd5bf63..31af0aa3199 100644 --- a/jdk/test/tools/launcher/DefaultLocaleTest.sh +++ b/jdk/test/tools/launcher/DefaultLocaleTest.sh @@ -48,7 +48,7 @@ fi OS=`uname` case "$OS" in - Windows* | CYGWIN* ) + Windows* ) JAVAC="${TESTJAVA}/bin/javac -d . " JAVA="${TESTJAVA}/bin/java -classpath . " JAVAW="${TESTJAVA}/bin/javaw -classpath . " @@ -64,6 +64,22 @@ case "$OS" in echo "Test passes" exit 0 ;; + CYGWIN* ) + JAVAC="${TESTJAVA}/bin/javac -d . " + JAVA="${TESTJAVA}/bin/java -classpath . " + JAVAW="${TESTJAVA}/bin/javaw -classpath . " + + ${JAVAC} ${TESTSRC}/DefaultLocaleTest.java + ${JAVA} DefaultLocaleTest | sed -e s@\\r@@g > x.out + ${JAVAW} DefaultLocaleTest `cat x.out` + if [ $? -ne 0 ] + then + echo "Test fails" + exit 1 + fi + echo "Test passes" + exit 0 + ;; * ) echo "Non-windows environment; test vacuously succeeds." exit 0; diff --git a/jdk/test/tools/launcher/UnicodeTest.sh b/jdk/test/tools/launcher/UnicodeTest.sh index 7b4789772f0..8f77f4b739d 100644 --- a/jdk/test/tools/launcher/UnicodeTest.sh +++ b/jdk/test/tools/launcher/UnicodeTest.sh @@ -54,7 +54,7 @@ mkdir UnicodeTest-src UnicodeTest-classes echo "creating test source files" "$JAVAC" -d . "${TESTSRC}"/UnicodeTest.java -CLASS_NAME=`"$JAVA" UnicodeTest` +CLASS_NAME=`"$JAVA" UnicodeTest | sed -e 's@\\r@@g' ` if [ "$CLASS_NAME" = "" ] then From 8fef75cd307850623b971715a7aad17e800f2c28 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 6 Jan 2010 13:09:52 -0800 Subject: [PATCH 10/59] 6307206: missing lint control for pkg-info Reviewed-by: darcy --- .../classes/com/sun/tools/javac/resources/compiler.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties index ba27f304dfd..ff9f85b494a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -704,7 +704,7 @@ compiler.warn.override.bridge=\ {0}; overridden method is a bridge method compiler.warn.pkg-info.already.seen=\ - [package-info] a package-info.java file has already been seen for package {0} + a package-info.java file has already been seen for package {0} compiler.warn.path.element.not.found=\ [path] bad path element "{0}": no such file or directory compiler.warn.possible.fall-through.into.case=\ From b796b9a5d29f144b2578a80170ec7d6523341b8d Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 6 Jan 2010 13:16:48 -0800 Subject: [PATCH 11/59] 6855236: Compiler Tree API TreePath class generates NullPointerException from Iterator Reviewed-by: darcy --- langtools/test/tools/javac/T6855236.java | 95 ++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 langtools/test/tools/javac/T6855236.java diff --git a/langtools/test/tools/javac/T6855236.java b/langtools/test/tools/javac/T6855236.java new file mode 100644 index 00000000000..fba6a37ad59 --- /dev/null +++ b/langtools/test/tools/javac/T6855236.java @@ -0,0 +1,95 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6855236 + * @summary Compiler Tree API TreePath class generates NullPointerException from Iterator + * @compile T6855236.java + * @compile -processor T6855236 -proc:only T6855236.java + */ + +import java.util.*; + +import javax.annotation.processing.*; +import javax.lang.model.*; +import javax.lang.model.element.*; + +import com.sun.source.tree.*; +import com.sun.source.util.*; + +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedAnnotationTypes("*") +public class T6855236 extends AbstractProcessor { + + private Trees trees; + + @Override + public void init(ProcessingEnvironment pe) { + super.init(pe); + trees = Trees.instance(pe); + } + + @Override + public boolean process(Set arg0, RoundEnvironment roundEnvironment) { + // Scanner class to scan through various component elements + CodeVisitor visitor = new CodeVisitor(); + + for (Element e : roundEnvironment.getRootElements()) { + TreePath tp = trees.getPath(e); + visitor.scan(tp, trees); + } + + return true; + } + + class CodeVisitor extends TreePathScanner { + + @Override + public Object visitMethodInvocation(MethodInvocationTree node, Trees p) { + System.out.print("current path: "); + for (Tree t : getCurrentPath()) { + System.out.print('/'); + System.out.print(t); + } + System.out.println(); + System.out.println("parent path: " + getCurrentPath().getParentPath()); + System.out.println("method select: " + node.getMethodSelect().toString()); + for (ExpressionTree arg : node.getArguments()) { + System.out.println("argument: " + arg.toString()); + } + return super.visitMethodInvocation(node, p); + } + + @Override + public Object visitExpressionStatement(ExpressionStatementTree node, Trees p) { + ExpressionTree t = node.getExpression(); + System.out.println("expression statement: " + t.toString()); + return super.visitExpressionStatement(node, p); + } + + } + +} + + From b4749c950a7a113f22d0701d142d716f53f60971 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 7 Jan 2010 08:14:48 -0800 Subject: [PATCH 12/59] 6911737: Module build: generate modules with native libraries and any other files not in jar Create modules under OUTPUTDIR/modules directory containing resources, native libraries Reviewed-by: alanb, ohair --- jdk/make/com/sun/crypto/provider/Makefile | 2 +- jdk/make/com/sun/java/pack/Makefile | 7 +- jdk/make/com/sun/java/pack/prop/Makefile | 1 + jdk/make/com/sun/jndi/cosnaming/Makefile | 1 + jdk/make/com/sun/jndi/dns/Makefile | 1 + jdk/make/com/sun/jndi/ldap/Makefile | 1 + jdk/make/com/sun/jndi/rmi/registry/Makefile | 1 + jdk/make/com/sun/nio/sctp/Makefile | 1 + jdk/make/com/sun/org/apache/xml/Makefile | 1 + jdk/make/com/sun/rowset/Makefile | 1 + jdk/make/com/sun/script/Makefile | 1 + .../com/sun/security/auth/module/Makefile | 1 + jdk/make/com/sun/servicetag/Makefile | 3 +- jdk/make/com/sun/tools/attach/Makefile | 2 + jdk/make/common/Defs.gmk | 95 +++++++++++- jdk/make/common/Demo.gmk | 2 + jdk/make/common/Library.gmk | 12 ++ jdk/make/common/Modules.gmk | 55 ++++++- jdk/make/common/Program.gmk | 19 +-- jdk/make/common/internal/BinaryPlugs.gmk | 4 +- jdk/make/common/internal/Resources.gmk | 2 +- jdk/make/common/shared/Sanity.gmk | 4 +- jdk/make/java/awt/Makefile | 1 + jdk/make/java/fdlibm/Makefile | 1 + jdk/make/java/hpi/native/Makefile | 1 + jdk/make/java/hpi/windows/Makefile | 5 +- jdk/make/java/instrument/Makefile | 1 + jdk/make/java/java/Makefile | 10 +- jdk/make/java/java_crw_demo/Makefile | 2 + jdk/make/java/java_hprof_demo/Makefile | 1 + jdk/make/java/jli/Makefile | 1 + jdk/make/java/jvm/Makefile | 22 ++- jdk/make/java/logging/Makefile | 1 + jdk/make/java/main/java/Makefile | 1 + jdk/make/java/main/javaw/Makefile | 1 + jdk/make/java/management/Makefile | 3 +- jdk/make/java/net/Makefile | 4 +- jdk/make/java/nio/Makefile | 3 +- jdk/make/java/npt/Makefile | 3 + jdk/make/java/redist/Makefile | 107 ++------------ .../java/redist/{FILES.gmk => fonts/Makefile} | 57 +++++++- jdk/make/java/redist/sajdi/Makefile | 87 +++++++++++ jdk/make/java/security/Makefile | 15 +- jdk/make/java/sql/Makefile | 1 + jdk/make/java/text/Makefile | 2 +- jdk/make/java/verify/Makefile | 1 + jdk/make/java/zip/Makefile | 1 + jdk/make/javax/crypto/Makefile | 25 +++- jdk/make/javax/imageio/Makefile | 1 + jdk/make/javax/print/Makefile | 1 + jdk/make/javax/sound/Makefile | 1 + jdk/make/javax/sound/jsoundalsa/Makefile | 1 + jdk/make/javax/sound/jsoundds/Makefile | 1 + jdk/make/javax/sql/Makefile | 1 + jdk/make/javax/swing/Makefile | 1 + jdk/make/javax/swing/plaf/Makefile | 1 + jdk/make/jpda/back/Makefile | 1 + jdk/make/jpda/transport/Makefile | 1 + jdk/make/jpda/transport/shmem/Makefile | 1 + jdk/make/jpda/transport/socket/Makefile | 1 + jdk/make/jpda/tty/Makefile | 1 + jdk/make/launchers/Makefile | 53 +++---- jdk/make/mkdemo/jvmti/Makefile | 1 + jdk/make/mkdemo/management/Makefile | 1 + jdk/make/mksample/dtrace/Makefile | 1 + jdk/make/mksample/jmx/jmx-scandir/Makefile | 1 + jdk/make/mksample/nbproject/Makefile | 1 + jdk/make/mksample/nio/file/Makefile | 1 + jdk/make/mksample/nio/multicast/Makefile | 1 + jdk/make/mksample/nio/server/Makefile | 1 + .../mksample/scripting/scriptpad/Makefile | 1 + .../mksample/webservices/EbayClient/Makefile | 1 + .../mksample/webservices/EbayServer/Makefile | 1 + jdk/make/modules/Makefile | 64 +++----- jdk/make/modules/modules.config | 137 +++++++++++++----- jdk/make/modules/tools/nbproject/project.xml | 3 +- .../src/com/sun/classanalyzer/Module.java | 6 +- jdk/make/sun/applet/Makefile | 1 + jdk/make/sun/awt/Makefile | 10 +- jdk/make/sun/cmm/Makefile | 31 ++-- jdk/make/sun/cmm/kcms/Makefile | 1 + jdk/make/sun/cmm/lcms/Makefile | 1 + jdk/make/sun/dcpr/Makefile | 1 + jdk/make/sun/font/Makefile | 17 ++- jdk/make/sun/font/t2k/Makefile | 1 + jdk/make/sun/headless/Makefile | 1 + jdk/make/sun/image/generic/Makefile | 1 + jdk/make/sun/image/vis/Makefile | 1 + jdk/make/sun/jar/Makefile | 1 + jdk/make/sun/javazic/Makefile | 2 + jdk/make/sun/jawt/Makefile | 1 + jdk/make/sun/jconsole/Makefile | 3 +- jdk/make/sun/jdbc/Makefile | 1 + jdk/make/sun/jdga/Makefile | 1 + jdk/make/sun/jkernel/Makefile | 1 + jdk/make/sun/jpeg/Makefile | 1 + jdk/make/sun/launcher/Makefile | 1 + jdk/make/sun/management/Makefile | 10 +- jdk/make/sun/native2ascii/Makefile | 1 + jdk/make/sun/net/others/Makefile | 1 + jdk/make/sun/net/spi/nameservice/dns/Makefile | 3 + jdk/make/sun/nio/Makefile | 84 +---------- jdk/make/sun/nio/{ => cs}/FILES_java.gmk | 0 jdk/make/sun/nio/cs/Makefile | 112 ++++++++++++++ jdk/make/sun/org/mozilla/javascript/Makefile | 1 + jdk/make/sun/pisces/Makefile | 1 + jdk/make/sun/rmi/cgi/Makefile | 2 + jdk/make/sun/rmi/oldtools/Makefile | 1 + jdk/make/sun/rmi/registry/Makefile | 5 + jdk/make/sun/rmi/rmi/Makefile | 3 +- jdk/make/sun/rmi/rmic/Makefile | 1 + jdk/make/sun/rmi/rmid/Makefile | 6 +- jdk/make/sun/security/ec/Makefile | 3 +- jdk/make/sun/security/jgss/wrapper/Makefile | 1 + jdk/make/sun/security/krb5/Makefile | 8 + jdk/make/sun/security/mscapi/Makefile | 3 +- jdk/make/sun/security/pkcs11/Makefile | 23 ++- jdk/make/sun/security/smartcardio/Makefile | 1 + jdk/make/sun/security/tools/Makefile | 5 + jdk/make/sun/serialver/Makefile | 1 + jdk/make/sun/splashscreen/Makefile | 1 + jdk/make/sun/text/Makefile | 1 + jdk/make/sun/tools/Makefile | 1 + jdk/make/sun/tracing/dtrace/Makefile | 1 + jdk/make/sun/xawt/Makefile | 1 + 125 files changed, 816 insertions(+), 404 deletions(-) rename jdk/make/java/redist/{FILES.gmk => fonts/Makefile} (65%) create mode 100644 jdk/make/java/redist/sajdi/Makefile rename jdk/make/sun/nio/{ => cs}/FILES_java.gmk (100%) create mode 100644 jdk/make/sun/nio/cs/Makefile diff --git a/jdk/make/com/sun/crypto/provider/Makefile b/jdk/make/com/sun/crypto/provider/Makefile index 8cf809dc469..96b12e9989e 100644 --- a/jdk/make/com/sun/crypto/provider/Makefile +++ b/jdk/make/com/sun/crypto/provider/Makefile @@ -249,7 +249,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunjce_provider.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: diff --git a/jdk/make/com/sun/java/pack/Makefile b/jdk/make/com/sun/java/pack/Makefile index 1d013c0894b..4598313fdba 100644 --- a/jdk/make/com/sun/java/pack/Makefile +++ b/jdk/make/com/sun/java/pack/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = pack200 PACKAGE = com.sun.java.util.jar.pack LIBRARY = unpack PRODUCT = sun @@ -123,11 +124,14 @@ COBJDIR = $(strip $(subst unpack,unpack-cmd,$(OBJDIR))) all: build -build: prop +build: prop pack200-tool prop: $(MAKE) -C prop +pack200-tool: + $(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack) + unpacker: $(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG= @@ -151,6 +155,7 @@ ifdef MT $(MT) /manifest $(TEMPDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1 endif $(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE) + $(install-module-file) ifeq ($(PLATFORM), windows) $(RES):: $(VERSIONINFO_RESOURCE) diff --git a/jdk/make/com/sun/java/pack/prop/Makefile b/jdk/make/com/sun/java/pack/prop/Makefile index 59a53f663be..e0bda2de040 100644 --- a/jdk/make/com/sun/java/pack/prop/Makefile +++ b/jdk/make/com/sun/java/pack/prop/Makefile @@ -29,6 +29,7 @@ # to a collision of rules with Classes.gmk and Library.gmk BUILDDIR = ../../../../.. +MODULE = pack200 PACKAGE = com.sun.java.util.jar.pack PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/jndi/cosnaming/Makefile b/jdk/make/com/sun/jndi/cosnaming/Makefile index 1657e9be36b..9cc85a196ff 100644 --- a/jdk/make/com/sun/jndi/cosnaming/Makefile +++ b/jdk/make/com/sun/jndi/cosnaming/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = jndi-cosnaming PACKAGE = com.sun.jndi.cosnaming PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/jndi/dns/Makefile b/jdk/make/com/sun/jndi/dns/Makefile index ed2641527b7..a081c255924 100644 --- a/jdk/make/com/sun/jndi/dns/Makefile +++ b/jdk/make/com/sun/jndi/dns/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = jndi-dns PACKAGE = com.sun.jndi.dns PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/jndi/ldap/Makefile b/jdk/make/com/sun/jndi/ldap/Makefile index eac6568ba2f..e6286c093c7 100644 --- a/jdk/make/com/sun/jndi/ldap/Makefile +++ b/jdk/make/com/sun/jndi/ldap/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = jndi-ldap PACKAGE = com.sun.jndi.ldap PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/jndi/rmi/registry/Makefile b/jdk/make/com/sun/jndi/rmi/registry/Makefile index 4192b55e406..34a4e8170cb 100644 --- a/jdk/make/com/sun/jndi/rmi/registry/Makefile +++ b/jdk/make/com/sun/jndi/rmi/registry/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../../.. +MODULE = jndi-rmiregistry PACKAGE = com.sun.jndi.rmi.registry PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/nio/sctp/Makefile b/jdk/make/com/sun/nio/sctp/Makefile index d5acea340a9..1eadf769122 100644 --- a/jdk/make/com/sun/nio/sctp/Makefile +++ b/jdk/make/com/sun/nio/sctp/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = sctp PACKAGE = com.sun.nio.sctp LIBRARY = sctp PRODUCT = sun diff --git a/jdk/make/com/sun/org/apache/xml/Makefile b/jdk/make/com/sun/org/apache/xml/Makefile index 36a15bac490..f57e3d0cfc3 100644 --- a/jdk/make/com/sun/org/apache/xml/Makefile +++ b/jdk/make/com/sun/org/apache/xml/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../../.. +MODULE = security-xmldsig PACKAGE = com.sun.org.apache.xml PRODUCT = xml include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/rowset/Makefile b/jdk/make/com/sun/rowset/Makefile index ff7641a128e..3f73fd6e791 100644 --- a/jdk/make/com/sun/rowset/Makefile +++ b/jdk/make/com/sun/rowset/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = jdbc-enterprise PACKAGE = com.sun.rowset PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/script/Makefile b/jdk/make/com/sun/script/Makefile index 5e4c83063d5..07159b0b6be 100644 --- a/jdk/make/com/sun/script/Makefile +++ b/jdk/make/com/sun/script/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../../.. +MODULE = scripting-rhino PACKAGE = com.sun.script PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/com/sun/security/auth/module/Makefile b/jdk/make/com/sun/security/auth/module/Makefile index d7a4abdf165..8552ffe758c 100644 --- a/jdk/make/com/sun/security/auth/module/Makefile +++ b/jdk/make/com/sun/security/auth/module/Makefile @@ -26,6 +26,7 @@ # Makefile for building auth modules. BUILDDIR = ../../../../.. +MODULE = security-auth PACKAGE = com.sun.security.auth.module PRODUCT = sun diff --git a/jdk/make/com/sun/servicetag/Makefile b/jdk/make/com/sun/servicetag/Makefile index e7914e8278e..4ec4bc7f08d 100644 --- a/jdk/make/com/sun/servicetag/Makefile +++ b/jdk/make/com/sun/servicetag/Makefile @@ -22,6 +22,7 @@ # have any questions. BUILDDIR = ../../.. +MODULE = servicetag PACKAGE = com.sun.servicetag PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -68,7 +69,7 @@ $(CLASSBINDIR)/%: $(SHARE_SRC)/classes/% $(SERVICETAG_LIBDIR)/jdk_header.png: $(SHARE_SRC)/classes/com/sun/servicetag/resources/jdk_header.png $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) install-servicetag-lib: @$(RM) -rf $(SERVICETAG_LIBDIR) diff --git a/jdk/make/com/sun/tools/attach/Makefile b/jdk/make/com/sun/tools/attach/Makefile index 25421bff371..f1b3a3a5538 100644 --- a/jdk/make/com/sun/tools/attach/Makefile +++ b/jdk/make/com/sun/tools/attach/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../../../.. +MODULE = attach PACKAGE = com.sun.tools.attach LIBRARY = attach PRODUCT = sun @@ -65,6 +66,7 @@ $(SERVICEDIR)/%: $(SHARE_SRC)/classes/sun/tools/attach/META-INF/services/% @$(MKDIR) -p $(@D) @$(RM) $@ @$(CAT) $< | $(SED) -e "s/^#\[$(PLATFORM)\]//" > $@ + @$(install-module-file) .PHONY: copy-files diff --git a/jdk/make/common/Defs.gmk b/jdk/make/common/Defs.gmk index de974fe62ec..d233b1ff8a3 100644 --- a/jdk/make/common/Defs.gmk +++ b/jdk/make/common/Defs.gmk @@ -225,12 +225,6 @@ DEVTOOLS_FT_DIR_EXISTS = $(shell \ endif endif - ifeq ($(PLATFORM), windows) - FREETYPE_LIB = $(FREETYPE_LIB_PATH)/freetype.lib - else - FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) -lfreetype - endif - ifdef ALT_FREETYPE_HEADERS_PATH FREETYPE_HEADERS_PATH = $(ALT_FREETYPE_HEADERS_PATH) else @@ -388,6 +382,14 @@ ifneq ($(THREADDIR),) UNIQUE_LOCATION_STRING += /$(THREADDIR) endif +# +# Build units may or may not define MODULE. Default to "other". +# +ifndef MODULE + MODULE = other +endif +override MODULE_DEST_DIR = $(OUTPUTDIR)/tmp/modules/$(MODULE) + # the use of += above makes a space separated list which we need to # remove for filespecs. # @@ -497,6 +499,58 @@ PKGDIR = $(subst .,/,$(PACKAGE)) # include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk +# +# Macros to find the module that $@ belongs to +# + +UNIQUE_PATH_PATTERN = $(subst /,.,$(UNIQUE_PATH)) +MODULE_PATH_PATTERN = -e 's%.*\/classes\/%classes\/%' \ + -e 's%.*\/$(UNIQUE_PATH_PATTERN)\/%classes\/%' \ + -e 's%.*\/lib\/%lib\/%' \ + -e 's%.*\/bin\/%bin\/%' \ + -e 's%.*\/include\/%include\/%' \ + -e 's%.*\/demo\/%demo\/%' \ + -e 's%.*\/sample\/%sample\/%' + +# Install a file to its module +define install-module-file +dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \ +$(CP) $@ $(MODULE_DEST_DIR)/$$dest +endef + +# Install all files from the directory to its module +define install-module-dir +dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \ +$(CP) -rf $(@D)/* $(MODULE_DEST_DIR)/$$dest +endef + +# chmod the file in its module +define chmod-module-file +dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(CHMOD) $1 $(MODULE_DEST_DIR)/$$dest +endef + +# install a sym link in its module +define install-module-sym-link +dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(LN) -s $1 $(MODULE_DEST_DIR)/$$dest +endef + + +# Run MAKE $@ for a launcher: +# $(call make-launcher, name, mainclass, java-args, main-args) +define make-launcher +$(CD) $(BUILDDIR)/launchers && \ +$(MAKE) -f Makefile.launcher \ + MODULE=$(MODULE) \ + PROGRAM=$(strip $1) \ + MAIN_CLASS=$(strip $2) \ + MAIN_JAVA_ARGS="$(strip $3)" \ + MAIN_ARGS="$(strip $4)" +endef + # # Convenient macros # @@ -511,6 +565,28 @@ endef define install-file $(prep-target) $(CP) $< $@ +$(install-module-file) +endef + +define chmod-file +$(CHMOD) $1 $@ +$(call chmod-module-file, $1) +endef + +define install-sym-link +$(LN) -s $1 $@ +$(call install-module-sym-link, $1) +endef + +# +# Marcos for files not belonging to any module +define install-non-module-file +$(prep-target) +$(CP) $< $@ +endef + +define install-manifest-file +$(install-non-module-file) endef # Cleanup rule for after debug java run (hotspot.log file is left around) @@ -712,7 +788,7 @@ else endif # Install of imported file (JDK_IMPORT_PATH, or some other external location) -define install-import-file +define install-importonly-file @$(ECHO) "ASSEMBLY_IMPORT: $@" $(prep-target) $(CP) $< $@ @@ -730,4 +806,9 @@ $(CP) $< $@ fi endef +define install-import-file +$(install-importonly-file) +$(install-module-file) +endef + .PHONY: all build clean clobber diff --git a/jdk/make/common/Demo.gmk b/jdk/make/common/Demo.gmk index 12a3ce105e4..26b8ea221ec 100644 --- a/jdk/make/common/Demo.gmk +++ b/jdk/make/common/Demo.gmk @@ -25,6 +25,8 @@ # JDK Demo building jar file. +MODULE = demos + # Some names are defined with LIBRARY inside the Defs.gmk file LIBRARY=$(DEMONAME) OBJDIR=$(TEMPDIR)/$(DEMONAME) diff --git a/jdk/make/common/Library.gmk b/jdk/make/common/Library.gmk index 22b9bc4f324..b95f43d7ef7 100644 --- a/jdk/make/common/Library.gmk +++ b/jdk/make/common/Library.gmk @@ -193,9 +193,18 @@ ifdef MT $(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2 endif $(CP) $(OBJDIR)/$(@F) $@ + $(install-module-file) $(CP) $(OBJDIR)/$(LIBRARY).map $(@D) $(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D) +$(ACTUAL_LIBRARY):: $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).map $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).pdb + +$(ACTUAL_LIBRARY_DIR)/%.map: FORCE + $(install-module-file) + +$(ACTUAL_LIBRARY_DIR)/%.pdb: FORCE + $(install-module-file) + endif # LIBRARY $(OBJDIR)/$(LIBRARY).lcf: $(OBJDIR)/$(LIBRARY).res $(COMPILE_FILES_o) $(FILES_m) @@ -250,6 +259,7 @@ ifeq ($(LIBRARY), fdlibm) $(AR) -r $@ $(FILES_o) else # LIBRARY $(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS) + $(install-module-file) ifeq ($(WRITE_LIBVERSION),true) $(MCS) -d -a "$(FULL_VERSION)" $@ endif # WRITE_LIBVERSION @@ -353,5 +363,7 @@ fastdebug: openjdk: $(MAKE) OPENJDK=true build +FORCE: + .PHONY: all build debug fastdebug diff --git a/jdk/make/common/Modules.gmk b/jdk/make/common/Modules.gmk index d277a11920a..a8dc72a5439 100644 --- a/jdk/make/common/Modules.gmk +++ b/jdk/make/common/Modules.gmk @@ -34,12 +34,10 @@ JRE_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jre-module-image # # Open issues that need further investigation: # 1. Classes in jre/lib/ext/dnsns.jar are currently put in jre/lib/jndi-dns -# module. +# module. META-INF/services file is not installed. # 2. Signed jars # For JDK build, signed jars are copied to the build. # All jars in the module image are unsigned. -# 3. jre/lib/security/US_export_policy.jar and local_policy.jar -# are not included in the module image yet. MODULE_IMAGEBINDIR = bin @@ -63,7 +61,8 @@ process-module-image-jre process-module-image-jdk :: @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." # Order is important here, trim jre after jdk image is created -modules:: sanity-module-images post-sanity-module-images \ +modules:: gen-modules \ + sanity-module-images post-sanity-module-images \ $(INITIAL_MODULE_IMAGE_JRE) $(INITIAL_MODULE_IMAGE_JDK) \ trim-module-image-jre trim-module-image-jdk \ process-module-image-jre process-module-image-jdk @@ -124,6 +123,33 @@ endif MODULES_TEMPDIR=$(ABS_TEMPDIR)/modules MODULES_LIB = $(ABS_OUTPUTDIR)/modules +MODULES_LIST = $(MODULES_TEMPDIR)/classlist/modules.list + +# Modules in the jre/lib/security directory +POLICY_MODULES = US_export_policy local_policy + +# Modules in the modules/ext directory +EXT_MODULES = localedata security-sunec security-sunjce + +# Build PKCS#11 on all platforms except 64-bit Windows. +PKCS11 = security-sunpkcs11 +ifeq ($(ARCH_DATA_MODEL), 64) + ifeq ($(PLATFORM), windows) + PKCS11 = + endif +endif + +EXT_MODULES += $(PKCS11) + +# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform. +ifeq ($(PLATFORM), windows) + ifneq ($(ARCH_DATA_MODEL), 64) + EXT_MODULES += security-sunmscapi + endif +endif + +# Modules for JDK only +JDK_MODULES = tools gen-modules: $(CD) modules; $(MAKE) all @@ -151,7 +177,6 @@ initial-module-image-jre-sol64:: initial-module-image-jre-setup \ # Construct an initial jre image (initial jdk jre) no trimming or stripping initial-module-image-jre:: initial-module-image-jre-setup \ $(JRE_LICENSES) $(JRE_MODULE_DOCFILES) \ - gen-modules \ $(BUILDMETAINDEX_JARFILE) @# Copy in bin directory $(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR) @@ -162,7 +187,21 @@ initial-module-image-jre:: initial-module-image-jre-setup \ @# @# copy modules to jre/lib @# - $(CP) -rf $(MODULES_LIB)/jre/lib/* $(JRE_MODULE_IMAGE_DIR)/lib + for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ + $(CP) $(MODULES_LIB)/$$m/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib ; \ + done + $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/ext + for m in $(EXT_MODULES) ; do \ + $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/ext ; \ + done + for m in $(POLICY_MODULES) ; do \ + $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/security; \ + done + @# Remove jdk modules + for m in $(JDK_MODULES) ; do \ + $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar ; \ + done + @# Make sure all directories are read/execute for everyone $(CHMOD) a+rx `$(FIND) $(JRE_MODULE_IMAGE_DIR) -type d` @# Remove some files from the jre area @@ -304,7 +343,9 @@ initial-module-image-jdk:: initial-module-image-jdk-setup \ @# copy jdk modules to jdk/lib @# $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/lib - $(CP) -rf $(MODULES_LIB)/lib/* $(JDK_MODULE_IMAGE_DIR)/lib + for m in $(JDK_MODULES) ; do \ + $(CP) $(MODULES_LIB)/$$m/lib/$$m.jar $(JDK_MODULE_IMAGE_DIR)/lib ; \ + done ifeq ($(PLATFORM), windows) @# @# lib/ diff --git a/jdk/make/common/Program.gmk b/jdk/make/common/Program.gmk index 091ec95f809..7cae90fb10f 100644 --- a/jdk/make/common/Program.gmk +++ b/jdk/make/common/Program.gmk @@ -50,8 +50,6 @@ ACTUAL_PROGRAM_NAME = $(PROGRAM)$(EXE_SUFFIX) ACTUAL_PROGRAM_DIR = $(BINDIR) ACTUAL_PROGRAM = $(ACTUAL_PROGRAM_DIR)/$(ACTUAL_PROGRAM_NAME) -JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg - # Make sure the default rule is all program_default_rule: all @@ -116,7 +114,7 @@ endif ifeq ($(COMPILE_IT),true) -$(ACTUAL_PROGRAM):: classes $(JVMCFG) $(INIT) +$(ACTUAL_PROGRAM):: classes $(INIT) # # Windows only @@ -190,12 +188,13 @@ $(ACTUAL_PROGRAM):: $(FILES_o) @$(MKDIR) -p $(TEMPDIR) $(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \ $(FILES_o) $(THREADLIBS) $(LDLIBS) + $(install-module-file) endif # PLATFORM else # COMPILE_IT -$(ACTUAL_PROGRAM):: $(JVMCFG) +$(ACTUAL_PROGRAM):: # Copies in the file from the JDK_IMPORT_PATH area $(ACTUAL_PROGRAM_DIR)/%: $(JDK_IMPORT_PATH)/jre/bin/% @@ -271,18 +270,6 @@ $(OBJDIR)/main.$(OBJECT_SUFFIX): $(LAUNCHER_SHARE_SRC)/bin/main.c $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$(OBJDIR)/main.$(OBJECT_SUFFIX) \ $(VERSION_DEFINES) $< -# -# How to install jvm.cfg. -# -ifeq ($(ZERO_BUILD), true) -JVMCFG_ARCH = zero -else -JVMCFG_ARCH = $(ARCH) -endif - -$(JVMCFG): $(LAUNCHER_PLATFORM_SRC)/bin/$(JVMCFG_ARCH)/jvm.cfg - $(install-file) - # # Default dependencies # diff --git a/jdk/make/common/internal/BinaryPlugs.gmk b/jdk/make/common/internal/BinaryPlugs.gmk index a77044af43c..96c7ba989bd 100644 --- a/jdk/make/common/internal/BinaryPlugs.gmk +++ b/jdk/make/common/internal/BinaryPlugs.gmk @@ -116,7 +116,7 @@ PLUG_IMPORT_JARFILE=$(BINARY_PLUGS_JARFILE) define import-binary-plug-file @$(ECHO) "PLUG IMPORT: $(@F)" -$(install-file) +$(install-non-module-file) endef # import-binary-plug-file # Import classes command @@ -184,7 +184,7 @@ PLUG_EXPORT_JARFILE=$(PLUG_EXPORT_DIR)/jre/lib/$(BINARY_PLUGS_JARNAME) define export-binary-plug-file @$(ECHO) "PLUG EXPORT: $(@F)" -$(install-file) +$(install-non-module-file) endef # export-binary-plug-file # OpenJDK Binary Plug License diff --git a/jdk/make/common/internal/Resources.gmk b/jdk/make/common/internal/Resources.gmk index a772194b471..dbbc4b561d8 100644 --- a/jdk/make/common/internal/Resources.gmk +++ b/jdk/make/common/internal/Resources.gmk @@ -139,7 +139,7 @@ STRIP_PROP_FILES = $(PROPERTIES_FILES:%=$(CLASSDESTDIR)/%) STRIP_PROP_options=$(TEMPDIR)/strip_prop_options define install-properties-file $(install-file) -$(CHMOD) a+rw $@ +$(call chmod-file, a+rw) @$(ECHO) "# Adding to strip properties list: $@" $(ECHO) "$@" >> $(STRIP_PROP_options) endef diff --git a/jdk/make/common/shared/Sanity.gmk b/jdk/make/common/shared/Sanity.gmk index e8b19c942eb..c19df0eb6ef 100644 --- a/jdk/make/common/shared/Sanity.gmk +++ b/jdk/make/common/shared/Sanity.gmk @@ -1117,7 +1117,7 @@ TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \ # be checked when this represents a full control build (i.e. the # HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory). $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h - @$(install-file) + @$(install-non-module-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \ @@ -1131,7 +1131,7 @@ $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h fi $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h - @$(install-file) + @$(install-non-module-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \ diff --git a/jdk/make/java/awt/Makefile b/jdk/make/java/awt/Makefile index e019a309d9f..f8c56732c3a 100644 --- a/jdk/make/java/awt/Makefile +++ b/jdk/make/java/awt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = java.awt PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/java/fdlibm/Makefile b/jdk/make/java/fdlibm/Makefile index 739eaf4403f..fcacf2d7106 100644 --- a/jdk/make/java/fdlibm/Makefile +++ b/jdk/make/java/fdlibm/Makefile @@ -31,6 +31,7 @@ # BUILDDIR = ../.. +MODULE = base LIBRARY = fdlibm PRODUCT = java diff --git a/jdk/make/java/hpi/native/Makefile b/jdk/make/java/hpi/native/Makefile index 7e9f2d2047c..79cafdcf82e 100644 --- a/jdk/make/java/hpi/native/Makefile +++ b/jdk/make/java/hpi/native/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = base LIBRARY = hpi PRODUCT = java THREADDIR = native_threads diff --git a/jdk/make/java/hpi/windows/Makefile b/jdk/make/java/hpi/windows/Makefile index b82d8853ab2..44d0501363a 100644 --- a/jdk/make/java/hpi/windows/Makefile +++ b/jdk/make/java/hpi/windows/Makefile @@ -26,8 +26,9 @@ # # Makefile for Windows HPI DLL # -BUILDDIR = ../../.. -LIBRARY = hpi +BUILDDIR = ../../.. +MODULE = base +LIBRARY = hpi PRODUCT = java THREADDIR = windows_threads LIB_LOCATION = $(BINDIR) diff --git a/jdk/make/java/instrument/Makefile b/jdk/make/java/instrument/Makefile index f46b3d10cc1..8b703afd920 100644 --- a/jdk/make/java/instrument/Makefile +++ b/jdk/make/java/instrument/Makefile @@ -27,6 +27,7 @@ # agent, supporting java.lang.instrument BUILDDIR = ../.. +MODULE = instrument PACKAGE = sun.instrument LIBRARY = instrument PRODUCT = sun diff --git a/jdk/make/java/java/Makefile b/jdk/make/java/java/Makefile index b0e40530f4e..e3d5ee4231c 100644 --- a/jdk/make/java/java/Makefile +++ b/jdk/make/java/java/Makefile @@ -29,6 +29,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = java.lang LIBRARY = java PRODUCT = java @@ -241,7 +242,7 @@ ifneq ($(PLATFORM),windows) $(GENSRCDIR)/java/lang/UNIXProcess.java: \ $(PLATFORM_SRC)/classes/java/lang/UNIXProcess.java.$(PLATFORM) - $(install-file) + $(install-non-module-file) clean:: $(RM) $(GENSRCDIR)/java/lang/UNIXProcess.java @@ -285,7 +286,7 @@ TZMAPFILE = $(PLATFORM_SRC)/lib/tzmappings $(TZMAP): $(TZMAPFILE) $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) endif build: $(LIBDIR)/$(PROPS) $(LIBDIR)/$(CAL_PROPS) $(TZMAP) @@ -315,7 +316,8 @@ $(CURDATA): \ $(BOOT_JAVA_CMD) -jar $(GENERATECURRENCYDATA_JARFILE) -o $@.temp \ < $(SHARE_SRC)/classes/java/util/CurrencyData.properties $(MV) $@.temp $@ - $(CHMOD) 444 $@ + $(install-module-file) + $(call chmod-file, 444) clean:: $(RM) $(CURDATA) @@ -369,7 +371,7 @@ $(GENSRCDIR)/java/lang/CharacterDataLatin1.java \ -usecharforbyte 11 4 1 $(GENSRCDIR)/java/lang/%.java : $(CHARACTERDATA)/%.java.template - $(install-file) + $(install-non-module-file) clean:: $(RM) $(GENSRCDIR)/java/lang/CharacterDataLatin1.java diff --git a/jdk/make/java/java_crw_demo/Makefile b/jdk/make/java/java_crw_demo/Makefile index 6c45bcbd499..4ee6467aa6d 100644 --- a/jdk/make/java/java_crw_demo/Makefile +++ b/jdk/make/java/java_crw_demo/Makefile @@ -24,6 +24,8 @@ # BUILDDIR = ../.. + +MODULE = demos LIBRARY = java_crw_demo PRODUCT = sun LIBRARY_OUTPUT = java_crw_demo diff --git a/jdk/make/java/java_hprof_demo/Makefile b/jdk/make/java/java_hprof_demo/Makefile index 4e1ef2a31a8..0826dd0213d 100644 --- a/jdk/make/java/java_hprof_demo/Makefile +++ b/jdk/make/java/java_hprof_demo/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = instrument LIBRARY = hprof PRODUCT = sun LIBRARY_OUTPUT = hprof_jvmti diff --git a/jdk/make/java/jli/Makefile b/jdk/make/java/jli/Makefile index 7aad6e9892d..98a7874402e 100644 --- a/jdk/make/java/jli/Makefile +++ b/jdk/make/java/jli/Makefile @@ -30,6 +30,7 @@ # its manifestations (java, javaw, javac, ...). # BUILDDIR = ../.. +MODULE = base LIBRARY = jli PRODUCT = java diff --git a/jdk/make/java/jvm/Makefile b/jdk/make/java/jvm/Makefile index 42b756309f4..ee992a1630b 100644 --- a/jdk/make/java/jvm/Makefile +++ b/jdk/make/java/jvm/Makefile @@ -24,6 +24,8 @@ # BUILDDIR = ../.. +MODULE = base + include $(BUILDDIR)/common/Defs.gmk # @@ -36,15 +38,29 @@ FILES_h = $(INCLUDEDIR)/jni.h \ $(INCLUDEDIR)/classfile_constants.h $(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h - $(install-file) + $(install-non-module-file) $(PLATFORM_INCLUDE)/%.h: $(PLATFORM_SRC)/javavm/export/%.h + $(install-non-module-file) + +JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg + +# +# How to install jvm.cfg. +# +ifeq ($(ZERO_BUILD), true) +JVMCFG_ARCH = zero +else +JVMCFG_ARCH = $(ARCH) +endif + +$(JVMCFG): $(PLATFORM_SRC)/bin/$(JVMCFG_ARCH)/jvm.cfg $(install-file) all: build -build: $(FILES_h) +build: $(FILES_h) $(JVMCFG) clean clobber:: - $(RM) $(FILES_h) + $(RM) $(FILES_h) $(JVMCFG) diff --git a/jdk/make/java/logging/Makefile b/jdk/make/java/logging/Makefile index 444c1c63b5a..2077c02a01b 100644 --- a/jdk/make/java/logging/Makefile +++ b/jdk/make/java/logging/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = logging PACKAGE = java.util.logging PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/java/main/java/Makefile b/jdk/make/java/main/java/Makefile index 37fdf2bdd0f..b24e9f0aaae 100644 --- a/jdk/make/java/main/java/Makefile +++ b/jdk/make/java/main/java/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = base PROGRAM = java PRODUCT = java diff --git a/jdk/make/java/main/javaw/Makefile b/jdk/make/java/main/javaw/Makefile index 7ebc218f669..cd81b3ae113 100644 --- a/jdk/make/java/main/javaw/Makefile +++ b/jdk/make/java/main/javaw/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = base PROGRAM = javaw PRODUCT = java diff --git a/jdk/make/java/management/Makefile b/jdk/make/java/management/Makefile index f579e10c105..17c778e938c 100644 --- a/jdk/make/java/management/Makefile +++ b/jdk/make/java/management/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = management PACKAGE = java.lang.management LIBRARY = management PRODUCT = java @@ -99,7 +100,7 @@ $(AGENTJAR): $(LIBDIR) $(TEMPDIR)/manifest @$(java-vm-cleanup) $(TEMPDIR)/manifest: $(MANIFEST) - $(install-file) + $(install-manifest-file) build: $(AGENTJAR) diff --git a/jdk/make/java/net/Makefile b/jdk/make/java/net/Makefile index 3c0985bcf9d..c714d0a61ac 100644 --- a/jdk/make/java/net/Makefile +++ b/jdk/make/java/net/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = java.net LIBRARY = net PRODUCT = sun @@ -111,8 +112,7 @@ LOCALE_SET_DEFINITION = jre MISC_FILES = $(LIBDIR) $(LIBDIR)/net.properties $(LIBDIR)/net.properties: $(SHARE_SRC)/lib/net.properties - @$(RM) $@ - $(CP) $< $@ + $(install-file) # # SDP configuration template diff --git a/jdk/make/java/nio/Makefile b/jdk/make/java/nio/Makefile index 455d7529f67..6dd15eac239 100644 --- a/jdk/make/java/nio/Makefile +++ b/jdk/make/java/nio/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = nio PACKAGE = java.nio LIBRARY = nio PRODUCT = java @@ -816,7 +817,7 @@ SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSOR_SRC) | \ $(NAWK) '/^.*Copyright.*Sun/ { print $$3 }') $(TEMPDIR)/$(GENSOR_SRC) : $(GENSOR_SRC) - $(install-file) + $(install-non-module-file) $(GENSOR_EXE) : $(TEMPDIR)/$(GENSOR_SRC) $(prep-target) diff --git a/jdk/make/java/npt/Makefile b/jdk/make/java/npt/Makefile index 57e6a663805..77afce633dd 100644 --- a/jdk/make/java/npt/Makefile +++ b/jdk/make/java/npt/Makefile @@ -24,6 +24,9 @@ # BUILDDIR = ../.. + +# It's currently used by jpda and hprof. Put it in base module for now. +MODULE = base LIBRARY = npt PRODUCT = sun LIBRARY_OUTPUT = npt diff --git a/jdk/make/java/redist/Makefile b/jdk/make/java/redist/Makefile index 69d95a60577..d66244920f3 100644 --- a/jdk/make/java/redist/Makefile +++ b/jdk/make/java/redist/Makefile @@ -35,6 +35,7 @@ # BUILDDIR = ../.. +MODULE = base PRODUCT = java include $(BUILDDIR)/common/Defs.gmk @@ -61,7 +62,11 @@ CLASSSHARINGDATA_DIR = $(BUILDDIR)/tools/sharing # Needed to do file copy ABS_BUILDDIR :=$(call FullPath,$(BUILDDIR)) -all: build +SUBDIRS = fonts sajdi +all clean clobber:: + $(SUBDIRS-loop) + +all:: build # List of files created here or coming from BUILDDIR area (this workspace) INTERNAL_IMPORT_LIST = $(LIBDIR)/classlist @@ -70,30 +75,6 @@ INTERNAL_IMPORT_LIST = $(LIBDIR)/classlist IMPORT_LIST = $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME) \ $(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt -# INCLUDE_SA is false on platforms where SA is not supported. -# On platforms where it is supported, we want to allow it to -# not be present, at least temporarily. So, -# if the SA files (well, just sa-jdi.jar) do not exist -# in the HOTSPOT_IMPORT_PATH, then we won't build SA. -SA_EXISTS := $(shell if [ -r $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \ - $(ECHO) true; \ - else \ - $(ECHO) false; \ - fi) - -ifeq ($(SA_EXISTS), false) - INCLUDE_SA := false -endif - -ifeq ($(INCLUDE_SA), true) - IMPORT_LIST += $(LIBDIR)/sa-jdi.jar \ - $(LIB_LOCATION)/$(SALIB_NAME) - ifeq ($(PLATFORM), windows) - IMPORT_LIST += $(LIB_LOCATION)/$(SAMAP_NAME) \ - $(LIB_LOCATION)/$(SAPDB_NAME) - endif -endif # INCLUDE_SA - # Hotspot client is only available on 32-bit non-Zero builds ifneq ($(ZERO_BUILD), true) ifeq ($(ARCH_DATA_MODEL), 32) @@ -110,10 +91,10 @@ IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%) # NOTE: These might actually come from BUILDDIR, depends on the settings. $(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll $(install-import-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) $(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(install-import-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) # Get the hotspot .map and .pdb files for client and server IMPORT_LIST += \ @@ -140,26 +121,32 @@ $(LIBDIR)/$(JVMLIB_NAME): $(HOTSPOT_LIB_PATH)/$(JVMLIB_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMMAP_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMPDB_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMPDB_NAME) $@ + @$(install-module-file) # Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Windows else # PLATFORM @@ -220,7 +207,7 @@ $(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJ $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME) \ $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME): @$(prep-target) - $(LN) -s ../$(LIBJSIG_NAME) $@ + $(call install-sym-link, ../$(LIBJSIG_NAME)) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_NAME) $(install-import-file) @@ -246,28 +233,6 @@ $(LIB_LOCATION)/$(CLIENT_LOCATION)/Xusage.txt : $(HOTSPOT_CLIENT_PATH)/Xusage.tx $(LIB_LOCATION)/$(KERNEL_LOCATION)/Xusage.txt : $(HOTSPOT_KERNEL_PATH)/Xusage.txt $(install-file) -ifeq ($(INCLUDE_SA), true) -# The Serviceability Agent is built in the Hotspot workspace. -# It contains two files: -# - sa-jdi.jar: This goes into the same dir as tools.jar. -# - a shared library: sawindbg.dll on windows / libproc.sa on unix -# This goes into the same dir as the other -# shared libs, eg. libjdwp.so. -$(LIBDIR)/sa-jdi.jar: $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar - $(install-import-file) - -$(LIB_LOCATION)/$(SALIB_NAME): $(HOTSPOT_SALIB_PATH)/$(SALIB_NAME) - $(install-import-file) - -ifeq ($(PLATFORM), windows) -$(LIB_LOCATION)/$(SAPDB_NAME): $(HOTSPOT_SALIB_PATH)/$(SAPDB_NAME) - $(install-import-file) - -$(LIB_LOCATION)/$(SAMAP_NAME): $(HOTSPOT_SALIB_PATH)/$(SAMAP_NAME) - $(install-import-file) -endif # windows -endif # INCLUDE_SA - # # Specific to OpenJDK building # @@ -288,7 +253,7 @@ INTERNAL_IMPORT_LIST += \ $(LIBDIR)/jce.jar: \ $(BUILDDIR)/closed/tools/crypto/jce/jce.jar - $(install-file) + $(install-non-module-file) $(LIBDIR)/security/US_export_policy.jar: \ $(BUILDDIR)/closed/tools/crypto/jce/US_export_policy.jar $(install-file) @@ -310,46 +275,6 @@ $(LIBDIR)/classlist: \ $(CLASSSHARINGDATA_DIR)/classlist.$(PLATFORM) $@.temp $(MV) $@.temp $@ -ifndef OPENJDK - -# Lucida font files are not included in the OpenJDK distribution. -# Get names of font files -include FILES.gmk - -# Copy font files into OUTPUTDIR area - -FONTFILES = $(SHARED_FONTFILES) -FONTSDIR = $(LIBDIR)/fonts -FONTSDIRFILE = $(FONTSDIR)/fonts.dir -INTERNAL_IMPORT_LIST += $(FONTFILES) - -ifneq ($(PLATFORM), windows) - INTERNAL_IMPORT_LIST += $(FONTSDIRFILE) -endif - -$(LIBDIR)/fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/%.ttf - $(install-file) - -$(FONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.fonts.dir - $(install-file) - -ifeq ($(PLATFORM), linux) - -# The oblique fonts are only needed/wanted on Linux. - -OBLFONTSDIR = $(LIBDIR)/oblique-fonts -OBLFONTSDIRFILE = $(OBLFONTSDIR)/fonts.dir -INTERNAL_IMPORT_LIST += $(OBLIQUE_FONTFILES) $(OBLFONTSDIRFILE) - -$(LIBDIR)/oblique-fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/oblique/%.ttf - $(install-file) - -$(OBLFONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.oblique-fonts.dir - $(install-file) - -endif # linux -endif # !OPENJDK - # Import internal files (ones that are stashed in this source tree) import_internal_files : $(INTERNAL_IMPORT_LIST) diff --git a/jdk/make/java/redist/FILES.gmk b/jdk/make/java/redist/fonts/Makefile similarity index 65% rename from jdk/make/java/redist/FILES.gmk rename to jdk/make/java/redist/fonts/Makefile index a90da603f4a..263d9b25c0e 100644 --- a/jdk/make/java/redist/FILES.gmk +++ b/jdk/make/java/redist/fonts/Makefile @@ -1,5 +1,5 @@ # -# Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,12 @@ # have any questions. # +BUILDDIR = ../../.. +MODULE = font +PRODUCT = java +include $(BUILDDIR)/common/Defs.gmk + + # # List of lucida font files that we redistribute. # @@ -54,3 +60,52 @@ OBLIQUE_FONTFILES = \ $(LIBDIR)/oblique-fonts/LucidaSansDemiOblique.ttf \ endif + +ifndef OPENJDK + +# Lucida font files are not included in the OpenJDK distribution. +# Get names of font files + +# Copy font files into OUTPUTDIR area + +FONTFILES = $(SHARED_FONTFILES) +FONTSDIR = $(LIBDIR)/fonts +FONTSDIRFILE = $(FONTSDIR)/fonts.dir +INTERNAL_IMPORT_LIST = $(FONTFILES) + +ifneq ($(PLATFORM), windows) + INTERNAL_IMPORT_LIST += $(FONTSDIRFILE) +endif + +$(LIBDIR)/fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/%.ttf + $(install-file) + +$(FONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.fonts.dir + $(install-file) + +ifeq ($(PLATFORM), linux) + +# The oblique fonts are only needed/wanted on Linux. + +OBLFONTSDIR = $(LIBDIR)/oblique-fonts +OBLFONTSDIRFILE = $(OBLFONTSDIR)/fonts.dir +INTERNAL_IMPORT_LIST += $(OBLIQUE_FONTFILES) $(OBLFONTSDIRFILE) + +$(LIBDIR)/oblique-fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/oblique/%.ttf + $(install-file) + +$(OBLFONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.oblique-fonts.dir + $(install-file) + +endif # linux + +all build : $(INTERNAL_IMPORT_LIST) + +clean clobber:: + $(RM) $(INTERNAL_IMPORT_LIST) + +else + +all build clean clobber : + +endif # !OPENJDK diff --git a/jdk/make/java/redist/sajdi/Makefile b/jdk/make/java/redist/sajdi/Makefile new file mode 100644 index 00000000000..7117763e299 --- /dev/null +++ b/jdk/make/java/redist/sajdi/Makefile @@ -0,0 +1,87 @@ +# +# Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +BUILDDIR = ../../.. +MODULE = sajdi +PRODUCT = java +include $(BUILDDIR)/common/Defs.gmk + +ifeq ($(PLATFORM), windows) + LIB_LOCATION = $(BINDIR) +else + LIB_LOCATION = $(LIBDIR)/$(LIBARCH) +endif + +# INCLUDE_SA is false on platforms where SA is not supported. +# On platforms where it is supported, we want to allow it to +# not be present, at least temporarily. So, +# if the SA files (well, just sa-jdi.jar) do not exist +# in the HOTSPOT_IMPORT_PATH, then we won't build SA. +SA_EXISTS := $(shell if [ -r $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \ + $(ECHO) true; \ + else \ + $(ECHO) false; \ + fi) + +ifeq ($(SA_EXISTS), false) + INCLUDE_SA := false +endif + +IMPORT_LIST = +ifeq ($(INCLUDE_SA), true) + IMPORT_LIST += $(LIBDIR)/sa-jdi.jar \ + $(LIB_LOCATION)/$(SALIB_NAME) + ifeq ($(PLATFORM), windows) + IMPORT_LIST += $(LIB_LOCATION)/$(SAMAP_NAME) \ + $(LIB_LOCATION)/$(SAPDB_NAME) + endif +endif # INCLUDE_SA + + +ifeq ($(INCLUDE_SA), true) +# The Serviceability Agent is built in the Hotspot workspace. +# It contains two files: +# - sa-jdi.jar: This goes into the same dir as tools.jar. +# - a shared library: sawindbg.dll on windows / libproc.sa on unix +# This goes into the same dir as the other +# shared libs, eg. libjdwp.so. +$(LIBDIR)/sa-jdi.jar: $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar + $(install-importonly-file) + +$(LIB_LOCATION)/$(SALIB_NAME): $(HOTSPOT_SALIB_PATH)/$(SALIB_NAME) + $(install-import-file) + +ifeq ($(PLATFORM), windows) +$(LIB_LOCATION)/$(SAPDB_NAME): $(HOTSPOT_SALIB_PATH)/$(SAPDB_NAME) + $(install-import-file) + +$(LIB_LOCATION)/$(SAMAP_NAME): $(HOTSPOT_SALIB_PATH)/$(SAMAP_NAME) + $(install-import-file) +endif # windows +endif # INCLUDE_SA + +all: $(IMPORT_LIST) + +clean clobber:: diff --git a/jdk/make/java/security/Makefile b/jdk/make/java/security/Makefile index 5da905a698d..8228eea85db 100644 --- a/jdk/make/java/security/Makefile +++ b/jdk/make/java/security/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = java.security PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -38,11 +39,9 @@ AUTO_FILES_JAVA_DIRS = java/security # PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security -SUNPKCS11 = ifeq ($(PLATFORM), solaris) PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris -SUNPKCS11 = sunpkcs11 else # PLATFORM @@ -57,9 +56,6 @@ endif # PLATFORM PROPS_BUILD = $(LIBDIR)/security/java.security -SUNPKCS11_SRC = $(TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg -SUNPKCS11_BUILD = $(LIBDIR)/security/sunpkcs11-solaris.cfg - POLICY_SRC = $(TOPDIR)/src/share/lib/security/java.policy POLICY_BUILD = $(LIBDIR)/security/java.policy @@ -73,14 +69,12 @@ FILES_class = $(FILES_java:%.java=$(CLASSBINDIR)/%.class) # include $(BUILDDIR)/common/Rules.gmk -build: properties $(SUNPKCS11) policy cacerts +build: properties policy cacerts install: all properties: classes $(PROPS_BUILD) -sunpkcs11: classes $(SUNPKCS11_BUILD) - policy: classes $(POLICY_BUILD) cacerts: classes $(CACERTS_BUILD) @@ -88,9 +82,6 @@ cacerts: classes $(CACERTS_BUILD) $(PROPS_BUILD): $(PROPS_SRC) $(install-file) -$(SUNPKCS11_BUILD): $(SUNPKCS11_SRC) - $(install-file) - $(POLICY_BUILD): $(POLICY_SRC) $(install-file) @@ -99,7 +90,7 @@ $(CACERTS_BUILD): $(CACERTS_SRC) clean clobber:: .delete.classlist $(RM) -r $(CLASSBINDIR)/java/security - $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(SUNPKCS11_BUILD) + $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) # Additional Rule for building sun.security.util $(CLASSBINDIR)/%.class: $(SHARE_SRC)/sun/%.java diff --git a/jdk/make/java/sql/Makefile b/jdk/make/java/sql/Makefile index 61e8047227b..62ce4b726e6 100644 --- a/jdk/make/java/sql/Makefile +++ b/jdk/make/java/sql/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jdbc-base PACKAGE = java.sql PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/java/text/Makefile b/jdk/make/java/text/Makefile index 4db338926f3..001f4717a9e 100644 --- a/jdk/make/java/text/Makefile +++ b/jdk/make/java/text/Makefile @@ -24,7 +24,7 @@ # BUILDDIR = ../.. - +MODULE = base PACKAGE = java.text PRODUCT = sun diff --git a/jdk/make/java/verify/Makefile b/jdk/make/java/verify/Makefile index 24bcc0f48d4..783dd2c55c7 100644 --- a/jdk/make/java/verify/Makefile +++ b/jdk/make/java/verify/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = base PRODUCT = java LIBRARY = verify include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/java/zip/Makefile b/jdk/make/java/zip/Makefile index cec9d0d6cf1..809753050e1 100644 --- a/jdk/make/java/zip/Makefile +++ b/jdk/make/java/zip/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../.. +MODULE = base PACKAGE = java.util.zip LIBRARY = zip PRODUCT = sun diff --git a/jdk/make/javax/crypto/Makefile b/jdk/make/javax/crypto/Makefile index fe07ed5edf7..19a00a5e197 100644 --- a/jdk/make/javax/crypto/Makefile +++ b/jdk/make/javax/crypto/Makefile @@ -108,6 +108,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = javax.crypto PRODUCT = sun @@ -293,7 +294,7 @@ limited: \ $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \ $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar - $(install-file) + $(install-non-module-file) $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \ policy/limited/default_local.policy \ @@ -414,7 +415,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/jce.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/jce.jar endif - $(install-file) + $(install-non-module-file) # # Install the appropriate policy file, depending on the type of build. @@ -425,7 +426,7 @@ else INSTALL_POLICYDIR = $(SIGNED_POLICY_BUILDDIR) endif -install-limited: \ +install-limited-jars: \ $(INSTALL_POLICYDIR)/limited/US_export_policy.jar \ $(INSTALL_POLICYDIR)/limited/local_policy.jar $(MKDIR) -p $(POLICY_DESTDIR) @@ -433,24 +434,28 @@ install-limited: \ $(POLICY_DESTDIR)/US_export_policy.jar \ $(POLICY_DESTDIR)/local_policy.jar $(CP) $^ $(POLICY_DESTDIR) + +install-limited: install-limited-jars install-module-files ifndef OPENJDK $(release-warning) endif -install-unlimited: \ +install-unlimited-jars: \ $(INSTALL_POLICYDIR)/unlimited/US_export_policy.jar \ - $(INSTALL_POLICYDIR)/unlimited/local_policy.jar + $(INSTALL_POLICYDIR)/unlimited/local_policy.jar $(MKDIR) -p $(POLICY_DESTDIR) $(RM) \ $(POLICY_DESTDIR)/US_export_policy.jar \ $(POLICY_DESTDIR)/local_policy.jar $(CP) $^ $(POLICY_DESTDIR) + +install-unlimited: install-unlimited-jars install-module-files ifndef OPENJDK $(release-warning) endif ifndef OPENJDK -install-prebuilt: +install-prebuilt-jars: @$(ECHO) "\n>>>Installing prebuilt JCE framework..." $(RM) $(JAR_DESTFILE) \ $(POLICY_DESTDIR)/US_export_policy.jar \ @@ -460,8 +465,16 @@ install-prebuilt: $(PREBUILT_DIR)/jce/US_export_policy.jar \ $(PREBUILT_DIR)/jce/local_policy.jar \ $(POLICY_DESTDIR) + +install-prebuilt: install-prebuilt-jars install-module-files endif +install-module-files: \ + $(POLICY_DESTDIR)/US_export_policy.jar \ + $(POLICY_DESTDIR)/local_policy.jar + +$(POLICY_DESTDIR)/%.jar : + $(install-module-file) # ===================================================== # Support routines. diff --git a/jdk/make/javax/imageio/Makefile b/jdk/make/javax/imageio/Makefile index b3f75d18181..62f3b1b65ed 100644 --- a/jdk/make/javax/imageio/Makefile +++ b/jdk/make/javax/imageio/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = imageio PACKAGE = javax.imageio PRODUCT = jiio include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/javax/print/Makefile b/jdk/make/javax/print/Makefile index b3652f8368e..639dc148556 100644 --- a/jdk/make/javax/print/Makefile +++ b/jdk/make/javax/print/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = print PACKAGE = javax.print PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/javax/sound/Makefile b/jdk/make/javax/sound/Makefile index d2d1e736aea..8b4948a15e1 100644 --- a/jdk/make/javax/sound/Makefile +++ b/jdk/make/javax/sound/Makefile @@ -26,6 +26,7 @@ # WARNING: Make sure the OPENJDK plugs are up-to-date, see make/common/internal/BinaryPlugs.gmk BUILDDIR = ../.. +MODULE = sound PACKAGE = javax.sound LIBRARY = jsound PRODUCT = sun diff --git a/jdk/make/javax/sound/jsoundalsa/Makefile b/jdk/make/javax/sound/jsoundalsa/Makefile index 6fdde65ee5c..15b215fe6b2 100644 --- a/jdk/make/javax/sound/jsoundalsa/Makefile +++ b/jdk/make/javax/sound/jsoundalsa/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = sound PACKAGE = javax.sound LIBRARY = jsoundalsa PRODUCT = sun diff --git a/jdk/make/javax/sound/jsoundds/Makefile b/jdk/make/javax/sound/jsoundds/Makefile index 5dcd336c935..5da3ee7bf77 100644 --- a/jdk/make/javax/sound/jsoundds/Makefile +++ b/jdk/make/javax/sound/jsoundds/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = sound PACKAGE = javax.sound LIBRARY = jsoundds PRODUCT = sun diff --git a/jdk/make/javax/sql/Makefile b/jdk/make/javax/sql/Makefile index 9edaff36f5c..deac8ea2399 100644 --- a/jdk/make/javax/sql/Makefile +++ b/jdk/make/javax/sql/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jdbc-enterprise PACKAGE = javax.sql PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/javax/swing/Makefile b/jdk/make/javax/swing/Makefile index 1f3fa6c0f39..16bfcac03ab 100644 --- a/jdk/make/javax/swing/Makefile +++ b/jdk/make/javax/swing/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = swing PACKAGE = javax.swing PRODUCT = com SWING_SRC = $(SHARE_SRC)/classes/javax/swing diff --git a/jdk/make/javax/swing/plaf/Makefile b/jdk/make/javax/swing/plaf/Makefile index c0c5ebecc70..2ef72c8b4c1 100644 --- a/jdk/make/javax/swing/plaf/Makefile +++ b/jdk/make/javax/swing/plaf/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = swing PACKAGE = javax.swing.plaf PRODUCT = com SWING_SRC = $(SHARE_SRC)/classes/javax/swing diff --git a/jdk/make/jpda/back/Makefile b/jdk/make/jpda/back/Makefile index 5237d9c798c..e2e073f31a6 100644 --- a/jdk/make/jpda/back/Makefile +++ b/jdk/make/jpda/back/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = debugging LIBRARY = jdwp PRODUCT = jpda diff --git a/jdk/make/jpda/transport/Makefile b/jdk/make/jpda/transport/Makefile index 8e507eab596..9069032fa6e 100644 --- a/jdk/make/jpda/transport/Makefile +++ b/jdk/make/jpda/transport/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = debugging PRODUCT = jpda include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/jpda/transport/shmem/Makefile b/jdk/make/jpda/transport/shmem/Makefile index fcc8c632de4..36d1d7fe861 100644 --- a/jdk/make/jpda/transport/shmem/Makefile +++ b/jdk/make/jpda/transport/shmem/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = debugging LIBRARY = dt_shmem PRODUCT = jbug diff --git a/jdk/make/jpda/transport/socket/Makefile b/jdk/make/jpda/transport/socket/Makefile index 65f8018477f..d48d0327524 100644 --- a/jdk/make/jpda/transport/socket/Makefile +++ b/jdk/make/jpda/transport/socket/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = debugging LIBRARY = dt_socket PRODUCT = jbug diff --git a/jdk/make/jpda/tty/Makefile b/jdk/make/jpda/tty/Makefile index 4468bddbeb3..1706aba1641 100644 --- a/jdk/make/jpda/tty/Makefile +++ b/jdk/make/jpda/tty/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jdb PACKAGE = com.sun.tools.example.debug.tty PRODUCT = jpda PROGRAM = jdb diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index e9f949c1b28..c9d32b9d207 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -28,33 +28,23 @@ # BUILDDIR = .. +MODULE = tools PACKAGE = launchers PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk -# Run MAKE $@ for a launcher: +# Run MAKE $@ for a launcher for the corba module: # $(call make-launcher, name, mainclass, java-args, main-args) -define make-launcher +define make-corba-launcher +$(CD) $(BUILDDIR)/launchers && \ $(MAKE) -f Makefile.launcher \ - PROGRAM=$(strip $1) \ - MAIN_CLASS=$(strip $2) \ - MAIN_JAVA_ARGS="$(strip $3)" \ - MAIN_ARGS="$(strip $4)" $@ + MODULE=corba \ + PROGRAM=$(strip $1) \ + MAIN_CLASS=$(strip $2) \ + MAIN_JAVA_ARGS="$(strip $3)" \ + MAIN_ARGS="$(strip $4)" endef -# Run MAKE $@ for all launchers -ifeq ($(PLATFORM),windows) -# Run MAKE $@ for all platform specific launchers -define make-platform-specific-launchers -$(call make-launcher, kinit, sun.security.krb5.internal.tools.Kinit, , ) -$(call make-launcher, klist, sun.security.krb5.internal.tools.Klist, , ) -$(call make-launcher, ktab, sun.security.krb5.internal.tools.Ktab, , ) -endef -else -# Run MAKE $@ for all platform specific launchers -define make-platform-specific-launchers -endef -endif # Run MAKE $@ for all generic launchers define make-all-launchers $(call make-launcher, appletviewer, sun.applet.Main, , ) @@ -85,36 +75,29 @@ $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jstat, sun.tools.jstat.Jstat, , ) $(call make-launcher, jstatd, sun.tools.jstatd.Jstatd, , ) -$(call make-launcher, keytool, sun.security.tools.KeyTool, , ) $(call make-launcher, native2ascii, sun.tools.native2ascii.Main, , ) -$(call make-launcher, orbd, com.sun.corba.se.impl.activation.ORBD, \ +$(call make-launcher, rmic, sun.rmi.rmic.Main, , ) +$(call make-launcher, schemagen, com.sun.tools.internal.jxc.SchemaGenerator, , ) +$(call make-launcher, serialver, sun.tools.serialver.SerialVer, , ) +$(call make-launcher, xjc, com.sun.tools.internal.xjc.Driver, , ) +$(call make-launcher, wsgen, com.sun.tools.internal.ws.WsGen, , ) +$(call make-launcher, wsimport, com.sun.tools.internal.ws.WsImport, , ) +$(call make-corba-launcher, orbd, com.sun.corba.se.impl.activation.ORBD, \ -J-Dcom.sun.CORBA.activation.DbDir=./orb.db \ -J-Dcom.sun.CORBA.activation.Port=1049 \ -J-Dcom.sun.CORBA.POA.ORBServerId=1, ) -$(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack) -$(call make-launcher, policytool, sun.security.tools.PolicyTool, , ) -$(call make-launcher, rmic, sun.rmi.rmic.Main, , ) -$(call make-launcher, rmid, sun.rmi.server.Activation, , ) -$(call make-launcher, rmiregistry, sun.rmi.registry.RegistryImpl, , ) -$(call make-launcher, schemagen, com.sun.tools.internal.jxc.SchemaGenerator, , ) -$(call make-launcher, serialver, sun.tools.serialver.SerialVer, , ) -$(call make-launcher, servertool, com.sun.corba.se.impl.activation.ServerTool, , ) -$(call make-launcher, tnameserv, com.sun.corba.se.impl.naming.cosnaming.TransientNameServer, \ +$(call make-corba-launcher, servertool, com.sun.corba.se.impl.activation.ServerTool, , ) +$(call make-corba-launcher, tnameserv, com.sun.corba.se.impl.naming.cosnaming.TransientNameServer, \ -J-Dcom.sun.CORBA.activation.DbDir=./orb.db \ -J-Djava.util.logging.LoggingPermission=contol \ -J-Dcom.sun.CORBA.POA.ORBServerId=1, ) -$(call make-launcher, wsgen, com.sun.tools.internal.ws.WsGen, , ) -$(call make-launcher, wsimport, com.sun.tools.internal.ws.WsImport, , ) -$(call make-launcher, xjc, com.sun.tools.internal.xjc.Driver, , ) endef build: $(make-all-launchers) - $(make-platform-specific-launchers) clean clobber:: $(make-all-launchers) - $(make-platform-specific-launchers) include $(BUILDDIR)/common/Rules.gmk diff --git a/jdk/make/mkdemo/jvmti/Makefile b/jdk/make/mkdemo/jvmti/Makefile index 592413087f1..749068b909d 100644 --- a/jdk/make/mkdemo/jvmti/Makefile +++ b/jdk/make/mkdemo/jvmti/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = demos PRODUCT = demos include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mkdemo/management/Makefile b/jdk/make/mkdemo/management/Makefile index b021ddd1eb0..e80b30afe0c 100644 --- a/jdk/make/mkdemo/management/Makefile +++ b/jdk/make/mkdemo/management/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = demos PRODUCT = demos include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/dtrace/Makefile b/jdk/make/mksample/dtrace/Makefile index 056f0b29f73..dbe1eed8159 100644 --- a/jdk/make/mksample/dtrace/Makefile +++ b/jdk/make/mksample/dtrace/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/jmx/jmx-scandir/Makefile b/jdk/make/mksample/jmx/jmx-scandir/Makefile index b32a4191750..5c06efce7dd 100644 --- a/jdk/make/mksample/jmx/jmx-scandir/Makefile +++ b/jdk/make/mksample/jmx/jmx-scandir/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/nbproject/Makefile b/jdk/make/mksample/nbproject/Makefile index abc326c9000..6543282c220 100644 --- a/jdk/make/mksample/nbproject/Makefile +++ b/jdk/make/mksample/nbproject/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/nio/file/Makefile b/jdk/make/mksample/nio/file/Makefile index f7159de83a3..3181339e180 100644 --- a/jdk/make/mksample/nio/file/Makefile +++ b/jdk/make/mksample/nio/file/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/nio/multicast/Makefile b/jdk/make/mksample/nio/multicast/Makefile index 179d3d4a97c..7e794c90539 100644 --- a/jdk/make/mksample/nio/multicast/Makefile +++ b/jdk/make/mksample/nio/multicast/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/nio/server/Makefile b/jdk/make/mksample/nio/server/Makefile index a776fa98fb3..3eced2d38ba 100644 --- a/jdk/make/mksample/nio/server/Makefile +++ b/jdk/make/mksample/nio/server/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/scripting/scriptpad/Makefile b/jdk/make/mksample/scripting/scriptpad/Makefile index 8918764ed5e..bd9009aa954 100644 --- a/jdk/make/mksample/scripting/scriptpad/Makefile +++ b/jdk/make/mksample/scripting/scriptpad/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/webservices/EbayClient/Makefile b/jdk/make/mksample/webservices/EbayClient/Makefile index 541bd14d4f4..16f42d214fc 100644 --- a/jdk/make/mksample/webservices/EbayClient/Makefile +++ b/jdk/make/mksample/webservices/EbayClient/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/mksample/webservices/EbayServer/Makefile b/jdk/make/mksample/webservices/EbayServer/Makefile index a0481cdedb9..6cbe9f06235 100644 --- a/jdk/make/mksample/webservices/EbayServer/Makefile +++ b/jdk/make/mksample/webservices/EbayServer/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/modules/Makefile b/jdk/make/modules/Makefile index 039682e871a..60dcd6ff395 100644 --- a/jdk/make/modules/Makefile +++ b/jdk/make/modules/Makefile @@ -40,32 +40,7 @@ MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp TMP=$(ABS_TEMPDIR)/modules MODULE_CLASSLIST = $(TMP)/classlist MODULE_CLASSES = $(TMP)/classes -MODULE_LIST = $(MODULE_CLASSLIST)/modules.list - -# Modules in the modules/ext directory -EXT_MODULES = localedata security-sunec security-sunjce - -# Build PKCS#11 on all platforms except 64-bit Windows. -# We exclude windows-amd64 because we don't have any -# 64-bit PKCS#11 implementations to test with on that platform. -PKCS11 = security-sunpkcs11 -ifeq ($(ARCH_DATA_MODEL), 64) - ifeq ($(PLATFORM), windows) - PKCS11 = - endif -endif - -EXT_MODULES += $(PKCS11) - -# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform. -ifeq ($(PLATFORM), windows) - ifneq ($(ARCH_DATA_MODEL), 64) - EXT_MODULES += security-sunmscapi - endif -endif - - -JDK_MODULES = tools +MODULES_LIST = $(MODULE_CLASSLIST)/modules.list SUBDIRS = tools all build clean clobber:: @@ -76,7 +51,7 @@ all:: unpack-jars gen-classlist modularize $(CLASSANALYZER_JAR): $(CD) tools && $(MAKE) all -JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -depth) +JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print) unpack-jars: $(RM) -rf $(MODULE_CLASSES) $(MKDIR) -p $(MODULE_CLASSES) @@ -107,31 +82,29 @@ gen-classlist: $(CLASSANALYZER_JAR) modularize: $(MODULE_JAR_MANIFEST_FILE) @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." @$(RM) -rf $(MODULE_LIB) - @$(MKDIR) -p $(MODULE_LIB)/lib - @$(MKDIR) -p $(MODULE_LIB)/jre/lib/ext - @# create modules - for m in `$(NAWK) '{print $$1}' $(MODULE_LIST)` ; do \ + @# create jar file for modules and + @# copy other files from all members of this module + for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ $(ECHO) "Creating module $$m" ; \ $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \ if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \ $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \ fi ; \ + $(MKDIR) -p $(MODULE_LIB)/$$m/lib; \ $(CD) $(MODULE_CLASSES) && \ $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \ - $(MODULE_LIB)/$$m.jar \ - @$(TMP)/tmp.cf \ - $(BOOT_JAR_JFLAGS) ; \ - done + $(MODULE_LIB)/$$m/lib/$$m.jar \ + @$(TMP)/tmp.cf \ + $(BOOT_JAR_JFLAGS); \ + for s in `$(GREP) "^$$m" $(MODULES_LIST)` ; do \ + if [ -d $(TMP)/$$s ] ; then \ + $(CP) -rf $(TMP)/$$s/* $(MODULE_LIB)/$$m; \ + $(RM) -rf $(MODULE_LIB)/$$m/classes; \ + fi \ + done \ + done @$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup) - @# move modules to lib, jre/lib, or jre/lib/ext - for m in $(EXT_MODULES) ; do \ - $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/jre/lib/ext ; \ - done - for m in $(JDK_MODULES) ; do \ - $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/lib ; \ - done - $(MV) $(MODULE_LIB)/*.jar $(MODULE_LIB)/jre/lib @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." $(MODULE_JAR_MANIFEST_FILE): @@ -140,6 +113,5 @@ $(MODULE_JAR_MANIFEST_FILE): clean clobber:: $(RM) -rf $(MODULE_CLASSLIST) $(RM) -rf $(MODULE_LIB) - $(RM) -f $(MODULE_JAR_MANIFEST_FILE) - $(RM) -f $(CLASSANALYZER_JAR) - + $(RM) $(MODULE_JAR_MANIFEST_FILE) + $(RM) $(CLASSANALYZER_JAR) diff --git a/jdk/make/modules/modules.config b/jdk/make/modules/modules.config index 04b71ea6a51..bcc0493a980 100644 --- a/jdk/make/modules/modules.config +++ b/jdk/make/modules/modules.config @@ -372,15 +372,19 @@ module management { /**************************************************************************/ +module tracing { + // tracing + include com.sun.tracing.**, sun.tracing.**; +} + module instrument { // java.lang.instrument include java.lang.instrument.*, sun.instrument.*; - // tracing - include com.sun.tracing.**, sun.tracing.**; - // HPROF support include com.sun.demo.jvmti.hprof.*; + + include tracing; } /**************************************************************************/ @@ -391,15 +395,17 @@ module rmi-activation { sun.rmi.server.InactiveGroupException; } +module rmic { + // rmic is included in tools + include sun.rmi.rmic.**; +} + module rmi { include java.rmi.**, sun.rmi.**, com.sun.rmi.**; // SSL factories are in rmi include javax.rmi.ssl.**; - // rmic is in tools - exclude sun.rmi.rmic.**; - // supporting classes in sun.misc and dependencies include sun.misc.GC; } @@ -468,9 +474,14 @@ module security-smartcardio { include javax.smartcardio.**, sun.security.smartcardio.**; } +module security-auth { + include com.sun.security.auth.**, sun.security.util.AuthResources_*; +} + module security-misc { - include com.sun.security.auth.**, sun.security.util.AuthResources_*, - sun.security.pkcs.*, + include security-auth; + + include sun.security.pkcs.*, sun.security.pkcs12.*; // this class is a candidate to be removed. @@ -500,9 +511,8 @@ module jndi-rmiregistry { } module jndi-dns { + include net-dns; include com.sun.jndi.dns.**, com.sun.jndi.url.dns.**; - include sun.net.dns.**; // to access DNS config. - include sun.net.spi.nameservice.dns.**; // for DNS-only name service. } module jndi-cosnaming { @@ -677,31 +687,69 @@ module corba { /**************************************************************************/ -module client { +module applet { include java.applet.**, - java.awt.**, - javax.accessibility.*, - javax.imageio.**, - javax.print.**, - javax.sound.**, - javax.swing.**, - sun.applet.**, - sun.audio.**, + sun.applet.**; +} + +module awt { + include java.awt.**, sun.awt.**, - sun.dc.**, - sun.font.**, + com.sun.awt.**; +} + +module font { + include sun.font.**; +} + +module imageio { + include javax.imageio.**, + com.sun.imageio.**; +} + +module java2d { + include sun.dc.**, sun.java2d.**, - sun.print.**, + com.sun.image.**; +} + +module media { + include com.sun.media.**; +} + +module print { + include javax.print.**, + sun.print.**; +} + +module sound { + include javax.sound.**; +} + +module swing { + include javax.swing.**, sun.swing.**, - com.sun.accessibility.**, - com.sun.awt.**, - com.sun.image.**, - com.sun.imageio.**, - com.sun.java.swing.*, // sajdi also contains classes in a subpackage; - // so use '*' instead of '**' + // sajdi also contains classes in subpackages of com.sun.java.swing; + // so use '*' instead of '**' + com.sun.java.swing.*, com.sun.java.swing.plaf.**, - com.sun.media.**, com.sun.swing.**; +} + +module client { + include applet, + awt, + font, + imageio, + java2d, + media, + print, + sound, + swing; + + include javax.accessibility.*, + sun.audio.**, + com.sun.accessibility.**; // Bidi class in client module for now include java.text.Bidi, sun.text.bidi.*; @@ -723,7 +771,13 @@ module client { /**************************************************************************/ +module jkernel { + include sun.jkernel.*; +} + module deploy { + include jkernel; + // For now, all plugin and JNLP include com.sun.java.browser.**, netscape.**, @@ -732,8 +786,7 @@ module deploy { com.sun.deploy.**, com.sun.javaws.**, javax.jnlp.*, - com.sun.jnlp.*, - sun.jkernel.*; + com.sun.jnlp.*; // Hook for http authentication include sun.net.www.protocol.http.AuthCacheBridge; @@ -741,6 +794,11 @@ module deploy { /**************************************************************************/ +module net-dns { + include sun.net.dns.**; // to access DNS config. + include sun.net.spi.nameservice.dns.**; // for DNS-only name service. +} + module net-compat { // NTLM authentication support include sun.net.www.protocol.http.ntlm.*; @@ -824,6 +882,7 @@ module tools { debugging, jaxws-tools, jdb, + rmic, sajdi; // include gui-tools in tools module unless the tool binaries @@ -834,8 +893,7 @@ module tools { com.sun.jarsigner.**, com.sun.javac.**, com.sun.javadoc.**, com.sun.source.**, - sun.jvmstat.**, - sun.rmi.rmic.**; + sun.jvmstat.**; } /**************************************************************************/ @@ -853,6 +911,19 @@ module inputmethods-ext { /**************************************************************************/ +// Workaround for US export and local policy files +// They are currently in signed jars under the jre/lib/security directory +module US_export_policy { + include default_US_export.policy; +} + +module local_policy { + include default_local.policy, + exempt_local.policy; +} + +/**************************************************************************/ + module other { include **; } diff --git a/jdk/make/modules/tools/nbproject/project.xml b/jdk/make/modules/tools/nbproject/project.xml index b8b0aeafe07..61955a8eac5 100644 --- a/jdk/make/modules/tools/nbproject/project.xml +++ b/jdk/make/modules/tools/nbproject/project.xml @@ -1,3 +1,4 @@ + - - org.netbeans.modules.java.j2seproject diff --git a/jdk/make/modules/tools/src/com/sun/classanalyzer/Module.java b/jdk/make/modules/tools/src/com/sun/classanalyzer/Module.java index 26af2277637..0fdc5b145fa 100644 --- a/jdk/make/modules/tools/src/com/sun/classanalyzer/Module.java +++ b/jdk/make/modules/tools/src/com/sun/classanalyzer/Module.java @@ -444,8 +444,8 @@ public class Module implements Comparable { } void printClassListTo(String output) throws IOException { - // no file created if the module doesn't have any class - if (classes.isEmpty()) { + // no file created if the module doesn't have any class nor resource + if (isEmpty()) { return; } @@ -482,7 +482,7 @@ public class Module implements Comparable { void printDependenciesTo(String output, boolean showDynamic) throws IOException { // no file created if the module doesn't have any class - if (classes.isEmpty()) { + if (isEmpty()) { return; } diff --git a/jdk/make/sun/applet/Makefile b/jdk/make/sun/applet/Makefile index 415db17ddfb..83902ab7d86 100644 --- a/jdk/make/sun/applet/Makefile +++ b/jdk/make/sun/applet/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = applet PACKAGE = sun.applet PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/awt/Makefile b/jdk/make/sun/awt/Makefile index c3c1745ff54..0a8ad9c5fe1 100644 --- a/jdk/make/sun/awt/Makefile +++ b/jdk/make/sun/awt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt LIBRARY = awt PRODUCT = sun @@ -312,15 +313,15 @@ dgalibs: $(DGALIBS) $(LIBDIR)/$(LIBARCH)/libxinerama.so: $(CLOSED_SRC)/solaris/lib/$(ARCH)/libxinerama.so $(install-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) $(LIBDIR)/$(LIBARCH)/libjdgaSUNW%.so: $(CLOSED_SRC)/solaris/lib/$(ARCH)/libjdgaSUNW%.so $(install-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) $(LIBDIR)/$(LIBARCH)/libjdgaSUNWafb.so: $(LIBDIR)/$(LIBARCH)/libjdgaSUNWffb.so $(prep-target) - $(LN) -s libjdgaSUNWffb.so $(LIBDIR)/$(LIBARCH)/libjdgaSUNWafb.so + $(call install-sym-link, libjdgaSUNWffb.so) clean:: dgalib.clean @@ -404,7 +405,8 @@ $(LIBDIR)/%.bfc: $(FONTCONFIGS_SRC)/$(FONTCONFIGS_SRC_PREFIX)%.properties \ $(COMPILEFONTCONFIG_JARFILE) $(prep-target) $(BOOT_JAVA_CMD) -jar $(COMPILEFONTCONFIG_JARFILE) $< $@ - $(CHMOD) 444 $(@) + $(install-module-file) + $(call chmod-file, 444) @$(java-vm-cleanup) fontconfigs.clean : diff --git a/jdk/make/sun/cmm/Makefile b/jdk/make/sun/cmm/Makefile index bbed857654c..dc8a87b6e69 100644 --- a/jdk/make/sun/cmm/Makefile +++ b/jdk/make/sun/cmm/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = java2d PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -45,34 +46,24 @@ iccprofiles: $(ICCPROFILE_DEST_DIR)/sRGB.pf $(ICCPROFILE_DEST_DIR)/GRAY.pf \ $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf $(ICCPROFILE_DEST_DIR)/sRGB.pf: $(ICCPROFILE_SRC_DIR)/sRGB.pf - $(RM) $(ICCPROFILE_DEST_DIR)/sRGB.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/sRGB.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/sRGB.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/GRAY.pf: $(ICCPROFILE_SRC_DIR)/GRAY.pf - $(RM) $(ICCPROFILE_DEST_DIR)/GRAY.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/GRAY.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/GRAY.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/CIEXYZ.pf: $(ICCPROFILE_SRC_DIR)/CIEXYZ.pf - $(RM) $(ICCPROFILE_DEST_DIR)/CIEXYZ.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/CIEXYZ.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/CIEXYZ.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/PYCC.pf: $(ICCPROFILE_SRC_DIR)/PYCC.pf - $(RM) $(ICCPROFILE_DEST_DIR)/PYCC.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/PYCC.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/PYCC.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf: $(ICCPROFILE_SRC_DIR)/LINEAR_RGB.pf - $(RM) $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/LINEAR_RGB.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf + $(install-file) + $(call chmod-file, 444) iccprofiles.clean: $(RM) -r $(ICCPROFILE_DEST_DIR) diff --git a/jdk/make/sun/cmm/kcms/Makefile b/jdk/make/sun/cmm/kcms/Makefile index 10ff72b4f57..a7250f74b87 100644 --- a/jdk/make/sun/cmm/kcms/Makefile +++ b/jdk/make/sun/cmm/kcms/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = java2d PACKAGE = sun.java2d.cmm.kcms LIBRARY = kcms PRODUCT = sun diff --git a/jdk/make/sun/cmm/lcms/Makefile b/jdk/make/sun/cmm/lcms/Makefile index ba595507b7a..ac8746af7b2 100644 --- a/jdk/make/sun/cmm/lcms/Makefile +++ b/jdk/make/sun/cmm/lcms/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = java2d PACKAGE = sun.java2d.cmm.lcms LIBRARY = lcms PRODUCT = sun diff --git a/jdk/make/sun/dcpr/Makefile b/jdk/make/sun/dcpr/Makefile index e49db2af23a..4dc39f93b9f 100644 --- a/jdk/make/sun/dcpr/Makefile +++ b/jdk/make/sun/dcpr/Makefile @@ -26,6 +26,7 @@ # WARNING: Make sure the OPENJDK plugs are up-to-date, see make/common/internal/BinaryPlugs.gmk BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.dc LIBRARY = dcpr PRODUCT = sun diff --git a/jdk/make/sun/font/Makefile b/jdk/make/sun/font/Makefile index f513a64bd46..c95e52f458e 100644 --- a/jdk/make/sun/font/Makefile +++ b/jdk/make/sun/font/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = font PACKAGE = sun.font LIBRARY = fontmanager PRODUCT = sun @@ -121,16 +122,21 @@ FILES_m=mapfile-vers.openjdk # #TODO: rework this to avoid hardcoding library name in the makefile # -library:: $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) - -$(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX): ifeq ($(PLATFORM), windows) - $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@ + FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) + OTHER_LDLIBS += $(FREETYPE_LIB_PATH)/freetype.lib else ifeq ($(USING_SYSTEM_FT_LIB), false) - $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@.6 + FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX).6 endif + OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype endif + +library:: $(FREETYPE_LIB) + +$(FREETYPE_LIB): + $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@ + $(install-module-file) endif #ifeq ($(PLATFORM), solaris) @@ -158,7 +164,6 @@ ifndef OPENJDK CPPFLAGS += -I$(CLOSED_SRC)/share/native/$(PKGDIR)/t2k else CPPFLAGS += -I$(FREETYPE_HEADERS_PATH) -I$(FREETYPE_HEADERS_PATH)/freetype2 - OTHER_LDLIBS += $(FREETYPE_LIB) endif ifeq ($(PLATFORM), windows) diff --git a/jdk/make/sun/font/t2k/Makefile b/jdk/make/sun/font/t2k/Makefile index d01e825159b..651eea84d2c 100644 --- a/jdk/make/sun/font/t2k/Makefile +++ b/jdk/make/sun/font/t2k/Makefile @@ -30,6 +30,7 @@ # BUILDDIR = ../../.. +MODULE = font PACKAGE = sun.font LIBRARY = t2k PRODUCT = sun diff --git a/jdk/make/sun/headless/Makefile b/jdk/make/sun/headless/Makefile index b1e1ebf6d5b..ee853eae746 100644 --- a/jdk/make/sun/headless/Makefile +++ b/jdk/make/sun/headless/Makefile @@ -30,6 +30,7 @@ MOTIF_VERSION = none MOTIF_VERSION_STRING=none LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/headless +MODULE = awt PACKAGE = sun.awt LIBRARY = mawt LIBRARY_OUTPUT = headless diff --git a/jdk/make/sun/image/generic/Makefile b/jdk/make/sun/image/generic/Makefile index 5caedf6d7d0..446209f8667 100644 --- a/jdk/make/sun/image/generic/Makefile +++ b/jdk/make/sun/image/generic/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = media PACKAGE = sun.awt.medialib LIBRARY = mlib_image PRODUCT = sun diff --git a/jdk/make/sun/image/vis/Makefile b/jdk/make/sun/image/vis/Makefile index b0e399b0878..2bc891a5cf6 100644 --- a/jdk/make/sun/image/vis/Makefile +++ b/jdk/make/sun/image/vis/Makefile @@ -27,6 +27,7 @@ # Makefile for building the VIS (solaris-only) version of medialib # BUILDDIR = ../../.. +MODULE = media PACKAGE = sun.awt.medialib LIBRARY = mlib_image_v PRODUCT = sun diff --git a/jdk/make/sun/jar/Makefile b/jdk/make/sun/jar/Makefile index b90d738900c..7dd586e2ff7 100644 --- a/jdk/make/sun/jar/Makefile +++ b/jdk/make/sun/jar/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jar-tool PACKAGE = sun.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/javazic/Makefile b/jdk/make/sun/javazic/Makefile index 96a2df1e0d9..10c2b1a8565 100644 --- a/jdk/make/sun/javazic/Makefile +++ b/jdk/make/sun/javazic/Makefile @@ -27,6 +27,7 @@ BUILDDIR = ../.. +MODULE = base PACKAGE = sun.javazic PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -69,6 +70,7 @@ $(INSTALLDIR)/$(MAPFILE): $(WORKDIR)/$(MAPFILE) $(RM) -r $(@D) $(prep-target) $(CP) -r $(WORKDIR)/* $(@D) + $(install-module-dir) clean clobber:: $(RM) -r $(TEMPDIR) $(INSTALLDIR) diff --git a/jdk/make/sun/jawt/Makefile b/jdk/make/sun/jawt/Makefile index 45d337258a4..424a20d1c41 100644 --- a/jdk/make/sun/jawt/Makefile +++ b/jdk/make/sun/jawt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt LIBRARY = jawt PRODUCT = sun diff --git a/jdk/make/sun/jconsole/Makefile b/jdk/make/sun/jconsole/Makefile index dc61227fe62..42f624e38b2 100644 --- a/jdk/make/sun/jconsole/Makefile +++ b/jdk/make/sun/jconsole/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jconsole PACKAGE = sun.tools.jconsole PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -79,7 +80,7 @@ $(CLASSBINDIR)/$(PKGDIR)/resources/%: $(SHARE_SRC)/classes/$(PKGDIR)/resources/% $(install-file) $(TEMPDIR)/manifest: $(SHARE_SRC)/classes/$(PKGDIR)/manifest - $(install-file) + $(install-manifest-file) # # Extra rule to build jconsole.jar diff --git a/jdk/make/sun/jdbc/Makefile b/jdk/make/sun/jdbc/Makefile index d7e7eaf1530..4b241b9174e 100644 --- a/jdk/make/sun/jdbc/Makefile +++ b/jdk/make/sun/jdbc/Makefile @@ -33,6 +33,7 @@ # BUILDDIR = ../.. +MODULE = jdbc-odbc PACKAGE = sun.jdbc.odbc LIBRARY = JdbcOdbc PRODUCT = sun diff --git a/jdk/make/sun/jdga/Makefile b/jdk/make/sun/jdga/Makefile index 257996d7721..d9a6db65565 100644 --- a/jdk/make/sun/jdga/Makefile +++ b/jdk/make/sun/jdga/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.jdga LIBRARY = sunwjdga PRODUCT = sun diff --git a/jdk/make/sun/jkernel/Makefile b/jdk/make/sun/jkernel/Makefile index 97f2f38aca5..7a7a6a3645f 100644 --- a/jdk/make/sun/jkernel/Makefile +++ b/jdk/make/sun/jkernel/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = jkernel PACKAGE = sun.jkernel LIBRARY = jkernel PRODUCT = sun diff --git a/jdk/make/sun/jpeg/Makefile b/jdk/make/sun/jpeg/Makefile index f97e2cd08b8..99d36a9b257 100644 --- a/jdk/make/sun/jpeg/Makefile +++ b/jdk/make/sun/jpeg/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.awt LIBRARY = jpeg PRODUCT = sun diff --git a/jdk/make/sun/launcher/Makefile b/jdk/make/sun/launcher/Makefile index 1346bc4e200..32b2ec7aa1b 100644 --- a/jdk/make/sun/launcher/Makefile +++ b/jdk/make/sun/launcher/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = sun.launcher PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/management/Makefile b/jdk/make/sun/management/Makefile index bb7ad8935c9..a54b1dd0be9 100644 --- a/jdk/make/sun/management/Makefile +++ b/jdk/make/sun/management/Makefile @@ -28,6 +28,8 @@ # BUILDDIR = ../.. +MODULE = management + include $(BUILDDIR)/common/Defs.gmk MGMT_LIBDIR = $(LIBDIR)/management @@ -56,17 +58,17 @@ jmxremotefiles: $(MGMT_LIBDIR)/jmxremote.password.template $(MGMT_LIBDIR)/jmxrem $(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties $(install-file) - $(CHMOD) 644 $@ + $(call chmod-file, 644) $(MGMT_LIBDIR)/snmp.acl.template: $(MGMT_LIB_SRC)/snmp.acl.template $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) $(MGMT_LIBDIR)/jmxremote.password.template: $(MGMT_LIB_SRC)/jmxremote.password.template $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) $(MGMT_LIBDIR)/jmxremote.access: $(MGMT_LIB_SRC)/jmxremote.access $(install-file) - $(CHMOD) 644 $@ + $(call chmod-file, 644) diff --git a/jdk/make/sun/native2ascii/Makefile b/jdk/make/sun/native2ascii/Makefile index 766e90fc545..1cd1ab9b155 100644 --- a/jdk/make/sun/native2ascii/Makefile +++ b/jdk/make/sun/native2ascii/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = tools PACKAGE = sun.tools.native2ascii PRODUCT = sun OTHER_JAVACFLAGS += -Xlint:serial -Werror diff --git a/jdk/make/sun/net/others/Makefile b/jdk/make/sun/net/others/Makefile index 2adf6048b7b..0896c7ef679 100644 --- a/jdk/make/sun/net/others/Makefile +++ b/jdk/make/sun/net/others/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = base PACKAGE = sun.net PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/net/spi/nameservice/dns/Makefile b/jdk/make/sun/net/spi/nameservice/dns/Makefile index d86a3c69f00..746f168b457 100644 --- a/jdk/make/sun/net/spi/nameservice/dns/Makefile +++ b/jdk/make/sun/net/spi/nameservice/dns/Makefile @@ -28,6 +28,9 @@ # BUILDDIR = ../../../../.. + +# dns should probably be its own module +MODULE = net-dns PACKAGE = sun.net.spi.nameservice.dns PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/nio/Makefile b/jdk/make/sun/nio/Makefile index 4b46a1fb76d..76051c1b17a 100644 --- a/jdk/make/sun/nio/Makefile +++ b/jdk/make/sun/nio/Makefile @@ -1,5 +1,5 @@ # -# Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,88 +23,12 @@ # have any questions. # -# -# Makefile for character converters. -# - BUILDDIR = ../.. - PACKAGE = sun.nio PRODUCT = sun - -# This re-directs all the class files to a separate location -CLASSDESTDIR = $(TEMPDIR)/classes - -OTHER_JAVACFLAGS += -Xlint:serial -Werror include $(BUILDDIR)/common/Defs.gmk -# -# Files -# -include FILES_java.gmk -AUTO_FILES_JAVA_DIRS = sun/nio/cs/ext +SUBDIRS = cs +all build clean clobber:: + $(SUBDIRS-loop) -# For Cygwin, command line arguments that are paths must be converted to -# windows style paths. These paths cannot be used as targets, however, because -# the ":" in them will interfere with GNU Make rules, generating "multiple -# target pattern" errors. - -# this define is for the rule: -CHARSETS_JAR = $(LIBDIR)/charsets.jar - -# extcs -FILES_genout_extcs = $(FILES_gen_extcs:%.java=$(GENSRCDIR)/%.java) - -# -# Rules -# -include $(BUILDDIR)/common/Classes.gmk - -build: $(FILES_genout_extcs) $(CHARSETS_JAR) - -# -# Extra rules to build character converters. - -SERVICE_DESCRIPTION = java.nio.charset.spi.CharsetProvider -SERVICE_DESCRIPTION_PATH = META-INF/services/$(SERVICE_DESCRIPTION) - -GENCSDATASRC = $(BUILDDIR)/tools/CharsetMapping -GENCSSRCDIR = $(BUILDDIR)/tools/src/build/tools/charsetmapping -GENCSEXT = $(GENSRCDIR)/sun/nio/cs/ext - -FILES_MAP = $(GENCSDATASRC)/sjis0213.map -FILES_DAT = $(CLASSDESTDIR)/sun/nio/cs/ext/sjis0213.dat -CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar - -$(FILES_DAT): $(FILES_MAP) - @$(prep-target) - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) \ - $(FILES_MAP) $(FILES_DAT) sjis0213 - - -$(FILES_genout_extcs): \ - $(GENCSDATASRC)/SingleByte-X.java.template \ - $(GENCSDATASRC)/DoubleByte-X.java.template \ - $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs - @$(prep-target) - $(RM) -r $(GENCSEXT) - $(MKDIR) -p $(GENCSEXT) - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \ - $(GENCSSRCDIR)/GenerateEUC_TW.java - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs - -$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ - $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH) - $(install-file) - -$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT) - $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \ - -C $(CLASSDESTDIR) sun \ - -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \ - $(BOOT_JAR_JFLAGS) - @$(java-vm-cleanup) - -clean:: - $(RM) -r $(CLASSDESTDIR) - $(RM) $(CHARSETS_JAR) diff --git a/jdk/make/sun/nio/FILES_java.gmk b/jdk/make/sun/nio/cs/FILES_java.gmk similarity index 100% rename from jdk/make/sun/nio/FILES_java.gmk rename to jdk/make/sun/nio/cs/FILES_java.gmk diff --git a/jdk/make/sun/nio/cs/Makefile b/jdk/make/sun/nio/cs/Makefile new file mode 100644 index 00000000000..c2e9c0b8ef2 --- /dev/null +++ b/jdk/make/sun/nio/cs/Makefile @@ -0,0 +1,112 @@ +# +# Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# +# Makefile for character converters. +# + +BUILDDIR = ../../.. + +# charsets should be separated from nio module +MODULE = charsets +PACKAGE = sun.nio +PRODUCT = sun + +# This re-directs all the class files to a separate location +CLASSDESTDIR = $(TEMPDIR)/classes + +OTHER_JAVACFLAGS += -Xlint:serial -Werror +include $(BUILDDIR)/common/Defs.gmk + +# +# Files +# +include FILES_java.gmk +AUTO_FILES_JAVA_DIRS = sun/nio/cs/ext + +# For Cygwin, command line arguments that are paths must be converted to +# windows style paths. These paths cannot be used as targets, however, because +# the ":" in them will interfere with GNU Make rules, generating "multiple +# target pattern" errors. + +# this define is for the rule: +CHARSETS_JAR = $(LIBDIR)/charsets.jar + +# extcs +FILES_genout_extcs = $(FILES_gen_extcs:%.java=$(GENSRCDIR)/%.java) + +# +# Rules +# +include $(BUILDDIR)/common/Classes.gmk + +build: $(FILES_genout_extcs) $(CHARSETS_JAR) + +# +# Extra rules to build character converters. + +SERVICE_DESCRIPTION = java.nio.charset.spi.CharsetProvider +SERVICE_DESCRIPTION_PATH = META-INF/services/$(SERVICE_DESCRIPTION) + +GENCSDATASRC = $(BUILDDIR)/tools/CharsetMapping +GENCSSRCDIR = $(BUILDDIR)/tools/src/build/tools/charsetmapping +GENCSEXT = $(GENSRCDIR)/sun/nio/cs/ext + +FILES_MAP = $(GENCSDATASRC)/sjis0213.map +FILES_DAT = $(CLASSDESTDIR)/sun/nio/cs/ext/sjis0213.dat +CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar + +$(FILES_DAT): $(FILES_MAP) + @$(prep-target) + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) \ + $(FILES_MAP) $(FILES_DAT) sjis0213 + + +$(FILES_genout_extcs): \ + $(GENCSDATASRC)/SingleByte-X.java.template \ + $(GENCSDATASRC)/DoubleByte-X.java.template \ + $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs + @$(prep-target) + $(RM) -r $(GENCSEXT) + $(MKDIR) -p $(GENCSEXT) + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \ + $(GENCSSRCDIR)/GenerateEUC_TW.java + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs + +$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ + $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH) + $(install-file) + +$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT) + $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \ + -C $(CLASSDESTDIR) sun \ + -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \ + $(BOOT_JAR_JFLAGS) + @$(java-vm-cleanup) + +clean:: + $(RM) -r $(CLASSDESTDIR) + $(RM) $(CHARSETS_JAR) diff --git a/jdk/make/sun/org/mozilla/javascript/Makefile b/jdk/make/sun/org/mozilla/javascript/Makefile index 2e74c02fdd5..1750fadc6cb 100644 --- a/jdk/make/sun/org/mozilla/javascript/Makefile +++ b/jdk/make/sun/org/mozilla/javascript/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = scripting-rhino PACKAGE = sun.org.mozilla.javascript.internal PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/pisces/Makefile b/jdk/make/sun/pisces/Makefile index 3f3a3228b95..73f07f5090b 100644 --- a/jdk/make/sun/pisces/Makefile +++ b/jdk/make/sun/pisces/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.pisces PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/rmi/cgi/Makefile b/jdk/make/sun/rmi/cgi/Makefile index 0ed90ca2bd5..4b69bc0a523 100644 --- a/jdk/make/sun/rmi/cgi/Makefile +++ b/jdk/make/sun/rmi/cgi/Makefile @@ -28,6 +28,8 @@ # BUILDDIR = ../../.. +# java-rmi.cgi is a JDK tool +MODULE = tools PACKAGE = sun.rmi PRODUCT = sun PROGRAM = java-rmi diff --git a/jdk/make/sun/rmi/oldtools/Makefile b/jdk/make/sun/rmi/oldtools/Makefile index ad610ffca41..b59d4fcf077 100644 --- a/jdk/make/sun/rmi/oldtools/Makefile +++ b/jdk/make/sun/rmi/oldtools/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = oldjavac PRODUCT = oldjavac include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/rmi/registry/Makefile b/jdk/make/sun/rmi/registry/Makefile index c5254a7f3c9..bfb6cb55ed8 100644 --- a/jdk/make/sun/rmi/registry/Makefile +++ b/jdk/make/sun/rmi/registry/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = rmi PACKAGE = sun.rmi.registry PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -48,3 +49,7 @@ RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/rmiregistry.propert # include $(BUILDDIR)/common/Classes.gmk +build: rmiregistry + +rmiregistry: + $(call make-launcher, rmiregistry, sun.rmi.registry.RegistryImpl, , ) diff --git a/jdk/make/sun/rmi/rmi/Makefile b/jdk/make/sun/rmi/rmi/Makefile index c351d87f0eb..844f51bcc34 100644 --- a/jdk/make/sun/rmi/rmi/Makefile +++ b/jdk/make/sun/rmi/rmi/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = rmi PACKAGE = sun.rmi PRODUCT = sun LIBRARY = rmi @@ -124,7 +125,7 @@ bin: $(BINDIR)/java-rmi.cgi $(BINDIR)/java-rmi.cgi: $(PLATFORM_SRC)/bin/java-rmi.cgi.sh $(install-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) bin.clean: $(RM) $(BINDIR)/java-rmi.cgi diff --git a/jdk/make/sun/rmi/rmic/Makefile b/jdk/make/sun/rmi/rmic/Makefile index a09a170f86f..ae73a2d28e3 100644 --- a/jdk/make/sun/rmi/rmic/Makefile +++ b/jdk/make/sun/rmi/rmic/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = rmic PACKAGE = sun.rmi.rmic PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/rmi/rmid/Makefile b/jdk/make/sun/rmi/rmid/Makefile index 845b103220d..23f223ec66b 100644 --- a/jdk/make/sun/rmi/rmid/Makefile +++ b/jdk/make/sun/rmi/rmid/Makefile @@ -29,11 +29,12 @@ # BUILDDIR = ../../.. +MODULE = rmi-activation PACKAGE = sun.rmi.activation PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk -build: stubs +build: stubs rmid # # Resources @@ -75,4 +76,5 @@ stubs: $(FILES_stubs) # include $(BUILDDIR)/common/Classes.gmk - +rmid: + $(call make-launcher, rmid, sun.rmi.server.Activation, , ) diff --git a/jdk/make/sun/security/ec/Makefile b/jdk/make/sun/security/ec/Makefile index 53a3e3e9e51..95b9e8d30d6 100644 --- a/jdk/make/sun/security/ec/Makefile +++ b/jdk/make/sun/security/ec/Makefile @@ -89,6 +89,7 @@ # BUILDDIR = ../../.. +MODULE = security-sunec PACKAGE = sun.security.ec PRODUCT = sun @@ -308,7 +309,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunec.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunec.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: diff --git a/jdk/make/sun/security/jgss/wrapper/Makefile b/jdk/make/sun/security/jgss/wrapper/Makefile index f5b75dbeb48..8be00aa6c20 100644 --- a/jdk/make/sun/security/jgss/wrapper/Makefile +++ b/jdk/make/sun/security/jgss/wrapper/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../../.. +MODULE = security-kerberos PACKAGE = sun.security.jgss.wrapper PRODUCT = sun diff --git a/jdk/make/sun/security/krb5/Makefile b/jdk/make/sun/security/krb5/Makefile index aac29eb5611..c835666ea9e 100644 --- a/jdk/make/sun/security/krb5/Makefile +++ b/jdk/make/sun/security/krb5/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = security-kerberos PACKAGE = sun.security.krb5 PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -77,3 +78,10 @@ ifeq ($(PLATFORM), windows) else OTHER_LDLIBS = -ldl $(JVMLIB) endif + +build: +ifeq ($(PLATFORM),windows) + $(call make-launcher, kinit, sun.security.krb5.internal.tools.Kinit, , ) + $(call make-launcher, klist, sun.security.krb5.internal.tools.Klist, , ) + $(call make-launcher, ktab, sun.security.krb5.internal.tools.Ktab, , ) +endif diff --git a/jdk/make/sun/security/mscapi/Makefile b/jdk/make/sun/security/mscapi/Makefile index c16d130504f..2cc8ea53614 100644 --- a/jdk/make/sun/security/mscapi/Makefile +++ b/jdk/make/sun/security/mscapi/Makefile @@ -89,6 +89,7 @@ # BUILDDIR = ../../.. +MODULE = security-sunmscapi PACKAGE = sun.security.mscapi LIBRARY = sunmscapi PRODUCT = sun @@ -271,7 +272,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunmscapi.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunmscapi.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: diff --git a/jdk/make/sun/security/pkcs11/Makefile b/jdk/make/sun/security/pkcs11/Makefile index 9a4a4089be4..f4be8d7a507 100644 --- a/jdk/make/sun/security/pkcs11/Makefile +++ b/jdk/make/sun/security/pkcs11/Makefile @@ -89,6 +89,7 @@ # BUILDDIR = ../../.. +MODULE = security-sunpkcs11 PACKAGE = sun.security.pkcs11 LIBRARY = j2pkcs11 PRODUCT = sun @@ -161,6 +162,16 @@ else OTHER_LDLIBS = -ldl $(JVMLIB) endif +# Other config files +SUNPKCS11_CFG = + +ifeq ($(PLATFORM), solaris) +SUNPKCS11_CFG = sunpkcs11-cfg +endif # PLATFORM + +SUNPKCS11_CFG_SRC = $(TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg +SUNPKCS11_CFG_BUILD = $(LIBDIR)/security/sunpkcs11-solaris.cfg + # # We use a variety of subdirectories in the $(TEMPDIR) depending on what # part of the build we're doing. Both OPENJDK/JDK builds are initially @@ -174,12 +185,17 @@ UNSIGNED_DIR = $(TEMPDIR)/unsigned # ifdef OPENJDK -all: build-jar install-jar +all: $(SUNPKCS11_CFG) build-jar install-jar else -all: build-jar install-prebuilt +all: $(SUNPKCS11_CFG) build-jar install-prebuilt $(build-warning) endif +sunpkcs11-cfg: $(SUNPKCS11_CFG_BUILD) + +$(SUNPKCS11_CFG_BUILD): $(SUNPKCS11_CFG_SRC) + $(install-file) + include $(BUILDDIR)/javax/crypto/Defs-jce.gmk @@ -271,7 +287,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunpkcs11.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunpkcs11.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: @@ -287,6 +303,7 @@ endif clobber clean:: $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR) + $(RM) $(SUNPKCS11_CFG_BUILD) .PHONY: build-jar jar install-jar ifndef OPENJDK diff --git a/jdk/make/sun/security/smartcardio/Makefile b/jdk/make/sun/security/smartcardio/Makefile index 55686411967..097cd40c7a9 100644 --- a/jdk/make/sun/security/smartcardio/Makefile +++ b/jdk/make/sun/security/smartcardio/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = security-smartcardio PACKAGE = sun.security.smartcardio LIBRARY = j2pcsc PRODUCT = sun diff --git a/jdk/make/sun/security/tools/Makefile b/jdk/make/sun/security/tools/Makefile index 0a8ffabe15c..3380d20e6d8 100644 --- a/jdk/make/sun/security/tools/Makefile +++ b/jdk/make/sun/security/tools/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = security-tools PACKAGE = sun.security.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -44,3 +45,7 @@ RESOURCE_BUNDLES_JAVA = sun/security/tools/JarSignerResources.java # include $(BUILDDIR)/common/Classes.gmk +build: + $(call make-launcher, keytool, sun.security.tools.KeyTool, , ) + $(call make-launcher, policytool, sun.security.tools.PolicyTool, , ) + diff --git a/jdk/make/sun/serialver/Makefile b/jdk/make/sun/serialver/Makefile index 0906d3e3e14..29c3cceba48 100644 --- a/jdk/make/sun/serialver/Makefile +++ b/jdk/make/sun/serialver/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = serialver PACKAGE = sun.tools.serialver PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/splashscreen/Makefile b/jdk/make/sun/splashscreen/Makefile index 305df2fc2e0..65b3fc388cc 100644 --- a/jdk/make/sun/splashscreen/Makefile +++ b/jdk/make/sun/splashscreen/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt LIBRARY = splashscreen PRODUCT = sun diff --git a/jdk/make/sun/text/Makefile b/jdk/make/sun/text/Makefile index 37b8522156a..005587df7a1 100644 --- a/jdk/make/sun/text/Makefile +++ b/jdk/make/sun/text/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../.. +MODULE = localedata PACKAGE = sun.text PRODUCT = sun diff --git a/jdk/make/sun/tools/Makefile b/jdk/make/sun/tools/Makefile index 3c4d4c98d7d..a6e926daf40 100644 --- a/jdk/make/sun/tools/Makefile +++ b/jdk/make/sun/tools/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = tools PACKAGE = sun.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/jdk/make/sun/tracing/dtrace/Makefile b/jdk/make/sun/tracing/dtrace/Makefile index cf0dc9a978f..16f09e71978 100644 --- a/jdk/make/sun/tracing/dtrace/Makefile +++ b/jdk/make/sun/tracing/dtrace/Makefile @@ -27,6 +27,7 @@ # Makefile for building dtrace extension # BUILDDIR = ../../.. +MODULE = tracing PACKAGE = sun.tracing.dtrace LIBRARY = jsdt PRODUCT = sun diff --git a/jdk/make/sun/xawt/Makefile b/jdk/make/sun/xawt/Makefile index 3cb408d9907..f9636cd3e66 100644 --- a/jdk/make/sun/xawt/Makefile +++ b/jdk/make/sun/xawt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt.X11 LIBRARY = mawt LIBRARY_OUTPUT = xawt From 7eff9123d30934ab3d81504a7d8f0dbc571cede9 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 7 Jan 2010 19:42:43 -0800 Subject: [PATCH 13/59] 6915171: Clarify checked/unchecked status of Throwable and its subclasses Reviewed-by: dholmes --- jdk/src/share/classes/java/lang/Error.java | 18 +++++++++++------- jdk/src/share/classes/java/lang/Exception.java | 16 ++++++++++++---- .../classes/java/lang/RuntimeException.java | 16 +++++++++------- jdk/src/share/classes/java/lang/Throwable.java | 6 ++++++ 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Error.java b/jdk/src/share/classes/java/lang/Error.java index c1ab7a89297..a5af32668e8 100644 --- a/jdk/src/share/classes/java/lang/Error.java +++ b/jdk/src/share/classes/java/lang/Error.java @@ -26,27 +26,31 @@ package java.lang; /** - * An Error is a subclass of Throwable + * An {@code Error} is a subclass of {@code Throwable} * that indicates serious problems that a reasonable application * should not try to catch. Most such errors are abnormal conditions. - * The ThreadDeath error, though a "normal" condition, - * is also a subclass of Error because most applications + * The {@code ThreadDeath} error, though a "normal" condition, + * is also a subclass of {@code Error} because most applications * should not try to catch it. *

- * A method is not required to declare in its throws - * clause any subclasses of Error that might be thrown + * A method is not required to declare in its {@code throws} + * clause any subclasses of {@code Error} that might be thrown * during the execution of the method but not caught, since these * errors are abnormal conditions that should never occur. * + * That is, {@code Error} and its subclasses are regarded as unchecked + * exceptions for the purposes of compile-time checking of exceptions. + * * @author Frank Yellin * @see java.lang.ThreadDeath + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Error extends Throwable { static final long serialVersionUID = 4980196508277280342L; /** - * Constructs a new error with null as its detail message. + * Constructs a new error with {@code null} as its detail message. * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ @@ -69,7 +73,7 @@ public class Error extends Throwable { /** * Constructs a new error with the specified detail message and * cause.

Note that the detail message associated with - * cause is not automatically incorporated in + * {@code cause} is not automatically incorporated in * this error's detail message. * * @param message the detail message (which is saved for later retrieval diff --git a/jdk/src/share/classes/java/lang/Exception.java b/jdk/src/share/classes/java/lang/Exception.java index 70b99ae9be6..bdb1c7d3687 100644 --- a/jdk/src/share/classes/java/lang/Exception.java +++ b/jdk/src/share/classes/java/lang/Exception.java @@ -26,19 +26,27 @@ package java.lang; /** - * The class Exception and its subclasses are a form of - * Throwable that indicates conditions that a reasonable + * The class {@code Exception} and its subclasses are a form of + * {@code Throwable} that indicates conditions that a reasonable * application might want to catch. * + *

The class {@code Exception} and any subclasses that are not also + * subclasses of {@link RuntimeException} are checked + * exceptions. Checked exceptions need to be declared in a + * method or constructor's {@code throws} clause if they can be thrown + * by the execution of the method or constructor and propagate outside + * the method or constructor boundary. + * * @author Frank Yellin * @see java.lang.Error + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Exception extends Throwable { static final long serialVersionUID = -3387516993124229948L; /** - * Constructs a new exception with null as its detail message. + * Constructs a new exception with {@code null} as its detail message. * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ @@ -61,7 +69,7 @@ public class Exception extends Throwable { /** * Constructs a new exception with the specified detail message and * cause.

Note that the detail message associated with - * cause is not automatically incorporated in + * {@code cause} is not automatically incorporated in * this exception's detail message. * * @param message the detail message (which is saved for later retrieval diff --git a/jdk/src/share/classes/java/lang/RuntimeException.java b/jdk/src/share/classes/java/lang/RuntimeException.java index e3378485bdf..d510e2c5898 100644 --- a/jdk/src/share/classes/java/lang/RuntimeException.java +++ b/jdk/src/share/classes/java/lang/RuntimeException.java @@ -26,22 +26,24 @@ package java.lang; /** - * RuntimeException is the superclass of those + * {@code RuntimeException} is the superclass of those * exceptions that can be thrown during the normal operation of the * Java Virtual Machine. - *

- * A method is not required to declare in its throws - * clause any subclasses of RuntimeException that might - * be thrown during the execution of the method but not caught. * + *

{@code RuntimeException} and its subclasses are unchecked + * exceptions. Unchecked exceptions do not need to be + * declared in a method or constructor's {@code throws} clause if they + * can be thrown by the execution of the method or constructor and + * propagate outside the method or constructor boundary. * * @author Frank Yellin + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class RuntimeException extends Exception { static final long serialVersionUID = -7034897190745766939L; - /** Constructs a new runtime exception with null as its + /** Constructs a new runtime exception with {@code null} as its * detail message. The cause is not initialized, and may subsequently be * initialized by a call to {@link #initCause}. */ @@ -63,7 +65,7 @@ public class RuntimeException extends Exception { /** * Constructs a new runtime exception with the specified detail message and * cause.

Note that the detail message associated with - * cause is not automatically incorporated in + * {@code cause} is not automatically incorporated in * this runtime exception's detail message. * * @param message the detail message (which is saved for later retrieval diff --git a/jdk/src/share/classes/java/lang/Throwable.java b/jdk/src/share/classes/java/lang/Throwable.java index c4e75d250ff..ebc7fe7ceab 100644 --- a/jdk/src/share/classes/java/lang/Throwable.java +++ b/jdk/src/share/classes/java/lang/Throwable.java @@ -34,6 +34,11 @@ import java.io.*; * this class or one of its subclasses can be the argument type in a * catch clause. * + * For the purposes of compile-time checking of exceptions, {@code + * Throwable} and any subclass of {@code Throwable} that is not also a + * subclass of either {@link RuntimeException} or {@link Error} are + * regarded as checked exceptions. + * *

Instances of two subclasses, {@link java.lang.Error} and * {@link java.lang.Exception}, are conventionally used to indicate * that exceptional situations have occurred. Typically, these instances @@ -142,6 +147,7 @@ import java.io.*; * @author unascribed * @author Josh Bloch (Added exception chaining and programmatic access to * stack trace in 1.4.) + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Throwable implements Serializable { From 9f2d8827dba8b96b750bf4b6e4653ae1b7fd496f Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 8 Jan 2010 11:11:33 -0800 Subject: [PATCH 14/59] 6878147: Keywords.log is declared and initialized but unused Reviewed-by: darcy --- .../src/share/classes/com/sun/tools/javac/parser/Keywords.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java index bec19a72ec1..c9922e46486 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java @@ -51,12 +51,10 @@ public class Keywords { return instance; } - private final Log log; private final Names names; protected Keywords(Context context) { context.put(keywordsKey, this); - log = Log.instance(context); names = Names.instance(context); for (Token t : Token.values()) { From 114e3f9b31cb193d43c6335d7afa63db78896e95 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 8 Jan 2010 11:16:23 -0800 Subject: [PATCH 15/59] 6878146: incorrect unused value should be deleted Reviewed-by: darcy --- .../classes/com/sun/tools/javac/util/LayoutCharacters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java b/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java index dd4f4dd9e03..05158b61cae 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java @@ -49,7 +49,7 @@ public interface LayoutCharacters { /** Tabulator character. */ - final static byte TAB = 0x8; + final static byte TAB = 0x9; /** Line feed character. */ From fb26d8497e11e2b6ea260878e8401417a85b077a Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 8 Jan 2010 11:28:49 -0800 Subject: [PATCH 16/59] 6665791: com.sun.source.tree.MethodTree.toString() does not output default values Reviewed-by: darcy --- .../com/sun/tools/javac/tree/Pretty.java | 4 + langtools/test/tools/javac/T6665791.java | 81 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 langtools/test/tools/javac/T6665791.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java index 0460157c2f7..34909d336c0 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java @@ -468,6 +468,10 @@ public class Pretty extends JCTree.Visitor { print(" throws "); printExprs(tree.thrown); } + if (tree.defaultValue != null) { + print(" default "); + printExpr(tree.defaultValue); + } if (tree.body != null) { print(" "); printStat(tree.body); diff --git a/langtools/test/tools/javac/T6665791.java b/langtools/test/tools/javac/T6665791.java new file mode 100644 index 00000000000..8a258f8e66a --- /dev/null +++ b/langtools/test/tools/javac/T6665791.java @@ -0,0 +1,81 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6665791 + * @summary com.sun.source.tree.MethodTree.toString() does not output default values + */ + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; +import com.sun.source.tree.ClassTree; +import com.sun.source.util.JavacTask; +import com.sun.source.util.TreeScanner; +import java.io.FileWriter; + +public class T6665791 { + static String test = "public @interface Annotation { boolean booleanProperty() default false; }"; + static File test_java = new File("Test.java"); + + public static void main(String[] args) throws Exception { + write(test_java, test); + + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager manager = + compiler.getStandardFileManager(null, null, null); + Iterable units = manager.getJavaFileObjects(test_java); + final StringWriter sw = new StringWriter(); + JavacTask task = (JavacTask) compiler.getTask(sw, manager, null, null, + null, units); + + new TreeScanner() { + @Override + public Boolean visitClass(ClassTree arg0, Void arg1) { + sw.write(arg0.toString()); + return super.visitClass(arg0, arg1); + } + }.scan(task.parse(), null); + + System.out.println("output:"); + System.out.println(sw.toString()); + String found = sw.toString().replaceAll("\\s+", " ").trim(); + String expect = test.replaceAll("\\s+", " ").trim(); + if (!expect.equals(found)) { + System.out.println("expect: " + expect); + System.out.println("found: " + found); + throw new Exception("unexpected output"); + } + } + + static void write(File file, String body) throws IOException { + FileWriter out = new FileWriter(file); + out.write(body); + out.close(); + } +} From 2c83d314bc585c1d5f341271ed96640eafa1e394 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 8 Jan 2010 11:32:57 -0800 Subject: [PATCH 17/59] 6915078: ALT_JDK_IMPORT_PATH typo in langtools/make/Makefile Reviewed-by: tbell --- langtools/make/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langtools/make/Makefile b/langtools/make/Makefile index 18da5257eed..ec31db106b5 100644 --- a/langtools/make/Makefile +++ b/langtools/make/Makefile @@ -144,8 +144,8 @@ else ifdef ALT_JDK_TOPDIR ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_TOPDIR) else - ifdef ALT_JDK_IMPORT_DIR - ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_IMPORT_DIR) + ifdef ALT_JDK_IMPORT_PATH + ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_IMPORT_PATH) endif endif endif From 09e737337bc15a49de0d938d9ab72427b45ade22 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 8 Jan 2010 13:14:45 -0800 Subject: [PATCH 18/59] 6915152: langtools build failures with import.jdk on Windows Reviewed-by: ohair --- langtools/make/build.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/langtools/make/build.xml b/langtools/make/build.xml index 7081f4dff6d..d614578847f 100644 --- a/langtools/make/build.xml +++ b/langtools/make/build.xml @@ -107,14 +107,21 @@ ignoresystemclasses="true" classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/> + + + From 46d57b48e414665e2425817c516f419a23a6b5aa Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Sat, 9 Jan 2010 19:32:58 +0000 Subject: [PATCH 19/59] 6907760: (file) OVERFLOW event should cause pending events to be purged Reviewed-by: chegar --- .../classes/sun/nio/fs/AbstractWatchKey.java | 34 +++-- .../WatchService/OverflowEventIsLoner.java | 122 ++++++++++++++++++ 2 files changed, 138 insertions(+), 18 deletions(-) create mode 100644 jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java diff --git a/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java b/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java index 8e33f81ed84..b00c71d37cd 100644 --- a/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java +++ b/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java @@ -88,26 +88,24 @@ abstract class AbstractWatchKey extends WatchKey { final void signalEvent(WatchEvent.Kind kind, Object context) { synchronized (this) { int size = events.size(); - if (size > 1) { - // don't let list get too big - if (size >= MAX_EVENT_LIST_SIZE) { - kind = StandardWatchEventKind.OVERFLOW; - context = null; + if (size > 0) { + // if the previous event is an OVERFLOW event or this is a + // repeated event then we simply increment the counter + WatchEvent prev = events.get(size-1); + if ((prev.kind() == StandardWatchEventKind.OVERFLOW) || + ((kind == prev.kind() && + Objects.equals(context, prev.context())))) + { + ((Event)prev).increment(); + return; } - // repeated event - WatchEvent prev = events.get(size-1); - if (kind == prev.kind()) { - boolean isRepeat; - if (context == null) { - isRepeat = (prev.context() == null); - } else { - isRepeat = context.equals(prev.context()); - } - if (isRepeat) { - ((Event)prev).increment(); - return; - } + // if the list has reached the limit then drop pending events + // and queue an OVERFLOW event + if (size >= MAX_EVENT_LIST_SIZE) { + events.clear(); + kind = StandardWatchEventKind.OVERFLOW; + context = null; } } diff --git a/jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java b/jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java new file mode 100644 index 00000000000..0b48a942d84 --- /dev/null +++ b/jdk/test/java/nio/file/WatchService/OverflowEventIsLoner.java @@ -0,0 +1,122 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6907760 + * @summary Check that the OVERFLOW event is not retrieved with other events + * @library .. + */ + +import java.nio.file.*; +import static java.nio.file.StandardWatchEventKind.*; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; + +public class OverflowEventIsLoner { + + static void drainEvents(WatchService watcher, + WatchEvent.Kind expectedKind, + int count) + throws IOException, InterruptedException + { + // wait for key to be signalled - the timeout is long to allow for + // polling implementations + WatchKey key = watcher.poll(15, TimeUnit.SECONDS); + if (key != null && count == 0) + throw new RuntimeException("Key was signalled (unexpected)"); + if (key == null && count > 0) + throw new RuntimeException("Key not signalled (unexpected)"); + + int nread = 0; + boolean gotOverflow = false; + do { + List> events = key.pollEvents(); + for (WatchEvent event: events) { + WatchEvent.Kind kind = event.kind(); + if (kind == expectedKind) { + // expected event kind + if (++nread > count) + throw new RuntimeException("More events than expected!!"); + } else if (kind == OVERFLOW) { + // overflow event should not be retrieved with other events + if (events.size() > 1) + throw new RuntimeException("Overflow retrieved with other events"); + gotOverflow = true; + } else { + throw new RuntimeException("Unexpected event '" + kind + "'"); + } + } + if (!key.reset()) + throw new RuntimeException("Key is no longer valid"); + key = watcher.poll(2, TimeUnit.SECONDS); + } while (key != null); + + // check that all expected events were received or there was an overflow + if (nread < count && !gotOverflow) + throw new RuntimeException("Insufficient events"); + } + + + static void test(Path dir) throws IOException, InterruptedException { + WatchService watcher = dir.getFileSystem().newWatchService(); + try { + WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE); + + // create a lot of files + int n = 1024; + Path[] files = new Path[n]; + for (int i=0; i Date: Sun, 10 Jan 2010 12:29:19 +0000 Subject: [PATCH 20/59] 6913877: (fs) AsynchronousFileChannel.write can return wrong result under load [win] Reviewed-by: chegar --- .../WindowsAsynchronousFileChannelImpl.java | 49 ++---- .../ch/WindowsAsynchronousFileChannelImpl.c | 14 +- .../AsynchronousFileChannel/LotsOfWrites.java | 162 ++++++++++++++++++ 3 files changed, 187 insertions(+), 38 deletions(-) create mode 100644 jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java diff --git a/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java b/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java index 0b43ab0d516..e14ac2fc659 100644 --- a/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java +++ b/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java @@ -445,20 +445,17 @@ public class WindowsAsynchronousFileChannelImpl // allocate OVERLAPPED overlapped = ioCache.add(result); - // synchronize on result to allow this thread handle the case - // where the read completes immediately. - synchronized (result) { - n = readFile(handle, address, rem, position, overlapped); - if (n == IOStatus.UNAVAILABLE) { - // I/O is pending - return; - } - // read completed immediately: - // 1. update buffer position - // 2. release waiters - updatePosition(n); + // initiate read + n = readFile(handle, address, rem, position, overlapped); + if (n == IOStatus.UNAVAILABLE) { + // I/O is pending + return; + } else if (n == IOStatus.EOF) { result.setResult(n); + } else { + throw new InternalError("Unexpected result: " + n); } + } catch (Throwable x) { // failed to initiate read result.setFailure(toIOException(x)); @@ -466,12 +463,9 @@ public class WindowsAsynchronousFileChannelImpl end(); } - // read failed or EOF so completion port will not be notified - if (n < 0 && overlapped != 0L) { + // release resources + if (overlapped != 0L) ioCache.remove(overlapped); - } - - // return direct buffer to cache if substituted releaseBufferIfSubstituted(); // invoke completion handler @@ -634,20 +628,15 @@ public class WindowsAsynchronousFileChannelImpl // allocate an OVERLAPPED structure overlapped = ioCache.add(result); - // synchronize on result to allow this thread handle the case - // where the read completes immediately. - synchronized (result) { - n = writeFile(handle, address, rem, position, overlapped); - if (n == IOStatus.UNAVAILABLE) { - // I/O is pending - return; - } - // read completed immediately: - // 1. update buffer position - // 2. release waiters - updatePosition(n); - result.setResult(n); + // initiate the write + n = writeFile(handle, address, rem, position, overlapped); + if (n == IOStatus.UNAVAILABLE) { + // I/O is pending + return; + } else { + throw new InternalError("Unexpected result: " + n); } + } catch (Throwable x) { // failed to initiate read: result.setFailure(toIOException(x)); diff --git a/jdk/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c index d8346ba3e7a..cf742116c79 100644 --- a/jdk/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c +++ b/jdk/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c @@ -39,7 +39,6 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_readFile(JNIEnv* env, jclass jlong handle, jlong address, jint len, jlong offset, jlong ov) { BOOL res; - DWORD nread = 0; OVERLAPPED* lpOverlapped = (OVERLAPPED*)jlong_to_ptr(ov); lpOverlapped->Offset = (DWORD)offset; @@ -49,7 +48,7 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_readFile(JNIEnv* env, jclass res = ReadFile((HANDLE) jlong_to_ptr(handle), (LPVOID) jlong_to_ptr(address), (DWORD)len, - &nread, + NULL, lpOverlapped); if (res == 0) { @@ -62,7 +61,7 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_readFile(JNIEnv* env, jclass return IOS_THROWN; } - return (jint)nread; + return IOS_UNAVAILABLE; } JNIEXPORT jint JNICALL @@ -70,7 +69,6 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_writeFile(JNIEnv* env, jclass jlong handle, jlong address, jint len, jlong offset, jlong ov) { BOOL res; - DWORD nwritten = 0; OVERLAPPED* lpOverlapped = (OVERLAPPED*)jlong_to_ptr(ov); lpOverlapped->Offset = (DWORD)offset; @@ -80,18 +78,18 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_writeFile(JNIEnv* env, jclass res = WriteFile((HANDLE)jlong_to_ptr(handle), (LPVOID) jlong_to_ptr(address), (DWORD)len, - &nwritten, + NULL, lpOverlapped); if (res == 0) { int error = GetLastError(); - if (error == ERROR_IO_PENDING) { + if (error == ERROR_IO_PENDING) return IOS_UNAVAILABLE; - } JNU_ThrowIOExceptionWithLastError(env, "WriteFile failed"); return IOS_THROWN; } - return (jint)nwritten; + + return IOS_UNAVAILABLE; } JNIEXPORT jint JNICALL diff --git a/jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java b/jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java new file mode 100644 index 00000000000..dd2c27ddbd4 --- /dev/null +++ b/jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java @@ -0,0 +1,162 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6913877 + * @summary Stress AsynchronousFileChannel.write + */ + +import java.io.*; +import java.nio.ByteBuffer; +import static java.nio.file.StandardOpenOption.*; +import java.nio.channels.*; +import java.util.Random; +import java.util.concurrent.CountDownLatch; + +public class LotsOfWrites { + static final Random rand = new Random(); + + /** + * Asynchronously writes a known pattern to a file up to a given size, + * counting down a latch to release waiters when done. + */ + static class Writer implements CompletionHandler { + private final File file; + private final long size; + private final CountDownLatch latch; + private final AsynchronousFileChannel channel; + + private volatile long position; + private volatile byte nextByte; + + private long updatePosition(long nwrote) { + position += nwrote; + return position; + } + + private ByteBuffer genNextBuffer() { + int n = Math.min(8192 + rand.nextInt(8192), (int)(size - position)); + ByteBuffer buf = ByteBuffer.allocate(n); + for (int i=0; i= size) { + done(); + return; + } + buf = genNextBuffer(); + } + channel.write(buf, pos, buf, this); + } + + @Override + public void failed(Throwable exc, ByteBuffer buf) { + exc.printStackTrace(); + done(); + } + } + + public static void main(String[] args) throws Exception { + // random number of writers + int count = 20 + rand.nextInt(16); + Writer[] writers = new Writer[count]; + CountDownLatch latch = new CountDownLatch(count); + + // initiate writing to each file + for (int i=0; i 0) { + for (int j=0; j Date: Mon, 11 Jan 2010 16:04:05 +0000 Subject: [PATCH 21/59] 6915313: Reorganize implementation to make it more feasible to port to JDK6 This makes the SCTP implementation easier to run with Suns JDK6. Reviewed-by: alanb --- jdk/make/com/sun/nio/sctp/FILES_java.gmk | 3 +- jdk/make/com/sun/nio/sctp/mapfile-vers | 5 ++ .../classes/sun/nio/ch/SctpChannelImpl.java | 16 ++-- .../sun/nio/ch/SctpMultiChannelImpl.java | 15 ++-- .../solaris/classes/sun/nio/ch/SctpNet.java | 39 +++++++- .../sun/nio/ch/SctpServerChannelImpl.java | 15 ++-- .../sun/nio/ch/SctpSocketDispatcher.java | 68 -------------- jdk/src/solaris/native/sun/nio/ch/SctpNet.c | 90 +++++++++++++++++++ 8 files changed, 149 insertions(+), 102 deletions(-) delete mode 100644 jdk/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java diff --git a/jdk/make/com/sun/nio/sctp/FILES_java.gmk b/jdk/make/com/sun/nio/sctp/FILES_java.gmk index 8be820fae9c..09c1563dcb9 100644 --- a/jdk/make/com/sun/nio/sctp/FILES_java.gmk +++ b/jdk/make/com/sun/nio/sctp/FILES_java.gmk @@ -57,8 +57,7 @@ FILES_java += \ sun/nio/ch/SctpResultContainer.java \ sun/nio/ch/SctpSendFailed.java \ sun/nio/ch/SctpServerChannelImpl.java \ - sun/nio/ch/SctpShutdown.java \ - sun/nio/ch/SctpSocketDispatcher.java + sun/nio/ch/SctpShutdown.java else FILES_java += \ sun/nio/ch/SctpChannelImpl.java \ diff --git a/jdk/make/com/sun/nio/sctp/mapfile-vers b/jdk/make/com/sun/nio/sctp/mapfile-vers index 0e5138586a0..21ac26ea7d8 100644 --- a/jdk/make/com/sun/nio/sctp/mapfile-vers +++ b/jdk/make/com/sun/nio/sctp/mapfile-vers @@ -25,9 +25,14 @@ SUNWprivate_1.1 { global: + Java_sun_nio_ch_SctpNet_init; Java_sun_nio_ch_SctpNet_socket0; Java_sun_nio_ch_SctpNet_bindx; Java_sun_nio_ch_SctpNet_branch0; + Java_sun_nio_ch_SctpNet_listen0; + Java_sun_nio_ch_SctpNet_connect0; + Java_sun_nio_ch_SctpNet_close0; + Java_sun_nio_ch_SctpNet_preClose0; Java_sun_nio_ch_SctpNet_getLocalAddresses0; Java_sun_nio_ch_SctpNet_getRemoteAddresses0; Java_sun_nio_ch_SctpNet_getPrimAddrOption0; diff --git a/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java index d7842570a2c..be64c9c0a68 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java @@ -38,7 +38,6 @@ import java.nio.channels.SelectionKey; import java.nio.channels.ClosedChannelException; import java.nio.channels.ConnectionPendingException; import java.nio.channels.NoConnectionPendingException; -import java.nio.channels.AlreadyBoundException; import java.nio.channels.AlreadyConnectedException; import java.nio.channels.NotYetBoundException; import java.nio.channels.NotYetConnectedException; @@ -54,7 +53,6 @@ import com.sun.nio.sctp.MessageInfo; import com.sun.nio.sctp.NotificationHandler; import com.sun.nio.sctp.SctpChannel; import com.sun.nio.sctp.SctpSocketOption; -import sun.nio.ch.NativeDispatcher; import sun.nio.ch.PollArrayWrapper; import sun.nio.ch.SelChImpl; import static com.sun.nio.sctp.SctpStandardSocketOption.*; @@ -69,9 +67,6 @@ import static sun.nio.ch.SctpResultContainer.SHUTDOWN; public class SctpChannelImpl extends SctpChannel implements SelChImpl { - /* Used to make native close and preClose calls */ - private static NativeDispatcher nd; - private final FileDescriptor fd; private final int fdVal; @@ -182,7 +177,7 @@ public class SctpChannelImpl extends SctpChannel synchronized (stateLock) { ensureOpenAndUnconnected(); if (isBound()) - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); InetSocketAddress isa = (local == null) ? new InetSocketAddress(0) : Net.checkAddress(local); Net.bind(fd, isa.getAddress(), isa.getPort()); @@ -234,7 +229,7 @@ public class SctpChannelImpl extends SctpChannel if (add) { for (InetSocketAddress addr : localAddresses) { if (addr.getAddress().equals(address)) { - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); } } } else { /*removing */ @@ -370,7 +365,7 @@ public class SctpChannelImpl extends SctpChannel InetAddress ia = isa.getAddress(); if (ia.isAnyLocalAddress()) ia = InetAddress.getLocalHost(); - n = Net.connect(fd, ia, isa.getPort()); + n = SctpNet.connect(fdVal, ia, isa.getPort()); if ( (n == IOStatus.INTERRUPTED) && isOpen()) continue; @@ -556,7 +551,7 @@ public class SctpChannelImpl extends SctpChannel @Override public void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + SctpNet.preClose(fdVal); if (receiverThread != 0) NativeThread.signal(receiverThread); @@ -662,7 +657,7 @@ public class SctpChannelImpl extends SctpChannel /* Postpone the kill if there is a waiting reader * or writer thread. */ if (receiverThread == 0 && senderThread == 0) { - nd.close(fd); + SctpNet.close(fdVal); state = ChannelState.KILLED; } else { state = ChannelState.KILLPENDING; @@ -1097,6 +1092,5 @@ public class SctpChannelImpl extends SctpChannel java.security.AccessController.doPrivileged( new sun.security.action.LoadLibraryAction("sctp")); initIDs(); - nd = new SctpSocketDispatcher(); } } diff --git a/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java index b8457fdba27..92ebb3f67b5 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java @@ -38,7 +38,6 @@ import java.util.HashSet; import java.util.HashMap; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; -import java.nio.channels.AlreadyBoundException; import java.nio.channels.ClosedChannelException; import java.nio.channels.NotYetBoundException; import java.nio.channels.spi.SelectorProvider; @@ -63,9 +62,6 @@ import static sun.nio.ch.SctpResultContainer.*; public class SctpMultiChannelImpl extends SctpMultiChannel implements SelChImpl { - /* Used to make native close and preClose calls */ - private static NativeDispatcher nd; - private final FileDescriptor fd; private final int fdVal; @@ -140,7 +136,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel synchronized (stateLock) { ensureOpen(); if (isBound()) - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); InetSocketAddress isa = (local == null) ? new InetSocketAddress(0) : Net.checkAddress(local); @@ -155,7 +151,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel if (isa.getAddress().isAnyLocalAddress()) wildcard = true; - Net.listen(fd, backlog < 1 ? 50 : backlog); + SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog); } } } @@ -196,7 +192,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel if (add) { for (InetSocketAddress addr : localAddresses) { if (addr.getAddress().equals(address)) { - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); } } } else { /*removing */ @@ -284,7 +280,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel @Override public void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + SctpNet.preClose(fdVal); if (receiverThread != 0) NativeThread.signal(receiverThread); @@ -375,7 +371,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel /* Postpone the kill if there is a thread sending or receiving. */ if (receiverThread == 0 && senderThread == 0) { - nd.close(fd); + SctpNet.close(fdVal); state = ChannelState.KILLED; } else { state = ChannelState.KILLPENDING; @@ -981,6 +977,5 @@ public class SctpMultiChannelImpl extends SctpMultiChannel Util.load(); /* loads nio & net native libraries */ java.security.AccessController.doPrivileged( new sun.security.action.LoadLibraryAction("sctp")); - nd = new SctpSocketDispatcher(); } } diff --git a/jdk/src/solaris/classes/sun/nio/ch/SctpNet.java b/jdk/src/solaris/classes/sun/nio/ch/SctpNet.java index f4cd5005f15..39019e7fd0a 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SctpNet.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SctpNet.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketAddress; +import java.nio.channels.AlreadyBoundException; import java.util.Set; import java.util.HashSet; import java.security.AccessController; @@ -52,8 +53,29 @@ public class SctpNet { return false; } + static boolean throwAlreadyBoundException() throws IOException { + throw new AlreadyBoundException(); + } + + static void listen(int fd, int backlog) throws IOException { + listen0(fd, backlog); + } + + static int connect(int fd, InetAddress remote, int remotePort) + throws IOException { + return connect0(fd, remote, remotePort); + } + + static void close(int fd) throws IOException { + close0(fd); + } + + static void preClose(int fd) throws IOException { + preClose0(fd); + } + /** - * @param oneToone + * @param oneToOne * if {@code true} returns a one-to-one sctp socket, otherwise * returns a one-to-many sctp socket */ @@ -240,6 +262,15 @@ public class SctpNet { /* Native Methods */ static native int socket0(boolean oneToOne) throws IOException; + static native void listen0(int fd, int backlog) throws IOException; + + static native int connect0(int fd, InetAddress remote, int remotePort) + throws IOException; + + static native void close0(int fd) throws IOException; + + static native void preClose0(int fd) throws IOException; + static native void bindx(int fd, InetAddress[] addrs, int port, int length, boolean add, boolean preferIPv6) throws IOException; @@ -271,5 +302,11 @@ public class SctpNet { throws IOException; static native void shutdown0(int fd, int assocId); + + static native void init(); + + static { + init(); + } } diff --git a/jdk/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java index 5381591b7f0..740905a0941 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java @@ -33,7 +33,6 @@ import java.util.Collections; import java.util.Set; import java.util.HashSet; import java.nio.channels.SelectionKey; -import java.nio.channels.AlreadyBoundException; import java.nio.channels.ClosedChannelException; import java.nio.channels.NotYetBoundException; import java.nio.channels.spi.SelectorProvider; @@ -49,9 +48,6 @@ import com.sun.nio.sctp.SctpStandardSocketOption; public class SctpServerChannelImpl extends SctpServerChannel implements SelChImpl { - /* Used to make native close and preClose calls */ - private static NativeDispatcher nd; - private final FileDescriptor fd; private final int fdVal; @@ -103,7 +99,7 @@ public class SctpServerChannelImpl extends SctpServerChannel if (!isOpen()) throw new ClosedChannelException(); if (isBound()) - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); InetSocketAddress isa = (local == null) ? new InetSocketAddress(0) : Net.checkAddress(local); @@ -118,7 +114,7 @@ public class SctpServerChannelImpl extends SctpServerChannel if (isa.getAddress().isAnyLocalAddress()) wildcard = true; - Net.listen(fd, backlog < 1 ? 50 : backlog); + SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog); } } return this; @@ -156,7 +152,7 @@ public class SctpServerChannelImpl extends SctpServerChannel if (add) { for (InetSocketAddress addr : localAddresses) { if (addr.getAddress().equals(address)) { - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); } } } else { /*removing */ @@ -261,7 +257,7 @@ public class SctpServerChannelImpl extends SctpServerChannel @Override public void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + SctpNet.preClose(fdVal); if (thread != 0) NativeThread.signal(thread); if (!isRegistered()) @@ -282,7 +278,7 @@ public class SctpServerChannelImpl extends SctpServerChannel // Postpone the kill if there is a thread in accept if (thread == 0) { - nd.close(fd); + SctpNet.close(fdVal); state = ChannelState.KILLED; } else { state = ChannelState.KILLPENDING; @@ -423,7 +419,6 @@ public class SctpServerChannelImpl extends SctpServerChannel Util.load(); // loads nio & net native libraries java.security.AccessController.doPrivileged( new sun.security.action.LoadLibraryAction("sctp")); - nd = new SctpSocketDispatcher(); initIDs(); } } diff --git a/jdk/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java b/jdk/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java deleted file mode 100644 index 937a7392496..00000000000 --- a/jdk/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.nio.ch; - -import java.io.IOException; -import java.io.FileDescriptor; - -/** - * Only used for {@code close} and {@code preclose}. All other methods - * throw {@code IOException}. - */ -class SctpSocketDispatcher extends NativeDispatcher { - @Override - @SuppressWarnings("unused") - int read(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - @SuppressWarnings("unused") - long readv(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - @SuppressWarnings("unused") - int write(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - @SuppressWarnings("unused") - long writev(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - void close(FileDescriptor fd) throws IOException { - FileDispatcherImpl.close0(fd); - } - - @Override - void preClose(FileDescriptor fd) throws IOException { - FileDispatcherImpl.preClose0(fd); - } -} diff --git a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c index 85611bd0d9d..8a27807c599 100644 --- a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c +++ b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c @@ -48,6 +48,9 @@ JNIEXPORT jint JNICALL JNI_OnLoad return JNI_VERSION_1_2; } +static int preCloseFD = -1; /* File descriptor to which we dup other fd's + before closing them for real */ + /** * Loads the native sctp library that contains the socket extension * functions, as well as locating the individual functions. @@ -107,6 +110,23 @@ jboolean loadSocketExtensionFuncs return JNI_TRUE; } +/* + * Class: sun_nio_ch_SctpNet + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_init + (JNIEnv *env, jclass cl) { + int sp[2]; + if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) < 0) { + JNU_ThrowIOExceptionWithLastError(env, "socketpair failed"); + return; + } + preCloseFD = sp[0]; + close(sp[1]); +} + /* * Class: sun_nio_ch_SctpNet * Method: socket0 @@ -184,6 +204,76 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_bindx free(sap); } +/* + * Class: sun_nio_ch_SctpNet + * Method: listen0 + * Signature: (II)V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_listen0 + (JNIEnv *env, jclass cl, jint fd, jint backlog) { + if (listen(fd, backlog) < 0) + handleSocketError(env, errno); +} + +/* + * Class: sun_nio_ch_SctpNet + * Method: connect0 + * Signature: (ILjava/net/InetAddress;I)I + */ +JNIEXPORT jint JNICALL +Java_sun_nio_ch_SctpNet_connect0 + (JNIEnv *env, jclass clazz, int fd, jobject iao, jint port) { + SOCKADDR sa; + int sa_len = SOCKADDR_LEN; + int rv; + + if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *) &sa, + &sa_len, JNI_TRUE) != 0) { + return IOS_THROWN; + } + + rv = connect(fd, (struct sockaddr *)&sa, sa_len); + if (rv != 0) { + if (errno == EINPROGRESS) { + return IOS_UNAVAILABLE; + } else if (errno == EINTR) { + return IOS_INTERRUPTED; + } + return handleSocketError(env, errno); + } + return 1; +} + +/* + * Class: sun_nio_ch_SctpNet + * Method: close0 + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_close0 + (JNIEnv *env, jclass clazz, jint fd) { + if (fd != -1) { + int rv = close(fd); + if (rv < 0) + JNU_ThrowIOExceptionWithLastError(env, "Close failed"); + } +} + +/* + * Class: sun_nio_ch_SctpNet + * Method: preClose0 + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_preClose0 + (JNIEnv *env, jclass clazz, jint fd) { + if (preCloseFD >= 0) { + if (dup2(preCloseFD, fd) < 0) + JNU_ThrowIOExceptionWithLastError(env, "dup2 failed"); + } +} + void initializeISA (JNIEnv* env) { if (isaCls == 0) { From 4447330ab3a0339d63622ff6ae4ca8463876e54a Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Mon, 11 Jan 2010 14:05:21 -0800 Subject: [PATCH 22/59] 6326754: Compiler will fail to handle -Xmaxerrs with -ve numbers Reviewed-by: ksrini --- .../classes/com/sun/tools/javac/util/Log.java | 5 +- langtools/test/tools/javac/T6326754.java | 76 +++++++++++++++++++ langtools/test/tools/javac/T6326754.out | 7 ++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/T6326754.java create mode 100644 langtools/test/tools/javac/T6326754.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java index 7184bd9ed5c..ee7d7fa8caa 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java @@ -145,7 +145,10 @@ public class Log extends AbstractLog { private int getIntOption(Options options, String optionName, int defaultValue) { String s = options.get(optionName); try { - if (s != null) return Integer.parseInt(s); + if (s != null) { + int n = Integer.parseInt(s); + return (n <= 0 ? Integer.MAX_VALUE : n); + } } catch (NumberFormatException e) { // silently ignore ill-formed numbers } diff --git a/langtools/test/tools/javac/T6326754.java b/langtools/test/tools/javac/T6326754.java new file mode 100644 index 00000000000..b04f311abde --- /dev/null +++ b/langtools/test/tools/javac/T6326754.java @@ -0,0 +1,76 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6326754 + * @summary Compiler will fail to handle -Xmaxerrs with -ve numbers + * + * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs -1 T6326754.java + * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs 0 T6326754.java + * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs 10 T6326754.java + * @compile/fail/ref=T6326754.out -XDrawDiagnostics T6326754.java + */ +class TestConstructor{ + T t; + K k; + public TestConstructor(T t,K k){ + this.t =t; + } + public TestConstructor(K k){ + this.k = k; + this.t = null; + } + public TestConstructor(T t){ + this.t=t; + this.k=null; + } + public void setT(T t){ + this.t=t; + this.k=null; + } + public void setT(K k){ + this.k = k; + this.t = null; + } + public void setT(T t,K k){ + this.t = t; + this.k = k; + } +} +class TestC{ + T t; + public void setT(T t){ + this.t = t; + } +} +public class T6326754{ + public static void main(String... arg){ + TestC tC =new TestC(); + tC.setT(); + TestConstructor tc = new TestConstructor("saaa"); + tc.setT("sasa"); + TestC tC1 = new TestC(); + tC1.setT(545); + } +} diff --git a/langtools/test/tools/javac/T6326754.out b/langtools/test/tools/javac/T6326754.out new file mode 100644 index 00000000000..efbd8393b8b --- /dev/null +++ b/langtools/test/tools/javac/T6326754.out @@ -0,0 +1,7 @@ +T6326754.java:44:12: compiler.err.name.clash.same.erasure: TestConstructor(T), TestConstructor(K) +T6326754.java:52:17: compiler.err.name.clash.same.erasure: setT(K), setT(T) +T6326754.java:64:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), T, T +T6326754.java:70:11: compiler.err.cant.apply.symbol: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC, null +- compiler.note.unchecked.filename: T6326754.java +- compiler.note.unchecked.recompile +4 errors From dfe44a05ec8eea9718bbb666d8c67790f79733b0 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 11 Jan 2010 14:09:15 -0800 Subject: [PATCH 23/59] 6764569: [PATCH] Fix unused imports in list resource bundles Reviewed-by: ksrini --- .../make/tools/CompileProperties/CompileProperties.java | 7 +++---- .../tools/CompileProperties/CompilePropertiesTask.java | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/langtools/make/tools/CompileProperties/CompileProperties.java b/langtools/make/tools/CompileProperties/CompileProperties.java index f498815ddf2..7e2d5dca58f 100644 --- a/langtools/make/tools/CompileProperties/CompileProperties.java +++ b/langtools/make/tools/CompileProperties/CompileProperties.java @@ -101,7 +101,7 @@ public class CompileProperties { boolean ok = true; /* Original usage */ if (args.length == 2 && args[0].charAt(0) != '-' ) { - ok = createFile(args[0], args[1], "ListResourceBundle"); + ok = createFile(args[0], args[1], "java.util.ListResourceBundle"); } else if (args.length == 3) { ok = createFile(args[0], args[1], args[2]); } else if (args.length == 0) { @@ -285,9 +285,9 @@ public class CompileProperties { log.info(" java CompileProperties {-compile path_to_properties_file path_to_java_output_file super_class} -or- -optionsfile filename"); log.info(""); log.info("Example:"); - log.info(" java CompileProperties -compile test.properties test.java ListResourceBundle"); + log.info(" java CompileProperties -compile test.properties test.java java.util.ListResourceBundle"); log.info(" java CompileProperties -optionsfile option_file"); - log.info("option_file contains: -compile test.properties test.java ListResourceBundle"); + log.info("option_file contains: -compile test.properties test.java java.util.ListResourceBundle"); } private static String escape(String theString) { @@ -379,7 +379,6 @@ public class CompileProperties { private static final String FORMAT = "{0}" + - "import java.util.ListResourceBundle;\n\n" + "public final class {1} extends {2} '{'\n" + " protected final Object[][] getContents() '{'\n" + " return new Object[][] '{'\n" + diff --git a/langtools/make/tools/CompileProperties/CompilePropertiesTask.java b/langtools/make/tools/CompileProperties/CompilePropertiesTask.java index e7a0be1751d..bed9e27b3bf 100644 --- a/langtools/make/tools/CompileProperties/CompilePropertiesTask.java +++ b/langtools/make/tools/CompileProperties/CompilePropertiesTask.java @@ -45,6 +45,7 @@ public class CompilePropertiesTask extends MatchingTask { this.superclass = superclass; } + @Override public void execute() { CompileProperties.Log log = new CompileProperties.Log() { public void error(String msg, Exception e) { @@ -84,7 +85,7 @@ public class CompilePropertiesTask extends MatchingTask { log("Generating " + count + " resource files to " + destDir, Project.MSG_INFO); CompileProperties cp = new CompileProperties(); cp.setLog(log); - boolean ok = cp.run((String[])mainOpts.toArray(new String[mainOpts.size()])); + boolean ok = cp.run(mainOpts.toArray(new String[mainOpts.size()])); if (!ok) throw new BuildException("CompileProperties failed."); } From 8d4265760027f2b82b0df81d88c48074bb3e9dc8 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Mon, 11 Jan 2010 14:12:10 -0800 Subject: [PATCH 24/59] 6915476: java.util.regex.PatternSyntaxException in com.sun.tools.javac.nio.PathFileObject Reviewed-by: darcy --- .../share/classes/com/sun/tools/javac/nio/PathFileObject.java | 2 +- langtools/test/tools/javac/nio/compileTest/CompileTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java index 80bdb2edb74..dc22ff3d978 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java +++ b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java @@ -309,7 +309,7 @@ abstract class PathFileObject implements JavaFileObject { } protected static String toBinaryName(String relativePath, String sep) { - return removeExtension(relativePath).replaceAll(sep, "."); + return removeExtension(relativePath).replace(sep, "."); } protected static String removeExtension(String fileName) { diff --git a/langtools/test/tools/javac/nio/compileTest/CompileTest.java b/langtools/test/tools/javac/nio/compileTest/CompileTest.java index 72df1693a8a..58e04ca4ff1 100644 --- a/langtools/test/tools/javac/nio/compileTest/CompileTest.java +++ b/langtools/test/tools/javac/nio/compileTest/CompileTest.java @@ -23,6 +23,8 @@ /** * @test + * @bug 6906175 6915476 + * @summary Path-based JavaFileManager * @compile HelloPathWorld.java * @run main CompileTest */ From 2279a1af12458588b1fed28579712bf217c0a0b2 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Mon, 11 Jan 2010 14:17:01 -0800 Subject: [PATCH 25/59] 6915497: test test/tools/javac/nio/compileTest/CompileTest.java fails under Hudson Reviewed-by: darcy --- .../test/tools/javac/nio/compileTest/CompileTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/langtools/test/tools/javac/nio/compileTest/CompileTest.java b/langtools/test/tools/javac/nio/compileTest/CompileTest.java index 58e04ca4ff1..9ec65c8014d 100644 --- a/langtools/test/tools/javac/nio/compileTest/CompileTest.java +++ b/langtools/test/tools/javac/nio/compileTest/CompileTest.java @@ -23,9 +23,9 @@ /** * @test - * @bug 6906175 6915476 + * @bug 6906175 6915476 6915497 * @summary Path-based JavaFileManager - * @compile HelloPathWorld.java + * @compile -g HelloPathWorld.java * @run main CompileTest */ @@ -94,7 +94,8 @@ public class CompileTest { options.addAll(Arrays.asList(opts)); options.addAll(Arrays.asList( "-verbose", "-XDverboseCompilePolicy", - "-d", classes.toString() + "-d", classes.toString(), + "-g" )); Iterable compilationUnits = fm.getJavaFileObjects(testSrcDir.resolve(className + ".java")); @@ -111,6 +112,8 @@ public class CompileTest { 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) From 8e7d694a820af5c087aa648a4a938acb784e5d2e Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 11 Jan 2010 15:35:28 -0800 Subject: [PATCH 26/59] 6828204: NavigableSet.subSet() documentation refers to nonexistent parameters Reviewed-by: martin --- jdk/src/share/classes/java/util/NavigableMap.java | 2 +- jdk/src/share/classes/java/util/NavigableSet.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/util/NavigableMap.java b/jdk/src/share/classes/java/util/NavigableMap.java index 592a20dbe6d..7761b0742c5 100644 --- a/jdk/src/share/classes/java/util/NavigableMap.java +++ b/jdk/src/share/classes/java/util/NavigableMap.java @@ -298,7 +298,7 @@ public interface NavigableMap extends SortedMap { * Returns a view of the portion of this map whose keys range from * {@code fromKey} to {@code toKey}. If {@code fromKey} and * {@code toKey} are equal, the returned map is empty unless - * {@code fromExclusive} and {@code toExclusive} are both true. The + * {@code fromInclusive} and {@code toInclusive} are both true. The * returned map is backed by this map, so changes in the returned map are * reflected in this map, and vice-versa. The returned map supports all * optional map operations that this map supports. diff --git a/jdk/src/share/classes/java/util/NavigableSet.java b/jdk/src/share/classes/java/util/NavigableSet.java index b96299e1547..d4f0b2ccd7c 100644 --- a/jdk/src/share/classes/java/util/NavigableSet.java +++ b/jdk/src/share/classes/java/util/NavigableSet.java @@ -192,7 +192,7 @@ public interface NavigableSet extends SortedSet { * Returns a view of the portion of this set whose elements range from * {@code fromElement} to {@code toElement}. If {@code fromElement} and * {@code toElement} are equal, the returned set is empty unless {@code - * fromExclusive} and {@code toExclusive} are both true. The returned set + * fromInclusive} and {@code toInclusive} are both true. The returned set * is backed by this set, so changes in the returned set are reflected in * this set, and vice-versa. The returned set supports all optional set * operations that this set supports. From 6e3f4a8a4cd971ad24babc131b97f081a49d7742 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Mon, 11 Jan 2010 16:18:05 -0800 Subject: [PATCH 27/59] 6909470: langtools stub generator should prune unnecessary imports Reviewed-by: darcy --- langtools/make/tools/GenStubs/GenStubs.java | 62 ++++++++++++++++++++- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/langtools/make/tools/GenStubs/GenStubs.java b/langtools/make/tools/GenStubs/GenStubs.java index da4d3b6082f..a2fd4b3605b 100644 --- a/langtools/make/tools/GenStubs/GenStubs.java +++ b/langtools/make/tools/GenStubs/GenStubs.java @@ -22,6 +22,7 @@ * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ + import java.io.*; import java.util.*; import javax.tools.JavaFileObject; @@ -41,15 +42,22 @@ import com.sun.tools.javac.api.JavacTool; import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.TypeTags; import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.JCTree.JCBlock; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; +import com.sun.tools.javac.tree.JCTree.JCFieldAccess; +import com.sun.tools.javac.tree.JCTree.JCIdent; +import com.sun.tools.javac.tree.JCTree.JCImport; import com.sun.tools.javac.tree.JCTree.JCLiteral; import com.sun.tools.javac.tree.JCTree.JCMethodDecl; import com.sun.tools.javac.tree.JCTree.JCModifiers; -import com.sun.tools.javac.tree.JCTree.JCStatement; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.tree.Pretty; +import com.sun.tools.javac.tree.TreeMaker; +import com.sun.tools.javac.tree.TreeScanner; import com.sun.tools.javac.tree.TreeTranslator; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.ListBuffer; +import com.sun.tools.javac.util.Name; +import javax.tools.JavaFileManager; /** * Generate stub source files by removing implementation details from input files. @@ -161,6 +169,7 @@ public class GenStubs { void makeStub(StandardJavaFileManager fm, CompilationUnitTree tree) throws IOException { CompilationUnitTree tree2 = new StubMaker().translate(tree); + CompilationUnitTree tree3 = new ImportCleaner(fm).removeRedundantImports(tree2); String className = fm.inferBinaryName(StandardLocation.SOURCE_PATH, tree.getSourceFile()); JavaFileObject fo = fm.getJavaFileForOutput(StandardLocation.SOURCE_OUTPUT, @@ -168,7 +177,7 @@ public class GenStubs { // System.err.println("Writing " + className + " to " + fo.getName()); Writer out = fo.openWriter(); try { - new Pretty(out, true).printExpr((JCTree) tree2); + new Pretty(out, true).printExpr((JCTree) tree3); } finally { out.close(); } @@ -272,6 +281,53 @@ public class GenStubs { } } + class ImportCleaner extends TreeScanner { + private Set names = new HashSet(); + private TreeMaker m; + + ImportCleaner(JavaFileManager fm) { + // ImportCleaner itself doesn't require a filemanager, but instantiating + // a TreeMaker does, indirectly (via ClassReader, sigh) + Context c = new Context(); + c.put(JavaFileManager.class, fm); + m = TreeMaker.instance(c); + } + + CompilationUnitTree removeRedundantImports(CompilationUnitTree t) { + JCCompilationUnit tree = (JCCompilationUnit) t; + tree.accept(this); + ListBuffer defs = new ListBuffer(); + for (JCTree def: tree.defs) { + if (def.getTag() == JCTree.IMPORT) { + JCImport imp = (JCImport) def; + if (imp.qualid.getTag() == JCTree.SELECT) { + JCFieldAccess qualid = (JCFieldAccess) imp.qualid; + if (!qualid.name.toString().equals("*") + && !names.contains(qualid.name)) { + continue; + } + } + } + defs.add(def); + } + return m.TopLevel(tree.packageAnnotations, tree.pid, defs.toList()); + } + + @Override + public void visitImport(JCImport tree) { } // ignore names found in imports + + @Override + public void visitIdent(JCIdent tree) { + names.add(tree.name); + } + + @Override + public void visitSelect(JCFieldAccess tree) { + super.visitSelect(tree); + names.add(tree.name); + } + } + //---------- Ant Invocation ------------------------------------------------ public static class Ant extends MatchingTask { From 74703b449349b25c07caa3abad258f20d87f6313 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 12 Jan 2010 15:19:24 -0800 Subject: [PATCH 28/59] 6915502: Legal notice repairs needed in jdk/make/modules/tools Fix the legal notice in jdk/make/modules/tools Reviewed-by: tbell --- jdk/make/modules/tools/build.xml | 44 ++++++++-------- .../tools/nbproject/project.properties | 40 +++++++-------- jdk/make/modules/tools/nbproject/project.xml | 51 +++++++++---------- 3 files changed, 60 insertions(+), 75 deletions(-) diff --git a/jdk/make/modules/tools/build.xml b/jdk/make/modules/tools/build.xml index 993ccb8de07..c52de21af90 100644 --- a/jdk/make/modules/tools/build.xml +++ b/jdk/make/modules/tools/build.xml @@ -1,32 +1,28 @@ + + diff --git a/jdk/make/modules/tools/nbproject/project.properties b/jdk/make/modules/tools/nbproject/project.properties index 00b74962d97..84df879f82b 100644 --- a/jdk/make/modules/tools/nbproject/project.properties +++ b/jdk/make/modules/tools/nbproject/project.properties @@ -1,32 +1,26 @@ # # Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. # -# - Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# 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). # -# - Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. +# 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. # -# - Neither the name of Sun Microsystems nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. # application.title=classanalyzer diff --git a/jdk/make/modules/tools/nbproject/project.xml b/jdk/make/modules/tools/nbproject/project.xml index 61955a8eac5..bd83ccaeb9b 100644 --- a/jdk/make/modules/tools/nbproject/project.xml +++ b/jdk/make/modules/tools/nbproject/project.xml @@ -1,34 +1,29 @@ + org.netbeans.modules.java.j2seproject From 5d1e287266a89d20f06ed20357730133711b5154 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 13 Jan 2010 17:39:44 -0800 Subject: [PATCH 29/59] 6472751: SourcePositions.getStartPos returns incorrect value for enum constants 6567414: javac compiler reports no source file or line on enum constant declaration error Reviewed-by: darcy --- .../sun/tools/javac/parser/JavacParser.java | 8 +- langtools/test/tools/javac/T6472751.java | 81 +++++++++++++++++++ langtools/test/tools/javac/T6567414.java | 11 +++ langtools/test/tools/javac/T6567414.out | 2 + 4 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 langtools/test/tools/javac/T6472751.java create mode 100644 langtools/test/tools/javac/T6567414.java create mode 100644 langtools/test/tools/javac/T6567414.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java index c84f2097c45..bf3aeb6ef6d 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -2613,12 +2613,12 @@ public class JavacParser implements Parser { body = toP(F.at(identPos).AnonymousClassDef(mods1, defs)); } if (args.isEmpty() && body == null) - createPos = Position.NOPOS; - JCIdent ident = F.at(Position.NOPOS).Ident(enumName); + createPos = identPos; + JCIdent ident = F.at(identPos).Ident(enumName); JCNewClass create = F.at(createPos).NewClass(null, typeArgs, ident, args, body); - if (createPos != Position.NOPOS) + if (createPos != identPos) storeEnd(create, S.prevEndPos()); - ident = F.at(Position.NOPOS).Ident(enumName); + ident = F.at(identPos).Ident(enumName); JCTree result = toP(F.at(pos).VarDef(mods, name, ident, create)); attach(result, dc); return result; diff --git a/langtools/test/tools/javac/T6472751.java b/langtools/test/tools/javac/T6472751.java new file mode 100644 index 00000000000..2f3e63f3ef5 --- /dev/null +++ b/langtools/test/tools/javac/T6472751.java @@ -0,0 +1,81 @@ +/* + * Copyright 2006-2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6472751 + * @summary SourcePositions.getStartPos returns incorrect value for enum constants + * @author Peter Ahe + */ + +import com.sun.source.tree.CompilationUnitTree; +import com.sun.source.tree.Tree; +import com.sun.source.tree.Tree.Kind; +import com.sun.source.util.JavacTask; +import com.sun.source.util.SourcePositions; +import com.sun.source.util.TreeScanner; +import com.sun.source.util.Trees; +import com.sun.tools.javac.util.List; +import java.io.IOException; +import java.net.URI; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.ToolProvider; + +public class T6472751 { + static class MyFileObject extends SimpleJavaFileObject { + public MyFileObject() { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + } + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return "public enum Test { ABC, DEF; }"; + } + } + static Trees trees; + static SourcePositions positions; + public static void main(String[] args) throws IOException { + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + JavacTask task = (JavacTask) compiler.getTask(null, null, null, null, null, List.of(new MyFileObject())); + trees = Trees.instance(task); + positions = trees.getSourcePositions(); + Iterable asts = task.parse(); + for (CompilationUnitTree ast : asts) { + new MyVisitor().scan(ast, null); + } + } + + static class MyVisitor extends TreeScanner { + @Override + public Void scan(Tree node, Void ignored) { + if (node == null) + return null; + Kind k = node.getKind(); + long pos = positions.getStartPosition(null,node); + System.out.format("%s: %s%n", k, pos); + if (k != Kind.MODIFIERS && pos < 0) + throw new Error("unexpected position found"); + return super.scan(node, ignored); + } + } +} diff --git a/langtools/test/tools/javac/T6567414.java b/langtools/test/tools/javac/T6567414.java new file mode 100644 index 00000000000..1a2fa48c840 --- /dev/null +++ b/langtools/test/tools/javac/T6567414.java @@ -0,0 +1,11 @@ +/* + * @test /nodynamiccopyright/ + * @bug 6567414 + * @summary javac compiler reports no source file or line on enum constant declaration error + * @compile/fail/ref=T6567414.out -XDrawDiagnostics T6567414.java + */ +enum Test { + FOO; + Test() throws Exception {} +} + diff --git a/langtools/test/tools/javac/T6567414.out b/langtools/test/tools/javac/T6567414.out new file mode 100644 index 00000000000..0f332d24cb9 --- /dev/null +++ b/langtools/test/tools/javac/T6567414.out @@ -0,0 +1,2 @@ +T6567414.java:8:3: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception +1 error From 7d98f6dfb1225557ce3f8ad4b0cf9c8cd12c6d9a Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Thu, 14 Jan 2010 17:18:30 -0800 Subject: [PATCH 30/59] 6917122: provide utility method to find the inner most type of a type tree Co-authored-by: Michael Ernst Reviewed-by: darcy, jjg --- .../classes/com/sun/tools/javac/tree/Pretty.java | 15 +-------------- .../com/sun/tools/javac/tree/TreeInfo.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java index 34909d336c0..ef4d4dc02dc 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java @@ -1152,20 +1152,7 @@ public class Pretty extends JCTree.Visitor { // Prints the inner element type of a nested array private void printBaseElementType(JCTree tree) throws IOException { - switch (tree.getTag()) { - case JCTree.TYPEARRAY: - printBaseElementType(((JCArrayTypeTree)tree).elemtype); - return; - case JCTree.WILDCARD: - printBaseElementType(((JCWildcard)tree).inner); - return; - case JCTree.ANNOTATED_TYPE: - printBaseElementType(((JCAnnotatedType)tree).underlyingType); - return; - default: - printExpr(tree); - return; - } + printExpr(TreeInfo.innermostType(tree)); } // prints the brackets of a nested array in reverse order diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java index fead12535a3..de1afecbbf4 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java @@ -891,4 +891,17 @@ public class TreeInfo { throw new AssertionError("Unexpected type tree: " + tree); } } + + public static JCTree innermostType(JCTree type) { + switch (type.getTag()) { + case JCTree.TYPEARRAY: + return innermostType(((JCArrayTypeTree)type).elemtype); + case JCTree.WILDCARD: + return innermostType(((JCWildcard)type).inner); + case JCTree.ANNOTATED_TYPE: + return innermostType(((JCAnnotatedType)type).underlyingType); + default: + return type; + } + } } From d7b99be64832a2446b98038c5f6c64ec1968f7da Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Thu, 14 Jan 2010 17:23:53 -0800 Subject: [PATCH 31/59] 6916986: handle spaces in langtools launcher path Co-authored-by: Michael Ernst Reviewed-by: darcy, jjg --- langtools/src/share/bin/launcher.sh-template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langtools/src/share/bin/launcher.sh-template b/langtools/src/share/bin/launcher.sh-template index c62af2e9b94..16ade3e071d 100644 --- a/langtools/src/share/bin/launcher.sh-template +++ b/langtools/src/share/bin/launcher.sh-template @@ -38,7 +38,7 @@ mylib="`dirname $mydir`"/lib # dependent jar files for additional dependencies. if [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then - cp=`unzip -c $mylib/#PROGRAM#.jar META-INF/MANIFEST.MF | + cp=`unzip -c "$mylib/#PROGRAM#.jar" META-INF/MANIFEST.MF | grep "Class-Path:" | sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1:|g'` bcp="$mylib/#PROGRAM#.jar":$cp From 738b0c0ec7588bba33e240dcf08fb460dfe68531 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 14 Jan 2010 20:05:19 -0800 Subject: [PATCH 32/59] 6908218: java.lang.Deprecated should have explicit @Target meta-annotation Reviewed-by: mernst --- jdk/src/share/classes/java/lang/Deprecated.java | 2 ++ jdk/src/share/classes/java/lang/SuppressWarnings.java | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Deprecated.java b/jdk/src/share/classes/java/lang/Deprecated.java index 427b77baac8..28909e19e77 100644 --- a/jdk/src/share/classes/java/lang/Deprecated.java +++ b/jdk/src/share/classes/java/lang/Deprecated.java @@ -26,6 +26,7 @@ package java.lang; import java.lang.annotation.*; +import static java.lang.annotation.ElementType.*; /** * A program element annotated @Deprecated is one that programmers @@ -38,5 +39,6 @@ import java.lang.annotation.*; */ @Documented @Retention(RetentionPolicy.RUNTIME) +@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE}) public @interface Deprecated { } diff --git a/jdk/src/share/classes/java/lang/SuppressWarnings.java b/jdk/src/share/classes/java/lang/SuppressWarnings.java index b999bce2685..cc98d68b1c0 100644 --- a/jdk/src/share/classes/java/lang/SuppressWarnings.java +++ b/jdk/src/share/classes/java/lang/SuppressWarnings.java @@ -26,7 +26,6 @@ package java.lang; import java.lang.annotation.*; -import java.lang.annotation.ElementType; import static java.lang.annotation.ElementType.*; /** @@ -45,7 +44,7 @@ import static java.lang.annotation.ElementType.*; * @since 1.5 * @author Josh Bloch */ -@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE}) +@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, TYPE_PARAMETER}) @Retention(RetentionPolicy.SOURCE) public @interface SuppressWarnings { /** From 60fa841f74a7f5ef4acfb1a28ee9d4c69530ee50 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Fri, 15 Jan 2010 09:48:21 -0500 Subject: [PATCH 33/59] 6915939: Exception should be thrown if OCSP SingleResponses contain unresolved critical extensions Reviewed-by: xuelei --- .../sun/security/provider/certpath/OCSPResponse.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java index e7b148fbc7c..c80888f9c1e 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java @@ -574,10 +574,18 @@ public final class OCSPResponse { (singleExtDer.length); for (int i = 0; i < singleExtDer.length; i++) { Extension ext = new Extension(singleExtDer[i]); - singleExtensions.put(ext.getId(), ext); if (DEBUG != null) { DEBUG.println("OCSP single extension: " + ext); } + // We don't support any extensions yet. Therefore, if it + // is critical we must throw an exception because we + // don't know how to process it. + if (ext.isCritical()) { + throw new IOException( + "Unsupported OCSP critical extension: " + + ext.getExtensionId()); + } + singleExtensions.put(ext.getId(), ext); } } else { singleExtensions = Collections.emptyMap(); From c5c869ce949c608ed3a2a7359197186bbb6a1eea Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Fri, 15 Jan 2010 16:31:16 +0000 Subject: [PATCH 34/59] 6916922: (sctp) SO_RCVBUF & SO_SNDBUF returns twice the value set Reviewed-by: alanb --- jdk/src/solaris/native/sun/nio/ch/SctpNet.c | 4 ++-- jdk/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c index 8a27807c599..f58157f1fae 100644 --- a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c +++ b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c @@ -484,7 +484,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0 arglen = sizeof(arg); } - if (setsockopt(fd, klevel, kopt, parg, arglen) < 0) { + if (NET_SetSockOpt(fd, klevel, kopt, parg, arglen) < 0) { JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "sun_nio_ch_SctpNet.setIntOption0"); } @@ -517,7 +517,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0 arglen = sizeof(result); } - if (getsockopt(fd, klevel, kopt, arg, &arglen) < 0) { + if (NET_GetSockOpt(fd, klevel, kopt, arg, &arglen) < 0) { JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "sun.nio.ch.Net.getIntOption"); return -1; diff --git a/jdk/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java b/jdk/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java index d5715b17198..f5814a17bc5 100644 --- a/jdk/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java +++ b/jdk/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java @@ -104,7 +104,9 @@ public class SocketOptionTests { sc.setOption(SCTP_NODELAY, true); checkOption(sc, SCTP_NODELAY, true); sc.setOption(SO_SNDBUF, 16*1024); + checkOption(sc, SO_SNDBUF, 16*1024); sc.setOption(SO_RCVBUF, 16*1024); + checkOption(sc, SO_RCVBUF, 16*1024); checkOption(sc, SO_LINGER, -1); /* default should be negative */ sc.setOption(SO_LINGER, 2000); checkOption(sc, SO_LINGER, 2000); From 34b95319c2e9fbea14d42c7f7541998d9dc05cfe Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Mon, 18 Jan 2010 14:01:07 +0000 Subject: [PATCH 35/59] 6916890: (sctp) SctpChannel.send may cause IAE if given a heap buffer with an offset Reviewed-by: alanb --- .../classes/sun/nio/ch/SctpChannelImpl.java | 25 ++++++---- .../sun/nio/ch/SctpMultiChannelImpl.java | 20 +++++--- .../com/sun/nio/sctp/SctpChannel/Send.java | 50 +++++++++++++++++-- .../sun/nio/sctp/SctpMultiChannel/Send.java | 45 +++++++++++++++++ 4 files changed, 118 insertions(+), 22 deletions(-) diff --git a/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java index be64c9c0a68..2d577c2e1b1 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java @@ -869,8 +869,8 @@ public class SctpChannelImpl extends SctpChannel public HandlerResult handleNotification( AssociationChangeNotification not, T unused) { if (not.event().equals( - AssociationChangeNotification.AssocChangeEvent.COMM_UP)) { - assert association == null; + AssociationChangeNotification.AssocChangeEvent.COMM_UP) && + association == null) { SctpAssocChange sac = (SctpAssocChange) not; association = new SctpAssociationImpl (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams()); @@ -982,17 +982,17 @@ public class SctpChannelImpl extends SctpChannel SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); - int pos = src.position(); - int lim = src.limit(); - - assert (pos <= lim && streamNumber >= 0); - int rem = (pos <= lim ? lim - pos : 0); if (src instanceof DirectBuffer) - return sendFromNativeBuffer(fd, src, rem, pos, target, streamNumber, + return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ + int pos = src.position(); + int lim = src.limit(); + assert (pos <= lim && streamNumber >= 0); + + int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); @@ -1000,7 +1000,7 @@ public class SctpChannelImpl extends SctpChannel /* Do not update src until we see how many bytes were written */ src.position(pos); - int n = sendFromNativeBuffer(fd, bb, rem, pos, target, streamNumber, + int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ @@ -1014,13 +1014,16 @@ public class SctpChannelImpl extends SctpChannel private int sendFromNativeBuffer(int fd, ByteBuffer bb, - int rem, - int pos, SocketAddress target, int streamNumber, boolean unordered, int ppid) throws IOException { + int pos = bb.position(); + int lim = bb.limit(); + assert (pos <= lim); + int rem = (pos <= lim ? lim - pos : 0); + int written = send0(fd, ((DirectBuffer)bb).address() + pos, rem, target, -1 /*121*/, streamNumber, unordered, ppid); if (written > 0) diff --git a/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java index 92ebb3f67b5..45a360ddfee 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java @@ -842,16 +842,17 @@ public class SctpMultiChannelImpl extends SctpMultiChannel int streamNumber = messageInfo.streamNumber(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); - int pos = src.position(); - int lim = src.limit(); - assert (pos <= lim && streamNumber >= 0); - int rem = (pos <= lim ? lim - pos : 0); if (src instanceof DirectBuffer) - return sendFromNativeBuffer(fd, src, rem, pos, target, assocId, + return sendFromNativeBuffer(fd, src, target, assocId, streamNumber, unordered, ppid); /* Substitute a native buffer */ + int pos = src.position(); + int lim = src.limit(); + assert (pos <= lim && streamNumber >= 0); + + int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); @@ -859,7 +860,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel /* Do not update src until we see how many bytes were written */ src.position(pos); - int n = sendFromNativeBuffer(fd, bb, rem, pos, target, assocId, + int n = sendFromNativeBuffer(fd, bb, target, assocId, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ @@ -873,14 +874,17 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private int sendFromNativeBuffer(int fd, ByteBuffer bb, - int rem, - int pos, SocketAddress target, int assocId, int streamNumber, boolean unordered, int ppid) throws IOException { + int pos = bb.position(); + int lim = bb.limit(); + assert (pos <= lim); + int rem = (pos <= lim ? lim - pos : 0); + int written = send0(fd, ((DirectBuffer)bb).address() + pos, rem, target, assocId, streamNumber, unordered, ppid); if (written > 0) diff --git a/jdk/test/com/sun/nio/sctp/SctpChannel/Send.java b/jdk/test/com/sun/nio/sctp/SctpChannel/Send.java index 3cee201d739..3a62147e9dc 100644 --- a/jdk/test/com/sun/nio/sctp/SctpChannel/Send.java +++ b/jdk/test/com/sun/nio/sctp/SctpChannel/Send.java @@ -112,9 +112,6 @@ public class Send { /* Receive CommUp */ channel.receive(buffer, null, handler); - /* save for TEST 8 */ - Association association = channel.association(); - /* TEST 2: send small message */ int streamNumber = 0; debug("sending on stream number: " + streamNumber); @@ -250,6 +247,29 @@ public class Send { pass(); debug("OK, caught " + e); } + + /* TEST 9: Send from heap buffer to force implementation to + * substitute with a native buffer, then check that its position + * is updated correctly */ + buffer.clear(); + info = MessageInfo.createOutgoing(null, 0); + buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + buffer.flip(); + final int offset = 1; + buffer.position(offset); + remaining = buffer.remaining(); + + debug("sending small message: " + buffer); + try { + sent = channel.send(buffer, info); + + check(sent == remaining, "sent should be equal to remaining"); + check(buffer.position() == (offset + sent), + "buffers position should have been incremented by sent"); + } catch (IllegalArgumentException iae) { + fail(iae + ", Error updating buffers position"); + } + } catch (IOException ioe) { unexpected(ioe); } finally { @@ -335,6 +355,30 @@ public class Send { /* TEST 7 ++ */ sc2 = ssc.accept(); + /* TEST 9 */ + ByteBuffer expected = ByteBuffer.allocate(Util.SMALL_BUFFER); + expected.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + expected.flip(); + final int offset = 1; + expected.position(offset); + buffer.clear(); + do { + info = sc2.receive(buffer, null, null); + if (info == null) { + fail("Server: unexpected null from receive"); + return; + } + } while (!info.isComplete()); + + buffer.flip(); + check(info != null, "info is null"); + check(info.streamNumber() == 0, "message not sent on the correct stream"); + check(info.bytes() == expected.remaining(), + "bytes received not equal to message length"); + check(info.bytes() == buffer.remaining(), "bytes != remaining"); + check(expected.equals(buffer), + "received message not the same as sent message"); + clientFinishedLatch.await(10L, TimeUnit.SECONDS); serverFinishedLatch.countDown(); } catch (IOException ioe) { diff --git a/jdk/test/com/sun/nio/sctp/SctpMultiChannel/Send.java b/jdk/test/com/sun/nio/sctp/SctpMultiChannel/Send.java index b7d1379d174..1f56c5df67e 100644 --- a/jdk/test/com/sun/nio/sctp/SctpMultiChannel/Send.java +++ b/jdk/test/com/sun/nio/sctp/SctpMultiChannel/Send.java @@ -185,6 +185,27 @@ public class Send { /* TEST 5: getRemoteAddresses(Association) */ channel.getRemoteAddresses(assoc); + /* TEST 6: Send from heap buffer to force implementation to + * substitute with a native buffer, then check that its position + * is updated correctly */ + info = MessageInfo.createOutgoing(assoc, null, 0); + buffer.clear(); + buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + buffer.flip(); + final int offset = 1; + buffer.position(offset); + remaining = buffer.remaining(); + + try { + sent = channel.send(buffer, info); + + check(sent == remaining, "sent should be equal to remaining"); + check(buffer.position() == (offset + sent), + "buffers position should have been incremented by sent"); + } catch (IllegalArgumentException iae) { + fail(iae + ", Error updating buffers position"); + } + } catch (IOException ioe) { unexpected(ioe); } finally { @@ -284,6 +305,30 @@ public class Send { bytes = serverChannel.send(buffer, info); debug("Server: sent " + bytes + "bytes"); + /* TEST 6 */ + ByteBuffer expected = ByteBuffer.allocate(Util.SMALL_BUFFER); + expected.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + expected.flip(); + final int offset = 1; + expected.position(offset); + buffer.clear(); + do { + info = serverChannel.receive(buffer, null, null); + if (info == null) { + fail("Server: unexpected null from receive"); + return; + } + } while (!info.isComplete()); + + buffer.flip(); + check(info != null, "info is null"); + check(info.streamNumber() == 0, "message not sent on the correct stream"); + check(info.bytes() == expected.remaining(), + "bytes received not equal to message length"); + check(info.bytes() == buffer.remaining(), "bytes != remaining"); + check(expected.equals(buffer), + "received message not the same as sent message"); + clientFinishedLatch.await(10L, TimeUnit.SECONDS); serverFinishedLatch.countDown(); } catch (IOException ioe) { From 3e77553ac1795d41a4606b15ac4b6b3dc596edad Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Mon, 18 Jan 2010 14:56:06 +0000 Subject: [PATCH 36/59] 6917317: (sctp) Remove dependency on handleSocketError Reviewed-by: alanb --- jdk/src/solaris/native/sun/nio/ch/SctpNet.c | 32 +++++++++++++++++++ .../com/sun/nio/sctp/SctpChannel/Connect.java | 12 +++++++ 2 files changed, 44 insertions(+) diff --git a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c index f58157f1fae..61d7764d23e 100644 --- a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c +++ b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c @@ -110,6 +110,38 @@ jboolean loadSocketExtensionFuncs return JNI_TRUE; } +jint +handleSocketError(JNIEnv *env, jint errorValue) +{ + char *xn; + switch (errorValue) { + case EINPROGRESS: /* Non-blocking connect */ + return 0; + case EPROTO: + xn= JNU_JAVANETPKG "ProtocolException"; + break; + case ECONNREFUSED: + xn = JNU_JAVANETPKG "ConnectException"; + break; + case ETIMEDOUT: + xn = JNU_JAVANETPKG "ConnectException"; + break; + case EHOSTUNREACH: + xn = JNU_JAVANETPKG "NoRouteToHostException"; + break; + case EADDRINUSE: /* Fall through */ + case EADDRNOTAVAIL: + xn = JNU_JAVANETPKG "BindException"; + break; + default: + xn = JNU_JAVANETPKG "SocketException"; + break; + } + errno = errorValue; + JNU_ThrowByNameWithLastError(env, xn, "NioSocketError"); + return IOS_THROWN; +} + /* * Class: sun_nio_ch_SctpNet * Method: init diff --git a/jdk/test/com/sun/nio/sctp/SctpChannel/Connect.java b/jdk/test/com/sun/nio/sctp/SctpChannel/Connect.java index 78cb52770ba..33f4441d356 100644 --- a/jdk/test/com/sun/nio/sctp/SctpChannel/Connect.java +++ b/jdk/test/com/sun/nio/sctp/SctpChannel/Connect.java @@ -192,6 +192,18 @@ public class Connect { testCCE(new Callable() { public Void call() throws IOException { cceChannel.finishConnect(); return null; } }); + + /* TEST 8: IOException: Connection refused. Exercises handleSocketError. + * Assumption: no sctp socket listening on 3456 */ + SocketAddress addr = new InetSocketAddress("localhost", 3456); + channel = SctpChannel.open(); + try { + channel.connect(addr); + fail("should have thrown ConnectException: Connection refused"); + } catch (IOException ioe) { + pass(); + } + } catch (IOException ioe) { unexpected(ioe); } finally { From 01c326e0daf1a1e11ee343849e45d34f723520ff Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 18 Jan 2010 15:21:34 +0000 Subject: [PATCH 37/59] 6917021: (file) copyTo/moveTo can overrwrite existing file when target associated with custom provider Reviewed-by: chegar --- .../classes/sun/nio/fs/AbstractPath.java | 24 +- jdk/test/java/nio/file/Path/CopyAndMove.java | 254 ++++---- .../nio/file/Path/PassThroughFileSystem.java | 554 ++++++++++++++++++ jdk/test/java/nio/file/TestUtil.java | 11 +- 4 files changed, 717 insertions(+), 126 deletions(-) create mode 100644 jdk/test/java/nio/file/Path/PassThroughFileSystem.java diff --git a/jdk/src/share/classes/sun/nio/fs/AbstractPath.java b/jdk/src/share/classes/sun/nio/fs/AbstractPath.java index 71204bd0a2e..e81e3eb1f98 100644 --- a/jdk/src/share/classes/sun/nio/fs/AbstractPath.java +++ b/jdk/src/share/classes/sun/nio/fs/AbstractPath.java @@ -256,8 +256,8 @@ abstract class AbstractPath extends Path { } if (option == null) throw new NullPointerException(); - throw new IllegalArgumentException("'" + option + - "' is not a valid copy option"); + throw new UnsupportedOperationException("'" + option + + "' is not a recognized copy option"); } return result; } @@ -279,9 +279,21 @@ abstract class AbstractPath extends Path { if (attrs.isSymbolicLink()) throw new IOException("Copying of symbolic links not supported"); - // delete target file - if (opts.replaceExisting) - target.deleteIfExists(); + // check if target exists + boolean exists; + if (opts.replaceExisting) { + try { + target.deleteIfExists(); + exists = false; + } catch (DirectoryNotEmptyException x) { + // let exception translate to FileAlreadyExistsException (6895012) + exists = true; + } + } else { + exists = target.exists(); + } + if (exists) + throw new FileAlreadyExistsException(target.toString()); // create directory or file if (attrs.isDirectory()) { @@ -318,7 +330,7 @@ abstract class AbstractPath extends Path { ReadableByteChannel rbc = newByteChannel(); try { // open target file for writing - SeekableByteChannel sbc = target.newByteChannel(CREATE, WRITE); + SeekableByteChannel sbc = target.newByteChannel(CREATE_NEW, WRITE); // simple copy loop try { diff --git a/jdk/test/java/nio/file/Path/CopyAndMove.java b/jdk/test/java/nio/file/Path/CopyAndMove.java index 18abbe0de56..9d24e6db335 100644 --- a/jdk/test/java/nio/file/Path/CopyAndMove.java +++ b/jdk/test/java/nio/file/Path/CopyAndMove.java @@ -22,10 +22,10 @@ */ /* @test - * @bug 4313887 6838333 + * @bug 4313887 6838333 6917021 * @summary Unit test for java.nio.file.Path copyTo/moveTo methods * @library .. - * @build CopyAndMove + * @build CopyAndMove PassThroughFileSystem * @run main/othervm CopyAndMove */ @@ -40,22 +40,31 @@ import java.util.*; public class CopyAndMove { static final Random rand = new Random(); static boolean heads() { return rand.nextBoolean(); } - static boolean supportsLinks; public static void main(String[] args) throws Exception { Path dir1 = TestUtil.createTemporaryDirectory(); try { - supportsLinks = TestUtil.supportsLinks(dir1); + // Same directory + doCopyTests(dir1, dir1, TestUtil.supportsLinks(dir1)); + doMoveTests(dir1, dir1, TestUtil.supportsLinks(dir1)); - // Exercise copyTo - doCopyTests(dir1); + // Different directories. Use test.dir if possible as it might be + // a different volume/file system and so improve test coverage. + String testDir = System.getProperty("test.dir", "."); + Path dir2 = TestUtil.createTemporaryDirectory(testDir); + try { + boolean testSymbolicLinks = + TestUtil.supportsLinks(dir1) && TestUtil.supportsLinks(dir2); + doCopyTests(dir1, dir2, testSymbolicLinks); + doMoveTests(dir1, dir2, testSymbolicLinks); + } finally { + TestUtil.removeAll(dir2); + } - // Exercise moveTo - // if test.dir differs to temporary file system then can test - // moving between devices - String testDir = System.getProperty("test.dir"); - Path dir2 = (testDir != null) ? Paths.get(testDir) : dir1; - doMoveTests(dir1, dir2); + // Target is location associated with custom provider + Path dir3 = PassThroughFileSystem.create().getPath(dir1.toString()); + doCopyTests(dir1, dir3, false); + doMoveTests(dir1, dir3, false); } finally { TestUtil.removeAll(dir1); @@ -186,30 +195,37 @@ public class CopyAndMove { checkBasicAttributes(basicAttributes, Attributes.readBasicFileAttributes(target, NOFOLLOW_LINKS)); - // verify POSIX attributes - if (posixAttributes != null && !basicAttributes.isSymbolicLink()) { - checkPosixAttributes(posixAttributes, - Attributes.readPosixFileAttributes(target, NOFOLLOW_LINKS)); - } + // verify other attributes when same provider + if (source.getFileSystem().provider() == target.getFileSystem().provider()) { - // verify DOS attributes - if (dosAttributes != null && !basicAttributes.isSymbolicLink()) { - checkDosAttributes(dosAttributes, - Attributes.readDosFileAttributes(target, NOFOLLOW_LINKS)); - } + // verify POSIX attributes + if (posixAttributes != null && !basicAttributes.isSymbolicLink()) { + checkPosixAttributes(posixAttributes, + Attributes.readPosixFileAttributes(target, NOFOLLOW_LINKS)); + } - // verify named attributes - if (namedAttributes != null && - target.getFileStore().supportsFileAttributeView("xattr")) - { - checkUserDefinedFileAttributes(namedAttributes, readUserDefinedFileAttributes(target)); + // verify DOS attributes + if (dosAttributes != null && !basicAttributes.isSymbolicLink()) { + checkDosAttributes(dosAttributes, + Attributes.readDosFileAttributes(target, NOFOLLOW_LINKS)); + } + + // verify named attributes + if (namedAttributes != null && + target.getFileStore().supportsFileAttributeView("xattr")) + { + checkUserDefinedFileAttributes(namedAttributes, + readUserDefinedFileAttributes(target)); + } } } /** * Tests all possible ways to invoke moveTo */ - static void doMoveTests(Path dir1, Path dir2) throws IOException { + static void doMoveTests(Path dir1, Path dir2, boolean supportsLinks) + throws IOException + { Path source, target, entry; boolean sameDevice = dir1.getFileStore().equals(dir2.getFileStore()); @@ -220,7 +236,7 @@ public class CopyAndMove { * Test: move regular file, target does not exist */ source = createSourceFile(dir1); - target = getTargetFile(dir1); + target = getTargetFile(dir2); moveAndVerify(source, target); target.delete(); @@ -228,7 +244,7 @@ public class CopyAndMove { * Test: move regular file, target exists */ source = createSourceFile(dir1); - target = getTargetFile(dir1).createFile(); + target = getTargetFile(dir2).createFile(); try { moveAndVerify(source, target); throw new RuntimeException("FileAlreadyExistsException expected"); @@ -248,7 +264,7 @@ public class CopyAndMove { * Test: move regular file, target does not exist */ source = createSourceFile(dir1); - target = getTargetFile(dir1); + target = getTargetFile(dir2); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); @@ -256,7 +272,7 @@ public class CopyAndMove { * Test: move regular file, target exists */ source = createSourceFile(dir1); - target = getTargetFile(dir1).createFile(); + target = getTargetFile(dir2).createFile(); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); @@ -264,7 +280,7 @@ public class CopyAndMove { * Test: move regular file, target exists and is empty directory */ source = createSourceFile(dir1); - target = getTargetFile(dir1).createDirectory(); + target = getTargetFile(dir2).createDirectory(); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); @@ -272,7 +288,7 @@ public class CopyAndMove { * Test: move regular file, target exists and is non-empty directory */ source = createSourceFile(dir1); - target = getTargetFile(dir1).createDirectory(); + target = getTargetFile(dir2).createDirectory(); entry = target.resolve("foo").createFile(); try { moveAndVerify(source, target); @@ -311,7 +327,7 @@ public class CopyAndMove { * Test: move empty directory, target does not exist */ source = createSourceDirectory(dir1); - target = getTargetFile(dir1); + target = getTargetFile(dir2); moveAndVerify(source, target); target.delete(); @@ -319,7 +335,7 @@ public class CopyAndMove { * Test: move empty directory, target exists */ source = createSourceDirectory(dir1); - target = getTargetFile(dir1).createFile(); + target = getTargetFile(dir2).createFile(); try { moveAndVerify(source, target); throw new RuntimeException("FileAlreadyExistsException expected"); @@ -339,7 +355,7 @@ public class CopyAndMove { * Test: move empty directory, target does not exist */ source = createSourceDirectory(dir1); - target = getTargetFile(dir1); + target = getTargetFile(dir2); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); @@ -347,7 +363,7 @@ public class CopyAndMove { * Test: move empty directory, target exists */ source = createSourceDirectory(dir1); - target = getTargetFile(dir1).createFile(); + target = getTargetFile(dir2).createFile(); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); @@ -355,7 +371,7 @@ public class CopyAndMove { * Test: move empty, target exists and is empty directory */ source = createSourceDirectory(dir1); - target = getTargetFile(dir1).createDirectory(); + target = getTargetFile(dir2).createDirectory(); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); @@ -363,7 +379,7 @@ public class CopyAndMove { * Test: move empty directory, target exists and is non-empty directory */ source = createSourceDirectory(dir1); - target = getTargetFile(dir1).createDirectory(); + target = getTargetFile(dir2).createDirectory(); entry = target.resolve("foo").createFile(); try { moveAndVerify(source, target, REPLACE_EXISTING); @@ -418,7 +434,7 @@ public class CopyAndMove { if (supportsLinks) { Path tmp = createSourceFile(dir1); source = dir1.resolve("link").createSymbolicLink(tmp); - target = getTargetFile(dir1); + target = getTargetFile(dir2); moveAndVerify(source, target); target.delete(); tmp.delete(); @@ -429,7 +445,7 @@ public class CopyAndMove { */ if (supportsLinks) { source = dir1.resolve("link").createSymbolicLink(dir2); - target = getTargetFile(dir1); + target = getTargetFile(dir2); moveAndVerify(source, target); target.delete(); } @@ -440,7 +456,7 @@ public class CopyAndMove { if (supportsLinks) { Path tmp = Paths.get("doesnotexist"); source = dir1.resolve("link").createSymbolicLink(tmp); - target = getTargetFile(dir1); + target = getTargetFile(dir2); moveAndVerify(source, target); target.delete(); } @@ -450,7 +466,7 @@ public class CopyAndMove { */ if (supportsLinks) { source = dir1.resolve("link").createSymbolicLink(dir2); - target = getTargetFile(dir1).createFile(); + target = getTargetFile(dir2).createFile(); try { moveAndVerify(source, target); throw new RuntimeException("FileAlreadyExistsException expected"); @@ -465,7 +481,7 @@ public class CopyAndMove { */ if (supportsLinks) { source = dir1.resolve("link").createSymbolicLink(dir2); - target = getTargetFile(dir1).createFile(); + target = getTargetFile(dir2).createFile(); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); } @@ -475,7 +491,7 @@ public class CopyAndMove { */ if (supportsLinks) { source = dir1.resolve("link").createSymbolicLink(dir2); - target = getTargetFile(dir1).createDirectory(); + target = getTargetFile(dir2).createDirectory(); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); } @@ -485,7 +501,7 @@ public class CopyAndMove { */ if (supportsLinks) { source = dir1.resolve("link").createSymbolicLink(dir2); - target = getTargetFile(dir1).createDirectory(); + target = getTargetFile(dir2).createDirectory(); entry = target.resolve("foo").createFile(); try { moveAndVerify(source, target); @@ -502,7 +518,7 @@ public class CopyAndMove { */ if (supportsLinks) { source = dir1.resolve("link").createSymbolicLink(dir1); - target = getTargetFile(dir1).createFile(); + target = getTargetFile(dir2).createFile(); moveAndVerify(source, target, REPLACE_EXISTING); target.delete(); } @@ -513,7 +529,7 @@ public class CopyAndMove { * Test nulls */ source = createSourceFile(dir1); - target = getTargetFile(dir1); + target = getTargetFile(dir2); try { source.moveTo(null); throw new RuntimeException("NullPointerException expected"); @@ -533,7 +549,7 @@ public class CopyAndMove { * Test UOE */ source = createSourceFile(dir1); - target = getTargetFile(dir1); + target = getTargetFile(dir2); try { source.moveTo(target, new CopyOption() { }); } catch (UnsupportedOperationException x) { } @@ -577,28 +593,32 @@ public class CopyAndMove { checkBasicAttributes(basicAttributes, Attributes.readBasicFileAttributes(source, linkOptions)); - // check POSIX attributes are copied - String os = System.getProperty("os.name"); - if (os.equals("SunOS") || os.equals("Linux")) { - checkPosixAttributes( - Attributes.readPosixFileAttributes(source, linkOptions), - Attributes.readPosixFileAttributes(target, linkOptions)); - } + // verify other attributes when same provider + if (source.getFileSystem().provider() == target.getFileSystem().provider()) { - // check DOS attributes are copied - if (os.startsWith("Windows")) { - checkDosAttributes( - Attributes.readDosFileAttributes(source, linkOptions), - Attributes.readDosFileAttributes(target, linkOptions)); - } + // check POSIX attributes are copied + String os = System.getProperty("os.name"); + if (os.equals("SunOS") || os.equals("Linux")) { + checkPosixAttributes( + Attributes.readPosixFileAttributes(source, linkOptions), + Attributes.readPosixFileAttributes(target, linkOptions)); + } - // check named attributes are copied - if (followLinks && - source.getFileStore().supportsFileAttributeView("xattr") && - target.getFileStore().supportsFileAttributeView("xattr")) - { - checkUserDefinedFileAttributes(readUserDefinedFileAttributes(source), - readUserDefinedFileAttributes(target)); + // check DOS attributes are copied + if (os.startsWith("Windows")) { + checkDosAttributes( + Attributes.readDosFileAttributes(source, linkOptions), + Attributes.readDosFileAttributes(target, linkOptions)); + } + + // check named attributes are copied + if (followLinks && + source.getFileStore().supportsFileAttributeView("xattr") && + target.getFileStore().supportsFileAttributeView("xattr")) + { + checkUserDefinedFileAttributes(readUserDefinedFileAttributes(source), + readUserDefinedFileAttributes(target)); + } } } } @@ -606,7 +626,9 @@ public class CopyAndMove { /** * Tests all possible ways to invoke copyTo */ - static void doCopyTests(Path dir) throws IOException { + static void doCopyTests(Path dir1, Path dir2, boolean supportsLinks) + throws IOException + { Path source, target, link, entry; // -- regular file -- @@ -614,8 +636,8 @@ public class CopyAndMove { /** * Test: move regular file, target does not exist */ - source = createSourceFile(dir); - target = getTargetFile(dir); + source = createSourceFile(dir1); + target = getTargetFile(dir2); copyAndVerify(source, target); source.delete(); target.delete(); @@ -623,8 +645,8 @@ public class CopyAndMove { /** * Test: copy regular file, target exists */ - source = createSourceFile(dir); - target = getTargetFile(dir).createFile(); + source = createSourceFile(dir1); + target = getTargetFile(dir2).createFile(); try { copyAndVerify(source, target); throw new RuntimeException("FileAlreadyExistsException expected"); @@ -643,8 +665,8 @@ public class CopyAndMove { /** * Test: copy regular file, target does not exist */ - source = createSourceFile(dir); - target = getTargetFile(dir); + source = createSourceFile(dir1); + target = getTargetFile(dir2); copyAndVerify(source, target, REPLACE_EXISTING); source.delete(); target.delete(); @@ -652,8 +674,8 @@ public class CopyAndMove { /** * Test: copy regular file, target exists */ - source = createSourceFile(dir); - target = getTargetFile(dir).createFile(); + source = createSourceFile(dir1); + target = getTargetFile(dir2).createFile(); copyAndVerify(source, target, REPLACE_EXISTING); source.delete(); target.delete(); @@ -661,8 +683,8 @@ public class CopyAndMove { /** * Test: copy regular file, target exists and is empty directory */ - source = createSourceFile(dir); - target = getTargetFile(dir).createDirectory(); + source = createSourceFile(dir1); + target = getTargetFile(dir2).createDirectory(); copyAndVerify(source, target, REPLACE_EXISTING); source.delete(); target.delete(); @@ -670,8 +692,8 @@ public class CopyAndMove { /** * Test: copy regular file, target exists and is non-empty directory */ - source = createSourceFile(dir); - target = getTargetFile(dir).createDirectory(); + source = createSourceFile(dir1); + target = getTargetFile(dir2).createDirectory(); entry = target.resolve("foo").createFile(); try { copyAndVerify(source, target); @@ -685,8 +707,8 @@ public class CopyAndMove { /** * Test: copy regular file + attributes */ - source = createSourceFile(dir); - target = getTargetFile(dir); + source = createSourceFile(dir1); + target = getTargetFile(dir2); copyAndVerify(source, target, COPY_ATTRIBUTES); source.delete(); target.delete(); @@ -697,8 +719,8 @@ public class CopyAndMove { /* * Test: copy directory, target does not exist */ - source = createSourceDirectory(dir); - target = getTargetFile(dir); + source = createSourceDirectory(dir1); + target = getTargetFile(dir2); copyAndVerify(source, target); source.delete(); target.delete(); @@ -706,8 +728,8 @@ public class CopyAndMove { /** * Test: copy directory, target exists */ - source = createSourceDirectory(dir); - target = getTargetFile(dir).createFile(); + source = createSourceDirectory(dir1); + target = getTargetFile(dir2).createFile(); try { copyAndVerify(source, target); throw new RuntimeException("FileAlreadyExistsException expected"); @@ -726,8 +748,8 @@ public class CopyAndMove { /** * Test: copy directory, target does not exist */ - source = createSourceDirectory(dir); - target = getTargetFile(dir); + source = createSourceDirectory(dir1); + target = getTargetFile(dir2); copyAndVerify(source, target, REPLACE_EXISTING); source.delete(); target.delete(); @@ -735,8 +757,8 @@ public class CopyAndMove { /** * Test: copy directory, target exists */ - source = createSourceDirectory(dir); - target = getTargetFile(dir).createFile(); + source = createSourceDirectory(dir1); + target = getTargetFile(dir2).createFile(); copyAndVerify(source, target, REPLACE_EXISTING); source.delete(); target.delete(); @@ -744,8 +766,8 @@ public class CopyAndMove { /** * Test: copy directory, target exists and is empty directory */ - source = createSourceDirectory(dir); - target = getTargetFile(dir).createDirectory(); + source = createSourceDirectory(dir1); + target = getTargetFile(dir2).createDirectory(); copyAndVerify(source, target, REPLACE_EXISTING); source.delete(); target.delete(); @@ -753,8 +775,8 @@ public class CopyAndMove { /** * Test: copy directory, target exists and is non-empty directory */ - source = createSourceDirectory(dir); - target = getTargetFile(dir).createDirectory(); + source = createSourceDirectory(dir1); + target = getTargetFile(dir2).createDirectory(); entry = target.resolve("foo").createFile(); try { copyAndVerify(source, target, REPLACE_EXISTING); @@ -768,8 +790,8 @@ public class CopyAndMove { /* * Test: copy directory + attributes */ - source = createSourceDirectory(dir); - target = getTargetFile(dir); + source = createSourceDirectory(dir1); + target = getTargetFile(dir2); copyAndVerify(source, target, COPY_ATTRIBUTES); source.delete(); target.delete(); @@ -780,9 +802,9 @@ public class CopyAndMove { * Test: Follow link */ if (supportsLinks) { - source = createSourceFile(dir); - link = dir.resolve("link").createSymbolicLink(source); - target = getTargetFile(dir); + source = createSourceFile(dir1); + link = dir1.resolve("link").createSymbolicLink(source); + target = getTargetFile(dir2); copyAndVerify(link, target); link.delete(); source.delete(); @@ -792,9 +814,9 @@ public class CopyAndMove { * Test: Copy link (to file) */ if (supportsLinks) { - source = createSourceFile(dir); - link = dir.resolve("link").createSymbolicLink(source); - target = getTargetFile(dir); + source = createSourceFile(dir1); + link = dir1.resolve("link").createSymbolicLink(source); + target = getTargetFile(dir2); copyAndVerify(link, target, NOFOLLOW_LINKS); link.delete(); source.delete(); @@ -804,9 +826,9 @@ public class CopyAndMove { * Test: Copy link (to directory) */ if (supportsLinks) { - source = dir.resolve("mydir").createDirectory(); - link = dir.resolve("link").createSymbolicLink(source); - target = getTargetFile(dir); + source = dir1.resolve("mydir").createDirectory(); + link = dir1.resolve("link").createSymbolicLink(source); + target = getTargetFile(dir2); copyAndVerify(link, target, NOFOLLOW_LINKS); link.delete(); source.delete(); @@ -817,8 +839,8 @@ public class CopyAndMove { */ if (supportsLinks) { assertTrue(source.notExists()); - link = dir.resolve("link").createSymbolicLink(source); - target = getTargetFile(dir); + link = dir1.resolve("link").createSymbolicLink(source); + target = getTargetFile(dir2); copyAndVerify(link, target, NOFOLLOW_LINKS); link.delete(); } @@ -830,8 +852,8 @@ public class CopyAndMove { System.getProperty("os.name").startsWith("Windows")) { Path unc = Paths.get("\\\\rialto\\share\\file"); - link = dir.resolve("link").createSymbolicLink(unc); - target = getTargetFile(dir); + link = dir1.resolve("link").createSymbolicLink(unc); + target = getTargetFile(dir2); copyAndVerify(link, target, NOFOLLOW_LINKS); link.delete(); } @@ -841,8 +863,8 @@ public class CopyAndMove { /** * Test nulls */ - source = createSourceFile(dir); - target = getTargetFile(dir); + source = createSourceFile(dir1); + target = getTargetFile(dir2); try { source.copyTo(null); throw new RuntimeException("NullPointerException expected"); @@ -861,8 +883,8 @@ public class CopyAndMove { /** * Test UOE */ - source = createSourceFile(dir); - target = getTargetFile(dir); + source = createSourceFile(dir1); + target = getTargetFile(dir2); try { source.copyTo(target, new CopyOption() { }); } catch (UnsupportedOperationException x) { } diff --git a/jdk/test/java/nio/file/Path/PassThroughFileSystem.java b/jdk/test/java/nio/file/Path/PassThroughFileSystem.java new file mode 100644 index 00000000000..41870ccc031 --- /dev/null +++ b/jdk/test/java/nio/file/Path/PassThroughFileSystem.java @@ -0,0 +1,554 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +import java.nio.file.*; +import java.nio.file.attribute.*; +import java.nio.file.spi.FileSystemProvider; +import java.nio.channels.SeekableByteChannel; +import java.net.URI; +import java.util.*; +import java.io.*; + +/** + * A "pass through" file system implementation that passes through, or delegates, + * everything to the default file system. + */ + +class PassThroughFileSystem extends FileSystem { + private final FileSystemProvider provider; + private final FileSystem delegate; + + PassThroughFileSystem(FileSystemProvider provider, FileSystem delegate) { + this.provider = provider; + this.delegate = delegate; + } + + /** + * Creates a new "pass through" file system. Useful for test environments + * where the provider might not be deployed. + */ + static FileSystem create() throws IOException { + FileSystemProvider provider = new PassThroughProvider(); + Map env = Collections.emptyMap(); + URI uri = URI.create("pass:///"); + return provider.newFileSystem(uri, env); + } + + @Override + public FileSystemProvider provider() { + return provider; + } + + @Override + public void close() throws IOException { + delegate.close(); + } + + @Override + public boolean isOpen() { + return delegate.isOpen(); + } + + @Override + public boolean isReadOnly() { + return delegate.isReadOnly(); + } + + @Override + public String getSeparator() { + return delegate.getSeparator(); + } + + @Override + public Iterable getRootDirectories() { + final Iterable roots = delegate.getRootDirectories(); + return new Iterable() { + @Override + public Iterator iterator() { + final Iterator itr = roots.iterator(); + return new Iterator() { + @Override + public boolean hasNext() { + return itr.hasNext(); + } + @Override + public Path next() { + return new PassThroughPath(delegate, itr.next()); + } + @Override + public void remove() { + itr.remove(); + } + }; + } + }; + } + + @Override + public Iterable getFileStores() { + // assume that unwrapped objects aren't exposed + return delegate.getFileStores(); + } + + @Override + public Set supportedFileAttributeViews() { + // assume that unwrapped objects aren't exposed + return delegate.supportedFileAttributeViews(); + } + + @Override + public Path getPath(String path) { + return new PassThroughPath(this, delegate.getPath(path)); + } + + @Override + public PathMatcher getPathMatcher(String syntaxAndPattern) { + final PathMatcher matcher = delegate.getPathMatcher(syntaxAndPattern); + return new PathMatcher() { + @Override + public boolean matches(Path path) { + return matcher.matches(PassThroughPath.unwrap(path)); + } + }; + } + + @Override + public UserPrincipalLookupService getUserPrincipalLookupService() { + // assume that unwrapped objects aren't exposed + return delegate.getUserPrincipalLookupService(); + } + + @Override + public WatchService newWatchService() throws IOException { + // to keep it simple + throw new UnsupportedOperationException(); + } + + static class PassThroughProvider extends FileSystemProvider { + private static final String SCHEME = "pass"; + private static volatile PassThroughFileSystem delegate; + + public PassThroughProvider() { } + + @Override + public String getScheme() { + return SCHEME; + } + + private void checkScheme(URI uri) { + if (!uri.getScheme().equalsIgnoreCase(SCHEME)) + throw new IllegalArgumentException(); + } + + private void checkUri(URI uri) { + checkScheme(uri); + if (!uri.getSchemeSpecificPart().equals("///")) + throw new IllegalArgumentException(); + } + + @Override + public FileSystem newFileSystem(URI uri, Map env) + throws IOException + { + checkUri(uri); + synchronized (PassThroughProvider.class) { + if (delegate != null) + throw new FileSystemAlreadyExistsException(); + PassThroughFileSystem result = + new PassThroughFileSystem(this, FileSystems.getDefault()); + delegate = result; + return result; + } + } + + @Override + public FileSystem getFileSystem(URI uri) { + checkUri(uri); + FileSystem result = delegate; + if (result == null) + throw new FileSystemNotFoundException(); + return result; + } + + @Override + public Path getPath(URI uri) { + checkScheme(uri); + if (delegate == null) + throw new FileSystemNotFoundException(); + uri = URI.create(delegate.provider().getScheme() + ":" + + uri.getSchemeSpecificPart()); + return new PassThroughPath(delegate, delegate.provider().getPath(uri)); + } + } + + static class PassThroughPath extends Path { + private final FileSystem fs; + private final Path delegate; + + PassThroughPath(FileSystem fs, Path delegate) { + this.fs = fs; + this.delegate = delegate; + } + + private Path wrap(Path path) { + return (path != null) ? new PassThroughPath(fs, path) : null; + } + + static Path unwrap(Path wrapper) { + if (!(wrapper instanceof PassThroughPath)) + throw new ProviderMismatchException(); + return ((PassThroughPath)wrapper).delegate; + } + + @Override + public FileSystem getFileSystem() { + return fs; + } + + @Override + public boolean isAbsolute() { + return delegate.isAbsolute(); + } + + @Override + public Path getRoot() { + return wrap(delegate.getRoot()); + } + + + @Override + public Path getName() { + return wrap(delegate.getName()); + } + + @Override + public Path getParent() { + return wrap(delegate.getParent()); + } + + @Override + public int getNameCount() { + return delegate.getNameCount(); + } + + @Override + public Path getName(int index) { + return wrap(delegate.getName(index)); + } + + @Override + public Path subpath(int beginIndex, int endIndex) { + return wrap(delegate.subpath(beginIndex, endIndex)); + } + + @Override + public boolean startsWith(Path other) { + return delegate.startsWith(unwrap(other)); + } + + @Override + public boolean endsWith(Path other) { + return delegate.endsWith(unwrap(other)); + } + + @Override + public Path normalize() { + return wrap(delegate.normalize()); + } + + @Override + public Path resolve(Path other) { + return wrap(delegate.resolve(unwrap(other))); + } + + @Override + public Path resolve(String other) { + return wrap(delegate.resolve(other)); + } + + @Override + public Path relativize(Path other) { + return wrap(delegate.relativize(unwrap(other))); + } + + @Override + public void setAttribute(String attribute, Object value, LinkOption... options) + throws IOException + { + delegate.setAttribute(attribute, value, options); + } + + @Override + public Object getAttribute(String attribute, LinkOption... options) + throws IOException + { + // assume that unwrapped objects aren't exposed + return delegate.getAttribute(attribute, options); + } + + @Override + public Map readAttributes(String attributes, LinkOption... options) + throws IOException + { + // assume that unwrapped objects aren't exposed + return delegate.readAttributes(attributes, options); + } + + @Override + public V getFileAttributeView(Class type, + LinkOption... options) + { + return delegate.getFileAttributeView(type, options); + } + + @Override + public void delete() throws IOException { + delegate.delete(); + } + + @Override + public void deleteIfExists() throws IOException { + delegate.deleteIfExists(); + } + + @Override + public Path createSymbolicLink(Path target, FileAttribute... attrs) + throws IOException + { + delegate.createSymbolicLink(unwrap(target), attrs); + return this; + } + + @Override + public Path createLink(Path existing) throws IOException { + delegate.createLink(unwrap(existing)); + return this; + } + + @Override + public Path readSymbolicLink() throws IOException { + return wrap(delegate.readSymbolicLink()); + } + + @Override + public URI toUri() { + String ssp = delegate.toUri().getSchemeSpecificPart(); + return URI.create(fs.provider().getScheme() + ":" + ssp); + } + + @Override + public Path toAbsolutePath() { + return wrap(delegate.toAbsolutePath()); + } + + @Override + public Path toRealPath(boolean resolveLinks) throws IOException { + return wrap(delegate.toRealPath(resolveLinks)); + } + + @Override + public Path copyTo(Path target, CopyOption... options) throws IOException { + return wrap(delegate.copyTo(unwrap(target), options)); + } + + @Override + public Path moveTo(Path target, CopyOption... options) throws IOException { + return wrap(delegate.copyTo(unwrap(target), options)); + } + + private DirectoryStream wrap(final DirectoryStream stream) { + return new DirectoryStream() { + @Override + public Iterator iterator() { + final Iterator itr = stream.iterator(); + return new Iterator() { + @Override + public boolean hasNext() { + return itr.hasNext(); + } + @Override + public Path next() { + return wrap(itr.next()); + } + @Override + public void remove() { + itr.remove(); + } + }; + } + @Override + public void close() throws IOException { + stream.close(); + } + }; + } + + @Override + public DirectoryStream newDirectoryStream() throws IOException { + return wrap(delegate.newDirectoryStream()); + } + + @Override + public DirectoryStream newDirectoryStream(String glob) + throws IOException + { + return wrap(delegate.newDirectoryStream(glob)); + } + + @Override + public DirectoryStream newDirectoryStream(DirectoryStream.Filter filter) + throws IOException + { + return wrap(delegate.newDirectoryStream(filter)); + } + + @Override + public Path createFile(FileAttribute... attrs) throws IOException { + delegate.createFile(attrs); + return this; + } + + @Override + public Path createDirectory(FileAttribute... attrs) + throws IOException + { + delegate.createDirectory(attrs); + return this; + } + + @Override + public SeekableByteChannel newByteChannel(Set options, + FileAttribute... attrs) + throws IOException + { + return delegate.newByteChannel(options, attrs); + } + + @Override + public SeekableByteChannel newByteChannel(OpenOption... options) + throws IOException + { + return delegate.newByteChannel(options); + } + + @Override + public InputStream newInputStream(OpenOption... options) throws IOException { + return delegate.newInputStream(); + } + + @Override + public OutputStream newOutputStream(OpenOption... options) + throws IOException + { + return delegate.newOutputStream(options); + } + + @Override + public boolean isHidden() throws IOException { + return delegate.isHidden(); + } + + @Override + public void checkAccess(AccessMode... modes) throws IOException { + delegate.checkAccess(modes); + } + + @Override + public boolean exists() { + return delegate.exists(); + } + + @Override + public boolean notExists() { + return delegate.notExists(); + } + + @Override + public FileStore getFileStore() throws IOException { + return delegate.getFileStore(); + } + + @Override + public WatchKey register(WatchService watcher, + WatchEvent.Kind[] events, + WatchEvent.Modifier... modifiers) + { + throw new UnsupportedOperationException(); + } + + @Override + public WatchKey register(WatchService watcher, + WatchEvent.Kind... events) + { + throw new UnsupportedOperationException(); + } + + + @Override + public Iterator iterator() { + final Iterator itr = delegate.iterator(); + return new Iterator() { + @Override + public boolean hasNext() { + return itr.hasNext(); + } + @Override + public Path next() { + return wrap(itr.next()); + } + @Override + public void remove() { + itr.remove(); + } + }; + } + + @Override + public int compareTo(Path other) { + return delegate.compareTo(unwrap(other)); + } + + @Override + public boolean isSameFile(Path other) throws IOException { + return delegate.isSameFile(unwrap(other)); + } + + + @Override + public boolean equals(Object other) { + if (!(other instanceof PassThroughPath)) + return false; + return delegate.equals(unwrap((PassThroughPath)other)); + } + + @Override + public int hashCode() { + return delegate.hashCode(); + } + + @Override + public String toString() { + return delegate.toString(); + } + } +} diff --git a/jdk/test/java/nio/file/TestUtil.java b/jdk/test/java/nio/file/TestUtil.java index 2436a45992c..972dc250d87 100644 --- a/jdk/test/java/nio/file/TestUtil.java +++ b/jdk/test/java/nio/file/TestUtil.java @@ -30,17 +30,20 @@ public class TestUtil { private TestUtil() { } - public static Path createTemporaryDirectory() throws IOException { - Path tmpdir = Paths.get(System.getProperty("java.io.tmpdir")); + static Path createTemporaryDirectory(String where) throws IOException { + Path top = FileSystems.getDefault().getPath(where); Random r = new Random(); - Path dir; do { - dir = tmpdir.resolve("name" + r.nextInt()); + dir = top.resolve("name" + r.nextInt()); } while (dir.exists()); return dir.createDirectory(); } + static Path createTemporaryDirectory() throws IOException { + return createTemporaryDirectory(System.getProperty("java.io.tmpdir")); + } + static void removeAll(Path dir) { Files.walkFileTree(dir, new FileVisitor() { @Override From f57059f5b46c393ff6b22ef2ad20071110f035da Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 18 Jan 2010 17:53:26 +0100 Subject: [PATCH 38/59] 6917663: test/java/security/Provider/Turkish.java not samevm friendly Added othervm flag to ensure that this test will run in isolation. Reviewed-by: alanb --- jdk/test/java/security/Provider/Turkish.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/test/java/security/Provider/Turkish.java b/jdk/test/java/security/Provider/Turkish.java index 1934561785d..ddf7391d9fe 100644 --- a/jdk/test/java/security/Provider/Turkish.java +++ b/jdk/test/java/security/Provider/Turkish.java @@ -25,6 +25,7 @@ * @test * @bug 6220064 * @summary make sure everything works ok in the Turkish local (dotted/dotless i problem) + * @run main/othervm Turkish * @author Andreas Sterbenz */ From 0dd2aad54faa2eedbbb05c9c8ed27c9f991439f8 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Mon, 18 Jan 2010 15:23:14 -0800 Subject: [PATCH 39/59] 6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH Build modules not depending on ALT_JDK_IMPORT_PATH being set Reviewed-by: alanb --- jdk/make/common/Defs.gmk | 17 +++- jdk/make/common/Modules.gmk | 6 +- jdk/make/modules/Makefile | 103 +++++++++++++---------- jdk/make/modules/optional.depconfig | 25 ++++++ jdk/make/modules/tools/Makefile | 126 +++++++++++++++++++++------- 5 files changed, 199 insertions(+), 78 deletions(-) diff --git a/jdk/make/common/Defs.gmk b/jdk/make/common/Defs.gmk index d233b1ff8a3..88a49d4443e 100644 --- a/jdk/make/common/Defs.gmk +++ b/jdk/make/common/Defs.gmk @@ -307,6 +307,9 @@ INCLUDEDIR = $(OUTPUTDIR)/include # for generated class files CLASSBINDIR = $(OUTPUTDIR)/classes DEMOCLASSDIR = $(OUTPUTDIR)/democlasses +# for modules +MODULES_DIR = $(OUTPUTDIR)/modules +ABS_MODULES_DIR = $(ABS_OUTPUTDIR)/modules # for generated tool class files BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses # for build tool jar files @@ -385,10 +388,18 @@ endif # # Build units may or may not define MODULE. Default to "other". # +# MODULE variable defines the lowest-level module name that +# might or might not be the name of the modules created in +# the modules build (see make/modules/modules.config and +# modules.group). +# +MODULES_TEMPDIR = $(OUTPUTDIR)/tmp/modules +ABS_MODULES_TEMPDIR = $(ABS_OUTPUTDIR)/tmp/modules + ifndef MODULE MODULE = other endif -override MODULE_DEST_DIR = $(OUTPUTDIR)/tmp/modules/$(MODULE) +override MODULE_DEST_DIR = $(MODULES_TEMPDIR)/$(MODULE) # the use of += above makes a space separated list which we need to # remove for filespecs. @@ -516,7 +527,7 @@ MODULE_PATH_PATTERN = -e 's%.*\/classes\/%classes\/%' \ define install-module-file dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \ $(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \ -$(CP) $@ $(MODULE_DEST_DIR)/$$dest +$(CP) -f $@ $(MODULE_DEST_DIR)/$$dest endef # Install all files from the directory to its module @@ -535,7 +546,7 @@ endef # install a sym link in its module define install-module-sym-link dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \ -$(LN) -s $1 $(MODULE_DEST_DIR)/$$dest +$(LN) -sf $1 $(MODULE_DEST_DIR)/$$dest endef diff --git a/jdk/make/common/Modules.gmk b/jdk/make/common/Modules.gmk index a8dc72a5439..435129dcfed 100644 --- a/jdk/make/common/Modules.gmk +++ b/jdk/make/common/Modules.gmk @@ -121,8 +121,6 @@ endif # JRE Image ###################################################### -MODULES_TEMPDIR=$(ABS_TEMPDIR)/modules -MODULES_LIB = $(ABS_OUTPUTDIR)/modules MODULES_LIST = $(MODULES_TEMPDIR)/classlist/modules.list # Modules in the jre/lib/security directory @@ -188,7 +186,7 @@ initial-module-image-jre:: initial-module-image-jre-setup \ @# copy modules to jre/lib @# for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ - $(CP) $(MODULES_LIB)/$$m/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib ; \ + $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib ; \ done $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/ext for m in $(EXT_MODULES) ; do \ @@ -344,7 +342,7 @@ initial-module-image-jdk:: initial-module-image-jdk-setup \ @# $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/lib for m in $(JDK_MODULES) ; do \ - $(CP) $(MODULES_LIB)/$$m/lib/$$m.jar $(JDK_MODULE_IMAGE_DIR)/lib ; \ + $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JDK_MODULE_IMAGE_DIR)/lib ; \ done ifeq ($(PLATFORM), windows) @# diff --git a/jdk/make/modules/Makefile b/jdk/make/modules/Makefile index 60dcd6ff395..ca7528f611e 100644 --- a/jdk/make/modules/Makefile +++ b/jdk/make/modules/Makefile @@ -23,65 +23,83 @@ # have any questions. # -# -# Modularizing the JDK -# - BUILDDIR = .. include $(BUILDDIR)/common/Defs.gmk -CLASSANALYZER_JAR=$(BUILDTOOLJARDIR)/classanalyzer.jar -JAVA_FLAGS=$(JAVA_TOOLS_FLAGS) -Xbootclasspath:$(CLASSBINDIR) +# +# Modularizing the JDK +# - Post jdk build process until the source tree is restructured +# for modules build +# - /modules/ will be created for each module. +# +# Steps: +# 0. During jdk build before this makefile is invoked, classes, +# resource files, and other non-class files such as native libraries, +# properties file, images, etc are created. +# +# Non-class files are copied to /tmp/modules/ +# directory in this step to prepare for the post-build modularization. +# +# The MODULE variable defined in other makefiles specifies +# the lowest-level module that the non-class files belong to. +# The name might or might not be the same as the name of the modules +# in the resulting /modules directory. +# +# 1. Unpack all jars in the /lib directory to a temporary +# location (/tmp/modules/classes) to prepare for modules +# creation. +# +# 2. Run ClassAnalyzer tool to analyze all jdk classes and generate +# class list for all modules and also perform dependency analysis. +# +# Input configuration files :- +# +# modules.config : defines the low-level modules and specifies +# what classes and resource files each module includes. +# modules.group : defines the module groups and its members. +# jdk7.depconfig : lists the dynamic dependencies including +# use of reflection Class.forName and JNI FindClass and +# service provider. +# optional.depconfig : lists the optional dependencies +# +# 3. Create one directory for each module (/modules/) +# based on the output files from (2). +# +# modules.list lists the modules to be created for the modules +# build and its members. For each module (m) in modules.list, +# a. create $m/lib/$m.jar with all classes and resource files +# listed in $m.classlist and $m.resources respectively. +# b. copy all non-class files from its members to +# /modules/$m. + -MODULE_LIB = $(ABS_OUTPUTDIR)/modules MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp -TMP=$(ABS_TEMPDIR)/modules -MODULE_CLASSLIST = $(TMP)/classlist -MODULE_CLASSES = $(TMP)/classes +TMP = $(ABS_MODULES_TEMPDIR) +MODULE_CLASSLIST = $(ABS_MODULES_TEMPDIR)/classlist +MODULE_CLASSES = $(ABS_MODULES_TEMPDIR)/classes MODULES_LIST = $(MODULE_CLASSLIST)/modules.list -SUBDIRS = tools -all build clean clobber:: - $(SUBDIRS-loop) - all:: unpack-jars gen-classlist modularize -$(CLASSANALYZER_JAR): - $(CD) tools && $(MAKE) all - JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print) unpack-jars: + @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." $(RM) -rf $(MODULE_CLASSES) $(MKDIR) -p $(MODULE_CLASSES) $(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES) - for jf in $(JAR_LIST) ; do \ + @for jf in $(JAR_LIST) ; do \ $(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\ done - -gen-classlist: $(CLASSANALYZER_JAR) - @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." - @$(RM) -rf $(MODULE_CLASSLIST) - @$(MKDIR) -p $(MODULE_CLASSLIST) - - @# Use java in the default tool directory. - @# OUTPUTDIR for solaris 64-bit doesn't have the tools. - $(JAVA_TOOLS_DIR)/java $(JAVA_FLAGS) \ - -Dclassanalyzer.debug \ - -jar $(CLASSANALYZER_JAR) \ - -jdkhome $(OUTPUTDIR) \ - -config modules.config \ - -config modules.group \ - -depconfig jdk7.depconfig \ - -depconfig optional.depconfig \ - -showdynamic \ - -output $(MODULE_CLASSLIST) @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." +gen-classlist: + $(CD) tools && $(MAKE) all + modularize: $(MODULE_JAR_MANIFEST_FILE) @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." - @$(RM) -rf $(MODULE_LIB) + @$(RM) -rf $(MODULES_DIR) @# create jar file for modules and @# copy other files from all members of this module @@ -91,16 +109,16 @@ modularize: $(MODULE_JAR_MANIFEST_FILE) if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \ $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \ fi ; \ - $(MKDIR) -p $(MODULE_LIB)/$$m/lib; \ + $(MKDIR) -p $(ABS_MODULES_DIR)/$$m/lib; \ $(CD) $(MODULE_CLASSES) && \ $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \ - $(MODULE_LIB)/$$m/lib/$$m.jar \ + $(ABS_MODULES_DIR)/$$m/lib/$$m.jar \ @$(TMP)/tmp.cf \ $(BOOT_JAR_JFLAGS); \ for s in `$(GREP) "^$$m" $(MODULES_LIST)` ; do \ if [ -d $(TMP)/$$s ] ; then \ - $(CP) -rf $(TMP)/$$s/* $(MODULE_LIB)/$$m; \ - $(RM) -rf $(MODULE_LIB)/$$m/classes; \ + $(CP) -rf $(TMP)/$$s/* $(ABS_MODULES_DIR)/$$m; \ + $(RM) -rf $(ABS_MODULES_DIR)/$$m/classes; \ fi \ done \ done @@ -112,6 +130,5 @@ $(MODULE_JAR_MANIFEST_FILE): clean clobber:: $(RM) -rf $(MODULE_CLASSLIST) - $(RM) -rf $(MODULE_LIB) + $(RM) -rf $(MODULES_DIR) $(RM) $(MODULE_JAR_MANIFEST_FILE) - $(RM) $(CLASSANALYZER_JAR) diff --git a/jdk/make/modules/optional.depconfig b/jdk/make/modules/optional.depconfig index 0811163e715..83f8bc79f91 100644 --- a/jdk/make/modules/optional.depconfig +++ b/jdk/make/modules/optional.depconfig @@ -1,3 +1,28 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + # public final java.nio.channels.SocketChannel getChannel() @Optional sun.security.ssl.BaseSSLSocketImpl -> java.nio.channels.SocketChannel diff --git a/jdk/make/modules/tools/Makefile b/jdk/make/modules/tools/Makefile index fcf514bec88..115411d360a 100644 --- a/jdk/make/modules/tools/Makefile +++ b/jdk/make/modules/tools/Makefile @@ -28,58 +28,128 @@ # BUILDDIR = ../.. -PACKAGE = com.sun.classanalyzer -PRODUCT = tools -PROGRAM = classanalyzer include $(BUILDDIR)/common/Defs.gmk +PKGDIR = com/sun/classanalyzer BUILDTOOL_SOURCE_ROOT = src BUILDTOOL_MAIN = $(PKGDIR)/ClassAnalyzer.java BUILTTOOL_MAINCLASS = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%)) BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN) -BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/$(PROGRAM)_manifest.mf -BUILDTOOL_JAR_FILE = $(BUILDTOOLJARDIR)/$(PROGRAM).jar +BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/classanalyzer_manifest.mf FILES_java := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \ - && $(FIND) $(PKGDIR) $(SCM_DIRS_prune) -o -type f -print) + && $(FIND) $(PKGDIR) -type f -print) + FILES_class = $(FILES_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) -all build: $(BUILDTOOL_JAR_FILE) tool_info +CLASSANALYZER_JAR_FILE = $(BUILDTOOLJARDIR)/classanalyzer.jar + +# +# ClassAnalyzer depends on the com.sun.tools.classfile API. +# The tool is compiled with the latest version of the classfile +# library in the langtools repo to make sure that synchronized +# change is made if the classfile API is changed. +# +# If langtools repo exists, build its own copy of the +# classfile library and use it for compile time and runtime. +# If not exist (the top level repo is not a forest), use +# the built jdk tools that imports tools.jar from the latest +# promoted build. +# +# If the classfile API is changed but not yet in a promoted build, +# the build might fail and the tool would need the langtools repo +# to build in that case. +# +ifndef LANGTOOLS_TOPDIR + LANGTOOLS_TOPDIR=$(JDK_TOPDIR)/../langtools +endif + +LANGTOOLS_TOPDIR_EXISTS := $(shell \ + if [ -d $(LANGTOOLS_TOPDIR) ] ; then \ + echo true; \ + else \ + echo false; \ + fi) + +CLASSFILE_SRC = $(LANGTOOLS_TOPDIR)/src/share/classes +CLASSFILE_PKGDIR = com/sun/tools/classfile + +ifeq ($(LANGTOOLS_TOPDIR_EXISTS), true) + FILES_classfile_java := $(shell \ + $(CD) $(CLASSFILE_SRC) && \ + $(FIND) $(CLASSFILE_PKGDIR) -name '*.java' -print) + FILES_classfile_class = $(FILES_classfile_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) + CLASSFILE_JAR_FILE = $(BUILDTOOLJARDIR)/classfile.jar + BUILDTOOL_JAVAC = $(BOOT_JAVAC_CMD) $(JAVAC_JVM_FLAGS) \ + $(BOOT_JAVACFLAGS) -classpath $(CLASSFILE_JAR_FILE) + BUILDTOOL_JAVA = $(BOOT_JAVA_CMD) $(JAVA_TOOLS_FLAGS) \ + -Xbootclasspath/p:$(CLASSFILE_JAR_FILE) +else + # if langtools doesn't exist, use tools from the built jdk + BUILDTOOL_JAVAC = $(BINDIR)/javac $(JAVAC_JVM_FLAGS) \ + $(BOOT_JAVACFLAGS) + BUILDTOOL_JAVA = $(BINDIR)/java $(JAVA_TOOLS_FLAGS) +endif + +# Location of the output modules.list, .classlist +# and other output files generated by the class analyzer tool. +# +MODULE_CLASSLIST = $(MODULES_TEMPDIR)/classlist + +all build: classanalyzer gen-classlist + +classanalyzer: $(CLASSFILE_JAR_FILE) $(CLASSANALYZER_JAR_FILE) + +gen-classlist: + @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." + @$(RM) -rf $(MODULE_CLASSLIST) + @$(MKDIR) -p $(MODULE_CLASSLIST) + $(BUILDTOOL_JAVA) \ + -Dclassanalyzer.debug \ + -jar $(CLASSANALYZER_JAR_FILE) \ + -jdkhome $(OUTPUTDIR) \ + -config ../modules.config \ + -config ../modules.group \ + -depconfig ../jdk7.depconfig \ + -depconfig ../optional.depconfig \ + -showdynamic \ + -output $(MODULE_CLASSLIST) + @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." $(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE) @$(prep-target) $(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@ +$(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR)/%.class : $(CLASSFILE_SRC)/$(CLASSFILE_PKGDIR)/%.java + @$(prep-target) + @$(BUILDTOOL_JAVAC) \ + -sourcepath $(CLASSFILE_SRC) \ + -d $(BUILDTOOLCLASSDIR) $< + $(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java @$(prep-target) - $(JAVAC_CMD) \ + $(BUILDTOOL_JAVAC) \ -sourcepath $(BUILDTOOL_SOURCE_ROOT) \ -d $(BUILDTOOLCLASSDIR) $< -$(BUILDTOOL_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class) +$(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class) @$(prep-target) - $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \ - -C $(BUILDTOOLCLASSDIR) $(PKGDIR) \ - $(BOOT_JAR_JFLAGS) || $(RM) $@ - $(java-vm-cleanup) + $(CD) $(BUILDTOOLCLASSDIR) && \ + $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \ + $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ + @$(java-vm-cleanup) -# Printing out a build tool information line -define printBuildToolSetting -if [ "$2" != "" ] ; then $(PRINTF) "%-25s %s\n" "$1:" "$2"; fi -endef - -# Print out the build tool information -tool_info: - @$(ECHO) "=========================================================" - @$(call printBuildToolSetting,BUILDTOOL,$(PROGRAM)) - @$(call printBuildToolSetting,PACKAGE,$(PACKAGE)) - @$(call printBuildToolSetting,BUILDTOOL_SOURCE_ROOT,$(BUILDTOOL_SOURCE_ROOT)) - @$(call printBuildToolSetting,BUILTTOOL_MAINCLASS,$(BUILTTOOL_MAINCLASS)) - @$(call printBuildToolSetting,BUILDTOOL_JAR_FILE,$(BUILDTOOL_JAR_FILE)) - @$(ECHO) "=========================================================" +$(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class) + @$(prep-target) + $(CD) $(BUILDTOOLCLASSDIR) && \ + $(BOOT_JAR_CMD) cf $@ \ + $(CLASSFILE_PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ + @$(java-vm-cleanup) clean clobber:: @$(RM) -rf $(BUILDTOOLCLASSDIR)/$(PKGDIR) + @$(RM) -rf $(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR) @$(RM) $(BUILDTOOL_MANIFEST_FILE) - @$(RM) $(BUILDTOOL_JAR_FILE) + @$(RM) $(CLASSANALYZER_JAR_FILE) + @$(RM) $(CLASSFILE_JAR_FILE) From 9645beba5ce2a89564569689bd4f43effda13e72 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Tue, 19 Jan 2010 11:43:45 +0800 Subject: [PATCH 40/59] 6917791: KeyTabEntry, when the byte value smaller then 16, the string drop '0' Reviewed-by: xuelei --- .../krb5/internal/ktab/KeyTabEntry.java | 2 +- .../sun/security/krb5/ktab/KeyString.java | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 jdk/test/sun/security/krb5/ktab/KeyString.java diff --git a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java index 3eb08b5df43..49c99fcb9d3 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java @@ -75,7 +75,7 @@ public class KeyTabEntry implements KeyTabConstants { public String getKeyString() { StringBuffer sb = new StringBuffer("0x"); for (int i = 0; i < keyblock.length; i++) { - sb.append(Integer.toHexString(keyblock[i]&0xff)); + sb.append(String.format("%02x", keyblock[i]&0xff)); } return sb.toString(); } diff --git a/jdk/test/sun/security/krb5/ktab/KeyString.java b/jdk/test/sun/security/krb5/ktab/KeyString.java new file mode 100644 index 00000000000..8a9c8898b4f --- /dev/null +++ b/jdk/test/sun/security/krb5/ktab/KeyString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +/* + * @test + * @bug 6917791 + * @summary KeyTabEntry, when the byte value smaller then 16, the string drop '0' + */ + +import sun.security.krb5.internal.ktab.KeyTabEntry; + +public class KeyString { + public static void main(String[] args) throws Exception { + KeyTabEntry e = new KeyTabEntry(null, null, null, 1, 1, new byte[8]); + // "0x" plus eight "00" + if (e.getKeyString().length() != 18) { + throw new Exception("key bytes length not correct"); + } + } +} From 79eae06de62cde7b61b54200cfb6773d0404c822 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 21 Jan 2010 11:12:21 -0800 Subject: [PATCH 41/59] Added tag jdk7-b80 for changeset e28f9a870f12 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index e43d2429adc..7f37898d353 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -54,3 +54,4 @@ c8b63075403d53a208104a8a6ea5072c1cb66aab jdk7-b76 1f17ca8353babb13f4908c1f87d11508232518c8 jdk7-b77 ab4ae8f4514693a9fe17ca2fec0239d8f8450d2c jdk7-b78 20aeeb51713990dbea6929a2e100a8bbf5df70d4 jdk7-b79 +a3242906c7747b5d9bcc3d118c7c3c69aa40f4b7 jdk7-b80 From d50eddb96269d4e2875b3a856d99bebc549cea66 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 21 Jan 2010 11:12:22 -0800 Subject: [PATCH 42/59] Added tag jdk7-b80 for changeset 2e36be9a9a7f --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index d8207f7ffed..2472579cb11 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -54,3 +54,4 @@ b751c528c55560cf2adeaeef24b39ca1f4d1cbf7 jdk7-b73 6881f0383f623394b5ec73f27a5f329ff55d0467 jdk7-b77 a7f7276b48cd74d8eb1baa83fbf3d1ef4a2603c8 jdk7-b78 ec0421b5703b677e2226cf4bf7ae4eaafd8061c5 jdk7-b79 +0336e70ca0aeabc783cc01658f36cb6e27ea7934 jdk7-b80 From ede6404548888ebd3700e9ef07f743eb27359441 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 21 Jan 2010 11:12:25 -0800 Subject: [PATCH 43/59] Added tag jdk7-b80 for changeset 8f15a8afca28 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index a8a8db0f290..84c4c8bc4c3 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -54,3 +54,4 @@ d8dd291a362acb656026a9c0a9da48501505a1e7 jdk7-b75 455105fc81d941482f8f8056afaa7aa0949c9300 jdk7-b77 e703499b4b51e3af756ae77c3d5e8b3058a14e4e jdk7-b78 a5a6adfca6ecefb5894a848debabfe442ff50e25 jdk7-b79 +3003ddd1d4330b06cb4691ae74d600d3685899eb jdk7-b80 From c22703a78f7db44d678d5708e10537c26222ee63 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 21 Jan 2010 11:12:31 -0800 Subject: [PATCH 44/59] Added tag jdk7-b80 for changeset 4f440ce94e8f --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 42de91ac8ce..88a3c46d299 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -54,3 +54,4 @@ ea7b88c676dd8b269bc858a4a17c14dc96c8aed1 jdk7-b74 bfadab8c7b1bf806a49d3e1bc19ec919717f057a jdk7-b77 7a12d3789e1b07a560fc79568b991818d617ede2 jdk7-b78 b1005c504358c18694c84e95fec16b28cdce7ae1 jdk7-b79 +9219574db5936367114b0f31469837f27d5a375a jdk7-b80 From 3000b7b77796c0a893b9304c871ce745982d9045 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 21 Jan 2010 11:12:31 -0800 Subject: [PATCH 45/59] Added tag jdk7-b80 for changeset 45ed797aeb93 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 9fd7d644b60..02f7c58c83e 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -54,3 +54,4 @@ fcf2b8b5d606641659419f247fcee4b284c45e6e jdk7-b75 5b4968c110476085225d3a71c4210fad2c1116c1 jdk7-b77 fc1c72d1dfbb17db7d46bba8db9afc39cbbb9299 jdk7-b78 c08894f5b6e594b9b12993e256b96c1b38099632 jdk7-b79 +447767dee56a0f8cb89acc8bf7be5f9be7d84e8b jdk7-b80 From 6f9b40f5772bb993e8942999d108c0ac7812e455 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 21 Jan 2010 11:12:37 -0800 Subject: [PATCH 46/59] Added tag jdk7-b80 for changeset 3effa7542ca5 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 15f0d5533b3..e6ad3c85d52 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -54,3 +54,4 @@ eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74 e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77 1143e498f813b8223b5e3a696d79da7ff7c25354 jdk7-b78 918920710d65432a2d54fdf407c1524a5571c4ad jdk7-b79 +049cfaaa9a7374e3768a79969a799e8b59ad52fa jdk7-b80 From 529b769396f40c9806d820859f054c421195e5c4 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 21 Jan 2010 11:12:47 -0800 Subject: [PATCH 47/59] Added tag jdk7-b80 for changeset 50559985f09b --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 31ee735e54f..662a0caab64 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -54,3 +54,4 @@ ce9bcdcb7859bb7ef10afd078ad59ba7847f208d jdk7-b69 0398ae15b90ac76d87ee21844453e95ff8613e43 jdk7-b77 acc1e40a5874ebf32bebcb6ada565b3b40b7461c jdk7-b78 ac5b4c5644ce54585e5287563dde2b006fa664f4 jdk7-b79 +f0074aa48d4e2a4c03c92b9c4f880679fea0306c jdk7-b80 From 233fefb60d38d8b4d5e4ec25c4c3ffb878ad8e4c Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Fri, 22 Jan 2010 15:01:00 -0800 Subject: [PATCH 48/59] 6919437: Bump the HS17 build number to 08 Update the HS17 build number to 08 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 103051faf3f..4dfc3baf752 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2009 HS_MAJOR_VER=17 HS_MINOR_VER=0 -HS_BUILD_NUMBER=07 +HS_BUILD_NUMBER=08 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 From 9b387b7ab7e41612b8fb30c8df914ddd3978fdab Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 28 Jan 2010 11:26:38 -0800 Subject: [PATCH 49/59] Added tag jdk7-b81 for changeset f2507e238f8a --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 7f37898d353..e89dd0a443a 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -55,3 +55,4 @@ c8b63075403d53a208104a8a6ea5072c1cb66aab jdk7-b76 ab4ae8f4514693a9fe17ca2fec0239d8f8450d2c jdk7-b78 20aeeb51713990dbea6929a2e100a8bbf5df70d4 jdk7-b79 a3242906c7747b5d9bcc3d118c7c3c69aa40f4b7 jdk7-b80 +8403096d1fe7ff5318df9708cfec84a3fd3e1cf9 jdk7-b81 From 03ff9b9965e4639629b2d71a0173eb3c6c9c8170 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 28 Jan 2010 11:26:39 -0800 Subject: [PATCH 50/59] Added tag jdk7-b81 for changeset 9900f2781664 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 2472579cb11..3d89f1fffed 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -55,3 +55,4 @@ b751c528c55560cf2adeaeef24b39ca1f4d1cbf7 jdk7-b73 a7f7276b48cd74d8eb1baa83fbf3d1ef4a2603c8 jdk7-b78 ec0421b5703b677e2226cf4bf7ae4eaafd8061c5 jdk7-b79 0336e70ca0aeabc783cc01658f36cb6e27ea7934 jdk7-b80 +e08a42a2a94d97ea8eedb187a94dbff822c8fbba jdk7-b81 From 2fb0850cfdf519d2de8b023550c16062de32766b Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 28 Jan 2010 11:26:42 -0800 Subject: [PATCH 51/59] Added tag jdk7-b81 for changeset 4197a09e1259 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 84c4c8bc4c3..687370f73b9 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -55,3 +55,4 @@ d8dd291a362acb656026a9c0a9da48501505a1e7 jdk7-b75 e703499b4b51e3af756ae77c3d5e8b3058a14e4e jdk7-b78 a5a6adfca6ecefb5894a848debabfe442ff50e25 jdk7-b79 3003ddd1d4330b06cb4691ae74d600d3685899eb jdk7-b80 +1f9b07674480c224828852ffe137beea36b3cab5 jdk7-b81 From acd68fe1dac3767512f91d8c8c885806b14a83cd Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 28 Jan 2010 11:26:48 -0800 Subject: [PATCH 52/59] Added tag jdk7-b81 for changeset 0c8ad4a8e25b --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 88a3c46d299..2dbd5bd8e68 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -55,3 +55,4 @@ bfadab8c7b1bf806a49d3e1bc19ec919717f057a jdk7-b77 7a12d3789e1b07a560fc79568b991818d617ede2 jdk7-b78 b1005c504358c18694c84e95fec16b28cdce7ae1 jdk7-b79 9219574db5936367114b0f31469837f27d5a375a jdk7-b80 +204e59d488cdaa9eafa8cb7164ea955b5a9d4a51 jdk7-b81 From 04d4c26c540f7ebe2b14f026f105064de55e3953 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 28 Jan 2010 11:26:49 -0800 Subject: [PATCH 53/59] Added tag jdk7-b81 for changeset 4ef036bb3679 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 02f7c58c83e..397b72859f7 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -55,3 +55,4 @@ fcf2b8b5d606641659419f247fcee4b284c45e6e jdk7-b75 fc1c72d1dfbb17db7d46bba8db9afc39cbbb9299 jdk7-b78 c08894f5b6e594b9b12993e256b96c1b38099632 jdk7-b79 447767dee56a0f8cb89acc8bf7be5f9be7d84e8b jdk7-b80 +f051045fe94a48fae1097f90cbd9227e6aae6b7e jdk7-b81 From d202ec0bed0ddf764a0e4f7950c87fb5d5531735 Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 28 Jan 2010 11:26:54 -0800 Subject: [PATCH 54/59] Added tag jdk7-b81 for changeset a280fa50978f --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index e6ad3c85d52..388b247aace 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -55,3 +55,4 @@ e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77 1143e498f813b8223b5e3a696d79da7ff7c25354 jdk7-b78 918920710d65432a2d54fdf407c1524a5571c4ad jdk7-b79 049cfaaa9a7374e3768a79969a799e8b59ad52fa jdk7-b80 +10b993d417fcdb40480dad7032ac241f4b87f1af jdk7-b81 From 3ef138021970744a1f0a222f9eb3fdc6097bf3da Mon Sep 17 00:00:00 2001 From: Michael Wilkerson Date: Thu, 28 Jan 2010 11:27:04 -0800 Subject: [PATCH 55/59] Added tag jdk7-b81 for changeset 43ee00bea176 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 662a0caab64..00e80a25c55 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -55,3 +55,4 @@ ce9bcdcb7859bb7ef10afd078ad59ba7847f208d jdk7-b69 acc1e40a5874ebf32bebcb6ada565b3b40b7461c jdk7-b78 ac5b4c5644ce54585e5287563dde2b006fa664f4 jdk7-b79 f0074aa48d4e2a4c03c92b9c4f880679fea0306c jdk7-b80 +cfabfcf9f110ef896cbdd382903d20eefbceefe0 jdk7-b81 From 6e0e99e0cd5bdf6e621adba2427adbad4bd52be1 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Thu, 28 Jan 2010 21:01:13 +0000 Subject: [PATCH 56/59] 6921068: Remove javadoc builds warnings from specdefault tag Ignore specdefault tag to avoid javadoc warnings Reviewed-by: darcy, ohair --- jdk/make/docs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/make/docs/Makefile b/jdk/make/docs/Makefile index 5d287c37272..e0ae9b5a400 100644 --- a/jdk/make/docs/Makefile +++ b/jdk/make/docs/Makefile @@ -69,7 +69,7 @@ DRAFT = '
DRAFT '$(MILESTONE)-$(BUILD_NUMBER)'' THIS_YEAR := $(shell $(DATE) | $(SED) -e 's/ / /g' | $(CUT) -d' ' -f6) TRADEMARK = &\#x2122; -IGNORED_TAGS = beaninfo revised since.unbundled spec Note ToDo +IGNORED_TAGS = beaninfo revised since.unbundled spec specdefault Note ToDo JLS3_URL = http://java.sun.com/docs/books/jls/ JLS3_CITE = \ From 2d314b47cd3710fb9e7590507373b8c904ef2fd8 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Fri, 29 Jan 2010 02:38:22 +0000 Subject: [PATCH 57/59] 6917466: Should set bootclasspath for javadoc in jdk build Javadoc needs to reference the newly built classes so as not to hit APIs which differ between the boot JDK and the source files of the JDK being built. Reviewed-by: ohair --- jdk/make/common/shared/Defs-java.gmk | 9 +++++++-- jdk/make/javax/swing/beaninfo/SwingBeans.gmk | 9 ++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/jdk/make/common/shared/Defs-java.gmk b/jdk/make/common/shared/Defs-java.gmk index f9ed6353131..1d13c216940 100644 --- a/jdk/make/common/shared/Defs-java.gmk +++ b/jdk/make/common/shared/Defs-java.gmk @@ -138,6 +138,10 @@ JAVACFLAGS += $(OTHER_JAVACFLAGS) # Needed for javah JAVAHFLAGS += -bootclasspath $(CLASSBINDIR) +# Needed for javadoc to ensure it builds documentation +# against the newly built classes +JAVADOCFLAGS += -bootclasspath $(CLASSBINDIR) + # Needed for JAVADOC and BOOT_JAVACFLAGS NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true @@ -155,14 +159,15 @@ ifdef LANGTOOLS_DIST -jar $(JAVAH_JAR) $(JAVAHFLAGS) JAVADOC_CMD = $(BOOT_JAVA_CMD) \ "-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \ - -jar $(JAVADOC_JAR) + -jar $(JAVADOC_JAR) $(JAVADOCFLAGS) else # If no explicit tools, use boot tools (add VM flags in this case) JAVAC_CMD = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \ $(JAVACFLAGS) JAVAH_CMD = $(JAVA_TOOLS_DIR)/javah \ $(JAVAHFLAGS) - JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%) + JAVADOC_CMD = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%) \ + $(JAVADOCFLAGS) endif # Override of what javac to use (see deploy workspace) diff --git a/jdk/make/javax/swing/beaninfo/SwingBeans.gmk b/jdk/make/javax/swing/beaninfo/SwingBeans.gmk index 20a716e0742..61fcf0b79a9 100644 --- a/jdk/make/javax/swing/beaninfo/SwingBeans.gmk +++ b/jdk/make/javax/swing/beaninfo/SwingBeans.gmk @@ -25,7 +25,7 @@ # # Makefile to build the BeanInfo generation tool (ie, a doclet), and -# then the beaninfo itself. Swing versions prior to 1.2 is no longer +# then the beaninfo itself. Swing versions prior to 1.2 are no longer # built. # # This makefile could be a lot simpler if we made it more regular. @@ -44,13 +44,12 @@ swing-1.2-beans-debug: $(MAKE) DEBUG_FLAG=true make-swing-beans -LOCAL_JAVADOC = $(JAVADOC_CMD) $(JAVADOCFLAGS) # get the absolute path to the jar command. PREFIX = 1.2 -JAVADOCFLAGS = $(NO_PROPRIETARY_API_WARNINGS) $(LANGUAGE_VERSION) +JAVADOCFLAGS += $(NO_PROPRIETARY_API_WARNINGS) $(LANGUAGE_VERSION) SWINGPKG = javax/swing LOCAL_JAVAC_FLAGS = $(OTHER_JAVACFLAGS) -# since LOCAL_JAVADOC runs on ALT_BOOTDIR, the doclet and all its classes must be compiled to match +# since JAVADOC_CMD runs on ALT_BOOTDIR, the doclet and all its classes must be compiled to match DOCLET_JAVAC_FLAGS = -source 6 -target 6 include FILES.gmk @@ -114,7 +113,7 @@ mkbeaninfo: $(BEANSRCDIR) .delete.beanlist $(FILES_beans) .javadoc.beanlist .javadoc.beanlist: if [ -s $(TEMPDIR)/.beans.list ]; \ - then $(LOCAL_JAVADOC) $(DOCLETFLAGS) -x $(DEBUG_FLAG) -d $(BEANSRCDIR) -t $(DOCLETSRC)/SwingBeanInfo.template -docletpath $(DOCLETDST) \ + then $(JAVADOC_CMD) $(DOCLETFLAGS) -x $(DEBUG_FLAG) -d $(BEANSRCDIR) -t $(DOCLETSRC)/SwingBeanInfo.template -docletpath $(DOCLETDST) \ $(shell if [ -s $(TEMPDIR)/.beans.list ]; then $(CAT) $(TEMPDIR)/.beans.list; fi); \ fi @$(java-vm-cleanup) From 067def0f1b3f89f6dd35934d1b7fc8b01506ed08 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 17:05:41 +0200 Subject: [PATCH 58/59] Added tag jdk7-b80 for changeset e6abd38682d2 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index c8522d07a2f..fdf92c01ecc 100644 --- a/.hgtags +++ b/.hgtags @@ -54,3 +54,4 @@ ce74bd35ce948d629a356e168797f44b593b1578 jdk7-b73 1d0121b741f029dc4b828e4b36ba6fda92907dd7 jdk7-b77 4061c66ba1af1a2e27c2c839ba887407dd3ce050 jdk7-b78 e9c98378f6b9256c0595ef2985ca5899f0c0e274 jdk7-b79 +e6abd38682d237306d6c147c17538ec9e7f8e3a7 jdk7-b80 From 04d32968fee6ff1448c3763ab61dde50bd1c13ac Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 17:06:08 +0200 Subject: [PATCH 59/59] Added tag jdk7-b81 for changeset dcc938ac40cc --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index fdf92c01ecc..32bc2071e9d 100644 --- a/.hgtags +++ b/.hgtags @@ -55,3 +55,4 @@ ce74bd35ce948d629a356e168797f44b593b1578 jdk7-b73 4061c66ba1af1a2e27c2c839ba887407dd3ce050 jdk7-b78 e9c98378f6b9256c0595ef2985ca5899f0c0e274 jdk7-b79 e6abd38682d237306d6c147c17538ec9e7f8e3a7 jdk7-b80 +dcc938ac40cc45f1ef454d76020b5db5d943001c jdk7-b81