Tue, 13 Apr 2010 16:42:58 -0700
Merge
test/tools/javap/T6305779.java | file | annotate | diff | comparison | revisions |
1.1 --- a/make/Makefile Thu Apr 08 17:03:01 2010 -0700 1.2 +++ b/make/Makefile Tue Apr 13 16:42:58 2010 -0700 1.3 @@ -188,10 +188,16 @@ 1.4 # All ant targets of interest 1.5 ANT_TARGETS = build clean sanity post-sanity diagnostics # for now 1.6 1.7 +# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1) 1.8 +$(OUTPUTDIR)/build/ant-diagnostics.log: 1.9 + @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) 1.10 + @$(RM) $@ 1.11 + $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \ 1.12 + $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@ 1.13 + 1.14 # Create a make target for each 1.15 -$(ANT_TARGETS): 1.16 +$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log 1.17 @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) 1.18 - $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $(OUTPUTDIR)/build/ant-diagnostics.log 1.19 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@ 1.20 1.21 #-------------------------------------------------------------------
2.1 --- a/make/jprt.properties Thu Apr 08 17:03:01 2010 -0700 2.2 +++ b/make/jprt.properties Tue Apr 13 16:42:58 2010 -0700 2.3 @@ -50,6 +50,5 @@ 2.4 jprt.test.targets= 2.5 2.6 # Directories needed to build 2.7 -jprt.bundle.src.dirs=make src 2.8 jprt.bundle.exclude.src.dirs=build dist 2.9
3.1 --- a/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Thu Apr 08 17:03:01 2010 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Tue Apr 13 16:42:58 2010 -0700 3.3 @@ -229,23 +229,24 @@ 3.4 if (kind == ENUM) { 3.5 List<Element> enclosedElements = 3.6 new ArrayList<Element>(e.getEnclosedElements()); 3.7 + // Handle any enum constants specially before other entities. 3.8 List<Element> enumConstants = new ArrayList<Element>(); 3.9 for(Element element : enclosedElements) { 3.10 if (element.getKind() == ENUM_CONSTANT) 3.11 enumConstants.add(element); 3.12 } 3.13 + if (!enumConstants.isEmpty()) { 3.14 + int i; 3.15 + for(i = 0; i < enumConstants.size()-1; i++) { 3.16 + this.visit(enumConstants.get(i), true); 3.17 + writer.print(","); 3.18 + } 3.19 + this.visit(enumConstants.get(i), true); 3.20 + writer.println(";\n"); 3.21 3.22 - int i; 3.23 - for(i = 0; i < enumConstants.size()-1; i++) { 3.24 - this.visit(enumConstants.get(i), true); 3.25 - writer.print(","); 3.26 - } 3.27 - if (i >= 0 ) { 3.28 - this.visit(enumConstants.get(i), true); 3.29 - writer.print(";"); 3.30 + enclosedElements.removeAll(enumConstants); 3.31 } 3.32 3.33 - enclosedElements.removeAll(enumConstants); 3.34 for(Element element : enclosedElements) 3.35 this.visit(element); 3.36 } else {
4.1 --- a/src/share/classes/com/sun/tools/javah/JavahTask.java Thu Apr 08 17:03:01 2010 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javah/JavahTask.java Tue Apr 13 16:42:58 2010 -0700 4.3 @@ -318,12 +318,6 @@ 4.4 int run(String[] args) { 4.5 try { 4.6 handleOptions(args); 4.7 - if (classes == null || classes.size() == 0) { 4.8 - if (help || version || fullVersion) 4.9 - return 0; 4.10 - else 4.11 - return 1; 4.12 - } 4.13 boolean ok = run(); 4.14 return ok ? 0 : 1; 4.15 } catch (BadArgs e) { 4.16 @@ -355,7 +349,7 @@ 4.17 fileManager = getDefaultFileManager(diagnosticListener, log); 4.18 4.19 Iterator<String> iter = args.iterator(); 4.20 - boolean noArgs = !iter.hasNext(); 4.21 + noArgs = !iter.hasNext(); 4.22 4.23 while (iter.hasNext()) { 4.24 String arg = iter.next(); 4.25 @@ -416,9 +410,9 @@ 4.26 4.27 Util util = new Util(log, diagnosticListener); 4.28 4.29 - if (help) { 4.30 + if (noArgs || help) { 4.31 showHelp(); 4.32 - return true; 4.33 + return help; // treat noArgs as an error for purposes of exit code 4.34 } 4.35 4.36 if (version || fullVersion) { 4.37 @@ -636,6 +630,7 @@ 4.38 String usercp; 4.39 List<String> classes; 4.40 boolean verbose; 4.41 + boolean noArgs; 4.42 boolean help; 4.43 boolean trace; 4.44 boolean version;
5.1 --- a/src/share/classes/com/sun/tools/javap/ClassWriter.java Thu Apr 08 17:03:01 2010 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javap/ClassWriter.java Tue Apr 13 16:42:58 2010 -0700 5.3 @@ -225,15 +225,15 @@ 5.4 writeModifiers(flags.getFieldModifiers()); 5.5 Signature_attribute sigAttr = getSignature(f.attributes); 5.6 if (sigAttr == null) 5.7 - print(getFieldType(f.descriptor)); 5.8 + print(getJavaFieldType(f.descriptor)); 5.9 else { 5.10 try { 5.11 Type t = sigAttr.getParsedSignature().getType(constant_pool); 5.12 - print(t); 5.13 + print(getJavaName(t.toString())); 5.14 } catch (ConstantPoolException e) { 5.15 // report error? 5.16 // fall back on non-generic descriptor 5.17 - print(getFieldType(f.descriptor)); 5.18 + print(getJavaFieldType(f.descriptor)); 5.19 } 5.20 } 5.21 print(" "); 5.22 @@ -314,14 +314,14 @@ 5.23 } 5.24 if (getName(m).equals("<init>")) { 5.25 print(getJavaName(classFile)); 5.26 - print(getParameterTypes(d, flags)); 5.27 + print(getJavaParameterTypes(d, flags)); 5.28 } else if (getName(m).equals("<clinit>")) { 5.29 print("{}"); 5.30 } else { 5.31 - print(getReturnType(d)); 5.32 + print(getJavaReturnType(d)); 5.33 print(" "); 5.34 print(getName(m)); 5.35 - print(getParameterTypes(d, flags)); 5.36 + print(getJavaParameterTypes(d, flags)); 5.37 } 5.38 5.39 Attribute e_attr = m.attributes.get(Attribute.Exceptions); 5.40 @@ -460,9 +460,9 @@ 5.41 } 5.42 } 5.43 5.44 - String getFieldType(Descriptor d) { 5.45 + String getJavaFieldType(Descriptor d) { 5.46 try { 5.47 - return d.getFieldType(constant_pool); 5.48 + return getJavaName(d.getFieldType(constant_pool)); 5.49 } catch (ConstantPoolException e) { 5.50 return report(e); 5.51 } catch (DescriptorException e) { 5.52 @@ -470,9 +470,9 @@ 5.53 } 5.54 } 5.55 5.56 - String getReturnType(Descriptor d) { 5.57 + String getJavaReturnType(Descriptor d) { 5.58 try { 5.59 - return d.getReturnType(constant_pool); 5.60 + return getJavaName(d.getReturnType(constant_pool)); 5.61 } catch (ConstantPoolException e) { 5.62 return report(e); 5.63 } catch (DescriptorException e) { 5.64 @@ -480,9 +480,9 @@ 5.65 } 5.66 } 5.67 5.68 - String getParameterTypes(Descriptor d, AccessFlags flags) { 5.69 + String getJavaParameterTypes(Descriptor d, AccessFlags flags) { 5.70 try { 5.71 - return adjustVarargs(flags, d.getParameterTypes(constant_pool)); 5.72 + return getJavaName(adjustVarargs(flags, d.getParameterTypes(constant_pool))); 5.73 } catch (ConstantPoolException e) { 5.74 return report(e); 5.75 } catch (DescriptorException e) {
6.1 --- a/test/Makefile Thu Apr 08 17:03:01 2010 -0700 6.2 +++ b/test/Makefile Tue Apr 13 16:42:58 2010 -0700 6.3 @@ -1,7 +1,21 @@ 6.4 # 6.5 -# Makefile to run jtreg and any other tests 6.6 +# Makefile to run jtreg and other tests 6.7 # 6.8 6.9 +# Product builds and langtools builds 6.10 +# 6.11 +# A full product build (or "control" build) creates a complete JDK image. 6.12 +# To test a product build, set TESTJAVA to the path for the image. 6.13 +# 6.14 +# A langtools build just builds the langtools components of a JDK. 6.15 +# To test a langtools build, set TESTJAVA to the path for a recent JDK 6.16 +# build, and set TESTBOOTCLASSPATH to the compiled langtools classes -- 6.17 +# for example build/classes or dist/lib/classes.jar. 6.18 + 6.19 +# JPRT 6.20 +# JPRT may invoke this Makefile directly, as part of a langtools build, 6.21 +# or indirectly, via FOREST/test/Makefile, as part of a control build. 6.22 + 6.23 # Get OS/ARCH specifics 6.24 OSNAME = $(shell uname -s) 6.25 ifeq ($(OSNAME), SunOS) 6.26 @@ -41,8 +55,11 @@ 6.27 # Root of this test area (important to use full paths in some places) 6.28 TEST_ROOT := $(shell pwd) 6.29 6.30 -# Default bundle of all test results (passed or not) 6.31 -JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip 6.32 +# Default bundle of all test results (passed or not) (JPRT only) 6.33 +ifdef JPRT_JOB_ID 6.34 + JPRT_CLEAN = clean 6.35 + JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip 6.36 +endif 6.37 6.38 ifeq ($(PLATFORM), windows) 6.39 SLASH_JAVA = J: 6.40 @@ -57,8 +74,21 @@ 6.41 JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg 6.42 endif 6.43 JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg 6.44 +JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff 6.45 6.46 -# Default JDK for JTREG 6.47 +# Default JCK to run 6.48 +ifdef JPRT_JCK_HOME 6.49 + JCK_HOME = $(JPRT_JCK_HOME) 6.50 +else 6.51 + JCK_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries 6.52 +endif 6.53 + 6.54 +# Default JDK for JTREG and JCK 6.55 +# 6.56 +# JT_JAVA is the version of java used to run jtreg/JCK. Since it is now 6.57 +# standard to execute tests in sameVM mode, it should normally be set the 6.58 +# same as TESTJAVA (although not necessarily so.) 6.59 +# 6.60 ifdef JPRT_JAVA_HOME 6.61 JT_JAVA = $(JPRT_JAVA_HOME) 6.62 else 6.63 @@ -72,49 +102,275 @@ 6.64 TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH) 6.65 endif 6.66 6.67 -TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar 6.68 +# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from 6.69 +# make/Makefile 6.70 +# For langtools, this is a directory containing build and dist 6.71 +# For a control build, this is build/$(PRODUCT)-$(ARCH)/j2sdk-image 6.72 +ifdef PRODUCT_HOME 6.73 + ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0) 6.74 + TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar 6.75 + endif 6.76 + ifeq ($(shell [ -r $(PRODUCT_HOME)/lib/tools.jar ]; echo $$?),0) 6.77 + TESTJAVA = $(PRODUCT_HOME) 6.78 + endif 6.79 +endif 6.80 + 6.81 +ifdef TESTBOOTCLASSPATH 6.82 + JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH) 6.83 +### In the following, -refvmoptions is an undocumented option 6.84 +### The following does not work JCK 7 b30 2/6/2010. Awaiting b31. 6.85 + JCK_OPTIONS += \ 6.86 + -vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \ 6.87 + -refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) 6.88 +endif 6.89 + 6.90 +# Concurrency is the number of tests that can execute at once. 6.91 +# Supported for JCK, not supported for jtreg. 6.92 +# On an otherwise empty machine, suggest setting to (#cpus + 2) 6.93 +# If unset, the default is (#cpus) 6.94 +### RFE: determine and use #cpus 6.95 +ifdef JCK_CONCURRENCY 6.96 + JCK_OPTIONS += -concurrency:$(JCK_CONCURRENCY) 6.97 +endif 6.98 + 6.99 +# JCK is executed using "Multi-JVM Group Mode", which is a hybrid 6.100 +# of otherVM and sameVM modes. New JVMs are created and reused for 6.101 +# a number of tests, then eventually discarded and a new one started. 6.102 +# This amortizes the JVM startup time. The "group size" defines 6.103 +# how many tests are run in a JVM before it is replaced. 6.104 +# If unset, the default is 100. 6.105 +JCK_GROUP_SIZE = 1000 6.106 +ifdef JCK_GROUP_SIZE 6.107 + JCK_COMPILER_OPTIONS += \ 6.108 + -jtoptions:-Ejck.env.compiler.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) \ 6.109 + -jtoptions:-Ejck.env.compiler.compRefExecute.groupMode.groupSize=$(JCK_GROUP_SIZE) 6.110 +### The following is not supported. Awaiting RFE 6924287 6.111 +### 6924287: Jck4Jdk: Allow to configure test group size for group mode via simple command line option 6.112 +### JCK_RUNTIME_OPTIONS += \ 6.113 +### -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) 6.114 +endif 6.115 + 6.116 +# Assertions: some tests show failures when assertions are enabled. 6.117 +# Since javac is typically loaded via the bootclassloader (either via TESTJAVA 6.118 +# or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac. 6.119 +JTREG_OPTIONS += $(ASSERTION_OPTIONS) 6.120 +JCK_OPTIONS += $(ASSERTION_OPTIONS:%=-vmoptions:%) 6.121 + 6.122 +# Include shared options 6.123 +JCK_COMPILER_OPTIONS += $(JCK_OPTIONS) 6.124 +JCK_RUNTIME_OPTIONS += $(JCK_OPTIONS) 6.125 + 6.126 +# Exit codes: 6.127 +# jtreg, jck: 0: OK, 1: tests failed, 2: tests error; 3+: SERIOUS 6.128 +FATAL_JTREG_EXIT = 3 6.129 +FATAL_JCK_EXIT = 3 6.130 +# jtdiff: 0: OK, 1: differences found; 2+: SERIOUS 6.131 +FATAL_JTDIFF_EXIT = 2 6.132 +# 6.133 +# Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid 6.134 +# having make exit with non-zero return code. 6.135 +EXIT = exit 6.136 +# Function to exit shell if exit code of preceding command is greater than or equal 6.137 +# to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed. 6.138 +EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi 6.139 6.140 # The test directories to run 6.141 DEFAULT_TESTDIRS = . 6.142 TESTDIRS = $(DEFAULT_TESTDIRS) 6.143 6.144 # Root of all test results 6.145 -TEST_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH) 6.146 +TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools 6.147 +ABS_TEST_OUTPUT_DIR := \ 6.148 + $(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ 6.149 + cd $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ 6.150 + pwd ) 6.151 +# Subdirectories for different test runs 6.152 +JTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg 6.153 +JCK_COMPILER_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-compiler 6.154 +JCK_RUNTIME_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-runtime-Xcompile 6.155 6.156 -# Default make rule 6.157 -all apt javac javadoc javah javap: clean check jtreg-tests $(JPRT_ARCHIVE_BUNDLE) 6.158 +# Default make rule -- warning, may take a while 6.159 +all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary 6.160 + @echo "Testing completed successfully" 6.161 + 6.162 +jtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary 6.163 + @echo "Testing completed successfully" 6.164 + 6.165 +jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary 6.166 + @echo "Testing completed successfully" 6.167 + 6.168 +jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary 6.169 @echo "Testing completed successfully" 6.170 6.171 # for use with JPRT -testrule 6.172 -all: TESTDIRS = . 6.173 -apt: TESTDIRS = tools/apt 6.174 -javac: TESTDIRS = tools/javac 6.175 -javadoc: TESTDIRS = tools/javadoc com/sun/javadoc 6.176 -javah: TESTDIRS = tools/javah 6.177 -javap: TESTDIRS = tools/javap 6.178 +all: JTREG_TESTDIRS = . 6.179 +jtreg: JTREG_TESTDIRS = . 6.180 +apt: JTREG_TESTDIRS = tools/apt 6.181 +javac: JTREG_TESTDIRS = tools/javac 6.182 +javadoc: JTREG_TESTDIRS = tools/javadoc com/sun/javadoc 6.183 +javah: JTREG_TESTDIRS = tools/javah 6.184 +javap: JTREG_TESTDIRS = tools/javap 6.185 + 6.186 +# Run jtreg tests 6.187 +# 6.188 +# JTREG_HOME 6.189 +# Installed location of jtreg 6.190 +# JT_JAVA 6.191 +# Version of java used to run jtreg. Should normally be the same as TESTJAVA 6.192 +# TESTJAVA 6.193 +# Version of java to be tested. 6.194 +# JTREG_OPTIONS 6.195 +# Additional options for jtreg 6.196 +# JTREG_TESTDIRS 6.197 +# Directories of tests to be run 6.198 +# JTREG_OUTPUT_DIR 6.199 +# Where to write the results 6.200 +# JTREG_REFERENCE 6.201 +# (Optional) reference results (e.g. work, report or summary.txt) 6.202 +# 6.203 +jtreg-tests: check-jtreg FRC 6.204 + @rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \ 6.205 + $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt 6.206 + @mkdir -p $(JTREG_OUTPUT_DIR) 6.207 + JT_JAVA=$(JT_JAVA) $(JTREG) \ 6.208 + -J-Xmx512m \ 6.209 + -a -samevm -ignore:quiet -v:fail,error,nopass \ 6.210 + -r:$(JTREG_OUTPUT_DIR)/JTreport \ 6.211 + -w:$(JTREG_OUTPUT_DIR)/JTwork \ 6.212 + -jdk:$(TESTJAVA) \ 6.213 + $(JAVA_ARGS:%=-vmoption:%) \ 6.214 + $(JTREG_OPTIONS) \ 6.215 + $(JTREG_TESTDIRS) \ 6.216 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \ 6.217 + echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \ 6.218 + ) 6.219 +ifdef JTREG_REFERENCE 6.220 + JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JTREG_OUTPUT_DIR)/diff.html \ 6.221 + $(JTREG_REFERENCE) $(JTREG_OUTPUT_DIR)/JTreport \ 6.222 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) 6.223 +endif 6.224 + 6.225 +jtreg-summary: FRC 6.226 + if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \ 6.227 + echo ; echo "Summary of jtreg test failures" ; \ 6.228 + cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \ 6.229 + grep -v 'Not run' | grep -v 'Passed' ; \ 6.230 + echo ; \ 6.231 + $(EXIT) `cat $(JTREG_OUTPUT_DIR)/status.txt` ; \ 6.232 + fi 6.233 6.234 # Check to make sure these directories exist 6.235 -check: $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 6.236 +check-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 6.237 6.238 -# Run the tests 6.239 -jtreg-tests: FRC 6.240 - @echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)" 6.241 - @rm -f -r $(TEST_OUTPUT_DIR)/JTwork $(TEST_OUTPUT_DIR)/JTreport 6.242 - @mkdir -p $(TEST_OUTPUT_DIR) 6.243 - JT_JAVA=$(JT_JAVA) $(JTREG) \ 6.244 - -a -samevm -k:\!ignore -v:fail,error,nopass \ 6.245 - -r:$(TEST_OUTPUT_DIR)/JTreport \ 6.246 - -w:$(TEST_OUTPUT_DIR)/JTwork \ 6.247 - -jdk:$(TESTJAVA) \ 6.248 - -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \ 6.249 - $(JAVA_ARGS:%=-vmoption:%) \ 6.250 - $(TESTDIRS) \ 6.251 - || ( status=$$? ; \ 6.252 - echo ; echo "Summary of test failures" ; \ 6.253 - cat $(TEST_OUTPUT_DIR)/JTreport/text/summary.txt | \ 6.254 - grep -v 'Not run' | grep -v 'Passed' ; \ 6.255 - echo ; \ 6.256 - exit $$status ) 6.257 + 6.258 +# Run JCK-compiler tests 6.259 +# 6.260 +# JCK_HOME 6.261 +# Installed location of JCK: should include JCK-compiler, and JCK-extras 6.262 +# JT_JAVA 6.263 +# Version of java used to run JCK. Should normally be the same as TESTJAVA 6.264 +# TESTJAVA 6.265 +# Version of java to be tested. 6.266 +# JCK_COMPILER_OPTIONS 6.267 +# Additional options for JCK-compiler 6.268 +# JCK_COMPILER_TESTDIRS 6.269 +# Directories of tests to be run 6.270 +# JCK_COMPILER_OUTPUT_DIR 6.271 +# Where to write the results 6.272 +# JCK_COMPILER_REFERENCE 6.273 +# (Optional) reference results (e.g. work, report or summary.txt) 6.274 +# 6.275 +jck-compiler-tests: check-jck FRC 6.276 + @rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \ 6.277 + $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt 6.278 + @mkdir -p $(JCK_COMPILER_OUTPUT_DIR) 6.279 + $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ 6.280 + -jar $(JCK_HOME)/JCK-compiler-7/lib/jtjck.jar \ 6.281 + -v:non-pass \ 6.282 + -r:$(JCK_COMPILER_OUTPUT_DIR)/report \ 6.283 + -w:$(JCK_COMPILER_OUTPUT_DIR)/work \ 6.284 + -jdk:$(TESTJAVA) \ 6.285 + $(JCK_COMPILER_OPTIONS) \ 6.286 + $(JCK_COMPILER_TESTDIRS) \ 6.287 + || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \ 6.288 + echo $$status > $(JCK_COMPILER_OUTPUT_DIR)/status.txt \ 6.289 + ) 6.290 +ifdef JCK_COMPILER_REFERENCE 6.291 + JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_COMPILER_OUTPUT_DIR)/diff.html \ 6.292 + $(JCK_COMPILER_REFERENCE) $(JCK_COMPILER_OUTPUT_DIR)/report \ 6.293 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) 6.294 +endif 6.295 + 6.296 +jck-compiler-summary: FRC 6.297 + if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \ 6.298 + echo ; echo "Summary of JCK-compiler test failures" ; \ 6.299 + cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \ 6.300 + grep -v 'Not run' | grep -v 'Passed' ; \ 6.301 + echo ; \ 6.302 + $(EXIT) `cat $(JCK_COMPILER_OUTPUT_DIR)/status.txt` ; \ 6.303 + fi 6.304 + 6.305 +# Run JCK-runtime tests in -Xcompile mode 6.306 +# This is a special mode to test javac by compiling the tests in the JCK-runtime test suite 6.307 +# Normal JCK-runtime invocation belongs in the jdk/ repository. 6.308 +# 6.309 +# JCK_HOME 6.310 +# Installed location of JCK: should include JCK-compiler, JCK-runtime and JCK-extras 6.311 +# JT_JAVA 6.312 +# Version of java used to run JCK. Should normally be the same as TESTJAVA 6.313 +# TESTJAVA 6.314 +# Version of java to be tested. 6.315 +# JCK_RUNTIME_OPTIONS 6.316 +# Additional options for JCK-runtime 6.317 +# JCK_RUNTIME_TESTDIRS 6.318 +# Directories of tests to be run 6.319 +# JCK_RUNTIME_OUTPUT_DIR 6.320 +# Where to write the results 6.321 +# JCK_RUNTIME_REFERENCE 6.322 +# (Optional) reference results (e.g. work, report or summary.txt) 6.323 +# 6.324 +jck-runtime-tests: check-jck FRC 6.325 + @rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \ 6.326 + $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt 6.327 + @mkdir -p $(JCK_RUNTIME_OUTPUT_DIR) 6.328 + $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ 6.329 + -jar $(JCK_HOME)/JCK-runtime-7/lib/jtjck.jar \ 6.330 + -v:non-pass \ 6.331 + -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \ 6.332 + -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \ 6.333 + -jdk:$(TESTJAVA) \ 6.334 + -Xcompile \ 6.335 + $(JCK_RUNTIME_OPTIONS) \ 6.336 + $(JCK_RUNTIME_TESTDIRS) \ 6.337 + || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \ 6.338 + echo $$status > $(JCK_RUNTIME_OUTPUT_DIR)/status.txt \ 6.339 + ) 6.340 +ifdef JCK_RUNTIME_REFERENCE 6.341 + JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_RUNTIME_OUTPUT_DIR)/diff.html \ 6.342 + $(JCK_RUNTIME_REFERENCE) $(JCK_RUNTIME_OUTPUT_DIR)/report \ 6.343 + || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) 6.344 +endif 6.345 + 6.346 +jck-runtime-summary: FRC 6.347 + if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \ 6.348 + echo ; echo "Summary of JCK-runtime test failures" ; \ 6.349 + cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \ 6.350 + grep -v 'Not run' | grep -v 'Passed' ; \ 6.351 + echo ; \ 6.352 + $(EXIT) `cat $(JCK_RUNTIME_OUTPUT_DIR)/status.txt` ; \ 6.353 + fi 6.354 + 6.355 +# Check to make sure these directories exist 6.356 +check-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME) 6.357 + 6.358 +all-summary: FRC 6.359 + if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then 6.360 + echo ; echo "Summary of test failures" ; \ 6.361 + cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \ 6.362 + grep -v 'Not run' | grep -v 'Passed' ; \ 6.363 + echo ; \ 6.364 + $(EXIT) 1 6.365 + fi 6.366 6.367 # Bundle up the results 6.368 $(JPRT_ARCHIVE_BUNDLE): FRC 6.369 @@ -124,12 +380,17 @@ 6.370 6.371 # Cleanup 6.372 clean: 6.373 - rm -f -r $(TEST_OUTPUT_DIR) 6.374 rm -f $(JPRT_ARCHIVE_BUNDLE) 6.375 6.376 # Used to force a target rules to run 6.377 FRC: 6.378 6.379 # Phony targets (e.g. these are not filenames) 6.380 -.PHONY: all tests clean check 6.381 +.PHONY: all clean \ 6.382 + jtreg javac javadoc javah javap jtreg-tests jtreg-summary check-jtreg \ 6.383 + jck-compiler jck-compiler-tests jck-compiler-summary \ 6.384 + jck-runtime jck-runtime-tests jck-runtime-summary check-jck 6.385 6.386 +# No use of suffix rules 6.387 +.SUFFIXES: 6.388 +
7.1 --- a/test/tools/javac/OverrideChecks/6738538/T6738538a.java Thu Apr 08 17:03:01 2010 -0700 7.2 +++ b/test/tools/javac/OverrideChecks/6738538/T6738538a.java Tue Apr 13 16:42:58 2010 -0700 7.3 @@ -41,4 +41,4 @@ 7.4 public T m(); 7.5 } 7.6 class Crash<T extends C<?> & I> {} 7.7 -} 7.8 \ No newline at end of file 7.9 +}
8.1 --- a/test/tools/javac/OverrideChecks/6738538/T6738538b.java Thu Apr 08 17:03:01 2010 -0700 8.2 +++ b/test/tools/javac/OverrideChecks/6738538/T6738538b.java Tue Apr 13 16:42:58 2010 -0700 8.3 @@ -44,4 +44,4 @@ 8.4 } 8.5 8.6 class C2<T extends C1<?> & I2> {} 8.7 -} 8.8 \ No newline at end of file 8.9 +}
9.1 --- a/test/tools/javac/api/6731573/Erroneous.java Thu Apr 08 17:03:01 2010 -0700 9.2 +++ b/test/tools/javac/api/6731573/Erroneous.java Tue Apr 13 16:42:58 2010 -0700 9.3 @@ -1,4 +1,4 @@ 9.4 class A { 9.5 boolean b; 9.6 boolean b; 9.7 -} 9.8 \ No newline at end of file 9.9 +}
10.1 --- a/test/tools/javac/api/6731573/T6731573.java Thu Apr 08 17:03:01 2010 -0700 10.2 +++ b/test/tools/javac/api/6731573/T6731573.java Tue Apr 13 16:42:58 2010 -0700 10.3 @@ -106,4 +106,4 @@ 10.4 public static void main(String... args) throws Exception { 10.5 new T6731573().test(); 10.6 } 10.7 -} 10.8 \ No newline at end of file 10.9 +}
11.1 --- a/test/tools/javac/cast/6548436/T6548436d.java Thu Apr 08 17:03:01 2010 -0700 11.2 +++ b/test/tools/javac/cast/6548436/T6548436d.java Tue Apr 13 16:42:58 2010 -0700 11.3 @@ -37,4 +37,4 @@ 11.4 static void test(Base<? extends Double> je) { 11.5 Object o = (Base<Integer>)je; 11.6 } 11.7 -} 11.8 \ No newline at end of file 11.9 +}
12.1 --- a/test/tools/javac/cast/6558559/T6558559a.java Thu Apr 08 17:03:01 2010 -0700 12.2 +++ b/test/tools/javac/cast/6558559/T6558559a.java Tue Apr 13 16:42:58 2010 -0700 12.3 @@ -37,4 +37,4 @@ 12.4 12.5 A<?> x = null; 12.6 B<?> y = (B<?>)x; 12.7 -} 12.8 \ No newline at end of file 12.9 +}
13.1 --- a/test/tools/javac/cast/6558559/T6558559b.java Thu Apr 08 17:03:01 2010 -0700 13.2 +++ b/test/tools/javac/cast/6558559/T6558559b.java Tue Apr 13 16:42:58 2010 -0700 13.3 @@ -40,4 +40,4 @@ 13.4 Object o = unboundList; 13.5 Throwable t3 = (Throwable) o; 13.6 } 13.7 -} 13.8 \ No newline at end of file 13.9 +}
14.1 --- a/test/tools/javac/cast/6586091/T6586091.java Thu Apr 08 17:03:01 2010 -0700 14.2 +++ b/test/tools/javac/cast/6586091/T6586091.java Tue Apr 13 16:42:58 2010 -0700 14.3 @@ -35,4 +35,4 @@ 14.4 14.5 A<A<?>> t = null; 14.6 B c = (B)t; 14.7 -} 14.8 \ No newline at end of file 14.9 +}
15.1 --- a/test/tools/javac/enum/T6724345.java Thu Apr 08 17:03:01 2010 -0700 15.2 +++ b/test/tools/javac/enum/T6724345.java Tue Apr 13 16:42:58 2010 -0700 15.3 @@ -48,4 +48,4 @@ 15.4 enum E implements I { 15.5 V {public void i() {}}; 15.6 } 15.7 -} 15.8 \ No newline at end of file 15.9 +}
16.1 --- a/test/tools/javac/generics/T6557954.java Thu Apr 08 17:03:01 2010 -0700 16.2 +++ b/test/tools/javac/generics/T6557954.java Tue Apr 13 16:42:58 2010 -0700 16.3 @@ -33,4 +33,4 @@ 16.4 class T6557954<T> { 16.5 class Foo<U extends T> {} 16.6 T6557954<Number>.Foo<Integer> f; 16.7 -} 16.8 \ No newline at end of file 16.9 +}
17.1 --- a/test/tools/javac/generics/T6751514.java Thu Apr 08 17:03:01 2010 -0700 17.2 +++ b/test/tools/javac/generics/T6751514.java Tue Apr 13 16:42:58 2010 -0700 17.3 @@ -79,4 +79,4 @@ 17.4 " - found: " + found + ")"); 17.5 } 17.6 } 17.7 -} 17.8 \ No newline at end of file 17.9 +}
18.1 --- a/test/tools/javac/generics/T6869075.java Thu Apr 08 17:03:01 2010 -0700 18.2 +++ b/test/tools/javac/generics/T6869075.java Tue Apr 13 16:42:58 2010 -0700 18.3 @@ -64,4 +64,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/inference/6569789/T6569789.java Thu Apr 08 17:03:01 2010 -0700 19.2 +++ b/test/tools/javac/generics/inference/6569789/T6569789.java Tue Apr 13 16:42:58 2010 -0700 19.3 @@ -41,4 +41,4 @@ 19.4 } 19.5 19.6 static <W extends C & I & I1 & I2, T extends W> void testMethod(T t) {} 19.7 -} 19.8 \ No newline at end of file 19.9 +}
20.1 --- a/test/tools/javac/generics/inference/6650759/T6650759a.java Thu Apr 08 17:03:01 2010 -0700 20.2 +++ b/test/tools/javac/generics/inference/6650759/T6650759a.java Tue Apr 13 16:42:58 2010 -0700 20.3 @@ -42,4 +42,4 @@ 20.4 Integer test = getGenericValue(new IntegerInterface()); 20.5 testSet(getGenericValue(new IntegerInterface())); 20.6 } 20.7 -} 20.8 \ No newline at end of file 20.9 +}
21.1 --- a/test/tools/javac/generics/wildcards/T6732484.java Thu Apr 08 17:03:01 2010 -0700 21.2 +++ b/test/tools/javac/generics/wildcards/T6732484.java Tue Apr 13 16:42:58 2010 -0700 21.3 @@ -34,4 +34,4 @@ 21.4 class B extends A<B> {} 21.5 21.6 A<? super B> f; 21.7 -} 21.8 \ No newline at end of file 21.9 +}
22.1 --- a/test/tools/javac/processing/model/util/elements/Foo.java Thu Apr 08 17:03:01 2010 -0700 22.2 +++ b/test/tools/javac/processing/model/util/elements/Foo.java Tue Apr 13 16:42:58 2010 -0700 22.3 @@ -26,4 +26,4 @@ 22.4 * Dummy type to compile. 22.5 */ 22.6 public class Foo { 22.7 -} 22.8 \ No newline at end of file 22.9 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/tools/javac/processing/model/util/elements/VacuousEnum.java Tue Apr 13 16:42:58 2010 -0700 23.3 @@ -0,0 +1,33 @@ 23.4 +/* 23.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 23.24 + * have any questions. 23.25 + */ 23.26 + 23.27 +/* 23.28 + * @test 23.29 + * @bug 6937417 23.30 + * @summary Test -Xprint on enum type with no constants 23.31 + * @author Joseph D. Darcy 23.32 + * @compile -Xprint VacuousEnum.java 23.33 + */ 23.34 +public enum VacuousEnum { 23.35 + // But alas, no enum constants! 23.36 +}
24.1 --- a/test/tools/javac/varargs/T6746184.java Thu Apr 08 17:03:01 2010 -0700 24.2 +++ b/test/tools/javac/varargs/T6746184.java Tue Apr 13 16:42:58 2010 -0700 24.3 @@ -36,4 +36,4 @@ 24.4 class A { 24.5 public static void m(final Object... varargs) {} 24.6 private static void m(final Object singleArg) {} 24.7 -} 24.8 \ No newline at end of file 24.9 +}
25.1 --- a/test/tools/javah/T6893943.java Thu Apr 08 17:03:01 2010 -0700 25.2 +++ b/test/tools/javah/T6893943.java Tue Apr 13 16:42:58 2010 -0700 25.3 @@ -23,7 +23,7 @@ 25.4 25.5 /* 25.6 * @test 25.7 - * @bug 6893943 25.8 + * @bug 6893943 6937318 25.9 * @summary exit code from javah with no args is 0 25.10 */ 25.11 25.12 @@ -31,22 +31,32 @@ 25.13 import java.util.*; 25.14 25.15 public class T6893943 { 25.16 + static final String[] NO_ARGS = { }; 25.17 + static final String[] HELP = { "-help" }; 25.18 + static final String NEWLINE = System.getProperty("line.separator"); 25.19 + 25.20 public static void main(String... args) throws Exception { 25.21 new T6893943().run(); 25.22 } 25.23 25.24 void run() throws Exception { 25.25 - testSimpleAPI(); 25.26 - testCommand(); 25.27 + testSimpleAPI(NO_ARGS, 1); 25.28 + testSimpleAPI(HELP, 0); 25.29 + testCommand(NO_ARGS, 1); 25.30 + testCommand(HELP, 0); 25.31 } 25.32 25.33 - void testSimpleAPI() throws Exception { 25.34 - PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.err)); 25.35 - int rc = com.sun.tools.javah.Main.run(new String[] { }, pw); 25.36 - expect("testSimpleAPI", rc, 1); 25.37 + void testSimpleAPI(String[] args, int expect_rc) throws Exception { 25.38 + System.err.println("Test simple api: " + Arrays.asList(args)); 25.39 + StringWriter sw = new StringWriter(); 25.40 + PrintWriter pw = new PrintWriter(sw); 25.41 + int rc = com.sun.tools.javah.Main.run(args, pw); 25.42 + pw.close(); 25.43 + expect("testSimpleAPI", sw.toString(), rc, expect_rc); 25.44 } 25.45 25.46 - void testCommand() throws Exception { 25.47 + void testCommand(String[] args, int expect_rc) throws Exception { 25.48 + System.err.println("Test command: " + Arrays.asList(args)); 25.49 File javaHome = new File(System.getProperty("java.home")); 25.50 if (javaHome.getName().equals("jre")) 25.51 javaHome = javaHome.getParentFile(); 25.52 @@ -54,22 +64,32 @@ 25.53 List<String> command = new ArrayList<String>(); 25.54 command.add(new File(new File(javaHome, "bin"), "javah").getPath()); 25.55 command.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path")); 25.56 + command.addAll(Arrays.asList(args)); 25.57 //System.err.println("command: " + command); 25.58 25.59 ProcessBuilder pb = new ProcessBuilder(command); 25.60 pb.redirectErrorStream(true); 25.61 Process p = pb.start(); 25.62 p.getOutputStream().close(); 25.63 + StringWriter sw = new StringWriter(); 25.64 String line; 25.65 BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 25.66 while ((line = in.readLine()) != null) 25.67 - System.err.println("javah: " + line); 25.68 + sw.write(line + NEWLINE); 25.69 int rc = p.waitFor(); 25.70 - expect("testCommand", rc, 1); 25.71 + expect("testCommand", sw.toString(), rc, expect_rc); 25.72 } 25.73 25.74 - void expect(String name, int actual, int expect) throws Exception { 25.75 - if (actual != expect) 25.76 - throw new Exception(name + ": unexpected exit: " + actual + ", expected: " + expect); 25.77 + void expect(String name, String out, int actual_rc, int expect_rc) throws Exception { 25.78 + if (out.isEmpty()) 25.79 + throw new Exception("No output from javah"); 25.80 + 25.81 + if (!out.startsWith("Usage:")) { 25.82 + System.err.println(out); 25.83 + throw new Exception("Unexpected output from javah"); 25.84 + } 25.85 + 25.86 + if (actual_rc != expect_rc) 25.87 + throw new Exception(name + ": unexpected exit: " + actual_rc + ", expected: " + expect_rc); 25.88 } 25.89 }
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/tools/javap/6937244/T6937244.java Tue Apr 13 16:42:58 2010 -0700 26.3 @@ -0,0 +1,57 @@ 26.4 +/* 26.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. 26.11 + * 26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 + * version 2 for more details (a copy is included in the LICENSE file that 26.16 + * accompanied this code). 26.17 + * 26.18 + * You should have received a copy of the GNU General Public License version 26.19 + * 2 along with this work; if not, write to the Free Software Foundation, 26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 + * 26.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 26.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 26.24 + * have any questions. 26.25 + */ 26.26 + 26.27 +/* 26.28 + * @test 26.29 + * @bug 6937244 26.30 + * @summary fields display with JVMS names, not Java names 26.31 + */ 26.32 + 26.33 +import java.io.*; 26.34 + 26.35 +public class T6937244 { 26.36 + public static void main(String[] args) throws Exception { 26.37 + new T6937244().run(); 26.38 + } 26.39 + 26.40 + void run() throws Exception { 26.41 + StringWriter sw = new StringWriter(); 26.42 + PrintWriter pw = new PrintWriter(sw); 26.43 + String[] args = { "java.lang.String" }; 26.44 + int rc = com.sun.tools.javap.Main.run(args, pw); 26.45 + pw.close(); 26.46 + String out = sw.toString(); 26.47 + System.err.println(out); 26.48 + if (rc != 0) 26.49 + throw new Exception("unexpected exit from javap: " + rc); 26.50 + for (String line: out.split("[\r\n]+")) { 26.51 + if (line.contains("CASE_INSENSITIVE_ORDER")) { 26.52 + if (line.matches("\\s*\\Qpublic static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;\\E\\s*")) 26.53 + return; 26.54 + throw new Exception("declaration not shown as expected"); 26.55 + } 26.56 + } 26.57 + throw new Exception("declaration of CASE_INSENSITIVE_ORDER not found"); 26.58 + } 26.59 +} 26.60 +
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/tools/javap/6937244/T6937244A.java Tue Apr 13 16:42:58 2010 -0700 27.3 @@ -0,0 +1,90 @@ 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 +import java.util.*; 27.35 + 27.36 +public class T6937244A { 27.37 + public static void main(String[] args) throws Exception { 27.38 + new T6937244A().run(); 27.39 + } 27.40 + 27.41 + void run() throws Exception { 27.42 + StringWriter sw = new StringWriter(); 27.43 + PrintWriter pw = new PrintWriter(sw); 27.44 + String[] args = { "Test" }; 27.45 + int rc = com.sun.tools.javap.Main.run(args, pw); 27.46 + pw.close(); 27.47 + String out = sw.toString(); 27.48 + System.err.println(out); 27.49 + if (rc != 0) 27.50 + throw new Exception("unexpected exit from javap: " + rc); 27.51 + 27.52 + int count = 0; 27.53 + 27.54 + for (String line: out.split("[\r\n]+")) { 27.55 + if (line.contains("extends")) { 27.56 + verify(line, "extends java.lang.Object implements java.util.List<java.lang.String>"); 27.57 + count++; 27.58 + } 27.59 + 27.60 + if (line.contains("field")) { 27.61 + verify(line, "java.util.List<java.lang.String> field"); 27.62 + count++; 27.63 + } 27.64 + 27.65 + if (line.contains("method")) { 27.66 + verify(line, "java.util.List<java.lang.String> method(java.util.List<java.lang.String>) throws java.lang.Exception"); 27.67 + count++; 27.68 + } 27.69 + } 27.70 + 27.71 + // final backstop check 27.72 + if (out.contains("/")) 27.73 + throw new Exception("unexpected \"/\" in output"); 27.74 + 27.75 + if (count != 3) 27.76 + throw new Exception("wrong number of matches found: " + count); 27.77 + } 27.78 + 27.79 + void verify(String line, String expect) throws Exception { 27.80 + if (!line.contains(expect)) { 27.81 + System.err.println("line: " + line); 27.82 + System.err.println("expect: " + expect); 27.83 + throw new Exception("expected string not found in line"); 27.84 + } 27.85 + } 27.86 +} 27.87 + 27.88 + 27.89 +abstract class Test implements List<String> { 27.90 + public List<String> field; 27.91 + public List<String> method(List<String> arg) throws Exception { return null; } 27.92 +} 27.93 +
28.1 --- a/test/tools/javap/T6715251.java Thu Apr 08 17:03:01 2010 -0700 28.2 +++ b/test/tools/javap/T6715251.java Tue Apr 13 16:42:58 2010 -0700 28.3 @@ -71,4 +71,4 @@ 28.4 28.5 String log; 28.6 int errors; 28.7 -} 28.8 \ No newline at end of file 28.9 +}
29.1 --- a/test/tools/javap/T6715753.java Thu Apr 08 17:03:01 2010 -0700 29.2 +++ b/test/tools/javap/T6715753.java Tue Apr 13 16:42:58 2010 -0700 29.3 @@ -47,4 +47,4 @@ 29.4 throw new Exception("test failed"); 29.5 } 29.6 } 29.7 -} 29.8 \ No newline at end of file 29.9 +}