Tue, 20 Apr 2010 01:30:04 -0700
Merge
test/tools/javap/T6305779.java | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Sun Apr 11 23:24:24 2010 -0700 1.2 +++ b/.hgtags Tue Apr 20 01:30:04 2010 -0700 1.3 @@ -63,3 +63,4 @@ 1.4 ef07347428f2198ae6b8144ac0b9086bbe39fd16 jdk7-b86 1.5 409db93d19c002333980df5b797c6b965150c7a0 jdk7-b87 1.6 f9b5d4867a26f8c4b90ad37fe2c345b721e93d6b jdk7-b88 1.7 +6cea9a143208bc1185ced046942c0f4e45dbeba5 jdk7-b89
2.1 --- a/make/Makefile Sun Apr 11 23:24:24 2010 -0700 2.2 +++ b/make/Makefile Tue Apr 20 01:30:04 2010 -0700 2.3 @@ -188,10 +188,16 @@ 2.4 # All ant targets of interest 2.5 ANT_TARGETS = build clean sanity post-sanity diagnostics # for now 2.6 2.7 +# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1) 2.8 +$(OUTPUTDIR)/build/ant-diagnostics.log: 2.9 + @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) 2.10 + @$(RM) $@ 2.11 + $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \ 2.12 + $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@ 2.13 + 2.14 # Create a make target for each 2.15 -$(ANT_TARGETS): 2.16 +$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log 2.17 @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) 2.18 - $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $(OUTPUTDIR)/build/ant-diagnostics.log 2.19 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@ 2.20 2.21 #-------------------------------------------------------------------
3.1 --- a/make/jprt.properties Sun Apr 11 23:24:24 2010 -0700 3.2 +++ b/make/jprt.properties Tue Apr 20 01:30:04 2010 -0700 3.3 @@ -50,6 +50,5 @@ 3.4 jprt.test.targets= 3.5 3.6 # Directories needed to build 3.7 -jprt.bundle.src.dirs=make src 3.8 jprt.bundle.exclude.src.dirs=build dist 3.9
4.1 --- a/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Sun Apr 11 23:24:24 2010 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Tue Apr 20 01:30:04 2010 -0700 4.3 @@ -229,23 +229,24 @@ 4.4 if (kind == ENUM) { 4.5 List<Element> enclosedElements = 4.6 new ArrayList<Element>(e.getEnclosedElements()); 4.7 + // Handle any enum constants specially before other entities. 4.8 List<Element> enumConstants = new ArrayList<Element>(); 4.9 for(Element element : enclosedElements) { 4.10 if (element.getKind() == ENUM_CONSTANT) 4.11 enumConstants.add(element); 4.12 } 4.13 + if (!enumConstants.isEmpty()) { 4.14 + int i; 4.15 + for(i = 0; i < enumConstants.size()-1; i++) { 4.16 + this.visit(enumConstants.get(i), true); 4.17 + writer.print(","); 4.18 + } 4.19 + this.visit(enumConstants.get(i), true); 4.20 + writer.println(";\n"); 4.21 4.22 - int i; 4.23 - for(i = 0; i < enumConstants.size()-1; i++) { 4.24 - this.visit(enumConstants.get(i), true); 4.25 - writer.print(","); 4.26 - } 4.27 - if (i >= 0 ) { 4.28 - this.visit(enumConstants.get(i), true); 4.29 - writer.print(";"); 4.30 + enclosedElements.removeAll(enumConstants); 4.31 } 4.32 4.33 - enclosedElements.removeAll(enumConstants); 4.34 for(Element element : enclosedElements) 4.35 this.visit(element); 4.36 } else {
5.1 --- a/src/share/classes/com/sun/tools/javah/JavahTask.java Sun Apr 11 23:24:24 2010 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javah/JavahTask.java Tue Apr 20 01:30:04 2010 -0700 5.3 @@ -318,12 +318,6 @@ 5.4 int run(String[] args) { 5.5 try { 5.6 handleOptions(args); 5.7 - if (classes == null || classes.size() == 0) { 5.8 - if (help || version || fullVersion) 5.9 - return 0; 5.10 - else 5.11 - return 1; 5.12 - } 5.13 boolean ok = run(); 5.14 return ok ? 0 : 1; 5.15 } catch (BadArgs e) { 5.16 @@ -355,7 +349,7 @@ 5.17 fileManager = getDefaultFileManager(diagnosticListener, log); 5.18 5.19 Iterator<String> iter = args.iterator(); 5.20 - boolean noArgs = !iter.hasNext(); 5.21 + noArgs = !iter.hasNext(); 5.22 5.23 while (iter.hasNext()) { 5.24 String arg = iter.next(); 5.25 @@ -416,9 +410,9 @@ 5.26 5.27 Util util = new Util(log, diagnosticListener); 5.28 5.29 - if (help) { 5.30 + if (noArgs || help) { 5.31 showHelp(); 5.32 - return true; 5.33 + return help; // treat noArgs as an error for purposes of exit code 5.34 } 5.35 5.36 if (version || fullVersion) { 5.37 @@ -636,6 +630,7 @@ 5.38 String usercp; 5.39 List<String> classes; 5.40 boolean verbose; 5.41 + boolean noArgs; 5.42 boolean help; 5.43 boolean trace; 5.44 boolean version;
6.1 --- a/src/share/classes/com/sun/tools/javap/ClassWriter.java Sun Apr 11 23:24:24 2010 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javap/ClassWriter.java Tue Apr 20 01:30:04 2010 -0700 6.3 @@ -225,15 +225,15 @@ 6.4 writeModifiers(flags.getFieldModifiers()); 6.5 Signature_attribute sigAttr = getSignature(f.attributes); 6.6 if (sigAttr == null) 6.7 - print(getFieldType(f.descriptor)); 6.8 + print(getJavaFieldType(f.descriptor)); 6.9 else { 6.10 try { 6.11 Type t = sigAttr.getParsedSignature().getType(constant_pool); 6.12 - print(t); 6.13 + print(getJavaName(t.toString())); 6.14 } catch (ConstantPoolException e) { 6.15 // report error? 6.16 // fall back on non-generic descriptor 6.17 - print(getFieldType(f.descriptor)); 6.18 + print(getJavaFieldType(f.descriptor)); 6.19 } 6.20 } 6.21 print(" "); 6.22 @@ -314,14 +314,14 @@ 6.23 } 6.24 if (getName(m).equals("<init>")) { 6.25 print(getJavaName(classFile)); 6.26 - print(getParameterTypes(d, flags)); 6.27 + print(getJavaParameterTypes(d, flags)); 6.28 } else if (getName(m).equals("<clinit>")) { 6.29 print("{}"); 6.30 } else { 6.31 - print(getReturnType(d)); 6.32 + print(getJavaReturnType(d)); 6.33 print(" "); 6.34 print(getName(m)); 6.35 - print(getParameterTypes(d, flags)); 6.36 + print(getJavaParameterTypes(d, flags)); 6.37 } 6.38 6.39 Attribute e_attr = m.attributes.get(Attribute.Exceptions); 6.40 @@ -460,9 +460,9 @@ 6.41 } 6.42 } 6.43 6.44 - String getFieldType(Descriptor d) { 6.45 + String getJavaFieldType(Descriptor d) { 6.46 try { 6.47 - return d.getFieldType(constant_pool); 6.48 + return getJavaName(d.getFieldType(constant_pool)); 6.49 } catch (ConstantPoolException e) { 6.50 return report(e); 6.51 } catch (DescriptorException e) { 6.52 @@ -470,9 +470,9 @@ 6.53 } 6.54 } 6.55 6.56 - String getReturnType(Descriptor d) { 6.57 + String getJavaReturnType(Descriptor d) { 6.58 try { 6.59 - return d.getReturnType(constant_pool); 6.60 + return getJavaName(d.getReturnType(constant_pool)); 6.61 } catch (ConstantPoolException e) { 6.62 return report(e); 6.63 } catch (DescriptorException e) { 6.64 @@ -480,9 +480,9 @@ 6.65 } 6.66 } 6.67 6.68 - String getParameterTypes(Descriptor d, AccessFlags flags) { 6.69 + String getJavaParameterTypes(Descriptor d, AccessFlags flags) { 6.70 try { 6.71 - return adjustVarargs(flags, d.getParameterTypes(constant_pool)); 6.72 + return getJavaName(adjustVarargs(flags, d.getParameterTypes(constant_pool))); 6.73 } catch (ConstantPoolException e) { 6.74 return report(e); 6.75 } catch (DescriptorException e) {
7.1 --- a/test/Makefile Sun Apr 11 23:24:24 2010 -0700 7.2 +++ b/test/Makefile Tue Apr 20 01:30:04 2010 -0700 7.3 @@ -1,7 +1,21 @@ 7.4 # 7.5 -# Makefile to run jtreg and any other tests 7.6 +# Makefile to run jtreg and other tests 7.7 # 7.8 7.9 +# Product builds and langtools builds 7.10 +# 7.11 +# A full product build (or "control" build) creates a complete JDK image. 7.12 +# To test a product build, set TESTJAVA to the path for the image. 7.13 +# 7.14 +# A langtools build just builds the langtools components of a JDK. 7.15 +# To test a langtools build, set TESTJAVA to the path for a recent JDK 7.16 +# build, and set TESTBOOTCLASSPATH to the compiled langtools classes -- 7.17 +# for example build/classes or dist/lib/classes.jar. 7.18 + 7.19 +# JPRT 7.20 +# JPRT may invoke this Makefile directly, as part of a langtools build, 7.21 +# or indirectly, via FOREST/test/Makefile, as part of a control build. 7.22 + 7.23 # Get OS/ARCH specifics 7.24 OSNAME = $(shell uname -s) 7.25 ifeq ($(OSNAME), SunOS) 7.26 @@ -41,8 +55,11 @@ 7.27 # Root of this test area (important to use full paths in some places) 7.28 TEST_ROOT := $(shell pwd) 7.29 7.30 -# Default bundle of all test results (passed or not) 7.31 -JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip 7.32 +# Default bundle of all test results (passed or not) (JPRT only) 7.33 +ifdef JPRT_JOB_ID 7.34 + JPRT_CLEAN = clean 7.35 + JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip 7.36 +endif 7.37 7.38 ifeq ($(PLATFORM), windows) 7.39 SLASH_JAVA = J: 7.40 @@ -57,8 +74,21 @@ 7.41 JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg 7.42 endif 7.43 JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg 7.44 +JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff 7.45 7.46 -# Default JDK for JTREG 7.47 +# Default JCK to run 7.48 +ifdef JPRT_JCK_HOME 7.49 + JCK_HOME = $(JPRT_JCK_HOME) 7.50 +else 7.51 + JCK_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries 7.52 +endif 7.53 + 7.54 +# Default JDK for JTREG and JCK 7.55 +# 7.56 +# JT_JAVA is the version of java used to run jtreg/JCK. Since it is now 7.57 +# standard to execute tests in sameVM mode, it should normally be set the 7.58 +# same as TESTJAVA (although not necessarily so.) 7.59 +# 7.60 ifdef JPRT_JAVA_HOME 7.61 JT_JAVA = $(JPRT_JAVA_HOME) 7.62 else 7.63 @@ -72,49 +102,275 @@ 7.64 TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH) 7.65 endif 7.66 7.67 -TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar 7.68 +# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from 7.69 +# make/Makefile 7.70 +# For langtools, this is a directory containing build and dist 7.71 +# For a control build, this is build/$(PRODUCT)-$(ARCH)/j2sdk-image 7.72 +ifdef PRODUCT_HOME 7.73 + ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0) 7.74 + TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar 7.75 + endif 7.76 + ifeq ($(shell [ -r $(PRODUCT_HOME)/lib/tools.jar ]; echo $$?),0) 7.77 + TESTJAVA = $(PRODUCT_HOME) 7.78 + endif 7.79 +endif 7.80 + 7.81 +ifdef TESTBOOTCLASSPATH 7.82 + JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH) 7.83 +### In the following, -refvmoptions is an undocumented option 7.84 +### The following does not work JCK 7 b30 2/6/2010. Awaiting b31. 7.85 + JCK_OPTIONS += \ 7.86 + -vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \ 7.87 + -refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) 7.88 +endif 7.89 + 7.90 +# Concurrency is the number of tests that can execute at once. 7.91 +# Supported for JCK, not supported for jtreg. 7.92 +# On an otherwise empty machine, suggest setting to (#cpus + 2) 7.93 +# If unset, the default is (#cpus) 7.94 +### RFE: determine and use #cpus 7.95 +ifdef JCK_CONCURRENCY 7.96 + JCK_OPTIONS += -concurrency:$(JCK_CONCURRENCY) 7.97 +endif 7.98 + 7.99 +# JCK is executed using "Multi-JVM Group Mode", which is a hybrid 7.100 +# of otherVM and sameVM modes. New JVMs are created and reused for 7.101 +# a number of tests, then eventually discarded and a new one started. 7.102 +# This amortizes the JVM startup time. The "group size" defines 7.103 +# how many tests are run in a JVM before it is replaced. 7.104 +# If unset, the default is 100. 7.105 +JCK_GROUP_SIZE = 1000 7.106 +ifdef JCK_GROUP_SIZE 7.107 + JCK_COMPILER_OPTIONS += \ 7.108 + -jtoptions:-Ejck.env.compiler.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) \ 7.109 + -jtoptions:-Ejck.env.compiler.compRefExecute.groupMode.groupSize=$(JCK_GROUP_SIZE) 7.110 +### The following is not supported. Awaiting RFE 6924287 7.111 +### 6924287: Jck4Jdk: Allow to configure test group size for group mode via simple command line option 7.112 +### JCK_RUNTIME_OPTIONS += \ 7.113 +### -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) 7.114 +endif 7.115 + 7.116 +# Assertions: some tests show failures when assertions are enabled. 7.117 +# Since javac is typically loaded via the bootclassloader (either via TESTJAVA 7.118 +# or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac. 7.119 +JTREG_OPTIONS += $(ASSERTION_OPTIONS) 7.120 +JCK_OPTIONS += $(ASSERTION_OPTIONS:%=-vmoptions:%) 7.121 + 7.122 +# Include shared options 7.123 +JCK_COMPILER_OPTIONS += $(JCK_OPTIONS) 7.124 +JCK_RUNTIME_OPTIONS += $(JCK_OPTIONS) 7.125 + 7.126 +# Exit codes: 7.127 +# jtreg, jck: 0: OK, 1: tests failed, 2: tests error; 3+: SERIOUS 7.128 +FATAL_JTREG_EXIT = 3 7.129 +FATAL_JCK_EXIT = 3 7.130 +# jtdiff: 0: OK, 1: differences found; 2+: SERIOUS 7.131 +FATAL_JTDIFF_EXIT = 2 7.132 +# 7.133 +# Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid 7.134 +# having make exit with non-zero return code. 7.135 +EXIT = exit 7.136 +# Function to exit shell if exit code of preceding command is greater than or equal 7.137 +# to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed. 7.138 +EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi 7.139 7.140 # The test directories to run 7.141 DEFAULT_TESTDIRS = . 7.142 TESTDIRS = $(DEFAULT_TESTDIRS) 7.143 7.144 # Root of all test results 7.145 -TEST_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH) 7.146 +TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools 7.147 +ABS_TEST_OUTPUT_DIR := \ 7.148 + $(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ 7.149 + cd $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ 7.150 + pwd ) 7.151 +# Subdirectories for different test runs 7.152 +JTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg 7.153 +JCK_COMPILER_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-compiler 7.154 +JCK_RUNTIME_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-runtime-Xcompile 7.155 7.156 -# Default make rule 7.157 -all apt javac javadoc javah javap: clean check jtreg-tests $(JPRT_ARCHIVE_BUNDLE) 7.158 +# Default make rule -- warning, may take a while 7.159 +all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary 7.160 + @echo "Testing completed successfully" 7.161 + 7.162 +jtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary 7.163 + @echo "Testing completed successfully" 7.164 + 7.165 +jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary 7.166 + @echo "Testing completed successfully" 7.167 + 7.168 +jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary 7.169 @echo "Testing completed successfully" 7.170 7.171 # for use with JPRT -testrule 7.172 -all: TESTDIRS = . 7.173 -apt: TESTDIRS = tools/apt 7.174 -javac: TESTDIRS = tools/javac 7.175 -javadoc: TESTDIRS = tools/javadoc com/sun/javadoc 7.176 -javah: TESTDIRS = tools/javah 7.177 -javap: TESTDIRS = tools/javap 7.178 +all: JTREG_TESTDIRS = . 7.179 +jtreg: JTREG_TESTDIRS = . 7.180 +apt: JTREG_TESTDIRS = tools/apt 7.181 +javac: JTREG_TESTDIRS = tools/javac 7.182 +javadoc: JTREG_TESTDIRS = tools/javadoc com/sun/javadoc 7.183 +javah: JTREG_TESTDIRS = tools/javah 7.184 +javap: JTREG_TESTDIRS = tools/javap 7.185 + 7.186 +# Run jtreg tests 7.187 +# 7.188 +# JTREG_HOME 7.189 +# Installed location of jtreg 7.190 +# JT_JAVA 7.191 +# Version of java used to run jtreg. Should normally be the same as TESTJAVA 7.192 +# TESTJAVA 7.193 +# Version of java to be tested. 7.194 +# JTREG_OPTIONS 7.195 +# Additional options for jtreg 7.196 +# JTREG_TESTDIRS 7.197 +# Directories of tests to be run 7.198 +# JTREG_OUTPUT_DIR 7.199 +# Where to write the results 7.200 +# JTREG_REFERENCE 7.201 +# (Optional) reference results (e.g. work, report or summary.txt) 7.202 +# 7.203 +jtreg-tests: check-jtreg FRC 7.204 + @rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \ 7.205 + $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt 7.206 + @mkdir -p $(JTREG_OUTPUT_DIR) 7.207 + JT_JAVA=$(JT_JAVA) $(JTREG) \ 7.208 + -J-Xmx512m \ 7.209 + -a -samevm -ignore:quiet -v:fail,error,nopass \ 7.210 + -r:$(JTREG_OUTPUT_DIR)/JTreport \ 7.211 + -w:$(JTREG_OUTPUT_DIR)/JTwork \ 7.212 + -jdk:$(TESTJAVA) \ 7.213 + $(JAVA_ARGS:%=-vmoption:%) \ 7.214 + $(JTREG_OPTIONS) \ 7.215 + $(JTREG_TESTDIRS) \ 7.216 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \ 7.217 + echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \ 7.218 + ) 7.219 +ifdef JTREG_REFERENCE 7.220 + JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JTREG_OUTPUT_DIR)/diff.html \ 7.221 + $(JTREG_REFERENCE) $(JTREG_OUTPUT_DIR)/JTreport \ 7.222 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) 7.223 +endif 7.224 + 7.225 +jtreg-summary: FRC 7.226 + if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \ 7.227 + echo ; echo "Summary of jtreg test failures" ; \ 7.228 + cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \ 7.229 + grep -v 'Not run' | grep -v 'Passed' ; \ 7.230 + echo ; \ 7.231 + $(EXIT) `cat $(JTREG_OUTPUT_DIR)/status.txt` ; \ 7.232 + fi 7.233 7.234 # Check to make sure these directories exist 7.235 -check: $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 7.236 +check-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 7.237 7.238 -# Run the tests 7.239 -jtreg-tests: FRC 7.240 - @echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)" 7.241 - @rm -f -r $(TEST_OUTPUT_DIR)/JTwork $(TEST_OUTPUT_DIR)/JTreport 7.242 - @mkdir -p $(TEST_OUTPUT_DIR) 7.243 - JT_JAVA=$(JT_JAVA) $(JTREG) \ 7.244 - -a -samevm -k:\!ignore -v:fail,error,nopass \ 7.245 - -r:$(TEST_OUTPUT_DIR)/JTreport \ 7.246 - -w:$(TEST_OUTPUT_DIR)/JTwork \ 7.247 - -jdk:$(TESTJAVA) \ 7.248 - -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \ 7.249 - $(JAVA_ARGS:%=-vmoption:%) \ 7.250 - $(TESTDIRS) \ 7.251 - || ( status=$$? ; \ 7.252 - echo ; echo "Summary of test failures" ; \ 7.253 - cat $(TEST_OUTPUT_DIR)/JTreport/text/summary.txt | \ 7.254 - grep -v 'Not run' | grep -v 'Passed' ; \ 7.255 - echo ; \ 7.256 - exit $$status ) 7.257 + 7.258 +# Run JCK-compiler tests 7.259 +# 7.260 +# JCK_HOME 7.261 +# Installed location of JCK: should include JCK-compiler, and JCK-extras 7.262 +# JT_JAVA 7.263 +# Version of java used to run JCK. Should normally be the same as TESTJAVA 7.264 +# TESTJAVA 7.265 +# Version of java to be tested. 7.266 +# JCK_COMPILER_OPTIONS 7.267 +# Additional options for JCK-compiler 7.268 +# JCK_COMPILER_TESTDIRS 7.269 +# Directories of tests to be run 7.270 +# JCK_COMPILER_OUTPUT_DIR 7.271 +# Where to write the results 7.272 +# JCK_COMPILER_REFERENCE 7.273 +# (Optional) reference results (e.g. work, report or summary.txt) 7.274 +# 7.275 +jck-compiler-tests: check-jck FRC 7.276 + @rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \ 7.277 + $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt 7.278 + @mkdir -p $(JCK_COMPILER_OUTPUT_DIR) 7.279 + $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ 7.280 + -jar $(JCK_HOME)/JCK-compiler-7/lib/jtjck.jar \ 7.281 + -v:non-pass \ 7.282 + -r:$(JCK_COMPILER_OUTPUT_DIR)/report \ 7.283 + -w:$(JCK_COMPILER_OUTPUT_DIR)/work \ 7.284 + -jdk:$(TESTJAVA) \ 7.285 + $(JCK_COMPILER_OPTIONS) \ 7.286 + $(JCK_COMPILER_TESTDIRS) \ 7.287 + || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \ 7.288 + echo $$status > $(JCK_COMPILER_OUTPUT_DIR)/status.txt \ 7.289 + ) 7.290 +ifdef JCK_COMPILER_REFERENCE 7.291 + JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_COMPILER_OUTPUT_DIR)/diff.html \ 7.292 + $(JCK_COMPILER_REFERENCE) $(JCK_COMPILER_OUTPUT_DIR)/report \ 7.293 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) 7.294 +endif 7.295 + 7.296 +jck-compiler-summary: FRC 7.297 + if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \ 7.298 + echo ; echo "Summary of JCK-compiler test failures" ; \ 7.299 + cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \ 7.300 + grep -v 'Not run' | grep -v 'Passed' ; \ 7.301 + echo ; \ 7.302 + $(EXIT) `cat $(JCK_COMPILER_OUTPUT_DIR)/status.txt` ; \ 7.303 + fi 7.304 + 7.305 +# Run JCK-runtime tests in -Xcompile mode 7.306 +# This is a special mode to test javac by compiling the tests in the JCK-runtime test suite 7.307 +# Normal JCK-runtime invocation belongs in the jdk/ repository. 7.308 +# 7.309 +# JCK_HOME 7.310 +# Installed location of JCK: should include JCK-compiler, JCK-runtime and JCK-extras 7.311 +# JT_JAVA 7.312 +# Version of java used to run JCK. Should normally be the same as TESTJAVA 7.313 +# TESTJAVA 7.314 +# Version of java to be tested. 7.315 +# JCK_RUNTIME_OPTIONS 7.316 +# Additional options for JCK-runtime 7.317 +# JCK_RUNTIME_TESTDIRS 7.318 +# Directories of tests to be run 7.319 +# JCK_RUNTIME_OUTPUT_DIR 7.320 +# Where to write the results 7.321 +# JCK_RUNTIME_REFERENCE 7.322 +# (Optional) reference results (e.g. work, report or summary.txt) 7.323 +# 7.324 +jck-runtime-tests: check-jck FRC 7.325 + @rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \ 7.326 + $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt 7.327 + @mkdir -p $(JCK_RUNTIME_OUTPUT_DIR) 7.328 + $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ 7.329 + -jar $(JCK_HOME)/JCK-runtime-7/lib/jtjck.jar \ 7.330 + -v:non-pass \ 7.331 + -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \ 7.332 + -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \ 7.333 + -jdk:$(TESTJAVA) \ 7.334 + -Xcompile \ 7.335 + $(JCK_RUNTIME_OPTIONS) \ 7.336 + $(JCK_RUNTIME_TESTDIRS) \ 7.337 + || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \ 7.338 + echo $$status > $(JCK_RUNTIME_OUTPUT_DIR)/status.txt \ 7.339 + ) 7.340 +ifdef JCK_RUNTIME_REFERENCE 7.341 + JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_RUNTIME_OUTPUT_DIR)/diff.html \ 7.342 + $(JCK_RUNTIME_REFERENCE) $(JCK_RUNTIME_OUTPUT_DIR)/report \ 7.343 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) 7.344 +endif 7.345 + 7.346 +jck-runtime-summary: FRC 7.347 + if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \ 7.348 + echo ; echo "Summary of JCK-runtime test failures" ; \ 7.349 + cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \ 7.350 + grep -v 'Not run' | grep -v 'Passed' ; \ 7.351 + echo ; \ 7.352 + $(EXIT) `cat $(JCK_RUNTIME_OUTPUT_DIR)/status.txt` ; \ 7.353 + fi 7.354 + 7.355 +# Check to make sure these directories exist 7.356 +check-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME) 7.357 + 7.358 +all-summary: FRC 7.359 + if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then 7.360 + echo ; echo "Summary of test failures" ; \ 7.361 + cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \ 7.362 + grep -v 'Not run' | grep -v 'Passed' ; \ 7.363 + echo ; \ 7.364 + $(EXIT) 1 7.365 + fi 7.366 7.367 # Bundle up the results 7.368 $(JPRT_ARCHIVE_BUNDLE): FRC 7.369 @@ -124,12 +380,17 @@ 7.370 7.371 # Cleanup 7.372 clean: 7.373 - rm -f -r $(TEST_OUTPUT_DIR) 7.374 rm -f $(JPRT_ARCHIVE_BUNDLE) 7.375 7.376 # Used to force a target rules to run 7.377 FRC: 7.378 7.379 # Phony targets (e.g. these are not filenames) 7.380 -.PHONY: all tests clean check 7.381 +.PHONY: all clean \ 7.382 + jtreg javac javadoc javah javap jtreg-tests jtreg-summary check-jtreg \ 7.383 + jck-compiler jck-compiler-tests jck-compiler-summary \ 7.384 + jck-runtime jck-runtime-tests jck-runtime-summary check-jck 7.385 7.386 +# No use of suffix rules 7.387 +.SUFFIXES: 7.388 +
8.1 --- a/test/tools/javac/OverrideChecks/6738538/T6738538a.java Sun Apr 11 23:24:24 2010 -0700 8.2 +++ b/test/tools/javac/OverrideChecks/6738538/T6738538a.java Tue Apr 20 01:30:04 2010 -0700 8.3 @@ -41,4 +41,4 @@ 8.4 public T m(); 8.5 } 8.6 class Crash<T extends C<?> & I> {} 8.7 -} 8.8 \ No newline at end of file 8.9 +}
9.1 --- a/test/tools/javac/OverrideChecks/6738538/T6738538b.java Sun Apr 11 23:24:24 2010 -0700 9.2 +++ b/test/tools/javac/OverrideChecks/6738538/T6738538b.java Tue Apr 20 01:30:04 2010 -0700 9.3 @@ -44,4 +44,4 @@ 9.4 } 9.5 9.6 class C2<T extends C1<?> & I2> {} 9.7 -} 9.8 \ No newline at end of file 9.9 +}
10.1 --- a/test/tools/javac/api/6731573/Erroneous.java Sun Apr 11 23:24:24 2010 -0700 10.2 +++ b/test/tools/javac/api/6731573/Erroneous.java Tue Apr 20 01:30:04 2010 -0700 10.3 @@ -1,4 +1,4 @@ 10.4 class A { 10.5 boolean b; 10.6 boolean b; 10.7 -} 10.8 \ No newline at end of file 10.9 +}
11.1 --- a/test/tools/javac/api/6731573/T6731573.java Sun Apr 11 23:24:24 2010 -0700 11.2 +++ b/test/tools/javac/api/6731573/T6731573.java Tue Apr 20 01:30:04 2010 -0700 11.3 @@ -106,4 +106,4 @@ 11.4 public static void main(String... args) throws Exception { 11.5 new T6731573().test(); 11.6 } 11.7 -} 11.8 \ No newline at end of file 11.9 +}
12.1 --- a/test/tools/javac/cast/6548436/T6548436d.java Sun Apr 11 23:24:24 2010 -0700 12.2 +++ b/test/tools/javac/cast/6548436/T6548436d.java Tue Apr 20 01:30:04 2010 -0700 12.3 @@ -37,4 +37,4 @@ 12.4 static void test(Base<? extends Double> je) { 12.5 Object o = (Base<Integer>)je; 12.6 } 12.7 -} 12.8 \ No newline at end of file 12.9 +}
13.1 --- a/test/tools/javac/cast/6558559/T6558559a.java Sun Apr 11 23:24:24 2010 -0700 13.2 +++ b/test/tools/javac/cast/6558559/T6558559a.java Tue Apr 20 01:30:04 2010 -0700 13.3 @@ -37,4 +37,4 @@ 13.4 13.5 A<?> x = null; 13.6 B<?> y = (B<?>)x; 13.7 -} 13.8 \ No newline at end of file 13.9 +}
14.1 --- a/test/tools/javac/cast/6558559/T6558559b.java Sun Apr 11 23:24:24 2010 -0700 14.2 +++ b/test/tools/javac/cast/6558559/T6558559b.java Tue Apr 20 01:30:04 2010 -0700 14.3 @@ -40,4 +40,4 @@ 14.4 Object o = unboundList; 14.5 Throwable t3 = (Throwable) o; 14.6 } 14.7 -} 14.8 \ No newline at end of file 14.9 +}
15.1 --- a/test/tools/javac/cast/6586091/T6586091.java Sun Apr 11 23:24:24 2010 -0700 15.2 +++ b/test/tools/javac/cast/6586091/T6586091.java Tue Apr 20 01:30:04 2010 -0700 15.3 @@ -35,4 +35,4 @@ 15.4 15.5 A<A<?>> t = null; 15.6 B c = (B)t; 15.7 -} 15.8 \ No newline at end of file 15.9 +}
16.1 --- a/test/tools/javac/enum/T6724345.java Sun Apr 11 23:24:24 2010 -0700 16.2 +++ b/test/tools/javac/enum/T6724345.java Tue Apr 20 01:30:04 2010 -0700 16.3 @@ -48,4 +48,4 @@ 16.4 enum E implements I { 16.5 V {public void i() {}}; 16.6 } 16.7 -} 16.8 \ No newline at end of file 16.9 +}
17.1 --- a/test/tools/javac/generics/T6557954.java Sun Apr 11 23:24:24 2010 -0700 17.2 +++ b/test/tools/javac/generics/T6557954.java Tue Apr 20 01:30:04 2010 -0700 17.3 @@ -33,4 +33,4 @@ 17.4 class T6557954<T> { 17.5 class Foo<U extends T> {} 17.6 T6557954<Number>.Foo<Integer> f; 17.7 -} 17.8 \ No newline at end of file 17.9 +}
18.1 --- a/test/tools/javac/generics/T6751514.java Sun Apr 11 23:24:24 2010 -0700 18.2 +++ b/test/tools/javac/generics/T6751514.java Tue Apr 20 01:30:04 2010 -0700 18.3 @@ -79,4 +79,4 @@ 18.4 " - found: " + found + ")"); 18.5 } 18.6 } 18.7 -} 18.8 \ No newline at end of file 18.9 +}
19.1 --- a/test/tools/javac/generics/T6869075.java Sun Apr 11 23:24:24 2010 -0700 19.2 +++ b/test/tools/javac/generics/T6869075.java Tue Apr 20 01:30:04 2010 -0700 19.3 @@ -64,4 +64,4 @@ 19.4 " - found: " + found + ")"); 19.5 } 19.6 } 19.7 -} 19.8 \ No newline at end of file 19.9 +}
20.1 --- a/test/tools/javac/generics/inference/6569789/T6569789.java Sun Apr 11 23:24:24 2010 -0700 20.2 +++ b/test/tools/javac/generics/inference/6569789/T6569789.java Tue Apr 20 01:30:04 2010 -0700 20.3 @@ -41,4 +41,4 @@ 20.4 } 20.5 20.6 static <W extends C & I & I1 & I2, T extends W> void testMethod(T t) {} 20.7 -} 20.8 \ No newline at end of file 20.9 +}
21.1 --- a/test/tools/javac/generics/inference/6650759/T6650759a.java Sun Apr 11 23:24:24 2010 -0700 21.2 +++ b/test/tools/javac/generics/inference/6650759/T6650759a.java Tue Apr 20 01:30:04 2010 -0700 21.3 @@ -42,4 +42,4 @@ 21.4 Integer test = getGenericValue(new IntegerInterface()); 21.5 testSet(getGenericValue(new IntegerInterface())); 21.6 } 21.7 -} 21.8 \ No newline at end of file 21.9 +}
22.1 --- a/test/tools/javac/generics/wildcards/T6732484.java Sun Apr 11 23:24:24 2010 -0700 22.2 +++ b/test/tools/javac/generics/wildcards/T6732484.java Tue Apr 20 01:30:04 2010 -0700 22.3 @@ -34,4 +34,4 @@ 22.4 class B extends A<B> {} 22.5 22.6 A<? super B> f; 22.7 -} 22.8 \ No newline at end of file 22.9 +}
23.1 --- a/test/tools/javac/processing/model/util/elements/Foo.java Sun Apr 11 23:24:24 2010 -0700 23.2 +++ b/test/tools/javac/processing/model/util/elements/Foo.java Tue Apr 20 01:30:04 2010 -0700 23.3 @@ -26,4 +26,4 @@ 23.4 * Dummy type to compile. 23.5 */ 23.6 public class Foo { 23.7 -} 23.8 \ No newline at end of file 23.9 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/test/tools/javac/processing/model/util/elements/VacuousEnum.java Tue Apr 20 01:30:04 2010 -0700 24.3 @@ -0,0 +1,33 @@ 24.4 +/* 24.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. 24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 + * 24.8 + * This code is free software; you can redistribute it and/or modify it 24.9 + * under the terms of the GNU General Public License version 2 only, as 24.10 + * published by the Free Software Foundation. 24.11 + * 24.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 24.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.15 + * version 2 for more details (a copy is included in the LICENSE file that 24.16 + * accompanied this code). 24.17 + * 24.18 + * You should have received a copy of the GNU General Public License version 24.19 + * 2 along with this work; if not, write to the Free Software Foundation, 24.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.21 + * 24.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 24.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 24.24 + * have any questions. 24.25 + */ 24.26 + 24.27 +/* 24.28 + * @test 24.29 + * @bug 6937417 24.30 + * @summary Test -Xprint on enum type with no constants 24.31 + * @author Joseph D. Darcy 24.32 + * @compile -Xprint VacuousEnum.java 24.33 + */ 24.34 +public enum VacuousEnum { 24.35 + // But alas, no enum constants! 24.36 +}
25.1 --- a/test/tools/javac/varargs/T6746184.java Sun Apr 11 23:24:24 2010 -0700 25.2 +++ b/test/tools/javac/varargs/T6746184.java Tue Apr 20 01:30:04 2010 -0700 25.3 @@ -36,4 +36,4 @@ 25.4 class A { 25.5 public static void m(final Object... varargs) {} 25.6 private static void m(final Object singleArg) {} 25.7 -} 25.8 \ No newline at end of file 25.9 +}
26.1 --- a/test/tools/javah/T6893943.java Sun Apr 11 23:24:24 2010 -0700 26.2 +++ b/test/tools/javah/T6893943.java Tue Apr 20 01:30:04 2010 -0700 26.3 @@ -23,7 +23,7 @@ 26.4 26.5 /* 26.6 * @test 26.7 - * @bug 6893943 26.8 + * @bug 6893943 6937318 26.9 * @summary exit code from javah with no args is 0 26.10 */ 26.11 26.12 @@ -31,22 +31,32 @@ 26.13 import java.util.*; 26.14 26.15 public class T6893943 { 26.16 + static final String[] NO_ARGS = { }; 26.17 + static final String[] HELP = { "-help" }; 26.18 + static final String NEWLINE = System.getProperty("line.separator"); 26.19 + 26.20 public static void main(String... args) throws Exception { 26.21 new T6893943().run(); 26.22 } 26.23 26.24 void run() throws Exception { 26.25 - testSimpleAPI(); 26.26 - testCommand(); 26.27 + testSimpleAPI(NO_ARGS, 1); 26.28 + testSimpleAPI(HELP, 0); 26.29 + testCommand(NO_ARGS, 1); 26.30 + testCommand(HELP, 0); 26.31 } 26.32 26.33 - void testSimpleAPI() throws Exception { 26.34 - PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.err)); 26.35 - int rc = com.sun.tools.javah.Main.run(new String[] { }, pw); 26.36 - expect("testSimpleAPI", rc, 1); 26.37 + void testSimpleAPI(String[] args, int expect_rc) throws Exception { 26.38 + System.err.println("Test simple api: " + Arrays.asList(args)); 26.39 + StringWriter sw = new StringWriter(); 26.40 + PrintWriter pw = new PrintWriter(sw); 26.41 + int rc = com.sun.tools.javah.Main.run(args, pw); 26.42 + pw.close(); 26.43 + expect("testSimpleAPI", sw.toString(), rc, expect_rc); 26.44 } 26.45 26.46 - void testCommand() throws Exception { 26.47 + void testCommand(String[] args, int expect_rc) throws Exception { 26.48 + System.err.println("Test command: " + Arrays.asList(args)); 26.49 File javaHome = new File(System.getProperty("java.home")); 26.50 if (javaHome.getName().equals("jre")) 26.51 javaHome = javaHome.getParentFile(); 26.52 @@ -54,22 +64,32 @@ 26.53 List<String> command = new ArrayList<String>(); 26.54 command.add(new File(new File(javaHome, "bin"), "javah").getPath()); 26.55 command.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path")); 26.56 + command.addAll(Arrays.asList(args)); 26.57 //System.err.println("command: " + command); 26.58 26.59 ProcessBuilder pb = new ProcessBuilder(command); 26.60 pb.redirectErrorStream(true); 26.61 Process p = pb.start(); 26.62 p.getOutputStream().close(); 26.63 + StringWriter sw = new StringWriter(); 26.64 String line; 26.65 BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 26.66 while ((line = in.readLine()) != null) 26.67 - System.err.println("javah: " + line); 26.68 + sw.write(line + NEWLINE); 26.69 int rc = p.waitFor(); 26.70 - expect("testCommand", rc, 1); 26.71 + expect("testCommand", sw.toString(), rc, expect_rc); 26.72 } 26.73 26.74 - void expect(String name, int actual, int expect) throws Exception { 26.75 - if (actual != expect) 26.76 - throw new Exception(name + ": unexpected exit: " + actual + ", expected: " + expect); 26.77 + void expect(String name, String out, int actual_rc, int expect_rc) throws Exception { 26.78 + if (out.isEmpty()) 26.79 + throw new Exception("No output from javah"); 26.80 + 26.81 + if (!out.startsWith("Usage:")) { 26.82 + System.err.println(out); 26.83 + throw new Exception("Unexpected output from javah"); 26.84 + } 26.85 + 26.86 + if (actual_rc != expect_rc) 26.87 + throw new Exception(name + ": unexpected exit: " + actual_rc + ", expected: " + expect_rc); 26.88 } 26.89 }
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/tools/javap/6937244/T6937244.java Tue Apr 20 01:30:04 2010 -0700 27.3 @@ -0,0 +1,57 @@ 27.4 +/* 27.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. 27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.7 + * 27.8 + * This code is free software; you can redistribute it and/or modify it 27.9 + * under the terms of the GNU General Public License version 2 only, as 27.10 + * published by the Free Software Foundation. 27.11 + * 27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.15 + * version 2 for more details (a copy is included in the LICENSE file that 27.16 + * accompanied this code). 27.17 + * 27.18 + * You should have received a copy of the GNU General Public License version 27.19 + * 2 along with this work; if not, write to the Free Software Foundation, 27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.21 + * 27.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 27.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 27.24 + * have any questions. 27.25 + */ 27.26 + 27.27 +/* 27.28 + * @test 27.29 + * @bug 6937244 27.30 + * @summary fields display with JVMS names, not Java names 27.31 + */ 27.32 + 27.33 +import java.io.*; 27.34 + 27.35 +public class T6937244 { 27.36 + public static void main(String[] args) throws Exception { 27.37 + new T6937244().run(); 27.38 + } 27.39 + 27.40 + void run() throws Exception { 27.41 + StringWriter sw = new StringWriter(); 27.42 + PrintWriter pw = new PrintWriter(sw); 27.43 + String[] args = { "java.lang.String" }; 27.44 + int rc = com.sun.tools.javap.Main.run(args, pw); 27.45 + pw.close(); 27.46 + String out = sw.toString(); 27.47 + System.err.println(out); 27.48 + if (rc != 0) 27.49 + throw new Exception("unexpected exit from javap: " + rc); 27.50 + for (String line: out.split("[\r\n]+")) { 27.51 + if (line.contains("CASE_INSENSITIVE_ORDER")) { 27.52 + if (line.matches("\\s*\\Qpublic static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;\\E\\s*")) 27.53 + return; 27.54 + throw new Exception("declaration not shown as expected"); 27.55 + } 27.56 + } 27.57 + throw new Exception("declaration of CASE_INSENSITIVE_ORDER not found"); 27.58 + } 27.59 +} 27.60 +
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/test/tools/javap/6937244/T6937244A.java Tue Apr 20 01:30:04 2010 -0700 28.3 @@ -0,0 +1,90 @@ 28.4 +/* 28.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. 28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.7 + * 28.8 + * This code is free software; you can redistribute it and/or modify it 28.9 + * under the terms of the GNU General Public License version 2 only, as 28.10 + * published by the Free Software Foundation. 28.11 + * 28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 28.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28.15 + * version 2 for more details (a copy is included in the LICENSE file that 28.16 + * accompanied this code). 28.17 + * 28.18 + * You should have received a copy of the GNU General Public License version 28.19 + * 2 along with this work; if not, write to the Free Software Foundation, 28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28.21 + * 28.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 28.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 28.24 + * have any questions. 28.25 + */ 28.26 + 28.27 +/* 28.28 + * @test 28.29 + * @bug 6937244 28.30 + * @summary fields display with JVMS names, not Java names 28.31 + */ 28.32 + 28.33 +import java.io.*; 28.34 +import java.util.*; 28.35 + 28.36 +public class T6937244A { 28.37 + public static void main(String[] args) throws Exception { 28.38 + new T6937244A().run(); 28.39 + } 28.40 + 28.41 + void run() throws Exception { 28.42 + StringWriter sw = new StringWriter(); 28.43 + PrintWriter pw = new PrintWriter(sw); 28.44 + String[] args = { "Test" }; 28.45 + int rc = com.sun.tools.javap.Main.run(args, pw); 28.46 + pw.close(); 28.47 + String out = sw.toString(); 28.48 + System.err.println(out); 28.49 + if (rc != 0) 28.50 + throw new Exception("unexpected exit from javap: " + rc); 28.51 + 28.52 + int count = 0; 28.53 + 28.54 + for (String line: out.split("[\r\n]+")) { 28.55 + if (line.contains("extends")) { 28.56 + verify(line, "extends java.lang.Object implements java.util.List<java.lang.String>"); 28.57 + count++; 28.58 + } 28.59 + 28.60 + if (line.contains("field")) { 28.61 + verify(line, "java.util.List<java.lang.String> field"); 28.62 + count++; 28.63 + } 28.64 + 28.65 + if (line.contains("method")) { 28.66 + verify(line, "java.util.List<java.lang.String> method(java.util.List<java.lang.String>) throws java.lang.Exception"); 28.67 + count++; 28.68 + } 28.69 + } 28.70 + 28.71 + // final backstop check 28.72 + if (out.contains("/")) 28.73 + throw new Exception("unexpected \"/\" in output"); 28.74 + 28.75 + if (count != 3) 28.76 + throw new Exception("wrong number of matches found: " + count); 28.77 + } 28.78 + 28.79 + void verify(String line, String expect) throws Exception { 28.80 + if (!line.contains(expect)) { 28.81 + System.err.println("line: " + line); 28.82 + System.err.println("expect: " + expect); 28.83 + throw new Exception("expected string not found in line"); 28.84 + } 28.85 + } 28.86 +} 28.87 + 28.88 + 28.89 +abstract class Test implements List<String> { 28.90 + public List<String> field; 28.91 + public List<String> method(List<String> arg) throws Exception { return null; } 28.92 +} 28.93 +
29.1 --- a/test/tools/javap/T6715251.java Sun Apr 11 23:24:24 2010 -0700 29.2 +++ b/test/tools/javap/T6715251.java Tue Apr 20 01:30:04 2010 -0700 29.3 @@ -71,4 +71,4 @@ 29.4 29.5 String log; 29.6 int errors; 29.7 -} 29.8 \ No newline at end of file 29.9 +}
30.1 --- a/test/tools/javap/T6715753.java Sun Apr 11 23:24:24 2010 -0700 30.2 +++ b/test/tools/javap/T6715753.java Tue Apr 20 01:30:04 2010 -0700 30.3 @@ -47,4 +47,4 @@ 30.4 throw new Exception("test failed"); 30.5 } 30.6 } 30.7 -} 30.8 \ No newline at end of file 30.9 +}