changeset 1296:24540bbb4135

Merge
author andrew
date Tue, 29 May 2012 00:27:58 +0100
parents 8caec3672381 (current diff) 179fa85aeefa (diff)
children 7450073e2e6f
files .hgtags make/build.xml make/test/lib/apt.sh make/tools/CompileProperties/CompileProperties.java make/tools/CompileProperties/CompilePropertiesTask.java make/tools/GenStubs/GenStubs.java make/tools/SelectTool/SelectToolTask.java src/share/classes/com/sun/mirror/apt/AnnotationProcessor.java src/share/classes/com/sun/mirror/apt/AnnotationProcessorEnvironment.java src/share/classes/com/sun/mirror/apt/AnnotationProcessorFactory.java src/share/classes/com/sun/mirror/apt/AnnotationProcessorListener.java src/share/classes/com/sun/mirror/apt/AnnotationProcessors.java src/share/classes/com/sun/mirror/apt/Filer.java src/share/classes/com/sun/mirror/apt/Messager.java src/share/classes/com/sun/mirror/apt/RoundCompleteEvent.java src/share/classes/com/sun/mirror/apt/RoundCompleteListener.java src/share/classes/com/sun/mirror/apt/RoundState.java src/share/classes/com/sun/mirror/apt/package-info.java src/share/classes/com/sun/mirror/declaration/AnnotationMirror.java src/share/classes/com/sun/mirror/declaration/AnnotationTypeDeclaration.java src/share/classes/com/sun/mirror/declaration/AnnotationTypeElementDeclaration.java src/share/classes/com/sun/mirror/declaration/AnnotationValue.java src/share/classes/com/sun/mirror/declaration/ClassDeclaration.java src/share/classes/com/sun/mirror/declaration/ConstructorDeclaration.java src/share/classes/com/sun/mirror/declaration/Declaration.java src/share/classes/com/sun/mirror/declaration/EnumConstantDeclaration.java src/share/classes/com/sun/mirror/declaration/EnumDeclaration.java src/share/classes/com/sun/mirror/declaration/ExecutableDeclaration.java src/share/classes/com/sun/mirror/declaration/FieldDeclaration.java src/share/classes/com/sun/mirror/declaration/InterfaceDeclaration.java src/share/classes/com/sun/mirror/declaration/MemberDeclaration.java src/share/classes/com/sun/mirror/declaration/MethodDeclaration.java src/share/classes/com/sun/mirror/declaration/Modifier.java src/share/classes/com/sun/mirror/declaration/PackageDeclaration.java src/share/classes/com/sun/mirror/declaration/ParameterDeclaration.java src/share/classes/com/sun/mirror/declaration/TypeDeclaration.java src/share/classes/com/sun/mirror/declaration/TypeParameterDeclaration.java src/share/classes/com/sun/mirror/declaration/package-info.java src/share/classes/com/sun/mirror/overview.html src/share/classes/com/sun/mirror/type/AnnotationType.java src/share/classes/com/sun/mirror/type/ArrayType.java src/share/classes/com/sun/mirror/type/ClassType.java src/share/classes/com/sun/mirror/type/DeclaredType.java src/share/classes/com/sun/mirror/type/EnumType.java src/share/classes/com/sun/mirror/type/InterfaceType.java src/share/classes/com/sun/mirror/type/MirroredTypeException.java src/share/classes/com/sun/mirror/type/MirroredTypesException.java src/share/classes/com/sun/mirror/type/PrimitiveType.java src/share/classes/com/sun/mirror/type/ReferenceType.java src/share/classes/com/sun/mirror/type/TypeMirror.java src/share/classes/com/sun/mirror/type/TypeVariable.java src/share/classes/com/sun/mirror/type/VoidType.java src/share/classes/com/sun/mirror/type/WildcardType.java src/share/classes/com/sun/mirror/type/package-info.java src/share/classes/com/sun/mirror/util/DeclarationFilter.java src/share/classes/com/sun/mirror/util/DeclarationScanner.java src/share/classes/com/sun/mirror/util/DeclarationVisitor.java src/share/classes/com/sun/mirror/util/DeclarationVisitors.java src/share/classes/com/sun/mirror/util/Declarations.java src/share/classes/com/sun/mirror/util/SimpleDeclarationVisitor.java src/share/classes/com/sun/mirror/util/SimpleTypeVisitor.java src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java src/share/classes/com/sun/mirror/util/SourcePosition.java src/share/classes/com/sun/mirror/util/TypeVisitor.java src/share/classes/com/sun/mirror/util/Types.java src/share/classes/com/sun/mirror/util/package-info.java src/share/classes/com/sun/tools/apt/Main.java src/share/classes/com/sun/tools/apt/comp/AnnotationProcessingError.java src/share/classes/com/sun/tools/apt/comp/Apt.java src/share/classes/com/sun/tools/apt/comp/BootstrapAPF.java src/share/classes/com/sun/tools/apt/comp/PrintAP.java src/share/classes/com/sun/tools/apt/comp/UsageMessageNeededException.java src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java src/share/classes/com/sun/tools/apt/main/CommandLine.java src/share/classes/com/sun/tools/apt/main/Main.java src/share/classes/com/sun/tools/apt/mirror/AptEnv.java src/share/classes/com/sun/tools/apt/mirror/apt/AnnotationProcessorEnvironmentImpl.java src/share/classes/com/sun/tools/apt/mirror/apt/FilerImpl.java src/share/classes/com/sun/tools/apt/mirror/apt/MessagerImpl.java src/share/classes/com/sun/tools/apt/mirror/apt/RoundCompleteEventImpl.java src/share/classes/com/sun/tools/apt/mirror/apt/RoundStateImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationMirrorImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationTypeDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationTypeElementDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationValueImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/ClassDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/Constants.java src/share/classes/com/sun/tools/apt/mirror/declaration/ConstructorDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationMaker.java src/share/classes/com/sun/tools/apt/mirror/declaration/EnumConstantDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/EnumDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/ExecutableDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/FieldDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/InterfaceDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/MemberDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/MethodDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/PackageDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/ParameterDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/TypeDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/declaration/TypeParameterDeclarationImpl.java src/share/classes/com/sun/tools/apt/mirror/type/AnnotationTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/ArrayTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/ClassTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/DeclaredTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/EnumTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/InterfaceTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/PrimitiveTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/TypeMaker.java src/share/classes/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java src/share/classes/com/sun/tools/apt/mirror/type/TypeVariableImpl.java src/share/classes/com/sun/tools/apt/mirror/type/VoidTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/type/WildcardTypeImpl.java src/share/classes/com/sun/tools/apt/mirror/util/DeclarationsImpl.java src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java src/share/classes/com/sun/tools/apt/mirror/util/TypesImpl.java src/share/classes/com/sun/tools/apt/resources/apt.properties src/share/classes/com/sun/tools/apt/resources/apt_ja.properties src/share/classes/com/sun/tools/apt/resources/apt_zh_CN.properties src/share/classes/com/sun/tools/apt/util/Bark.java src/share/classes/com/sun/tools/javac/Launcher.java src/share/classes/com/sun/tools/javac/file/Paths.java src/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/share/classes/com/sun/tools/javac/main/JavacOption.java src/share/classes/com/sun/tools/javac/main/OptionName.java src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java src/share/classes/com/sun/tools/javac/parser/EndPosParser.java src/share/classes/com/sun/tools/javac/parser/Keywords.java src/share/classes/com/sun/tools/javac/parser/Token.java test/jprt.config test/tools/apt/Basics/Aggregate.java test/tools/apt/Basics/ClassAnnotations.java test/tools/apt/Basics/FreshnessApf.java test/tools/apt/Basics/GenClass.java test/tools/apt/Basics/Indirect.java test/tools/apt/Basics/Lacuna.java test/tools/apt/Basics/MethodAnnotations.java test/tools/apt/Basics/Milk.java test/tools/apt/Basics/MisMatch.java test/tools/apt/Basics/Misc.java test/tools/apt/Basics/MyMarker.java test/tools/apt/Basics/MySimple.java test/tools/apt/Basics/NestedClassAnnotations.java test/tools/apt/Basics/ParameterAnnotations.java test/tools/apt/Basics/StaticFieldAnnotations.java test/tools/apt/Basics/StaticMethodAnnotations.java test/tools/apt/Basics/TestGetPackageApf.java test/tools/apt/Basics/TestGetTypeDeclarationApf.java test/tools/apt/Basics/annot/AnnotMarker.java test/tools/apt/Basics/annot/AnnotShangri_la.java test/tools/apt/Basics/annot/AnnotSimple.java test/tools/apt/Basics/annot/annot2/AnnotMarker2.java test/tools/apt/Basics/annot/annot2/AnnotSimple2.java test/tools/apt/Basics/com.sun.mirror.apt.AnnotationProcessorFactory test/tools/apt/Basics/foo/bar/Baz.java test/tools/apt/Basics/foo/bar/Quux.java test/tools/apt/Basics/golden.txt test/tools/apt/Basics/goldenAggregate.txt test/tools/apt/Basics/p1/p2.java test/tools/apt/Basics/p1/p2/C1.java test/tools/apt/Basics/print.sh test/tools/apt/Compile/ClassDeclApf.java test/tools/apt/Compile/ClassDeclApf2.java test/tools/apt/Compile/Dummy1.java test/tools/apt/Compile/ErrorAPF.java test/tools/apt/Compile/HelloAnnotation.java test/tools/apt/Compile/HelloWorld.java test/tools/apt/Compile/Round1Apf.java test/tools/apt/Compile/Round2Apf.java test/tools/apt/Compile/Round3Apf.java test/tools/apt/Compile/Round4Apf.java test/tools/apt/Compile/Rounds.java test/tools/apt/Compile/StaticApf.java test/tools/apt/Compile/WarnAPF.java test/tools/apt/Compile/WrappedStaticApf.java test/tools/apt/Compile/compile.sh test/tools/apt/Compile/golden.txt test/tools/apt/Compile/goldenFactory.txt test/tools/apt/Compile/goldenWarn.txt test/tools/apt/Compile/servicesRound1 test/tools/apt/Compile/servicesRound2 test/tools/apt/Compile/servicesRound3 test/tools/apt/Compile/servicesRound4 test/tools/apt/Compile/servicesStaticApf test/tools/apt/Compile/src/AhOneClass.java test/tools/apt/Compile/src/AndAhTwoClass.java test/tools/apt/Compile/src/Round1Class.java test/tools/apt/Discovery/Dee.java test/tools/apt/Discovery/Dum.java test/tools/apt/Discovery/Empty.java test/tools/apt/Discovery/PhantomTouch.java test/tools/apt/Discovery/PhantomUpdate.java test/tools/apt/Discovery/Touch.java test/tools/apt/Discovery/discovery.sh test/tools/apt/Discovery/servicesBadTouch test/tools/apt/Discovery/servicesPhantomTouch test/tools/apt/Discovery/servicesTouch test/tools/apt/Discovery/servicesTweedle test/tools/apt/Misc/Marked.java test/tools/apt/Misc/Marker.java test/tools/apt/Misc/Misc.java test/tools/apt/Misc/misc.sh test/tools/apt/Misc/servicesMisc test/tools/apt/Options/Marked.java test/tools/apt/Options/Marker.java test/tools/apt/Options/OptionChecker.java test/tools/apt/Options/options.sh test/tools/apt/Options/servicesOptions test/tools/apt/Scanners/Counter.java test/tools/apt/Scanners/MemberOrderApf.java test/tools/apt/Scanners/Order.java test/tools/apt/Scanners/Scanner.java test/tools/apt/Scanners/TestEnum.java test/tools/apt/Scanners/VisitOrder.java test/tools/apt/Scanners/scanner.sh test/tools/apt/Scanners/servicesScanner test/tools/apt/lib/Ignore.java test/tools/apt/lib/Test.java test/tools/apt/lib/TestProcessor.java test/tools/apt/lib/TestProcessorFactory.java test/tools/apt/lib/Tester.java test/tools/apt/mirror/declaration/AnnoMirror.java test/tools/apt/mirror/declaration/AnnoTypeDecl.java test/tools/apt/mirror/declaration/AnnoTypeElemDecl.java test/tools/apt/mirror/declaration/AnnoVal.java test/tools/apt/mirror/declaration/ClassDecl.java test/tools/apt/mirror/declaration/ConstExpr.java test/tools/apt/mirror/declaration/ConstructorDecl.java test/tools/apt/mirror/declaration/EnumDecl.java test/tools/apt/mirror/declaration/FieldDecl.java test/tools/apt/mirror/declaration/GetAnno.java test/tools/apt/mirror/declaration/InterfaceDecl.java test/tools/apt/mirror/declaration/MethodDecl.java test/tools/apt/mirror/declaration/PackageDecl.java test/tools/apt/mirror/declaration/ParameterDecl.java test/tools/apt/mirror/declaration/pkg1/AClass.java test/tools/apt/mirror/declaration/pkg1/AnAnnoType.java test/tools/apt/mirror/declaration/pkg1/AnEnum.java test/tools/apt/mirror/declaration/pkg1/AnInterface.java test/tools/apt/mirror/declaration/pkg1/package-info.java test/tools/apt/mirror/declaration/pkg1/pkg2/AnInterface.java test/tools/apt/mirror/declaration/pkg1/pkg2/package.html test/tools/apt/mirror/type/AnnoTyp.java test/tools/apt/mirror/type/ArrayTyp.java test/tools/apt/mirror/type/ClassTyp.java test/tools/apt/mirror/type/EnumTyp.java test/tools/apt/mirror/type/InterfaceTyp.java test/tools/apt/mirror/type/PrimitiveTyp.java test/tools/apt/mirror/type/TypeVar.java test/tools/apt/mirror/type/WildcardTyp.java test/tools/apt/mirror/util/Overrides.java test/tools/apt/mirror/util/TypeCreation.java test/tools/javac/apt.sh test/tools/javac/diags/examples/InferredDoNotConformToBounds.java
diffstat 681 files changed, 25545 insertions(+), 34691 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon Jul 11 22:31:52 2011 +0100
+++ b/.hgignore	Tue May 29 00:27:58 2012 +0100
@@ -2,3 +2,4 @@
 ^dist/
 /nbproject/private/
 ^.hgtip
+.DS_Store
--- a/.hgtags	Mon Jul 11 22:31:52 2011 +0100
+++ b/.hgtags	Tue May 29 00:27:58 2012 +0100
@@ -125,3 +125,43 @@
 c455e2ae5c93014ae3fc475aba4509b5f70465f7 jdk7-b145
 9425dd4f53d5bfcd992d9aecea0eb7d8b2d4f62b jdk7-b146
 58bc532d63418ac3c9b42460d89cdaf595c6f3e1 jdk7-b147
+e9f118c2bd3c4690d8d2e6b108b5bad7e226634c jdk8-b01
+b3c059de2a61fc122c99d555cdd8b85f112393c1 jdk8-b02
+f497fac86cf9ada4801ecaf49eb0d2307a2b61c8 jdk8-b03
+5df63fd8fa64741e829281ee6febe9954932841b jdk8-b04
+5304c2a17d4b001e365a8f0163082dc375f1abab jdk8-b05
+d2422276f9dabc848b7a079025719826d2f9a30f jdk8-b06
+116980ecec5cc7d52736f09cf332321e0773265f jdk8-b07
+e8acc2d6c32f0c8321e642e1a86672a2e196a056 jdk8-b08
+b7a7e47c8d3daf7822abf7c37e5179ccbbf53008 jdk8-b09
+f6c783e18bdf4d46a0ab273868afebbf32600ff7 jdk8-b10
+4bf01f1c4e3464f378959d10f3983a0469181d94 jdk8-b11
+f2d6ed25857dfa7f269ac66e13666d648cb988c6 jdk8-b12
+ae25163501bc7477cd907e26a006a6f1b05fdb6d jdk8-b13
+58f1325d72b2bacc901f5189ee5e4e81e81ea657 jdk8-b14
+07599bd780cab1f40da7915e1dc6774629b0cf8c jdk8-b15
+1cbe86c11ba69521875c0b0357d7540781eb334d jdk8-b17
+ec2c0973cc31e143cffc05ceb63d98fae76f97d4 jdk8-b16
+ab1b1cc7857716914f2bb20b3128e5a8978290f7 jdk8-b18
+77b2c066084cbc75150efc6603a713c558329813 jdk8-b19
+ffd294128a48cbb90ce8f0569f82b61f1f164a18 jdk8-b20
+bcb21abf1c4177baf4574f99709513dcd4474727 jdk8-b21
+390a7828ae18324030c0546b6452d51093ffa451 jdk8-b22
+601ffcc6551d5414ef871be306c3a26396cf16a7 jdk8-b23
+6c9d21ca92c41ff5fcfa76c5b7fafe0f042f4aef jdk8-b24
+520c30f85bb529a3daf5d7623764c2464f00fd19 jdk8-b25
+b556aa8a99c358469861770aebdce884e06fa178 jdk8-b26
+be456f9c64e818161c789252145d4ddc292ae863 jdk8-b27
+5bed623b0c773aa8a8d5f8d4004ce9d3974143cc jdk8-b28
+e974e82abe51ef66dc32bb6ab5d0733753d3c7d7 jdk8-b29
+08a3425f39f829502ca0ddbfb2d051c31710cb19 jdk8-b30
+b28cfbe7e8b196da954bed9a22bfd790e55333aa jdk8-b31
+be069d72dde2bfe6f996c46325a320961ca854c2 jdk8-b32
+46831c72b7f6c69fef2cc2935001863643a65f94 jdk8-b33
+6b105afbb77ca9600a99eade31f686d070c70581 jdk8-b34
+defd666a786334465496c8901fa302b779c7e045 jdk8-b35
+94bbaa67686f44a124cd16fd9f1e8a6a3f684d2d jdk8-b36
+5891b38985e8b2502296fc29e726b527d03116d2 jdk8-b37
+1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38
+a9f547c218d957306dfc0cdd710be041bb62a555 jdk8-b39
+86e0dad6aadf626bf5755f503aee2d0da525d9d5 jdk8-b40
--- a/make/Makefile-classic	Mon Jul 11 22:31:52 2011 +0100
+++ b/make/Makefile-classic	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012 Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -115,7 +115,6 @@
 JAVADOC_JAR = $(LIB_DIR)/javadoc.jar
 JAVAH_JAR = $(LIB_DIR)/javah.jar
 JAVAP_JAR = $(LIB_DIR)/javap.jar
-APT_JAR = $(LIB_DIR)/apt.jar
 
 CLASSES_JAR = $(DIST_DIR)/classes.jar
 SRC_ZIP = $(DIST_DIR)/src.zip
@@ -163,7 +162,7 @@
 
 #----- useful macros
 
-TOOLS =  javac javadoc javah javap apt
+TOOLS =  javac javadoc javah javap
 
 SOURCE_LEVEL = 5
 BOOTSTRAP_TARGET_LEVEL = 5
@@ -319,28 +318,6 @@
 	( $(ECHO) Main-Class: sun.tools.javap.Main ) > $(BUILD_DIR)/javap.mf
 	$(BOOTJAR) -cfm $@ $(BUILD_DIR)/javap.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAP_DIRS))
 
-#----- apt
-
-APT_DIRS = \
-	com/sun/mirror \
-	com/sun/tools/apt
-
-APT_RESOURCE_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(APT_DIRS)) -name SCCS -prune -o -name \*.properties -print )
-
-APT_JAVA_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(APT_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
-	$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
- 
-$(APT_JAR): $(APT_JAVA_FILES) $(JAVAC_JAR) \
-		$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
-	$(MKDIR) -p $(CLASSES_DIR) $(@D)
-	$(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(NO_PROPRIETARY_API_WARNINGS) \
-		$(APT_JAVA_FILES) \
-		$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
-	( $(ECHO) Main-Class: com.sun.tools.apt.Main ; $(ECHO) Class-Path: javac.jar ) > $(BUILD_DIR)/apt.mf
-	$(BOOTJAR) -cfm $@ $(BUILD_DIR)/apt.mf $(patsubst %,-C $(CLASSES_DIR) %, $(APT_DIRS))
-
 #-----
 
 build-tools: $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
@@ -366,7 +343,7 @@
 
 #----- all classes
 
-$(DIST_DIR)/%/classes.jar: $(JAVAC_JAR) $(JAVADOC_JAR) $(JAVAH_JAR) $(JAVAP_JAR) $(APT_JAR)
+$(DIST_DIR)/%/classes.jar: $(JAVAC_JAR) $(JAVADOC_JAR) $(JAVAH_JAR) $(JAVAP_JAR)
 	$(MKDIR) -p $(@D)
 	$(BOOTJAR) -cf $@ -C $(CLASSES_DIR) .
 
@@ -401,7 +378,6 @@
 	- $(TESTJAVA) -jar $(JAVADOC_JAR) -version
 	$(TESTJAVA) -jar $(JAVAH_JAR) -version
 	- $(TESTJAVA) -jar $(JAVAP_JAR) -version
-	$(TESTJAVA) -jar $(APT_JAR) -version
 
 #-----
 
--- a/make/build.properties	Mon Jul 11 22:31:52 2011 +0100
+++ b/make/build.properties	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -159,15 +159,6 @@
 
 #
 
-apt.includes = \
-        com/sun/mirror/ \
-        com/sun/tools/apt/
-
-apt.tests = \
-        tools/apt/
-
-#
-
 # The following files require the latest JDK to be available.
 # The API can be provided by using a suitable boot.java.home
 # or by setting import.jdk
@@ -196,3 +187,7 @@
 # An empty value means all tests
 # Override as desired to run a specific set of tests
 jtreg.tests =
+
+# Check style configuration
+# overridable name and version
+checkstyle.name.version = checkstyle-5.4
--- a/make/build.xml	Mon Jul 11 22:31:52 2011 +0100
+++ b/make/build.xml	Tue May 29 00:27:58 2012 +0100
@@ -83,7 +83,7 @@
  - global property definitions
  - general top level targets
  - general diagnostic/debugging targets
- - groups of targets for each tool: javac, javadoc, doclets, javah, javap, apt
+ - groups of targets for each tool: javac, javadoc, doclets, javah, javap
     Within each group, the following targets are provided, where applicable
       build-bootstrap-TOOL      build the bootstrap version of the tool
       build-classes-TOOL        build the classes for the tool
@@ -131,8 +131,10 @@
     <property name="dist.bin.dir" location="${dist.dir}/bin"/>
     <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
     <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
+    <property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/>
     <property name="dist.lib.dir" location="${dist.dir}/lib"/>
     <property name="make.dir" location="make"/>
+    <property name="make.conf.dir" location="${make.dir}/conf"/>
     <property name="make.tools.dir" location="${make.dir}/tools"/>
     <property name="src.dir" location="src"/>
     <property name="src.bin.dir" location="${src.dir}/share/bin"/>
@@ -243,11 +245,11 @@
     />
 
     <target name="build-all-tools"
-        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"
+        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap"
     />
 
     <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
-        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${apt.includes}"/>
+        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes}"/>
     </target>
 
     <!-- clean -->
@@ -263,6 +265,41 @@
         <jtreg-tool name="all" tests="${jtreg.tests}"/>
     </target>
 
+    <target name="checkstyle" depends="-def-checkstyle"
+        description="Generates reports for code convention violations.">
+        <mkdir dir="${dist.checkstyle.dir}"/>
+        <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml"
+              failureProperty="checkstyle.failure"
+              failOnViolation="false">
+            <formatter type="xml" tofile="${dist.checkstyle.dir}/checkstyle_report.xml"/>
+            <fileset dir="src" includes="**/*.java, **/*.properties"/>
+        </checkstyle>
+        <!-- transform the output to a simple html -->
+        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
+               out="${dist.checkstyle.dir}/checkstyle_report.html"
+               style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>            
+        <!-- transform the output to a very simple emacs friendly text file -->
+        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
+               out="${dist.checkstyle.dir}/checkstyle_report.tmp"
+               style="${make.conf.dir}/checkstyle-emacs.xsl"/>
+        <!-- beautify remove extra lines -->
+        <move file="${dist.checkstyle.dir}/checkstyle_report.tmp"
+             toFile="${dist.checkstyle.dir}/checkstyle_report.emacs.txt">
+            <filterchain>
+                <ignoreblank/>
+                <replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/>
+            </filterchain>
+        </move>
+    </target>
+    <!-- target can be invoked from an ide, the output of which can be used
+         to access and fix the errors directly.
+     -->
+    <target name="checkstyle-ide" depends="checkstyle">
+        <concat>
+            <fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/>
+        </concat>  
+    </target>
+    
     <target name="findbugs" depends="-def-findbugs,build-all-tools">
         <property name="findbugs.reportLevel" value="medium"/>
         <mkdir dir="${dist.findbugs.dir}"/>
@@ -406,6 +443,7 @@
         <echo level="info">target.java.home = ${target.java.home}</echo>
         <echo level="info">jtreg.home = ${jtreg.home}</echo>
         <echo level="info">findbugs.home = ${findbugs.home}</echo>
+        <echo level="info">checkstyle.home = ${checkstyle.home}</echo>
     </target>
 
     <target name="post-sanity" depends="-def-jtreg,sanity,build"
@@ -619,42 +657,6 @@
 
 
     <!--
-    **** apt targets.
-    -->
-
-    <target name="build-bootstrap-apt" depends="build-bootstrap-javac">
-        <build-bootstrap-classes includes="${apt.includes}"/>
-        <build-bootstrap-jar     name="apt" includes="${apt.includes}"
-                                 jarclasspath="javac.jar"/>
-        <build-bootstrap-tool    name="apt"/>
-    </target>
-
-    <target name="build-apt" depends="build-javac,build-classes-apt">
-        <build-jar  name="apt" includes="${apt.includes}" jarclasspath="javac.jar"/>
-        <build-tool name="apt"/>
-    </target>
-
-    <target name="build-classes-apt" depends="build-classes-javac">
-        <build-classes includes="${apt.includes}"/>
-    </target>
-
-    <target name="javadoc-apt" depends="build-apt,-def-javadoc-tool">
-        <javadoc-tool name="apt" includes="${apt.includes}"/>
-    </target>
-
-
-    <target name="jtreg-apt" depends="build-apt,-def-jtreg">
-        <jtreg-tool name="apt" tests="${apt.tests}"/>
-    </target>
-
-    <target name="findbugs-apt" depends="build-apt,-def-findbugs">
-        <findbugs-tool name="apt"/>
-    </target>
-
-    <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/>
-
-
-    <!--
     **** Create import JDK stubs.
     -->
 
@@ -690,6 +692,10 @@
         <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
     </target>
 
+    <target name="-check-checkstyle.home" depends="-def-check">
+        <check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>
+    </target>
+    
     <target name="-check-jtreg.home" depends="-def-check">
         <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
     </target>
@@ -856,7 +862,8 @@
                source="${boot.javac.source}"
                target="${boot.javac.target}"
                executable="${boot.java.home}/bin/javac"
-               srcdir="${make.tools.dir}/CompileProperties"
+               srcdir="${make.tools.dir}"
+               includes="compileproperties/* anttasks/CompileProperties*"
                destdir="${build.toolclasses.dir}/"
                classpath="${ant.core.lib}"
                bootclasspath="${boot.java.home}/jre/lib/rt.jar"
@@ -864,7 +871,7 @@
             <compilerarg line="${javac.lint.opts}"/>
         </javac>
         <taskdef name="pcompile"
-                 classname="CompilePropertiesTask"
+                 classname="anttasks.CompilePropertiesTask"
                  classpath="${build.toolclasses.dir}/"/>
     </target>
 
@@ -874,7 +881,8 @@
                source="${boot.javac.source}"
                target="${boot.javac.target}"
                executable="${boot.java.home}/bin/javac"
-               srcdir="${make.tools.dir}/GenStubs"
+               srcdir="${make.tools.dir}"
+               includes="genstubs/* anttasks/GenStubs*"
                destdir="${build.toolclasses.dir}/"
                classpath="${ant.core.lib}"
                includeantruntime="false">
@@ -882,7 +890,7 @@
             <compilerarg line="${javac.lint.opts}"/>
         </javac>
         <taskdef name="genstubs"
-                 classname="GenStubs$$Ant"
+                 classname="anttasks.GenStubsTask"
                  classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"/>
     </target>
 
@@ -925,7 +933,6 @@
                             <filename name="java/"/>
                             <filename name="javax/"/>
                             <filename name="com/sun/javadoc/"/>
-                            <filename name="com/sun/mirror/"/>
                             <filename name="com/sun/source/"/>
                         </or>
                     </packageset>
@@ -963,7 +970,7 @@
                     samevm="@{samevm}" verbose="@{verbose}"
                     failonerror="false" resultproperty="jtreg.@{name}.result"
                     javacoptions="-g"
-                    vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}:${build.classes.dir} @{jpda.jvmargs}">
+                    vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}${build.classes.dir} @{jpda.jvmargs}">
                     <arg line="@{keywords}"/>
                     <arg line="@{options}"/>
                     <arg line="@{tests}"/>
@@ -989,6 +996,16 @@
         <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
     </target>
 
+    <target name="-def-checkstyle" unless="checkstyle.defined"
+        depends="-check-checkstyle.home">
+        <taskdef resource="checkstyletask.properties">
+            <classpath>
+                <pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/>
+            </classpath>
+        </taskdef>
+        <property name="checkstyle.defined" value="true"/>
+    </target>
+    
     <target name="-def-findbugs" unless="findbugs.defined"
         depends="-check-findbugs.home,-check-target.java.home">
         <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/conf/checkstyle-emacs.xsl	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" omit-xml-declaration="yes"/>
+
+<xsl:template match="/">
+Coding Style Check Results
+--------------------------
+Total files checked: <xsl:number level="any" value="count(descendant::file)"/>
+  Files with errors: <xsl:number level="any" value="count(descendant::file[error])"/>
+       Total errors: <xsl:number level="any" value="count(descendant::error)"/>
+    Errors per file: <xsl:number level="any" value="count(descendant::error) div count(descendant::file)"/>
+<xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="file[error]">
+<xsl:apply-templates select="error"/>
+</xsl:template>
+
+<xsl:template match="error">
+<xsl:value-of select="../@name"/>:<xsl:value-of select="@line"/><xsl:text>: </xsl:text><xsl:value-of select="@message"/><xsl:text>
+</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/conf/checkstyle-langtools.xml	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+   Checks for initial langtools code conventions, we are starting with
+   imports and import orders and this will grow to encompass other
+   violations over time. 
+-->
+
+<module name="Checker">
+    
+    <!-- Checks for whitespace. -->
+    <module name="FileTabCharacter">
+        <property name="fileExtensions" value=".java"/>
+    </module>
+
+    <!-- Miscellaneous other checks.                   -->
+    <module name="RegexpSingleline">
+        <property name="format" value="\s+$"/>
+        <property name="minimum" value="0"/>
+        <property name="maximum" value="0"/>
+        <property name="message" value="Line has trailing spaces."/>
+        <property name="fileExtensions" value=".java .html"/>
+    </module>
+
+    <module name="TreeWalker">
+    <!-- Checks for imports                              -->
+    <!--
+        <module name="AvoidStarImport"/>
+        <module name="IllegalImport"/>
+    -->
+        <module name="GenericWhitespace"/>
+        <module name="RedundantImport"/>
+        <module name="UnusedImports"/>  
+        <module name="ImportOrder">
+            <property name="groups" value="java, javax, org, com"/>
+            <property name="ordered" value="true"/>
+            <property name="separated" value="true"/>
+        </module>        
+        <module name="EmptyForInitializerPad">
+            <property name="option" value="space"/>
+        </module>
+        <module name="WhitespaceAfter"/>
+    </module>
+</module>
\ No newline at end of file
--- a/make/jprt.properties	Mon Jul 11 22:31:52 2011 +0100
+++ b/make/jprt.properties	Tue May 29 00:27:58 2012 +0100
@@ -25,12 +25,55 @@
 
 # Properties for jprt
 
-# Use whatever release that the submitted job requests
-jprt.tools.default.release=${jprt.submit.release}
+# Locked down to jdk8
+jprt.tools.default.release=jdk8
 
 # The different build flavors we want, we override here so we just get these 2
 jprt.build.flavors=product,fastdebug
 
+# Standard list of jprt build targets for this source tree
+jprt.build.targets=                                             \
+    solaris_sparc_5.10-{product|fastdebug},                     \
+    solaris_sparcv9_5.10-{product|fastdebug},                   \
+    solaris_i586_5.10-{product|fastdebug},                      \
+    solaris_x64_5.10-{product|fastdebug},                       \
+    linux_i586_2.6-{product|fastdebug},                         \
+    linux_x64_2.6-{product|fastdebug},                          \
+    macosx_x64_10.7-{product|fastdebug},                        \
+    windows_i586_5.1-{product|fastdebug},                       \
+    windows_x64_5.2-{product|fastdebug}
+
+# Test target list (no fastdebug & limited c2 testing)
+jprt.my.test.target.set= 					\
+    solaris_sparc_5.10-product-c1-TESTNAME,                     \
+    solaris_sparcv9_5.10-product-c2-TESTNAME,                   \
+    solaris_i586_5.10-product-c1-TESTNAME,                      \
+    solaris_x64_5.10-product-c2-TESTNAME,                       \
+    linux_i586_2.6-product-{c1|c2}-TESTNAME,                    \
+    linux_x64_2.6-product-c2-TESTNAME,                          \
+    macosx_x64_10.7-product-c2-TESTNAME,                        \
+    windows_i586_5.1-product-c1-TESTNAME,                       \
+    windows_x64_5.2-product-c2-TESTNAME
+
+# Default test targets
+jprt.make.rule.test.targets=					\
+    ${jprt.my.test.target.set:TESTNAME=jtreg}
+
 # Directories to be excluded from the source bundles
 jprt.bundle.exclude.src.dirs=build dist webrev
 
+# Test target list (no fastdebug & limited c2 testing)
+jprt.my.test.target.set= 					\
+    solaris_sparc_5.10-product-c1-TESTNAME,                     \
+    solaris_sparcv9_5.10-product-c2-TESTNAME,                   \
+    solaris_i586_5.10-product-c1-TESTNAME,                      \
+    solaris_x64_5.10-product-c2-TESTNAME,                       \
+    linux_i586_2.6-product-{c1|c2}-TESTNAME,                    \
+    linux_x64_2.6-product-c2-TESTNAME,                          \
+    macosx_x64_10.7-product-c2-TESTNAME,                        \
+    windows_i586_5.1-product-c1-TESTNAME,                       \
+    windows_x64_5.2-product-c2-TESTNAME
+
+# Default test targets
+jprt.make.rule.test.targets=					\
+    ${jprt.my.test.target.set:TESTNAME=jtreg}
--- a/make/netbeans/README	Mon Jul 11 22:31:52 2011 +0100
+++ b/make/netbeans/README	Tue May 29 00:27:58 2012 +0100
@@ -7,7 +7,7 @@
 repository.
 
 The repository contains a number of tools:
-    apt, javac, javadoc and its doclets, javah and javap.
+    javac, javadoc and its doclets, javah and javap.
 
 Build Properties.
 
--- a/make/netbeans/langtools/build.xml	Mon Jul 11 22:31:52 2011 +0100
+++ b/make/netbeans/langtools/build.xml	Tue May 29 00:27:58 2012 +0100
@@ -261,7 +261,8 @@
 
     <target name="-def-select-tool">
         <mkdir dir="${build.toolclasses.dir}"/>
-        <javac srcdir="${make.tools.dir}/SelectTool"
+        <javac srcdir="${make.tools.dir}"
+               includes="anttasks/SelectTool*"
                destdir="${build.toolclasses.dir}/"
                classpath="${ant.core.lib}"
                includeantruntime="false"
@@ -270,7 +271,7 @@
                    <compilerarg line="-Xlint"/>
         </javac>
         <taskdef name="select-tool"
-                 classname="SelectToolTask"
+                 classname="anttasks.SelectToolTask"
                  classpath="${build.toolclasses.dir}/"/>
     </target>
 
--- a/make/test/lib/apt.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @summary Verify the basic execution of the apt classes in classes.jar.
-
-TESTSRC=${TESTSRC:-.}
-TOPDIR=${TESTSRC}/../../..
-TESTJAVAEXE="${TESTJAVA:+${TESTJAVA}/bin/}java"
-
-"${TESTJAVAEXE}" -Xbootclasspath/p:${TOPDIR}/dist/lib/classes.jar \
-    com.sun.tools.apt.Main \
-    -print "${TESTSRC}"/../HelloWorld.java > apt.tmp
-
-if diff ${TESTSRC}/../HelloWorld.apt.gold.txt apt.tmp ; then
-    echo "Test passed."
-else
-    echo "Test failed."
-    exit 1
-fi
--- a/make/test/lib/src.gold.txt	Mon Jul 11 22:31:52 2011 +0100
+++ b/make/test/lib/src.gold.txt	Tue May 29 00:27:58 2012 +0100
@@ -1,14 +1,4 @@
 com/sun/javadoc/package.html
-com/sun/mirror/apt/package.html
-com/sun/mirror/declaration/package.html
-com/sun/mirror/overview.html
-com/sun/mirror/type/package.html
-com/sun/mirror/util/package.html
-com/sun/tools/apt/Main.java
-com/sun/tools/apt/main/Main.java
-com/sun/tools/apt/resources/apt.properties
-com/sun/tools/apt/resources/apt_ja.properties
-com/sun/tools/apt/resources/apt_zh_CN.properties
 com/sun/tools/doclets/formats/html/markup/package.html
 com/sun/tools/doclets/formats/html/package.html
 com/sun/tools/doclets/formats/html/resources/standard.properties
--- a/make/tools/CompileProperties/CompileProperties.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,402 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-/** Translates a .properties file into a .java file containing the
- *  definition of a java.util.Properties subclass which can then be
- *  compiled with javac. <P>
- *
- *  Usage: java CompileProperties [path to .properties file] [path to .java file to be output] [super class]
- *
- *  Infers the package by looking at the common suffix of the two
- *  inputs, eliminating "classes" from it.
- *
- * @author Scott Violet
- * @author Kenneth Russell
- */
-
-public class CompileProperties {
-
-    public static void main(String[] args) {
-        CompileProperties cp = new CompileProperties();
-        boolean ok = cp.run(args);
-        if ( !ok ) {
-            System.exit(1);
-        }
-    }
-
-    static interface Log {
-        void info(String msg);
-        void verbose(String msg);
-        void error(String msg, Exception e);
-    }
-
-    private String propfiles[];
-    private String outfiles[] ;
-    private String supers[]   ;
-    private int compileCount = 0;
-    private boolean quiet = false;
-    private Log log;
-
-    public void setLog(Log log) {
-        this.log = log;
-    }
-
-    public boolean run(String[] args) {
-        if (log == null) {
-            log = new Log() {
-                public void error(String msg, Exception e) {
-                    System.err.println("ERROR: CompileProperties: " + msg);
-                    if ( e != null ) {
-                        System.err.println("EXCEPTION: " + e.toString());
-                        e.printStackTrace();
-                    }
-                }
-                public void info(String msg) {
-                    System.out.println(msg);
-                }
-                public void verbose(String msg) {
-                    if (!quiet)
-                        System.out.println(msg);
-                }
-            };
-        }
-
-        boolean ok = true;
-        /* Original usage */
-        if (args.length == 2 && args[0].charAt(0) != '-' ) {
-            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) {
-            usage(log);
-            ok = false;
-        } else {
-            /* New batch usage */
-            ok = parseOptions(args);
-            if ( ok && compileCount == 0 ) {
-                log.error("options parsed but no files to compile", null);
-                ok = false;
-            }
-            /* Need at least one file. */
-            if ( !ok ) {
-                usage(log);
-            } else {
-                /* Process files */
-                for ( int i = 0; i < compileCount && ok ; i++ ) {
-                    ok = createFile(propfiles[i], outfiles[i], supers[i]);
-                }
-            }
-        }
-        return ok;
-    }
-
-    private boolean parseOptions(String args[]) {
-        boolean ok = true;
-        if ( compileCount > 0 ) {
-            String new_propfiles[] = new String[compileCount + args.length];
-            String new_outfiles[]  = new String[compileCount + args.length];
-            String new_supers[]    = new String[compileCount + args.length];
-            System.arraycopy(propfiles, 0, new_propfiles, 0, compileCount);
-            System.arraycopy(outfiles, 0, new_outfiles, 0, compileCount);
-            System.arraycopy(supers, 0, new_supers, 0, compileCount);
-            propfiles = new_propfiles;
-            outfiles  = new_outfiles;
-            supers    = new_supers;
-        } else {
-            propfiles = new String[args.length];
-            outfiles  = new String[args.length];
-            supers    = new String[args.length];
-        }
-
-        for ( int i = 0; i < args.length ; i++ ) {
-            if ( "-compile".equals(args[i]) && i+3 < args.length ) {
-                propfiles[compileCount] = args[++i];
-                outfiles[compileCount]  = args[++i];
-                supers[compileCount]    = args[++i];
-                compileCount++;
-            } else if ( "-optionsfile".equals(args[i]) && i+1 < args.length ) {
-                String filename = args[++i];
-                FileInputStream finput = null;
-                byte contents[] = null;
-                try {
-                    finput = new FileInputStream(filename);
-                    int byteCount = finput.available();
-                    if ( byteCount <= 0 ) {
-                        log.error("The -optionsfile file is empty", null);
-                        ok = false;
-                    } else {
-                        contents = new byte[byteCount];
-                        int bytesRead = finput.read(contents);
-                        if ( byteCount != bytesRead ) {
-                            log.error("Cannot read all of -optionsfile file", null);
-                            ok = false;
-                        }
-                    }
-                } catch ( IOException e ) {
-                    log.error("cannot open " + filename, e);
-                    ok = false;
-                }
-                if ( finput != null ) {
-                    try {
-                        finput.close();
-                    } catch ( IOException e ) {
-                        ok = false;
-                        log.error("cannot close " + filename, e);
-                    }
-                }
-                if ( ok = true && contents != null ) {
-                    String tokens[] = (new String(contents)).split("\\s+");
-                    if ( tokens.length > 0 ) {
-                        ok = parseOptions(tokens);
-                    }
-                }
-                if ( !ok ) {
-                    break;
-                }
-            } else if ( "-quiet".equals(args[i]) ) {
-                quiet = true;
-            } else {
-                log.error("argument error", null);
-                ok = false;
-            }
-        }
-        return ok;
-    }
-
-    private boolean createFile(String propertiesPath, String outputPath,
-            String superClass) {
-        boolean ok = true;
-        log.verbose("parsing: " + propertiesPath);
-        Properties p = new Properties();
-        try {
-            p.load(new FileInputStream(propertiesPath));
-        } catch ( FileNotFoundException e ) {
-            ok = false;
-            log.error("Cannot find file " + propertiesPath, e);
-        } catch ( IOException e ) {
-            ok = false;
-            log.error("IO error on file " + propertiesPath, e);
-        }
-        if ( ok ) {
-            String packageName = inferPackageName(propertiesPath, outputPath);
-            log.verbose("inferred package name: " + packageName);
-            List<String> sortedKeys = new ArrayList<String>();
-            for ( Object key : p.keySet() ) {
-                sortedKeys.add((String)key);
-            }
-            Collections.sort(sortedKeys);
-            Iterator<String> keys = sortedKeys.iterator();
-
-            StringBuffer data = new StringBuffer();
-
-            while (keys.hasNext()) {
-                String key = keys.next();
-                data.append("            { \"" + escape(key) + "\", \"" +
-                        escape((String)p.get(key)) + "\" },\n");
-            }
-
-            // Get class name from java filename, not the properties filename.
-            //   (zh_TW properties might be used to create zh_HK files)
-            File file = new File(outputPath);
-            String name = file.getName();
-            int dotIndex = name.lastIndexOf('.');
-            String className;
-            if (dotIndex == -1) {
-                className = name;
-            } else {
-                className = name.substring(0, dotIndex);
-            }
-
-            String packageString = "";
-            if (packageName != null && !packageName.equals("")) {
-                packageString = "package " + packageName + ";\n\n";
-            }
-
-            Writer writer = null;
-            try {
-                writer = new BufferedWriter(
-                        new OutputStreamWriter(new FileOutputStream(outputPath), "8859_1"));
-                MessageFormat format = new MessageFormat(FORMAT);
-                writer.write(format.format(new Object[] { packageString, className, superClass, data }));
-            } catch ( IOException e ) {
-                ok = false;
-                log.error("IO error writing to file " + outputPath, e);
-            }
-            if ( writer != null ) {
-                try {
-                    writer.flush();
-                } catch ( IOException e ) {
-                    ok = false;
-                    log.error("IO error flush " + outputPath, e);
-                }
-                try {
-                    writer.close();
-                } catch ( IOException e ) {
-                    ok = false;
-                    log.error("IO error close " + outputPath, e);
-                }
-            }
-            log.verbose("wrote: " + outputPath);
-        }
-        return ok;
-    }
-
-    private static void usage(Log log) {
-        log.info("usage:");
-        log.info("    java CompileProperties path_to_properties_file path_to_java_output_file [super_class]");
-        log.info("      -OR-");
-        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 java.util.ListResourceBundle");
-        log.info("    java CompileProperties -optionsfile option_file");
-        log.info("option_file contains: -compile test.properties test.java java.util.ListResourceBundle");
-    }
-
-    private static String escape(String theString) {
-        // This is taken from Properties.saveConvert with changes for Java strings
-        int len = theString.length();
-        StringBuffer outBuffer = new StringBuffer(len*2);
-
-        for(int x=0; x<len; x++) {
-            char aChar = theString.charAt(x);
-            switch(aChar) {
-                case '\\':outBuffer.append('\\'); outBuffer.append('\\');
-                break;
-                case '\t':outBuffer.append('\\'); outBuffer.append('t');
-                break;
-                case '\n':outBuffer.append('\\'); outBuffer.append('n');
-                break;
-                case '\r':outBuffer.append('\\'); outBuffer.append('r');
-                break;
-                case '\f':outBuffer.append('\\'); outBuffer.append('f');
-                break;
-                default:
-                    if ((aChar < 0x0020) || (aChar > 0x007e)) {
-                        outBuffer.append('\\');
-                        outBuffer.append('u');
-                        outBuffer.append(toHex((aChar >> 12) & 0xF));
-                        outBuffer.append(toHex((aChar >>  8) & 0xF));
-                        outBuffer.append(toHex((aChar >>  4) & 0xF));
-                        outBuffer.append(toHex( aChar        & 0xF));
-                    } else {
-                        if (specialSaveChars.indexOf(aChar) != -1) {
-                            outBuffer.append('\\');
-                        }
-                        outBuffer.append(aChar);
-                    }
-            }
-        }
-        return outBuffer.toString();
-    }
-
-    private static String inferPackageName(String inputPath, String outputPath) {
-        // Normalize file names
-        inputPath  = new File(inputPath).getPath();
-        outputPath = new File(outputPath).getPath();
-        // Split into components
-        String sep;
-        if (File.separatorChar == '\\') {
-            sep = "\\\\";
-        } else {
-            sep = File.separator;
-        }
-        String[] inputs  = inputPath.split(sep);
-        String[] outputs = outputPath.split(sep);
-        // Match common names, eliminating first "classes" entry from
-        // each if present
-        int inStart  = 0;
-        int inEnd    = inputs.length - 2;
-        int outEnd   = outputs.length - 2;
-        int i = inEnd;
-        int j = outEnd;
-        while (i >= 0 && j >= 0) {
-            if (!inputs[i].equals(outputs[j]) ||
-                    (inputs[i].equals("gensrc") && inputs[j].equals("gensrc"))) {
-                ++i;
-                ++j;
-                break;
-            }
-            --i;
-            --j;
-        }
-        String result;
-        if (i < 0 || j < 0 || i >= inEnd || j >= outEnd) {
-            result = "";
-        } else {
-            if (inputs[i].equals("classes") && outputs[j].equals("classes")) {
-                ++i;
-            }
-            inStart = i;
-            StringBuffer buf = new StringBuffer();
-            for (i = inStart; i <= inEnd; i++) {
-                buf.append(inputs[i]);
-                if (i < inEnd) {
-                    buf.append('.');
-                }
-            }
-            result = buf.toString();
-        }
-        return result;
-    }
-
-    private static final String FORMAT =
-            "{0}" +
-            "public final class {1} extends {2} '{'\n" +
-            "    protected final Object[][] getContents() '{'\n" +
-            "        return new Object[][] '{'\n" +
-            "{3}" +
-            "        };\n" +
-            "    }\n" +
-            "}\n";
-
-    // This comes from Properties
-    private static char toHex(int nibble) {
-        return hexDigit[(nibble & 0xF)];
-    }
-
-    // This comes from Properties
-    private static final char[] hexDigit = {
-        '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
-    };
-
-    // Note: different from that in Properties
-    private static final String specialSaveChars = "\"";
-}
--- a/make/tools/CompileProperties/CompilePropertiesTask.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-
-public class CompilePropertiesTask extends MatchingTask {
-    public void setSrcDir(File srcDir) {
-        this.srcDir = srcDir;
-    }
-
-    public void setDestDir(File destDir) {
-        this.destDir = destDir;
-    }
-
-    public void setSuperclass(String superclass) {
-        this.superclass = superclass;
-    }
-
-    @Override
-    public void execute() {
-        CompileProperties.Log log = new CompileProperties.Log() {
-            public void error(String msg, Exception e) {
-                log(msg, Project.MSG_ERR);
-            }
-            public void info(String msg) {
-                log(msg, Project.MSG_INFO);
-            }
-            public void verbose(String msg) {
-                log(msg, Project.MSG_VERBOSE);
-            }
-        };
-        List<String> mainOpts = new ArrayList<String>();
-        int count = 0;
-        DirectoryScanner s = getDirectoryScanner(srcDir);
-        for (String path: s.getIncludedFiles()) {
-            if (path.endsWith(".properties")) {
-                String destPath =
-                        path.substring(0, path.length() - ".properties".length()) +
-                        ".java";
-                File srcFile = new File(srcDir, path);
-                File destFile = new File(destDir, destPath);
-                // Arguably, the comparison in the next line should be ">", not ">="
-                // but that assumes the resolution of the last modified time is fine
-                // grained enough; in practice, it is better to use ">=".
-                if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified())
-                    continue;
-                destFile.getParentFile().mkdirs();
-                mainOpts.add("-compile");
-                mainOpts.add(srcFile.getPath());
-                mainOpts.add(destFile.getPath());
-                mainOpts.add(superclass);
-                count++;
-            }
-        }
-        if (mainOpts.size() > 0) {
-            log("Generating " + count + " resource files to " + destDir, Project.MSG_INFO);
-            CompileProperties cp = new CompileProperties();
-            cp.setLog(log);
-            boolean ok = cp.run(mainOpts.toArray(new String[mainOpts.size()]));
-            if (!ok)
-                throw new BuildException("CompileProperties failed.");
-        }
-    }
-
-    private File srcDir;
-    private File destDir;
-    private String superclass = "java.util.ListResourceBundle";
-}
--- a/make/tools/GenStubs/GenStubs.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,448 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-import java.util.*;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.Reference;
-
-
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.util.JavacTask;
-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.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.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.
- *
- * This is a special purpose stub generator, specific to the needs of generating
- * stub files for JDK 7 API that are needed to compile langtools files that depend
- * on that API. The stub generator works by removing as much of the API source code
- * as possible without affecting the public signature, in order to reduce the
- * transitive closure of the API being referenced. The resulting stubs can be
- * put on the langtools sourcepath with -implicit:none to compile the langtools
- * files that depend on the JDK 7 API.
- *
- * Usage:
- *  genstubs -s <outdir> -sourcepath <path> <classnames>
- *
- * The specified class names are looked up on the sourcepath, and corresponding
- * stubs are written to the source output directory.
- *
- * Classes are parsed into javac ASTs, then processed with a javac TreeTranslator
- * to remove implementation details, and written out in the source output directory.
- * Documentation comments and annotations are removed. Method bodies are removed
- * and methods are marked native. Private and package-private field definitions
- * have their initializers replace with 0, 0.0, false, null as appropriate.
- *
- * An Ant task, Main$Ant is also provided. Files are specified with an implicit
- * fileset, using srcdir as a base directory. The set of files to be included
- * is specified with an includes attribute or nested <includes> set. However,
- * unlike a normal fileset, an empty includes attribute means "no files" instead
- * of "all files".  The Ant task also accepts "fork=true" and classpath attribute
- * or nested <classpath> element to run GenStubs in a separate VM with the specified
- * path. This is likely necessary if a JDK 7 parser is required to read the
- * JDK 7 input files.
- */
-
-public class GenStubs {
-    static class Fault extends Exception {
-        private static final long serialVersionUID = 0;
-        Fault(String message) {
-            super(message);
-        }
-        Fault(String message, Throwable cause) {
-            super(message);
-            initCause(cause);
-        }
-    }
-
-    public static void main(String[] args) {
-        boolean ok = new GenStubs().run(args);
-        if (!ok)
-            System.exit(1);
-    }
-
-    boolean run(String... args) {
-        File outdir = null;
-        String sourcepath = null;
-        List<String> classes = new ArrayList<String>();
-        for (ListIterator<String> iter = Arrays.asList(args).listIterator(); iter.hasNext(); ) {
-            String arg = iter.next();
-            if (arg.equals("-s") && iter.hasNext())
-                outdir = new File(iter.next());
-            else if (arg.equals("-sourcepath") && iter.hasNext())
-                sourcepath = iter.next();
-            else if (arg.startsWith("-"))
-                throw new IllegalArgumentException(arg);
-            else {
-                classes.add(arg);
-                while (iter.hasNext())
-                    classes.add(iter.next());
-            }
-        }
-
-        return run(sourcepath, outdir, classes);
-    }
-
-    boolean run(String sourcepath, File outdir, List<String> classes) {
-        //System.err.println("run: sourcepath:" + sourcepath + " outdir:" + outdir + " classes:" + classes);
-        if (sourcepath == null)
-            throw new IllegalArgumentException("sourcepath not set");
-        if (outdir == null)
-            throw new IllegalArgumentException("source output dir not set");
-
-        JavacTool tool = JavacTool.create();
-        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
-
-        try {
-            fm.setLocation(StandardLocation.SOURCE_OUTPUT, Collections.singleton(outdir));
-            fm.setLocation(StandardLocation.SOURCE_PATH, splitPath(sourcepath));
-            List<JavaFileObject> files = new ArrayList<JavaFileObject>();
-            for (String c: classes) {
-                JavaFileObject fo = fm.getJavaFileForInput(
-                        StandardLocation.SOURCE_PATH, c, JavaFileObject.Kind.SOURCE);
-                if (fo == null)
-                    error("class not found: " + c);
-                else
-                    files.add(fo);
-            }
-
-            JavacTask t = tool.getTask(null, fm, null, null, null, files);
-            Iterable<? extends CompilationUnitTree> trees = t.parse();
-            for (CompilationUnitTree tree: trees) {
-                makeStub(fm, tree);
-            }
-        } catch (IOException e) {
-            error("IO error " + e, e);
-        }
-
-        return (errors == 0);
-    }
-
-    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,
-                className, JavaFileObject.Kind.SOURCE, null);
-        // System.err.println("Writing " + className + " to " + fo.getName());
-        Writer out = fo.openWriter();
-        try {
-            new Pretty(out, true).printExpr((JCTree) tree3);
-        } finally {
-            out.close();
-        }
-    }
-
-    List<File> splitPath(String path) {
-        List<File> list = new ArrayList<File>();
-        for (String p: path.split(File.pathSeparator)) {
-            if (p.length() > 0)
-                list.add(new File(p));
-        }
-        return list;
-    }
-
-    void error(String message) {
-        System.err.println(message);
-        errors++;
-    }
-
-    void error(String message, Throwable cause) {
-        error(message);
-    }
-
-    int errors;
-
-    class StubMaker extends TreeTranslator {
-        CompilationUnitTree translate(CompilationUnitTree tree) {
-            return super.translate((JCCompilationUnit) tree);
-        }
-
-        /**
-         * compilation units: remove javadoc comments
-         * -- required, in order to remove @deprecated tags, since we
-         * (separately) remove all annotations, including @Deprecated
-         */
-        public void visitTopLevel(JCCompilationUnit tree) {
-            super.visitTopLevel(tree);
-            tree.docComments = Collections.emptyMap();
-        }
-
-        /**
-         * methods: remove method bodies, make methods native
-         */
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            tree.mods = translate(tree.mods);
-            tree.restype = translate(tree.restype);
-            tree.typarams = translateTypeParams(tree.typarams);
-            tree.params = translateVarDefs(tree.params);
-            tree.thrown = translate(tree.thrown);
-            if (tree.restype != null && tree.body != null) {
-                tree.mods.flags |= Flags.NATIVE;
-                tree.body = null;
-            }
-            result = tree;
-        }
-
-        /**
-         * modifiers: remove annotations
-         */
-        @Override
-        public void visitModifiers(JCModifiers tree) {
-            tree.annotations = com.sun.tools.javac.util.List.nil();
-            result = tree;
-        }
-
-        /**
-         * field definitions: replace initializers with 0, 0.0, false etc
-         * when possible -- i.e. leave public, protected initializers alone
-         */
-        @Override
-        public void visitVarDef(JCVariableDecl tree) {
-            tree.mods = translate(tree.mods);
-            tree.vartype = translate(tree.vartype);
-            if (tree.init != null) {
-                if ((tree.mods.flags & (Flags.PUBLIC | Flags.PROTECTED)) != 0)
-                    tree.init = translate(tree.init);
-                else {
-                    String t = tree.vartype.toString();
-                    if (t.equals("boolean"))
-                        tree.init = new JCLiteral(TypeTags.BOOLEAN, 0) { };
-                    else if (t.equals("byte"))
-                        tree.init = new JCLiteral(TypeTags.BYTE, 0) { };
-                    else if (t.equals("char"))
-                        tree.init = new JCLiteral(TypeTags.CHAR, 0) { };
-                    else if (t.equals("double"))
-                        tree.init = new JCLiteral(TypeTags.DOUBLE, 0.d) { };
-                    else if (t.equals("float"))
-                        tree.init = new JCLiteral(TypeTags.FLOAT, 0.f) { };
-                    else if (t.equals("int"))
-                        tree.init = new JCLiteral(TypeTags.INT, 0) { };
-                    else if (t.equals("long"))
-                        tree.init = new JCLiteral(TypeTags.LONG, 0) { };
-                    else if (t.equals("short"))
-                        tree.init = new JCLiteral(TypeTags.SHORT, 0) { };
-                    else
-                        tree.init = new JCLiteral(TypeTags.BOT, null) { };
-                }
-            }
-            result = tree;
-        }
-    }
-
-    class ImportCleaner extends TreeScanner {
-        private Set<Name> names = new HashSet<Name>();
-        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<JCTree> defs = new ListBuffer<JCTree>();
-            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 {
-        private File srcDir;
-        private File destDir;
-        private boolean fork;
-        private Path classpath;
-        private String includes;
-
-        public void setSrcDir(File dir) {
-            this.srcDir = dir;
-        }
-
-        public void setDestDir(File dir) {
-            this.destDir = dir;
-        }
-
-        public void setFork(boolean v) {
-            this.fork = v;
-        }
-
-        public void setClasspath(Path cp) {
-            if (classpath == null)
-                classpath = cp;
-            else
-                classpath.append(cp);
-        }
-
-        public Path createClasspath() {
-            if (classpath == null) {
-                classpath = new Path(getProject());
-            }
-            return classpath.createPath();
-        }
-
-        public void setClasspathRef(Reference r) {
-            createClasspath().setRefid(r);
-        }
-
-        public void setIncludes(String includes) {
-            super.setIncludes(includes);
-            this.includes = includes;
-        }
-
-        @Override
-        public void execute() {
-            if (includes != null && includes.trim().isEmpty())
-                return;
-
-            DirectoryScanner s = getDirectoryScanner(srcDir);
-            String[] files = s.getIncludedFiles();
-//            System.err.println("Ant.execute: srcDir " + srcDir);
-//            System.err.println("Ant.execute: destDir " + destDir);
-//            System.err.println("Ant.execute: files " + Arrays.asList(files));
-
-            files = filter(srcDir, destDir, files);
-            if (files.length == 0)
-                return;
-            System.out.println("Generating " + files.length + " stub files to " + destDir);
-
-            List<String> classNames = new ArrayList<String>();
-            for (String file: files) {
-                classNames.add(file.replaceAll(".java$", "").replace('/', '.'));
-            }
-
-            if (!fork) {
-                GenStubs m = new GenStubs();
-                boolean ok = m.run(srcDir.getPath(), destDir, classNames);
-                if (!ok)
-                    throw new BuildException("genstubs failed");
-            } else {
-                List<String> cmd = new ArrayList<String>();
-                String java_home = System.getProperty("java.home");
-                cmd.add(new File(new File(java_home, "bin"), "java").getPath());
-                if (classpath != null)
-                    cmd.add("-Xbootclasspath/p:" + classpath);
-                cmd.add(GenStubs.class.getName());
-                cmd.add("-sourcepath");
-                cmd.add(srcDir.getPath());
-                cmd.add("-s");
-                cmd.add(destDir.getPath());
-                cmd.addAll(classNames);
-                //System.err.println("GenStubs exec " + cmd);
-                ProcessBuilder pb = new ProcessBuilder(cmd);
-                pb.redirectErrorStream(true);
-                try {
-                    Process p = pb.start();
-                    BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
-                    try {
-                        String line;
-                        while ((line = in.readLine()) != null)
-                            System.out.println(line);
-                    } finally {
-                        in.close();
-                    }
-                    int rc = p.waitFor();
-                    if (rc != 0)
-                        throw new BuildException("genstubs failed");
-                } catch (IOException e) {
-                    throw new BuildException("genstubs failed", e);
-                } catch (InterruptedException e) {
-                    throw new BuildException("genstubs failed", e);
-                }
-            }
-        }
-
-        String[] filter(File srcDir, File destDir, String[] files) {
-            List<String> results = new ArrayList<String>();
-            for (String f: files) {
-                long srcTime = new File(srcDir, f).lastModified();
-                long destTime = new File(destDir, f).lastModified();
-                if (srcTime > destTime)
-                    results.add(f);
-            }
-            return results.toArray(new String[results.size()]);
-        }
-    }
-}
--- a/make/tools/SelectTool/SelectToolTask.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import javax.swing.SwingUtilities;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-
-/**
- * Task to allow the user to control langtools tools built when using NetBeans.
- *
- * There are two primary modes.
- * 1) Property mode. In this mode, property names are provided to get values
- * that may be specified by the user, either directly in a GUI dialog, or
- * read from a properties file. If the GUI dialog is invoked, values may
- * optionally be set for future use.
- * 2) Setup mode. In this mode, no property names are provided, and the GUI
- * is invoked to allow the user to set or reset values for use in property mode.
- */
-public class SelectToolTask extends Task {
-    /**
-     * Set the location of the private properties file used to keep the retain
-     * user preferences for this repository.
-     */
-    public void setPropertyFile(File propertyFile) {
-        this.propertyFile = propertyFile;
-    }
-
-    /**
-     * Set the name of the property which will be set to the name of the
-     * selected tool, if any. If no tool is selected, the property will
-     * remain unset.
-     */
-    public void setToolProperty(String toolProperty) {
-        this.toolProperty = toolProperty;
-    }
-
-    /**
-     * Set the name of the property which will be set to the execution args of the
-     * selected tool, if any. The args default to an empty string.
-     */
-    public void setArgsProperty(String argsProperty) {
-        this.argsProperty = argsProperty;
-    }
-
-    /**
-     * Specify whether or not to pop up a dialog if the user has not specified
-     * a default value for a property.
-     */
-    public void setAskIfUnset(boolean askIfUnset) {
-        this.askIfUnset = askIfUnset;
-    }
-
-    @Override
-    public void execute() {
-        Project p = getProject();
-
-        Properties props = readProperties(propertyFile);
-        toolName = props.getProperty("tool.name");
-        if (toolName != null) {
-            toolArgs = props.getProperty(toolName + ".args", "");
-        }
-
-        if (toolProperty == null ||
-            askIfUnset && (toolName == null
-                || (argsProperty != null && toolArgs == null))) {
-            showGUI(props);
-        }
-
-        // finally, return required values, if any
-        if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
-            p.setProperty(toolProperty, toolName);
-
-            if (argsProperty != null && toolArgs != null)
-                p.setProperty(argsProperty, toolArgs);
-        }
-    }
-
-    void showGUI(Properties fileProps) {
-        Properties guiProps = new Properties(fileProps);
-        JOptionPane p = createPane(guiProps);
-        p.createDialog("Select Tool").setVisible(true);
-
-        toolName = (String) toolChoice.getSelectedItem();
-        toolArgs = argsField.getText();
-
-        if (defaultCheck.isSelected()) {
-            if (toolName.equals("")) {
-                fileProps.remove("tool.name");
-            } else {
-                fileProps.put("tool.name", toolName);
-                fileProps.put(toolName + ".args", toolArgs);
-            }
-            writeProperties(propertyFile, fileProps);
-        }
-    }
-
-    JOptionPane createPane(final Properties props) {
-        JPanel body = new JPanel(new GridBagLayout());
-        GridBagConstraints lc = new GridBagConstraints();
-        lc.insets.right = 10;
-        lc.insets.bottom = 3;
-        GridBagConstraints fc = new GridBagConstraints();
-        fc.anchor = GridBagConstraints.WEST;
-        fc.gridx = 1;
-        fc.gridwidth = GridBagConstraints.REMAINDER;
-        fc.insets.bottom = 3;
-
-        JLabel toolLabel = new JLabel("Tool:");
-        body.add(toolLabel, lc);
-        String[] toolChoices = { "apt", "javac", "javadoc", "javah", "javap" };
-        if (true || toolProperty == null) {
-            // include empty value in setup mode
-            List<String> l = new ArrayList<String>(Arrays.asList(toolChoices));
-            l.add(0, "");
-            toolChoices = l.toArray(new String[l.size()]);
-        }
-        toolChoice = new JComboBox(toolChoices);
-        if (toolName != null)
-            toolChoice.setSelectedItem(toolName);
-        toolChoice.addItemListener(new ItemListener() {
-            public void itemStateChanged(ItemEvent e) {
-                String tn = (String) e.getItem();
-                argsField.setText(getDefaultArgsForTool(props, tn));
-                if (toolProperty != null)
-                    okButton.setEnabled(!tn.equals(""));
-            }
-        });
-        body.add(toolChoice, fc);
-
-        argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
-        if (toolProperty == null || argsProperty != null) {
-            JLabel argsLabel = new JLabel("Args:");
-            body.add(argsLabel, lc);
-            body.add(argsField, fc);
-            argsField.addFocusListener(new FocusListener() {
-                public void focusGained(FocusEvent e) {
-                }
-                public void focusLost(FocusEvent e) {
-                    String toolName = (String) toolChoice.getSelectedItem();
-                    if (toolName.length() > 0)
-                        props.put(toolName + ".args", argsField.getText());
-                }
-            });
-        }
-
-        defaultCheck = new JCheckBox("Set as default");
-        if (toolProperty == null)
-            defaultCheck.setSelected(true);
-        else
-            body.add(defaultCheck, fc);
-
-        final JOptionPane p = new JOptionPane(body);
-        okButton = new JButton("OK");
-        okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
-        okButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
-                d.setVisible(false);
-            }
-        });
-        p.setOptions(new Object[] { okButton });
-
-        return p;
-    }
-
-    Properties readProperties(File file) {
-        Properties p = new Properties();
-        if (file != null && file.exists()) {
-            Reader in = null;
-            try {
-                in = new BufferedReader(new FileReader(file));
-                p.load(in);
-                in.close();
-            } catch (IOException e) {
-                throw new BuildException("error reading property file", e);
-            } finally {
-                if (in != null) {
-                    try {
-                        in.close();
-                    } catch (IOException e) {
-                        throw new BuildException("cannot close property file", e);
-                    }
-                }
-            }
-        }
-        return p;
-    }
-
-    void writeProperties(File file, Properties p) {
-        if (file != null) {
-            Writer out = null;
-            try {
-                File dir = file.getParentFile();
-                if (dir != null && !dir.exists())
-                    dir.mkdirs();
-                out = new BufferedWriter(new FileWriter(file));
-                p.store(out, "langtools properties");
-                out.close();
-            } catch (IOException e) {
-                throw new BuildException("error writing property file", e);
-            } finally {
-                if (out != null) {
-                    try {
-                        out.close();
-                    } catch (IOException e) {
-                        throw new BuildException("cannot close property file", e);
-                    }
-                }
-            }
-        }
-    }
-
-    String getDefaultArgsForTool(Properties props, String tn) {
-        return (tn == null || tn.equals("")) ? "" : props.getProperty(tn + ".args", "");
-    }
-
-    // Ant task parameters
-    private boolean askIfUnset;
-    private String toolProperty;
-    private String argsProperty;
-    private File propertyFile;
-
-    // GUI components
-    private JComboBox toolChoice;
-    private JTextField argsField;
-    private JCheckBox defaultCheck;
-    private JButton okButton;
-
-    // Result values for the client
-    private String toolName;
-    private String toolArgs;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/anttasks/CompilePropertiesTask.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package anttasks;
+
+import compileproperties.CompileProperties;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+
+public class CompilePropertiesTask extends MatchingTask {
+    public void setSrcDir(File srcDir) {
+        this.srcDir = srcDir;
+    }
+
+    public void setDestDir(File destDir) {
+        this.destDir = destDir;
+    }
+
+    public void setSuperclass(String superclass) {
+        this.superclass = superclass;
+    }
+
+    @Override
+    public void execute() {
+        CompileProperties.Log log = new CompileProperties.Log() {
+            public void error(String msg, Exception e) {
+                log(msg, Project.MSG_ERR);
+            }
+            public void info(String msg) {
+                log(msg, Project.MSG_INFO);
+            }
+            public void verbose(String msg) {
+                log(msg, Project.MSG_VERBOSE);
+            }
+        };
+        List<String> mainOpts = new ArrayList<String>();
+        int count = 0;
+        DirectoryScanner s = getDirectoryScanner(srcDir);
+        for (String path: s.getIncludedFiles()) {
+            if (path.endsWith(".properties")) {
+                String destPath =
+                        path.substring(0, path.length() - ".properties".length()) +
+                        ".java";
+                File srcFile = new File(srcDir, path);
+                File destFile = new File(destDir, destPath);
+                // Arguably, the comparison in the next line should be ">", not ">="
+                // but that assumes the resolution of the last modified time is fine
+                // grained enough; in practice, it is better to use ">=".
+                if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified())
+                    continue;
+                destFile.getParentFile().mkdirs();
+                mainOpts.add("-compile");
+                mainOpts.add(srcFile.getPath());
+                mainOpts.add(destFile.getPath());
+                mainOpts.add(superclass);
+                count++;
+            }
+        }
+        if (mainOpts.size() > 0) {
+            log("Generating " + count + " resource files to " + destDir, Project.MSG_INFO);
+            CompileProperties cp = new CompileProperties();
+            cp.setLog(log);
+            boolean ok = cp.run(mainOpts.toArray(new String[mainOpts.size()]));
+            if (!ok)
+                throw new BuildException("CompileProperties failed.");
+        }
+    }
+
+    private File srcDir;
+    private File destDir;
+    private String superclass = "java.util.ListResourceBundle";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/anttasks/GenStubsTask.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package anttasks;
+
+import genstubs.GenStubs;
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+/**
+ * Files are specified with an implicit fileset, using srcdir as a base directory.
+ * The set of files to be included is specified with an includes attribute or
+ * nested <includes> set. However, unlike a normal fileset, an empty includes attribute
+ * means "no files" instead of "all files".  The Ant task also accepts "fork=true" and
+ * classpath attribute or nested <classpath> element to run GenStubs in a separate VM
+ * with the specified path. This is likely necessary if a JDK 7 parser is required to read the
+ * JDK 7 input files.
+ */
+public class GenStubsTask extends MatchingTask {
+    private File srcDir;
+    private File destDir;
+    private boolean fork;
+    private Path classpath;
+    private String includes;
+
+    public void setSrcDir(File dir) {
+        this.srcDir = dir;
+    }
+
+    public void setDestDir(File dir) {
+        this.destDir = dir;
+    }
+
+    public void setFork(boolean v) {
+        this.fork = v;
+    }
+
+    public void setClasspath(Path cp) {
+        if (classpath == null)
+            classpath = cp;
+        else
+            classpath.append(cp);
+    }
+
+    public Path createClasspath() {
+        if (classpath == null) {
+            classpath = new Path(getProject());
+        }
+        return classpath.createPath();
+    }
+
+    public void setClasspathRef(Reference r) {
+        createClasspath().setRefid(r);
+    }
+
+    public void setIncludes(String includes) {
+        super.setIncludes(includes);
+        this.includes = includes;
+    }
+
+    @Override
+    public void execute() {
+        if (includes != null && includes.trim().isEmpty())
+            return;
+
+        DirectoryScanner s = getDirectoryScanner(srcDir);
+        String[] files = s.getIncludedFiles();
+//            System.err.println("Ant.execute: srcDir " + srcDir);
+//            System.err.println("Ant.execute: destDir " + destDir);
+//            System.err.println("Ant.execute: files " + Arrays.asList(files));
+
+        files = filter(srcDir, destDir, files);
+        if (files.length == 0)
+            return;
+        System.out.println("Generating " + files.length + " stub files to " + destDir);
+
+        List<String> classNames = new ArrayList<String>();
+        for (String file: files) {
+            classNames.add(file.replaceAll(".java$", "").replace('/', '.'));
+        }
+
+        if (!fork) {
+            GenStubs m = new GenStubs();
+            boolean ok = m.run(srcDir.getPath(), destDir, classNames);
+            if (!ok)
+                throw new BuildException("genstubs failed");
+        } else {
+            List<String> cmd = new ArrayList<String>();
+            String java_home = System.getProperty("java.home");
+            cmd.add(new File(new File(java_home, "bin"), "java").getPath());
+            if (classpath != null)
+                cmd.add("-Xbootclasspath/p:" + classpath);
+            cmd.add(GenStubs.class.getName());
+            cmd.add("-sourcepath");
+            cmd.add(srcDir.getPath());
+            cmd.add("-s");
+            cmd.add(destDir.getPath());
+            cmd.addAll(classNames);
+            //System.err.println("GenStubs exec " + cmd);
+            ProcessBuilder pb = new ProcessBuilder(cmd);
+            pb.redirectErrorStream(true);
+            try {
+                Process p = pb.start();
+                BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+                try {
+                    String line;
+                    while ((line = in.readLine()) != null)
+                        System.out.println(line);
+                } finally {
+                    in.close();
+                }
+                int rc = p.waitFor();
+                if (rc != 0)
+                    throw new BuildException("genstubs failed");
+            } catch (IOException e) {
+                throw new BuildException("genstubs failed", e);
+            } catch (InterruptedException e) {
+                throw new BuildException("genstubs failed", e);
+            }
+        }
+    }
+
+    String[] filter(File srcDir, File destDir, String[] files) {
+        List<String> results = new ArrayList<String>();
+        for (String f: files) {
+            long srcTime = new File(srcDir, f).lastModified();
+            long destTime = new File(destDir, f).lastModified();
+            if (srcTime > destTime)
+                results.add(f);
+        }
+        return results.toArray(new String[results.size()]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/anttasks/SelectToolTask.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package anttasks;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import javax.swing.SwingUtilities;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+
+/**
+ * Task to allow the user to control langtools tools built when using NetBeans.
+ *
+ * There are two primary modes.
+ * 1) Property mode. In this mode, property names are provided to get values
+ * that may be specified by the user, either directly in a GUI dialog, or
+ * read from a properties file. If the GUI dialog is invoked, values may
+ * optionally be set for future use.
+ * 2) Setup mode. In this mode, no property names are provided, and the GUI
+ * is invoked to allow the user to set or reset values for use in property mode.
+ */
+public class SelectToolTask extends Task {
+    /**
+     * Set the location of the private properties file used to keep the retain
+     * user preferences for this repository.
+     */
+    public void setPropertyFile(File propertyFile) {
+        this.propertyFile = propertyFile;
+    }
+
+    /**
+     * Set the name of the property which will be set to the name of the
+     * selected tool, if any. If no tool is selected, the property will
+     * remain unset.
+     */
+    public void setToolProperty(String toolProperty) {
+        this.toolProperty = toolProperty;
+    }
+
+    /**
+     * Set the name of the property which will be set to the execution args of the
+     * selected tool, if any. The args default to an empty string.
+     */
+    public void setArgsProperty(String argsProperty) {
+        this.argsProperty = argsProperty;
+    }
+
+    /**
+     * Specify whether or not to pop up a dialog if the user has not specified
+     * a default value for a property.
+     */
+    public void setAskIfUnset(boolean askIfUnset) {
+        this.askIfUnset = askIfUnset;
+    }
+
+    @Override
+    public void execute() {
+        Project p = getProject();
+
+        Properties props = readProperties(propertyFile);
+        toolName = props.getProperty("tool.name");
+        if (toolName != null) {
+            toolArgs = props.getProperty(toolName + ".args", "");
+        }
+
+        if (toolProperty == null ||
+            askIfUnset && (toolName == null
+                || (argsProperty != null && toolArgs == null))) {
+            showGUI(props);
+        }
+
+        // finally, return required values, if any
+        if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
+            p.setProperty(toolProperty, toolName);
+
+            if (argsProperty != null && toolArgs != null)
+                p.setProperty(argsProperty, toolArgs);
+        }
+    }
+
+    void showGUI(Properties fileProps) {
+        Properties guiProps = new Properties(fileProps);
+        JOptionPane p = createPane(guiProps);
+        p.createDialog("Select Tool").setVisible(true);
+
+        toolName = (String) toolChoice.getSelectedItem();
+        toolArgs = argsField.getText();
+
+        if (defaultCheck.isSelected()) {
+            if (toolName.equals("")) {
+                fileProps.remove("tool.name");
+            } else {
+                fileProps.put("tool.name", toolName);
+                fileProps.put(toolName + ".args", toolArgs);
+            }
+            writeProperties(propertyFile, fileProps);
+        }
+    }
+
+    JOptionPane createPane(final Properties props) {
+        JPanel body = new JPanel(new GridBagLayout());
+        GridBagConstraints lc = new GridBagConstraints();
+        lc.insets.right = 10;
+        lc.insets.bottom = 3;
+        GridBagConstraints fc = new GridBagConstraints();
+        fc.anchor = GridBagConstraints.WEST;
+        fc.gridx = 1;
+        fc.gridwidth = GridBagConstraints.REMAINDER;
+        fc.insets.bottom = 3;
+
+        JLabel toolLabel = new JLabel("Tool:");
+        body.add(toolLabel, lc);
+        String[] toolChoices = { "apt", "javac", "javadoc", "javah", "javap" };
+        if (true || toolProperty == null) {
+            // include empty value in setup mode
+            List<String> l = new ArrayList<String>(Arrays.asList(toolChoices));
+            l.add(0, "");
+            toolChoices = l.toArray(new String[l.size()]);
+        }
+        toolChoice = new JComboBox(toolChoices);
+        if (toolName != null)
+            toolChoice.setSelectedItem(toolName);
+        toolChoice.addItemListener(new ItemListener() {
+            public void itemStateChanged(ItemEvent e) {
+                String tn = (String) e.getItem();
+                argsField.setText(getDefaultArgsForTool(props, tn));
+                if (toolProperty != null)
+                    okButton.setEnabled(!tn.equals(""));
+            }
+        });
+        body.add(toolChoice, fc);
+
+        argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
+        if (toolProperty == null || argsProperty != null) {
+            JLabel argsLabel = new JLabel("Args:");
+            body.add(argsLabel, lc);
+            body.add(argsField, fc);
+            argsField.addFocusListener(new FocusListener() {
+                public void focusGained(FocusEvent e) {
+                }
+                public void focusLost(FocusEvent e) {
+                    String toolName = (String) toolChoice.getSelectedItem();
+                    if (toolName.length() > 0)
+                        props.put(toolName + ".args", argsField.getText());
+                }
+            });
+        }
+
+        defaultCheck = new JCheckBox("Set as default");
+        if (toolProperty == null)
+            defaultCheck.setSelected(true);
+        else
+            body.add(defaultCheck, fc);
+
+        final JOptionPane p = new JOptionPane(body);
+        okButton = new JButton("OK");
+        okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
+        okButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
+                d.setVisible(false);
+            }
+        });
+        p.setOptions(new Object[] { okButton });
+
+        return p;
+    }
+
+    Properties readProperties(File file) {
+        Properties p = new Properties();
+        if (file != null && file.exists()) {
+            Reader in = null;
+            try {
+                in = new BufferedReader(new FileReader(file));
+                p.load(in);
+                in.close();
+            } catch (IOException e) {
+                throw new BuildException("error reading property file", e);
+            } finally {
+                if (in != null) {
+                    try {
+                        in.close();
+                    } catch (IOException e) {
+                        throw new BuildException("cannot close property file", e);
+                    }
+                }
+            }
+        }
+        return p;
+    }
+
+    void writeProperties(File file, Properties p) {
+        if (file != null) {
+            Writer out = null;
+            try {
+                File dir = file.getParentFile();
+                if (dir != null && !dir.exists())
+                    dir.mkdirs();
+                out = new BufferedWriter(new FileWriter(file));
+                p.store(out, "langtools properties");
+                out.close();
+            } catch (IOException e) {
+                throw new BuildException("error writing property file", e);
+            } finally {
+                if (out != null) {
+                    try {
+                        out.close();
+                    } catch (IOException e) {
+                        throw new BuildException("cannot close property file", e);
+                    }
+                }
+            }
+        }
+    }
+
+    String getDefaultArgsForTool(Properties props, String tn) {
+        return (tn == null || tn.equals("")) ? "" : props.getProperty(tn + ".args", "");
+    }
+
+    // Ant task parameters
+    private boolean askIfUnset;
+    private String toolProperty;
+    private String argsProperty;
+    private File propertyFile;
+
+    // GUI components
+    private JComboBox toolChoice;
+    private JTextField argsField;
+    private JCheckBox defaultCheck;
+    private JButton okButton;
+
+    // Result values for the client
+    private String toolName;
+    private String toolArgs;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/compileproperties/CompileProperties.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package compileproperties;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/** Translates a .properties file into a .java file containing the
+ *  definition of a java.util.Properties subclass which can then be
+ *  compiled with javac. <P>
+ *
+ *  Usage: java CompileProperties [path to .properties file] [path to .java file to be output] [super class]
+ *
+ *  Infers the package by looking at the common suffix of the two
+ *  inputs, eliminating "classes" from it.
+ *
+ * @author Scott Violet
+ * @author Kenneth Russell
+ */
+
+public class CompileProperties {
+
+    public static void main(String[] args) {
+        CompileProperties cp = new CompileProperties();
+        boolean ok = cp.run(args);
+        if ( !ok ) {
+            System.exit(1);
+        }
+    }
+
+    public static interface Log {
+        void info(String msg);
+        void verbose(String msg);
+        void error(String msg, Exception e);
+    }
+
+    private String propfiles[];
+    private String outfiles[] ;
+    private String supers[]   ;
+    private int compileCount = 0;
+    private boolean quiet = false;
+    public Log log;
+
+    public void setLog(Log log) {
+        this.log = log;
+    }
+
+    public boolean run(String[] args) {
+        if (log == null) {
+            log = new Log() {
+                public void error(String msg, Exception e) {
+                    System.err.println("ERROR: CompileProperties: " + msg);
+                    if ( e != null ) {
+                        System.err.println("EXCEPTION: " + e.toString());
+                        e.printStackTrace();
+                    }
+                }
+                public void info(String msg) {
+                    System.out.println(msg);
+                }
+                public void verbose(String msg) {
+                    if (!quiet)
+                        System.out.println(msg);
+                }
+            };
+        }
+
+        boolean ok = true;
+        /* Original usage */
+        if (args.length == 2 && args[0].charAt(0) != '-' ) {
+            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) {
+            usage(log);
+            ok = false;
+        } else {
+            /* New batch usage */
+            ok = parseOptions(args);
+            if ( ok && compileCount == 0 ) {
+                log.error("options parsed but no files to compile", null);
+                ok = false;
+            }
+            /* Need at least one file. */
+            if ( !ok ) {
+                usage(log);
+            } else {
+                /* Process files */
+                for ( int i = 0; i < compileCount && ok ; i++ ) {
+                    ok = createFile(propfiles[i], outfiles[i], supers[i]);
+                }
+            }
+        }
+        return ok;
+    }
+
+    private boolean parseOptions(String args[]) {
+        boolean ok = true;
+        if ( compileCount > 0 ) {
+            String new_propfiles[] = new String[compileCount + args.length];
+            String new_outfiles[]  = new String[compileCount + args.length];
+            String new_supers[]    = new String[compileCount + args.length];
+            System.arraycopy(propfiles, 0, new_propfiles, 0, compileCount);
+            System.arraycopy(outfiles, 0, new_outfiles, 0, compileCount);
+            System.arraycopy(supers, 0, new_supers, 0, compileCount);
+            propfiles = new_propfiles;
+            outfiles  = new_outfiles;
+            supers    = new_supers;
+        } else {
+            propfiles = new String[args.length];
+            outfiles  = new String[args.length];
+            supers    = new String[args.length];
+        }
+
+        for ( int i = 0; i < args.length ; i++ ) {
+            if ( "-compile".equals(args[i]) && i+3 < args.length ) {
+                propfiles[compileCount] = args[++i];
+                outfiles[compileCount]  = args[++i];
+                supers[compileCount]    = args[++i];
+                compileCount++;
+            } else if ( "-optionsfile".equals(args[i]) && i+1 < args.length ) {
+                String filename = args[++i];
+                FileInputStream finput = null;
+                byte contents[] = null;
+                try {
+                    finput = new FileInputStream(filename);
+                    int byteCount = finput.available();
+                    if ( byteCount <= 0 ) {
+                        log.error("The -optionsfile file is empty", null);
+                        ok = false;
+                    } else {
+                        contents = new byte[byteCount];
+                        int bytesRead = finput.read(contents);
+                        if ( byteCount != bytesRead ) {
+                            log.error("Cannot read all of -optionsfile file", null);
+                            ok = false;
+                        }
+                    }
+                } catch ( IOException e ) {
+                    log.error("cannot open " + filename, e);
+                    ok = false;
+                }
+                if ( finput != null ) {
+                    try {
+                        finput.close();
+                    } catch ( IOException e ) {
+                        ok = false;
+                        log.error("cannot close " + filename, e);
+                    }
+                }
+                if ( ok = true && contents != null ) {
+                    String tokens[] = (new String(contents)).split("\\s+");
+                    if ( tokens.length > 0 ) {
+                        ok = parseOptions(tokens);
+                    }
+                }
+                if ( !ok ) {
+                    break;
+                }
+            } else if ( "-quiet".equals(args[i]) ) {
+                quiet = true;
+            } else {
+                log.error("argument error", null);
+                ok = false;
+            }
+        }
+        return ok;
+    }
+
+    private boolean createFile(String propertiesPath, String outputPath,
+            String superClass) {
+        boolean ok = true;
+        log.verbose("parsing: " + propertiesPath);
+        Properties p = new Properties();
+        try {
+            p.load(new FileInputStream(propertiesPath));
+        } catch ( FileNotFoundException e ) {
+            ok = false;
+            log.error("Cannot find file " + propertiesPath, e);
+        } catch ( IOException e ) {
+            ok = false;
+            log.error("IO error on file " + propertiesPath, e);
+        }
+        if ( ok ) {
+            String packageName = inferPackageName(propertiesPath, outputPath);
+            log.verbose("inferred package name: " + packageName);
+            List<String> sortedKeys = new ArrayList<String>();
+            for ( Object key : p.keySet() ) {
+                sortedKeys.add((String)key);
+            }
+            Collections.sort(sortedKeys);
+            Iterator<String> keys = sortedKeys.iterator();
+
+            StringBuffer data = new StringBuffer();
+
+            while (keys.hasNext()) {
+                String key = keys.next();
+                data.append("            { \"" + escape(key) + "\", \"" +
+                        escape((String)p.get(key)) + "\" },\n");
+            }
+
+            // Get class name from java filename, not the properties filename.
+            //   (zh_TW properties might be used to create zh_HK files)
+            File file = new File(outputPath);
+            String name = file.getName();
+            int dotIndex = name.lastIndexOf('.');
+            String className;
+            if (dotIndex == -1) {
+                className = name;
+            } else {
+                className = name.substring(0, dotIndex);
+            }
+
+            String packageString = "";
+            if (packageName != null && !packageName.equals("")) {
+                packageString = "package " + packageName + ";\n\n";
+            }
+
+            Writer writer = null;
+            try {
+                writer = new BufferedWriter(
+                        new OutputStreamWriter(new FileOutputStream(outputPath), "8859_1"));
+                MessageFormat format = new MessageFormat(FORMAT);
+                writer.write(format.format(new Object[] { packageString, className, superClass, data }));
+            } catch ( IOException e ) {
+                ok = false;
+                log.error("IO error writing to file " + outputPath, e);
+            }
+            if ( writer != null ) {
+                try {
+                    writer.flush();
+                } catch ( IOException e ) {
+                    ok = false;
+                    log.error("IO error flush " + outputPath, e);
+                }
+                try {
+                    writer.close();
+                } catch ( IOException e ) {
+                    ok = false;
+                    log.error("IO error close " + outputPath, e);
+                }
+            }
+            log.verbose("wrote: " + outputPath);
+        }
+        return ok;
+    }
+
+    private static void usage(Log log) {
+        log.info("usage:");
+        log.info("    java CompileProperties path_to_properties_file path_to_java_output_file [super_class]");
+        log.info("      -OR-");
+        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 java.util.ListResourceBundle");
+        log.info("    java CompileProperties -optionsfile option_file");
+        log.info("option_file contains: -compile test.properties test.java java.util.ListResourceBundle");
+    }
+
+    private static String escape(String theString) {
+        // This is taken from Properties.saveConvert with changes for Java strings
+        int len = theString.length();
+        StringBuffer outBuffer = new StringBuffer(len*2);
+
+        for(int x=0; x<len; x++) {
+            char aChar = theString.charAt(x);
+            switch(aChar) {
+                case '\\':outBuffer.append('\\'); outBuffer.append('\\');
+                break;
+                case '\t':outBuffer.append('\\'); outBuffer.append('t');
+                break;
+                case '\n':outBuffer.append('\\'); outBuffer.append('n');
+                break;
+                case '\r':outBuffer.append('\\'); outBuffer.append('r');
+                break;
+                case '\f':outBuffer.append('\\'); outBuffer.append('f');
+                break;
+                default:
+                    if ((aChar < 0x0020) || (aChar > 0x007e)) {
+                        outBuffer.append('\\');
+                        outBuffer.append('u');
+                        outBuffer.append(toHex((aChar >> 12) & 0xF));
+                        outBuffer.append(toHex((aChar >>  8) & 0xF));
+                        outBuffer.append(toHex((aChar >>  4) & 0xF));
+                        outBuffer.append(toHex( aChar        & 0xF));
+                    } else {
+                        if (specialSaveChars.indexOf(aChar) != -1) {
+                            outBuffer.append('\\');
+                        }
+                        outBuffer.append(aChar);
+                    }
+            }
+        }
+        return outBuffer.toString();
+    }
+
+    private static String inferPackageName(String inputPath, String outputPath) {
+        // Normalize file names
+        inputPath  = new File(inputPath).getPath();
+        outputPath = new File(outputPath).getPath();
+        // Split into components
+        String sep;
+        if (File.separatorChar == '\\') {
+            sep = "\\\\";
+        } else {
+            sep = File.separator;
+        }
+        String[] inputs  = inputPath.split(sep);
+        String[] outputs = outputPath.split(sep);
+        // Match common names, eliminating first "classes" entry from
+        // each if present
+        int inStart  = 0;
+        int inEnd    = inputs.length - 2;
+        int outEnd   = outputs.length - 2;
+        int i = inEnd;
+        int j = outEnd;
+        while (i >= 0 && j >= 0) {
+            if (!inputs[i].equals(outputs[j]) ||
+                    (inputs[i].equals("gensrc") && inputs[j].equals("gensrc"))) {
+                ++i;
+                ++j;
+                break;
+            }
+            --i;
+            --j;
+        }
+        String result;
+        if (i < 0 || j < 0 || i >= inEnd || j >= outEnd) {
+            result = "";
+        } else {
+            if (inputs[i].equals("classes") && outputs[j].equals("classes")) {
+                ++i;
+            }
+            inStart = i;
+            StringBuffer buf = new StringBuffer();
+            for (i = inStart; i <= inEnd; i++) {
+                buf.append(inputs[i]);
+                if (i < inEnd) {
+                    buf.append('.');
+                }
+            }
+            result = buf.toString();
+        }
+        return result;
+    }
+
+    private static final String FORMAT =
+            "{0}" +
+            "public final class {1} extends {2} '{'\n" +
+            "    protected final Object[][] getContents() '{'\n" +
+            "        return new Object[][] '{'\n" +
+            "{3}" +
+            "        };\n" +
+            "    }\n" +
+            "}\n";
+
+    // This comes from Properties
+    private static char toHex(int nibble) {
+        return hexDigit[(nibble & 0xF)];
+    }
+
+    // This comes from Properties
+    private static final char[] hexDigit = {
+        '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+    };
+
+    // Note: different from that in Properties
+    private static final String specialSaveChars = "\"";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/genstubs/GenStubs.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package genstubs;
+
+import java.io.*;
+import java.util.*;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+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.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.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.
+ *
+ * This is a special purpose stub generator, specific to the needs of generating
+ * stub files for JDK 7 API that are needed to compile langtools files that depend
+ * on that API. The stub generator works by removing as much of the API source code
+ * as possible without affecting the public signature, in order to reduce the
+ * transitive closure of the API being referenced. The resulting stubs can be
+ * put on the langtools sourcepath with -implicit:none to compile the langtools
+ * files that depend on the JDK 7 API.
+ *
+ * Usage:
+ *  genstubs -s <outdir> -sourcepath <path> <classnames>
+ *
+ * The specified class names are looked up on the sourcepath, and corresponding
+ * stubs are written to the source output directory.
+ *
+ * Classes are parsed into javac ASTs, then processed with a javac TreeTranslator
+ * to remove implementation details, and written out in the source output directory.
+ * Documentation comments and annotations are removed. Method bodies are removed
+ * and methods are marked native. Private and package-private field definitions
+ * have their initializers replace with 0, 0.0, false, null as appropriate.
+ */
+
+public class GenStubs {
+    static class Fault extends Exception {
+        private static final long serialVersionUID = 0;
+        Fault(String message) {
+            super(message);
+        }
+        Fault(String message, Throwable cause) {
+            super(message);
+            initCause(cause);
+        }
+    }
+
+    public static void main(String[] args) {
+        boolean ok = new GenStubs().run(args);
+        if (!ok)
+            System.exit(1);
+    }
+
+    public boolean run(String... args) {
+        File outdir = null;
+        String sourcepath = null;
+        List<String> classes = new ArrayList<String>();
+        for (ListIterator<String> iter = Arrays.asList(args).listIterator(); iter.hasNext(); ) {
+            String arg = iter.next();
+            if (arg.equals("-s") && iter.hasNext())
+                outdir = new File(iter.next());
+            else if (arg.equals("-sourcepath") && iter.hasNext())
+                sourcepath = iter.next();
+            else if (arg.startsWith("-"))
+                throw new IllegalArgumentException(arg);
+            else {
+                classes.add(arg);
+                while (iter.hasNext())
+                    classes.add(iter.next());
+            }
+        }
+
+        return run(sourcepath, outdir, classes);
+    }
+
+    public boolean run(String sourcepath, File outdir, List<String> classes) {
+        //System.err.println("run: sourcepath:" + sourcepath + " outdir:" + outdir + " classes:" + classes);
+        if (sourcepath == null)
+            throw new IllegalArgumentException("sourcepath not set");
+        if (outdir == null)
+            throw new IllegalArgumentException("source output dir not set");
+
+        JavacTool tool = JavacTool.create();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+        try {
+            fm.setLocation(StandardLocation.SOURCE_OUTPUT, Collections.singleton(outdir));
+            fm.setLocation(StandardLocation.SOURCE_PATH, splitPath(sourcepath));
+            List<JavaFileObject> files = new ArrayList<JavaFileObject>();
+            for (String c: classes) {
+                JavaFileObject fo = fm.getJavaFileForInput(
+                        StandardLocation.SOURCE_PATH, c, JavaFileObject.Kind.SOURCE);
+                if (fo == null)
+                    error("class not found: " + c);
+                else
+                    files.add(fo);
+            }
+
+            JavacTask t = tool.getTask(null, fm, null, null, null, files);
+            Iterable<? extends CompilationUnitTree> trees = t.parse();
+            for (CompilationUnitTree tree: trees) {
+                makeStub(fm, tree);
+            }
+        } catch (IOException e) {
+            error("IO error " + e, e);
+        }
+
+        return (errors == 0);
+    }
+
+    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,
+                className, JavaFileObject.Kind.SOURCE, null);
+        // System.err.println("Writing " + className + " to " + fo.getName());
+        Writer out = fo.openWriter();
+        try {
+            new Pretty(out, true).printExpr((JCTree) tree3);
+        } finally {
+            out.close();
+        }
+    }
+
+    List<File> splitPath(String path) {
+        List<File> list = new ArrayList<File>();
+        for (String p: path.split(File.pathSeparator)) {
+            if (p.length() > 0)
+                list.add(new File(p));
+        }
+        return list;
+    }
+
+    void error(String message) {
+        System.err.println(message);
+        errors++;
+    }
+
+    void error(String message, Throwable cause) {
+        error(message);
+    }
+
+    int errors;
+
+    class StubMaker extends TreeTranslator {
+        CompilationUnitTree translate(CompilationUnitTree tree) {
+            return super.translate((JCCompilationUnit) tree);
+        }
+
+        /**
+         * compilation units: remove javadoc comments
+         * -- required, in order to remove @deprecated tags, since we
+         * (separately) remove all annotations, including @Deprecated
+         */
+        public void visitTopLevel(JCCompilationUnit tree) {
+            super.visitTopLevel(tree);
+            tree.docComments = Collections.emptyMap();
+        }
+
+        /**
+         * methods: remove method bodies, make methods native
+         */
+        @Override
+        public void visitMethodDef(JCMethodDecl tree) {
+            tree.mods = translate(tree.mods);
+            tree.restype = translate(tree.restype);
+            tree.typarams = translateTypeParams(tree.typarams);
+            tree.params = translateVarDefs(tree.params);
+            tree.thrown = translate(tree.thrown);
+            if (tree.restype != null && tree.body != null) {
+                tree.mods.flags |= Flags.NATIVE;
+                tree.body = null;
+            }
+            result = tree;
+        }
+
+        /**
+         * modifiers: remove annotations
+         */
+        @Override
+        public void visitModifiers(JCModifiers tree) {
+            tree.annotations = com.sun.tools.javac.util.List.nil();
+            result = tree;
+        }
+
+        /**
+         * field definitions: replace initializers with 0, 0.0, false etc
+         * when possible -- i.e. leave public, protected initializers alone
+         */
+        @Override
+        public void visitVarDef(JCVariableDecl tree) {
+            tree.mods = translate(tree.mods);
+            tree.vartype = translate(tree.vartype);
+            if (tree.init != null) {
+                if ((tree.mods.flags & (Flags.PUBLIC | Flags.PROTECTED)) != 0)
+                    tree.init = translate(tree.init);
+                else {
+                    String t = tree.vartype.toString();
+                    if (t.equals("boolean"))
+                        tree.init = new JCLiteral(TypeTags.BOOLEAN, 0) { };
+                    else if (t.equals("byte"))
+                        tree.init = new JCLiteral(TypeTags.BYTE, 0) { };
+                    else if (t.equals("char"))
+                        tree.init = new JCLiteral(TypeTags.CHAR, 0) { };
+                    else if (t.equals("double"))
+                        tree.init = new JCLiteral(TypeTags.DOUBLE, 0.d) { };
+                    else if (t.equals("float"))
+                        tree.init = new JCLiteral(TypeTags.FLOAT, 0.f) { };
+                    else if (t.equals("int"))
+                        tree.init = new JCLiteral(TypeTags.INT, 0) { };
+                    else if (t.equals("long"))
+                        tree.init = new JCLiteral(TypeTags.LONG, 0) { };
+                    else if (t.equals("short"))
+                        tree.init = new JCLiteral(TypeTags.SHORT, 0) { };
+                    else
+                        tree.init = new JCLiteral(TypeTags.BOT, null) { };
+                }
+            }
+            result = tree;
+        }
+    }
+
+    class ImportCleaner extends TreeScanner {
+        private Set<Name> names = new HashSet<Name>();
+        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<JCTree> defs = new ListBuffer<JCTree>();
+            for (JCTree def: tree.defs) {
+                if (def.getTag() == JCTree.Tag.IMPORT) {
+                    JCImport imp = (JCImport) def;
+                    if (imp.qualid.getTag() == JCTree.Tag.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);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/Makefile	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,203 @@
+#
+# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+default: all
+
+# The BOOT_JAVAC setup uses the bootdir compiler to compile the tools
+# and the bootstrap javac, to be run by the bootdir jvm.
+$(eval $(call SetupJavaCompiler,BOOT_JAVAC,\
+	JAVAC:=$(JAVAC),\
+        FLAGS:=-Xprefer:source -XDignore.symbol.file=true -g,\
+        MODE:=SINGLE_THREADED_BATCH))
+
+# Now setup the compilation of the properties compilation tool. You can depend
+# upon $(BUILD_TOOLS) to trigger a compilation of the tools. Note that we
+# add src/share/classes to the sourcepath. This is necessary since the GenStubs
+# program needs to be linked and run towards the new javac sources.
+$(eval $(call SetupJavaCompilation,BUILD_TOOLS,\
+		SETUP:=BOOT_JAVAC,\
+		SRC:=$(LANGTOOLS_TOPDIR)/make/tools $(LANGTOOLS_TOPDIR)/src/share/classes,\
+		INCLUDES:=compileproperties genstubs,\
+		BIN:=$(LANGTOOLS_OUTPUTDIR)/btclasses))
+
+# The compileprops tools compiles a properties file into a resource bundle.
+TOOL_COMPILEPROPS_CMD:=$(JAVA) -cp $(LANGTOOLS_OUTPUTDIR)/btclasses compileproperties.CompileProperties -quiet
+# Lookup the properties that need to be compiled into resource bundles.
+PROPSOURCES:=$(shell find $(LANGTOOLS_TOPDIR)/src/share/classes -name "*.properties")
+# Strip away prefix and suffix, leaving for example only: "com/sun/tools/javac/resources/javac_zh_CN"
+PROPPATHS:=$(patsubst $(LANGTOOLS_TOPDIR)/src/share/classes/%.properties,%,$(PROPSOURCES))
+# Generate the list of java files to be created.
+PROPJAVAS:=$(patsubst %,$(LANGTOOLS_OUTPUTDIR)/gensrc/%.java,$(PROPPATHS))
+# Generate the package dirs for the tobe generated java files.
+PROPDIRS:=$(dir $(PROPJAVAS))
+# Now generate a sequence of "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
+# suitable to be fed into the CompileProperties command.
+PROPCMDLINE:=$(subst _SPACE_,$(SPACE),$(join $(addprefix -compile_SPACE_,$(PROPSOURCES)), \
+		$(addsuffix _SPACE_java.util.ListResourceBundle,$(addprefix _SPACE_$(LANGTOOLS_OUTPUTDIR)/gensrc/,$(addsuffix .java,$(PROPPATHS))))))
+
+# Now setup the rule for the generation of the resource bundles.
+$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d : $(PROPSOURCES) $(BUILD_TOOLS)
+	rm -rf $(@D)/*
+	mkdir -p $(@D) $(PROPDIRS)
+	printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties
+	printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties
+	printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties
+	echo Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles
+	$(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \
+		-compile 	$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties \
+				$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.java \
+				java.util.ListResourceBundle \
+		-compile 	$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties \
+				$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.java \
+				java.util.ListResourceBundle \
+		-compile	$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties \
+				$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.java \
+				java.util.ListResourceBundle
+	echo PROPS_ARE_CREATED=yes > $@
+
+# Trigger the generation of the resource bundles. After the resource bundles have
+# been compiled, then the makefile will restart and the newly created java files
+# will become part of the build further along in the makefile.
+-include $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d
+
+ifeq ($(PROPS_ARE_CREATED),yes)
+        # Setup the rules to build a dist/bootstrap/lib/javac.jar, ie a smaller intermediate javac
+        # that can be compiled with an old javac. The intermediate javac is then used
+        # to compile javac again and to build the complete new jdk.
+        $(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_LANGTOOLS,\
+		SETUP:=BOOT_JAVAC,\
+		SRC:=$(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc,\
+		EXCLUDES:=com/sun/tools/javac/nio,\
+		BIN:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap))
+
+        $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAC,$(BUILD_BOOTSTRAP_LANGTOOLS),\
+		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
+		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar,\
+		JARMAIN:=com.sun.tools.javac.Main))
+
+        $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAH,$(BUILD_BOOTSTRAP_LANGTOOLS),\
+		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
+		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javah.jar,\
+		JARMAIN:=com.sun.tools.javah.Main))
+
+        $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAP,$(BUILD_BOOTSTRAP_LANGTOOLS),\
+		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
+		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javap.jar,\
+		JARMAIN:=com.sun.tools.javap.Main))
+
+        $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVADOC,$(BUILD_BOOTSTRAP_LANGTOOLS),\
+		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
+		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javadoc.jar,\
+		JARMAIN:=com.sun.tools.javadoc.Main))
+
+        # GenStubs is used to bootstrap any dependencies from javac to the new JDK that is not 
+        # yet built. It is currently not needed but might be again in the future. The following
+        # exercises the functionality to verify that it works.
+        TOOL_GENSTUBS_CMD=$(JAVA) \
+             "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \
+             -cp "$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar$(PATH_SEP)$(LANGTOOLS_OUTPUTDIR)/btclasses" \
+             genstubs.GenStubs
+        # We fetch source from the JDK...
+        JDKS=$(JDK_TOPDIR)/src/share/classes
+        # Build the list of classes to generate stubs from. java/util/Objects.java isn't
+        # currently needed, but is used as a demo for now.
+	 STUBSOURCES:=$(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \
+		    -e "$(JDKS)/java/util/Objects.java")
+        # Rewrite the file names into class names because the GenStubs tool require this.
+        STUBCLASSES:=$(subst /,.,$(patsubst $(JDKS)/%.java,%,$(STUBSOURCES)))
+
+        # Now setup the build recipe for genstubs.
+        $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d : $(STUBSOURCES) $(BUILD_TOOLS) \
+				$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+				$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d
+	       	mkdir -p $(@D)
+		mkdir -p $(LANGTOOLS_OUTPUTDIR)/tmpstubs
+	       	echo Generating stubs from JDK sources.
+	       	($(TOOL_GENSTUBS_CMD) -s $(LANGTOOLS_OUTPUTDIR)/tmpstubs -sourcepath $(JDKS) $(STUBCLASSES) && echo STUBS_ARE_CREATED=yes > $@)
+		if $(DIFF) -x "_the*" -rq $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(LANGTOOLS_OUTPUTDIR)/genstubs > /dev/null 2>&1; then \
+			echo No changes in the stubs!; \
+			rm -rf $(LANGTOOLS_OUTPUTDIR)/tmpstubs; \
+		else \
+			echo Changes in stubs detected!; \
+			rm -rf $(@D); \
+			mv $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(@D); \
+		fi
+		echo STUBS_ARE_CREATED=yes > $@
+
+        # Trigger a generation of the genstubs java source code and a restart
+        # of the makefile to make sure that the following build setup use the 
+        # newly created java files.
+        -include $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d
+
+	ifeq ($(STUBS_ARE_CREATED),yes)
+                # Setup a compiler configuration using the intermediate javac in dist/bootstrap/lib/javac.jar
+                # that generates code for the new jdk that is being built.
+                # The code compiled by this compiler setup, cannot necessarily be run with the bootstrap jvm.
+                $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE,\
+                  JVM:=$(JAVA),\
+                  JAVAC:="-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \
+			 -jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar,\
+                  FLAGS:=-Xprefer:source -XDignore.symbol.file=true,\
+                  SERVER_DIR:=$(JAVAC_SERVERS),\
+                  SERVER_JVM:=$(SERVER_JAVA),\
+                  MODE:=$(JAVAC_USE_MODE),\
+		  USE_DEPS:=$(JAVAC_USE_DEPS)))
+
+                # javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied.
+		RESOURCE_SUFFIXES:=.gif .xml .css javax.tools.JavaCompilerTool
+
+                $(eval $(call SetupJavaCompilation,BUILD_FULL_JAVAC,\
+			SETUP:=GENERATE_NEWBYTECODE,\
+			SRC:=$(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc \
+			     $(LANGTOOLS_OUTPUTDIR)/genstubs,\
+			EXCLUDES:=java/util java/io java/nio,\
+			COPY:=$(RESOURCE_SUFFIXES),\
+			BIN:=$(LANGTOOLS_OUTPUTDIR)/classes))
+
+                $(eval $(call SetupArchive,ARCHIVE_FULL_JAVAC,$(BUILD_FULL_JAVAC),\
+			SETUP:=GENERATE_NEWBYTECODE,\
+			SRCS:=$(LANGTOOLS_OUTPUTDIR)/classes,\
+			SUFFIXES:=.class $(RESOURCE_SUFFIXES),\
+			JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar,\
+			HEADERS:=$(LANGTOOLS_OUTPUTDIR)/gensrc_headers))
+
+                $(eval $(call SetupZipArchive,ZIP_FULL_JAVAC_SOURCE,\
+			SRC:=$(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc,\
+			ZIP:=$(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip))
+
+                all: 		$(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar \
+				$(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip \
+	                 	$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+				$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javah.jar \
+				$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javap.jar \
+				$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javadoc.jar
+
+
+        endif
+endif
--- a/src/share/classes/com/sun/mirror/apt/AnnotationProcessor.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-
-import java.io.IOException;
-import java.util.Collection;
-
-
-/**
- * An annotation processor, used to examine and process the
- * annotations of program elements.  An annotation processor may,
- * for example, create new source files and XML documents to be used
- * in conjunction with the original code.
- *
- * <p> An annotation processor is constructed by a
- * {@linkplain AnnotationProcessorFactory factory}, which provides it with an
- * {@linkplain AnnotationProcessorEnvironment environment} that
- * encapsulates the state it needs.
- * Messages regarding warnings and errors encountered during processing
- * should be directed to the environment's {@link Messager},
- * and new files may be created using the environment's {@link Filer}.
- *
- * <p> Each annotation processor is created to process annotations
- * of a particular annotation type or set of annotation types.
- * It may use its environment to find the program elements with
- * annotations of those types.  It may freely examine any other program
- * elements in the course of its processing.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.annotation.processing.Processor}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationProcessor {
-
-    /**
-     * Process all program elements supported by this annotation processor.
-     */
-    void process();
-}
--- a/src/share/classes/com/sun/mirror/apt/AnnotationProcessorEnvironment.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-
-import java.util.Collection;
-import java.util.Map;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.*;
-
-
-/**
- * The environment encapsulating the state needed by an annotation processor.
- * An annotation processing tool makes this environment available
- * to all annotation processors.
- *
- * <p> When an annotation processing tool is invoked, it is given a
- * set of type declarations on which to operate.  These
- * are refered to as the <i>specified</i> types.
- * The type declarations said to be <i>included</i> in this invocation
- * consist of the specified types and any types nested within them.
- *
- * <p> {@link DeclarationFilter}
- * provides a simple way to select just the items of interest
- * when a method returns a collection of declarations.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.annotation.processing.ProcessingEnvironment}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationProcessorEnvironment {
-
-    /**
-     * Returns the options passed to the annotation processing tool.
-     * Options are returned in the form of a map from option name
-     * (such as <tt>"-encoding"</tt>) to option value.
-     * For an option with no value (such as <tt>"-help"</tt>), the
-     * corresponding value in the map is <tt>null</tt>.
-     *
-     * <p> Options beginning with <tt>"-A"</tt> are <i>processor-specific.</i>
-     * Such options are unrecognized by the tool, but intended to be used by
-     * some annotation processor.
-     *
-     * @return the options passed to the tool
-     */
-    Map<String,String> getOptions();
-
-    /**
-     * Returns the messager used to report errors, warnings, and other
-     * notices.
-     *
-     * @return the messager
-     */
-    Messager getMessager();
-
-    /**
-     * Returns the filer used to create new source, class, or auxiliary
-     * files.
-     *
-     * @return the filer
-     */
-    Filer getFiler();
-
-
-    /**
-     * Returns the declarations of the types specified when the
-     * annotation processing tool was invoked.
-     *
-     * @return the types specified when the tool was invoked, or an
-     * empty collection if there were none
-     */
-    Collection<TypeDeclaration> getSpecifiedTypeDeclarations();
-
-    /**
-     * Returns the declaration of a package given its fully qualified name.
-     *
-     * @param name  fully qualified package name, or "" for the unnamed package
-     * @return the declaration of the named package, or null if it cannot
-     * be found
-     */
-    PackageDeclaration getPackage(String name);
-
-    /**
-     * Returns the declaration of a type given its fully qualified name.
-     *
-     * @param name  fully qualified type name
-     * @return the declaration of the named type, or null if it cannot be
-     * found
-     */
-    TypeDeclaration getTypeDeclaration(String name);
-
-    /**
-     * A convenience method that returns the declarations of the types
-     * {@linkplain AnnotationProcessorEnvironment <i>included</i>}
-     * in this invocation of the annotation processing tool.
-     *
-     * @return the declarations of the types included in this invocation
-     * of the tool, or an empty collection if there are none
-     */
-    Collection<TypeDeclaration> getTypeDeclarations();
-
-    /**
-     * Returns the declarations annotated with the given annotation type.
-     * Only declarations of the types
-     * {@linkplain AnnotationProcessorEnvironment <i>included</i>}
-     * in this invocation of the annotation processing tool, or
-     * declarations of members, parameters, or type parameters
-     * declared within those, are returned.
-     *
-     * @param a  annotation type being requested
-     * @return the declarations annotated with the given annotation type,
-     * or an empty collection if there are none
-     */
-    Collection<Declaration> getDeclarationsAnnotatedWith(
-                                                AnnotationTypeDeclaration a);
-
-    /**
-     * Returns an implementation of some utility methods for
-     * operating on declarations.
-     *
-     * @return declaration utilities
-     */
-    Declarations getDeclarationUtils();
-
-    /**
-     * Returns an implementation of some utility methods for
-     * operating on types.
-     *
-     * @return type utilities
-     */
-    Types getTypeUtils();
-
-    /**
-     * Add a listener.  If the listener is currently registered to listen,
-     * adding it again will have no effect.
-     *
-     * @param listener The listener to add.
-     * @throws NullPointerException if the listener is null
-     */
-    void addListener(AnnotationProcessorListener listener);
-
-
-    /**
-     * Remove a listener.  If the listener is not currently listening,
-     * the method call does nothing.
-     *
-     * @param listener The listener to remove.
-     * @throws NullPointerException if the listener is null
-     */
-    void removeListener(AnnotationProcessorListener listener);
-}
--- a/src/share/classes/com/sun/mirror/apt/AnnotationProcessorFactory.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-
-import java.util.Collection;
-import java.util.Set;
-
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-
-
-/**
- * A factory for creating annotation processors.
- * Each factory is responsible for creating processors for one or more
- * annotation types.
- * The factory is said to <i>support</i> these types.
- *
- * <p> Each implementation of an <tt>AnnotationProcessorFactory</tt>
- * must provide a public no-argument constructor to be used by tools to
- * instantiate the factory.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.annotation.processing.Processor}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationProcessorFactory {
-
-    /**
-     * Returns the options recognized by this factory or by any of the
-     * processors it may create.
-     * Only {@linkplain AnnotationProcessorEnvironment#getOptions()
-     * processor-specific} options are included, each of which begins
-     * with <tt>"-A"</tt>.  For example, if this factory recognizes
-     * options such as <tt>-Adebug -Aloglevel=3</tt>, it will
-     * return the strings <tt>"-Adebug"</tt> and <tt>"-Aloglevel"</tt>.
-     *
-     * <p> A tool might use this information to determine if any
-     * options provided by a user are unrecognized by any processor,
-     * in which case it may wish to report an error.
-     *
-     * @return the options recognized by this factory or by any of the
-     * processors it may create, or an empty collection if none
-     */
-    Collection<String> supportedOptions();
-
-    /**
-     * Returns the names of the annotation types supported by this factory.
-     * An element of the result may be the canonical (fully qualified) name
-     * of a supported annotation type.  Alternately it may be of the form
-     * <tt>"<i>name</i>.*"</tt>
-     * representing the set of all annotation types
-     * with canonical names beginning with <tt>"<i>name</i>."</tt>
-     * Finally, <tt>"*"</tt> by itself represents the set of all
-     * annotation types.
-     *
-     * @return the names of the annotation types supported by this factory
-     */
-    Collection<String> supportedAnnotationTypes();
-
-    /**
-     * Returns an annotation processor for a set of annotation
-     * types. The set will be empty if the factory supports
-     * &quot;<tt>*</tt>&quot; and the specified type declarations have
-     * no annotations.  Note that the set of annotation types may be
-     * empty for other reasons, such as giving the factory an
-     * opportunity to register a listener.  An
-     * <tt>AnnotationProcessorFactory</tt> must gracefully handle an
-     * empty set of annotations; an appropriate response to an empty
-     * set will often be returning {@link AnnotationProcessors#NO_OP}.
-     *
-     * @param atds type declarations of the annotation types to be processed
-     * @param env  environment to use during processing
-     * @return an annotation processor for the given annotation types,
-     *          or <tt>null</tt> if the types are not supported or the
-     *          processor cannot be created
-     */
-    AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                        AnnotationProcessorEnvironment env);
-}
--- a/src/share/classes/com/sun/mirror/apt/AnnotationProcessorListener.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-/**
- * Superinterface for all annotation processor event listeners.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  This interface has no
- * direct analog in the standardized API because the different round
- * model renders it unnecessary.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationProcessorListener extends java.util.EventListener {}
--- a/src/share/classes/com/sun/mirror/apt/AnnotationProcessors.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-import com.sun.mirror.apt.*;
-import java.util.*;
-
-/**
- * Utilities to create specialized annotation processors.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  There is no direct analog
- * of the functionality of this class in the standardized API.
- *
- * @since 1.5
- * @author Joseph D. Darcy
- * @author Scott Seligman
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class AnnotationProcessors {
-    static class NoOpAP implements AnnotationProcessor {
-        NoOpAP() {}
-        public void process(){}
-    }
-
-    /**
-     * Combines multiple annotation processors into a simple composite
-     * processor.
-     * The composite processor functions by invoking each of its component
-     * processors in sequence.
-     */
-    static class CompositeAnnotationProcessor implements AnnotationProcessor {
-
-        private List<AnnotationProcessor> aps =
-            new LinkedList<AnnotationProcessor>();
-
-        /**
-         * Constructs a new composite annotation processor.
-         * @param aps  the component annotation processors
-         */
-        public CompositeAnnotationProcessor(Collection<AnnotationProcessor> aps) {
-            this.aps.addAll(aps);
-        }
-
-        /**
-         * Constructs a new composite annotation processor.
-         * @param aps  the component annotation processors
-         */
-        public CompositeAnnotationProcessor(AnnotationProcessor... aps) {
-            for(AnnotationProcessor ap: aps)
-                this.aps.add(ap);
-        }
-
-        /**
-         * Invokes the <tt>process</tt> method of each component processor,
-         * in the order in which the processors were passed to the constructor.
-         */
-        public void process() {
-            for(AnnotationProcessor ap: aps)
-                ap.process();
-        }
-    }
-
-
-    /**
-     *  An annotation processor that does nothing and has no state.
-     *  May be used multiple times.
-     *
-     * @since 1.5
-     */
-    public final static AnnotationProcessor NO_OP = new NoOpAP();
-
-    /**
-     * Constructs a new composite annotation processor.  A composite
-     * annotation processor combines multiple annotation processors
-     * into one and functions by invoking each of its component
-     * processors' process methods in sequence.
-     *
-     * @param aps The processors to create a composite of
-     * @since 1.5
-     */
-    public static AnnotationProcessor getCompositeAnnotationProcessor(AnnotationProcessor... aps) {
-        return new CompositeAnnotationProcessor(aps);
-    }
-
-    /**
-     * Constructs a new composite annotation processor.  A composite
-     * annotation processor combines multiple annotation processors
-     * into one and functions by invoking each of its component
-     * processors' process methods in the sequence the processors are
-     * returned by the collection's iterator.
-     *
-     * @param aps A collection of processors to create a composite of
-     * @since 1.5
-     */
-    public static AnnotationProcessor getCompositeAnnotationProcessor(Collection<AnnotationProcessor> aps) {
-        return new CompositeAnnotationProcessor(aps);
-    }
-}
--- a/src/share/classes/com/sun/mirror/apt/Filer.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-
-import java.io.*;
-
-
-/**
- * This interface supports the creation of new files by an
- * annotation processor.
- * Files created in this way will be known to the annotation processing
- * tool implementing this interface, better enabling the tool to manage them.
- * Four kinds of files are distinguished:
- * source files, class files, other text files, and other binary files.
- * The latter two are collectively referred to as <i>auxiliary</i> files.
- *
- * <p> There are two distinguished locations (subtrees within the
- * file system) where newly created files are placed:
- * one for new source files, and one for new class files.
- * (These might be specified on a tool's command line, for example,
- * using flags such as <tt>-s</tt> and <tt>-d</tt>.)
- * Auxiliary files may be created in either location.
- *
- * <p> During each run of an annotation processing tool, a file
- * with a given pathname may be created only once.  If that file already
- * exists before the first attempt to create it, the old contents will
- * be deleted.  Any subsequent attempt to create the same file during
- * a run will fail.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.annotation.processing.Filer}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface Filer {
-
-    /**
-     * Creates a new source file and returns a writer for it.
-     * The file's name and path (relative to the root of all newly created
-     * source files) is based on the type to be declared in that file.
-     * If more than one type is being declared, the name of the principal
-     * top-level type (the public one, for example) should be used.
-     *
-     * <p> The {@linkplain java.nio.charset.Charset charset} used to
-     * encode the file is determined by the implementation.
-     * An annotation processing tool may have an <tt>-encoding</tt>
-     * flag or the like for specifying this.  It will typically use
-     * the platform's default encoding if none is specified.
-     *
-     * @param name  canonical (fully qualified) name of the principal type
-     *          being declared in this file
-     * @return a writer for the new file
-     * @throws IOException if the file cannot be created
-     */
-    PrintWriter createSourceFile(String name) throws IOException;
-
-    /**
-     * Creates a new class file, and returns a stream for writing to it.
-     * The file's name and path (relative to the root of all newly created
-     * class files) is based on the name of the type being written.
-     *
-     * @param name canonical (fully qualified) name of the type being written
-     * @return a stream for writing to the new file
-     * @throws IOException if the file cannot be created
-     */
-    OutputStream createClassFile(String name) throws IOException;
-
-    /**
-     * Creates a new text file, and returns a writer for it.
-     * The file is located along with either the
-     * newly created source or newly created binary files.  It may be
-     * named relative to some package (as are source and binary files),
-     * and from there by an arbitrary pathname.  In a loose sense, the
-     * pathname of the new file will be the concatenation of
-     * <tt>loc</tt>, <tt>pkg</tt>, and <tt>relPath</tt>.
-     *
-     * <p> A {@linkplain java.nio.charset.Charset charset} for
-     * encoding the file may be provided.  If none is given, the
-     * charset used to encode source files
-     * (see {@link #createSourceFile(String)}) will be used.
-     *
-     * @param loc location of the new file
-     * @param pkg package relative to which the file should be named,
-     *          or the empty string if none
-     * @param relPath final pathname components of the file
-     * @param charsetName the name of the charset to use, or null if none
-     *          is being explicitly specified
-     * @return a writer for the new file
-     * @throws IOException if the file cannot be created
-     */
-    PrintWriter createTextFile(Location loc,
-                               String pkg,
-                               File relPath,
-                               String charsetName) throws IOException;
-
-    /**
-     * Creates a new binary file, and returns a stream for writing to it.
-     * The file is located along with either the
-     * newly created source or newly created binary files.  It may be
-     * named relative to some package (as are source and binary files),
-     * and from there by an arbitrary pathname.  In a loose sense, the
-     * pathname of the new file will be the concatenation of
-     * <tt>loc</tt>, <tt>pkg</tt>, and <tt>relPath</tt>.
-     *
-     * @param loc location of the new file
-     * @param pkg package relative to which the file should be named,
-     *          or the empty string if none
-     * @param relPath final pathname components of the file
-     * @return a stream for writing to the new file
-     * @throws IOException if the file cannot be created
-     */
-    OutputStream createBinaryFile(Location loc,
-                                  String pkg,
-                                  File relPath) throws IOException;
-
-
-    /**
-     * Locations (subtrees within the file system) where new files are created.
-     *
-     * @deprecated All components of this API have been superseded by
-     * the standardized annotation processing API.  The replacement
-     * for the functionality of this enum is {@link
-     * javax.tools.StandardLocation}.
-     */
-    @Deprecated
-    enum Location {
-        /** The location of new source files. */
-        SOURCE_TREE,
-        /** The location of new class files. */
-        CLASS_TREE
-    }
-}
--- a/src/share/classes/com/sun/mirror/apt/Messager.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-import com.sun.mirror.util.SourcePosition;
-
-/**
- * A <tt>Messager</tt> provides the way for
- * an annotation processor to report error messages, warnings, and
- * other notices.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.annotation.processing.Messager}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface Messager {
-
-    /**
-     * Prints an error message.
-     * Equivalent to <tt>printError(null, msg)</tt>.
-     * @param msg  the message, or an empty string if none
-     */
-    void printError(String msg);
-
-    /**
-     * Prints an error message.
-     * @param pos  the position where the error occured, or null if it is
-     *                  unknown or not applicable
-     * @param msg  the message, or an empty string if none
-     */
-    void printError(SourcePosition pos, String msg);
-
-    /**
-     * Prints a warning message.
-     * Equivalent to <tt>printWarning(null, msg)</tt>.
-     * @param msg  the message, or an empty string if none
-     */
-    void printWarning(String msg);
-
-    /**
-     * Prints a warning message.
-     * @param pos  the position where the warning occured, or null if it is
-     *                  unknown or not applicable
-     * @param msg  the message, or an empty string if none
-     */
-    void printWarning(SourcePosition pos, String msg);
-
-    /**
-     * Prints a notice.
-     * Equivalent to <tt>printNotice(null, msg)</tt>.
-     * @param msg  the message, or an empty string if none
-     */
-    void printNotice(String msg);
-
-    /**
-     * Prints a notice.
-     * @param pos  the position where the noticed occured, or null if it is
-     *                  unknown or not applicable
-     * @param msg  the message, or an empty string if none
-     */
-    void printNotice(SourcePosition pos, String msg);
-}
--- a/src/share/classes/com/sun/mirror/apt/RoundCompleteEvent.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-/**
- * Event for the completion of a round of annotation processing.
- *
- * <p>While this class extends the serializable <tt>EventObject</tt>, it
- * cannot meaningfully be serialized because all of the annotation
- * processing tool's internal state would potentially be needed.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  This class has no direct
- * analog in the standardized API because the different round model
- * renders it unnecessary.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public abstract class RoundCompleteEvent extends java.util.EventObject {
-    private RoundState rs;
-
-    /**
-     * The current <tt>AnnotationProcessorEnvironment</tt> is regarded
-     * as the source of events.
-     *
-     * @param source The source of events
-     * @param rs     The state of the round
-     */
-    protected RoundCompleteEvent(AnnotationProcessorEnvironment source,
-                                 RoundState rs) {
-        super(source);
-        this.rs = rs;
-    }
-
-    /**
-     * Return round state.
-     */
-    public RoundState getRoundState() {
-        return rs;
-    }
-
-    /**
-     * Return source.
-     */
-    public AnnotationProcessorEnvironment getSource() {
-        return (AnnotationProcessorEnvironment)super.getSource();
-    }
-}
--- a/src/share/classes/com/sun/mirror/apt/RoundCompleteListener.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-/**
- * Listener for the completion of a round of annotation processing.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  This interface has no
- * direct analog in the standardized API because the different round
- * model renders it unnecessary.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface RoundCompleteListener extends AnnotationProcessorListener {
-    /**
-     * Invoked after all processors for a round have run to completion.
-     *
-     * @param event An event for round completion
-     */
-    void roundComplete(RoundCompleteEvent event);
-}
--- a/src/share/classes/com/sun/mirror/apt/RoundState.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.apt;
-
-/**
- * Represents the status of a completed round of annotation processing.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.annotation.processing.RoundEnvironment}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface RoundState {
-    /**
-     * Returns <tt>true</tt> if this was the last round of annotation
-     * processing; returns <tt>false</tt> if there will be a subsequent round.
-     */
-    boolean finalRound();
-
-    /**
-     * Returns <tt>true</tt> if an error was raised in this round of processing;
-     * returns <tt>false</tt> otherwise.
-     */
-    boolean errorRaised();
-
-    /**
-     * Returns <tt>true</tt> if new source files were created in this round of
-     * processing; returns <tt>false</tt> otherwise.
-     */
-    boolean sourceFilesCreated();
-
-    /**
-     * Returns <tt>true</tt> if new class files were created in this round of
-     * processing; returns <tt>false</tt> otherwise.
-     */
-    boolean classFilesCreated();
-}
--- a/src/share/classes/com/sun/mirror/apt/package-info.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Classes used to communicate information between {@linkplain
- * com.sun.mirror.apt.AnnotationProcessor annotation processors} and
- * an annotation processing tool.
- *
- * <p>The {@code apt} tool and its associated API have been superseded
- * by the standardized annotation processing API.  The replacement for
- * the functionality in this package is {@link
- * javax.annotation.processing}.
- *
- * @since 1.5
- */
-package com.sun.mirror.apt;
--- a/src/share/classes/com/sun/mirror/declaration/AnnotationMirror.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-import java.util.Map;
-import com.sun.mirror.type.AnnotationType;
-import com.sun.mirror.util.SourcePosition;
-
-
-/**
- * Represents an annotation.  An annotation associates a value with
- * each element of an annotation type.
- *
- * <p> Annotations should not be compared using reference-equality
- * ("<tt>==</tt>").  There is no guarantee that any particular
- * annotation will always be represented by the same object.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.AnnotationMirror}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationMirror {
-
-    /**
-     * Returns the annotation type of this annotation.
-     *
-     * @return the annotation type of this annotation
-     */
-    AnnotationType getAnnotationType();
-
-    /**
-     * Returns the source position of the beginning of this annotation.
-     * Returns null if the position is unknown or not applicable.
-     *
-     * <p>This source position is intended for use in providing diagnostics,
-     * and indicates only approximately where an annotation begins.
-     *
-     * @return  the source position of the beginning of this annotation or
-     * null if the position is unknown or not applicable
-     */
-    SourcePosition getPosition();
-
-    /**
-     * Returns this annotation's elements and their values.
-     * This is returned in the form of a map that associates elements
-     * with their corresponding values.
-     * Only those elements and values explicitly present in the
-     * annotation are included, not those that are implicitly assuming
-     * their default values.
-     * The order of the map matches the order in which the
-     * elements appear in the annotation's source.
-     *
-     * @return this annotation's elements and their values,
-     * or an empty map if there are none
-     */
-    Map<AnnotationTypeElementDeclaration, AnnotationValue> getElementValues();
-}
--- a/src/share/classes/com/sun/mirror/declaration/AnnotationTypeDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.util.Collection;
-
-
-/**
- * Represents the declaration of an annotation type.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.TypeElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationTypeDeclaration extends InterfaceDeclaration {
-
-    /**
-     * Returns the annotation type elements of this annotation type.
-     * These are the methods that are directly declared in the type's
-     * declaration.
-     *
-     * @return the annotation type elements of this annotation type,
-     * or an empty collection if there are none
-     */
-    Collection<AnnotationTypeElementDeclaration> getMethods();
-}
--- a/src/share/classes/com/sun/mirror/declaration/AnnotationTypeElementDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-/**
- * Represents an element of an annotation type.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.ExecutableElement}.
- *
- * @author Joe Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationTypeElementDeclaration extends MethodDeclaration {
-
-    /**
-     * Returns the default value of this element.
-     *
-     * @return the default value of this element, or null if this element
-     * has no default.
-     */
-    AnnotationValue getDefaultValue();
-
-    /**
-     * {@inheritDoc}
-     */
-    AnnotationTypeDeclaration getDeclaringType();
-}
--- a/src/share/classes/com/sun/mirror/declaration/AnnotationValue.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-import com.sun.mirror.util.SourcePosition;
-
-/**
- * Represents a value of an annotation type element.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.AnnotationValue}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationValue {
-
-    /**
-     * Returns the value.
-     * The result has one of the following types:
-     * <ul><li> a wrapper class (such as {@link Integer}) for a primitive type
-     *     <li> {@code String}
-     *     <li> {@code TypeMirror}
-     *     <li> {@code EnumConstantDeclaration}
-     *     <li> {@code AnnotationMirror}
-     *     <li> {@code Collection<AnnotationValue>}
-     *          (representing the elements, in order, if the value is an array)
-     * </ul>
-     *
-     * @return the value
-     */
-    Object getValue();
-
-    /**
-     * Returns the source position of the beginning of this annotation value.
-     * Returns null if the position is unknown or not applicable.
-     *
-     * <p>This source position is intended for use in providing diagnostics,
-     * and indicates only approximately where an annotation value begins.
-     *
-     * @return  the source position of the beginning of this annotation value or
-     * null if the position is unknown or not applicable
-     */
-    SourcePosition getPosition();
-
-    /**
-     * Returns a string representation of this value.
-     * This is returned in a form suitable for representing this value
-     * in the source code of an annotation.
-     *
-     * @return a string representation of this value
-     */
-    String toString();
-}
--- a/src/share/classes/com/sun/mirror/declaration/ClassDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.type.ClassType;
-
-
-/**
- * Represents the declaration of a class.
- * For the declaration of an interface, see {@link InterfaceDeclaration}.
- * Provides access to information about the class, its members, and
- * its constructors.
- * Note that an {@linkplain EnumDeclaration enum} is a kind of class.
- *
- * <p> While a <tt>ClassDeclaration</tt> represents the <i>declaration</i>
- * of a class, a {@link ClassType} represents a class <i>type</i>.
- * See {@link TypeDeclaration} for more on this distinction.
- *
- * <p> {@link com.sun.mirror.util.DeclarationFilter}
- * provides a simple way to select just the items of interest
- * when a method returns a collection of declarations.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.TypeElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- *
- * @see ClassType
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface ClassDeclaration extends TypeDeclaration {
-
-    /**
-     * Returns the class type directly extended by this class.
-     * The only class with no superclass is <tt>java.lang.Object</tt>,
-     * for which this method returns null.
-     *
-     * @return the class type directly extended by this class, or null
-     * if there is none
-     */
-    ClassType getSuperclass();
-
-    /**
-     * Returns the constructors of this class.
-     * This includes the default constructor if this class has
-     * no constructors explicitly declared.
-     *
-     * @return the constructors of this class
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<ConstructorDeclaration> getConstructors();
-
-    /**
-     * {@inheritDoc}
-     */
-    Collection<MethodDeclaration> getMethods();
-}
--- a/src/share/classes/com/sun/mirror/declaration/ConstructorDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-/**
- * Represents a constructor of a class or interface.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.ExecutableElement}.
- *
- * @author Joe Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface ConstructorDeclaration extends ExecutableDeclaration {
-}
--- a/src/share/classes/com/sun/mirror/declaration/Declaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-/**
- * Represents the declaration of a program element such as a package,
- * class, or method.  Each declaration represents a static, language-level
- * construct (and not, for example, a runtime construct of the virtual
- * machine), and typically corresponds one-to-one with a particular
- * fragment of source code.
- *
- * <p> Declarations should be compared using the {@link #equals(Object)}
- * method.  There is no guarantee that any particular declaration will
- * always be represented by the same object.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.Element}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- *
- * @see Declarations
- * @see TypeMirror
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface Declaration {
-
-    /**
-     * Tests whether an object represents the same declaration as this.
-     *
-     * @param obj  the object to be compared with this declaration
-     * @return <tt>true</tt> if the specified object represents the same
-     *          declaration as this
-     */
-    boolean equals(Object obj);
-
-    /**
-     * Returns the text of the documentation ("javadoc") comment of
-     * this declaration.
-     *
-     * @return the documentation comment of this declaration, or <tt>null</tt>
-     *          if there is none
-     */
-    String getDocComment();
-
-    /**
-     * Returns the annotations that are directly present on this declaration.
-     *
-     * @return the annotations directly present on this declaration;
-     *          an empty collection if there are none
-     */
-    Collection<AnnotationMirror> getAnnotationMirrors();
-
-    /**
-     * Returns the annotation of this declaration having the specified
-     * type.  The annotation may be either inherited or directly
-     * present on this declaration.
-     *
-     * <p> The annotation returned by this method could contain an element
-     * whose value is of type <tt>Class</tt>.
-     * This value cannot be returned directly:  information necessary to
-     * locate and load a class (such as the class loader to use) is
-     * not available, and the class might not be loadable at all.
-     * Attempting to read a <tt>Class</tt> object by invoking the relevant
-     * method on the returned annotation
-     * will result in a {@link MirroredTypeException},
-     * from which the corresponding {@link TypeMirror} may be extracted.
-     * Similarly, attempting to read a <tt>Class[]</tt>-valued element
-     * will result in a {@link MirroredTypesException}.
-     *
-     * <blockquote>
-     * <i>Note:</i> This method is unlike
-     * others in this and related interfaces.  It operates on run-time
-     * reflective information -- representations of annotation types
-     * currently loaded into the VM -- rather than on the mirrored
-     * representations defined by and used throughout these
-     * interfaces.  It is intended for callers that are written to
-     * operate on a known, fixed set of annotation types.
-     * </blockquote>
-     *
-     * @param <A>  the annotation type
-     * @param annotationType  the <tt>Class</tt> object corresponding to
-     *          the annotation type
-     * @return the annotation of this declaration having the specified type
-     *
-     * @see #getAnnotationMirrors()
-     */
-    <A extends Annotation> A getAnnotation(Class<A> annotationType);
-
-    /**
-     * Returns the modifiers of this declaration, excluding annotations.
-     * Implicit modifiers, such as the <tt>public</tt> and <tt>static</tt>
-     * modifiers of interface members, are included.
-     *
-     * @return the modifiers of this declaration in undefined order;
-     *          an empty collection if there are none
-     */
-    Collection<Modifier> getModifiers();
-
-    /**
-     * Returns the simple (unqualified) name of this declaration.
-     * The name of a generic type does not include any reference
-     * to its formal type parameters.
-     * For example, the simple name of the interface declaration
-     * {@code java.util.Set<E>} is <tt>"Set"</tt>.
-     * If this declaration represents the empty package, an empty
-     * string is returned.
-     * If it represents a constructor, the simple name of its
-     * declaring class is returned.
-     *
-     * @return the simple name of this declaration
-     */
-    String getSimpleName();
-
-    /**
-     * Returns the source position of the beginning of this declaration.
-     * Returns <tt>null</tt> if the position is unknown or not applicable.
-     *
-     * <p> This source position is intended for use in providing
-     * diagnostics, and indicates only approximately where a declaration
-     * begins.
-     *
-     * @return the source position of the beginning of this declaration,
-     *          or null if the position is unknown or not applicable
-     */
-    SourcePosition getPosition();
-
-    /**
-     * Applies a visitor to this declaration.
-     *
-     * @param v the visitor operating on this declaration
-     */
-    void accept(DeclarationVisitor v);
-}
--- a/src/share/classes/com/sun/mirror/declaration/EnumConstantDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-/**
- * Represents an enum constant declaration.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.VariableElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface EnumConstantDeclaration extends FieldDeclaration {
-    /**
-     * {@inheritDoc}
-     */
-    EnumDeclaration getDeclaringType();
-}
--- a/src/share/classes/com/sun/mirror/declaration/EnumDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.util.Collection;
-
-
-/**
- * Represents the declaration of an enum type.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.TypeElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface EnumDeclaration extends ClassDeclaration {
-
-    /**
-     * Returns the enum constants defined for this enum.
-     *
-     * @return the enum constants defined for this enum,
-     * or an empty collection if there are none
-     */
-    Collection<EnumConstantDeclaration> getEnumConstants();
-}
--- a/src/share/classes/com/sun/mirror/declaration/ExecutableDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.type.ReferenceType;
-
-
-/**
- * Represents a method or constructor of a class or interface.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.ExecutableElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface ExecutableDeclaration extends MemberDeclaration {
-
-    /**
-     * Returns <tt>true</tt> if this method or constructor accepts a variable
-     * number of arguments.
-     *
-     * @return <tt>true</tt> if this method or constructor accepts a variable
-     * number of arguments
-     */
-    boolean isVarArgs();
-
-    /**
-     * Returns the formal type parameters of this method or constructor.
-     * They are returned in declaration order.
-     *
-     * @return the formal type parameters of this method or constructor,
-     * or an empty collection if there are none
-     */
-    Collection<TypeParameterDeclaration> getFormalTypeParameters();
-
-    /**
-     * Returns the formal parameters of this method or constructor.
-     * They are returned in declaration order.
-     *
-     * @return the formal parameters of this method or constructor,
-     * or an empty collection if there are none
-     */
-    Collection<ParameterDeclaration> getParameters();
-
-    /**
-     * Returns the exceptions and other throwables listed in this
-     * method or constructor's <tt>throws</tt> clause.
-     *
-     * @return the exceptions and other throwables listed in the
-     * <tt>throws</tt> clause, or an empty collection if there are none
-     */
-    Collection<ReferenceType> getThrownTypes();
-}
--- a/src/share/classes/com/sun/mirror/declaration/FieldDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import com.sun.mirror.type.TypeMirror;
-
-
-/**
- * Represents a field of a type declaration.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.VariableElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface FieldDeclaration extends MemberDeclaration {
-
-    /**
-     * Returns the type of this field.
-     *
-     * @return the type of this field
-     */
-    TypeMirror getType();
-
-    /**
-     * Returns the value of this field if this field is a compile-time
-     * constant.  Returns <tt>null</tt> otherwise.
-     * The value will be of a primitive type or <tt>String</tt>.
-     * If the value is of a primitive type, it is wrapped in the
-     * appropriate wrapper class (such as {@link Integer}).
-     *
-     * @return the value of this field if this field is a compile-time
-     * constant, or <tt>null</tt> otherwise
-     */
-    Object getConstantValue();
-
-    /**
-     * Returns the text of a <i>constant expression</i> representing the
-     * value of this field if this field is a compile-time constant.
-     * Returns <tt>null</tt> otherwise.
-     * The value will be of a primitive type or <tt>String</tt>.
-     * The text returned is in a form suitable for representing the value
-     * in source code.
-     *
-     * @return the text of a constant expression if this field is a
-     *          compile-time constant, or <tt>null</tt> otherwise
-     */
-    String getConstantExpression();
-}
--- a/src/share/classes/com/sun/mirror/declaration/InterfaceDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import com.sun.mirror.type.InterfaceType;
-
-
-/**
- * Represents the declaration of an interface.
- * Provides access to information about the interface and its members.
- * Note that an {@linkplain AnnotationTypeDeclaration annotation type} is
- * a kind of interface.
- *
- * <p> While an <tt>InterfaceDeclaration</tt> represents the
- * <i>declaration</i> of an interface, an {@link InterfaceType}
- * represents an interface <i>type</i>.
- * See {@link TypeDeclaration} for more on this distinction.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.TypeElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- *
- * @see InterfaceType
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface InterfaceDeclaration extends TypeDeclaration {
-}
--- a/src/share/classes/com/sun/mirror/declaration/MemberDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-/**
- * Represents a declaration that may be a member or constructor of a declared
- * type.  This includes fields, constructors, methods, and (since they
- * may be nested) declared types themselves.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.Element}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface MemberDeclaration extends Declaration {
-
-    /**
-     * Returns the type declaration within which this member or constructor
-     * is declared.
-     * If this is the declaration of a top-level type (a non-nested class
-     * or interface), returns null.
-     *
-     * @return the type declaration within which this member or constructor
-     * is declared, or null if there is none
-     */
-    TypeDeclaration getDeclaringType();
-}
--- a/src/share/classes/com/sun/mirror/declaration/MethodDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import com.sun.mirror.type.TypeMirror;
-import com.sun.mirror.type.VoidType;
-
-
-/**
- * Represents a method of a class or interface.
- * Note that an
- * {@linkplain AnnotationTypeElementDeclaration annotation type element}
- * is a kind of method.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.ExecutableElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface MethodDeclaration extends ExecutableDeclaration {
-
-    /**
-     * Returns the formal return type of this method.
-     * Returns {@link VoidType} if this method does not return a value.
-     *
-     * @return the formal return type of this method
-     */
-    TypeMirror getReturnType();
-}
--- a/src/share/classes/com/sun/mirror/declaration/Modifier.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-/**
- * Represents a modifier on the declaration of a program element such
- * as a class, method, or field.
- *
- * <p> Not all modifiers are applicable to all kinds of declarations.
- * When two or more modifiers appear in the source code of a declaration,
- * then it is customary, though not required, that they appear in the same
- * order as the constants listed in the detail section below.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this enum is {@link javax.lang.model.element.Modifier}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public enum Modifier {
-
-    // See JLS2 sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1.
-    // java.lang.reflect.Modifier includes INTERFACE, but that's a VMism.
-
-    /** The modifier <tt>public</tt> */         PUBLIC,
-    /** The modifier <tt>protected</tt> */      PROTECTED,
-    /** The modifier <tt>private</tt> */        PRIVATE,
-    /** The modifier <tt>abstract</tt> */       ABSTRACT,
-    /** The modifier <tt>static</tt> */         STATIC,
-    /** The modifier <tt>final</tt> */          FINAL,
-    /** The modifier <tt>transient</tt> */      TRANSIENT,
-    /** The modifier <tt>volatile</tt> */       VOLATILE,
-    /** The modifier <tt>synchronized</tt> */   SYNCHRONIZED,
-    /** The modifier <tt>native</tt> */         NATIVE,
-    /** The modifier <tt>strictfp</tt> */       STRICTFP;
-
-
-    private String lowercase = null;    // modifier name in lowercase
-
-    /**
-     * Returns this modifier's name in lowercase.
-     */
-    public String toString() {
-        if (lowercase == null) {
-           lowercase = name().toLowerCase(java.util.Locale.US);
-        }
-        return lowercase;
-    }
-}
--- a/src/share/classes/com/sun/mirror/declaration/PackageDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.util.Collection;
-
-
-/**
- * Represents the declaration of a package.  Provides access to information
- * about the package and its members.
- *
- * <p> {@link com.sun.mirror.util.DeclarationFilter}
- * provides a simple way to select just the items of interest
- * when a method returns a collection of declarations.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.PackageElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface PackageDeclaration extends Declaration {
-
-    /**
-     * Returns the fully qualified name of this package.
-     * This is also known as the package's <i>canonical</i> name.
-     *
-     * @return the fully qualified name of this package, or the
-     * empty string if this is the unnamed package
-     */
-    String getQualifiedName();
-
-    /**
-     * Returns the declarations of the top-level classes in this package.
-     * Interfaces are not included, but enum types are.
-     *
-     * @return the declarations of the top-level classes in this package
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<ClassDeclaration> getClasses();
-
-    /**
-     * Returns the declarations of the top-level enum types in this package.
-     *
-     * @return the declarations of the top-level enum types in this package
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<EnumDeclaration> getEnums();
-
-    /**
-     * Returns the declarations of the top-level interfaces in this package.
-     * Annotation types are included.
-     *
-     * @return the declarations of the top-level interfaces in this package
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<InterfaceDeclaration> getInterfaces();
-
-    /**
-     * Returns the declarations of the top-level annotation types in this
-     * package.
-     *
-     * @return the declarations of the top-level annotation types in this
-     * package
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<AnnotationTypeDeclaration> getAnnotationTypes();
-}
--- a/src/share/classes/com/sun/mirror/declaration/ParameterDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import com.sun.mirror.type.TypeMirror;
-
-
-/**
- * Represents a formal parameter of a method or constructor.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.VariableElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface ParameterDeclaration extends Declaration {
-
-    /**
-     * Returns the type of this parameter.
-     *
-     * @return the type of this parameter
-     */
-    TypeMirror getType();
-}
--- a/src/share/classes/com/sun/mirror/declaration/TypeDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.type.*;
-
-
-/**
- * Represents the declaration of a class or interface.
- * Provides access to information about the type and its members.
- * Note that an {@linkplain EnumDeclaration enum} is a kind of class,
- * and an {@linkplain AnnotationTypeDeclaration annotation type} is
- * a kind of interface.
- *
- * <p> <a name="DECL_VS_TYPE"></a>
- * While a <tt>TypeDeclaration</tt> represents the <i>declaration</i>
- * of a class or interface, a {@link DeclaredType} represents a class
- * or interface <i>type</i>, the latter being a use
- * (or <i>invocation</i>) of the former.
- * The distinction is most apparent with generic types,
- * for which a single declaration can define a whole
- * family of types.  For example, the declaration of
- * {@code java.util.Set} corresponds to the parameterized types
- * {@code java.util.Set<String>} and {@code java.util.Set<Number>}
- * (and many others), and to the raw type {@code java.util.Set}.
- *
- * <p> {@link com.sun.mirror.util.DeclarationFilter}
- * provides a simple way to select just the items of interest
- * when a method returns a collection of declarations.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.element.TypeElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- *
- * @see DeclaredType
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface TypeDeclaration extends MemberDeclaration {
-
-    /**
-     * Returns the package within which this type is declared.
-     *
-     * @return the package within which this type is declared
-     */
-    PackageDeclaration getPackage();
-
-    /**
-     * Returns the fully qualified name of this class or interface
-     * declaration.  More precisely, it returns the <i>canonical</i>
-     * name.
-     * The name of a generic type does not include any reference
-     * to its formal type parameters.
-     * For example, the the fully qualified name of the interface declaration
-     * {@code java.util.Set<E>} is <tt>"java.util.Set"</tt>.
-     *
-     * @return the fully qualified name of this class or interface declaration
-     */
-    String getQualifiedName();
-
-    /**
-     * Returns the formal type parameters of this class or interface.
-     *
-     * @return the formal type parameters, or an empty collection
-     * if there are none
-     */
-    Collection<TypeParameterDeclaration> getFormalTypeParameters();
-
-    /**
-     * Returns the interface types directly implemented by this class
-     * or extended by this interface.
-     *
-     * @return the interface types directly implemented by this class
-     * or extended by this interface, or an empty collection if there are none
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<InterfaceType> getSuperinterfaces();
-
-    /**
-     * Returns the fields that are directly declared by this class or
-     * interface.  Includes enum constants.
-     *
-     * @return the fields that are directly declared,
-     * or an empty collection if there are none
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<FieldDeclaration> getFields();
-
-    /**
-     * Returns the methods that are directly declared by this class or
-     * interface.  Includes annotation type elements.  Excludes
-     * implicitly declared methods of an interface, such as
-     * <tt>toString</tt>, that correspond to the methods of
-     * <tt>java.lang.Object</tt>.
-     *
-     * @return the methods that are directly declared,
-     * or an empty collection if there are none
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<? extends MethodDeclaration> getMethods();
-
-    /**
-     * Returns the declarations of the nested classes and interfaces
-     * that are directly declared by this class or interface.
-     *
-     * @return the declarations of the nested classes and interfaces,
-     * or an empty collection if there are none
-     *
-     * @see com.sun.mirror.util.DeclarationFilter
-     */
-    Collection<TypeDeclaration> getNestedTypes();
-}
--- a/src/share/classes/com/sun/mirror/declaration/TypeParameterDeclaration.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.type.*;
-
-
-/**
- * Represents a formal type parameter of a generic type, method,
- * or constructor declaration.
- * A type parameter declares a {@link TypeVariable}.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.TypeParameterElement}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface TypeParameterDeclaration extends Declaration {
-
-    /**
-     * Returns the bounds of this type parameter.
-     * These are the types given by the <i>extends</i> clause.
-     * If there is no explicit <i>extends</i> clause, then
-     * <tt>java.lang.Object</tt> is considered to be the sole bound.
-     *
-     * @return the bounds of this type parameter
-     */
-    Collection<ReferenceType> getBounds();
-
-    /**
-     * Returns the type, method, or constructor declaration within which
-     * this type parameter is declared.
-     *
-     * @return the declaration within which this type parameter is declared
-     */
-    Declaration getOwner();
-}
--- a/src/share/classes/com/sun/mirror/declaration/package-info.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Interfaces used to model program element declarations.  A
- * declaration is represented by the appropriate subinterface of
- * {@link com.sun.mirror.declaration.Declaration}, and an annotation
- * is represented as an {@link
- * com.sun.mirror.declaration.AnnotationMirror}.
- *
- * <p>The {@code apt} tool and its associated API have been superseded
- * by the standardized annotation processing API.  The replacement for
- * the functionality in this package is {@link
- * javax.lang.model.element}.
- *
- * @since 1.5
- */
-package com.sun.mirror.declaration;
--- a/src/share/classes/com/sun/mirror/overview.html	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-</head>
-
-<body bgcolor="white">
-
-The Mirror API is used to model the semantic structure of a program.
-It provides representations of the entities
-declared in a program, such as classes, methods, and fields.
-Constructs below the method level, such as 
-individual statements and expressions, are not represented.
-
-<p> Also included is support for writing
-{@linkplain com.sun.mirror.apt.AnnotationProcessor annotation processors}
-to examine and process the annotations
-of program elements.  An annotation processor may, as an example, create
-new source files and XML documents to be used in conjunction with the
-original code.
-
-
-<h4> Characteristics of the API </h4>
-
-A program is represented at the language level, rather than at the
-level of the virtual machine.  Nested classes, for example, are
-handled as first-class constructs, 
-rather than in the translated form understood by the VM.
-Both source code and compiled code (class files) may be modeled
-in this way.
-
-<p> Programs are modeled in their static, or build-time, form.
-This differs from the {@linkplain java.lang.reflect reflection} API,
-which provides run-time information about classes and objects.
-
-<p> The API does not provide direct support for generating new code.
-
-
-<h4> Declarations and Types </h4>
-  
-The mirror API represents program constructs principally through the
-{@link com.sun.mirror.declaration.Declaration} interface
-and its hierarchy of subinterfaces in the package {@link
-com.sun.mirror.declaration}.  A <tt>Declaration</tt> represents a
-program element such as a package, class, or method.
-The interface hierarchy is depicted
-<a href="com/sun/mirror/declaration/package-tree.html"> here</a>.
-
-<p> Types are represented by the {@link com.sun.mirror.type.TypeMirror}
-interface and its hierarchy of subinterfaces in the
-package {@link com.sun.mirror.type}.  Types include primitive types,
-class and interface types, array types, type variables, and wildcards.
-The interface hierarchy is depicted
-<a href="com/sun/mirror/type/package-tree.html"> here</a>.
-
-<p> The API makes a clear distinction between declarations and types.
-This is most significant for generic types, where a single declaration
-can define an infinite family of types.  For example, the declaration of
-<tt>java.util.Set</tt> defines the raw type <tt>java.util.Set</tt>,
-the parameterized type {@code java.util.Set<String>},
-and much more.  Only the declaration can be annotated, for example,
-and only a type can appear in a method signature.
-
-<p> A program being modeled may be incomplete, in that
-it may depend on an unknown class or interface type.
-This may be the result of a processing error such as a missing class file,
-or perhaps the missing type is to be created by an annotation processor.
-See {@link com.sun.mirror.type.DeclaredType} for information on
-how such unknown types are handled.
-
-
-<h4> Utilities and Tool Support </h4>
-
-The {@link com.sun.mirror.util} package provides
-utilities to assist in the processing of declarations and types.
-Included is support for using the visitor design pattern when
-operating on declaration and type objects.
-
-<p> The {@link com.sun.mirror.apt} package supports the writing
-of annotation processors.  It provides the mechanism for them to
-interact with an annotation processing tool.
-
-
-@since 1.5
-
-</body>
-</html>
--- a/src/share/classes/com/sun/mirror/type/AnnotationType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-
-
-/**
- * Represents an annotation type.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.type.DeclaredType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface AnnotationType extends InterfaceType {
-
-    /**
-     * {@inheritDoc}
-     */
-    AnnotationTypeDeclaration getDeclaration();
-}
--- a/src/share/classes/com/sun/mirror/type/ArrayType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-/**
- * Represents an array type.
- * A multidimensional array type is represented as an array type
- * whose component type is also an array type.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.type.ArrayType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface ArrayType extends ReferenceType {
-
-    /**
-     * Returns the component type of this array type.
-     *
-     * @return the component type of this array type
-     */
-    TypeMirror getComponentType();
-}
--- a/src/share/classes/com/sun/mirror/type/ClassType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-
-
-/**
- * Represents a class type.
- * Interface types are represented separately by {@link InterfaceType}.
- * Note that an {@linkplain EnumType enum} is a kind of class.
- *
- * <p> While a {@link ClassDeclaration} represents the <i>declaration</i>
- * of a class, a <tt>ClassType</tt> represents a class <i>type</i>.
- * See {@link TypeDeclaration} for more on this distinction.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.type.DeclaredType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface ClassType extends DeclaredType {
-
-    /**
-     * {@inheritDoc}
-     */
-    ClassDeclaration getDeclaration();
-
-    /**
-     * Returns the class type that is a direct supertype of this one.
-     * This is the superclass of this type's declaring class, with any
-     * type arguments substituted in.
-     * The only class with no superclass is <tt>java.lang.Object</tt>,
-     * for which this method returns <tt>null</tt>.
-     *
-     * <p> For example, the class type extended by
-     * {@code java.util.TreeSet<String>} is
-     * {@code java.util.AbstractSet<String>}.
-     *
-     * @return the class type that is a direct supertype of this one,
-     * or <tt>null</tt> if there is none
-     */
-    ClassType getSuperclass();
-}
--- a/src/share/classes/com/sun/mirror/type/DeclaredType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.TypeDeclaration;
-
-
-/**
- * Represents a declared type, either a class type or an interface type.
- * This includes parameterized types such as {@code java.util.Set<String>}
- * as well as raw types.
- *
- * <p> While a <tt>TypeDeclaration</tt> represents the <i>declaration</i>
- * of a class or interface, a <tt>DeclaredType</tt> represents a class
- * or interface <i>type</i>, the latter being a use of the former.
- * See {@link TypeDeclaration} for more on this distinction.
- *
- * <p> A <tt>DeclaredType</tt> may represent a type
- * for which details (declaration, supertypes, <i>etc.</i>) are unknown.
- * This may be the result of a processing error, such as a missing class file,
- * and is indicated by {@link #getDeclaration()} returning <tt>null</tt>.
- * Other method invocations on such an unknown type will not, in general,
- * return meaningful results.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.type.DeclaredType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface DeclaredType extends ReferenceType {
-
-    /**
-     * Returns the declaration of this type.
-     *
-     * <p> Returns null if this type's declaration is unknown.  This may
-     * be the result of a processing error, such as a missing class file.
-     *
-     * @return the declaration of this type, or null if unknown
-     */
-    TypeDeclaration getDeclaration();
-
-    /**
-     * Returns the type that contains this type as a member.
-     * Returns <tt>null</tt> if this is a top-level type.
-     *
-     * <p> For example, the containing type of {@code O.I<S>}
-     * is the type {@code O}, and the containing type of
-     * {@code O<T>.I<S>} is the type {@code O<T>}.
-     *
-     * @return the type that contains this type,
-     * or <tt>null</tt> if this is a top-level type
-     */
-    DeclaredType getContainingType();
-
-    /**
-     * Returns (in order) the actual type arguments of this type.
-     * For a generic type nested within another generic type
-     * (such as {@code Outer<String>.Inner<Number>}), only the type
-     * arguments of the innermost type are included.
-     *
-     * @return the actual type arguments of this type, or an empty collection
-     * if there are none
-     */
-    Collection<TypeMirror> getActualTypeArguments();
-
-    /**
-     * Returns the interface types that are direct supertypes of this type.
-     * These are the interface types implemented or extended
-     * by this type's declaration, with any type arguments
-     * substituted in.
-     *
-     * <p> For example, the interface type extended by
-     * {@code java.util.Set<String>} is {@code java.util.Collection<String>}.
-     *
-     * @return the interface types that are direct supertypes of this type,
-     * or an empty collection if there are none
-     */
-    Collection<InterfaceType> getSuperinterfaces();
-}
--- a/src/share/classes/com/sun/mirror/type/EnumType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import com.sun.mirror.declaration.EnumDeclaration;
-
-
-/**
- * Represents an enum type.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.type.DeclaredType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface EnumType extends ClassType {
-
-    /**
-     * {@inheritDoc}
-     */
-    EnumDeclaration getDeclaration();
-}
--- a/src/share/classes/com/sun/mirror/type/InterfaceType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-
-
-/**
- * Represents an interface type.
- * Note that an {@linkplain AnnotationType annotation type} is
- * a kind of interface.
- *
- * <p> While an {@link InterfaceDeclaration} represents the
- * <i>declaration</i> of an interface, an <tt>InterfaceType</tt>
- * represents an interface <i>type</i>.
- * See {@link TypeDeclaration} for more on this distinction.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.type.DeclaredType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface InterfaceType extends DeclaredType {
-
-    /**
-     * {@inheritDoc}
-     */
-    InterfaceDeclaration getDeclaration();
-}
--- a/src/share/classes/com/sun/mirror/type/MirroredTypeException.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import java.lang.annotation.Annotation;
-
-import com.sun.mirror.declaration.Declaration;
-
-
-/**
- * Thrown when an application attempts to access the {@link Class} object
- * corresponding to a {@link TypeMirror}.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this exception is {@link
- * javax.lang.model.type.MirroredTypeException}.
- *
- * @see MirroredTypesException
- * @see Declaration#getAnnotation(Class)
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class MirroredTypeException extends RuntimeException {
-
-    private static final long serialVersionUID = 1;
-
-    private transient TypeMirror type;          // cannot be serialized
-    private String name;                        // type's qualified "name"
-
-    /**
-     * Constructs a new MirroredTypeException for the specified type.
-     *
-     * @param type  the type being accessed
-     */
-    public MirroredTypeException(TypeMirror type) {
-        super("Attempt to access Class object for TypeMirror " + type);
-        this.type = type;
-        name = type.toString();
-    }
-
-    /**
-     * Returns the type mirror corresponding to the type being accessed.
-     * The type mirror may be unavailable if this exception has been
-     * serialized and then read back in.
-     *
-     * @return the type mirror, or <tt>null</tt> if unavailable
-     */
-    public TypeMirror getTypeMirror() {
-        return type;
-    }
-
-    /**
-     * Returns the fully qualified name of the type being accessed.
-     * More precisely, returns the canonical name of a class,
-     * interface, array, or primitive, and returns <tt>"void"</tt> for
-     * the pseudo-type representing the type of <tt>void</tt>.
-     *
-     * @return the fully qualified name of the type being accessed
-     */
-    public String getQualifiedName() {
-        return name;
-    }
-}
--- a/src/share/classes/com/sun/mirror/type/MirroredTypesException.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import com.sun.mirror.declaration.Declaration;
-
-
-/**
- * Thrown when an application attempts to access a sequence of {@link Class}
- * objects each corresponding to a {@link TypeMirror}.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this exception is {@link
- * javax.lang.model.type.MirroredTypesException}.
- *
- * @see MirroredTypeException
- * @see Declaration#getAnnotation(Class)
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class MirroredTypesException extends RuntimeException {
-
-    private static final long serialVersionUID = 1;
-
-    private transient Collection<TypeMirror> types;     // cannot be serialized
-    private Collection<String> names;           // types' qualified "names"
-
-    /**
-     * Constructs a new MirroredTypesException for the specified types.
-     *
-     * @param types  an ordered collection of the types being accessed
-     */
-    public MirroredTypesException(Collection<TypeMirror> types) {
-        super("Attempt to access Class objects for TypeMirrors " + types);
-        this.types = types;
-        names = new ArrayList<String>();
-        for (TypeMirror t : types) {
-            names.add(t.toString());
-        }
-    }
-
-    /**
-     * Returns the type mirrors corresponding to the types being accessed.
-     * The type mirrors may be unavailable if this exception has been
-     * serialized and then read back in.
-     *
-     * @return the type mirrors in order, or <tt>null</tt> if unavailable
-     */
-    public Collection<TypeMirror> getTypeMirrors() {
-        return (types != null)
-                ? Collections.unmodifiableCollection(types)
-                : null;
-    }
-
-    /**
-     * Returns the fully qualified names of the types being accessed.
-     * More precisely, returns the canonical names of each class,
-     * interface, array, or primitive, and <tt>"void"</tt> for
-     * the pseudo-type representing the type of <tt>void</tt>.
-     *
-     * @return the fully qualified names, in order, of the types being
-     *          accessed
-     */
-    public Collection<String> getQualifiedNames() {
-        return Collections.unmodifiableCollection(names);
-    }
-}
--- a/src/share/classes/com/sun/mirror/type/PrimitiveType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-/**
- * Represents a primitive type.  These include
- * <tt>boolean</tt>, <tt>byte</tt>, <tt>short</tt>, <tt>int</tt>,
- * <tt>long</tt>, <tt>char</tt>, <tt>float</tt>, and <tt>double</tt>.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.type.PrimitiveType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface PrimitiveType extends TypeMirror {
-
-    /**
-     * Returns the kind of primitive type that this object represents.
-     *
-     * @return the kind of primitive type that this object represents
-     */
-    Kind getKind();
-
-    /**
-     * An enumeration of the different kinds of primitive types.
-     *
-     * @deprecated All components of this API have been superseded by
-     * the standardized annotation processing API.  The replacement
-     * for the functionality of this enum is {@link
-     * javax.lang.model.type.TypeKind}.
-     */
-    @Deprecated
-    enum Kind {
-        /** The primitive type <tt>boolean</tt> */      BOOLEAN,
-        /** The primitive type <tt>byte</tt> */         BYTE,
-        /** The primitive type <tt>short</tt> */        SHORT,
-        /** The primitive type <tt>int</tt> */          INT,
-        /** The primitive type <tt>long</tt> */         LONG,
-        /** The primitive type <tt>char</tt> */         CHAR,
-        /** The primitive type <tt>float</tt> */        FLOAT,
-        /** The primitive type <tt>double</tt> */       DOUBLE
-    }
-}
--- a/src/share/classes/com/sun/mirror/type/ReferenceType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-/**
- * Represents a reference type.
- * These include class and interface types, array types, and type variables.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.type.ReferenceType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface ReferenceType extends TypeMirror {
-}
--- a/src/share/classes/com/sun/mirror/type/TypeMirror.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import com.sun.mirror.declaration.Declaration;
-import com.sun.mirror.util.Types;
-import com.sun.mirror.util.TypeVisitor;
-
-
-/**
- * Represents a type in the Java programming language.
- * Types include primitive types, class and interface types, array
- * types, and type variables.  Wildcard type arguments, and the
- * pseudo-type representing the type of <tt>void</tt>, are represented
- * by type mirrors as well.
- *
- * <p> Types may be compared using the utility methods in
- * {@link Types}.
- * There is no guarantee that any particular type will
- * always be represented by the same object.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.type.TypeMirror}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- *
- * @see Declaration
- * @see Types
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface TypeMirror {
-
-    /**
-     * Returns a string representation of this type.
-     * Any names embedded in the expression are qualified.
-     *
-     * @return a string representation of this type
-     */
-    String toString();
-
-    /**
-     * Tests whether two types represent the same type.
-     *
-     * @param obj the object to be compared with this type
-     * @return <tt>true</tt> if the specified object represents the same
-     *          type as this.
-     */
-    boolean equals(Object obj);
-
-    /**
-     * Applies a visitor to this type.
-     *
-     * @param v the visitor operating on this type
-     */
-    void accept(TypeVisitor v);
-}
--- a/src/share/classes/com/sun/mirror/type/TypeVariable.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-
-
-/**
- * Represents a type variable.
- * A type variable is declared by a
- * {@linkplain TypeParameterDeclaration type parameter} of a
- * type, method, or constructor.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.type.TypeVariable}.
- *
- * @author Joe Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface TypeVariable extends ReferenceType {
-
-    /**
-     * Returns the type parameter that declared this type variable.
-     *
-     * @return the type parameter that declared this type variable
-     */
-    TypeParameterDeclaration getDeclaration();
-}
--- a/src/share/classes/com/sun/mirror/type/VoidType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import com.sun.mirror.declaration.MethodDeclaration;
-
-
-/**
- * A pseudo-type representing the type of <tt>void</tt>.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is included in {@link
- * javax.lang.model.type.NoType}.
- *
- * @see MethodDeclaration#getReturnType()
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface VoidType extends TypeMirror {
-}
--- a/src/share/classes/com/sun/mirror/type/WildcardType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.type;
-
-
-import java.util.Collection;
-
-
-/**
- * Represents a wildcard type argument.
- * Examples include:    <pre><tt>
- *   ?
- *   ? extends Number
- *   ? super T
- * </tt></pre>
- *
- * <p> A wildcard may have its upper bound explicitly set by an
- * <tt>extends</tt> clause, its lower bound explicitly set by a
- * <tt>super</tt> clause, or neither (but not both).
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.type.WildcardType}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface WildcardType extends TypeMirror {
-
-    /**
-     * Returns the upper bounds of this wildcard.
-     * If no upper bound is explicitly declared, then
-     * an empty collection is returned.
-     *
-     * @return the upper bounds of this wildcard
-     */
-    Collection<ReferenceType> getUpperBounds();
-
-    /**
-     * Returns the lower bounds of this wildcard.
-     * If no lower bound is explicitly declared, then
-     * an empty collection is returned.
-     *
-     * @return the lower bounds of this wildcard
-     */
-    Collection<ReferenceType> getLowerBounds();
-}
--- a/src/share/classes/com/sun/mirror/type/package-info.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Interfaces used to model types.  A type is represented by the
- * appropriate subinterface of {@link com.sun.mirror.type.TypeMirror}.
- *
- * <p>The {@code apt} tool and its associated API have been
- * superseded by the standardized annotation processing API.  The
- * replacement for the functionality in this package is {@link
- * javax.lang.model.type}.
- *
- * @since 1.5
- */
-package com.sun.mirror.type;
--- a/src/share/classes/com/sun/mirror/util/DeclarationFilter.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,319 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.sun.mirror.declaration.Declaration;
-import com.sun.mirror.declaration.Modifier;
-
-import static com.sun.mirror.declaration.Modifier.*;
-
-
-/**
- * A filter for selecting just the items of interest
- * from a collection of declarations.
- * The filter is said to <i>select</i> or to <i>match</i> those declarations.
- * Filters can be created in several ways:
- * by the static methods described below,
- * by negating or composing existing filters,
- * or by subclasses that implement arbitrary matching rules.
- *
- * <p> A subclass can create an arbitrary filter simply by implementing
- * the {@link #matches(Declaration)} method.
- *
- * <p> Examples.
- * <p> Selecting the <tt>public</tt> declarations from a collection:
- * <blockquote><pre>
- *     result = FILTER_PUBLIC.filter(decls);            </pre></blockquote>
- * Selecting class declarations (including enums):
- * <blockquote><pre>
- *     classFilter = DeclarationFilter.getFilter(ClassDeclaration.class);
- *     result = classFilter.filter(decls);              </pre></blockquote>
- * Selecting class declarations but excluding enums:
- * <blockquote><pre>
- *     enumFilter = DeclarationFilter.getFilter(EnumDeclaration.class);
- *     compoundFilter = classFilter.and(enumFilter.not());
- *     result = compoundFilter.filter(decls);           </pre></blockquote>
- * Selecting declarations named "Bob":
- * <blockquote><pre>
- *     nameFilter = new DeclarationFilter() {
- *                      public boolean matches(Declaration d) {
- *                          return d.getSimpleName().equals("Bob");
- *                      }
- *                  };
- *     result = nameFilter.filter(decls);               </pre></blockquote>
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this class is {@link
- * javax.lang.model.util.ElementFilter}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class DeclarationFilter {
-
-    // Predefined filters for convenience.
-
-    /**
-     * A filter that selects only <tt>public</tt> declarations.
-     */
-    public static final DeclarationFilter FILTER_PUBLIC =
-            new AccessFilter(PUBLIC);
-
-    /**
-     * A filter that selects only <tt>protected</tt> declarations.
-     */
-    public static final DeclarationFilter FILTER_PROTECTED =
-            new AccessFilter(PROTECTED);
-
-    /**
-     * A filter that selects only <tt>public</tt> or <tt>protected</tt>
-     * declarations.
-     */
-    public static final DeclarationFilter FILTER_PUBLIC_OR_PROTECTED =
-            new AccessFilter(PUBLIC, PROTECTED);
-
-    /**
-     * A filter that selects only package-private (<i>default</i>)
-     * declarations.
-     */
-    public static final DeclarationFilter FILTER_PACKAGE =
-            new AccessFilter();
-
-    /**
-     * A filter that selects only <tt>private</tt> declarations.
-     */
-    public static final DeclarationFilter FILTER_PRIVATE =
-            new AccessFilter(PRIVATE);
-
-
-    /**
-     * Constructs an identity filter:  one that selects all declarations.
-     */
-    public DeclarationFilter() {
-    }
-
-
-
-    // Methods to create a filter.
-
-    /**
-     * Returns a filter that selects declarations containing all of a
-     * collection of modifiers.
-     *
-     * @param mods  the modifiers to match (non-null)
-     * @return a filter that matches declarations containing <tt>mods</tt>
-     */
-    public static DeclarationFilter getFilter(
-                                             final Collection<Modifier> mods) {
-        return new DeclarationFilter() {
-            public boolean matches(Declaration d) {
-                return d.getModifiers().containsAll(mods);
-            }
-        };
-    }
-
-    /**
-     * Returns a filter that selects declarations of a particular kind.
-     * For example, there may be a filter that selects only class
-     * declarations, or only fields.
-     * The filter will select declarations of the specified kind,
-     * and also any subtypes of that kind; for example, a field filter
-     * will also select enum constants.
-     *
-     * @param kind  the kind of declarations to select
-     * @return a filter that selects declarations of a particular kind
-     */
-    public static DeclarationFilter getFilter(
-                                     final Class<? extends Declaration> kind) {
-        return new DeclarationFilter() {
-            public boolean matches(Declaration d) {
-                return kind.isInstance(d);
-            }
-        };
-    }
-
-    /**
-     * Returns a filter that selects those declarations selected
-     * by both this filter and another.
-     *
-     * @param f  filter to be composed with this one
-     * @return a filter that selects those declarations selected by
-     *          both this filter and another
-     */
-    public DeclarationFilter and(DeclarationFilter f) {
-        final DeclarationFilter f1 = this;
-        final DeclarationFilter f2 = f;
-        return new DeclarationFilter() {
-            public boolean matches(Declaration d) {
-                return f1.matches(d) && f2.matches(d);
-            }
-        };
-    }
-
-    /**
-     * Returns a filter that selects those declarations selected
-     * by either this filter or another.
-     *
-     * @param f  filter to be composed with this one
-     * @return a filter that selects those declarations selected by
-     *          either this filter or another
-     */
-    public DeclarationFilter or(DeclarationFilter f) {
-        final DeclarationFilter f1 = this;
-        final DeclarationFilter f2 = f;
-        return new DeclarationFilter() {
-            public boolean matches(Declaration d) {
-                return f1.matches(d) || f2.matches(d);
-            }
-        };
-    }
-
-    /**
-     * Returns a filter that selects those declarations not selected
-     * by this filter.
-     *
-     * @return a filter that selects those declarations not selected
-     * by this filter
-     */
-    public DeclarationFilter not() {
-        return new DeclarationFilter() {
-            public boolean matches(Declaration d) {
-                return !DeclarationFilter.this.matches(d);
-            }
-        };
-    }
-
-
-
-    // Methods to apply a filter.
-
-    /**
-     * Tests whether this filter matches a given declaration.
-     * The default implementation always returns <tt>true</tt>;
-     * subclasses should override this.
-     *
-     * @param decl  the declaration to match
-     * @return <tt>true</tt> if this filter matches the given declaration
-     */
-    public boolean matches(Declaration decl) {
-        return true;
-    }
-
-    /**
-     * Returns the declarations matched by this filter.
-     * The result is a collection of the same type as the argument;
-     * the {@linkplain #filter(Collection, Class) two-parameter version}
-     * of <tt>filter</tt> offers control over the result type.
-     *
-     * @param <D>    type of the declarations being filtered
-     * @param decls  declarations being filtered
-     * @return the declarations matched by this filter
-     */
-    public <D extends Declaration> Collection<D> filter(Collection<D> decls) {
-        ArrayList<D> res = new ArrayList<D>(decls.size());
-        for (D d : decls) {
-            if (matches(d)) {
-                res.add(d);
-            }
-        }
-        return res;
-    }
-
-    /**
-     * Returns the declarations matched by this filter, with the result
-     * being restricted to declarations of a given kind.
-     * Similar to the simpler
-     * {@linkplain #filter(Collection) single-parameter version}
-     * of <tt>filter</tt>, but the result type is specified explicitly.
-     *
-     * @param <D>      type of the declarations being returned
-     * @param decls    declarations being filtered
-     * @param resType  type of the declarations being returned --
-     *                  the reflective view of <tt>D</tt>
-     * @return the declarations matched by this filter, restricted to those
-     *                  of the specified type
-     */
-    public <D extends Declaration> Collection<D>
-            filter(Collection<? extends Declaration> decls, Class<D> resType) {
-        ArrayList<D> res = new ArrayList<D>(decls.size());
-        for (Declaration d : decls) {
-            if (resType.isInstance(d) && matches(d)) {
-                res.add(resType.cast(d));
-            }
-        }
-        return res;
-    }
-
-
-
-    /*
-     * A filter based on access modifiers.
-     */
-    private static class AccessFilter extends DeclarationFilter {
-
-        // The first access modifier to filter on, or null if we're looking
-        // for declarations with no access modifiers.
-        private Modifier mod1 = null;
-
-        // The second access modifier to filter on, or null if none.
-        private Modifier mod2 = null;
-
-        // Returns a filter that matches declarations with no access
-        // modifiers.
-        AccessFilter() {
-        }
-
-        // Returns a filter that matches m.
-        AccessFilter(Modifier m) {
-            mod1 = m;
-        }
-
-        // Returns a filter that matches either m1 or m2.
-        AccessFilter(Modifier m1, Modifier m2) {
-            mod1 = m1;
-            mod2 = m2;
-        }
-
-        public boolean matches(Declaration d) {
-            Collection<Modifier> mods = d.getModifiers();
-            if (mod1 == null) { // looking for package private
-                return !(mods.contains(PUBLIC) ||
-                         mods.contains(PROTECTED) ||
-                         mods.contains(PRIVATE));
-            }
-            return mods.contains(mod1) &&
-                   (mod2 == null || mods.contains(mod2));
-        }
-    }
-}
--- a/src/share/classes/com/sun/mirror/util/DeclarationScanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-import com.sun.mirror.declaration.*;
-
-/**
- * A visitor for declarations that scans declarations contained within
- * the given declaration.  For example, when visiting a class, the
- * methods, fields, constructors, and nested types of the class are
- * also visited.
- *
- * <p> To control the processing done on a declaration, users of this
- * class pass in their own visitors for pre and post processing.  The
- * preprocessing visitor is called before the contained declarations
- * are scanned; the postprocessing visitor is called after the
- * contained declarations are scanned.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this class is {@link
- * javax.lang.model.util.ElementScanner6}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-class DeclarationScanner implements DeclarationVisitor {
-    protected DeclarationVisitor pre;
-    protected DeclarationVisitor post;
-
-    DeclarationScanner(DeclarationVisitor pre, DeclarationVisitor post) {
-        this.pre = pre;
-        this.post = post;
-    }
-
-    /**
-     * Visits a declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitDeclaration(Declaration d) {
-        d.accept(pre);
-        d.accept(post);
-    }
-
-    /**
-     * Visits a package declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitPackageDeclaration(PackageDeclaration d) {
-        d.accept(pre);
-
-        for(ClassDeclaration classDecl: d.getClasses()) {
-            classDecl.accept(this);
-        }
-
-        for(InterfaceDeclaration interfaceDecl: d.getInterfaces()) {
-            interfaceDecl.accept(this);
-        }
-
-        d.accept(post);
-    }
-
-    /**
-     * Visits a member or constructor declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitMemberDeclaration(MemberDeclaration d) {
-        visitDeclaration(d);
-    }
-
-    /**
-     * Visits a type declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitTypeDeclaration(TypeDeclaration d) {
-        d.accept(pre);
-
-        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
-            tpDecl.accept(this);
-        }
-
-        for(FieldDeclaration fieldDecl: d.getFields()) {
-            fieldDecl.accept(this);
-        }
-
-        for(MethodDeclaration methodDecl: d.getMethods()) {
-            methodDecl.accept(this);
-        }
-
-        for(TypeDeclaration typeDecl: d.getNestedTypes()) {
-            typeDecl.accept(this);
-        }
-
-        d.accept(post);
-    }
-
-    /**
-     * Visits a class declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitClassDeclaration(ClassDeclaration d) {
-        d.accept(pre);
-
-        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
-            tpDecl.accept(this);
-        }
-
-        for(FieldDeclaration fieldDecl: d.getFields()) {
-            fieldDecl.accept(this);
-        }
-
-        for(MethodDeclaration methodDecl: d.getMethods()) {
-            methodDecl.accept(this);
-        }
-
-        for(TypeDeclaration typeDecl: d.getNestedTypes()) {
-            typeDecl.accept(this);
-        }
-
-        for(ConstructorDeclaration ctorDecl: d.getConstructors()) {
-            ctorDecl.accept(this);
-        }
-
-        d.accept(post);
-    }
-
-    /**
-     * Visits an enum declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitEnumDeclaration(EnumDeclaration d) {
-        visitClassDeclaration(d);
-    }
-
-    /**
-     * Visits an interface declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitInterfaceDeclaration(InterfaceDeclaration d) {
-        visitTypeDeclaration(d);
-    }
-
-    /**
-     * Visits an annotation type declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {
-        visitInterfaceDeclaration(d);
-    }
-
-    /**
-     * Visits a field declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitFieldDeclaration(FieldDeclaration d) {
-        visitMemberDeclaration(d);
-    }
-
-    /**
-     * Visits an enum constant declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {
-        visitFieldDeclaration(d);
-    }
-
-    /**
-     * Visits a method or constructor declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitExecutableDeclaration(ExecutableDeclaration d) {
-        d.accept(pre);
-
-        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
-            tpDecl.accept(this);
-        }
-
-        for(ParameterDeclaration pDecl: d.getParameters()) {
-            pDecl.accept(this);
-        }
-
-        d.accept(post);
-    }
-
-    /**
-     * Visits a constructor declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitConstructorDeclaration(ConstructorDeclaration d) {
-        visitExecutableDeclaration(d);
-    }
-
-    /**
-     * Visits a method declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitMethodDeclaration(MethodDeclaration d) {
-        visitExecutableDeclaration(d);
-    }
-
-    /**
-     * Visits an annotation type element declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitAnnotationTypeElementDeclaration(
-            AnnotationTypeElementDeclaration d) {
-        visitMethodDeclaration(d);
-    }
-
-    /**
-     * Visits a parameter declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitParameterDeclaration(ParameterDeclaration d) {
-        visitDeclaration(d);
-    }
-
-    /**
-     * Visits a type parameter declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {
-        visitDeclaration(d);
-    }
-}
--- a/src/share/classes/com/sun/mirror/util/DeclarationVisitor.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-import com.sun.mirror.declaration.*;
-
-
-/**
- * A visitor for declarations, in the style of the standard visitor
- * design pattern.  Classes implementing this interface are used to
- * operate on a declaration when the kind of declaration is unknown at
- * compile time.  When a visitor is passed to a declaration's {@link
- * Declaration#accept accept} method, the most specific
- * <tt>visit<i>Xxx</i></tt> method applicable to that declaration is
- * invoked.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.ElementVisitor}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface DeclarationVisitor {
-
-    /**
-     * Visits a declaration.
-     * @param d the declaration to visit
-     */
-    public void visitDeclaration(Declaration d);
-
-    /**
-     * Visits a package declaration.
-     * @param d the declaration to visit
-     */
-    public void visitPackageDeclaration(PackageDeclaration d);
-
-    /**
-     * Visits a member or constructor declaration.
-     * @param d the declaration to visit
-     */
-    public void visitMemberDeclaration(MemberDeclaration d);
-
-    /**
-     * Visits a type declaration.
-     * @param d the declaration to visit
-     */
-    public void visitTypeDeclaration(TypeDeclaration d);
-
-    /**
-     * Visits a class declaration.
-     * @param d the declaration to visit
-     */
-    public void visitClassDeclaration(ClassDeclaration d);
-
-    /**
-     * Visits an enum declaration.
-     * @param d the declaration to visit
-     */
-    public void visitEnumDeclaration(EnumDeclaration d);
-
-    /**
-     * Visits an interface declaration.
-     * @param d the declaration to visit
-     */
-    public void visitInterfaceDeclaration(InterfaceDeclaration d);
-
-    /**
-     * Visits an annotation type declaration.
-     * @param d the declaration to visit
-     */
-    public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d);
-
-    /**
-     * Visits a field declaration.
-     * @param d the declaration to visit
-     */
-    public void visitFieldDeclaration(FieldDeclaration d);
-
-    /**
-     * Visits an enum constant declaration.
-     * @param d the declaration to visit
-     */
-    public void visitEnumConstantDeclaration(EnumConstantDeclaration d);
-
-    /**
-     * Visits a method or constructor declaration.
-     * @param d the declaration to visit
-     */
-    public void visitExecutableDeclaration(ExecutableDeclaration d);
-
-    /**
-     * Visits a constructor declaration.
-     * @param d the declaration to visit
-     */
-    public void visitConstructorDeclaration(ConstructorDeclaration d);
-
-    /**
-     * Visits a method declaration.
-     * @param d the declaration to visit
-     */
-    public void visitMethodDeclaration(MethodDeclaration d);
-
-    /**
-     * Visits an annotation type element declaration.
-     * @param d the declaration to visit
-     */
-    public void visitAnnotationTypeElementDeclaration(
-                                     AnnotationTypeElementDeclaration d);
-
-    /**
-     * Visits a parameter declaration.
-     * @param d the declaration to visit
-     */
-    public void visitParameterDeclaration(ParameterDeclaration d);
-
-    /**
-     * Visits a type parameter declaration.
-     * @param d the declaration to visit
-     */
-    public void visitTypeParameterDeclaration(TypeParameterDeclaration d);
-}
--- a/src/share/classes/com/sun/mirror/util/DeclarationVisitors.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-/**
- * Utilities to create specialized <tt>DeclarationVisitor</tt> instances.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  There is no direct
- * replacement for the functionality of this class in the standardized
- * API due to that API's different visitor structure.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class DeclarationVisitors {
-    private DeclarationVisitors(){} // do not instantiate.
-
-    /**
-     * A visitor that has no side effects and keeps no state.
-     */
-    public static final DeclarationVisitor NO_OP = new SimpleDeclarationVisitor();
-
-    /**
-     * Return a <tt>DeclarationVisitor</tt> that will scan the
-     * declaration structure, visiting declarations contained in
-     * another declaration.  For example, when visiting a class, the
-     * fields, methods, constructors, etc. of the class are also
-     * visited.  The order in which the contained declarations are scanned is
-     * not specified.
-     *
-     * <p>The <tt>pre</tt> and <tt>post</tt>
-     * <tt>DeclarationVisitor</tt> parameters specify,
-     * respectively, the processing the scanner will do before or
-     * after visiting the contained declarations.  If only one of pre
-     * and post processing is needed, use {@link
-     * DeclarationVisitors#NO_OP DeclarationVisitors.NO_OP} for the
-     * other parameter.
-     *
-     * @param pre visitor representing processing to do before
-     * visiting contained declarations.
-     *
-     * @param post visitor representing processing to do after
-     * visiting contained declarations.
-     */
-    public static DeclarationVisitor getDeclarationScanner(DeclarationVisitor pre,
-                                                           DeclarationVisitor post) {
-        return new DeclarationScanner(pre, post);
-    }
-
-    /**
-     * Return a <tt>DeclarationVisitor</tt> that will scan the
-     * declaration structure, visiting declarations contained in
-     * another declaration in source code order.  For example, when
-     * visiting a class, the fields, methods, constructors, etc. of
-     * the class are also visited.  The order in which the contained
-     * declarations are visited is as close to source code order as
-     * possible; declaration mirrors created from class files instead
-     * of source code will not have source position information.
-     *
-     * <p>The <tt>pre</tt> and <tt>post</tt>
-     * <tt>DeclarationVisitor</tt> parameters specify,
-     * respectively, the processing the scanner will do before or
-     * after visiting the contained declarations.  If only one of pre
-     * and post processing is needed, use {@link
-     * DeclarationVisitors#NO_OP DeclarationVisitors.NO_OP} for the other parameter.
-     *
-     * @param pre visitor representing processing to do before
-     * visiting contained declarations.
-     *
-     * @param post visitor representing processing to do after
-     * visiting contained declarations.
-     */
-    public static DeclarationVisitor getSourceOrderDeclarationScanner(DeclarationVisitor pre,
-                                                                      DeclarationVisitor post) {
-        return new SourceOrderDeclScanner(pre, post);
-    }
-}
--- a/src/share/classes/com/sun/mirror/util/Declarations.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-
-import com.sun.mirror.declaration.*;
-
-
-/**
- * Utility methods for operating on declarations.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.util.Elements}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface Declarations {
-
-    /**
-     * Tests whether one type, method, or field declaration hides another.
-     *
-     * @param sub the first member
-     * @param sup the second member
-     * @return <tt>true</tt> if and only if the first member hides
-     *          the second
-     */
-    boolean hides(MemberDeclaration sub, MemberDeclaration sup);
-
-    /**
-     * Tests whether one method overrides another.  When a
-     * non-abstract method overrides an abstract one, the
-     * former is also said to <i>implement</i> the latter.
-     *
-     * @param sub the first method
-     * @param sup the second method
-     * @return <tt>true</tt> if and only if the first method overrides
-     *          the second
-     */
-    boolean overrides(MethodDeclaration sub, MethodDeclaration sup);
-}
--- a/src/share/classes/com/sun/mirror/util/SimpleDeclarationVisitor.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-
-import com.sun.mirror.declaration.*;
-
-
-/**
- * A simple visitor for declarations.
- *
- * <p> The implementations of the methods of this class do nothing but
- * delegate up the declaration hierarchy.  A subclass should override the
- * methods that correspond to the kinds of declarations on which it
- * will operate.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this class is {@link
- * javax.lang.model.util.SimpleElementVisitor6}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class SimpleDeclarationVisitor implements DeclarationVisitor {
-
-    /**
-     * Creates a new <tt>SimpleDeclarationVisitor</tt>.
-     */
-    public SimpleDeclarationVisitor(){}
-
-    /**
-     * Visits a declaration.
-     * The implementation does nothing.
-     * @param d the declaration to visit
-     */
-    public void visitDeclaration(Declaration d) {
-    }
-
-    /**
-     * Visits a package declaration.
-     * The implementation simply invokes
-     * {@link #visitDeclaration visitDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitPackageDeclaration(PackageDeclaration d) {
-        visitDeclaration(d);
-    }
-
-    /**
-     * Visits a member or constructor declaration.
-     * The implementation simply invokes
-     * {@link #visitDeclaration visitDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitMemberDeclaration(MemberDeclaration d) {
-        visitDeclaration(d);
-    }
-
-    /**
-     * Visits a type declaration.
-     * The implementation simply invokes
-     * {@link #visitMemberDeclaration visitMemberDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitTypeDeclaration(TypeDeclaration d) {
-        visitMemberDeclaration(d);
-    }
-
-    /**
-     * Visits a class declaration.
-     * The implementation simply invokes
-     * {@link #visitTypeDeclaration visitTypeDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitClassDeclaration(ClassDeclaration d) {
-        visitTypeDeclaration(d);
-    }
-
-    /**
-     * Visits an enum declaration.
-     * The implementation simply invokes
-     * {@link #visitClassDeclaration visitClassDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitEnumDeclaration(EnumDeclaration d) {
-        visitClassDeclaration(d);
-    }
-
-    /**
-     * Visits an interface declaration.
-     * The implementation simply invokes
-     * {@link #visitTypeDeclaration visitTypeDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitInterfaceDeclaration(InterfaceDeclaration d) {
-        visitTypeDeclaration(d);
-    }
-
-    /**
-     * Visits an annotation type declaration.
-     * The implementation simply invokes
-     * {@link #visitInterfaceDeclaration visitInterfaceDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {
-        visitInterfaceDeclaration(d);
-    }
-
-    /**
-     * Visits a field declaration.
-     * The implementation simply invokes
-     * {@link #visitMemberDeclaration visitMemberDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitFieldDeclaration(FieldDeclaration d) {
-        visitMemberDeclaration(d);
-    }
-
-    /**
-     * Visits an enum constant declaration.
-     * The implementation simply invokes
-     * {@link #visitFieldDeclaration visitFieldDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {
-        visitFieldDeclaration(d);
-    }
-
-    /**
-     * Visits a method or constructor declaration.
-     * The implementation simply invokes
-     * {@link #visitMemberDeclaration visitMemberDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitExecutableDeclaration(ExecutableDeclaration d) {
-        visitMemberDeclaration(d);
-    }
-
-    /**
-     * Visits a constructor declaration.
-     * The implementation simply invokes
-     * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitConstructorDeclaration(ConstructorDeclaration d) {
-        visitExecutableDeclaration(d);
-    }
-
-    /**
-     * Visits a method declaration.
-     * The implementation simply invokes
-     * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitMethodDeclaration(MethodDeclaration d) {
-        visitExecutableDeclaration(d);
-    }
-
-    /**
-     * Visits an annotation type element declaration.
-     * The implementation simply invokes
-     * {@link #visitMethodDeclaration visitMethodDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitAnnotationTypeElementDeclaration(
-            AnnotationTypeElementDeclaration d) {
-        visitMethodDeclaration(d);
-    }
-
-    /**
-     * Visits a parameter declaration.
-     * The implementation simply invokes
-     * {@link #visitDeclaration visitDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitParameterDeclaration(ParameterDeclaration d) {
-        visitDeclaration(d);
-    }
-
-    /**
-     * Visits a type parameter declaration.
-     * The implementation simply invokes
-     * {@link #visitDeclaration visitDeclaration}.
-     * @param d the declaration to visit
-     */
-    public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {
-        visitDeclaration(d);
-    }
-}
--- a/src/share/classes/com/sun/mirror/util/SimpleTypeVisitor.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-
-import com.sun.mirror.type.*;
-
-
-/**
- * A simple visitor for types.
- *
- * <p> The implementations of the methods of this class do nothing but
- * delegate up the type hierarchy.  A subclass should override the
- * methods that correspond to the kinds of types on which it will
- * operate.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this class is {@link
- * javax.lang.model.util.SimpleTypeVisitor6}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class SimpleTypeVisitor implements TypeVisitor {
-
-    /**
-     * Creates a new <tt>SimpleTypeVisitor</tt>.
-     */
-    public SimpleTypeVisitor() {}
-
-    /**
-     * Visits a type mirror.
-     * The implementation does nothing.
-     * @param t the type to visit
-     */
-    public void visitTypeMirror(TypeMirror t) {
-    }
-
-    /**
-     * Visits a primitive type.
-     * The implementation simply invokes
-     * {@link #visitTypeMirror visitTypeMirror}.
-     * @param t the type to visit
-     */
-    public void visitPrimitiveType(PrimitiveType t) {
-        visitTypeMirror(t);
-    }
-
-    /**
-     * Visits a void type.
-     * The implementation simply invokes
-     * {@link #visitTypeMirror visitTypeMirror}.
-     * @param t the type to visit
-     */
-    public void visitVoidType(VoidType t) {
-        visitTypeMirror(t);
-    }
-
-    /**
-     * Visits a reference type.
-     * The implementation simply invokes
-     * {@link #visitTypeMirror visitTypeMirror}.
-     * @param t the type to visit
-     */
-    public void visitReferenceType(ReferenceType t) {
-        visitTypeMirror(t);
-    }
-
-    /**
-     * Visits a declared type.
-     * The implementation simply invokes
-     * {@link #visitReferenceType visitReferenceType}.
-     * @param t the type to visit
-     */
-    public void visitDeclaredType(DeclaredType t) {
-        visitReferenceType(t);
-    }
-
-    /**
-     * Visits a class type.
-     * The implementation simply invokes
-     * {@link #visitDeclaredType visitDeclaredType}.
-     * @param t the type to visit
-     */
-    public void visitClassType(ClassType t) {
-        visitDeclaredType(t);
-    }
-
-    /**
-     * Visits an enum type.
-     * The implementation simply invokes
-     * {@link #visitClassType visitClassType}.
-     * @param t the type to visit
-     */
-    public void visitEnumType(EnumType t) {
-        visitClassType(t);
-    }
-
-    /**
-     * Visits an interface type.
-     * The implementation simply invokes
-     * {@link #visitDeclaredType visitDeclaredType}.
-     * @param t the type to visit
-     */
-    public void visitInterfaceType(InterfaceType t) {
-        visitDeclaredType(t);
-    }
-
-    /**
-     * Visits an annotation type.
-     * The implementation simply invokes
-     * {@link #visitInterfaceType visitInterfaceType}.
-     * @param t the type to visit
-     */
-    public void visitAnnotationType(AnnotationType t) {
-        visitInterfaceType(t);
-    }
-
-    /**
-     * Visits an array type.
-     * The implementation simply invokes
-     * {@link #visitReferenceType visitReferenceType}.
-     * @param t the type to visit
-     */
-    public void visitArrayType(ArrayType t) {
-        visitReferenceType(t);
-    }
-
-    /**
-     * Visits a type variable.
-     * The implementation simply invokes
-     * {@link #visitReferenceType visitReferenceType}.
-     * @param t the type to visit
-     */
-    public void visitTypeVariable(TypeVariable t) {
-        visitReferenceType(t);
-    }
-
-    /**
-     * Visits a wildcard.
-     * The implementation simply invokes
-     * {@link #visitTypeMirror visitTypeMirror}.
-     * @param t the type to visit
-     */
-    public void visitWildcardType(WildcardType t) {
-        visitTypeMirror(t);
-    }
-}
--- a/src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-import com.sun.mirror.declaration.*;
-
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-/**
- * A visitor for declarations that scans declarations contained within
- * the given declaration in source code order.  For example, when
- * visiting a class, the methods, fields, constructors, and nested
- * types of the class are also visited.
- *
- * To control the processing done on a declaration, users of this
- * class pass in their own visitors for pre and post processing.  The
- * preprocessing visitor is called before the contained declarations
- * are scanned; the postprocessing visitor is called after the
- * contained declarations are scanned.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this class is {@link
- * javax.lang.model.util.SimpleElementVisitor6}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-class SourceOrderDeclScanner extends DeclarationScanner {
-    static class SourceOrderComparator implements java.util.Comparator<Declaration> {
-        SourceOrderComparator(){}
-
-
-        static boolean equals(Declaration d1, Declaration d2) {
-            return d1 == d2 || (d1 != null && d1.equals(d2));
-        }
-
-        private static class DeclPartialOrder extends com.sun.mirror.util.SimpleDeclarationVisitor {
-            private int value = 1000;
-            private static int staticAdjust(Declaration d) {
-                return d.getModifiers().contains(Modifier.STATIC)?0:1;
-            }
-
-            DeclPartialOrder() {}
-
-            public int getValue() { return value; }
-
-            @Override
-            public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {value = 0;}
-
-            @Override
-            public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {value = 1;}
-
-            @Override
-            public void visitClassDeclaration(ClassDeclaration d) {value = 2 + staticAdjust(d);}
-
-            @Override
-            public void visitInterfaceDeclaration(InterfaceDeclaration d) {value = 4;}
-
-            @Override
-            public void visitEnumDeclaration(EnumDeclaration d) {value = 6;}
-
-            @Override
-            public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {value = 8;}
-
-            @Override
-            public void visitFieldDeclaration(FieldDeclaration d) {value = 10 + staticAdjust(d);}
-
-            @Override
-            public void visitConstructorDeclaration(ConstructorDeclaration d) {value = 12;}
-
-            @Override
-            public void visitMethodDeclaration(MethodDeclaration d) {value = 14 + staticAdjust(d);}
-        }
-        @SuppressWarnings("cast")
-        private int compareEqualPosition(Declaration d1, Declaration d2) {
-            assert
-                (d1.getPosition() == d2.getPosition()) || // Handles two null positions.
-                (d1.getPosition().file().compareTo(d2.getPosition().file()) == 0 &&
-                 d1.getPosition().line()   == d2.getPosition().line() &&
-                 d1.getPosition().column() == d2.getPosition().column());
-
-            DeclPartialOrder dpo1 = new DeclPartialOrder();
-            DeclPartialOrder dpo2 = new DeclPartialOrder();
-
-            d1.accept(dpo1);
-            d2.accept(dpo2);
-
-            int difference = dpo1.getValue() - dpo2.getValue();
-            if (difference != 0)
-                return difference;
-            else {
-                int result = d1.getSimpleName().compareTo(d2.getSimpleName());
-                if (result != 0)
-                    return result;
-                return (int)( Long.signum((long)System.identityHashCode(d1) -
-                                          (long)System.identityHashCode(d2)));
-            }
-        }
-
-        public int compare(Declaration d1, Declaration d2) {
-            if (equals(d1, d2))
-                return 0;
-
-            SourcePosition p1 = d1.getPosition();
-            SourcePosition p2 = d2.getPosition();
-
-            if (p1 == null && p2 != null)
-                return 1;
-            else if (p1 != null && p2 == null)
-                return -1;
-            else if(p1 == null && p2 == null)
-                return compareEqualPosition(d1, d2);
-            else {
-                assert p1 != null && p2 != null;
-                int fileComp = p1.file().compareTo(p2.file()) ;
-                if (fileComp == 0) {
-                    long diff = (long)p1.line() - (long)p2.line();
-                    if (diff == 0) {
-                        diff = Long.signum((long)p1.column() - (long)p2.column());
-                        if (diff != 0)
-                            return (int)diff;
-                        else {
-                            // declarations may be two
-                            // compiler-generated members with the
-                            // same source position
-                            return compareEqualPosition(d1, d2);
-                        }
-                    } else
-                        return (diff<0)? -1:1;
-                } else
-                    return fileComp;
-            }
-        }
-    }
-
-    final static java.util.Comparator<Declaration> comparator = new SourceOrderComparator();
-
-    SourceOrderDeclScanner(DeclarationVisitor pre, DeclarationVisitor post) {
-        super(pre, post);
-    }
-
-    /**
-     * Visits a type declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitTypeDeclaration(TypeDeclaration d) {
-        d.accept(pre);
-
-        SortedSet<Declaration> decls = new
-            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
-
-        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
-            decls.add(tpDecl);
-        }
-
-        for(FieldDeclaration fieldDecl: d.getFields()) {
-            decls.add(fieldDecl);
-        }
-
-        for(MethodDeclaration methodDecl: d.getMethods()) {
-            decls.add(methodDecl);
-        }
-
-        for(TypeDeclaration typeDecl: d.getNestedTypes()) {
-            decls.add(typeDecl);
-        }
-
-        for(Declaration decl: decls )
-            decl.accept(this);
-
-        d.accept(post);
-    }
-
-    /**
-     * Visits a class declaration.
-     *
-     * @param d the declaration to visit
-     */
-    public void visitClassDeclaration(ClassDeclaration d) {
-        d.accept(pre);
-
-        SortedSet<Declaration> decls = new
-            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
-
-        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
-            decls.add(tpDecl);
-        }
-
-        for(FieldDeclaration fieldDecl: d.getFields()) {
-            decls.add(fieldDecl);
-        }
-
-        for(MethodDeclaration methodDecl: d.getMethods()) {
-            decls.add(methodDecl);
-        }
-
-        for(TypeDeclaration typeDecl: d.getNestedTypes()) {
-            decls.add(typeDecl);
-        }
-
-        for(ConstructorDeclaration ctorDecl: d.getConstructors()) {
-            decls.add(ctorDecl);
-        }
-
-        for(Declaration decl: decls )
-            decl.accept(this);
-
-        d.accept(post);
-    }
-
-    public void visitExecutableDeclaration(ExecutableDeclaration d) {
-        d.accept(pre);
-
-        SortedSet<Declaration> decls = new
-            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
-
-        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters())
-            decls.add(tpDecl);
-
-        for(ParameterDeclaration pDecl: d.getParameters())
-            decls.add(pDecl);
-
-        for(Declaration decl: decls )
-            decl.accept(this);
-
-        d.accept(post);
-    }
-
-}
--- a/src/share/classes/com/sun/mirror/util/SourcePosition.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-
-import java.io.File;
-
-
-/**
- * Represents a position in a source file.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  There is no direct
- * replacement for the functionality of this interface since the
- * standardized {@link javax.annotation.processing.Messager Messager}
- * API implicitly takes a source position argument via any element,
- * annotation mirror, or annotation value passed along with the
- * message.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface SourcePosition {
-
-    /**
-     * Returns the source file containing this position.
-     *
-     * @return the source file containing this position; never null
-     */
-    File file();
-
-    /**
-     * Returns the line number of this position.  Lines are numbered
-     * starting with 1.
-     *
-     * @return the line number of this position, or 0 if the line
-     * number is unknown or not applicable
-     */
-    int line();
-
-    /**
-     * Returns the column number of this position.  Columns are numbered
-     * starting with 1.
-     *
-     * @return the column number of this position, or 0 if the column
-     * number is unknown or not applicable
-     */
-    int column();
-}
--- a/src/share/classes/com/sun/mirror/util/TypeVisitor.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-
-import com.sun.mirror.type.*;
-
-
-/**
- * A visitor for types, in the style of the standard visitor design pattern.
- * This is used to operate on a type when the kind
- * of type is unknown at compile time.
- * When a visitor is passed to a type's
- * {@link TypeMirror#accept accept} method,
- * the most specific <tt>visit<i>Xxx</i></tt> method applicable to
- * that type is invoked.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.element.TypeVisitor}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface TypeVisitor {
-
-    /**
-     * Visits a type mirror.
-     *
-     * @param t the type to visit
-     */
-    public void visitTypeMirror(TypeMirror t);
-
-    /**
-     * Visits a primitive type.
-
-     * @param t the type to visit
-     */
-    public void visitPrimitiveType(PrimitiveType t);
-
-    /**
-     * Visits a void type.
-     *
-     * @param t the type to visit
-     */
-    public void visitVoidType(VoidType t);
-
-    /**
-     * Visits a reference type.
-     *
-     * @param t the type to visit
-     */
-    public void visitReferenceType(ReferenceType t);
-
-    /**
-     * Visits a declared type.
-     *
-     * @param t the type to visit
-     */
-    public void visitDeclaredType(DeclaredType t);
-
-    /**
-     * Visits a class type.
-     *
-     * @param t the type to visit
-     */
-    public void visitClassType(ClassType t);
-
-    /**
-     * Visits an enum type.
-     *
-     * @param t the type to visit
-     */
-    public void visitEnumType(EnumType t);
-
-    /**
-     * Visits an interface type.
-     *
-     * @param t the type to visit
-     */
-    public void visitInterfaceType(InterfaceType t);
-
-    /**
-     * Visits an annotation type.
-     *
-     * @param t the type to visit
-     */
-    public void visitAnnotationType(AnnotationType t);
-
-    /**
-     * Visits an array type.
-     *
-     * @param t the type to visit
-     */
-    public void visitArrayType(ArrayType t);
-
-    /**
-     * Visits a type variable.
-     *
-     * @param t the type to visit
-     */
-    public void visitTypeVariable(TypeVariable t);
-
-    /**
-     * Visits a wildcard.
-     *
-     * @param t the type to visit
-     */
-    public void visitWildcardType(WildcardType t);
-}
--- a/src/share/classes/com/sun/mirror/util/Types.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.mirror.util;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-
-
-/**
- * Utility methods for operating on types.
- *
- * @deprecated All components of this API have been superseded by the
- * standardized annotation processing API.  The replacement for the
- * functionality of this interface is {@link
- * javax.lang.model.util.Types}.
- *
- * @author Joseph D. Darcy
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public interface Types {
-
-    /**
-     * Tests whether one type is a subtype of the another.
-     * Any type is considered to be a subtype of itself.
-     *
-     * @param t1  the first type
-     * @param t2  the second type
-     * @return <tt>true</tt> if and only if the first type is a subtype
-     *          of the second
-     */
-    boolean isSubtype(TypeMirror t1, TypeMirror t2);
-
-    /**
-     * Tests whether one type is assignable to another.
-     *
-     * @param t1  the first type
-     * @param t2  the second type
-     * @return <tt>true</tt> if and only if the first type is assignable
-     *          to the second
-     */
-    boolean isAssignable(TypeMirror t1, TypeMirror t2);
-
-    /**
-     * Returns the erasure of a type.
-     *
-     * @param t  the type to be erased
-     * @return the erasure of the given type
-     */
-    TypeMirror getErasure(TypeMirror t);
-
-    /**
-     * Returns a primitive type.
-     *
-     * @param kind  the kind of primitive type to return
-     * @return a primitive type
-     */
-    PrimitiveType getPrimitiveType(PrimitiveType.Kind kind);
-
-    /**
-     * Returns the pseudo-type representing the type of <tt>void</tt>.
-     *
-     * @return the pseudo-type representing the type of <tt>void</tt>
-     */
-    VoidType getVoidType();
-
-    /**
-     * Returns an array type with the specified component type.
-     *
-     * @param componentType  the component type
-     * @return an array type with the specified component type.
-     * @throws IllegalArgumentException if the component type is not valid for
-     *          an array
-     */
-    ArrayType getArrayType(TypeMirror componentType);
-
-    /**
-     * Returns the type variable declared by a type parameter.
-     *
-     * @param tparam  the type parameter
-     * @return the type variable declared by the type parameter
-     */
-    TypeVariable getTypeVariable(TypeParameterDeclaration tparam);
-
-    /**
-     * Returns a new wildcard.
-     * Either the wildcards's upper bounds or lower bounds may be
-     * specified, or neither, but not both.
-     *
-     * @param upperBounds  the upper bounds of this wildcard,
-     *          or an empty collection if none
-     * @param lowerBounds  the lower bounds of this wildcard,
-     *          or an empty collection if none
-     * @return a new wildcard
-     * @throws IllegalArgumentException if bounds are not valid
-     */
-    WildcardType getWildcardType(Collection<ReferenceType> upperBounds,
-                                 Collection<ReferenceType> lowerBounds);
-
-    /**
-     * Returns the type corresponding to a type declaration and
-     * actual type arguments.
-     * Given the declaration for <tt>String</tt>, for example, this
-     * method may be used to get the <tt>String</tt> type.  It may
-     * then be invoked a second time, with the declaration for <tt>Set</tt>,
-     * to make the parameterized type {@code Set<String>}.
-     *
-     * <p> The number of type arguments must either equal the
-     * number of the declaration's formal type parameters, or must be
-     * zero.  If zero, and if the declaration is generic,
-     * then the declaration's raw type is returned.
-     *
-     * <p> If a parameterized type is being returned, its declaration
-     * must not be contained within a generic outer class.
-     * The parameterized type {@code Outer<String>.Inner<Number>},
-     * for example, may be constructed by first using this
-     * method to get the type {@code Outer<String>}, and then invoking
-     * {@link #getDeclaredType(DeclaredType, TypeDeclaration, TypeMirror...)}.
-     *
-     * @param decl      the type declaration
-     * @param typeArgs  the actual type arguments
-     * @return the type corresponding to the type declaration and
-     *          actual type arguments
-     * @throws IllegalArgumentException if too many or too few
-     *          type arguments are given, or if an inappropriate type
-     *          argument or declaration is provided
-     */
-    DeclaredType getDeclaredType(TypeDeclaration decl,
-                                 TypeMirror... typeArgs);
-
-    /**
-     * Returns the type corresponding to a type declaration
-     * and actual arguments, given a
-     * {@linkplain DeclaredType#getContainingType() containing type}
-     * of which it is a member.
-     * The parameterized type {@code Outer<String>.Inner<Number>},
-     * for example, may be constructed by first using
-     * {@link #getDeclaredType(TypeDeclaration, TypeMirror...)}
-     * to get the type {@code Outer<String>}, and then invoking
-     * this method.
-     *
-     * <p> If the containing type is a parameterized type,
-     * the number of type arguments must equal the
-     * number of the declaration's formal type parameters.
-     * If it is not parameterized or if it is <tt>null</tt>, this method is
-     * equivalent to <tt>getDeclaredType(decl, typeArgs)</tt>.
-     *
-     * @param containing  the containing type, or <tt>null</tt> if none
-     * @param decl        the type declaration
-     * @param typeArgs    the actual type arguments
-     * @return the type corresponding to the type declaration and
-     *          actual type arguments,
-     *          contained within the given type
-     * @throws IllegalArgumentException if too many or too few
-     *          type arguments are given, or if an inappropriate type
-     *          argument, declaration, or containing type is provided
-     */
-    DeclaredType getDeclaredType(DeclaredType containing,
-                                 TypeDeclaration decl,
-                                 TypeMirror... typeArgs);
-}
--- a/src/share/classes/com/sun/mirror/util/package-info.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Utilities to assist in the processing of {@linkplain
- * com.sun.mirror.declaration declarations} and {@linkplain
- * com.sun.mirror.type types}.
- *
- * <p>The {@code apt} tool and its associated API have been superseded
- * by the standardized annotation processing API.  The replacement for
- * the functionality in this package is {@link javax.lang.model.util}.
- *
- * @since 1.5
- */
-package com.sun.mirror.util;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.source.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for a lambda expression.
+ *
+ * For example:
+ * <pre>
+ *   ()->{}
+ *   (List<String> ls)->ls.size()
+ *   (x,y)-> { return x + y; }
+ * </pre>
+ */
+public interface LambdaExpressionTree extends ExpressionTree {
+
+    /**
+     * Lambda expressions come in two forms: (i) expression lambdas, whose body
+     * is an expression, and (ii) statement lambdas, whose body is a block
+     */
+    public enum BodyKind {
+        /** enum constant for expression lambdas */
+        EXPRESSION,
+        /** enum constant for statement lambdas */
+        STATEMENT;
+    }
+
+    List<? extends VariableTree> getParameters();
+    Tree getBody();
+    BodyKind getBodyKind();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/source/tree/MemberReferenceTree.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.source.tree;
+
+import java.util.List;
+
+import javax.lang.model.element.Name;
+
+/**
+ * A tree node for a member reference expression.
+ *
+ * For example:
+ * <pre>
+ *   <em>expression</em> # <em>[ identifier | new ]</em>
+ * </pre>
+ *
+ * @since 1.8
+ */
+public interface MemberReferenceTree extends ExpressionTree {
+
+    /**
+     * There are two kinds of member references: (i) method references and
+     * (ii) constructor references
+     */
+    public enum ReferenceMode {
+        /** enum constant for method references */
+        INVOKE,
+        /** enum constant for constructor references */
+        NEW
+    }
+    ReferenceMode getMode();
+    ExpressionTree getQualifierExpression();
+    Name getName();
+    List<? extends ExpressionTree> getTypeArguments();
+}
--- a/src/share/classes/com/sun/source/tree/Tree.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/source/tree/Tree.java	Tue May 29 00:27:58 2012 +0100
@@ -132,6 +132,11 @@
         MEMBER_SELECT(MemberSelectTree.class),
 
         /**
+         * Used for instances of {@link MemberReferenceTree}.
+         */
+        MEMBER_REFERENCE(MemberReferenceTree.class),
+
+        /**
          * Used for instances of {@link ForLoopTree}.
          */
         FOR_LOOP(ForLoopTree.class),
@@ -187,6 +192,11 @@
         NEW_CLASS(NewClassTree.class),
 
         /**
+         * Used for instances of {@link LambdaExpressionTree}.
+         */
+        LAMBDA_EXPRESSION(LambdaExpressionTree.class),
+
+        /**
          * Used for instances of {@link ParenthesizedTree}.
          */
         PARENTHESIZED(ParenthesizedTree.class),
--- a/src/share/classes/com/sun/source/tree/TreeVisitor.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/source/tree/TreeVisitor.java	Tue May 29 00:27:58 2012 +0100
@@ -85,9 +85,11 @@
     R visitModifiers(ModifiersTree node, P p);
     R visitNewArray(NewArrayTree node, P p);
     R visitNewClass(NewClassTree node, P p);
+    R visitLambdaExpression(LambdaExpressionTree node, P p);
     R visitParenthesized(ParenthesizedTree node, P p);
     R visitReturn(ReturnTree node, P p);
     R visitMemberSelect(MemberSelectTree node, P p);
+    R visitMemberReference(MemberReferenceTree node, P p);
     R visitEmptyStatement(EmptyStatementTree node, P p);
     R visitSwitch(SwitchTree node, P p);
     R visitSynchronized(SynchronizedTree node, P p);
--- a/src/share/classes/com/sun/source/util/JavacTask.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/source/util/JavacTask.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,9 @@
 
 package com.sun.source.util;
 
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.tree.Tree;
 import java.io.IOException;
+
+import javax.annotation.processing.ProcessingEnvironment;
 import javax.lang.model.element.Element;
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.util.Elements;
@@ -35,6 +35,12 @@
 import javax.tools.JavaCompiler.CompilationTask;
 import javax.tools.JavaFileObject;
 
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.Tree;
+import com.sun.tools.javac.api.BasicJavacTask;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.util.Context;
+
 /**
  * Provides access to functionality specific to the JDK Java Compiler, javac.
  *
@@ -45,10 +51,29 @@
 public abstract class JavacTask implements CompilationTask {
 
     /**
+     * Get the {@code JavacTask} for a {@code ProcessingEnvironment}.
+     * If the compiler is being invoked using a
+     * {@link javax.tools.JavaCompiler.CompilationTask CompilationTask},
+     * then that task will be returned.
+     * @param processingEnvironment
+     * @return the {@code JavacTask} for a {@code ProcessingEnvironment}
+     * @since 1.8
+     */
+    public static JavacTask instance(ProcessingEnvironment processingEnvironment) {
+        if (!processingEnvironment.getClass().getName().equals(
+                "com.sun.tools.javac.processing.JavacProcessingEnvironment"))
+            throw new IllegalArgumentException();
+        Context c = ((JavacProcessingEnvironment) processingEnvironment).getContext();
+        JavacTask t = c.get(JavacTask.class);
+        return (t != null) ? t : new BasicJavacTask(c, true);
+    }
+
+    /**
      * Parse the specified files returning a list of abstract syntax trees.
      *
      * @return a list of abstract syntax trees
      * @throws IOException if an unhandled I/O error occurred in the compiler.
+     * @throws IllegalStateException if the operation cannot be performed at this time.
      */
     public abstract Iterable<? extends CompilationUnitTree> parse()
         throws IOException;
@@ -58,6 +83,7 @@
      *
      * @return a list of elements that were analyzed
      * @throws IOException if an unhandled I/O error occurred in the compiler.
+     * @throws IllegalStateException if the operation cannot be performed at this time.
      */
     public abstract Iterable<? extends Element> analyze() throws IOException;
 
@@ -66,17 +92,51 @@
      *
      * @return a list of files that were generated
      * @throws IOException if an unhandled I/O error occurred in the compiler.
+     * @throws IllegalStateException if the operation cannot be performed at this time.
      */
     public abstract Iterable<? extends JavaFileObject> generate() throws IOException;
 
     /**
-     * The specified listener will receive events describing the progress of
-     * this compilation task.
+     * The specified listener will receive notification of events
+     * describing the progress of this compilation task.
+     *
+     * If another listener is receiving notifications as a result of a prior
+     * call of this method, then that listener will no longer receive notifications.
+     *
+     * Informally, this method is equivalent to calling {@code removeTaskListener} for
+     * any listener that has been previously set, followed by {@code addTaskListener}
+     * for the new listener.
+     *
+     * @throws IllegalStateException if the specified listener has already been added.
      */
     public abstract void setTaskListener(TaskListener taskListener);
 
     /**
+     * The specified listener will receive notification of events
+     * describing the progress of this compilation task.
+     *
+     * This method may be called at any time before or during the compilation.
+     *
+     * @throws IllegalStateException if the specified listener has already been added.
+     * @since 1.8
+     */
+    public abstract void addTaskListener(TaskListener taskListener);
+
+    /**
+     * The specified listener will no longer receive notification of events
+     * describing the progress of this compilation task.
+     *
+     * This method may be called at any time before or during the compilation.
+     *
+     * @since 1.8
+     */
+    public abstract void removeTaskListener(TaskListener taskListener);
+
+    /**
      * Get a type mirror of the tree node determined by the specified path.
+     * This method has been superceded by methods on
+     * {@link com.sun.source.util.Trees Trees}.
+     * @see com.sun.source.util.Trees#getTypeMirror
      */
     public abstract TypeMirror getTypeMirror(Iterable<? extends Tree> path);
     /**
--- a/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Tue May 29 00:27:58 2012 +0100
@@ -172,6 +172,10 @@
         return defaultAction(node, p);
     }
 
+    public R visitLambdaExpression(LambdaExpressionTree node, P p) {
+        return defaultAction(node, p);
+    }
+
     public R visitParenthesized(ParenthesizedTree node, P p) {
         return defaultAction(node, p);
     }
@@ -208,6 +212,10 @@
         return defaultAction(node, p);
     }
 
+    public R visitMemberReference(MemberReferenceTree node, P p) {
+        return defaultAction(node, p);
+    }
+
     public R visitIdentifier(IdentifierTree node, P p) {
         return defaultAction(node, p);
     }
--- a/src/share/classes/com/sun/source/util/TreeScanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/source/util/TreeScanner.java	Tue May 29 00:27:58 2012 +0100
@@ -285,6 +285,12 @@
         return r;
     }
 
+    public R visitLambdaExpression(LambdaExpressionTree node, P p) {
+        R r = scan(node.getParameters(), p);
+        r = scanAndReduce(node.getBody(), p, r);
+        return r;
+    }
+
     public R visitParenthesized(ParenthesizedTree node, P p) {
         return scan(node.getExpression(), p);
     }
@@ -333,6 +339,12 @@
         return scan(node.getExpression(), p);
     }
 
+    public R visitMemberReference(MemberReferenceTree node, P p) {
+        R r = scan(node.getQualifierExpression(), p);
+        r = scanAndReduce(node.getTypeArguments(), p, r);
+        return r;
+    }
+
     public R visitIdentifier(IdentifierTree node, P p) {
         return null;
     }
--- a/src/share/classes/com/sun/tools/apt/Main.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt;
-
-import java.io.PrintWriter;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-
-/**
- * The main program for the command-line tool apt.
- *
- * <p>Nothing described in this source file is part of any supported
- * API.  If you write code that depends on this, you do so at your own
- * risk.  This code and its internal interfaces are subject to change
- * or deletion without notice.
- */
-public class Main {
-
-    static {
-        ClassLoader loader = Main.class.getClassLoader();
-        if (loader != null)
-            loader.setPackageAssertionStatus("com.sun.tools.apt", true);
-    }
-
-    /** Command line interface.  If args is <tt>null</tt>, a
-     * <tt>NullPointerException</tt> is thrown.
-     * @param args   The command line parameters.
-     */
-    public static void main(String... args) {
-        System.exit(process(args));
-    }
-
-    /** Programatic interface.  If args is <tt>null</tt>, a
-     * <tt>NullPointerException</tt> is thrown.
-     * Output is directed to <tt>System.err</tt>.
-     * @param args   The command line parameters.
-     */
-    public static int process(String... args) {
-        return processing(null, null, args);
-    }
-
-    /** Programmatic interface.  If any argument
-     * is <tt>null</tt>, a <tt>NullPointerException</tt> is thrown.
-     * @param args   The command line parameters.
-     * @param out    Where the tool's output is directed.
-     */
-    public static int process(PrintWriter out, String... args) {
-        if (out == null)
-            throw new NullPointerException("Parameter out cannot be null.");
-        return processing(null, out, args);
-    }
-
-    /** Programmatic interface.  If <tt>factory</tt> or <tt>args</tt>
-     * is <tt>null</tt>, a <tt>NullPointerException</tt> is thrown.
-     * The &quot;<tt>-factory</tt>&quot; and &quot;<tt>-factorypath</tt>&quot;
-     * command line parameters are ignored by this entry point.
-     * Output is directed to <tt>System.err</tt>.
-     *
-     * @param factory The annotation processor factory to use
-     * @param args    The command line parameters.
-     */
-    public static int process(AnnotationProcessorFactory factory, String... args) {
-        return process(factory, new PrintWriter(System.err, true), args);
-    }
-
-    /** Programmatic interface.  If any argument
-     * is <tt>null</tt>, a <tt>NullPointerException</tt> is thrown.
-     * The &quot;<tt>-factory</tt>&quot; and &quot;<tt>-factorypath</tt>&quot;
-     * command line parameters are ignored by this entry point.
-     *
-     * @param factory The annotation processor factory to use
-     * @param args   The command line parameters.
-     * @param out    Where the tool's output is directed.
-     */
-    public static int process(AnnotationProcessorFactory factory, PrintWriter out,
-                              String... args) {
-        if (out == null)
-            throw new NullPointerException("Parameter out cannot be null.");
-        if (factory == null)
-            throw new NullPointerException("Parameter factory cannot be null");
-        return processing(factory, out, args);
-    }
-
-    private static int processing(AnnotationProcessorFactory factory,
-                                  PrintWriter out,
-                                  String... args) {
-        if (out == null)
-            out = new PrintWriter(System.err, true);
-        com.sun.tools.apt.main.Main compiler =
-            new com.sun.tools.apt.main.Main("apt", out);
-        return compiler.compile(args, factory);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/comp/AnnotationProcessingError.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.comp;
-
-public class AnnotationProcessingError extends Error {
-    private static final long serialVersionUID = 3279196183341719287L;
-    AnnotationProcessingError(Throwable cause) {
-        super(cause);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/comp/Apt.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,509 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.comp;
-
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.comp.*;
-import com.sun.tools.javac.tree.*;
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.tree.TreeScanner;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.apt.util.Bark;
-import com.sun.tools.javac.util.Position;
-
-import java.util.*;
-import java.util.regex.*;
-import java.lang.reflect.*;
-import java.lang.reflect.InvocationTargetException;
-import java.io.IOException;
-
-import com.sun.tools.apt.*;
-import com.sun.tools.apt.comp.*;
-import com.sun.tools.javac.code.Symbol.*;
-
-import com.sun.mirror.declaration.TypeDeclaration;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.apt.*;
-// import com.sun.mirror.apt.AnnotationProcessorFactory;
-import com.sun.mirror.apt.AnnotationProcessors;
-
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.apt.mirror.apt.FilerImpl;
-import com.sun.tools.apt.mirror.apt.AnnotationProcessorEnvironmentImpl;
-
-
-import static com.sun.tools.apt.mirror.declaration.DeclarationMaker.isJavaIdentifier;
-
-/**
- * Apt compiler phase.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own
- *  risk.  This code and its internal interfaces are subject to change
- *  or deletion without notice.</b>
- */
-@SuppressWarnings("deprecation")
-public class Apt extends ListBuffer<Env<AttrContext>> {
-    java.util.Set<String> genSourceFileNames = new java.util.LinkedHashSet<String>();
-    public java.util.Set<String> getSourceFileNames() {
-        return genSourceFileNames;
-    }
-
-    /** List of names of generated class files.
-     */
-    java.util.Set<String> genClassFileNames  = new java.util.LinkedHashSet<String>();
-    public java.util.Set<String> getClassFileNames() {
-        return genClassFileNames;
-    }
-
-    /* AptEnvironment */
-    AptEnv aptenv;
-
-    private Context context;
-
-    /** The context key for the todo list. */
-
-    protected static final Context.Key<Apt> aptKey =
-        new Context.Key<Apt>();
-
-    /** Get the Apt instance for this context. */
-    public static Apt instance(Context context) {
-        Apt instance = context.get(aptKey);
-        if (instance == null)
-            instance = new Apt(context);
-        return instance;
-    }
-
-    /** Create a new apt list. */
-    protected Apt(Context context) {
-        this.context = context;
-
-        context.put(aptKey, this);
-        aptenv = AptEnv.instance(context);
-    }
-
-    /**
-     * Used to scan javac trees to build data structures needed for
-     * bootstrapping the apt environment.  In particular:
-     *
-     * <ul>
-     *
-     * <li> Generate list of canonical names of annotation types that
-     * appear in source files given on the command line
-     *
-     * <li> Collect list of javac symbols representing source files
-     * given on the command line
-     *
-     * </ul>
-     */
-    static class AptTreeScanner extends TreeScanner {
-
-        // Set of fully qualified names of annotation types present in
-        // examined source
-        private Set<String> annotationSet;
-
-        // Symbols to build bootstrapping declaration list
-        private Collection<ClassSymbol> specifiedDeclCollection;
-        private Collection<ClassSymbol> declCollection;
-
-        public Set<String> getAnnotationSet() {
-            return annotationSet;
-        }
-
-        public AptTreeScanner() {
-            annotationSet = new  LinkedHashSet<String>();
-            specifiedDeclCollection = new LinkedHashSet<ClassSymbol>();
-            declCollection = new LinkedHashSet<ClassSymbol>();
-        }
-
-        public void visitTopLevel(JCTree.JCCompilationUnit tree) {
-            super.visitTopLevel(tree);
-            // Print out contents -- what are we dealing with?
-
-            for(JCTree d: tree.defs) {
-                if (d instanceof JCTree.JCClassDecl)
-                    specifiedDeclCollection.add(((JCTree.JCClassDecl) d).sym);
-            }
-
-        }
-
-        public void visitBlock(JCTree.JCBlock tree) {
-            ; // Do nothing.
-        }
-
-
-        // should add nested classes to packages, etc.
-        public void visitClassDef(JCTree.JCClassDecl tree) {
-            if (tree.sym == null) {
-                // could be an anon class w/in an initializer
-                return;
-            }
-
-            super.visitClassDef(tree);
-
-            declCollection.add(tree.sym);
-        }
-
-        public void visitMethodDef(JCTree.JCMethodDecl tree) {
-            super.visitMethodDef(tree);
-        }
-
-        public void visitVarDef(JCTree.JCVariableDecl tree) {
-            super.visitVarDef(tree);
-        }
-
-        public void visitAnnotation(JCTree.JCAnnotation tree) {
-            super.visitAnnotation(tree);
-            annotationSet.add(tree.type.tsym.toString());
-        }
-    }
-
-    Set<String> computeAnnotationSet(Collection<ClassSymbol> classSymbols) {
-        Set<String> annotationSet = new HashSet<String>();
-
-        for(ClassSymbol classSymbol: classSymbols) {
-            computeAnnotationSet(classSymbol, annotationSet);
-        }
-        return annotationSet;
-    }
-
-    void computeAnnotationSet(Symbol symbol, Set<String> annotationSet) {
-        if (symbol != null ) {
-            if (symbol.getAnnotationMirrors() != null)
-                for(Attribute.Compound compound: symbol.getAnnotationMirrors())
-                    annotationSet.add(compound.type.tsym.toString()); // should fullName be used instead of toString?
-
-            if (symbol instanceof Symbol.MethodSymbol) // add parameter annotations
-                for(Symbol param: ((MethodSymbol) symbol).params())
-                    computeAnnotationSet(param, annotationSet);
-
-            if (symbol.members() != null) {
-                for(Scope.Entry e = symbol.members().elems; e != null; e = e.sibling)
-                    computeAnnotationSet(e.sym, annotationSet);
-            }
-        }
-    }
-
-    public void main(com.sun.tools.javac.util.List<JCTree.JCCompilationUnit> treeList,
-                     ListBuffer<ClassSymbol> classes,
-                     Map<String, String> origOptions,
-                     ClassLoader aptCL,
-                     AnnotationProcessorFactory providedFactory,
-                     java.util.Set<Class<? extends AnnotationProcessorFactory> > productiveFactories) {
-        Bark bark = Bark.instance(context);
-        java.io.PrintWriter out = bark.warnWriter;
-        Options options = Options.instance(context);
-
-        Collection<TypeDeclaration> spectypedecls =     new LinkedHashSet<TypeDeclaration>();
-        Collection<TypeDeclaration> typedecls =         new LinkedHashSet<TypeDeclaration>();
-        Set<String> unmatchedAnnotations =              new LinkedHashSet<String>();
-        Set<AnnotationTypeDeclaration> emptyATDS =      Collections.emptySet();
-        Set<Class<? extends AnnotationProcessorFactory> > currentRoundFactories =
-            new LinkedHashSet<Class<? extends AnnotationProcessorFactory> >();
-
-        // Determine what annotations are present on the input source
-        // files, create collections of specified type declarations,
-        // and type declarations.
-        AptTreeScanner ats = new AptTreeScanner();
-        for(JCTree t: treeList) {
-            t.accept(ats);
-        }
-
-        // Turn collection of ClassSymbols into Collection of apt decls
-        for (ClassSymbol cs : ats.specifiedDeclCollection) {
-            TypeDeclaration decl = aptenv.declMaker.getTypeDeclaration(cs);
-            spectypedecls.add(decl);
-        }
-
-        for (ClassSymbol cs : ats.declCollection) {
-            TypeDeclaration decl = aptenv.declMaker.getTypeDeclaration(cs);
-            typedecls.add(decl);
-        }
-
-        unmatchedAnnotations.addAll(ats.getAnnotationSet());
-
-        // Process input class files
-        for(ClassSymbol cs : classes) {
-            TypeDeclaration decl = aptenv.declMaker.getTypeDeclaration(cs);
-            // System.out.println("Adding a class to spectypedecls");
-            spectypedecls.add(decl);
-            typedecls.add(decl);
-            computeAnnotationSet(cs, unmatchedAnnotations);
-        }
-
-        if (options.get("-XListAnnotationTypes") != null) {
-            out.println("Set of annotations found:" +
-                        (new TreeSet<String>(unmatchedAnnotations)).toString());
-        }
-
-        AnnotationProcessorEnvironmentImpl trivAPE =
-            new AnnotationProcessorEnvironmentImpl(spectypedecls, typedecls, origOptions, context);
-
-        if (options.get("-XListDeclarations") != null) {
-            out.println("Set of Specified Declarations:" +
-                        spectypedecls);
-
-            out.println("Set of Included Declarations: " +
-                           typedecls);
-        }
-
-        if (options.get("-print") != null) {
-            if (spectypedecls.size() == 0 )
-                throw new UsageMessageNeededException();
-
-            // Run the printing processor
-            AnnotationProcessor proc = (new BootstrapAPF()).getProcessorFor(new HashSet<AnnotationTypeDeclaration>(),
-                                                                            trivAPE);
-            proc.process();
-        } else {
-            // Discovery process
-
-            // List of annotation processory factory instances
-            java.util.Iterator<AnnotationProcessorFactory> providers = null;
-            {
-                /*
-                 * If a factory is provided by the user, the
-                 * "-factory" and "-factorypath" options are not used.
-                 *
-                 * Otherwise, if the "-factory" option is used, search
-                 * the appropriate path for the named class.
-                 * Otherwise, use sun.misc.Service to implement the
-                 * default discovery policy.
-                 */
-
-                java.util.List<AnnotationProcessorFactory> list =
-                    new LinkedList<AnnotationProcessorFactory>();
-                String factoryName = options.get("-factory");
-
-                if (providedFactory != null) {
-                    list.add(providedFactory);
-                    providers = list.iterator();
-                } else if (factoryName != null) {
-                    try {
-                        AnnotationProcessorFactory factory =
-                            (AnnotationProcessorFactory) (aptCL.loadClass(factoryName).newInstance());
-                        list.add(factory);
-                    } catch (ClassNotFoundException cnfe) {
-                        bark.aptWarning("FactoryNotFound", factoryName);
-                    } catch (ClassCastException cce) {
-                        bark.aptWarning("FactoryWrongType", factoryName);
-                    } catch (Exception e ) {
-                        bark.aptWarning("FactoryCantInstantiate", factoryName);
-                    } catch(Throwable t) {
-                        throw new AnnotationProcessingError(t);
-                    }
-
-                    providers = list.iterator();
-                } else {
-                    @SuppressWarnings("unchecked")
-                    Iterator<AnnotationProcessorFactory> iter =
-                            sun.misc.Service.providers(AnnotationProcessorFactory.class, aptCL);
-                    providers = iter;
-
-                }
-            }
-
-            java.util.Map<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> factoryToAnnotation =
-                new LinkedHashMap<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>>();
-
-            if (!providers.hasNext() && productiveFactories.size() == 0) {
-                if (unmatchedAnnotations.size() > 0)
-                    bark.aptWarning("NoAnnotationProcessors");
-                if (spectypedecls.size() == 0)
-                    throw new UsageMessageNeededException();
-                return; // no processors; nothing else to do
-            } else {
-                // If there are no annotations, still give
-                // processors that match everything a chance to
-                // run.
-
-                if(unmatchedAnnotations.size() == 0)
-                    unmatchedAnnotations.add("");
-
-                Set<String> emptyStringSet = new HashSet<String>();
-                emptyStringSet.add("");
-                emptyStringSet = Collections.unmodifiableSet(emptyStringSet);
-
-                while (providers.hasNext() ) {
-                    Object provider = providers.next();
-                    try {
-                        Set<String> matchedStrings = new HashSet<String>();
-
-                        AnnotationProcessorFactory apf = (AnnotationProcessorFactory) provider;
-                        Collection<String> supportedTypes = apf.supportedAnnotationTypes();
-
-                        Collection<Pattern> supportedTypePatterns = new LinkedList<Pattern>();
-                        for(String s: supportedTypes)
-                            supportedTypePatterns.add(importStringToPattern(s));
-
-                        for(String s: unmatchedAnnotations) {
-                            for(Pattern p: supportedTypePatterns) {
-                                if (p.matcher(s).matches()) {
-                                    matchedStrings.add(s);
-                                    break;
-                                }
-                            }
-                        }
-
-                        unmatchedAnnotations.removeAll(matchedStrings);
-
-                        if (options.get("-XPrintFactoryInfo") != null) {
-                            out.println("Factory " + apf.getClass().getName() +
-                                        " matches " +
-                                        ((matchedStrings.size() == 0)?
-                                         "nothing.": matchedStrings));
-                        }
-
-                        if (matchedStrings.size() > 0) {
-                            // convert annotation names to annotation
-                            // type decls
-                            Set<AnnotationTypeDeclaration> atds = new HashSet<AnnotationTypeDeclaration>();
-
-                            // If a "*" processor is called on the
-                            // empty string, pass in an empty set of
-                            // annotation type declarations.
-                            if (!matchedStrings.equals(emptyStringSet)) {
-                                for(String s: matchedStrings) {
-                                    TypeDeclaration decl = aptenv.declMaker.getTypeDeclaration(s);
-                                    AnnotationTypeDeclaration annotdecl;
-                                    if (decl == null) {
-                                        bark.aptError("DeclarationCreation", s);
-                                    } else {
-                                        try {
-                                            annotdecl = (AnnotationTypeDeclaration)decl;
-                                            atds.add(annotdecl);
-
-                                        } catch (ClassCastException cce) {
-                                            bark.aptError("BadDeclaration", s);
-                                        }
-                                    }
-                                }
-                            }
-
-                            currentRoundFactories.add(apf.getClass());
-                            productiveFactories.add(apf.getClass());
-                            factoryToAnnotation.put(apf, atds);
-                        } else if (productiveFactories.contains(apf.getClass())) {
-                            // If a factory provided a processor in a
-                            // previous round but doesn't match any
-                            // annotations this round, call it with an
-                            // empty set of declarations.
-                            currentRoundFactories.add(apf.getClass());
-                            factoryToAnnotation.put(apf, emptyATDS );
-                        }
-
-                        if (unmatchedAnnotations.size() == 0)
-                            break;
-
-                    } catch (ClassCastException cce) {
-                        bark.aptWarning("BadFactory", cce);
-                    }
-                }
-
-                unmatchedAnnotations.remove("");
-            }
-
-            // If the set difference of productiveFactories and
-            // currentRoundFactories is non-empty, call the remaining
-            // productive factories with an empty set of declarations.
-            {
-                java.util.Set<Class<? extends AnnotationProcessorFactory> > neglectedFactories =
-                    new LinkedHashSet<Class<? extends AnnotationProcessorFactory>>(productiveFactories);
-                neglectedFactories.removeAll(currentRoundFactories);
-                for(Class<? extends AnnotationProcessorFactory> working : neglectedFactories) {
-                    try {
-                        AnnotationProcessorFactory factory = working.newInstance();
-                        factoryToAnnotation.put(factory, emptyATDS);
-                    } catch (Exception e ) {
-                        bark.aptWarning("FactoryCantInstantiate", working.getName());
-                    } catch(Throwable t) {
-                        throw new AnnotationProcessingError(t);
-                    }
-                }
-            }
-
-            if (unmatchedAnnotations.size() > 0)
-                bark.aptWarning("AnnotationsWithoutProcessors", unmatchedAnnotations);
-
-            Set<AnnotationProcessor> processors = new LinkedHashSet<AnnotationProcessor>();
-
-            // If there were no source files AND no factory matching "*",
-            // make sure the usage message is printed
-            if (spectypedecls.size() == 0 &&
-                factoryToAnnotation.keySet().size() == 0 )
-                throw new UsageMessageNeededException();
-
-            try {
-                for(Map.Entry<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> entry :
-                        factoryToAnnotation.entrySet()) {
-                    AnnotationProcessorFactory  apFactory = entry.getKey();
-                    AnnotationProcessor processor = apFactory.getProcessorFor(entry.getValue(),
-                                                                              trivAPE);
-                    if (processor != null)
-                        processors.add(processor);
-                    else
-                        bark.aptWarning("NullProcessor", apFactory.getClass().getName());
-                }
-            } catch(Throwable t) {
-                throw new AnnotationProcessingError(t);
-            }
-
-            LinkedList<AnnotationProcessor> temp = new LinkedList<AnnotationProcessor>();
-            temp.addAll(processors);
-
-            AnnotationProcessor proc = AnnotationProcessors.getCompositeAnnotationProcessor(temp);
-
-            try {
-                proc.process();
-            } catch (Throwable t) {
-                throw new AnnotationProcessingError(t);
-            }
-
-            // Invoke listener callback mechanism
-            trivAPE.roundComplete();
-
-            FilerImpl filerimpl = (FilerImpl)trivAPE.getFiler();
-            genSourceFileNames = filerimpl.getSourceFileNames();
-            genClassFileNames = filerimpl.getClassFileNames();
-            filerimpl.flush(); // Make sure new files are written out
-        }
-    }
-
-    /**
-     * Convert import-style string to regex matching that string.  If
-     * the string is a valid import-style string, return a regex that
-     * won't match anything.
-     */
-    Pattern importStringToPattern(String s) {
-        if (com.sun.tools.javac.processing.JavacProcessingEnvironment.isValidImportString(s)) {
-            return com.sun.tools.javac.processing.JavacProcessingEnvironment.validImportStringToPattern(s);
-        } else {
-            Bark bark = Bark.instance(context);
-            bark.aptWarning("MalformedSupportedString", s);
-            return com.sun.tools.javac.processing.JavacProcessingEnvironment.noMatches;
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/comp/BootstrapAPF.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.comp;
-
-import java.util.*;
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-
-@SuppressWarnings("deprecation")
-public class BootstrapAPF implements AnnotationProcessorFactory {
-
-    static final Collection<String> supportedOptions =
-        Collections.unmodifiableSet(new HashSet<String>());
-
-    static Collection<String> supportedAnnotations;
-    static {
-        Collection<String> c = new HashSet<String>();
-        c.add("*");
-        supportedAnnotations = Collections.unmodifiableCollection(c);
-    }
-
-    public BootstrapAPF(){}
-
-    public Collection<String> supportedOptions() {
-        return BootstrapAPF.supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new PrintAP(env);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/comp/PrintAP.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,467 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.comp;
-
-import com.sun.mirror.declaration.*;
-import static com.sun.mirror.declaration.Modifier.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.apt.*;
-
-import java.util.*;
-import com.sun.mirror.util.*;
-
-/**
- * Class used to implement "-print" option.
- */
-@SuppressWarnings("deprecation")
-public class PrintAP implements AnnotationProcessor {
-
-
-    static class PrintingVisitors {
-        int indentation = 0; // Indentation level;
-        AnnotationProcessorEnvironment env;
-        Messager out;
-        Declaration java_lang_Object;
-        Declaration java_lang_annotation_Annotation;
-
-        static Set<Modifier> EMPTY_ELIDES = Collections.emptySet();
-        static Set<Modifier> INTERFACE_ELIDES = EnumSet.of(ABSTRACT);
-        static Set<Modifier> ENUM_ELIDES = EnumSet.of(FINAL, ABSTRACT);
-        static Set<Modifier> INTERFACE_MEMBER_ELIDES = EnumSet.of(ABSTRACT, PUBLIC, STATIC, FINAL);
-
-        PrintingVisitors(AnnotationProcessorEnvironment env) {
-            this.env = env;
-            this.out = env.getMessager();
-            this.java_lang_Object = env.getTypeDeclaration("java.lang.Object");
-            this.java_lang_annotation_Annotation = env.getTypeDeclaration("java.lang.annotation.Annotation");
-        }
-
-
-        static String [] spaces = {
-            "",
-            "  ",
-            "    ",
-            "      ",
-            "        ",
-            "          ",
-            "            ",
-            "              ",
-            "                ",
-            "                  ",
-            "                    "
-        };
-
-
-        String indent(){
-            int indentation = this.indentation;
-            if (indentation < 0)
-                return "";
-            else if (indentation <= 10)
-                return spaces[indentation];
-            else {
-                StringBuilder sb = new StringBuilder();
-                while (indentation > 10) {
-                    sb.append(spaces[indentation]);
-                    indentation -= 10;
-                }
-                sb.append(spaces[indentation]);
-            return sb.toString();
-            }
-        }
-
-
-        class PrePrinting extends SimpleDeclarationVisitor {
-            Map<EnumDeclaration, Integer> enumCardinality  = new HashMap<EnumDeclaration, Integer>();
-            Map<EnumDeclaration, Integer> enumConstVisited = new HashMap<EnumDeclaration, Integer>();
-
-            PrePrinting(){}
-
-            public void visitClassDeclaration(ClassDeclaration d) {
-                System.out.println();
-                printDocComment(d);
-                printModifiers(d, EMPTY_ELIDES);
-                System.out.print("class " + d.getSimpleName());
-                printFormalTypeParameters(d);
-
-                // Elide "extends Object"
-                ClassType Super = d.getSuperclass();
-                if (Super != null && !java_lang_Object.equals(Super.getDeclaration()) )
-                    System.out.print(" extends " + Super.toString());
-
-                printInterfaces(d);
-
-                System.out.println(" {");
-
-                PrintingVisitors.this.indentation++;
-            }
-
-            public void visitEnumDeclaration(EnumDeclaration d) {
-                enumCardinality.put(d, d.getEnumConstants().size());
-                enumConstVisited.put(d, 1);
-
-                System.out.println();
-                printDocComment(d);
-                printModifiers(d, ENUM_ELIDES);
-
-                System.out.print("enum " + d.getSimpleName());
-                printFormalTypeParameters(d);
-                printInterfaces(d);
-
-                System.out.println(" {");
-
-                PrintingVisitors.this.indentation++;
-            }
-
-
-            public void visitInterfaceDeclaration(InterfaceDeclaration d) {
-                System.out.println();
-                printDocComment(d);
-                printModifiers(d, INTERFACE_ELIDES);
-                System.out.print("interface " + d.getSimpleName());
-
-                printFormalTypeParameters(d);
-                printInterfaces(d);
-
-                System.out.println(" {");
-
-                PrintingVisitors.this.indentation++;
-            }
-
-            public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {
-                System.out.println();
-                printDocComment(d);
-                printModifiers(d, INTERFACE_ELIDES);
-                System.out.print("@interface " + d.getSimpleName());
-                printFormalTypeParameters(d);
-
-                printInterfaces(d);
-
-                System.out.println(" {");
-
-                PrintingVisitors.this.indentation++;
-            }
-
-            public void visitFieldDeclaration(FieldDeclaration d) {
-                System.out.println();
-                printDocComment(d);
-                printModifiers(d,
-                               (d.getDeclaringType() instanceof InterfaceDeclaration)?
-                               INTERFACE_MEMBER_ELIDES : EMPTY_ELIDES);
-                System.out.print(d.getType().toString() + " " +
-                                   d.getSimpleName() );
-                String constantExpr = d.getConstantExpression();
-                if (constantExpr != null) {
-                    System.out.print(" = " + constantExpr);
-                }
-                System.out.println(";" );
-            }
-
-            public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {
-                EnumDeclaration ed = d.getDeclaringType();
-                int enumCard = enumCardinality.get(ed);
-                int enumVisit = enumConstVisited.get(ed);
-
-                System.out.println();
-                printDocComment(d);
-                System.out.print(PrintingVisitors.this.indent());
-                System.out.print(d.getSimpleName() );
-                System.out.println((enumVisit < enumCard )? ",":";" );
-
-                enumConstVisited.put(ed, enumVisit+1);
-            }
-
-            public void visitMethodDeclaration(MethodDeclaration d) {
-                System.out.println();
-                printDocComment(d);
-                printModifiers(d,
-                               (d.getDeclaringType() instanceof InterfaceDeclaration)?
-                               INTERFACE_MEMBER_ELIDES : EMPTY_ELIDES);
-                printFormalTypeParameters(d);
-                System.out.print(d.getReturnType().toString() + " ");
-                System.out.print(d.getSimpleName() + "(");
-                printParameters(d);
-                System.out.print(")");
-                printThrows(d);
-                System.out.println(";");
-            }
-
-            public void visitConstructorDeclaration(ConstructorDeclaration d) {
-                System.out.println();
-                printDocComment(d);
-                printModifiers(d, EMPTY_ELIDES);
-                printFormalTypeParameters(d);
-                System.out.print(d.getSimpleName() + "(");
-                printParameters(d);
-                System.out.print(")");
-                printThrows(d);
-                System.out.println(";");
-            }
-
-
-        }
-
-        class PostPrinting extends SimpleDeclarationVisitor {
-            PostPrinting(){}
-
-            public void visitTypeDeclaration(TypeDeclaration d) {
-                PrintingVisitors.this.indentation--;
-
-                System.out.print(PrintingVisitors.this.indent());
-                System.out.println("}");
-            }
-        }
-
-        private void printAnnotations(Collection<AnnotationMirror> annots) {
-
-            for(AnnotationMirror annot: annots) {
-                System.out.print(this.indent());
-                System.out.print(annot.toString());
-                System.out.println();
-            }
-        }
-
-        private void printAnnotationsInline(Collection<AnnotationMirror> annots) {
-
-            for(AnnotationMirror annot: annots) {
-                System.out.print(annot);
-                System.out.print(" ");
-            }
-        }
-
-
-        private void printParameters(ExecutableDeclaration ex) {
-
-            Collection<ParameterDeclaration> parameters = ex.getParameters();
-            int size = parameters.size();
-
-            switch (size) {
-            case 0:
-                break;
-
-            case 1:
-                for(ParameterDeclaration parameter: parameters) {
-                    printModifiers(parameter, EMPTY_ELIDES);
-
-                    if (ex.isVarArgs() ) {
-                        System.out.print(((ArrayType)parameter.getType()).getComponentType() );
-                        System.out.print("...");
-                    } else
-                        System.out.print(parameter.getType());
-                    System.out.print(" " + parameter.getSimpleName());
-                }
-                break;
-
-            default:
-                {
-                    int i = 1;
-                    for(ParameterDeclaration parameter: parameters) {
-                        if (i == 2)
-                            PrintingVisitors.this.indentation++;
-
-                        if (i > 1)
-                            System.out.print(PrintingVisitors.this.indent());
-
-                        printModifiers(parameter, EMPTY_ELIDES);
-
-                        if (i == size && ex.isVarArgs() ) {
-                            System.out.print(((ArrayType)parameter.getType()).getComponentType() );
-                            System.out.print("...");
-                        } else
-                            System.out.print(parameter.getType());
-                        System.out.print(" " + parameter.getSimpleName());
-
-                        if (i < size)
-                            System.out.println(",");
-
-                        i++;
-                    }
-
-                    if (parameters.size() >= 2)
-                        PrintingVisitors.this.indentation--;
-                }
-                break;
-            }
-        }
-
-        private void printDocComment(Declaration d) {
-            String docComment = d.getDocComment();
-
-            if (docComment != null) {
-                // Break comment into lines
-                java.util.StringTokenizer st = new StringTokenizer(docComment,
-                                                                  "\n\r");
-                System.out.print(PrintingVisitors.this.indent());
-                System.out.println("/**");
-
-                while(st.hasMoreTokens()) {
-                    System.out.print(PrintingVisitors.this.indent());
-                    System.out.print(" *");
-                    System.out.println(st.nextToken());
-                }
-
-                System.out.print(PrintingVisitors.this.indent());
-                System.out.println(" */");
-            }
-        }
-
-        private void printModifiers(Declaration d, Collection<Modifier> elides) {
-            printAnnotations(d.getAnnotationMirrors());
-
-            System.out.print(PrintingVisitors.this.indent());
-
-            for(Modifier m: adjustModifiers(d.getModifiers(), elides) ){
-                System.out.print(m.toString() + " ");
-            }
-        }
-
-        private void printModifiers(ParameterDeclaration d, Collection<Modifier> elides) {
-            printAnnotationsInline(d.getAnnotationMirrors());
-
-            for(Modifier m: adjustModifiers(d.getModifiers(), elides) ) {
-                System.out.print(m.toString() + " ");
-            }
-        }
-
-        private Collection<Modifier> adjustModifiers(Collection<Modifier> mods,
-                                                     Collection<Modifier> elides) {
-            if (elides.isEmpty())
-                return mods;
-            else {
-                Collection<Modifier> newMods = new LinkedHashSet<Modifier>();
-                newMods.addAll(mods);
-                newMods.removeAll(elides);
-                return newMods;
-            }
-        }
-
-        private void printFormalTypeParameters(ExecutableDeclaration e) {
-            printFormalTypeParameterSet(e.getFormalTypeParameters(), true);
-        }
-
-        private void printFormalTypeParameters(TypeDeclaration d) {
-            printFormalTypeParameterSet(d.getFormalTypeParameters(), false);
-        }
-
-        private void printFormalTypeParameterSet(Collection<TypeParameterDeclaration> typeParams, boolean pad) {
-            if (typeParams.size() != 0) {
-                System.out.print("<");
-
-                boolean first = true;
-                for(TypeParameterDeclaration tpd: typeParams) {
-                    if (!first)
-                        System.out.print(", ");
-                    System.out.print(tpd.toString());
-                }
-
-                System.out.print(">");
-                if (pad)
-                    System.out.print(" ");
-
-            }
-        }
-
-        private void printInterfaceSet(Collection<InterfaceType> interfaces,
-                                       boolean classNotInterface) {
-            if (interfaces.size() != 0) {
-                System.out.print((classNotInterface?" implements" : " extends"));
-
-                boolean first = true;
-                for(InterfaceType interType: interfaces) {
-                    if (!first)
-                        System.out.print(",");
-                    System.out.print(" ");
-                    System.out.print(interType.toString());
-                    first = false;
-                }
-            }
-        }
-
-        private void printInterfaces(TypeDeclaration d) {
-            printInterfaceSet(d.getSuperinterfaces(), d instanceof ClassDeclaration);
-        }
-
-        private void printInterfaces(AnnotationTypeDeclaration d) {
-            Collection<InterfaceType> interfaces = new HashSet<InterfaceType>(d.getSuperinterfaces());
-
-            for(InterfaceType interType: interfaces) {
-                if (java_lang_annotation_Annotation.equals(interType.getDeclaration()) )
-                    interfaces.remove(interType);
-            }
-
-            printInterfaceSet(interfaces, d instanceof ClassDeclaration);
-        }
-
-        private void printThrows(ExecutableDeclaration d) {
-            Collection<ReferenceType> thrownTypes = d.getThrownTypes();
-            final int size = thrownTypes.size();
-            if (size != 0) {
-                System.out.print(" throws");
-
-                int i = 1;
-                for(ReferenceType thrownType: thrownTypes) {
-                    if (i == 1) {
-                        System.out.print(" ");
-                    }
-
-                    if (i == 2)
-                        PrintingVisitors.this.indentation++;
-
-                    if (i >= 2)
-                        System.out.print(PrintingVisitors.this.indent());
-
-                    System.out.print(thrownType.toString());
-
-
-                    if (i != size) {
-                        System.out.println(", ");
-                    }
-                    i++;
-                }
-
-                if (size >= 2)
-                    PrintingVisitors.this.indentation--;
-            }
-        }
-
-        DeclarationVisitor getPrintingVisitor() {
-            return DeclarationVisitors.getSourceOrderDeclarationScanner(new PrePrinting(),
-                                                                        new PostPrinting());
-        }
-    }
-
-    AnnotationProcessorEnvironment env;
-    PrintAP(AnnotationProcessorEnvironment env) {
-        this.env = env;
-    }
-
-
-    public void process() {
-        Collection<TypeDeclaration> typedecls = env.getSpecifiedTypeDeclarations();
-
-        for (TypeDeclaration td: typedecls)
-            td.accept((new PrintingVisitors(env)).getPrintingVisitor());
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/comp/UsageMessageNeededException.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.comp;
-
-
-public class UsageMessageNeededException extends RuntimeException {
-    private static final long serialVersionUID = -3265159608992825840L;
-}
--- a/src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.main;
-
-import java.io.*;
-import java.util.Map;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.jvm.*;
-
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.tree.JCTree.*;
-
-import com.sun.tools.apt.comp.*;
-import com.sun.tools.apt.util.Bark;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-import com.sun.tools.javac.parser.DocCommentScanner;
-
-/**
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own
- *  risk.  This code and its internal interfaces are subject to change
- *  or deletion without notice.</b>
- */
-@SuppressWarnings("deprecation")
-public class AptJavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
-    /** The context key for the compiler. */
-    protected static final Context.Key<AptJavaCompiler> compilerKey =
-        new Context.Key<AptJavaCompiler>();
-
-    /** Get the JavaCompiler instance for this context. */
-    public static AptJavaCompiler instance(Context context) {
-        AptJavaCompiler instance = context.get(compilerKey);
-        if (instance == null)
-            instance = new AptJavaCompiler(context);
-        return instance;
-    }
-
-
-    java.util.Set<String> genSourceFileNames;
-    java.util.Set<String> genClassFileNames;
-
-    public java.util.Set<String> getSourceFileNames() {
-        return genSourceFileNames;
-    }
-
-    /** List of names of generated class files.
-     */
-    public java.util.Set<String> getClassFileNames() {
-        return genClassFileNames;
-    }
-
-    java.util.Set<java.io.File> aggregateGenFiles = java.util.Collections.emptySet();
-
-    public java.util.Set<java.io.File> getAggregateGenFiles() {
-        return aggregateGenFiles;
-    }
-
-    /** The bark to be used for error reporting.
-     */
-    Bark bark;
-
-    /** The log to be used for error reporting.
-     */
-    Log log;
-
-    /** The annotation framework
-     */
-    Apt apt;
-
-    private static Context preRegister(Context context) {
-        Bark.preRegister(context);
-
-        if (context.get(JavaFileManager.class) == null)
-            JavacFileManager.preRegister(context);
-
-        return context;
-    }
-
-    /** Construct a new compiler from a shared context.
-     */
-    public AptJavaCompiler(Context context) {
-        super(preRegister(context));
-
-        context.put(compilerKey, this);
-        apt = Apt.instance(context);
-
-        ClassReader classReader = ClassReader.instance(context);
-        classReader.preferSource = true;
-
-        // TEMPORARY NOTE: bark==log, but while refactoring, we maintain their
-        // original identities, to remember the original intent.
-        log = Log.instance(context);
-        bark = Bark.instance(context);
-
-        Options options = Options.instance(context);
-        classOutput   = options.get("-retrofit")      == null;
-        nocompile     = options.get("-nocompile")     != null;
-        print         = options.get("-print")         != null;
-        classesAsDecls= options.get("-XclassesAsDecls") != null;
-
-        genSourceFileNames = new java.util.LinkedHashSet<String>();
-        genClassFileNames  = new java.util.LinkedHashSet<String>();
-
-        // this forces a copy of the line map to be kept in the tree,
-        // for use by com.sun.mirror.util.SourcePosition.
-        lineDebugInfo = true;
-    }
-
-    /* Switches:
-     */
-
-    /** Emit class files. This switch is always set, except for the first
-     *  phase of retrofitting, where signatures are parsed.
-     */
-    public boolean classOutput;
-
-    /** The internal printing annotation processor should be used.
-     */
-    public boolean print;
-
-    /** Compilation should not be done after annotation processing.
-     */
-    public boolean nocompile;
-
-    /** Are class files being treated as declarations
-     */
-    public boolean classesAsDecls;
-
-    /** Try to open input stream with given name.
-     *  Report an error if this fails.
-     *  @param filename   The file name of the input stream to be opened.
-     */
-    // PROVIDED FOR EXTREME BACKWARDS COMPATIBILITY
-    // There are some very obscure errors that can arise while translating
-    // the contents of a file from bytes to characters. In Tiger, these
-    // diagnostics were ignored. This method provides compatibility with
-    // that behavior. It would be better to honor those diagnostics, in which
-    // case, this method can be deleted.
-    @Override
-    public CharSequence readSource(JavaFileObject filename) {
-        try {
-            inputFiles.add(filename);
-            boolean prev = bark.setDiagnosticsIgnored(true);
-            try {
-                return filename.getCharContent(false);
-            }
-            finally {
-                bark.setDiagnosticsIgnored(prev);
-            }
-        } catch (IOException e) {
-            bark.error(Position.NOPOS, "cant.read.file", filename);
-            return null;
-        }
-    }
-
-    /** Parse contents of input stream.
-     *  @param filename     The name of the file from which input stream comes.
-     *  @param input        The input stream to be parsed.
-     */
-    // PROVIDED FOR BACKWARDS COMPATIBILITY
-    // In Tiger, diagnostics from the scanner and parser were ignored.
-    // This method provides compatibility with that behavior.
-    // It would be better to honor those diagnostics, in which
-    // case, this method can be deleted.
-    @Override
-    protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) {
-        boolean prev = bark.setDiagnosticsIgnored(true);
-        try {
-            return super.parse(filename, content);
-        }
-        finally {
-            bark.setDiagnosticsIgnored(prev);
-        }
-    }
-
-    @Override
-    protected boolean keepComments() {
-        return true;  // make doc comments available to mirror API impl.
-    }
-
-    /** Track when the JavaCompiler has been used to compile something. */
-    private boolean hasBeenUsed = false;
-
-    /** Main method: compile a list of files, return all compiled classes
-     *  @param filenames     The names of all files to be compiled.
-     */
-    public List<ClassSymbol> compile(List<String> filenames,
-                                     Map<String, String> origOptions,
-                                     ClassLoader aptCL,
-                                     AnnotationProcessorFactory providedFactory,
-                                     java.util.Set<Class<? extends AnnotationProcessorFactory> > productiveFactories,
-                                     java.util.Set<java.io.File> aggregateGenFiles)
-        throws Throwable {
-        // as a JavaCompiler can only be used once, throw an exception if
-        // it has been used before.
-        assert !hasBeenUsed : "attempt to reuse JavaCompiler";
-        hasBeenUsed = true;
-
-        this.aggregateGenFiles = aggregateGenFiles;
-
-        long msec = System.currentTimeMillis();
-
-        ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>();
-        try {
-            JavacFileManager fm = (JavacFileManager)fileManager;
-            //parse all files
-            ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>();
-            for (List<String> l = filenames; l.nonEmpty(); l = l.tail) {
-                if (classesAsDecls) {
-                    if (! l.head.endsWith(".java") ) { // process as class file
-                        ClassSymbol cs = reader.enterClass(names.fromString(l.head));
-                        try {
-                            cs.complete();
-                        } catch(Symbol.CompletionFailure cf) {
-                            bark.aptError("CantFindClass", l);
-                            continue;
-                        }
-
-                        classes.append(cs); // add to list of classes
-                        continue;
-                    }
-                }
-                JavaFileObject fo = fm.getJavaFileObjectsFromStrings(List.of(l.head)).iterator().next();
-                trees.append(parse(fo));
-            }
-
-            //enter symbols for all files
-            List<JCCompilationUnit> roots = trees.toList();
-
-            if (errorCount() == 0) {
-                boolean prev = bark.setDiagnosticsIgnored(true);
-                try {
-                    enter.main(roots);
-                }
-                finally {
-                    bark.setDiagnosticsIgnored(prev);
-                }
-            }
-
-            if (errorCount() == 0) {
-                apt.main(roots,
-                         classes,
-                         origOptions, aptCL,
-                         providedFactory,
-                         productiveFactories);
-                genSourceFileNames.addAll(apt.getSourceFileNames());
-                genClassFileNames.addAll(apt.getClassFileNames());
-            }
-
-        } catch (Abort ex) {
-        }
-
-        if (verbose)
-            log.printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
-
-        chk.reportDeferredDiagnostics();
-
-        printCount("error", errorCount());
-        printCount("warn", warningCount());
-
-        return classes.toList();
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/main/CommandLine.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.main;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.FileReader;
-import java.io.BufferedReader;
-import java.io.StreamTokenizer;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Various utility methods for processing Java tool command line arguments.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class CommandLine {
-    /**
-     * Process Win32-style command files for the specified command line
-     * arguments and return the resulting arguments. A command file argument
-     * is of the form '@file' where 'file' is the name of the file whose
-     * contents are to be parsed for additional arguments. The contents of
-     * the command file are parsed using StreamTokenizer and the original
-     * '@file' argument replaced with the resulting tokens. Recursive command
-     * files are not supported. The '@' character itself can be quoted with
-     * the sequence '@@'.
-     */
-    public static String[] parse(String[] args)
-        throws IOException
-    {
-        ListBuffer<String> newArgs = new ListBuffer<String>();
-        for (int i = 0; i < args.length; i++) {
-            String arg = args[i];
-            if (arg.length() > 1 && arg.charAt(0) == '@') {
-                arg = arg.substring(1);
-                if (arg.charAt(0) == '@') {
-                    newArgs.append(arg);
-                } else {
-                    loadCmdFile(arg, newArgs);
-                }
-            } else {
-                newArgs.append(arg);
-            }
-        }
-        return newArgs.toList().toArray(new String[newArgs.length()]);
-    }
-
-    private static void loadCmdFile(String name, ListBuffer<String> args)
-        throws IOException
-    {
-        Reader r = new BufferedReader(new FileReader(name));
-        StreamTokenizer st = new StreamTokenizer(r);
-        st.resetSyntax();
-        st.wordChars(' ', 255);
-        st.whitespaceChars(0, ' ');
-        st.commentChar('#');
-        st.quoteChar('"');
-        st.quoteChar('\'');
-        while (st.nextToken() != StreamTokenizer.TT_EOF) {
-            args.append(st.sval);
-        }
-        r.close();
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/main/Main.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1281 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.main;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import java.util.StringTokenizer;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-import java.net.URLClassLoader;
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import javax.tools.JavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.code.Source;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.jvm.Target;
-import com.sun.tools.javac.util.*;
-
-import com.sun.tools.apt.comp.AnnotationProcessingError;
-import com.sun.tools.apt.comp.UsageMessageNeededException;
-import com.sun.tools.apt.util.Bark;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-
-import static com.sun.tools.javac.file.Paths.pathToURLs;
-
-/** This class provides a commandline interface to the apt build-time
- *  tool.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own
- *  risk.  This code and its internal interfaces are subject to change
- *  or deletion without notice.</b>
- */
-@SuppressWarnings("deprecation")
-public class Main {
-
-    /** For testing: enter any options you want to be set implicitly
-     *  here.
-     */
-    static String[] forcedOpts = {
-        // Preserve parameter names from class files if the class was
-        // compiled with debug enabled
-        "-XDsave-parameter-names"
-    };
-
-    /** The name of the compiler, for use in diagnostics.
-     */
-    String ownName;
-
-    /** The writer to use for diagnostic output.
-     */
-    PrintWriter out;
-
-
-    /** Instantiated factory to use in lieu of discovery process.
-     */
-    AnnotationProcessorFactory providedFactory = null;
-
-    /** Map representing original command-line arguments.
-     */
-    Map<String,String> origOptions = new HashMap<String, String>();
-
-    /** Classloader to use for finding factories.
-     */
-    ClassLoader aptCL = null;
-
-    /** Result codes.
-     */
-    static final int
-        EXIT_OK = 0,        // Compilation completed with no errors.
-        EXIT_ERROR = 1,     // Completed but reported errors.
-        EXIT_CMDERR = 2,    // Bad command-line arguments
-        EXIT_SYSERR = 3,    // System error or resource exhaustion.
-        EXIT_ABNORMAL = 4;  // Compiler terminated abnormally
-
-    /** This class represents an option recognized by the main program
-     */
-    private class Option {
-        /** Whether or not the option is used only aptOnly.
-         */
-        boolean aptOnly = false;
-
-        /** Option string.
-         */
-        String name;
-
-        /** Documentation key for arguments.
-         */
-        String argsNameKey;
-
-        /** Documentation key for description.
-         */
-        String descrKey;
-
-        /** Suffix option (-foo=bar or -foo:bar)
-         */
-        boolean hasSuffix;
-
-        Option(String name, String argsNameKey, String descrKey) {
-            this.name = name;
-            this.argsNameKey = argsNameKey;
-            this.descrKey = descrKey;
-            char lastChar = name.charAt(name.length()-1);
-            hasSuffix = lastChar == ':' || lastChar == '=';
-        }
-        Option(String name, String descrKey) {
-            this(name, null, descrKey);
-        }
-
-        public String toString() {
-            return name;
-        }
-
-        /** Does this option take a (separate) operand?
-         */
-        boolean hasArg() {
-            return argsNameKey != null && !hasSuffix;
-        }
-
-        /** Does argument string match option pattern?
-         *  @param arg        The command line argument string.
-         */
-        boolean matches(String arg) {
-            return hasSuffix ? arg.startsWith(name) : arg.equals(name);
-        }
-
-        /** For javac-only options, print nothing.
-         */
-        void help() {
-        }
-
-        String helpSynopsis() {
-            return name +
-                (argsNameKey == null ? "" :
-                 ((hasSuffix ? "" : " ") +
-                  getLocalizedString(argsNameKey)));
-        }
-
-        /** Print a line of documentation describing this option, if non-standard.
-         */
-        void xhelp() {}
-
-        /** Process the option (with arg). Return true if error detected.
-         */
-        boolean process(String option, String arg) {
-            options.put(option, arg);
-            return false;
-        }
-
-        /** Process the option (without arg). Return true if error detected.
-         */
-        boolean process(String option) {
-            if (hasSuffix)
-                return process(name, option.substring(name.length()));
-            else
-                return process(option, option);
-        }
-    };
-
-    private class SharedOption extends Option {
-        SharedOption(String name, String argsNameKey, String descrKey) {
-            super(name, argsNameKey, descrKey);
-        }
-
-        SharedOption(String name, String descrKey) {
-            super(name, descrKey);
-        }
-
-        void help() {
-            String s = "  " + helpSynopsis();
-            out.print(s);
-            for (int j = s.length(); j < 29; j++) out.print(" ");
-            Bark.printLines(out, getLocalizedString(descrKey));
-        }
-
-    }
-
-    private class AptOption extends Option {
-        AptOption(String name, String argsNameKey, String descrKey) {
-            super(name, argsNameKey, descrKey);
-            aptOnly = true;
-        }
-
-        AptOption(String name, String descrKey) {
-            super(name, descrKey);
-            aptOnly = true;
-        }
-
-        /** Print a line of documentation describing this option, if standard.
-         */
-        void help() {
-            String s = "  " + helpSynopsis();
-            out.print(s);
-            for (int j = s.length(); j < 29; j++) out.print(" ");
-            Bark.printLines(out, getLocalizedString(descrKey));
-        }
-
-    }
-
-    /** A nonstandard or extended (-X) option
-     */
-    private class XOption extends Option {
-        XOption(String name, String argsNameKey, String descrKey) {
-            super(name, argsNameKey, descrKey);
-        }
-        XOption(String name, String descrKey) {
-            this(name, null, descrKey);
-        }
-        void help() {}
-        void xhelp() {}
-    };
-
-    /** A nonstandard or extended (-X) option
-     */
-    private class AptXOption extends Option {
-        AptXOption(String name, String argsNameKey, String descrKey) {
-            super(name, argsNameKey, descrKey);
-            aptOnly = true;
-        }
-        AptXOption(String name, String descrKey) {
-            this(name, null, descrKey);
-        }
-        void xhelp() {
-            String s = "  " + helpSynopsis();
-            out.print(s);
-            for (int j = s.length(); j < 29; j++) out.print(" ");
-            Log.printLines(out, getLocalizedString(descrKey));
-        }
-    };
-
-    /** A hidden (implementor) option
-     */
-    private class HiddenOption extends Option {
-        HiddenOption(String name) {
-            super(name, null, null);
-        }
-        HiddenOption(String name, String argsNameKey) {
-            super(name, argsNameKey, null);
-        }
-        void help() {}
-        void xhelp() {}
-    };
-
-    private class AptHiddenOption extends HiddenOption {
-        AptHiddenOption(String name) {
-            super(name);
-            aptOnly = true;
-        }
-        AptHiddenOption(String name, String argsNameKey) {
-            super(name, argsNameKey);
-            aptOnly = true;
-        }
-    }
-
-    private Option[] recognizedOptions = {
-        new Option("-g",                                        "opt.g"),
-        new Option("-g:none",                                   "opt.g.none") {
-            boolean process(String option) {
-                options.put("-g:", "none");
-                return false;
-            }
-        },
-
-        new Option("-g:{lines,vars,source}",                    "opt.g.lines.vars.source") {
-            boolean matches(String s) {
-                return s.startsWith("-g:");
-            }
-            boolean process(String option) {
-                String suboptions = option.substring(3);
-                options.put("-g:", suboptions);
-                // enter all the -g suboptions as "-g:suboption"
-                for (StringTokenizer t = new StringTokenizer(suboptions, ","); t.hasMoreTokens(); ) {
-                    String tok = t.nextToken();
-                    String opt = "-g:" + tok;
-                    options.put(opt, opt);
-                }
-                return false;
-            }
-        },
-
-        new XOption("-Xlint",                                   "opt.Xlint"),
-        new XOption("-Xlint:{"
-                    + "all,"
-                    + "cast,deprecation,divzero,empty,unchecked,fallthrough,path,serial,finally,overrides,"
-                    + "-cast,-deprecation,-divzero,-empty,-unchecked,-fallthrough,-path,-serial,-finally,-overrides,"
-                    + "none}",
-                                                                "opt.Xlint.suboptlist") {
-            boolean matches(String s) {
-                return s.startsWith("-Xlint:");
-            }
-            boolean process(String option) {
-                String suboptions = option.substring(7);
-                options.put("-Xlint:", suboptions);
-                // enter all the -Xlint suboptions as "-Xlint:suboption"
-                for (StringTokenizer t = new StringTokenizer(suboptions, ","); t.hasMoreTokens(); ) {
-                    String tok = t.nextToken();
-                    String opt = "-Xlint:" + tok;
-                    options.put(opt, opt);
-                }
-                return false;
-            }
-        },
-
-        new Option("-nowarn",                                   "opt.nowarn"),
-        new Option("-verbose",                                  "opt.verbose"),
-
-        // -deprecation is retained for command-line backward compatibility
-        new Option("-deprecation",                              "opt.deprecation") {
-                boolean process(String option) {
-                    options.put("-Xlint:deprecation", option);
-                    return false;
-                }
-            },
-
-        new SharedOption("-classpath",     "opt.arg.path",      "opt.classpath"),
-        new SharedOption("-cp",            "opt.arg.path",      "opt.classpath") {
-            boolean process(String option, String arg) {
-                return super.process("-classpath", arg);
-            }
-        },
-        new Option("-sourcepath",          "opt.arg.path",      "opt.sourcepath"),
-        new Option("-bootclasspath",       "opt.arg.path",      "opt.bootclasspath") {
-            boolean process(String option, String arg) {
-                options.remove("-Xbootclasspath/p:");
-                options.remove("-Xbootclasspath/a:");
-                return super.process(option, arg);
-            }
-        },
-        new XOption("-Xbootclasspath/p:",  "opt.arg.path", "opt.Xbootclasspath.p"),
-        new XOption("-Xbootclasspath/a:",  "opt.arg.path", "opt.Xbootclasspath.a"),
-        new XOption("-Xbootclasspath:",    "opt.arg.path", "opt.bootclasspath") {
-            boolean process(String option, String arg) {
-                options.remove("-Xbootclasspath/p:");
-                options.remove("-Xbootclasspath/a:");
-                return super.process("-bootclasspath", arg);
-            }
-        },
-        new Option("-extdirs",             "opt.arg.dirs",      "opt.extdirs"),
-        new XOption("-Djava.ext.dirs=",    "opt.arg.dirs",      "opt.extdirs") {
-            boolean process(String option, String arg) {
-                return super.process("-extdirs", arg);
-            }
-        },
-        new Option("-endorseddirs",        "opt.arg.dirs",      "opt.endorseddirs"),
-        new XOption("-Djava.endorsed.dirs=","opt.arg.dirs",     "opt.endorseddirs") {
-            boolean process(String option, String arg) {
-                return super.process("-endorseddirs", arg);
-            }
-        },
-        new Option("-proc:{none, only}",                        "opt.proc.none.only") {
-            public boolean matches(String s) {
-                return s.equals("-proc:none") || s.equals("-proc:only");
-            }
-        },
-        new Option("-processor",        "opt.arg.class",        "opt.processor"),
-        new Option("-processorpath",    "opt.arg.path",         "opt.processorpath"),
-
-        new SharedOption("-d",          "opt.arg.path", "opt.d"),
-        new SharedOption("-s",          "opt.arg.path", "opt.s"),
-        new Option("-encoding",         "opt.arg.encoding",     "opt.encoding"),
-        new SharedOption("-source",             "opt.arg.release",      "opt.source") {
-            boolean process(String option, String operand) {
-                Source source = Source.lookup(operand);
-                if (source == null) {
-                    error("err.invalid.source", operand);
-                    return true;
-                } else if (source.compareTo(Source.JDK1_5) > 0) {
-                    error("err.unsupported.source.version", operand);
-                    return true;
-                }
-                return super.process(option, operand);
-            }
-        },
-        new Option("-target",           "opt.arg.release",      "opt.target") {
-            boolean process(String option, String operand) {
-                Target target = Target.lookup(operand);
-                if (target == null) {
-                    error("err.invalid.target", operand);
-                    return true;
-                } else if (target.compareTo(Target.JDK1_5) > 0) {
-                    error("err.unsupported.target.version", operand);
-                    return true;
-                }
-                return super.process(option, operand);
-            }
-        },
-        new AptOption("-version",               "opt.version") {
-            boolean process(String option) {
-                Bark.printLines(out, ownName + " " + AptJavaCompiler.version());
-                return super.process(option);
-            }
-        },
-        new HiddenOption("-fullversion"),
-        new AptOption("-help",                                  "opt.help") {
-            boolean process(String option) {
-                Main.this.help();
-                return super.process(option);
-            }
-        },
-        new SharedOption("-X",                                  "opt.X") {
-            boolean process(String option) {
-                Main.this.xhelp();
-                return super.process(option);
-            }
-        },
-
-        // This option exists only for the purpose of documenting itself.
-        // It's actually implemented by the launcher.
-        new AptOption("-J",             "opt.arg.flag",         "opt.J") {
-            String helpSynopsis() {
-                hasSuffix = true;
-                return super.helpSynopsis();
-            }
-            boolean process(String option) {
-                throw new AssertionError
-                    ("the -J flag should be caught by the launcher.");
-            }
-        },
-
-
-        new SharedOption("-A",          "opt.proc.flag",        "opt.A") {
-                String helpSynopsis() {
-                    hasSuffix = true;
-                    return super.helpSynopsis();
-                }
-
-                boolean matches(String arg) {
-                    return arg.startsWith("-A");
-                }
-
-                boolean hasArg() {
-                    return false;
-                }
-
-                boolean process(String option) {
-                    return process(option, option);
-                }
-            },
-
-        new AptOption("-nocompile",     "opt.nocompile"),
-
-        new AptOption("-print",         "opt.print"),
-
-        new AptOption("-factorypath", "opt.arg.path", "opt.factorypath"),
-
-        new AptOption("-factory",     "opt.arg.class", "opt.factory"),
-
-        new AptXOption("-XListAnnotationTypes", "opt.XListAnnotationTypes"),
-
-        new AptXOption("-XListDeclarations",    "opt.XListDeclarations"),
-
-        new AptXOption("-XPrintAptRounds",      "opt.XPrintAptRounds"),
-
-        new AptXOption("-XPrintFactoryInfo",    "opt.XPrintFactoryInfo"),
-
-        /*
-         * Option to treat both classes and source files as
-         * declarations that can be given on the command line and
-         * processed as the result of an apt round.
-         */
-        new AptXOption("-XclassesAsDecls", "opt.XClassesAsDecls"),
-
-        // new Option("-moreinfo",                                      "opt.moreinfo") {
-        new HiddenOption("-moreinfo") {
-            boolean process(String option) {
-                Type.moreInfo = true;
-                return super.process(option);
-            }
-        },
-
-        // treat warnings as errors
-        new HiddenOption("-Werror"),
-
-        // use complex inference from context in the position of a method call argument
-        new HiddenOption("-complexinference"),
-
-        // prompt after each error
-        // new Option("-prompt",                                        "opt.prompt"),
-        new HiddenOption("-prompt"),
-
-        // dump stack on error
-        new HiddenOption("-doe"),
-
-        // display warnings for generic unchecked and unsafe operations
-        new HiddenOption("-warnunchecked") {
-            boolean process(String option) {
-                options.put("-Xlint:unchecked", option);
-                return false;
-            }
-        },
-
-        new HiddenOption("-Xswitchcheck") {
-            boolean process(String option) {
-                options.put("-Xlint:switchcheck", option);
-                return false;
-            }
-        },
-
-        // generate trace output for subtyping operations
-        new HiddenOption("-debugsubtyping"),
-
-        new XOption("-Xmaxerrs",        "opt.arg.number",       "opt.maxerrs"),
-        new XOption("-Xmaxwarns",       "opt.arg.number",       "opt.maxwarns"),
-        new XOption("-Xstdout",         "opt.arg.file",         "opt.Xstdout") {
-            boolean process(String option, String arg) {
-                try {
-                    out = new PrintWriter(new FileWriter(arg), true);
-                } catch (java.io.IOException e) {
-                    error("err.error.writing.file", arg, e);
-                    return true;
-                }
-                return super.process(option, arg);
-            }
-        },
-
-        new XOption("-Xprint",                                  "opt.print"),
-
-        new XOption("-XprintRounds",                            "opt.printRounds"),
-
-        new XOption("-XprintProcessorInfo",                     "opt.printProcessorInfo"),
-
-
-        /* -O is a no-op, accepted for backward compatibility. */
-        new HiddenOption("-O"),
-
-        /* -Xjcov produces tables to support the code coverage tool jcov. */
-        new HiddenOption("-Xjcov"),
-
-        /* This is a back door to the compiler's option table.
-         * -Dx=y sets the option x to the value y.
-         * -Dx sets the option x to the value x.
-         */
-        new HiddenOption("-XD") {
-            String s;
-            boolean matches(String s) {
-                this.s = s;
-                return s.startsWith(name);
-            }
-            boolean process(String option) {
-                s = s.substring(name.length());
-                int eq = s.indexOf('=');
-                String key = (eq < 0) ? s : s.substring(0, eq);
-                String value = (eq < 0) ? s : s.substring(eq+1);
-                options.put(key, value);
-                return false;
-            }
-        },
-
-        new HiddenOption("sourcefile") {
-                String s;
-                boolean matches(String s) {
-                    this.s = s;
-                    return s.endsWith(".java") ||
-                        (options.get("-XclassesAsDecls") != null);
-                }
-                boolean process(String option) {
-                    if (s.endsWith(".java")) {
-                        if (!sourceFileNames.contains(s))
-                            sourceFileNames.add(s);
-                    } else if (options.get("-XclassesAsDecls") != null) {
-                        classFileNames.add(s);
-                    }
-                    return false;
-                }
-            },
-    };
-
-    /**
-     * Construct a compiler instance.
-     */
-    public Main(String name) {
-        this(name, new PrintWriter(System.err, true));
-    }
-
-    /**
-     * Construct a compiler instance.
-     */
-    public Main(String name, PrintWriter out) {
-        this.ownName = name;
-        this.out = out;
-    }
-
-    /** A table of all options that's passed to the JavaCompiler constructor.  */
-    private Options options = null;
-
-    /** The list of source files to process
-     */
-    java.util.List<String> sourceFileNames = new java.util.LinkedList<String>();
-
-    /** The list of class files to process
-     */
-    java.util.List<String> classFileNames = new java.util.LinkedList<String>();
-
-    /** List of top level names of generated source files from most recent apt round.
-     */
-    java.util.Set<String> genSourceFileNames = new java.util.LinkedHashSet<String>();
-
-    /** List of names of generated class files from most recent apt round.
-     */
-    java.util.Set<String> genClassFileNames  = new java.util.LinkedHashSet<String>();
-
-    /**
-     * List of all the generated source file names across all apt rounds.
-     */
-    java.util.Set<String> aggregateGenSourceFileNames = new java.util.LinkedHashSet<String>();
-
-    /**
-     * List of all the generated class file names across all apt rounds.
-     */
-    java.util.Set<String> aggregateGenClassFileNames  = new java.util.LinkedHashSet<String>();
-
-    /**
-     * List of all the generated file names across all apt rounds.
-     */
-    java.util.Set<java.io.File> aggregateGenFiles = new java.util.LinkedHashSet<java.io.File>();
-
-    /**
-     * Set of all factories that have provided a processor on some apt round.
-     */
-    java.util.Set<Class<? extends AnnotationProcessorFactory> > productiveFactories  =
-        new java.util.LinkedHashSet<Class<? extends AnnotationProcessorFactory> >();
-
-
-
-    /** Print a string that explains usage.
-     */
-    void help() {
-        Bark.printLines(out, getLocalizedString("msg.usage.header", ownName));
-        for (int i=0; i < recognizedOptions.length; i++) {
-            recognizedOptions[i].help();
-        }
-        Bark.printLines(out, getLocalizedString("msg.usage.footer"));
-        out.println();
-    }
-
-    /** Print a string that explains usage for X options.
-     */
-    void xhelp() {
-        for (int i=0; i<recognizedOptions.length; i++) {
-            recognizedOptions[i].xhelp();
-        }
-        out.println();
-        Bark.printLines(out, getLocalizedString("msg.usage.nonstandard.footer"));
-    }
-
-    /** Report a usage error.
-     */
-    void error(String key, Object... args) {
-        warning(key, args);
-        help();
-    }
-
-    /** Report a warning.
-     */
-    void warning(String key, Object... args) {
-        Bark.printLines(out, ownName + ": "
-                       + getLocalizedString(key, args));
-    }
-
-    /** Process command line arguments: store all command line options
-     *  in `options' table and return all source filenames.
-     *  @param args    The array of command line arguments.
-     */
-    protected java.util.List<String> processArgs(String[] flags) {
-        int ac = 0;
-        while (ac < flags.length) {
-            String flag = flags[ac];
-            ac++;
-
-            int j;
-            for (j=0; j < recognizedOptions.length; j++)
-                if (recognizedOptions[j].matches(flag))
-                    break;
-
-            if (j == recognizedOptions.length) {
-                error("err.invalid.flag", flag);
-                return null;
-            }
-
-            Option option = recognizedOptions[j];
-            if (option.hasArg()) {
-                if (ac == flags.length) {
-                    error("err.req.arg", flag);
-                    return null;
-                }
-                String operand = flags[ac];
-                ac++;
-                if (option.process(flag, operand))
-                    return null;
-            } else {
-                if (option.process(flag))
-                    return null;
-            }
-        }
-
-        String sourceString = options.get("-source");
-        Source source = (sourceString != null)
-            ? Source.lookup(sourceString)
-            : Source.JDK1_5; // JDK 5 is the latest supported source version
-        String targetString = options.get("-target");
-        Target target = (targetString != null)
-            ? Target.lookup(targetString)
-            : Target.JDK1_5; // JDK 5 is the latest supported source version
-        // We don't check source/target consistency for CLDC, as J2ME
-        // profiles are not aligned with J2SE targets; moreover, a
-        // single CLDC target may have many profiles.  In addition,
-        // this is needed for the continued functioning of the JSR14
-        // prototype.
-        if (Character.isDigit(target.name.charAt(0)) &&
-            target.compareTo(source.requiredTarget()) < 0) {
-            if (targetString != null) {
-                if (sourceString == null) {
-                    warning("warn.target.default.source.conflict",
-                            targetString,
-                            source.requiredTarget().name);
-                } else {
-                    warning("warn.source.target.conflict",
-                            sourceString,
-                            source.requiredTarget().name);
-                }
-                return null;
-            } else {
-                options.put("-target", source.requiredTarget().name);
-            }
-        }
-        return sourceFileNames;
-    }
-
-    /** Programmatic interface for main function.
-     * @param args    The command line parameters.
-     */
-    public int compile(String[] args, AnnotationProcessorFactory factory) {
-        int returnCode = 0;
-        providedFactory = factory;
-
-        Context context = new Context();
-        JavacFileManager.preRegister(context);
-        options = Options.instance(context);
-        Bark bark;
-
-        /*
-         * Process the command line options to create the intial
-         * options data.  This processing is at least partially reused
-         * by any recursive apt calls.
-         */
-
-        // For testing: assume all arguments in forcedOpts are
-        // prefixed to command line arguments.
-        processArgs(forcedOpts);
-
-        /*
-         * A run of apt only gets passed the most recently generated
-         * files; the initial run of apt gets passed the files from
-         * the command line.
-         */
-
-        java.util.List<String> origFilenames;
-        try {
-            // assign args the result of parse to capture results of
-            // '@file' expansion
-            origFilenames = processArgs((args=CommandLine.parse(args)));
-
-            if (options.get("suppress-tool-api-removal-message") == null) {
-                Bark.printLines(out, getLocalizedString("misc.Deprecation"));
-            }
-
-            if (origFilenames == null) {
-                return EXIT_CMDERR;
-            } else if (origFilenames.size() == 0) {
-                // it is allowed to compile nothing if just asking for help
-                if (options.get("-help") != null ||
-                    options.get("-X") != null)
-                    return EXIT_OK;
-            }
-        } catch (java.io.FileNotFoundException e) {
-            Bark.printLines(out, ownName + ": " +
-                           getLocalizedString("err.file.not.found",
-                                              e.getMessage()));
-            return EXIT_SYSERR;
-        } catch (IOException ex) {
-            ioMessage(ex);
-            return EXIT_SYSERR;
-        } catch (OutOfMemoryError ex) {
-            resourceMessage(ex);
-            return EXIT_SYSERR;
-        } catch (StackOverflowError ex) {
-            resourceMessage(ex);
-            return EXIT_SYSERR;
-        } catch (FatalError ex) {
-            feMessage(ex);
-            return EXIT_SYSERR;
-        } catch (sun.misc.ServiceConfigurationError sce) {
-            sceMessage(sce);
-            return EXIT_ABNORMAL;
-        } catch (Throwable ex) {
-            bugMessage(ex);
-            return EXIT_ABNORMAL;
-        }
-
-
-        boolean firstRound = true;
-        boolean needSourcePath = false;
-        boolean needClassPath  = false;
-        boolean classesAsDecls = options.get("-XclassesAsDecls") != null;
-
-        /*
-         * Create augumented classpath and sourcepath values.
-         *
-         * If any of the prior apt rounds generated any new source
-         * files, the n'th apt round (and any javac invocation) has the
-         * source destination path ("-s path") as the last element of
-         * the "-sourcepath" to the n'th call.
-         *
-         * If any of the prior apt rounds generated any new class files,
-         * the n'th apt round (and any javac invocation) has the class
-         * destination path ("-d path") as the last element of the
-         * "-classpath" to the n'th call.
-         */
-        String augmentedSourcePath = "";
-        String augmentedClassPath = "";
-        String baseClassPath = "";
-
-        try {
-            /*
-             * Record original options for future annotation processor
-             * invocations.
-             */
-            origOptions = new HashMap<String, String>(options.size());
-            for(String s: options.keySet()) {
-                String value;
-                if (s.equals(value = options.get(s)))
-                    origOptions.put(s, (String)null);
-                else
-                    origOptions.put(s, value);
-            }
-            origOptions = Collections.unmodifiableMap(origOptions);
-
-            JavacFileManager fm = (JavacFileManager) context.get(JavaFileManager.class);
-            {
-                // Note: it might be necessary to check for an empty
-                // component ("") of the source path or class path
-
-                String sourceDest = options.get("-s");
-                if (fm.hasLocation(StandardLocation.SOURCE_PATH)) {
-                    for(File f: fm.getLocation(StandardLocation.SOURCE_PATH))
-                        augmentedSourcePath += (f + File.pathSeparator);
-                    augmentedSourcePath += (sourceDest == null)?".":sourceDest;
-                } else {
-                    augmentedSourcePath = ".";
-
-                    if (sourceDest != null)
-                        augmentedSourcePath += (File.pathSeparator + sourceDest);
-                }
-
-                String classDest = options.get("-d");
-                if (fm.hasLocation(StandardLocation.CLASS_PATH)) {
-                    for(File f: fm.getLocation(StandardLocation.CLASS_PATH))
-                        baseClassPath += (f + File.pathSeparator);
-                    // put baseClassPath into map to handle any
-                    // value needed for the classloader
-                    options.put("-classpath", baseClassPath);
-
-                    augmentedClassPath = baseClassPath + ((classDest == null)?".":classDest);
-                } else {
-                    baseClassPath = ".";
-                    if (classDest != null)
-                        augmentedClassPath = baseClassPath + (File.pathSeparator + classDest);
-                }
-                assert options.get("-classpath") != null;
-            }
-
-            /*
-             * Create base and augmented class loaders
-             */
-            ClassLoader augmentedAptCL = null;
-            {
-            /*
-             * Use a url class loader to look for classes on the
-             * user-specified class path. Prepend computed bootclass
-             * path, which includes extdirs, to the URLClassLoader apt
-             * uses.
-             */
-                String aptclasspath = "";
-                String bcp = "";
-                Iterable<? extends File> bootclasspath = fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH);
-
-                if (bootclasspath != null) {
-                    for(File f: bootclasspath)
-                        bcp += (f + File.pathSeparator);
-                }
-
-                // If the factory path is set, use that path
-                if (providedFactory == null)
-                    aptclasspath = options.get("-factorypath");
-                if (aptclasspath == null)
-                    aptclasspath = options.get("-classpath");
-
-                assert aptclasspath != null;
-                aptclasspath = (bcp + aptclasspath);
-                aptCL = new URLClassLoader(pathToURLs(aptclasspath));
-
-                if (providedFactory == null &&
-                    options.get("-factorypath") != null) // same CL even if new class files written
-                    augmentedAptCL = aptCL;
-                else {
-                    // Create class loader in case new class files are
-                    // written
-                    augmentedAptCL = new URLClassLoader(pathToURLs(augmentedClassPath.
-                                                                   substring(baseClassPath.length())),
-                                                        aptCL);
-                }
-            }
-
-            int round = 0; // For -XPrintAptRounds
-            do {
-                round++;
-
-                Context newContext = new Context();
-                Options newOptions = Options.instance(newContext); // creates a new context
-                newOptions.putAll(options);
-
-                // populate with old options... don't bother reparsing command line, etc.
-
-                // if genSource files, must add destination to source path
-                if (genSourceFileNames.size() > 0 && !firstRound) {
-                    newOptions.put("-sourcepath", augmentedSourcePath);
-                    needSourcePath = true;
-                }
-                aggregateGenSourceFileNames.addAll(genSourceFileNames);
-                sourceFileNames.addAll(genSourceFileNames);
-                genSourceFileNames.clear();
-
-                // Don't really need to track this; just have to add -d
-                // "foo" to class path if any class files are generated
-                if (genClassFileNames.size() > 0) {
-                    newOptions.put("-classpath", augmentedClassPath);
-                    aptCL = augmentedAptCL;
-                    needClassPath = true;
-                }
-                aggregateGenClassFileNames.addAll(genClassFileNames);
-                classFileNames.addAll(genClassFileNames);
-                genClassFileNames.clear();
-
-                options = newOptions;
-
-                if (options.get("-XPrintAptRounds") != null) {
-                    out.println("apt Round : " + round);
-                    out.println("filenames: " + sourceFileNames);
-                    if (classesAsDecls)
-                        out.println("classnames: " + classFileNames);
-                    out.println("options: " + options);
-                }
-
-                returnCode = compile(args, newContext);
-                firstRound = false;
-
-                // Check for reported errors before continuing
-                bark = Bark.instance(newContext);
-            } while(((genSourceFileNames.size() != 0 ) ||
-                     (classesAsDecls && genClassFileNames.size() != 0)) &&
-                    bark.nerrors == 0);
-        } catch (UsageMessageNeededException umne) {
-            help();
-            return EXIT_CMDERR; // will cause usage message to be printed
-        }
-
-        /*
-         * Do not compile if a processor has reported an error or if
-         * there are no source files to process.  A more sophisticated
-         * test would also fail for syntax errors caught by javac.
-         */
-        if (options.get("-nocompile") == null &&
-            options.get("-print")     == null &&
-            bark.nerrors == 0 &&
-            (origFilenames.size() > 0 || aggregateGenSourceFileNames.size() > 0 )) {
-            /*
-             * Need to create new argument string for calling javac:
-             * 1. apt specific arguments (e.g. -factory) must be stripped out
-             * 2. proper settings for sourcepath and classpath must be used
-             * 3. generated class names must be added
-             * 4. class file names as declarations must be removed
-             */
-
-            int newArgsLength = args.length +
-                (needSourcePath?1:0) +
-                (needClassPath?1:0) +
-                aggregateGenSourceFileNames.size();
-
-            // Null out apt-specific options and don't copy over into
-            // newArgs. This loop should be a lot faster; the options
-            // array should be replaced with a better data structure
-            // which includes a map from strings to options.
-            //
-            // If treating classes as declarations, must strip out
-            // class names from the javac argument list
-            argLoop:
-            for(int i = 0; i < args.length; i++) {
-                int matchPosition = -1;
-
-                // "-A" by itself is recognized by apt but not javac
-                if (args[i] != null && args[i].equals("-A")) {
-                    newArgsLength--;
-                    args[i] = null;
-                    continue argLoop;
-                } else {
-                    optionLoop:
-                    for(int j = 0; j < recognizedOptions.length; j++) {
-                        if (args[i] != null && recognizedOptions[j].matches(args[i])) {
-                            matchPosition = j;
-                            break optionLoop;
-                        }
-                    }
-
-                    if (matchPosition != -1) {
-                        Option op = recognizedOptions[matchPosition];
-                        if (op.aptOnly) {
-                            newArgsLength--;
-                            args[i] = null;
-                            if (op.hasArg()) {
-                                newArgsLength--;
-                                args[i+1] = null;
-                            }
-                        } else {
-                            if (op.hasArg()) { // skip over next string
-                                i++;
-                                continue argLoop;
-                            }
-
-                            if ((options.get("-XclassesAsDecls") != null) &&
-                                (matchPosition == (recognizedOptions.length-1)) ){
-                                // Remove class file names from
-                                // consideration by javac.
-                                if (! args[i].endsWith(".java")) {
-                                    newArgsLength--;
-                                    args[i] = null;
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-
-            String newArgs[] = new String[newArgsLength];
-
-            int j = 0;
-            for(int i=0; i < args.length; i++) {
-                if (args[i] != null)
-                    newArgs[j++] = args[i];
-            }
-
-            if (needClassPath)
-                newArgs[j++] = "-XD-classpath=" + augmentedClassPath;
-
-            if (needSourcePath) {
-                newArgs[j++] = "-XD-sourcepath=" + augmentedSourcePath;
-
-                for(String s: aggregateGenSourceFileNames)
-                    newArgs[j++] = s;
-            }
-
-            returnCode = com.sun.tools.javac.Main.compile(newArgs);
-        }
-
-        return returnCode;
-    }
-
-    /** Programmatic interface for main function.
-     * @param args    The command line parameters.
-     */
-    int compile(String[] args, Context context) {
-        boolean assertionsEnabled = false;
-        assert assertionsEnabled = true;
-        if (!assertionsEnabled) {
-            // Bark.printLines(out, "fatal error: assertions must be enabled when running javac");
-            // return EXIT_ABNORMAL;
-        }
-        int exitCode = EXIT_OK;
-
-        AptJavaCompiler comp = null;
-        try {
-            context.put(Bark.outKey, out);
-
-            comp = AptJavaCompiler.instance(context);
-            if (comp == null)
-                return EXIT_SYSERR;
-
-            java.util.List<String> nameList = new java.util.LinkedList<String>();
-            nameList.addAll(sourceFileNames);
-            if (options.get("-XclassesAsDecls") != null)
-                nameList.addAll(classFileNames);
-
-            List<Symbol.ClassSymbol> cs
-                = comp.compile(List.from(nameList.toArray(new String[0])),
-                               origOptions,
-                               aptCL,
-                               providedFactory,
-                               productiveFactories,
-                               aggregateGenFiles);
-
-            /*
-             * If there aren't new source files, we shouldn't bother
-             *  running javac if there were errors.
-             *
-             * If there are new files, we should try running javac in
-             * case there were typing errors.
-             *
-             */
-
-            if (comp.errorCount() != 0 ||
-                options.get("-Werror") != null && comp.warningCount() != 0)
-                return EXIT_ERROR;
-        } catch (IOException ex) {
-            ioMessage(ex);
-            return EXIT_SYSERR;
-        } catch (OutOfMemoryError ex) {
-            resourceMessage(ex);
-            return EXIT_SYSERR;
-        } catch (StackOverflowError ex) {
-            resourceMessage(ex);
-            return EXIT_SYSERR;
-        } catch (FatalError ex) {
-            feMessage(ex);
-            return EXIT_SYSERR;
-        } catch (UsageMessageNeededException umne) {
-            help();
-            return EXIT_CMDERR; // will cause usage message to be printed
-        } catch (AnnotationProcessingError ex) {
-            apMessage(ex);
-            return EXIT_ABNORMAL;
-        } catch (sun.misc.ServiceConfigurationError sce) {
-            sceMessage(sce);
-            return EXIT_ABNORMAL;
-        } catch (Throwable ex) {
-            bugMessage(ex);
-            return EXIT_ABNORMAL;
-        } finally {
-            if (comp != null) {
-                comp.close();
-                genSourceFileNames.addAll(comp.getSourceFileNames());
-                genClassFileNames.addAll(comp.getClassFileNames());
-            }
-            sourceFileNames = new java.util.LinkedList<String>();
-            classFileNames  = new java.util.LinkedList<String>();
-        }
-        return exitCode;
-    }
-
-    /** Print a message reporting an internal error.
-     */
-    void bugMessage(Throwable ex) {
-        Bark.printLines(out, getLocalizedString("msg.bug",
-                                               AptJavaCompiler.version()));
-        ex.printStackTrace(out);
-    }
-
-    /** Print a message reporting an fatal error.
-     */
-    void apMessage(AnnotationProcessingError ex) {
-        Bark.printLines(out, getLocalizedString("misc.Problem"));
-        ex.getCause().printStackTrace(out);
-    }
-
-    /** Print a message about sun.misc.Service problem.
-     */
-    void sceMessage(sun.misc.ServiceConfigurationError ex) {
-        Bark.printLines(out, getLocalizedString("misc.SunMiscService"));
-        ex.printStackTrace(out);
-    }
-
-    /** Print a message reporting an fatal error.
-     */
-    void feMessage(Throwable ex) {
-        Bark.printLines(out, ex.toString());
-    }
-
-    /** Print a message reporting an input/output error.
-     */
-    void ioMessage(Throwable ex) {
-        Bark.printLines(out, getLocalizedString("msg.io"));
-        ex.printStackTrace(out);
-    }
-
-    /** Print a message reporting an out-of-resources error.
-     */
-    void resourceMessage(Throwable ex) {
-        Bark.printLines(out, getLocalizedString("msg.resource"));
-        ex.printStackTrace(out);
-    }
-
-    /* ************************************************************************
-     * Internationalization
-     *************************************************************************/
-
-    /** Find a localized string in the resource bundle.
-     *  @param key     The key for the localized string.
-     */
-    private static String getLocalizedString(String key, Object... args) {
-        return getText(key, args);
-    }
-
-    private static final String javacRB =
-        "com.sun.tools.javac.resources.javac";
-
-    private static final String aptRB =
-        "com.sun.tools.apt.resources.apt";
-
-    private static ResourceBundle messageRBjavac;
-    private static ResourceBundle messageRBapt;
-
-    /** Initialize ResourceBundle.
-     */
-    private static void initResource() {
-        try {
-            messageRBapt   = ResourceBundle.getBundle(aptRB);
-            messageRBjavac = ResourceBundle.getBundle(javacRB);
-        } catch (MissingResourceException e) {
-            Error x = new FatalError("Fatal Error: Resource for apt or javac is missing");
-            x.initCause(e);
-            throw x;
-        }
-    }
-
-    /** Get and format message string from resource.
-     */
-    private static String getText(String key, Object... _args) {
-        String[] args = new String[_args.length];
-        for (int i=0; i<_args.length; i++) {
-            args[i] = "" + _args[i];
-        }
-        if (messageRBapt == null || messageRBjavac == null )
-            initResource();
-        try {
-            return MessageFormat.format(messageRBapt.getString("apt." + key),
-                                        (Object[]) args);
-        } catch (MissingResourceException e) {
-            try {
-                return MessageFormat.format(messageRBjavac.getString("javac." + key),
-                                            (Object[]) args);
-            } catch (MissingResourceException f) {
-                String msg = "apt or javac message file broken: key={0} "
-                    + "arguments={1}, {2}";
-                return MessageFormat.format(msg, (Object[]) args);
-            }
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/AptEnv.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror;
-
-
-import com.sun.tools.apt.mirror.declaration.DeclarationMaker;
-import com.sun.tools.apt.mirror.type.TypeMaker;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.CompletionFailure;
-import com.sun.tools.javac.comp.Attr;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Names;
-
-
-/**
- * The environment for a run of apt.
- */
-@SuppressWarnings("deprecation")
-public class AptEnv {
-
-    public Names names;                 // javac's name table
-    public Symtab symtab;               // javac's predefined symbols
-    public Types jctypes;               // javac's type utilities
-    public Enter enter;                 // javac's enter phase
-    public Attr attr;                   // javac's attr phase (to evaluate
-                                        //   constant initializers)
-    public TypeMaker typeMaker;         // apt's internal type utilities
-    public DeclarationMaker declMaker;  // apt's internal declaration utilities
-
-
-    private static final Context.Key<AptEnv> aptEnvKey =
-            new Context.Key<AptEnv>();
-
-    public static AptEnv instance(Context context) {
-        AptEnv instance = context.get(aptEnvKey);
-        if (instance == null) {
-            instance = new AptEnv(context);
-        }
-        return instance;
-    }
-
-    private AptEnv(Context context) {
-        context.put(aptEnvKey, this);
-
-        names = Names.instance(context);
-        symtab = Symtab.instance(context);
-        jctypes = Types.instance(context);
-        enter = Enter.instance(context);
-        attr = Attr.instance(context);
-        typeMaker = TypeMaker.instance(context);
-        declMaker = DeclarationMaker.instance(context);
-    }
-
-
-    /**
-     * Does a symbol have a given flag?  Forces symbol completion.
-     */
-    public static boolean hasFlag(Symbol sym, long flag) {
-        return (getFlags(sym) & flag) != 0;
-    }
-
-    /**
-     * Returns a symbol's flags.  Forces completion.
-     */
-    public static long getFlags(Symbol sym) {
-        complete(sym);
-        return sym.flags();
-    }
-
-    /**
-     * Completes a symbol, ignoring completion failures.
-     */
-    private static void complete(Symbol sym) {
-        while (true) {
-            try {
-                sym.complete();
-                return;
-            } catch (CompletionFailure e) {
-                // Should never see two in a row, but loop just to be sure.
-            }
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/apt/AnnotationProcessorEnvironmentImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.apt;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.*;
-import com.sun.mirror.apt.*;
-import com.sun.tools.apt.mirror.apt.*;
-import com.sun.tools.apt.mirror.declaration.DeclarationMaker;
-import com.sun.tools.apt.mirror.util.*;
-import com.sun.tools.apt.util.Bark;
-import com.sun.tools.javac.util.Context;
-
-import com.sun.tools.apt.mirror.apt.FilerImpl;
-import com.sun.tools.apt.mirror.apt.MessagerImpl;
-import com.sun.tools.apt.mirror.apt.RoundStateImpl;
-import com.sun.tools.apt.mirror.apt.RoundCompleteEventImpl;
-
-import com.sun.tools.javac.util.Context;
-
-import java.util.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Annotation Processor Environment implementation.
- */
-@SuppressWarnings("deprecation")
-public class AnnotationProcessorEnvironmentImpl implements AnnotationProcessorEnvironment {
-
-    Collection<TypeDeclaration> spectypedecls;
-    Collection<TypeDeclaration> typedecls;
-    Map<String, String> origOptions;
-    DeclarationMaker declMaker;
-    Declarations declUtils;
-    Types typeUtils;
-    Messager messager;
-    FilerImpl filer;
-    Bark bark;
-    Set<RoundCompleteListener> roundCompleteListeners;
-
-    public AnnotationProcessorEnvironmentImpl(Collection<TypeDeclaration> spectypedecls,
-                                              Collection<TypeDeclaration> typedecls,
-                                              Map<String, String> origOptions,
-                                              Context context) {
-        // Safer to copy collections before applying unmodifiable
-        // wrapper.
-        this.spectypedecls = Collections.unmodifiableCollection(spectypedecls);
-        this.typedecls = Collections.unmodifiableCollection(typedecls);
-        this.origOptions = Collections.unmodifiableMap(origOptions);
-
-        declMaker = DeclarationMaker.instance(context);
-        declUtils = DeclarationsImpl.instance(context);
-        typeUtils = TypesImpl.instance(context);
-        messager = MessagerImpl.instance(context);
-        filer = FilerImpl.instance(context);
-        bark = Bark.instance(context);
-        roundCompleteListeners = new LinkedHashSet<RoundCompleteListener>();
-    }
-
-    public Map<String,String> getOptions() {
-        return origOptions;
-    }
-
-    public Messager getMessager() {
-        return messager;
-    }
-
-    public Filer getFiler() {
-        return filer;
-    }
-
-    public Collection<TypeDeclaration> getSpecifiedTypeDeclarations() {
-        return spectypedecls;
-    }
-
-    public PackageDeclaration getPackage(String name) {
-        return declMaker.getPackageDeclaration(name);
-    }
-
-    public TypeDeclaration getTypeDeclaration(String name) {
-        return declMaker.getTypeDeclaration(name);
-    }
-
-    public Collection<TypeDeclaration> getTypeDeclarations() {
-        return typedecls;
-    }
-
-    public Collection<Declaration> getDeclarationsAnnotatedWith(
-                                                AnnotationTypeDeclaration a) {
-        /*
-         * create collection of Declarations annotated with a given
-         * annotation.
-         */
-
-        CollectingAP proc = new CollectingAP(this, a);
-        proc.process();
-        return proc.decls;
-    }
-
-    private static class CollectingAP implements AnnotationProcessor {
-        AnnotationProcessorEnvironment env;
-        Collection<Declaration> decls;
-        AnnotationTypeDeclaration atd;
-        CollectingAP(AnnotationProcessorEnvironment env,
-                     AnnotationTypeDeclaration atd) {
-            this.env = env;
-            this.atd = atd;
-            decls = new HashSet<Declaration>();
-        }
-
-        private class CollectingVisitor extends SimpleDeclarationVisitor {
-            public void visitDeclaration(Declaration d) {
-                for(AnnotationMirror am: d.getAnnotationMirrors()) {
-                    if (am.getAnnotationType().getDeclaration().equals(CollectingAP.this.atd))
-                        CollectingAP.this.decls.add(d);
-                }
-            }
-        }
-
-        public void process() {
-            for(TypeDeclaration d: env.getSpecifiedTypeDeclarations())
-                d.accept(getSourceOrderDeclarationScanner(new CollectingVisitor(),
-                                                          NO_OP));
-        }
-    }
-
-    public Declarations getDeclarationUtils() {
-        return declUtils;
-    }
-
-    public Types getTypeUtils() {
-        return typeUtils;
-    }
-
-    public void addListener(AnnotationProcessorListener listener) {
-        if (listener == null)
-            throw new NullPointerException();
-        else {
-            if (listener instanceof RoundCompleteListener)
-                roundCompleteListeners.add((RoundCompleteListener)listener);
-        }
-    }
-
-    public void removeListener(AnnotationProcessorListener listener) {
-        if (listener == null)
-            throw new NullPointerException();
-        else
-            roundCompleteListeners.remove(listener);
-    }
-
-    public void roundComplete() {
-        RoundState roundState  = new RoundStateImpl(bark.nerrors > 0,
-                                                    filer.getSourceFileNames().size() > 0,
-                                                    filer.getClassFileNames().size() > 0,
-                                                    origOptions);
-        RoundCompleteEvent roundCompleteEvent = new RoundCompleteEventImpl(this, roundState);
-
-        filer.roundOver();
-        for(RoundCompleteListener rcl: roundCompleteListeners)
-            rcl.roundComplete(roundCompleteEvent);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/apt/FilerImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.apt;
-
-
-import java.io.*;
-import java.util.Collection;
-import java.util.EnumMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.sun.mirror.apt.Filer;
-import com.sun.tools.apt.mirror.declaration.DeclarationMaker;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Options;
-import com.sun.tools.javac.util.Position;
-import com.sun.tools.apt.util.Bark;
-
-import static com.sun.mirror.apt.Filer.Location.*;
-
-
-/**
- * Implementation of Filer.
- */
-@SuppressWarnings("deprecation")
-public class FilerImpl implements Filer {
-    /*
-     * The Filer class must maintain a number of constraints.  First,
-     * multiple attempts to open the same path within the same
-     * invocation of apt results in an IOException being thrown.  For
-     * example, trying to open the same source file twice:
-     *
-     * createSourceFile("foo.Bar")
-     * ...
-     * createSourceFile("foo.Bar")
-     *
-     * is disallowed as is opening a text file that happens to have
-     * the same name as a source file:
-     *
-     * createSourceFile("foo.Bar")
-     * ...
-     * createTextFile(SOURCE_TREE, "foo", new File("Bar"), null)
-     *
-     * Additionally, creating a source file that corresponds to an
-     * already created class file (or vice versa) generates at least a
-     * warning.  This is an error if -XclassesAsDecls is being used
-     * since you can't create the same type twice.  However, if the
-     * Filer is used to create a text file named *.java that happens
-     * to correspond to an existing class file, a warning is *not*
-     * generated.  Similarly, a warning is not generated for a binary
-     * file named *.class and an existing source file.
-     *
-     * The reason for this difference is that source files and class
-     * files are registered with apt and can get passed on as
-     * declarations to the next round of processing.  Files that are
-     * just named *.java and *.class are not processed in that manner;
-     * although having extra source files and class files on the
-     * source path and class path can alter the behavior of the tool
-     * and any final compile.
-     */
-
-    private enum FileKind {
-        SOURCE {
-            void register(File file, String name, FilerImpl that) throws IOException {
-                // Check for corresponding class file
-                if (that.filesCreated.contains(new File(that.locations.get(CLASS_TREE),
-                                                        that.nameToPath(name, ".class")))) {
-
-                    that.bark.aptWarning("CorrespondingClassFile", name);
-                    if (that.opts.get("-XclassesAsDecls") != null)
-                        throw new IOException();
-                }
-                that.sourceFileNames.add(file.getPath());
-            }
-        },
-
-        CLASS  {
-            void register(File file, String name, FilerImpl that) throws IOException {
-                if (that.filesCreated.contains(new File(that.locations.get(SOURCE_TREE),
-                                                        that.nameToPath(name, ".java")))) {
-                    that.bark.aptWarning("CorrespondingSourceFile", name);
-                    if (that.opts.get("-XclassesAsDecls") != null)
-                        throw new IOException();
-                }
-                // Track the binary name instead of the filesystem location
-                that.classFileNames.add(name);
-            }
-        },
-
-        OTHER  {
-            // Nothing special to do
-            void register(File file, String name, FilerImpl that) throws IOException {}
-        };
-
-        abstract void register(File file, String name, FilerImpl that) throws IOException;
-    }
-
-    private final Options opts;
-    private final DeclarationMaker declMaker;
-    private final com.sun.tools.apt.main.AptJavaCompiler comp;
-
-    // Platform's default encoding
-    private final static String DEFAULT_ENCODING =
-            new OutputStreamWriter(new ByteArrayOutputStream()).getEncoding();
-
-    private String encoding;    // name of charset used for source files
-
-    private final EnumMap<Location, File> locations;    // where new files go
-
-
-    private static final Context.Key<FilerImpl> filerKey =
-            new Context.Key<FilerImpl>();
-
-    // Set of files opened.
-    private Collection<Flushable> wc;
-
-    private Bark bark;
-
-    // All created files.
-    private final Set<File> filesCreated;
-
-    // Names of newly created source files
-    private HashSet<String> sourceFileNames = new HashSet<String>();
-
-    // Names of newly created class files
-    private HashSet<String> classFileNames  = new HashSet<String>();
-
-    private boolean roundOver;
-
-    public static FilerImpl instance(Context context) {
-        FilerImpl instance = context.get(filerKey);
-        if (instance == null) {
-            instance = new FilerImpl(context);
-        }
-        return instance;
-    }
-
-    // flush all output streams;
-    public void flush() {
-        for(Flushable opendedFile: wc) {
-            try {
-                opendedFile.flush();
-                if (opendedFile instanceof FileOutputStream) {
-                    try {
-                        ((FileOutputStream) opendedFile).getFD().sync() ;
-                    } catch (java.io.SyncFailedException sfe) {}
-                }
-            } catch (IOException e) { }
-        }
-    }
-
-    private FilerImpl(Context context) {
-        context.put(filerKey, this);
-        opts = Options.instance(context);
-        declMaker = DeclarationMaker.instance(context);
-        bark = Bark.instance(context);
-        comp = com.sun.tools.apt.main.AptJavaCompiler.instance(context);
-        roundOver = false;
-        this.filesCreated = comp.getAggregateGenFiles();
-
-        // Encoding
-        encoding = opts.get("-encoding");
-        if (encoding == null) {
-            encoding = DEFAULT_ENCODING;
-        }
-
-        wc = new HashSet<Flushable>();
-
-        // Locations
-        locations = new EnumMap<Location, File>(Location.class);
-        String s = opts.get("-s");      // location for new source files
-        String d = opts.get("-d");      // location for new class files
-        locations.put(SOURCE_TREE, new File(s != null ? s : "."));
-        locations.put(CLASS_TREE,  new File(d != null ? d : "."));
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public PrintWriter createSourceFile(String name) throws IOException {
-        String pathname = nameToPath(name, ".java");
-        File file = new File(locations.get(SOURCE_TREE),
-                             pathname);
-        PrintWriter pw = getPrintWriter(file, encoding, name, FileKind.SOURCE);
-        return pw;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public OutputStream createClassFile(String name) throws IOException {
-        String pathname = nameToPath(name, ".class");
-        File file = new File(locations.get(CLASS_TREE),
-                             pathname);
-        OutputStream os = getOutputStream(file, name, FileKind.CLASS);
-        return os;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public PrintWriter createTextFile(Location loc,
-                                      String pkg,
-                                      File relPath,
-                                      String charsetName) throws IOException {
-        File file = (pkg.length() == 0)
-                        ? relPath
-                        : new File(nameToPath(pkg), relPath.getPath());
-        if (charsetName == null) {
-            charsetName = encoding;
-        }
-        return getPrintWriter(loc, file.getPath(), charsetName, null, FileKind.OTHER);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public OutputStream createBinaryFile(Location loc,
-                                         String pkg,
-                                         File relPath) throws IOException {
-        File file = (pkg.length() == 0)
-                        ? relPath
-                        : new File(nameToPath(pkg), relPath.getPath());
-        return getOutputStream(loc, file.getPath(), null, FileKind.OTHER);
-    }
-
-
-    /**
-     * Converts the canonical name of a top-level type or package to a
-     * pathname.  Suffix is ".java" or ".class" or "".
-     */
-    private String nameToPath(String name, String suffix) throws IOException {
-        if (!DeclarationMaker.isJavaIdentifier(name.replace('.', '_'))) {
-            bark.aptWarning("IllegalFileName", name);
-            throw new IOException();
-        }
-        return name.replace('.', File.separatorChar) + suffix;
-    }
-
-    private String nameToPath(String name) throws IOException {
-        return nameToPath(name, "");
-    }
-
-    /**
-     * Returns a writer for a text file given its location, its
-     * pathname relative to that location, and its encoding.
-     */
-    private PrintWriter getPrintWriter(Location loc, String pathname,
-                                       String encoding, String name, FileKind kind) throws IOException {
-        File file = new File(locations.get(loc), pathname);
-        return getPrintWriter(file, encoding, name, kind);
-    }
-
-    /**
-     * Returns a writer for a text file given its encoding.
-     */
-    private PrintWriter getPrintWriter(File file,
-                                       String encoding, String name, FileKind kind) throws IOException {
-        prepareFile(file, name, kind);
-        PrintWriter pw =
-            new PrintWriter(
-                    new BufferedWriter(
-                         new OutputStreamWriter(new FileOutputStream(file),
-                                                encoding)));
-        wc.add(pw);
-        return pw;
-    }
-
-    /**
-     * Returns an output stream for a binary file given its location
-     * and its pathname relative to that location.
-     */
-    private OutputStream getOutputStream(Location loc, String pathname, String name, FileKind kind)
-                                                        throws IOException {
-        File file = new File(locations.get(loc), pathname);
-        return getOutputStream(file, name, kind);
-    }
-
-    private OutputStream getOutputStream(File file, String name, FileKind kind) throws IOException {
-        prepareFile(file, name, kind);
-        OutputStream os = new FileOutputStream(file);
-        wc.add(os);
-        return os;
-
-    }
-
-    public Set<String> getSourceFileNames() {
-        return sourceFileNames;
-    }
-
-    public Set<String> getClassFileNames() {
-        return classFileNames;
-    }
-
-    public void roundOver() {
-        roundOver = true;
-    }
-
-    /**
-     * Checks that the file has not already been created during this
-     * invocation.  If not, creates intermediate directories, and
-     * deletes the file if it already exists.
-     */
-    private void prepareFile(File file, String name, FileKind kind) throws IOException {
-        if (roundOver) {
-            bark.aptWarning("NoNewFilesAfterRound", file.toString());
-            throw new IOException();
-        }
-
-        if (filesCreated.contains(file)) {
-            bark.aptWarning("FileReopening", file.toString());
-            throw new IOException();
-        } else {
-            if (file.exists()) {
-                file.delete();
-            } else {
-                File parent = file.getParentFile();
-                if (parent != null && !parent.exists()) {
-                    if(!parent.mkdirs()) {
-                        bark.aptWarning("BadParentDirectory", file.toString());
-                        throw new IOException();
-                    }
-                }
-            }
-
-            kind.register(file, name, this);
-            filesCreated.add(file);
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/apt/MessagerImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.apt;
-
-import javax.tools.JavaFileObject;
-import com.sun.mirror.apt.Messager;
-import com.sun.tools.apt.mirror.util.SourcePositionImpl;
-import com.sun.mirror.util.SourcePosition;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Position;
-import com.sun.tools.apt.util.Bark;
-
-
-/**
- * Implementation of Messager.
- */
-@SuppressWarnings("deprecation")
-public class MessagerImpl implements Messager {
-    private final Bark bark;
-
-    private static final Context.Key<MessagerImpl> messagerKey =
-            new Context.Key<MessagerImpl>();
-
-    public static MessagerImpl instance(Context context) {
-        MessagerImpl instance = context.get(messagerKey);
-        if (instance == null) {
-            instance = new MessagerImpl(context);
-        }
-        return instance;
-    }
-
-    private MessagerImpl(Context context) {
-        context.put(messagerKey, this);
-        bark = Bark.instance(context);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void printError(String msg) {
-        bark.aptError("Messager", msg);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void printError(SourcePosition pos, String msg) {
-        if (pos instanceof SourcePositionImpl) {
-            SourcePositionImpl posImpl = (SourcePositionImpl) pos;
-            JavaFileObject prev = bark.useSource(posImpl.getSource());
-            bark.aptError(posImpl.getJavacPosition(), "Messager", msg);
-            bark.useSource(prev);
-        } else
-            printError(msg);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void printWarning(String msg) {
-        bark.aptWarning("Messager", msg);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void printWarning(SourcePosition pos, String msg) {
-        if (pos instanceof SourcePositionImpl) {
-            SourcePositionImpl posImpl = (SourcePositionImpl) pos;
-            JavaFileObject prev = bark.useSource(posImpl.getSource());
-            bark.aptWarning(posImpl.getJavacPosition(), "Messager", msg);
-            bark.useSource(prev);
-        } else
-            printWarning(msg);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void printNotice(String msg) {
-        bark.aptNote("Messager", msg);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void printNotice(SourcePosition pos, String msg) {
-        if (pos instanceof SourcePositionImpl) {
-            SourcePositionImpl posImpl = (SourcePositionImpl) pos;
-            JavaFileObject prev = bark.useSource(posImpl.getSource());
-            bark.aptNote(posImpl.getJavacPosition(), "Messager", msg);
-            bark.useSource(prev);
-        } else
-            printNotice(msg);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/apt/RoundCompleteEventImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.apt;
-
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.RoundCompleteEvent;
-import com.sun.mirror.apt.RoundState;
-
-@SuppressWarnings("deprecation")
-public class RoundCompleteEventImpl extends RoundCompleteEvent {
-    private static final long serialVersionUID = 7067621446720784300L;
-
-    public RoundCompleteEventImpl(AnnotationProcessorEnvironment source,
-                                  RoundState rs) {
-        super(source, rs);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/apt/RoundStateImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.apt;
-
-import com.sun.mirror.apt.RoundState;
-import java.util.Map;
-
-@SuppressWarnings("deprecation")
-public class RoundStateImpl implements RoundState {
-    private final boolean finalRound;
-    private final boolean errorRaised;
-    private final boolean sourceFilesCreated;
-    private final boolean classFilesCreated;
-
-    public RoundStateImpl(boolean errorRaised,
-                          boolean sourceFilesCreated,
-                          boolean classFilesCreated,
-                          Map<String,String> options) {
-        /*
-         * In the default mode of operation, this round is the final
-         * round if an error was raised OR there were no new source
-         * files generated.  If classes are being treated as
-         * declarations, this is the final round if an error was
-         * raised OR neither new source files nor new class files were
-         * generated.
-         */
-        this.finalRound =
-            errorRaised ||
-            (!sourceFilesCreated &&
-            !(classFilesCreated && options.keySet().contains("-XclassesAsDecls")) );
-        this.errorRaised = errorRaised;
-        this.sourceFilesCreated = sourceFilesCreated;
-        this.classFilesCreated = classFilesCreated;
-    }
-
-    public boolean finalRound() {
-        return finalRound;
-    }
-
-    public boolean errorRaised() {
-        return errorRaised;
-    }
-
-    public boolean sourceFilesCreated() {
-        return sourceFilesCreated;
-    }
-
-    public boolean classFilesCreated() {
-        return classFilesCreated;
-    }
-
-    public String toString() {
-        return
-            "[final round: " +  finalRound +
-            ", error raised: " +  errorRaised +
-            ", source files created: " + sourceFilesCreated +
-            ", class files created: " + classFilesCreated + "]";
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationMirrorImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.AnnotationType;
-import com.sun.mirror.util.SourcePosition;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Pair;
-
-
-/**
- * Implementation of AnnotationMirror
- */
-@SuppressWarnings("deprecation")
-public class AnnotationMirrorImpl implements AnnotationMirror {
-
-    protected final AptEnv env;
-    protected final Attribute.Compound anno;
-    protected final Declaration decl;
-
-
-    AnnotationMirrorImpl(AptEnv env, Attribute.Compound anno, Declaration decl) {
-        this.env = env;
-        this.anno = anno;
-        this.decl = decl;
-    }
-
-
-    /**
-     * Returns a string representation of this annotation.
-     * String is of one of the forms:
-     *     @com.example.foo(name1=val1, name2=val2)
-     *     @com.example.foo(val)
-     *     @com.example.foo
-     * Omit parens for marker annotations, and omit "value=" when allowed.
-     */
-    public String toString() {
-        StringBuilder sb = new StringBuilder("@");
-        Constants.Formatter fmtr = Constants.getFormatter(sb);
-
-        fmtr.append(anno.type.tsym);
-
-        int len = anno.values.length();
-        if (len > 0) {          // omit parens for marker annotations
-            sb.append('(');
-            boolean first = true;
-            for (Pair<MethodSymbol, Attribute> val : anno.values) {
-                if (!first) {
-                    sb.append(", ");
-                }
-                first = false;
-
-                Name name = val.fst.name;
-                if (len > 1 || name != env.names.value) {
-                    fmtr.append(name);
-                    sb.append('=');
-                }
-                sb.append(new AnnotationValueImpl(env, val.snd, this));
-            }
-            sb.append(')');
-        }
-        return fmtr.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public AnnotationType getAnnotationType() {
-        return (AnnotationType) env.typeMaker.getType(anno.type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Map<AnnotationTypeElementDeclaration, AnnotationValue>
-                                                        getElementValues() {
-        Map<AnnotationTypeElementDeclaration, AnnotationValue> res =
-            new LinkedHashMap<AnnotationTypeElementDeclaration,
-                                                   AnnotationValue>(); // whew!
-        for (Pair<MethodSymbol, Attribute> val : anno.values) {
-            res.put(getElement(val.fst),
-                    new AnnotationValueImpl(env, val.snd, this));
-        }
-        return res;
-    }
-
-    public SourcePosition getPosition() {
-        // Return position of the declaration on which this annotation
-        // appears.
-        return (decl == null) ? null : decl.getPosition();
-
-    }
-
-    public Declaration getDeclaration() {
-        return this.decl;
-    }
-
-    /**
-     * Returns the annotation type element for a symbol.
-     */
-    private AnnotationTypeElementDeclaration getElement(MethodSymbol m) {
-        return (AnnotationTypeElementDeclaration)
-                    env.declMaker.getExecutableDeclaration(m);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,355 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.lang.annotation.*;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.*;
-import sun.reflect.annotation.*;
-
-import com.sun.mirror.type.TypeMirror;
-import com.sun.mirror.type.MirroredTypeException;
-import com.sun.mirror.type.MirroredTypesException;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Pair;
-
-
-/**
- * A generator of dynamic proxy implementations of
- * java.lang.annotation.Annotation.
- *
- * <p> The "dynamic proxy return form" of an attribute element value is
- * the form used by sun.reflect.annotation.AnnotationInvocationHandler.
- */
-@SuppressWarnings("deprecation")
-class AnnotationProxyMaker {
-
-    private final AptEnv env;
-    private final Attribute.Compound attrs;
-    private final Class<? extends Annotation> annoType;
-
-
-    private AnnotationProxyMaker(AptEnv env,
-                                 Attribute.Compound attrs,
-                                 Class<? extends Annotation> annoType) {
-        this.env = env;
-        this.attrs = attrs;
-        this.annoType = annoType;
-    }
-
-
-    /**
-     * Returns a dynamic proxy for an annotation mirror.
-     */
-    public static <A extends Annotation> A generateAnnotation(
-            AptEnv env, Attribute.Compound attrs, Class<A> annoType) {
-        AnnotationProxyMaker apm = new AnnotationProxyMaker(env, attrs, annoType);
-        return annoType.cast(apm.generateAnnotation());
-    }
-
-
-    /**
-     * Returns a dynamic proxy for an annotation mirror.
-     */
-    private Annotation generateAnnotation() {
-        return AnnotationParser.annotationForMap(annoType,
-                                                 getAllReflectedValues());
-    }
-
-    /**
-     * Returns a map from element names to their values in "dynamic
-     * proxy return form".  Includes all elements, whether explicit or
-     * defaulted.
-     */
-    private Map<String, Object> getAllReflectedValues() {
-        Map<String, Object> res = new LinkedHashMap<String, Object>();
-
-        for (Map.Entry<MethodSymbol, Attribute> entry :
-                                                  getAllValues().entrySet()) {
-            MethodSymbol meth = entry.getKey();
-            Object value = generateValue(meth, entry.getValue());
-            if (value != null) {
-                res.put(meth.name.toString(), value);
-            } else {
-                // Ignore this element.  May lead to
-                // IncompleteAnnotationException somewhere down the line.
-            }
-        }
-        return res;
-    }
-
-    /**
-     * Returns a map from element symbols to their values.
-     * Includes all elements, whether explicit or defaulted.
-     */
-    private Map<MethodSymbol, Attribute> getAllValues() {
-        Map<MethodSymbol, Attribute> res =
-            new LinkedHashMap<MethodSymbol, Attribute>();
-
-        // First find the default values.
-        ClassSymbol sym = (ClassSymbol) attrs.type.tsym;
-        for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
-            if (e.sym.kind == Kinds.MTH) {
-                MethodSymbol m = (MethodSymbol) e.sym;
-                Attribute def = m.defaultValue;
-                if (def != null) {
-                    res.put(m, def);
-                }
-            }
-        }
-        // Next find the explicit values, possibly overriding defaults.
-        for (Pair<MethodSymbol, Attribute> p : attrs.values) {
-            res.put(p.fst, p.snd);
-        }
-        return res;
-    }
-
-    /**
-     * Converts an element value to its "dynamic proxy return form".
-     * Returns an exception proxy on some errors, but may return null if
-     * a useful exception cannot or should not be generated at this point.
-     */
-    private Object generateValue(MethodSymbol meth, Attribute attr) {
-        ValueVisitor vv = new ValueVisitor(meth);
-        return vv.getValue(attr);
-    }
-
-
-    private class ValueVisitor implements Attribute.Visitor {
-
-        private MethodSymbol meth;      // annotation element being visited
-        private Class<?> runtimeType;   // runtime type of annotation element
-        private Object value;           // value in "dynamic proxy return form"
-
-        ValueVisitor(MethodSymbol meth) {
-            this.meth = meth;
-        }
-
-        Object getValue(Attribute attr) {
-            Method method;              // runtime method of annotation element
-            try {
-                method = annoType.getMethod(meth.name.toString());
-            } catch (NoSuchMethodException e) {
-                return null;
-            }
-            runtimeType = method.getReturnType();
-            attr.accept(this);
-            if (!(value instanceof ExceptionProxy) &&
-                !AnnotationType.invocationHandlerReturnType(runtimeType)
-                                                        .isInstance(value)) {
-                typeMismatch(method, attr);
-            }
-            return value;
-        }
-
-
-        public void visitConstant(Attribute.Constant c) {
-            value = Constants.decodeConstant(c.value, c.type);
-        }
-
-        public void visitClass(Attribute.Class c) {
-            value = new MirroredTypeExceptionProxy(
-                                env.typeMaker.getType(c.type));
-        }
-
-        public void visitArray(Attribute.Array a) {
-            Type elemtype = env.jctypes.elemtype(a.type);
-
-            if (elemtype.tsym == env.symtab.classType.tsym) {   // Class[]
-                // Construct a proxy for a MirroredTypesException
-                ArrayList<TypeMirror> elems = new ArrayList<TypeMirror>();
-                for (int i = 0; i < a.values.length; i++) {
-                    Type elem = ((Attribute.Class) a.values[i]).type;
-                    elems.add(env.typeMaker.getType(elem));
-                }
-                value = new MirroredTypesExceptionProxy(elems);
-
-            } else {
-                int len = a.values.length;
-                Class<?> runtimeTypeSaved = runtimeType;
-                runtimeType = runtimeType.getComponentType();
-                try {
-                    Object res = Array.newInstance(runtimeType, len);
-                    for (int i = 0; i < len; i++) {
-                        a.values[i].accept(this);
-                        if (value == null || value instanceof ExceptionProxy) {
-                            return;
-                        }
-                        try {
-                            Array.set(res, i, value);
-                        } catch (IllegalArgumentException e) {
-                            value = null;       // indicates a type mismatch
-                            return;
-                        }
-                    }
-                    value = res;
-                } finally {
-                    runtimeType = runtimeTypeSaved;
-                }
-            }
-        }
-
-        @SuppressWarnings({"unchecked", "rawtypes"})
-        public void visitEnum(Attribute.Enum e) {
-            if (runtimeType.isEnum()) {
-                String constName = e.value.toString();
-                try {
-                    value = Enum.valueOf((Class)runtimeType, constName);
-                } catch (IllegalArgumentException ex) {
-                    value = new EnumConstantNotPresentExceptionProxy(
-                                                        (Class<Enum<?>>)runtimeType, constName);
-                }
-            } else {
-                value = null;   // indicates a type mismatch
-            }
-        }
-
-        public void visitCompound(Attribute.Compound c) {
-            try {
-                Class<? extends Annotation> nested =
-                    runtimeType.asSubclass(Annotation.class);
-                value = generateAnnotation(env, c, nested);
-            } catch (ClassCastException ex) {
-                value = null;   // indicates a type mismatch
-            }
-        }
-
-        public void visitError(Attribute.Error e) {
-            value = null;       // indicates a type mismatch
-        }
-
-
-        /**
-         * Sets "value" to an ExceptionProxy indicating a type mismatch.
-         */
-        private void typeMismatch(Method method, final Attribute attr) {
-            class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
-                private static final long serialVersionUID = 8473323277815075163L;
-                transient final Method method;
-                AnnotationTypeMismatchExceptionProxy(Method method) {
-                    this.method = method;
-                }
-                public String toString() {
-                    return "<error>";   // eg:  @Anno(value=<error>)
-                }
-                protected RuntimeException generateException() {
-                    return new AnnotationTypeMismatchException(method,
-                                attr.type.toString());
-                }
-            }
-            value = new AnnotationTypeMismatchExceptionProxy(method);
-        }
-    }
-
-
-    /**
-     * ExceptionProxy for MirroredTypeException.
-     * The toString, hashCode, and equals methods foward to the underlying
-     * type.
-     */
-    private static final class MirroredTypeExceptionProxy extends ExceptionProxy {
-        private static final long serialVersionUID = 6662035281599933545L;
-
-        private MirroredTypeException ex;
-
-        MirroredTypeExceptionProxy(TypeMirror t) {
-            // It would be safer if we could construct the exception in
-            // generateException(), but there would be no way to do
-            // that properly following deserialization.
-            ex = new MirroredTypeException(t);
-        }
-
-        public String toString() {
-            return ex.getQualifiedName();
-        }
-
-        public int hashCode() {
-            TypeMirror t = ex.getTypeMirror();
-            return (t != null)
-                    ? t.hashCode()
-                    : ex.getQualifiedName().hashCode();
-        }
-
-        public boolean equals(Object obj) {
-            TypeMirror t = ex.getTypeMirror();
-            return t != null &&
-                   obj instanceof MirroredTypeExceptionProxy &&
-                   t.equals(
-                        ((MirroredTypeExceptionProxy) obj).ex.getTypeMirror());
-        }
-
-        protected RuntimeException generateException() {
-            return (RuntimeException) ex.fillInStackTrace();
-        }
-    }
-
-
-    /**
-     * ExceptionProxy for MirroredTypesException.
-     * The toString, hashCode, and equals methods foward to the underlying
-     * types.
-     */
-    private static final class MirroredTypesExceptionProxy extends ExceptionProxy {
-        private static final long serialVersionUID = -6670822532616693951L;
-
-        private MirroredTypesException ex;
-
-        MirroredTypesExceptionProxy(Collection<TypeMirror> ts) {
-            // It would be safer if we could construct the exception in
-            // generateException(), but there would be no way to do
-            // that properly following deserialization.
-            ex = new MirroredTypesException(ts);
-        }
-
-        public String toString() {
-            return ex.getQualifiedNames().toString();
-        }
-
-        public int hashCode() {
-            Collection<TypeMirror> ts = ex.getTypeMirrors();
-            return (ts != null)
-                    ? ts.hashCode()
-                    : ex.getQualifiedNames().hashCode();
-        }
-
-        public boolean equals(Object obj) {
-            Collection<TypeMirror> ts = ex.getTypeMirrors();
-            return ts != null &&
-                   obj instanceof MirroredTypesExceptionProxy &&
-                   ts.equals(
-                      ((MirroredTypesExceptionProxy) obj).ex.getTypeMirrors());
-        }
-
-        protected RuntimeException generateException() {
-            return (RuntimeException) ex.fillInStackTrace();
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationTypeDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of AnnotationTypeDeclaration
- */
-@SuppressWarnings("deprecation")
-public class AnnotationTypeDeclarationImpl extends InterfaceDeclarationImpl
-                                           implements AnnotationTypeDeclaration
-{
-    AnnotationTypeDeclarationImpl(AptEnv env, ClassSymbol sym) {
-        super(env, sym);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<AnnotationTypeElementDeclaration> getMethods() {
-        return identityFilter.filter(super.getMethods(),
-                                     AnnotationTypeElementDeclaration.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitAnnotationTypeDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationTypeElementDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-
-
-/**
- * Implementation of AnnotationTypeElementDeclaration
- */
-@SuppressWarnings("deprecation")
-public class AnnotationTypeElementDeclarationImpl extends MethodDeclarationImpl
-                                  implements AnnotationTypeElementDeclaration {
-
-    AnnotationTypeElementDeclarationImpl(AptEnv env, MethodSymbol sym) {
-        super(env, sym);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public AnnotationTypeDeclaration getDeclaringType() {
-        return (AnnotationTypeDeclaration) super.getDeclaringType();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public AnnotationValue getDefaultValue() {
-        return (sym.defaultValue == null)
-               ? null
-               : new AnnotationValueImpl(env, sym.defaultValue, null);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitAnnotationTypeElementDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationValueImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.SourcePosition;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.TypeTags;
-
-
-/**
- * Implementation of AnnotationValue
- */
-@SuppressWarnings("deprecation")
-public class AnnotationValueImpl implements AnnotationValue {
-
-    protected final AptEnv env;
-    protected final Attribute attr;
-    protected final AnnotationMirrorImpl annotation;
-
-    AnnotationValueImpl(AptEnv env, Attribute attr, AnnotationMirrorImpl annotation) {
-        this.env = env;
-        this.attr = attr;
-        this.annotation = annotation;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        Constants.Formatter fmtr = Constants.getFormatter(sb);
-
-        fmtr.append(getValue());
-        return fmtr.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Object getValue() {
-        ValueVisitor vv = new ValueVisitor();
-        attr.accept(vv);
-        return vv.value;
-    }
-
-
-    public SourcePosition getPosition() {
-        // Imprecise implementation; just return position of enclosing
-        // annotation.
-        return (annotation == null) ? null : annotation.getPosition();
-    }
-
-    private class ValueVisitor implements Attribute.Visitor {
-
-        public Object value;
-
-        public void visitConstant(Attribute.Constant c) {
-            value = Constants.decodeConstant(c.value, c.type);
-        }
-
-        public void visitClass(Attribute.Class c) {
-            value = env.typeMaker.getType(
-                        env.jctypes.erasure(c.type));
-        }
-
-        public void visitEnum(Attribute.Enum e) {
-            value = env.declMaker.getFieldDeclaration(e.value);
-        }
-
-        public void visitCompound(Attribute.Compound c) {
-            value = new AnnotationMirrorImpl(env, c,
-                                             (annotation == null) ?
-                                             null :
-                                             annotation.getDeclaration());
-        }
-
-        public void visitArray(Attribute.Array a) {
-            ArrayList<AnnotationValue> vals =
-                new ArrayList<AnnotationValue>(a.values.length);
-            for (Attribute elem : a.values) {
-                vals.add(new AnnotationValueImpl(env, elem, annotation));
-            }
-            value = vals;
-        }
-
-        public void visitError(Attribute.Error e) {
-            value = "<error>";  // javac will already have logged an error msg
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/ClassDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Inherited;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.ClassType;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of ClassDeclaration
- */
-@SuppressWarnings("deprecation")
-public class ClassDeclarationImpl extends TypeDeclarationImpl
-                                  implements ClassDeclaration {
-
-    ClassDeclarationImpl(AptEnv env, ClassSymbol sym) {
-        super(env, sym);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * Overridden here to handle @Inherited.
-     */
-    public <A extends Annotation> A getAnnotation(Class<A> annoType) {
-
-        boolean inherited = annoType.isAnnotationPresent(Inherited.class);
-        for (Type t = sym.type;
-             t.tsym != env.symtab.objectType.tsym && !t.isErroneous();
-             t = env.jctypes.supertype(t)) {
-
-            A result = getAnnotation(annoType, t.tsym);
-            if (result != null || !inherited) {
-                return result;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public ClassType getSuperclass() {
-        //  java.lang.Object has no superclass
-        if (sym == env.symtab.objectType.tsym) {
-            return null;
-        }
-        Type t = env.jctypes.supertype(sym.type);
-        return (ClassType) env.typeMaker.getType(t);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<ConstructorDeclaration> getConstructors() {
-        ArrayList<ConstructorDeclaration> res =
-            new ArrayList<ConstructorDeclaration>();
-        for (Symbol s : getMembers(true)) {
-            if (s.isConstructor()) {
-                MethodSymbol m = (MethodSymbol) s;
-                res.add((ConstructorDeclaration)
-                        env.declMaker.getExecutableDeclaration(m));
-            }
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<MethodDeclaration> getMethods() {
-        return identityFilter.filter(super.getMethods(),
-                                     MethodDeclaration.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitClassDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/Constants.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.TypeMirror;
-import com.sun.tools.apt.mirror.type.TypeMirrorImpl;
-import com.sun.tools.javac.code.Type;
-
-import static com.sun.tools.javac.code.TypeTags.*;
-
-
-/**
- * Utility class for operating on constant expressions.
- */
-@SuppressWarnings("deprecation")
-class Constants {
-
-    /**
-     * Converts a constant in javac's internal representation (in which
-     * boolean, char, byte, short, and int are each represented by an Integer)
-     * into standard representation.  Other values (including null) are
-     * returned unchanged.
-     */
-    static Object decodeConstant(Object value, Type type) {
-        if (value instanceof Integer) {
-            int i = ((Integer) value).intValue();
-            switch (type.tag) {
-            case BOOLEAN:  return Boolean.valueOf(i != 0);
-            case CHAR:     return Character.valueOf((char) i);
-            case BYTE:     return Byte.valueOf((byte) i);
-            case SHORT:    return Short.valueOf((short) i);
-            }
-        }
-        return value;
-    }
-
-    /**
-     * Returns a formatter for generating the text of constant
-     * expressions.  Equivalent to
-     * <tt>getFormatter(new StringBuilder())</tt>.
-     */
-    static Formatter getFormatter() {
-        return new Formatter(new StringBuilder());
-    }
-
-    /**
-     * Returns a formatter for generating the text of constant
-     * expressions.  Also generates the text of constant
-     * "pseudo-expressions" for annotations and array-valued
-     * annotation elements.
-     *
-     * @param buf  where the expression is written
-     */
-    static Formatter getFormatter(StringBuilder buf) {
-        return new Formatter(buf);
-    }
-
-
-    /**
-     * Utility class used to generate the text of constant
-     * expressions.  Also generates the text of constant
-     * "pseudo-expressions" for annotations and array-valued
-     * annotation elements.
-     */
-    static class Formatter {
-
-        private StringBuilder buf;      // where the output goes
-
-        private Formatter(StringBuilder buf) {
-            this.buf = buf;
-        }
-
-
-        public String toString() {
-            return buf.toString();
-        }
-
-        /**
-         * Appends a constant whose type is not statically known
-         * by dispatching to the appropriate overloaded append method.
-         */
-        void append(Object val) {
-            if (val instanceof String) {
-                append((String) val);
-            } else if (val instanceof Character) {
-                append((Character) val);
-            } else if (val instanceof Boolean) {
-                append((Boolean) val);
-            } else if (val instanceof Byte) {
-                append((Byte) val);
-            } else if (val instanceof Short) {
-                append((Short) val);
-            } else if (val instanceof Integer) {
-                append((Integer) val);
-            } else if (val instanceof Long) {
-                append((Long) val);
-            } else if (val instanceof Float) {
-                append((Float) val);
-            } else if (val instanceof Double) {
-                append((Double) val);
-            } else if (val instanceof TypeMirror) {
-                append((TypeMirrorImpl) val);
-            } else if (val instanceof EnumConstantDeclaration) {
-                append((EnumConstantDeclarationImpl) val);
-            } else if (val instanceof AnnotationMirror) {
-                append((AnnotationMirrorImpl) val);
-            } else if (val instanceof Collection<?>) {
-                append((Collection<?>) val);
-            } else {
-                appendUnquoted(val.toString());
-            }
-        }
-
-        /**
-         * Appends a string, escaped (as needed) and quoted.
-         */
-        void append(String val) {
-            buf.append('"');
-            appendUnquoted(val);
-            buf.append('"');
-        }
-
-        /**
-         * Appends a Character, escaped (as needed) and quoted.
-         */
-        void append(Character val) {
-            buf.append('\'');
-            appendUnquoted(val.charValue());
-            buf.append('\'');
-        }
-
-        void append(Boolean val) {
-            buf.append(val);
-        }
-
-        void append(Byte val) {
-            buf.append(String.format("0x%02x", val));
-        }
-
-        void append(Short val) {
-            buf.append(val);
-        }
-
-        void append(Integer val) {
-            buf.append(val);
-        }
-
-        void append(Long val) {
-            buf.append(val).append('L');
-        }
-
-        void append(Float val) {
-            if (val.isNaN()) {
-                buf.append("0.0f/0.0f");
-            } else if (val.isInfinite()) {
-                if (val.floatValue() < 0) {
-                    buf.append('-');
-                }
-                buf.append("1.0f/0.0f");
-            } else {
-                buf.append(val).append('f');
-            }
-        }
-
-        void append(Double val) {
-            if (val.isNaN()) {
-                buf.append("0.0/0.0");
-            } else if (val.isInfinite()) {
-                if (val.doubleValue() < 0) {
-                    buf.append('-');
-                }
-                buf.append("1.0/0.0");
-            } else {
-                buf.append(val);
-            }
-        }
-
-        /**
-         * Appends the class literal corresponding to a type.  Should
-         * only be invoked for types that have an associated literal.
-         * e.g:  "java.lang.String.class"
-         *       "boolean.class"
-         *       "int[].class"
-         */
-        void append(TypeMirrorImpl t) {
-            appendUnquoted(t.type.toString());
-            buf.append(".class");
-        }
-
-        /**
-         * Appends the fully qualified name of an enum constant.
-         * e.g:  "java.math.RoundingMode.UP"
-         */
-        void append(EnumConstantDeclarationImpl e) {
-            appendUnquoted(e.sym.enclClass() + "." + e);
-        }
-
-        /**
-         * Appends the text of an annotation pseudo-expression.
-         * e.g:  "@pkg.Format(linesep='\n')"
-         */
-        void append(AnnotationMirrorImpl anno) {
-            appendUnquoted(anno.toString());
-        }
-
-        /**
-         * Appends the elements of a collection, enclosed within braces
-         * and separated by ", ".  Useful for array-valued annotation
-         * elements.
-         */
-        void append(Collection<?> vals) {
-            buf.append('{');
-            boolean first = true;
-            for (Object val : vals) {
-                if (first) {
-                    first = false;
-                } else {
-                    buf.append(", ");
-                }
-                append(((AnnotationValue) val).getValue());
-            }
-            buf.append('}');
-        }
-
-
-        /**
-         * For each char of a string, append using appendUnquoted(char).
-         */
-        private void appendUnquoted(String s) {
-            for (char c : s.toCharArray()) {
-                appendUnquoted(c);
-            }
-        }
-
-        /**
-         * Appends a char (unquoted), using escapes for those that are not
-         * printable ASCII.  We don't know what is actually printable in
-         * the locale in which this result will be used, so ASCII is our
-         * best guess as to the least common denominator.
-         */
-        private void appendUnquoted(char c) {
-            switch (c) {
-            case '\b': buf.append("\\b");  break;
-            case '\t': buf.append("\\t");  break;
-            case '\n': buf.append("\\n");  break;
-            case '\f': buf.append("\\f");  break;
-            case '\r': buf.append("\\r");  break;
-            case '\"': buf.append("\\\""); break;
-            case '\'': buf.append("\\\'"); break;
-            case '\\': buf.append("\\\\"); break;
-            default:
-                if (isPrintableAscii(c)) {
-                    buf.append(c);
-                } else {
-                    buf.append(String.format("\\u%04x", (int) c));
-                }
-            }
-        }
-
-        /**
-         * Is c a printable ASCII character?
-         */
-        private static boolean isPrintableAscii(char c) {
-            return c >= ' ' && c <= '~';
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/ConstructorDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-
-
-/**
- * Implementation of ConstructorDeclaration
- */
-@SuppressWarnings("deprecation")
-public class ConstructorDeclarationImpl extends ExecutableDeclarationImpl
-                                        implements ConstructorDeclaration {
-
-    ConstructorDeclarationImpl(AptEnv env, MethodSymbol sym) {
-        super(env, sym);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * Returns the simple name of the declaring class.
-     */
-    public String getSimpleName() {
-        return sym.enclClass().name.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitConstructorDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.Collection;
-import java.util.EnumSet;
-import javax.tools.JavaFileObject;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.*;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.apt.mirror.util.SourcePositionImpl;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.AttrContext;
-import com.sun.tools.javac.comp.Env;
-import com.sun.tools.javac.tree.*;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Position;
-
-import static com.sun.mirror.declaration.Modifier.*;
-import static com.sun.tools.javac.code.Kinds.*;
-
-
-/**
- * Implementation of Declaration
- */
-@SuppressWarnings("deprecation")
-public abstract class DeclarationImpl implements Declaration {
-
-    protected final AptEnv env;
-    public final Symbol sym;
-
-    protected static final DeclarationFilter identityFilter =
-            new DeclarationFilter();
-
-
-    /**
-     * "sym" should be completed before this constructor is called.
-     */
-    protected DeclarationImpl(AptEnv env, Symbol sym) {
-        this.env = env;
-        this.sym = sym;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * <p> ParameterDeclarationImpl overrides this implementation.
-     */
-    public boolean equals(Object obj) {
-        if (obj instanceof DeclarationImpl) {
-            DeclarationImpl that = (DeclarationImpl) obj;
-            return sym == that.sym && env == that.env;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p> ParameterDeclarationImpl overrides this implementation.
-     */
-    public int hashCode() {
-        return sym.hashCode() + env.hashCode();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getDocComment() {
-        // Our doc comment is contained in a map in our toplevel,
-        // indexed by our tree.  Find our enter environment, which gives
-        // us our toplevel.  It also gives us a tree that contains our
-        // tree:  walk it to find our tree.  This is painful.
-        Env<AttrContext> enterEnv = getEnterEnv();
-        if (enterEnv == null)
-            return null;
-        JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
-        return enterEnv.toplevel.docComments.get(tree);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<AnnotationMirror> getAnnotationMirrors() {
-        Collection<AnnotationMirror> res =
-            new ArrayList<AnnotationMirror>();
-        for (Attribute.Compound a : sym.getAnnotationMirrors()) {
-            res.add(env.declMaker.getAnnotationMirror(a, this));
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     * Overridden by ClassDeclarationImpl to handle @Inherited.
-     */
-    public <A extends Annotation> A getAnnotation(Class<A> annoType) {
-        return getAnnotation(annoType, sym);
-    }
-
-    protected <A extends Annotation> A getAnnotation(Class<A> annoType,
-                                                     Symbol annotated) {
-        if (!annoType.isAnnotation()) {
-            throw new IllegalArgumentException(
-                                "Not an annotation type: " + annoType);
-        }
-        String name = annoType.getName();
-        for (Attribute.Compound attr : annotated.getAnnotationMirrors()) {
-            if (name.equals(attr.type.tsym.flatName().toString())) {
-                return AnnotationProxyMaker.generateAnnotation(env, attr,
-                                                               annoType);
-            }
-        }
-        return null;
-    }
-
-    // Cache for modifiers.
-    private EnumSet<Modifier> modifiers = null;
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<Modifier> getModifiers() {
-        if (modifiers == null) {
-            modifiers = EnumSet.noneOf(Modifier.class);
-            long flags = AptEnv.getFlags(sym);
-
-            if (0 != (flags & Flags.PUBLIC))       modifiers.add(PUBLIC);
-            if (0 != (flags & Flags.PROTECTED))    modifiers.add(PROTECTED);
-            if (0 != (flags & Flags.PRIVATE))      modifiers.add(PRIVATE);
-            if (0 != (flags & Flags.ABSTRACT))     modifiers.add(ABSTRACT);
-            if (0 != (flags & Flags.STATIC))       modifiers.add(STATIC);
-            if (0 != (flags & Flags.FINAL))        modifiers.add(FINAL);
-            if (0 != (flags & Flags.TRANSIENT))    modifiers.add(TRANSIENT);
-            if (0 != (flags & Flags.VOLATILE))     modifiers.add(VOLATILE);
-            if (0 != (flags & Flags.SYNCHRONIZED)) modifiers.add(SYNCHRONIZED);
-            if (0 != (flags & Flags.NATIVE))       modifiers.add(NATIVE);
-            if (0 != (flags & Flags.STRICTFP))     modifiers.add(STRICTFP);
-        }
-        return modifiers;
-    }
-
-    /**
-     * {@inheritDoc}
-     * Overridden in some subclasses.
-     */
-    public String getSimpleName() {
-        return sym.name.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public SourcePosition getPosition() {
-        // Find the toplevel.  From there use a tree-walking utility
-        // that finds the tree for our symbol, and with it the position.
-        Env<AttrContext> enterEnv = getEnterEnv();
-        if (enterEnv == null)
-            return null;
-        JCTree.JCCompilationUnit toplevel = enterEnv.toplevel;
-        JavaFileObject sourcefile = toplevel.sourcefile;
-        if (sourcefile == null)
-            return null;
-        int pos = TreeInfo.positionFor(sym, toplevel);
-
-        return new SourcePositionImpl(sourcefile, pos, toplevel.lineMap);
-    }
-
-    /**
-     * Applies a visitor to this declaration.
-     *
-     * @param v the visitor operating on this declaration
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitDeclaration(this);
-    }
-
-
-    private Collection<Symbol> members = null;  // cache for getMembers()
-
-    /**
-     * Returns the symbols of type or package members (and constructors)
-     * that are not synthetic or otherwise unwanted.
-     * Caches the result if "cache" is true.
-     */
-    protected Collection<Symbol> getMembers(boolean cache) {
-        if (members != null) {
-            return members;
-        }
-        LinkedList<Symbol> res = new LinkedList<Symbol>();
-        for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null && !unwanted(e.sym)) {
-                res.addFirst(e.sym);
-            }
-        }
-        return cache ? (members = res) : res;
-    }
-
-    /**
-     * Tests whether this is a symbol that should never be seen by clients,
-     * such as a synthetic class.
-     * Note that a class synthesized by the compiler may not be flagged as
-     * synthetic:  see bugid 4959932.
-     */
-    private static boolean unwanted(Symbol s) {
-        return AptEnv.hasFlag(s, Flags.SYNTHETIC) ||
-               (s.kind == TYP &&
-                !DeclarationMaker.isJavaIdentifier(s.name.toString()));
-    }
-
-    /**
-     * Returns this declaration's enter environment, or null if it
-     * has none.
-     */
-    private Env<AttrContext> getEnterEnv() {
-        // Get enclosing class of sym, or sym itself if it is a class
-        // or package.
-        TypeSymbol ts = (sym.kind != PCK)
-                        ? sym.enclClass()
-                        : (PackageSymbol) sym;
-        return (ts != null)
-                ? env.enter.getEnv(ts)
-                : null;
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/DeclarationMaker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.sun.mirror.declaration.*;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.main.JavaCompiler;
-
-/**
- * Utilities for constructing and caching declarations.
- */
-@SuppressWarnings("deprecation")
-public class DeclarationMaker {
-
-    private AptEnv env;
-    private Context context;
-    private JavaCompiler javacompiler;
-    private static final Context.Key<DeclarationMaker> declarationMakerKey =
-            new Context.Key<DeclarationMaker>();
-
-    public static DeclarationMaker instance(Context context) {
-        DeclarationMaker instance = context.get(declarationMakerKey);
-        if (instance == null) {
-            instance = new DeclarationMaker(context);
-        }
-        return instance;
-    }
-
-    private DeclarationMaker(Context context) {
-        context.put(declarationMakerKey, this);
-        env = AptEnv.instance(context);
-        this.context = context;
-        this.javacompiler = JavaCompiler.instance(context);
-    }
-
-
-
-    // Cache of package declarations
-    private Map<PackageSymbol, PackageDeclaration> packageDecls =
-            new HashMap<PackageSymbol, PackageDeclaration>();
-
-    /**
-     * Returns the package declaration for a package symbol.
-     */
-    public PackageDeclaration getPackageDeclaration(PackageSymbol p) {
-        PackageDeclaration res = packageDecls.get(p);
-        if (res == null) {
-            res = new PackageDeclarationImpl(env, p);
-            packageDecls.put(p, res);
-        }
-        return res;
-    }
-
-    /**
-     * Returns the package declaration for the package with the given name.
-     * Name is fully-qualified, or "" for the unnamed package.
-     * Returns null if package declaration not found.
-     */
-    public PackageDeclaration getPackageDeclaration(String name) {
-        PackageSymbol p = null;
-        if (name.equals("") )
-            p = env.symtab.unnamedPackage;
-        else {
-            if (!isJavaName(name))
-                return null;
-            Symbol s = nameToSymbol(name, false);
-            if (s instanceof PackageSymbol) {
-                p = (PackageSymbol) s;
-                if (!p.exists())
-                    return null;
-            } else
-                return null;
-        }
-        return getPackageDeclaration(p);
-    }
-
-    // Cache of type declarations
-    private Map<ClassSymbol, TypeDeclaration> typeDecls =
-            new HashMap<ClassSymbol, TypeDeclaration>();
-
-    /**
-     * Returns the type declaration for a class symbol.
-     * Forces completion, and returns null on error.
-     */
-    public TypeDeclaration getTypeDeclaration(ClassSymbol c) {
-        long flags = AptEnv.getFlags(c);        // forces symbol completion
-        if (c.kind == Kinds.ERR) {
-            return null;
-        }
-        TypeDeclaration res = typeDecls.get(c);
-        if (res == null) {
-            if ((flags & Flags.ANNOTATION) != 0) {
-                res = new AnnotationTypeDeclarationImpl(env, c);
-            } else if ((flags & Flags.INTERFACE) != 0) {
-                res = new InterfaceDeclarationImpl(env, c);
-            } else if ((flags & Flags.ENUM) != 0) {
-                res = new EnumDeclarationImpl(env, c);
-            } else {
-                res = new ClassDeclarationImpl(env, c);
-            }
-            typeDecls.put(c, res);
-        }
-        return res;
-    }
-
-    /**
-     * Returns the type declaration for the type with the given canonical name.
-     * Returns null if type declaration not found.
-     */
-    public TypeDeclaration getTypeDeclaration(String name) {
-        if (!isJavaName(name))
-            return null;
-        Symbol s = nameToSymbol(name, true);
-        if (s instanceof ClassSymbol) {
-            ClassSymbol c = (ClassSymbol) s;
-            return getTypeDeclaration(c);
-        } else
-            return null;
-    }
-
-    /**
-     * Returns a symbol given the type's or packages's canonical name,
-     * or null if the name isn't found.
-     */
-    private Symbol nameToSymbol(String name, boolean classCache) {
-        Symbol s = null;
-        Name nameName = env.names.fromString(name);
-        if (classCache)
-            s = env.symtab.classes.get(nameName);
-        else
-            s = env.symtab.packages.get(nameName);
-
-        if (s != null && s.exists())
-            return s;
-
-        s = javacompiler.resolveIdent(name);
-        if (s.kind == Kinds.ERR  )
-            return null;
-
-        if (s.kind == Kinds.PCK)
-            s.complete();
-
-        return s;
-    }
-
-    // Cache of method and constructor declarations
-    private Map<MethodSymbol, ExecutableDeclaration> executableDecls =
-            new HashMap<MethodSymbol, ExecutableDeclaration>();
-
-    /**
-     * Returns the method or constructor declaration for a method symbol.
-     */
-    ExecutableDeclaration getExecutableDeclaration(MethodSymbol m) {
-        ExecutableDeclaration res = executableDecls.get(m);
-        if (res == null) {
-            if (m.isConstructor()) {
-                res = new ConstructorDeclarationImpl(env, m);
-            } else if (isAnnotationTypeElement(m)) {
-                res = new AnnotationTypeElementDeclarationImpl(env, m);
-            } else {
-                res = new MethodDeclarationImpl(env, m);
-            }
-            executableDecls.put(m, res);
-        }
-        return res;
-    }
-
-    // Cache of field declarations
-    private Map<VarSymbol, FieldDeclaration> fieldDecls =
-            new HashMap<VarSymbol, FieldDeclaration>();
-
-    /**
-     * Returns the field declaration for a var symbol.
-     */
-    FieldDeclaration getFieldDeclaration(VarSymbol v) {
-        FieldDeclaration res = fieldDecls.get(v);
-        if (res == null) {
-            if (hasFlag(v, Flags.ENUM)) {
-                res = new EnumConstantDeclarationImpl(env, v);
-            } else {
-                res = new FieldDeclarationImpl(env, v);
-            }
-            fieldDecls.put(v, res);
-        }
-        return res;
-    }
-
-    /**
-     * Returns a parameter declaration.
-     */
-    ParameterDeclaration getParameterDeclaration(VarSymbol v) {
-        return new ParameterDeclarationImpl(env, v);
-    }
-
-    /**
-     * Returns a type parameter declaration.
-     */
-    public TypeParameterDeclaration getTypeParameterDeclaration(TypeSymbol t) {
-        return new TypeParameterDeclarationImpl(env, t);
-    }
-
-    /**
-     * Returns an annotation.
-     */
-    AnnotationMirror getAnnotationMirror(Attribute.Compound a, Declaration decl) {
-        return new AnnotationMirrorImpl(env, a, decl);
-    }
-
-
-    /**
-     * Is a string a valid Java identifier?
-     */
-    public static boolean isJavaIdentifier(String id) {
-        return javax.lang.model.SourceVersion.isIdentifier(id);
-    }
-
-    public static boolean isJavaName(String name) {
-        for(String id: name.split("\\.")) {
-            if (! isJavaIdentifier(id))
-                return false;
-        }
-        return true;
-    }
-
-    /**
-     * Is a method an annotation type element?
-     * It is if it's declared in an annotation type.
-     */
-    private static boolean isAnnotationTypeElement(MethodSymbol m) {
-        return hasFlag(m.enclClass(), Flags.ANNOTATION);
-    }
-
-    /**
-     * Does a symbol have a given flag?
-     */
-    private static boolean hasFlag(Symbol s, long flag) {
-        return AptEnv.hasFlag(s, flag);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/EnumConstantDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-
-
-/**
- * Implementation of EnumConstantDeclaration
- */
-@SuppressWarnings("deprecation")
-public class EnumConstantDeclarationImpl extends FieldDeclarationImpl
-                                         implements EnumConstantDeclaration {
-
-    EnumConstantDeclarationImpl(AptEnv env, VarSymbol sym) {
-        super(env, sym);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public EnumDeclaration getDeclaringType() {
-        return (EnumDeclaration) super.getDeclaringType();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitEnumConstantDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/EnumDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.*;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of EnumDeclaration
- */
-@SuppressWarnings("deprecation")
-public class EnumDeclarationImpl extends ClassDeclarationImpl
-                                 implements EnumDeclaration {
-
-    EnumDeclarationImpl(AptEnv env, ClassSymbol sym) {
-        super(env, sym);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<EnumConstantDeclaration> getEnumConstants() {
-        return identityFilter.filter(getFields(),
-                                     EnumConstantDeclaration.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitEnumDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/ExecutableDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.ReferenceType;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of ExecutableDeclaration
- */
-@SuppressWarnings("deprecation")
-public abstract class ExecutableDeclarationImpl extends MemberDeclarationImpl
-                                             implements ExecutableDeclaration {
-    public MethodSymbol sym;
-
-    protected ExecutableDeclarationImpl(AptEnv env, MethodSymbol sym) {
-        super(env, sym);
-        this.sym = sym;
-    }
-
-
-    /**
-     * Returns type parameters (if any), method name, and signature
-     * (value parameter types).
-     */
-    public String toString() {
-        return sym.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isVarArgs() {
-        return AptEnv.hasFlag(sym, Flags.VARARGS);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<ParameterDeclaration> getParameters() {
-        Collection<ParameterDeclaration> res =
-            new ArrayList<ParameterDeclaration>();
-        for (VarSymbol param : sym.params())
-            res.add(env.declMaker.getParameterDeclaration(param));
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<ReferenceType> getThrownTypes() {
-        ArrayList<ReferenceType> res = new ArrayList<ReferenceType>();
-        for (Type t : sym.type.getThrownTypes()) {
-            res.add((ReferenceType) env.typeMaker.getType(t));
-        }
-        return res;
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/FieldDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.TypeMirror;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.TypeTags;
-
-
-/**
- * Implementation of FieldDeclaration
- */
-@SuppressWarnings("deprecation")
-class FieldDeclarationImpl extends MemberDeclarationImpl
-                                  implements FieldDeclaration {
-
-    protected VarSymbol sym;
-
-    FieldDeclarationImpl(AptEnv env, VarSymbol sym) {
-        super(env, sym);
-        this.sym = sym;
-    }
-
-
-    /**
-     * Returns the field's name.
-     */
-    public String toString() {
-        return getSimpleName();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeMirror getType() {
-        return env.typeMaker.getType(sym.type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Object getConstantValue() {
-        Object val = sym.getConstValue();
-        // val may be null, indicating that this is not a constant.
-
-        return Constants.decodeConstant(val, sym.type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getConstantExpression() {
-        Object val = getConstantValue();
-        if (val == null) {
-            return null;
-        }
-        Constants.Formatter fmtr = Constants.getFormatter();
-        fmtr.append(val);
-        return fmtr.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitFieldDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/InterfaceDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of InterfaceDeclaration
- */
-@SuppressWarnings("deprecation")
-public class InterfaceDeclarationImpl extends TypeDeclarationImpl
-                                      implements InterfaceDeclaration {
-
-    InterfaceDeclarationImpl(AptEnv env, ClassSymbol sym) {
-        super(env, sym);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitInterfaceDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/MemberDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Implementation of MemberDeclaration
- */
-@SuppressWarnings("deprecation")
-public abstract class MemberDeclarationImpl extends DeclarationImpl
-                                            implements MemberDeclaration {
-
-    protected MemberDeclarationImpl(AptEnv env, Symbol sym) {
-        super(env, sym);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeDeclaration getDeclaringType() {
-        ClassSymbol c = getDeclaringClassSymbol();
-        return (c == null)
-            ? null
-            : env.declMaker.getTypeDeclaration(c);
-    }
-
-    /**
-     * {@inheritDoc}
-     * For methods, constructors, and types.
-     */
-    public Collection<TypeParameterDeclaration> getFormalTypeParameters() {
-        ArrayList<TypeParameterDeclaration> res =
-            new ArrayList<TypeParameterDeclaration>();
-        for (Type t : sym.type.getTypeArguments()) {
-            res.add(env.declMaker.getTypeParameterDeclaration(t.tsym));
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitMemberDeclaration(this);
-    }
-
-
-    /**
-     * Returns the ClassSymbol of the declaring type,
-     * or null if this is a top-level type.
-     */
-    private ClassSymbol getDeclaringClassSymbol() {
-        return sym.owner.enclClass();
-    }
-
-    /**
-     * Returns the formal type parameters of a type, member or constructor
-     * as an angle-bracketed string.  Each parameter consists of the simple
-     * type variable name and any bounds (with no implicit "extends Object"
-     * clause added).  Type names are qualified.
-     * Returns "" if there are no type parameters.
-     */
-    protected static String typeParamsToString(AptEnv env, Symbol sym) {
-        if (sym.type.getTypeArguments().isEmpty()) {
-            return "";
-        }
-        StringBuilder s = new StringBuilder();
-        for (Type t : sym.type.getTypeArguments()) {
-            Type.TypeVar tv = (Type.TypeVar) t;
-            s.append(s.length() == 0 ? "<" : ", ")
-             .append(TypeParameterDeclarationImpl.toString(env, tv));
-        }
-        s.append(">");
-        return s.toString();
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/MethodDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.mirror.type.TypeMirror;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-
-
-/**
- * Implementation of MethodDeclaration
- */
-@SuppressWarnings("deprecation")
-public class MethodDeclarationImpl extends ExecutableDeclarationImpl
-                                   implements MethodDeclaration {
-
-    MethodDeclarationImpl(AptEnv env, MethodSymbol sym) {
-        super(env, sym);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeMirror getReturnType() {
-        return env.typeMaker.getType(sym.type.getReturnType());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitMethodDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/PackageDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.*;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of PackageDeclaration.
- */
-@SuppressWarnings("deprecation")
-public class PackageDeclarationImpl extends DeclarationImpl
-                                    implements PackageDeclaration {
-
-    private PackageSymbol sym;
-
-
-    public PackageDeclarationImpl(AptEnv env, PackageSymbol sym) {
-        super(env, sym);
-        this.sym = sym;
-    }
-
-
-    /**
-     * Returns the qualified name.
-     */
-    public String toString() {
-        return getQualifiedName();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getQualifiedName() {
-        return sym.getQualifiedName().toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<ClassDeclaration> getClasses() {
-        return identityFilter.filter(getAllTypes(),
-                                     ClassDeclaration.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<EnumDeclaration> getEnums() {
-        return identityFilter.filter(getAllTypes(),
-                                     EnumDeclaration.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<InterfaceDeclaration> getInterfaces() {
-        return identityFilter.filter(getAllTypes(),
-                                     InterfaceDeclaration.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<AnnotationTypeDeclaration> getAnnotationTypes() {
-        return identityFilter.filter(getAllTypes(),
-                                     AnnotationTypeDeclaration.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitPackageDeclaration(this);
-    }
-
-
-    // Cache of all top-level type declarations in this package.
-    private Collection<TypeDeclaration> allTypes = null;
-
-    /**
-     * Caches and returns all top-level type declarations in this package.
-     * Omits synthetic types.
-     */
-    private Collection<TypeDeclaration> getAllTypes() {
-        if (allTypes != null) {
-            return allTypes;
-        }
-        allTypes = new ArrayList<TypeDeclaration>();
-        for (Symbol s : getMembers(false)) {
-            allTypes.add(env.declMaker.getTypeDeclaration((ClassSymbol) s));
-        }
-        return allTypes;
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/ParameterDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.TypeMirror;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-
-
-/**
- * Implementation of ParameterDeclaration
- */
-@SuppressWarnings("deprecation")
-public class ParameterDeclarationImpl extends DeclarationImpl
-                                      implements ParameterDeclaration
-{
-    protected VarSymbol sym;
-
-
-    ParameterDeclarationImpl(AptEnv env, VarSymbol sym) {
-        super(env, sym);
-        this.sym = sym;
-    }
-
-
-    /**
-     * Returns the simple name of the parameter.
-     */
-    public String toString() {
-        return getType() + " " + sym.name;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean equals(Object obj) {
-        // Neither ParameterDeclarationImpl objects nor their symbols
-        // are cached by the current implementation, so check symbol
-        // owners and names.
-
-        if (obj instanceof ParameterDeclarationImpl) {
-            ParameterDeclarationImpl that = (ParameterDeclarationImpl) obj;
-            return sym.owner == that.sym.owner &&
-                   sym.name == that.sym.name &&
-                   env == that.env;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public int hashCode() {
-        return sym.owner.hashCode() + sym.name.hashCode() + env.hashCode();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeMirror getType() {
-        return env.typeMaker.getType(sym.type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitParameterDeclaration(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/TypeDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.Name;
-
-/**
- * Implementation of TypeDeclaration
- */
-@SuppressWarnings("deprecation")
-public class TypeDeclarationImpl extends MemberDeclarationImpl
-                                 implements TypeDeclaration {
-
-    public ClassSymbol sym;
-
-
-    /**
-     * "sym" should be completed before this constructor is called.
-     */
-     protected TypeDeclarationImpl(AptEnv env, ClassSymbol sym) {
-        super(env, sym);
-        this.sym = sym;
-    }
-
-
-    /**
-     * Returns the type's name, with any type parameters (including those
-     * of outer classes).  Type names are qualified.
-     */
-    public String toString() {
-        return toString(env, sym);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public PackageDeclaration getPackage() {
-        return env.declMaker.getPackageDeclaration(sym.packge());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getQualifiedName() {
-        return sym.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<InterfaceType> getSuperinterfaces() {
-        return env.typeMaker.getTypes(env.jctypes.interfaces(sym.type),
-                                      InterfaceType.class);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<FieldDeclaration> getFields() {
-        ArrayList<FieldDeclaration> res = new ArrayList<FieldDeclaration>();
-        for (Symbol s : getMembers(true)) {
-            if (s.kind == Kinds.VAR) {
-                res.add(env.declMaker.getFieldDeclaration((VarSymbol) s));
-            }
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<? extends MethodDeclaration> getMethods() {
-        ArrayList<MethodDeclaration> res = new ArrayList<MethodDeclaration>();
-        for (Symbol s : getMembers(true)) {
-            if (s.kind == Kinds.MTH && !s.isConstructor() &&
-                !env.names.clinit.equals(s.name) ) { // screen out static initializers
-                MethodSymbol m = (MethodSymbol) s;
-                res.add((MethodDeclaration)
-                        env.declMaker.getExecutableDeclaration(m));
-            }
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<TypeDeclaration> getNestedTypes() {
-        ArrayList<TypeDeclaration> res = new ArrayList<TypeDeclaration>();
-        for (Symbol s : getMembers(true)) {
-            if (s.kind == Kinds.TYP) {
-                res.add(env.declMaker.getTypeDeclaration((ClassSymbol) s));
-            }
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitTypeDeclaration(this);
-    }
-
-
-    /**
-     * Returns a type's name, with any type parameters (including those
-     * of outer classes).  Type names are qualified.
-     */
-    static String toString(AptEnv env, ClassSymbol c) {
-        StringBuilder sb = new StringBuilder();
-        if (c.isInner()) {
-            // c is an inner class, so include type params of outer.
-            ClassSymbol enclosing = c.owner.enclClass();
-            sb.append(toString(env, enclosing))
-              .append('.')
-              .append(c.name);
-        } else {
-            sb.append(c);
-        }
-        sb.append(typeParamsToString(env, c));
-        return sb.toString();
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/declaration/TypeParameterDeclarationImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.declaration;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.ReferenceType;
-import com.sun.mirror.util.DeclarationVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of TypeParameterDeclaration
- */
-@SuppressWarnings("deprecation")
-public class TypeParameterDeclarationImpl extends DeclarationImpl
-                                          implements TypeParameterDeclaration
-{
-    protected TypeSymbol sym;
-
-
-    TypeParameterDeclarationImpl(AptEnv env, TypeSymbol sym) {
-        super(env, sym);
-        this.sym = sym;
-    }
-
-
-    /**
-     * Returns the type parameter's name along with any "extends" clause.
-     * Class names are qualified.  No implicit "extends Object" is added.
-     */
-    public String toString() {
-        return toString(env, (Type.TypeVar) sym.type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<ReferenceType> getBounds() {
-        ArrayList<ReferenceType> res = new ArrayList<ReferenceType>();
-        for (Type t : env.jctypes.getBounds((Type.TypeVar) sym.type)) {
-            res.add((ReferenceType) env.typeMaker.getType(t));
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Declaration getOwner() {
-        Symbol owner = sym.owner;
-        return ((owner.kind & Kinds.TYP) != 0)
-               ? env.declMaker.getTypeDeclaration((ClassSymbol) owner)
-               : env.declMaker.getExecutableDeclaration((MethodSymbol) owner);
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(DeclarationVisitor v) {
-        v.visitTypeParameterDeclaration(this);
-    }
-
-
-    /**
-     * Returns the type parameter's name along with any "extends" clause.
-     * See {@link #toString()} for details.
-     */
-    static String toString(AptEnv env, Type.TypeVar tv) {
-        StringBuilder s = new StringBuilder();
-        s.append(tv);
-        boolean first = true;
-        for (Type bound : getExtendsBounds(env, tv)) {
-            s.append(first ? " extends " : " & ");
-            s.append(env.typeMaker.typeToString(bound));
-            first = false;
-        }
-        return s.toString();
-    }
-
-    /**
-     * Returns the bounds of a type variable, eliding java.lang.Object
-     * if it appears alone.
-     */
-    private static Iterable<Type> getExtendsBounds(AptEnv env,
-                                                   Type.TypeVar tv) {
-        return (tv.getUpperBound().tsym == env.symtab.objectType.tsym)
-               ? com.sun.tools.javac.util.List.<Type>nil()
-               : env.jctypes.getBounds(tv);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/AnnotationTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Implementation of AnnotationType
- */
-@SuppressWarnings("deprecation")
-public class AnnotationTypeImpl extends InterfaceTypeImpl
-                                implements AnnotationType {
-
-    AnnotationTypeImpl(AptEnv env, Type.ClassType type) {
-        super(env, type);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public AnnotationTypeDeclaration getDeclaration() {
-        return (AnnotationTypeDeclaration) super.getDeclaration();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitAnnotationType(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/ArrayTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Implementation of ArrayType
- */
-@SuppressWarnings("deprecation")
-public class ArrayTypeImpl extends TypeMirrorImpl implements ArrayType {
-
-    protected Type.ArrayType type;
-
-
-    ArrayTypeImpl(AptEnv env, Type.ArrayType type) {
-        super(env, type);
-        this.type = type;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeMirror getComponentType() {
-        return env.typeMaker.getType(type.elemtype);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitArrayType(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/ClassTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Implementation of ClassType
- */
-@SuppressWarnings("deprecation")
-public class ClassTypeImpl extends DeclaredTypeImpl implements ClassType {
-
-    ClassTypeImpl(AptEnv env, Type.ClassType type) {
-        super(env, type);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public ClassDeclaration getDeclaration() {
-        return (ClassDeclaration) super.getDeclaration();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public ClassType getSuperclass() {
-        //  java.lang.Object has no superclass
-        if (type.tsym == env.symtab.objectType.tsym) {
-            return null;
-        }
-        Type sup = env.jctypes.supertype(type);
-        return (ClassType) env.typeMaker.getType(sup);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitClassType(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/DeclaredTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.TypeDeclaration;
-import com.sun.mirror.type.*;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-
-
-/**
- * Implementation of DeclaredType
- */
-@SuppressWarnings("deprecation")
-abstract class DeclaredTypeImpl extends TypeMirrorImpl
-                                implements DeclaredType {
-
-    protected Type.ClassType type;
-
-
-    protected DeclaredTypeImpl(AptEnv env, Type.ClassType type) {
-        super(env, type);
-        this.type = type;
-    }
-
-
-    /**
-     * Returns a string representation of this declared type.
-     * This includes the type's name and any actual type arguments.
-     * Type names are qualified.
-     */
-    public String toString() {
-        return toString(env, type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeDeclaration getDeclaration() {
-        return env.declMaker.getTypeDeclaration((ClassSymbol) type.tsym);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public DeclaredType getContainingType() {
-        if (type.getEnclosingType().tag == TypeTags.CLASS) {
-            // This is the type of an inner class.
-            return (DeclaredType) env.typeMaker.getType(type.getEnclosingType());
-        }
-        ClassSymbol enclosing = type.tsym.owner.enclClass();
-        if (enclosing != null) {
-            // Nested but not inner.  Return the raw type of the enclosing
-            // class or interface.
-            // See java.lang.reflect.ParameterizedType.getOwnerType().
-            return (DeclaredType) env.typeMaker.getType(
-                                        env.jctypes.erasure(enclosing.type));
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<TypeMirror> getActualTypeArguments() {
-        return env.typeMaker.getTypes(type.getTypeArguments());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<InterfaceType> getSuperinterfaces() {
-        return env.typeMaker.getTypes(env.jctypes.interfaces(type),
-                                      InterfaceType.class);
-    }
-
-
-    /**
-     * Returns a string representation of this declared type.
-     * See {@link #toString()} for details.
-     */
-    static String toString(AptEnv env, Type.ClassType c) {
-        return c.toString();
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/EnumTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Implementation of EnumType
- */
-@SuppressWarnings("deprecation")
-public class EnumTypeImpl extends ClassTypeImpl implements EnumType {
-
-    EnumTypeImpl(AptEnv env, Type.ClassType type) {
-        super(env, type);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public EnumDeclaration getDeclaration() {
-        return (EnumDeclaration) super.getDeclaration();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitEnumType(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/InterfaceTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Implementation of InterfaceType
- */
-@SuppressWarnings("deprecation")
-public class InterfaceTypeImpl extends DeclaredTypeImpl
-                               implements InterfaceType {
-
-    InterfaceTypeImpl(AptEnv env, Type.ClassType type) {
-        super(env, type);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public InterfaceDeclaration getDeclaration() {
-        return (InterfaceDeclaration) super.getDeclaration();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitInterfaceType(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/PrimitiveTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-
-import com.sun.mirror.type.PrimitiveType;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Type;
-
-import static com.sun.mirror.type.PrimitiveType.Kind.*;
-
-
-/**
- * Implementation of PrimitiveType.
- */
-@SuppressWarnings("deprecation")
-class PrimitiveTypeImpl extends TypeMirrorImpl implements PrimitiveType {
-
-    private final Kind kind;    // the kind of primitive
-
-
-    PrimitiveTypeImpl(AptEnv env, Kind kind) {
-        super(env, getType(env, kind));
-        this.kind = kind;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Kind getKind() {
-        return kind;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitPrimitiveType(this);
-    }
-
-
-    /**
-     * Returns the javac type corresponding to a kind of primitive type.
-     */
-    private static Type getType(AptEnv env, Kind kind) {
-        switch (kind) {
-        case BOOLEAN:   return env.symtab.booleanType;
-        case BYTE:      return env.symtab.byteType;
-        case SHORT:     return env.symtab.shortType;
-        case INT:       return env.symtab.intType;
-        case LONG:      return env.symtab.longType;
-        case CHAR:      return env.symtab.charType;
-        case FLOAT:     return env.symtab.floatType;
-        case DOUBLE:    return env.symtab.doubleType;
-        default:        throw new AssertionError();
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/TypeMaker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.type.*;
-import com.sun.mirror.type.PrimitiveType.Kind;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.util.Context;
-
-import static com.sun.tools.javac.code.TypeTags.*;
-
-
-/**
- * Utilities for constructing type objects.
- */
-@SuppressWarnings("deprecation")
-public class TypeMaker {
-
-    private final AptEnv env;
-    private final VoidType voidType;
-    private PrimitiveType[] primTypes = new PrimitiveType[VOID];
-                                                // VOID is past all prim types
-
-
-    private static final Context.Key<TypeMaker> typeMakerKey =
-            new Context.Key<TypeMaker>();
-
-    public static TypeMaker instance(Context context) {
-        TypeMaker instance = context.get(typeMakerKey);
-        if (instance == null) {
-            instance = new TypeMaker(context);
-        }
-        return instance;
-    }
-
-    private TypeMaker(Context context) {
-        context.put(typeMakerKey, this);
-        env = AptEnv.instance(context);
-
-        voidType = new VoidTypeImpl(env);
-        primTypes[BOOLEAN] = new PrimitiveTypeImpl(env, Kind.BOOLEAN);
-        primTypes[BYTE]    = new PrimitiveTypeImpl(env, Kind.BYTE);
-        primTypes[SHORT]   = new PrimitiveTypeImpl(env, Kind.SHORT);
-        primTypes[INT]     = new PrimitiveTypeImpl(env, Kind.INT);
-        primTypes[LONG]    = new PrimitiveTypeImpl(env, Kind.LONG);
-        primTypes[CHAR]    = new PrimitiveTypeImpl(env, Kind.CHAR);
-        primTypes[FLOAT]   = new PrimitiveTypeImpl(env, Kind.FLOAT);
-        primTypes[DOUBLE]  = new PrimitiveTypeImpl(env, Kind.DOUBLE);
-    }
-
-
-    /**
-     * Returns the TypeMirror corresponding to a javac Type object.
-     */
-    public TypeMirror getType(Type t) {
-        if (t.isPrimitive()) {
-            return primTypes[t.tag];
-        }
-        switch (t.tag) {
-        case ERROR:     // fall through
-        case CLASS:     return getDeclaredType((Type.ClassType) t);
-        case WILDCARD:  return new WildcardTypeImpl(env, (Type.WildcardType) t);
-        case TYPEVAR:   return new TypeVariableImpl(env, (Type.TypeVar) t);
-        case ARRAY:     return new ArrayTypeImpl(env, (Type.ArrayType) t);
-        case VOID:      return voidType;
-        default:        throw new AssertionError();
-        }
-    }
-
-    /**
-     * Returns the declared type corresponding to a given ClassType.
-     */
-    public DeclaredType getDeclaredType(Type.ClassType t) {
-        return
-            hasFlag(t.tsym, Flags.ANNOTATION) ? new AnnotationTypeImpl(env, t) :
-            hasFlag(t.tsym, Flags.INTERFACE)  ? new InterfaceTypeImpl(env, t) :
-            hasFlag(t.tsym, Flags.ENUM)       ? new EnumTypeImpl(env, t) :
-                                                new ClassTypeImpl(env, t);
-    }
-
-    /**
-     * Returns a collection of types corresponding to a list of javac Type
-     * objects.
-     */
-    public Collection<TypeMirror> getTypes(Iterable<Type> types) {
-        return getTypes(types, TypeMirror.class);
-    }
-
-    /**
-     * Returns a collection of types corresponding to a list of javac Type
-     * objects.  The element type of the result is specified explicitly.
-     */
-    public <T extends TypeMirror> Collection<T> getTypes(Iterable<Type> types,
-                                                         Class<T> resType) {
-        ArrayList<T> res = new ArrayList<T>();
-        for (Type t : types) {
-            TypeMirror mir = getType(t);
-            if (resType.isInstance(mir)) {
-                res.add(resType.cast(mir));
-            }
-        }
-        return res;
-    }
-
-    /**
-     * Returns the string representation of a type.
-     * Bounds of type variables are not included; bounds of wildcard types are.
-     * Type names are qualified.
-     */
-    public String typeToString(Type t) {
-        switch (t.tag) {
-        case ARRAY:
-            return typeToString(env.jctypes.elemtype(t)) + "[]";
-        case CLASS:
-            Type.ClassType c = (Type.ClassType) t;
-            return DeclaredTypeImpl.toString(env, c);
-        case WILDCARD:
-            Type.WildcardType a = (Type.WildcardType) t;
-            return WildcardTypeImpl.toString(env, a);
-        default:
-            return t.tsym.toString();
-        }
-    }
-
-
-    /**
-     * Does a symbol have a given flag?
-     */
-    private static boolean hasFlag(Symbol s, long flag) {
-        return AptEnv.hasFlag(s, flag);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-
-
-/**
- * Implementation of TypeMirror
- */
-@SuppressWarnings("deprecation")
-public abstract class TypeMirrorImpl implements TypeMirror {
-
-    protected final AptEnv env;
-    public final Type type;
-
-
-    protected TypeMirrorImpl(AptEnv env, Type type) {
-        this.env = env;
-        this.type = type;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String toString() {
-        return type.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean equals(Object obj) {
-        if (obj instanceof TypeMirrorImpl) {
-            TypeMirrorImpl that = (TypeMirrorImpl) obj;
-            return env.jctypes.isSameType(this.type, that.type);
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public int hashCode() {
-        return Types.hashCode(type);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/TypeVariableImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.Symbol.TypeSymbol;
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Implementation of TypeVariable
- */
-@SuppressWarnings("deprecation")
-public class TypeVariableImpl extends TypeMirrorImpl implements TypeVariable {
-
-    protected Type.TypeVar type;
-
-
-    TypeVariableImpl(AptEnv env, Type.TypeVar type) {
-        super(env, type);
-        this.type = type;
-    }
-
-
-    /**
-     * Returns the simple name of this type variable.  Bounds are
-     * not included.
-     */
-    public String toString() {
-        return type.tsym.name.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeParameterDeclaration getDeclaration() {
-        TypeSymbol sym = type.tsym;
-        return env.declMaker.getTypeParameterDeclaration(sym);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitTypeVariable(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/VoidTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import com.sun.mirror.type.VoidType;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-
-
-/**
- * Implementation of VoidType.
- */
-@SuppressWarnings("deprecation")
-class VoidTypeImpl extends TypeMirrorImpl implements VoidType {
-
-    VoidTypeImpl(AptEnv env) {
-        super(env, env.symtab.voidType);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitVoidType(this);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/type/WildcardTypeImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.type;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.TypeVisitor;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-
-
-/**
- * Implementation of WildcardType
- */
-@SuppressWarnings("deprecation")
-public class WildcardTypeImpl extends TypeMirrorImpl implements WildcardType {
-
-    protected Type.WildcardType type;
-
-    WildcardTypeImpl(AptEnv env, Type.WildcardType type) {
-        super(env, type);
-        this.type = type;
-    }
-
-
-    /**
-     * Returns the string form of a wildcard type, consisting of "?"
-     * and any "extends" or "super" clause.
-     * Delimiting brackets are not included.  Class names are qualified.
-     */
-    public String toString() {
-        return toString(env, type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<ReferenceType> getUpperBounds() {
-        return type.isSuperBound()
-                ? Collections.<ReferenceType>emptyList()
-                : typeToCollection(type.type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Collection<ReferenceType> getLowerBounds() {
-        return type.isExtendsBound()
-                ? Collections.<ReferenceType>emptyList()
-                : typeToCollection(type.type);
-    }
-
-    /**
-     * Gets the ReferenceType for a javac Type object, and returns
-     * it in a singleton collection.  If type is null, returns an empty
-     * collection.
-     */
-    private Collection<ReferenceType> typeToCollection(Type type) {
-        ArrayList<ReferenceType> res = new ArrayList<ReferenceType>(1);
-        if (type != null) {
-            res.add((ReferenceType) env.typeMaker.getType(type));
-        }
-        return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void accept(TypeVisitor v) {
-        v.visitWildcardType(this);
-    }
-
-
-    /**
-     * Returns the string form of a wildcard type, consisting of "?"
-     * and any "extends" or "super" clause.
-     * See {@link #toString()} for details.
-     */
-    static String toString(AptEnv env, Type.WildcardType wildThing) {
-        return wildThing.toString();
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/util/DeclarationsImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.util;
-
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.Declarations;
-import com.sun.tools.apt.mirror.declaration.DeclarationImpl;
-import com.sun.tools.apt.mirror.declaration.MethodDeclarationImpl;
-import com.sun.tools.apt.mirror.util.DeclarationsImpl;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.Context;
-
-import static com.sun.tools.javac.code.Kinds.*;
-
-
-/**
- * Implementation of Declarations utility methods for annotation processors
- */
-@SuppressWarnings("deprecation")
-public class DeclarationsImpl implements Declarations {
-
-    private final AptEnv env;
-
-
-    private static final Context.Key<Declarations> declarationsKey =
-            new Context.Key<Declarations>();
-
-    public static Declarations instance(Context context) {
-        Declarations instance = context.get(declarationsKey);
-        if (instance == null) {
-            instance = new DeclarationsImpl(context);
-        }
-        return instance;
-    }
-
-    private DeclarationsImpl(Context context) {
-        context.put(declarationsKey, this);
-        env = AptEnv.instance(context);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * See sections 8.3 and 8.4.6 of
-     * <cite>The Java&trade; Language Specification</cite>
-     */
-    public boolean hides(MemberDeclaration sub, MemberDeclaration sup) {
-        Symbol hider = ((DeclarationImpl) sub).sym;
-        Symbol hidee = ((DeclarationImpl) sup).sym;
-
-        // Fields only hide fields; methods only methods; types only types.
-        // Names must match.  Nothing hides itself (just try it).
-        if (hider == hidee ||
-                hider.kind != hidee.kind ||
-                hider.name != hidee.name) {
-            return false;
-        }
-
-        // Only static methods can hide other methods.
-        // Methods only hide methods with matching signatures.
-        if (hider.kind == MTH) {
-            if ((hider.flags() & Flags.STATIC) == 0 ||
-                        !env.jctypes.isSubSignature(hider.type, hidee.type)) {
-                return false;
-            }
-        }
-
-        // Hider must be in a subclass of hidee's class.
-        // Note that if M1 hides M2, and M2 hides M3, and M3 is accessible
-        // in M1's class, then M1 and M2 both hide M3.
-        ClassSymbol hiderClass = hider.owner.enclClass();
-        ClassSymbol hideeClass = hidee.owner.enclClass();
-        if (hiderClass == null || hideeClass == null ||
-                !hiderClass.isSubClass(hideeClass, env.jctypes)) {
-            return false;
-        }
-
-        // Hidee must be accessible in hider's class.
-        // The method isInheritedIn is poorly named:  it checks only access.
-        return hidee.isInheritedIn(hiderClass, env.jctypes);
-    }
-
-    /**
-     * {@inheritDoc}
-     * See section 8.4.6.1 of
-     * <cite>The Java&trade; Language Specification</cite>
-     */
-    public boolean overrides(MethodDeclaration sub, MethodDeclaration sup) {
-        MethodSymbol overrider = ((MethodDeclarationImpl) sub).sym;
-        MethodSymbol overridee = ((MethodDeclarationImpl) sup).sym;
-        ClassSymbol origin = (ClassSymbol) overrider.owner;
-
-        return overrider.name == overridee.name &&
-
-               // not reflexive as per JLS
-               overrider != overridee &&
-
-               // we don't care if overridee is static, though that wouldn't
-               // compile
-               !overrider.isStatic() &&
-
-               // overrider, whose declaring type is the origin, must be
-               // in a subtype of overridee's type
-               env.jctypes.asSuper(origin.type, overridee.owner) != null &&
-
-               // check access and signatures; don't check return types
-               overrider.overrides(overridee, origin, env.jctypes, false);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.util;
-
-
-import java.io.File;
-import javax.tools.JavaFileObject;
-
-import com.sun.mirror.util.SourcePosition;
-import com.sun.tools.javac.util.Position;
-
-
-/**
- * Implementation of SourcePosition
- */
-@SuppressWarnings("deprecation")
-public class SourcePositionImpl implements SourcePosition {
-
-    private JavaFileObject sourcefile;
-    private int pos;            // file position, in javac's internal format
-    private Position.LineMap linemap;
-
-
-    public SourcePositionImpl(JavaFileObject sourcefile, int pos, Position.LineMap linemap) {
-        this.sourcefile = sourcefile;
-        this.pos = pos;
-        this.linemap = linemap;
-        assert sourcefile != null;
-        assert linemap != null;
-    }
-
-    public int getJavacPosition() {
-        return pos;
-    }
-
-    public JavaFileObject getSource() {
-        return sourcefile;
-    }
-
-    /**
-     * Returns a string representation of this position in the
-     * form "sourcefile:line", or "sourcefile" if no line number is available.
-     */
-    public String toString() {
-        int ln = line();
-        return (ln == Position.NOPOS)
-                ? sourcefile.getName()
-                : sourcefile.getName() + ":" + ln;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public File file() {
-        return new File(sourcefile.toUri());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public int line() {
-        return linemap.getLineNumber(pos);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public int column() {
-        return linemap.getColumnNumber(pos);
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/mirror/util/TypesImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.mirror.util;
-
-
-import java.util.Collection;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.Types;
-import com.sun.tools.apt.mirror.AptEnv;
-import com.sun.tools.apt.mirror.declaration.*;
-import com.sun.tools.apt.mirror.type.TypeMirrorImpl;
-import com.sun.tools.javac.code.BoundKind;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.ListBuffer;
-
-
-/**
- * Implementation of Types utility methods for annotation processors
- */
-@SuppressWarnings("deprecation")
-public class TypesImpl implements Types {
-
-    private final AptEnv env;
-
-
-    private static final Context.Key<Types> typesKey =
-            new Context.Key<Types>();
-
-    public static Types instance(Context context) {
-        Types instance = context.get(typesKey);
-        if (instance == null) {
-            instance = new TypesImpl(context);
-        }
-        return instance;
-    }
-
-    private TypesImpl(Context context) {
-        context.put(typesKey, this);
-        env = AptEnv.instance(context);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isSubtype(TypeMirror t1, TypeMirror t2) {
-        return env.jctypes.isSubtype(((TypeMirrorImpl) t1).type,
-                                     ((TypeMirrorImpl) t2).type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isAssignable(TypeMirror t1, TypeMirror t2) {
-        return env.jctypes.isAssignable(((TypeMirrorImpl) t1).type,
-                                        ((TypeMirrorImpl) t2).type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeMirror getErasure(TypeMirror t) {
-        return env.typeMaker.getType(
-                env.jctypes.erasure(((TypeMirrorImpl) t).type));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public PrimitiveType getPrimitiveType(PrimitiveType.Kind kind) {
-        Type prim = null;
-        switch (kind) {
-        case BOOLEAN:   prim = env.symtab.booleanType;  break;
-        case BYTE:      prim = env.symtab.byteType;     break;
-        case SHORT:     prim = env.symtab.shortType;    break;
-        case INT:       prim = env.symtab.intType;      break;
-        case LONG:      prim = env.symtab.longType;     break;
-        case CHAR:      prim = env.symtab.charType;     break;
-        case FLOAT:     prim = env.symtab.floatType;    break;
-        case DOUBLE:    prim = env.symtab.doubleType;   break;
-        default:        assert false;
-        }
-        return (PrimitiveType) env.typeMaker.getType(prim);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public VoidType getVoidType() {
-        return (VoidType) env.typeMaker.getType(env.symtab.voidType);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public ArrayType getArrayType(TypeMirror componentType) {
-        if (componentType instanceof VoidType) {
-            throw new IllegalArgumentException("void");
-        }
-        return (ArrayType) env.typeMaker.getType(
-                new Type.ArrayType(((TypeMirrorImpl) componentType).type,
-                                   env.symtab.arrayClass));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public TypeVariable getTypeVariable(TypeParameterDeclaration tparam) {
-        return (TypeVariable) env.typeMaker.getType(
-                                ((DeclarationImpl) tparam).sym.type);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public WildcardType getWildcardType(Collection<ReferenceType> upperBounds,
-                                        Collection<ReferenceType> lowerBounds) {
-        BoundKind kind;
-        Type bound;
-        int uppers  = upperBounds.size();
-        int downers = lowerBounds.size();
-
-        if (uppers + downers > 1) {
-            throw new IllegalArgumentException("Multiple bounds not allowed");
-
-        } else if (uppers + downers == 0) {
-            kind = BoundKind.UNBOUND;
-            bound = env.symtab.objectType;
-
-        } else if (uppers == 1) {
-            assert downers == 0;
-            kind = BoundKind.EXTENDS;
-            bound = ((TypeMirrorImpl) upperBounds.iterator().next()).type;
-
-        } else {
-            assert uppers == 0 && downers == 1;
-            kind = BoundKind.SUPER;
-            bound = ((TypeMirrorImpl) lowerBounds.iterator().next()).type;
-        }
-
-        if (bound instanceof Type.WildcardType)
-            throw new IllegalArgumentException(bound.toString());
-
-        return (WildcardType) env.typeMaker.getType(
-                new Type.WildcardType(bound, kind, env.symtab.boundClass));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public DeclaredType getDeclaredType(TypeDeclaration decl,
-                                        TypeMirror... typeArgs) {
-        ClassSymbol sym = ((TypeDeclarationImpl) decl).sym;
-
-        if (typeArgs.length == 0)
-            return (DeclaredType) env.typeMaker.getType(
-                                        env.jctypes.erasure(sym.type));
-        if (sym.type.getEnclosingType().isParameterized())
-            throw new IllegalArgumentException(decl.toString());
-
-        return getDeclaredType(sym.type.getEnclosingType(), sym, typeArgs);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public DeclaredType getDeclaredType(DeclaredType containing,
-                                        TypeDeclaration decl,
-                                        TypeMirror... typeArgs) {
-        if (containing == null)
-            return getDeclaredType(decl, typeArgs);
-
-        ClassSymbol sym = ((TypeDeclarationImpl) decl).sym;
-        Type outer = ((TypeMirrorImpl) containing).type;
-
-        if (outer.tsym != sym.owner.enclClass())
-            throw new IllegalArgumentException(containing.toString());
-        if (!outer.isParameterized())
-            return getDeclaredType(decl, typeArgs);
-
-        return getDeclaredType(outer, sym, typeArgs);
-    }
-
-    private DeclaredType getDeclaredType(Type outer,
-                                         ClassSymbol sym,
-                                         TypeMirror... typeArgs) {
-        if (typeArgs.length != sym.type.getTypeArguments().length())
-            throw new IllegalArgumentException(
-                                "Incorrect number of type arguments");
-
-        ListBuffer<Type> targs = new ListBuffer<Type>();
-        for (TypeMirror t : typeArgs) {
-            if (!(t instanceof ReferenceType || t instanceof WildcardType))
-                throw new IllegalArgumentException(t.toString());
-            targs.append(((TypeMirrorImpl) t).type);
-        }
-        //### Need a way to check that type args match formals.
-
-        return (DeclaredType) env.typeMaker.getType(
-                new Type.ClassType(outer, targs.toList(), sym));
-    }
-}
--- a/src/share/classes/com/sun/tools/apt/resources/apt.properties	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-#
-# Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-apt.msg.usage.header=\
-Usage: {0} <apt and javac options> <source files>\n\
-where apt options include:
-
-apt.msg.usage.footer=\
-See javac -help for information on javac options.
-
-apt.msg.usage.nonstandard.footer=\
-These options are non-standard and subject to change without notice, \nas is the format of their output.
-
-apt.msg.bug=\
-An exception has occurred in apt ({0}). \
-Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  \
-after checking the Bug Parade for duplicates. \
-Include your program and the following diagnostic in your report.  Thank you.
-
-## apt options
-
-apt.opt.A=\
-    Options to pass to annotation processors
-apt.opt.arg.class=\
-    <class>
-apt.opt.arg.directory=\
-    Specify where to place processor and javac generated class files
-apt.opt.classpath=\
-    Specify where to find user class files and annotation processor factories
-apt.opt.d=\
-    Specify where to place processor and javac generated class files
-apt.opt.factory=\
-    Name of AnnotationProcessorFactory to use; bypasses default discovery process
-apt.opt.factorypath=\
-    Specify where to find annotation processor factories
-apt.opt.s=\
-    Specify where to place processor generated source files
-apt.opt.help=\
-    Print a synopsis of standard options; use javac -help for more options
-apt.opt.print=\
-    Print out textual representation of specified types
-apt.opt.nocompile=\
-    Do not compile source files to class files
-apt.opt.proc.flag=\
-    [key[=value]]
-apt.opt.version=\
-    Version information
-apt.opt.XListAnnotationTypes=\
-    List found annotation types
-apt.opt.XListDeclarations=\
-    List specified and included declarations
-apt.opt.XPrintAptRounds=\
-    Print information about initial and recursive apt rounds
-apt.opt.XPrintFactoryInfo=\
-    Print information about which annotations a factory is asked to process
-apt.opt.XClassesAsDecls=\
-    Treat both class and source files as declarations to process
-
-##
-## errors
-##
-
-## All errors which do not refer to a particular line in the source code are
-## preceded by this string.
-
-apt.err.error=\
-    error:\u0020
-
-apt.err.unsupported.source.version=\
-    Source release {0} is not supported; use release 5 or earlier
-
-apt.err.unsupported.target.version=\
-    Target release {0} is not supported; use release 5 or earlier
-
-apt.err.BadDeclaration=\
-    Bad declaration created for annotation type {0}
-
-apt.err.CantFindClass=\
-    Could not find class file for {0}
-
-apt.err.DeclarationCreation=\
-    Could not create declaration for annotation type {0}
-
-# Print an error from the Messager
-apt.err.Messager=\
-    {0}
-
-##
-## miscellaneous strings
-##
-
-apt.misc.Deprecation=\
-    \nwarning:\u0020The apt tool and its associated API are planned to be\n\
-    removed in the next major JDK release.  These features have been\n\
-    superseded by javac and the standardized annotation processing API,\n\
-    javax.annotation.processing and javax.lang.model.  Users are\n\
-    recommended to migrate to the annotation processing features of\n\
-    javac; see the javac man page for more information.\n
-
-apt.misc.Problem=\
-    Problem encountered during annotation processing; \nsee stacktrace below for more information.
-
-apt.misc.SunMiscService=\
-    Error finding annotation processor factories; \ncheck META-INF/services information.
-
-# Print a notice from the Messager
-apt.note.Messager=\
-    {0}
-
-##
-## warnings
-##
-
-## All warning messages are preceded by the following string.
-apt.warn.warning=\
-    warning:\u0020
-
-apt.warn.AnnotationsWithoutProcessors=\
-    Annotation types without processors: {0}
-
-apt.warn.BadFactory=\
-    Bad annotation processor factory: {0} 
-
-apt.warn.BadParentDirectory=\
-    Failed to create some parent directory of {0} 
-
-apt.warn.FactoryCantInstantiate=\
-    Could not instantiate an instance of factory ''{0}''.
-
-apt.warn.FactoryWrongType=\
-    Specified factory, ''{0}'', is not an AnnotationProcessorFactory.
-
-apt.warn.FactoryNotFound=\
-    Specified AnnotationProcessorFactory, ''{0}'', not found on search path.
-
-apt.warn.FileReopening=\
-    Attempt to create ''{0}'' multiple times
-
-apt.warn.IllegalFileName=\
-    Cannot create file for illegal name ''{0}''.
-
-apt.warn.MalformedSupportedString=\
-    Malformed string for annotation support, ''{0}'', returned by factory.
-
-apt.warn.NoNewFilesAfterRound=\
-    Cannot create file ''{0}'' after a round has ended.
-
-# Print a warning from the Messager
-apt.warn.Messager=\
-    {0}
-
-apt.warn.NoAnnotationProcessors=\
-    No annotation processors found but annotations present.
-
-apt.warn.NullProcessor=\
-    Factory {0} returned null for an annotation processor.
-
-apt.warn.CorrespondingClassFile=\
-    A class file corresponding to source file ''{0}'' has already been created.
-
-apt.warn.CorrespondingSourceFile=\
-    A source file corresponding to class file ''{0}'' has already been created.
--- a/src/share/classes/com/sun/tools/apt/resources/apt_ja.properties	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-apt.msg.usage.header=\u4F7F\u7528\u65B9\u6CD5: {0} <apt and javac options> <source files>\n\u6B21\u306Eapt\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u3059:
-
-apt.msg.usage.footer=javac\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u3064\u3044\u3066\u306F\u3001javac -help\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-
-apt.msg.usage.nonstandard.footer=\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u3001\u8868\u793A\u5F62\u5F0F\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\n\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002
-
-apt.msg.bug=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3067\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002Bug Parade\u306B\u540C\u3058\u30D0\u30B0\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u306A\u3044\u3053\u3068\u3092\u3054\u78BA\u8A8D\u306E\u4E0A\u3001Java Developer Connection(http://java.sun.com/webapps/bugreport)\u3067\u30D0\u30B0\u306E\u767B\u9332\u3092\u304A\u9858\u3044\u3044\u305F\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306B\u306F\u3001\u305D\u306E\u30D7\u30ED\u30B0\u30E9\u30E0\u3068\u4E0B\u8A18\u306E\u8A3A\u65AD\u5185\u5BB9\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u3054\u5354\u529B\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\u3002
-
-## apt options
-
-apt.opt.A=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u306B\u6E21\u3055\u308C\u308B\u30AA\u30D7\u30B7\u30E7\u30F3
-apt.opt.arg.class=<class>
-apt.opt.arg.directory=\u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
-apt.opt.classpath=\u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304A\u3088\u3073\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
-apt.opt.d=\u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
-apt.opt.factory=\u4F7F\u7528\u3059\u308BAnnotationProcessorFactory\u306E\u540D\u524D\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u691C\u51FA\u51E6\u7406\u3092\u30D0\u30A4\u30D1\u30B9
-apt.opt.factorypath=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA\u306E\u691C\u7D22\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
-apt.opt.s=\u30D7\u30ED\u30BB\u30C3\u30B5\u304C\u751F\u6210\u3057\u305F\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
-apt.opt.help=\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B\u3002\u8A73\u7D30\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u3064\u3044\u3066\u306Fjavac -help\u3092\u53C2\u7167
-apt.opt.print=\u6307\u5B9A\u3057\u305F\u578B\u306E\u30C6\u30AD\u30B9\u30C8\u8868\u793A\u3092\u51FA\u529B\u3059\u308B
-apt.opt.nocompile=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306B\u30B3\u30F3\u30D1\u30A4\u30EB\u3057\u306A\u3044
-apt.opt.proc.flag=[key[=value]]
-apt.opt.version=\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831
-apt.opt.XListAnnotationTypes=\u898B\u3064\u304B\u3063\u305F\u6CE8\u91C8\u578B\u3092\u30EA\u30B9\u30C8\u3059\u308B
-apt.opt.XListDeclarations=\u6307\u5B9A\u3055\u308C\u305F\u5BA3\u8A00\u304A\u3088\u3073\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u5BA3\u8A00\u3092\u30EA\u30B9\u30C8\u3059\u308B
-apt.opt.XPrintAptRounds=\u521D\u671F\u304A\u3088\u3073\u518D\u5E30apt\u5F80\u5FA9\u306B\u3064\u3044\u3066\u306E\u60C5\u5831\u3092\u5370\u5237\u3059\u308B
-apt.opt.XPrintFactoryInfo=\u30D5\u30A1\u30AF\u30C8\u30EA\u304C\u51E6\u7406\u3092\u4F9D\u983C\u3055\u308C\u308B\u6CE8\u91C8\u306B\u3064\u3044\u3066\u306E\u60C5\u5831\u3092\u5370\u5237\u3059\u308B
-apt.opt.XClassesAsDecls=\u30AF\u30E9\u30B9\u3068\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4E21\u65B9\u3068\u3082\u51E6\u7406\u3059\u308B\u5BA3\u8A00\u3068\u3057\u3066\u51E6\u7406
-
-##
-## errors
-##
-
-## All errors which do not refer to a particular line in the source code are
-## preceded by this string.
-
-apt.err.error=\u30A8\u30E9\u30FC:\u0020
-
-apt.err.unsupported.source.version=\u30BD\u30FC\u30B9\u30FB\u30EA\u30EA\u30FC\u30B9{0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30EA\u30EA\u30FC\u30B95\u4EE5\u524D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
-
-apt.err.unsupported.target.version=\u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30EA\u30EA\u30FC\u30B9{0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30EA\u30EA\u30FC\u30B95\u4EE5\u524D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
-
-apt.err.BadDeclaration=\u6CE8\u91C8\u578B{0}\u7528\u306B\u4F5C\u6210\u3055\u308C\u305F\u7121\u52B9\u306A\u5BA3\u8A00\u3067\u3059
-
-apt.err.CantFindClass={0}\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-
-apt.err.DeclarationCreation=\u6CE8\u91C8\u578B{0}\u7528\u306B\u5BA3\u8A00\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-
-# Print an error from the Messager
-apt.err.Messager={0}
-
-##
-## miscellaneous strings
-##
-
-apt.misc.Deprecation=\n\u8B66\u544A: apt\u30C4\u30FC\u30EB\u3068\u30C4\u30FC\u30EB\u306B\u95A2\u9023\u4ED8\u3051\u3089\u308C\u305FAPI\u306F\u3001\u6B21\u56DE\u306EJDK\n\u30E1\u30B8\u30E3\u30FC\u30FB\u30EA\u30EA\u30FC\u30B9\u3067\u524A\u9664\u3055\u308C\u308B\u4E88\u5B9A\u3067\u3059\u3002\u3053\u308C\u3089\u306E\u6A5F\u80FD\u306Fjavac\u304A\u3088\u3073\n\u6A19\u6E96\u5316\u3055\u308C\u305F\u6CE8\u91C8\u51E6\u7406API\u306Ejavax.annotation.processing\u304A\u3088\u3073javax.lang.model\n\u306B\u3088\u3063\u3066\u7F6E\u304D\u63DB\u3048\u3089\u308C\u307E\u3057\u305F\u3002\u30E6\u30FC\u30B6\u30FC\u306Fjavac\u306E\u6CE8\u91C8\u51E6\u7406\u6A5F\u80FD\u306B\n\u79FB\u884C\u3059\u308B\u3053\u3068\u3092\u304A\u85A6\u3081\u3057\u307E\u3059\u3002\n\u8A73\u7D30\u306F\u3001javac man\u30DA\u30FC\u30B8\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
-
-apt.misc.Problem=\u6CE8\u91C8\u51E6\u7406\u4E2D\u306B\u554F\u984C\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u3001\u4E0B\u8A18\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-
-apt.misc.SunMiscService=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA\u306E\u691C\u7D22\u30A8\u30E9\u30FC\u3067\u3059\u3002\nMETA-INF/services\u5185\u306E\u60C5\u5831\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-
-# Print a notice from the Messager
-apt.note.Messager={0}
-
-##
-## warnings
-##
-
-## All warning messages are preceded by the following string.
-apt.warn.warning=\u8B66\u544A:
-
-apt.warn.AnnotationsWithoutProcessors=\u30D7\u30ED\u30BB\u30C3\u30B5\u306A\u3057\u306E\u6CE8\u91C8\u578B\u3067\u3059: {0}
-
-apt.warn.BadFactory=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA\u304C\u7121\u52B9\u3067\u3059: {0} 
-
-apt.warn.BadParentDirectory={0}\u306E\u3044\u304F\u3064\u304B\u306E\u89AA\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u4F5C\u6210\u306B\u5931\u6557\u3057\u307E\u3057\u305F 
-
-apt.warn.FactoryCantInstantiate=\u30D5\u30A1\u30AF\u30C8\u30EA''{0}''\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002
-
-apt.warn.FactoryWrongType=\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30AF\u30C8\u30EA''{0}''\u306FAnnotationProcessorFactory\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
-
-apt.warn.FactoryNotFound=\u6307\u5B9A\u3057\u305FAnnotationProcessorFactory ''{0}''\u306F\u691C\u7D22\u30D1\u30B9\u3067\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002
-
-apt.warn.FileReopening=''{0}''\u3092\u8907\u6570\u56DE\u4F5C\u6210\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059
-
-apt.warn.IllegalFileName=\u7121\u52B9\u306A\u540D\u524D''{0}''\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002
-
-apt.warn.MalformedSupportedString=\u30D5\u30A1\u30AF\u30C8\u30EA\u304C\u8FD4\u3057\u305F\u6CE8\u91C8\u30B5\u30DD\u30FC\u30C8''{0}''\u306E\u6587\u5B57\u5217\u304C\u4E0D\u6B63\u3067\u3059\u3002
-
-apt.warn.NoNewFilesAfterRound=\u5F80\u5FA9\u306E\u7D42\u4E86\u5F8C\u306B\u30D5\u30A1\u30A4\u30EB''{0}''\u3092\u4F5C\u6210\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
-
-# Print a warning from the Messager
-apt.warn.Messager={0}
-
-apt.warn.NoAnnotationProcessors=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u304C\u3001\u6CE8\u91C8\u306F\u5B58\u5728\u3057\u307E\u3059\u3002
-
-apt.warn.NullProcessor=\u30D5\u30A1\u30AF\u30C8\u30EA{0}\u304C\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u306Bnull\u3092\u8FD4\u3057\u307E\u3057\u305F\u3002
-
-apt.warn.CorrespondingClassFile=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB''{0}''\u306B\u5BFE\u5FDC\u3059\u308B\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u4F5C\u6210\u3055\u308C\u3066\u3044\u307E\u3059\u3002
-
-apt.warn.CorrespondingSourceFile=\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB''{0}''\u306B\u5BFE\u5FDC\u3059\u308B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u4F5C\u6210\u3055\u308C\u3066\u3044\u307E\u3059\u3002
--- a/src/share/classes/com/sun/tools/apt/resources/apt_zh_CN.properties	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-#
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-apt.msg.usage.header=\u7528\u6CD5: {0} <apt and javac options> <source files>\n\u5176\u4E2D, apt \u9009\u9879\u5305\u62EC:
-
-apt.msg.usage.footer=\u6709\u5173 javac \u9009\u9879\u7684\u4FE1\u606F, \u8BF7\u53C2\u9605 javac -help\u3002
-
-apt.msg.usage.nonstandard.footer=\u8FD9\u4E9B\u9009\u9879\u53CA\u5176\u8F93\u51FA\u683C\u5F0F\u90FD\u4E0D\u662F\u6807\u51C6\u7684, \n\u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002
-
-apt.msg.bug=apt ({0}) \u4E2D\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\u3002 \u5982\u679C\u5728 Bug Parade \u4E2D\u6CA1\u6709\u627E\u5230\u8BE5\u9519\u8BEF, \u8BF7\u5728 Java Developer Connection (http://java.sun.com/webapps/bugreport) \u4E2D\u5EFA\u7ACB Bug\u3002\u8BF7\u5728\u62A5\u544A\u4E2D\u9644\u4E0A\u60A8\u7684\u7A0B\u5E8F\u548C\u4EE5\u4E0B\u8BCA\u65AD\u4FE1\u606F\u3002\u8C22\u8C22\u3002
-
-## apt options
-
-apt.opt.A=\u4F20\u9012\u7ED9\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u7684\u9009\u9879
-apt.opt.arg.class=<\u7C7B>
-apt.opt.arg.directory=\u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
-apt.opt.classpath=\u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u548C\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u5DE5\u5382\u7684\u4F4D\u7F6E
-apt.opt.d=\u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
-apt.opt.factory=\u8981\u4F7F\u7528\u7684 AnnotationProcessorFactory \u7684\u540D\u79F0; \u7ED5\u8FC7\u9ED8\u8BA4\u7684\u641C\u7D22\u8FDB\u7A0B
-apt.opt.factorypath=\u6307\u5B9A\u67E5\u627E\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u5DE5\u5382\u7684\u4F4D\u7F6E
-apt.opt.s=\u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u751F\u6210\u7684\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E
-apt.opt.help=\u8F93\u51FA\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981; \u4F7F\u7528 javac -help \u53EF\u4EE5\u5F97\u5230\u66F4\u591A\u9009\u9879
-apt.opt.print=\u8F93\u51FA\u6307\u5B9A\u7C7B\u578B\u7684\u6587\u672C\u8868\u793A
-apt.opt.nocompile=\u8BF7\u52FF\u5C06\u6E90\u6587\u4EF6\u7F16\u8BD1\u4E3A\u7C7B\u6587\u4EF6
-apt.opt.proc.flag=[\u5173\u952E\u5B57[=\u503C]]
-apt.opt.version=\u7248\u672C\u4FE1\u606F
-apt.opt.XListAnnotationTypes=\u5217\u51FA\u627E\u5230\u7684\u6CE8\u91CA\u7C7B\u578B
-apt.opt.XListDeclarations=\u5217\u51FA\u6307\u5B9A\u548C\u5305\u542B\u7684\u58F0\u660E
-apt.opt.XPrintAptRounds=\u8F93\u51FA\u6709\u5173\u521D\u59CB\u548C\u9012\u5F52 apt \u5FAA\u73AF\u7684\u4FE1\u606F
-apt.opt.XPrintFactoryInfo=\u8F93\u51FA\u6709\u5173\u8BF7\u6C42\u5DE5\u5382\u5904\u7406\u54EA\u4E9B\u6CE8\u91CA\u7684\u4FE1\u606F
-apt.opt.XClassesAsDecls=\u5C06\u7C7B\u6587\u4EF6\u548C\u6E90\u6587\u4EF6\u90FD\u89C6\u4E3A\u8981\u5904\u7406\u7684\u58F0\u660E
-
-##
-## errors
-##
-
-## All errors which do not refer to a particular line in the source code are
-## preceded by this string.
-
-apt.err.error=\u9519\u8BEF:\u0020
-
-apt.err.unsupported.source.version=\u4E0D\u652F\u6301\u6E90\u53D1\u884C\u7248 {0}; \u8BF7\u4F7F\u7528\u53D1\u884C\u7248 5 \u6216\u65E9\u671F\u53D1\u884C\u7248
-
-apt.err.unsupported.target.version=\u4E0D\u652F\u6301\u76EE\u6807\u53D1\u884C\u7248 {0}; \u8BF7\u4F7F\u7528\u53D1\u884C\u7248 5 \u6216\u65E9\u671F\u53D1\u884C\u7248
-
-apt.err.BadDeclaration=\u4E3A\u6CE8\u91CA\u7C7B\u578B{0}\u521B\u5EFA\u7684\u58F0\u660E\u51FA\u73B0\u9519\u8BEF
-
-apt.err.CantFindClass=\u627E\u4E0D\u5230{0}\u7684\u7C7B\u6587\u4EF6
-
-apt.err.DeclarationCreation=\u65E0\u6CD5\u4E3A\u6CE8\u91CA\u7C7B\u578B{0}\u521B\u5EFA\u58F0\u660E
-
-# Print an error from the Messager
-apt.err.Messager={0}
-
-##
-## miscellaneous strings
-##
-
-apt.misc.Deprecation=\n\u8B66\u544A:\u0020\u5DF2\u8BA1\u5212\u5728\u4E0B\u4E00\u4E2A JDK \u4E3B\u53D1\u884C\u7248\u4E2D\n\u5220\u9664 apt \u5DE5\u5177\u53CA\u5176\u5173\u8054\u7684 API\u3002\u8FD9\u4E9B\u529F\u80FD\n\u5DF2\u88AB javac \u548C\u6807\u51C6\u6CE8\u91CA\u5904\u7406 API,\njavax.annotation.processing \u548C javax.lang.model \u53D6\u4EE3\u3002\u5EFA\u8BAE\u7528\u6237\n\u79FB\u690D\u5230 javac \u7684\u6CE8\u91CA\u5904\u7406\u529F\u80FD;\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605 javac \u5E2E\u52A9\u9875\u3002\n
-
-apt.misc.Problem=\u6CE8\u91CA\u5904\u7406\u8FC7\u7A0B\u4E2D\u9047\u5230\u95EE\u9898; \n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605\u4E0B\u9762\u7684\u5806\u6808\u8DDF\u8E2A\u3002
-
-apt.misc.SunMiscService=\u67E5\u627E\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u5DE5\u5382\u65F6\u51FA\u9519; \n\u8BF7\u67E5\u770B META-INF/\u670D\u52A1\u4FE1\u606F\u3002
-
-# Print a notice from the Messager
-apt.note.Messager={0}
-
-##
-## warnings
-##
-
-## All warning messages are preceded by the following string.
-apt.warn.warning=\u8B66\u544A:\u0020
-
-apt.warn.AnnotationsWithoutProcessors=\u4E0D\u5E26\u5904\u7406\u7A0B\u5E8F\u7684\u6CE8\u91CA\u7C7B\u578B: {0}
-
-apt.warn.BadFactory=\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u5DE5\u5382\u51FA\u73B0\u9519\u8BEF: {0} 
-
-apt.warn.BadParentDirectory=\u65E0\u6CD5\u521B\u5EFA{0}\u7684\u67D0\u4E9B\u7236\u76EE\u5F55 
-
-apt.warn.FactoryCantInstantiate=\u65E0\u6CD5\u5B9E\u4F8B\u5316\u5DE5\u5382 ''{0}'' \u7684\u5B9E\u4F8B\u3002
-
-apt.warn.FactoryWrongType=\u6307\u5B9A\u7684\u5DE5\u5382 ''{0}'' \u4E0D\u662F AnnotationProcessorFactory\u3002
-
-apt.warn.FactoryNotFound=\u5728\u641C\u7D22\u8DEF\u5F84\u4E2D\u627E\u4E0D\u5230\u6307\u5B9A\u7684 AnnotationProcessorFactory ''{0}''\u3002
-
-apt.warn.FileReopening=\u5C1D\u8BD5\u591A\u6B21\u521B\u5EFA ''{0}''
-
-apt.warn.IllegalFileName=\u65E0\u6CD5\u521B\u5EFA\u5E26\u6709\u975E\u6CD5\u540D\u79F0 ''{0}'' \u7684\u6587\u4EF6\u3002
-
-apt.warn.MalformedSupportedString=\u5DE5\u5382\u8FD4\u56DE\u683C\u5F0F\u9519\u8BEF\u7684\u6CE8\u91CA\u652F\u6301\u5B57\u7B26\u4E32 ''{0}''\u3002
-
-apt.warn.NoNewFilesAfterRound=\u5FAA\u73AF\u7ED3\u675F\u540E\u65E0\u6CD5\u521B\u5EFA\u6587\u4EF6 ''{0}''\u3002
-
-# Print a warning from the Messager
-apt.warn.Messager={0}
-
-apt.warn.NoAnnotationProcessors=\u627E\u4E0D\u5230\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F, \u4F46\u5B58\u5728\u6CE8\u91CA\u3002
-
-apt.warn.NullProcessor=\u5BF9\u4E8E\u67D0\u4E2A\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F, \u5DE5\u5382{0}\u8FD4\u56DE\u7684\u503C\u4E3A\u7A7A\u503C\u3002
-
-apt.warn.CorrespondingClassFile=\u5DF2\u521B\u5EFA\u4E0E\u6E90\u6587\u4EF6 ''{0}'' \u76F8\u5BF9\u5E94\u7684\u7C7B\u6587\u4EF6\u3002
-
-apt.warn.CorrespondingSourceFile=\u5DF2\u521B\u5EFA\u4E0E\u7C7B\u6587\u4EF6 ''{0}'' \u76F8\u5BF9\u5E94\u7684\u6E90\u6587\u4EF6\u3002
--- a/src/share/classes/com/sun/tools/apt/util/Bark.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.apt.util;
-
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.JCDiagnostic;
-import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.JavacMessages;
-import com.sun.tools.javac.util.Position;
-
-/** A subtype of Log for use in APT.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class Bark extends Log {
-    /** The context key for the bark. */
-    protected static final Context.Key<Bark> barkKey =
-        new Context.Key<Bark>();
-
-    /**
-     * Preregisters factories to create and use a Bark object for use as
-     * both a Log and a Bark.
-     */
-    public static void preRegister(Context context) {
-        context.put(barkKey, new Context.Factory<Bark>() {
-            public Bark make(Context c) {
-                return new Bark(c);
-            }
-        });
-        context.put(Log.logKey, new Context.Factory<Log>() {
-            public Log make(Context c) {
-                return Bark.instance(c);
-            }
-        });
-    }
-
-    /** Get the Bark instance for this context. */
-    public static Bark instance(Context context) {
-        Bark instance = context.get(barkKey);
-        if (instance == null)
-            instance = new Bark(context);
-        return instance;
-    }
-
-    /** Specifies whether or not to ignore any diagnostics that are reported.
-     */
-    private boolean ignoreDiagnostics;
-
-    /**
-     * Factory for APT-specific diagnostics.
-     */
-    private JCDiagnostic.Factory aptDiags;
-
-
-    /**
-     * Creates a Bark.
-     */
-    protected Bark(Context context) {
-        super(context); // will register this object in context with Log.logKey
-        context.put(barkKey, this);
-
-        // register additional resource bundle for APT messages.
-        JavacMessages aptMessages = JavacMessages.instance(context);
-        aptMessages.add("com.sun.tools.apt.resources.apt");
-        aptDiags = new JCDiagnostic.Factory(aptMessages, "apt");
-
-        multipleErrors = true;
-    }
-
-    /**
-     * Sets a flag indicating whether or not to ignore all diagnostics.
-     * When ignored, they are not reported to the output writers, not are they
-     * counted in the various counters.
-     * @param b If true, subsequent diagnostics will be ignored.
-     * @return the previous state of the flag
-     */
-    public boolean setDiagnosticsIgnored(boolean b) {
-        boolean prev = ignoreDiagnostics;
-        ignoreDiagnostics = b;
-        return prev;
-    }
-
-    /**
-     * Report a diagnostic if they are not currently being ignored.
-     */
-    @Override
-    public void report(JCDiagnostic diagnostic) {
-        if (ignoreDiagnostics)
-            return;
-
-        super.report(diagnostic);
-    }
-
-    /** Report an error.
-     *  @param key    The key for the localized error message.
-     *  @param args   Fields of the error message.
-     */
-    public void aptError(String key, Object... args) {
-        aptError(Position.NOPOS, key, args);
-    }
-
-    /** Report an error, unless another error was already reported at same
-     *  source position.
-     *  @param pos    The source position at which to report the error.
-     *  @param key    The key for the localized error message.
-     *  @param args   Fields of the error message.
-     */
-    public void aptError(int pos, String key, Object ... args) {
-        report(aptDiags.error(source, new SimpleDiagnosticPosition(pos), key, args));
-    }
-
-    /** Report a warning, unless suppressed by the  -nowarn option or the
-     *  maximum number of warnings has been reached.
-     *  @param key    The key for the localized warning message.
-     *  @param args   Fields of the warning message.
-     */
-    public void aptWarning(String key, Object... args) {
-        aptWarning(Position.NOPOS, key, args);
-    }
-
-    /** Report a warning, unless suppressed by the  -nowarn option or the
-     *  maximum number of warnings has been reached.
-     *  @param pos    The source position at which to report the warning.
-     *  @param key    The key for the localized warning message.
-     *  @param args   Fields of the warning message.
-     */
-    public void aptWarning(int pos, String key, Object ... args) {
-        report(aptDiags.warning(source, new SimpleDiagnosticPosition(pos), key, args));
-    }
-
-    /** Report a note, unless suppressed by the  -nowarn option.
-     *  @param key    The key for the localized note message.
-     *  @param args   Fields of the note message.
-     */
-    public void aptNote(String key, Object... args) {
-        aptNote(Position.NOPOS, key, args);
-    }
-
-    /** Report a note, unless suppressed by the  -nowarn option.
-     *  @param pos    The source position at which to report the note.
-     *  @param key    The key for the localized note message.
-     *  @param args   Fields of the note message.
-     */
-    public void aptNote(int pos, String key, Object ... args) {
-        report(aptDiags.note(source, new SimpleDiagnosticPosition(pos), key, args));
-    }
-}
--- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Tue May 29 00:27:58 2012 +0100
@@ -216,6 +216,7 @@
 doclet.Same_package_name_used=Package name format used twice: {0}
 doclet.Serialization.Excluded_Class=Non-transient field {1} uses excluded class {0}.
 doclet.Serialization.Nonexcluded_Class=Non-transient field {1} uses hidden, non-included class {0}.
+doclet.exception_encountered=Exception encountered while processing {1}\n{0}
 doclet.usage=Provided by Standard doclet:\n\
   -d <directory>                    Destination directory for output files\n\
   -use                              Create class and package usage pages\n\
--- a/src/share/classes/com/sun/tools/doclets/package.html	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/doclets/package.html	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,6 @@
 </head>
 <body bgcolor="white">
         As of JDK version 1.5, replaced by 
-        {@link com.sun.tools.doclets.internal.toolkit.util}.
+        {@code com.sun.tools.doclets.internal.toolkit.util}.
     </body>
 </html>
--- a/src/share/classes/com/sun/tools/javac/Launcher.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac;
-
-import java.io.File;
-import java.util.prefs.Preferences;
-import javax.swing.JFileChooser;
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
-
-
-/**
- * <b>Unsupported</b> entry point for starting javac from an IDE.
- *
- * <p><b>Note:</b> this class is not available in the JDK.  It is not
- * compiled by default and will not be in tools.jar.  It is designed
- * to be useful when editing the compiler sources in an IDE (as part
- * of a <em>project</em>).  Simply ensure that this class is added to
- * the project and make it the main class of the project.</p>
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk.  This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- *
- * @author Peter von der Ah&eacute;
- * @since 1.6
- */
-class Launcher {
-    public static void main(String... args) {
-        JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
-        JFileChooser fileChooser;
-        Preferences prefs = Preferences.userNodeForPackage(Launcher.class);
-        if (args.length > 0)
-            fileChooser = new JFileChooser(args[0]);
-        else {
-            String fileName = prefs.get("recent.file", null);
-            fileChooser = new JFileChooser();
-            if (fileName != null) {
-                fileChooser = new JFileChooser();
-                fileChooser.setSelectedFile(new File(fileName));
-            }
-        }
-        if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
-            String fileName = fileChooser.getSelectedFile().getPath();
-            prefs.put("recent.file", fileName);
-            javac.run(System.in, null, null, "-d", "/tmp", fileName);
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/javac/Main.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/Main.java	Tue May 29 00:27:58 2012 +0100
@@ -73,7 +73,7 @@
     public static int compile(String[] args) {
         com.sun.tools.javac.main.Main compiler =
             new com.sun.tools.javac.main.Main("javac");
-        return compiler.compile(args);
+        return compiler.compile(args).exitCode;
     }
 
 
@@ -91,6 +91,6 @@
     public static int compile(String[] args, PrintWriter out) {
         com.sun.tools.javac.main.Main compiler =
             new com.sun.tools.javac.main.Main("javac", out);
-        return compiler.compile(args);
+        return compiler.compile(args).exitCode;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.api;
+
+import java.io.IOException;
+import java.util.Locale;
+
+import javax.annotation.processing.Processor;
+import javax.lang.model.element.Element;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+import javax.tools.JavaFileObject;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.model.JavacElements;
+import com.sun.tools.javac.model.JavacTypes;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.Context;
+import java.util.Collection;
+
+/**
+ * Provides basic functionality for implementations of JavacTask.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public class BasicJavacTask extends JavacTask {
+    protected Context context;
+    private TaskListener taskListener;
+
+    public BasicJavacTask(Context c, boolean register) {
+        context = c;
+        if (register)
+            context.put(JavacTask.class, this);
+    }
+
+    @Override
+    public Iterable<? extends CompilationUnitTree> parse() throws IOException {
+        throw new IllegalStateException();
+    }
+
+    @Override
+    public Iterable<? extends Element> analyze() throws IOException {
+        throw new IllegalStateException();
+    }
+
+    @Override
+    public Iterable<? extends JavaFileObject> generate() throws IOException {
+        throw new IllegalStateException();
+    }
+
+    @Override
+    public void setTaskListener(TaskListener tl) {
+        MultiTaskListener mtl = MultiTaskListener.instance(context);
+        if (taskListener != null)
+            mtl.remove(taskListener);
+        if (tl != null)
+            mtl.add(tl);
+        taskListener = tl;
+    }
+
+    @Override
+    public void addTaskListener(TaskListener taskListener) {
+        MultiTaskListener mtl = MultiTaskListener.instance(context);
+        mtl.add(taskListener);
+    }
+
+    @Override
+    public void removeTaskListener(TaskListener taskListener) {
+        MultiTaskListener mtl = MultiTaskListener.instance(context);
+        mtl.remove(taskListener);
+    }
+
+    public Collection<TaskListener> getTaskListeners() {
+        MultiTaskListener mtl = MultiTaskListener.instance(context);
+        return mtl.getTaskListeners();
+    }
+
+    @Override
+    public TypeMirror getTypeMirror(Iterable<? extends Tree> path) {
+        // TODO: Should complete attribution if necessary
+        Tree last = null;
+        for (Tree node : path)
+            last = node;
+        return ((JCTree)last).type;
+    }
+
+    @Override
+    public Elements getElements() {
+        return JavacElements.instance(context);
+    }
+
+    @Override
+    public Types getTypes() {
+        return JavacTypes.instance(context);
+    }
+
+    public void setProcessors(Iterable<? extends Processor> processors) {
+        throw new IllegalStateException();
+    }
+
+    public void setLocale(Locale locale) {
+        throw new IllegalStateException();
+    }
+
+    public Boolean call() {
+        throw new IllegalStateException();
+    }
+
+}
--- a/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,33 +31,36 @@
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
+import javax.lang.model.element.Modifier;
 import javax.lang.model.element.NestingKind;
 import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
 import javax.tools.FileObject;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileManager.Location;
 import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
 
 import com.sun.source.util.TaskEvent;
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import javax.lang.model.element.Modifier;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileObject.Kind;
+import com.sun.tools.javac.util.JCDiagnostic;
 
 /**
  *  Wrap objects to enable unchecked exceptions to be caught and handled.
@@ -146,7 +149,7 @@
             return fo;
     }
 
-    <T> DiagnosticListener<T> wrap(DiagnosticListener<T> dl) {
+    <T /*super JavaFileOject*/> DiagnosticListener<T> wrap(DiagnosticListener<T> dl) {
         if (isTrusted(dl))
             return dl;
         return new WrappedDiagnosticListener<T>(dl);
@@ -158,6 +161,30 @@
         return new WrappedTaskListener(tl);
     }
 
+    TaskListener unwrap(TaskListener l) {
+        if (l instanceof WrappedTaskListener)
+            return ((WrappedTaskListener) l).clientTaskListener;
+        else
+            return l;
+    }
+
+    Collection<TaskListener> unwrap(Collection<? extends TaskListener> listeners) {
+        Collection<TaskListener> c = new ArrayList<TaskListener>(listeners.size());
+        for (TaskListener l: listeners)
+            c.add(unwrap(l));
+        return c;
+    }
+
+    @SuppressWarnings("unchecked")
+    private <T> Diagnostic<T> unwrap(final Diagnostic<T> diagnostic) {
+        if (diagnostic instanceof JCDiagnostic) {
+            JCDiagnostic d = (JCDiagnostic) diagnostic;
+            return (Diagnostic<T>) new DiagnosticSourceUnwrapper(d);
+        } else {
+            return diagnostic;
+        }
+    }
+
     protected boolean isTrusted(Object o) {
         Class<?> c = o.getClass();
         Boolean trusted = trustedClasses.get(c);
@@ -169,6 +196,10 @@
         return trusted;
     }
 
+    private String wrappedToString(Class<?> wrapperClass, Object wrapped) {
+        return wrapperClass.getSimpleName() + "[" + wrapped + "]";
+    }
+
     // <editor-fold defaultstate="collapsed" desc="Wrapper classes">
 
     // FIXME: all these classes should be converted to use multi-catch when
@@ -349,6 +380,11 @@
                 throw new ClientCodeException(e);
             }
         }
+
+        @Override
+        public String toString() {
+            return wrappedToString(getClass(), clientJavaFileManager);
+        }
     }
 
     protected class WrappedFileObject implements FileObject {
@@ -474,6 +510,11 @@
                 throw new ClientCodeException(e);
             }
         }
+
+        @Override
+        public String toString() {
+            return wrappedToString(getClass(), clientFileObject);
+        }
     }
 
     protected class WrappedJavaFileObject extends WrappedFileObject implements JavaFileObject {
@@ -532,9 +573,14 @@
                 throw new ClientCodeException(e);
             }
         }
+
+        @Override
+        public String toString() {
+            return wrappedToString(getClass(), clientFileObject);
+        }
     }
 
-    protected class WrappedDiagnosticListener<T> implements DiagnosticListener<T> {
+    protected class WrappedDiagnosticListener<T /*super JavaFileObject*/> implements DiagnosticListener<T> {
         protected DiagnosticListener<T> clientDiagnosticListener;
         WrappedDiagnosticListener(DiagnosticListener<T> clientDiagnosticListener) {
             clientDiagnosticListener.getClass(); // null check
@@ -544,7 +590,7 @@
         @Override
         public void report(Diagnostic<? extends T> diagnostic) {
             try {
-                clientDiagnosticListener.report(diagnostic);
+                clientDiagnosticListener.report(unwrap(diagnostic));
             } catch (ClientCodeException e) {
                 throw e;
             } catch (RuntimeException e) {
@@ -553,6 +599,60 @@
                 throw new ClientCodeException(e);
             }
         }
+
+        @Override
+        public String toString() {
+            return wrappedToString(getClass(), clientDiagnosticListener);
+        }
+    }
+
+    public class DiagnosticSourceUnwrapper implements Diagnostic<JavaFileObject> {
+        public final JCDiagnostic d;
+
+        DiagnosticSourceUnwrapper(JCDiagnostic d) {
+            this.d = d;
+        }
+
+        public Diagnostic.Kind getKind() {
+            return d.getKind();
+        }
+
+        public JavaFileObject getSource() {
+            return unwrap(d.getSource());
+        }
+
+        public long getPosition() {
+            return d.getPosition();
+        }
+
+        public long getStartPosition() {
+            return d.getStartPosition();
+        }
+
+        public long getEndPosition() {
+            return d.getEndPosition();
+        }
+
+        public long getLineNumber() {
+            return d.getLineNumber();
+        }
+
+        public long getColumnNumber() {
+            return d.getColumnNumber();
+        }
+
+        public String getCode() {
+            return d.getCode();
+        }
+
+        public String getMessage(Locale locale) {
+            return d.getMessage(locale);
+        }
+
+        @Override
+        public String toString() {
+            return d.toString();
+        }
     }
 
     protected class WrappedTaskListener implements TaskListener {
@@ -587,6 +687,11 @@
                 throw new ClientCodeException(e);
             }
         }
+
+        @Override
+        public String toString() {
+            return wrappedToString(getClass(), clientTaskListener);
+        }
     }
 
     // </editor-fold>
--- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,7 @@
 import com.sun.tools.javac.comp.*;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.main.*;
+import com.sun.tools.javac.main.JavaCompiler;
 import com.sun.tools.javac.model.*;
 import com.sun.tools.javac.parser.Parser;
 import com.sun.tools.javac.parser.ParserFactory;
@@ -51,7 +52,6 @@
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.main.JavaCompiler;
 
 /**
  * Provides access to functionality specific to the JDK Java Compiler, javac.
@@ -64,29 +64,31 @@
  * @author Peter von der Ah&eacute;
  * @author Jonathan Gibbons
  */
-public class JavacTaskImpl extends JavacTask {
+public class JavacTaskImpl extends BasicJavacTask {
     private ClientCodeWrapper ccw;
     private Main compilerMain;
     private JavaCompiler compiler;
     private Locale locale;
     private String[] args;
-    private Context context;
+    private String[] classNames;
     private List<JavaFileObject> fileObjects;
     private Map<JavaFileObject, JCCompilationUnit> notYetEntered;
     private ListBuffer<Env<AttrContext>> genList;
-    private TaskListener taskListener;
     private AtomicBoolean used = new AtomicBoolean();
     private Iterable<? extends Processor> processors;
 
-    private Integer result = null;
+    private Main.Result result = null;
 
     JavacTaskImpl(Main compilerMain,
                 String[] args,
+                String[] classNames,
                 Context context,
                 List<JavaFileObject> fileObjects) {
+        super(null, false);
         this.ccw = ClientCodeWrapper.instance(context);
         this.compilerMain = compilerMain;
         this.args = args;
+        this.classNames = classNames;
         this.context = context;
         this.fileObjects = fileObjects;
         setLocale(Locale.getDefault());
@@ -101,17 +103,14 @@
                 Context context,
                 Iterable<String> classes,
                 Iterable<? extends JavaFileObject> fileObjects) {
-        this(compilerMain, toArray(flags, classes), context, toList(fileObjects));
+        this(compilerMain, toArray(flags), toArray(classes), context, toList(fileObjects));
     }
 
-    static private String[] toArray(Iterable<String> flags, Iterable<String> classes) {
+    static private String[] toArray(Iterable<String> iter) {
         ListBuffer<String> result = new ListBuffer<String>();
-        if (flags != null)
-            for (String flag : flags)
-                result.append(flag);
-        if (classes != null)
-            for (String cls : classes)
-                result.append(cls);
+        if (iter != null)
+            for (String s : iter)
+                result.append(s);
         return result.toArray(new String[result.length()]);
     }
 
@@ -129,9 +128,9 @@
             initContext();
             notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
             compilerMain.setAPIMode(true);
-            result = compilerMain.compile(args, context, fileObjects, processors);
+            result = compilerMain.compile(args, classNames, context, fileObjects, processors);
             cleanup();
-            return result == 0;
+            return result.isOK();
         } else {
             throw new IllegalStateException("multiple calls to method 'call'");
         }
@@ -158,10 +157,10 @@
         } else {
             initContext();
             compilerMain.setOptions(Options.instance(context));
-            compilerMain.filenames = new ListBuffer<File>();
-            List<File> filenames = compilerMain.processArgs(CommandLine.parse(args));
+            compilerMain.filenames = new LinkedHashSet<File>();
+            Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
             if (!filenames.isEmpty())
-                throw new IllegalArgumentException("Malformed arguments " + filenames.toString(" "));
+                throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
             compiler = JavaCompiler.instance(context);
             compiler.keepComments = true;
             compiler.genEndPos = true;
@@ -174,15 +173,23 @@
             // endContext will be called when all classes have been generated
             // TODO: should handle the case after each phase if errors have occurred
             args = null;
+            classNames = null;
         }
     }
 
+    <T> String toString(Iterable<T> items, String sep) {
+        String currSep = "";
+        StringBuilder sb = new StringBuilder();
+        for (T item: items) {
+            sb.append(currSep);
+            sb.append(item.toString());
+            currSep = sep;
+        }
+        return sb.toString();
+    }
+
     private void initContext() {
-        context.put(JavacTaskImpl.class, this);
-        if (context.get(TaskListener.class) != null)
-            context.put(TaskListener.class, (TaskListener)null);
-        if (taskListener != null)
-            context.put(TaskListener.class, ccw.wrap(taskListener));
+        context.put(JavacTask.class, this);
         //initialize compiler's default locale
         context.put(Locale.class, locale);
     }
@@ -193,6 +200,7 @@
         compiler = null;
         compilerMain = null;
         args = null;
+        classNames = null;
         context = null;
         fileObjects = null;
         notYetEntered = null;
@@ -211,10 +219,6 @@
         return fm.getRegularFile(file);
     }
 
-    public void setTaskListener(TaskListener taskListener) {
-        this.taskListener = taskListener;
-    }
-
     /**
      * Parse the specified files returning a list of abstract syntax trees.
      *
@@ -263,6 +267,9 @@
     public Iterable<? extends TypeElement> enter(Iterable<? extends CompilationUnitTree> trees)
         throws IOException
     {
+        if (trees == null && notYetEntered != null && notYetEntered.isEmpty())
+            return List.nil();
+
         prepareCompiler();
 
         ListBuffer<JCCompilationUnit> roots = null;
@@ -311,7 +318,7 @@
             ListBuffer<TypeElement> elements = new ListBuffer<TypeElement>();
             for (JCCompilationUnit unit : units) {
                 for (JCTree node : unit.defs) {
-                    if (node.getTag() == JCTree.CLASSDEF) {
+                    if (node.hasTag(JCTree.Tag.CLASSDEF)) {
                         JCClassDecl cdef = (JCClassDecl) node;
                         if (cdef.sym != null) // maybe null if errors in anno processing
                             elements.append(cdef.sym);
@@ -369,12 +376,12 @@
         private void handleFlowResults(Queue<Env<AttrContext>> queue, ListBuffer<Element> elems) {
             for (Env<AttrContext> env: queue) {
                 switch (env.tree.getTag()) {
-                    case JCTree.CLASSDEF:
+                    case CLASSDEF:
                         JCClassDecl cdef = (JCClassDecl) env.tree;
                         if (cdef.sym != null)
                             elems.append(cdef.sym);
                         break;
-                    case JCTree.TOPLEVEL:
+                    case TOPLEVEL:
                         JCCompilationUnit unit = (JCCompilationUnit) env.tree;
                         if (unit.packge != null)
                             elems.append(unit.packge);
--- a/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Tue May 29 00:27:58 2012 +0100
@@ -25,18 +25,15 @@
 
 package com.sun.tools.javac.api;
 
-import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.Writer;
 import java.nio.charset.Charset;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 import javax.lang.model.SourceVersion;
@@ -44,16 +41,15 @@
 
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.main.JavacOption.OptionKind;
-import com.sun.tools.javac.main.JavacOption;
 import com.sun.tools.javac.main.Main;
-import com.sun.tools.javac.main.RecognizedOptions.GrumpyHelper;
-import com.sun.tools.javac.main.RecognizedOptions;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.main.OptionHelper;
+import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Log.PrefixKind;
 import com.sun.tools.javac.util.Options;
-import com.sun.tools.javac.util.Pair;
 
 /**
  * TODO: describe com.sun.tools.javac.api.Tool
@@ -66,23 +62,10 @@
  * @author Peter von der Ah\u00e9
  */
 public final class JavacTool implements JavaCompiler {
-    private final List<Pair<String,String>> options
-        = new ArrayList<Pair<String,String>>();
-    private final Context dummyContext = new Context();
-
-    private final PrintWriter silent = new PrintWriter(new OutputStream(){
-        public void write(int b) {}
-    });
-
-    private final Main sharedCompiler = new Main("javac", silent);
-    {
-        sharedCompiler.setOptions(Options.instance(dummyContext));
-    }
-
     /**
-     * Constructor used by service provider mechanism.  The correct way to
-     * obtain an instance of this class is using create or the service provider
-     * mechanism.
+     * Constructor used by service provider mechanism.  The recommended way to
+     * obtain an instance of this class is by using {@link #create} or the
+     * service provider mechanism.
      * @see javax.tools.JavaCompilerTool
      * @see javax.tools.ToolProvider
      * @see #create
@@ -98,49 +81,6 @@
         return new JavacTool();
     }
 
-    private String argsToString(Object... args) {
-        String newArgs = null;
-        if (args.length > 0) {
-            StringBuilder sb = new StringBuilder();
-            String separator = "";
-            for (Object arg : args) {
-                sb.append(separator).append(arg.toString());
-                separator = File.pathSeparator;
-            }
-            newArgs = sb.toString();
-        }
-        return newArgs;
-    }
-
-    private void setOption1(String name, OptionKind kind, Object... args) {
-        String arg = argsToString(args);
-        JavacOption option = sharedCompiler.getOption(name);
-        if (option == null || !match(kind, option.getKind()))
-            throw new IllegalArgumentException(name);
-        if ((args.length != 0) != option.hasArg())
-            throw new IllegalArgumentException(name);
-        if (option.hasArg()) {
-            if (option.process(null, name, arg)) // FIXME
-                throw new IllegalArgumentException(name);
-        } else {
-            if (option.process(null, name)) // FIXME
-                throw new IllegalArgumentException(name);
-        }
-        options.add(new Pair<String,String>(name,arg));
-    }
-
-    public void setOption(String name, Object... args) {
-        setOption1(name, OptionKind.NORMAL, args);
-    }
-
-    public void setExtendedOption(String name, Object... args)  {
-        setOption1(name, OptionKind.EXTENDED, args);
-    }
-
-    private static boolean match(OptionKind clientKind, OptionKind optionKind) {
-        return (clientKind == (optionKind == OptionKind.HIDDEN ? OptionKind.EXTENDED : optionKind));
-    }
-
     public JavacFileManager getStandardFileManager(
         DiagnosticListener<? super JavaFileObject> diagnosticListener,
         Locale locale,
@@ -156,15 +96,28 @@
         return new JavacFileManager(context, true, charset);
     }
 
+    @Override
     public JavacTask getTask(Writer out,
                              JavaFileManager fileManager,
                              DiagnosticListener<? super JavaFileObject> diagnosticListener,
                              Iterable<String> options,
                              Iterable<String> classes,
-                             Iterable<? extends JavaFileObject> compilationUnits)
+                             Iterable<? extends JavaFileObject> compilationUnits) {
+        Context context = new Context();
+        return getTask(out, fileManager, diagnosticListener,
+                options, classes, compilationUnits,
+                context);
+    }
+
+    public JavacTask getTask(Writer out,
+                             JavaFileManager fileManager,
+                             DiagnosticListener<? super JavaFileObject> diagnosticListener,
+                             Iterable<String> options,
+                             Iterable<String> classes,
+                             Iterable<? extends JavaFileObject> compilationUnits,
+                             Context context)
     {
         try {
-            Context context = new Context();
             ClientCodeWrapper ccw = ClientCodeWrapper.instance(context);
 
             final String kindMsg = "All compilation units must be of SOURCE kind";
@@ -195,7 +148,9 @@
             if (fileManager == null)
                 fileManager = getStandardFileManager(diagnosticListener, null, null);
             fileManager = ccw.wrap(fileManager);
+
             context.put(JavaFileManager.class, fileManager);
+
             processOptions(context, fileManager, options);
             Main compiler = new Main("javacTask", context.get(Log.outKey));
             return new JavacTaskImpl(compiler, options, context, classes, compilationUnits);
@@ -211,10 +166,28 @@
         if (options == null)
             return;
 
-        Options optionTable = Options.instance(context);
+        final Options optionTable = Options.instance(context);
+        Log log = Log.instance(context);
+
+        Option[] recognizedOptions =
+                Option.getJavacToolOptions().toArray(new Option[0]);
+        OptionHelper optionHelper = new GrumpyHelper(log) {
+            @Override
+            public String get(Option option) {
+                return optionTable.get(option.getText());
+            }
 
-        JavacOption[] recognizedOptions =
-            RecognizedOptions.getJavacToolOptions(new GrumpyHelper());
+            @Override
+            public void put(String name, String value) {
+                optionTable.put(name, value);
+            }
+
+            @Override
+            public void remove(String name) {
+                optionTable.remove(name);
+            }
+        };
+
         Iterator<String> flags = options.iterator();
         while (flags.hasNext()) {
             String flag = flags.next();
@@ -227,29 +200,31 @@
                 if (fileManager.handleOption(flag, flags)) {
                     continue;
                 } else {
-                    String msg = Main.getLocalizedString("err.invalid.flag", flag);
+                    String msg = log.localize(PrefixKind.JAVAC, "err.invalid.flag", flag);
                     throw new IllegalArgumentException(msg);
                 }
             }
 
-            JavacOption option = recognizedOptions[j];
+            Option option = recognizedOptions[j];
             if (option.hasArg()) {
                 if (!flags.hasNext()) {
-                    String msg = Main.getLocalizedString("err.req.arg", flag);
+                    String msg = log.localize(PrefixKind.JAVAC, "err.req.arg", flag);
                     throw new IllegalArgumentException(msg);
                 }
                 String operand = flags.next();
-                if (option.process(optionTable, flag, operand))
+                if (option.process(optionHelper, flag, operand))
                     // should not happen as the GrumpyHelper will throw exceptions
                     // in case of errors
                     throw new IllegalArgumentException(flag + " " + operand);
             } else {
-                if (option.process(optionTable, flag))
+                if (option.process(optionHelper, flag))
                     // should not happen as the GrumpyHelper will throw exceptions
                     // in case of errors
                     throw new IllegalArgumentException(flag);
             }
         }
+
+        optionTable.notifyListeners();
     }
 
     public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
@@ -266,9 +241,8 @@
     }
 
     public int isSupportedOption(String option) {
-        JavacOption[] recognizedOptions =
-            RecognizedOptions.getJavacToolOptions(new GrumpyHelper());
-        for (JavacOption o : recognizedOptions) {
+        Set<Option> recognizedOptions = Option.getJavacToolOptions();
+        for (Option o : recognizedOptions) {
             if (o.matches(option))
                 return o.hasArg() ? 1 : 0;
         }
--- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.tools.javac.api;
 
 import java.io.IOException;
-import java.util.Map;
+
 import javax.annotation.processing.ProcessingEnvironment;
 import javax.lang.model.element.AnnotationMirror;
 import javax.lang.model.element.AnnotationValue;
@@ -44,13 +44,14 @@
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.Scope;
 import com.sun.source.tree.Tree;
+import com.sun.source.util.JavacTask;
 import com.sun.source.util.SourcePositions;
 import com.sun.source.util.TreePath;
 import com.sun.source.util.Trees;
 import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.TypeSymbol;
-import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Type.UnionClassType;
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
@@ -59,12 +60,14 @@
 import com.sun.tools.javac.comp.MemberEnter;
 import com.sun.tools.javac.comp.Resolve;
 import com.sun.tools.javac.model.JavacElements;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.TreeCopier;
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.List;
@@ -93,12 +96,14 @@
     private JavacElements elements;
     private JavacTaskImpl javacTaskImpl;
 
+    // called reflectively from Trees.instance(CompilationTask task)
     public static JavacTrees instance(JavaCompiler.CompilationTask task) {
         if (!(task instanceof JavacTaskImpl))
             throw new IllegalArgumentException();
         return instance(((JavacTaskImpl)task).getContext());
     }
 
+    // called reflectively from Trees.instance(ProcessingEnvironment env)
     public static JavacTrees instance(ProcessingEnvironment env) {
         if (!(env instanceof JavacProcessingEnvironment))
             throw new IllegalArgumentException();
@@ -129,7 +134,10 @@
         resolve = Resolve.instance(context);
         treeMaker = TreeMaker.instance(context);
         memberEnter = MemberEnter.instance(context);
-        javacTaskImpl = context.get(JavacTaskImpl.class);
+
+        JavacTask t = context.get(JavacTask.class);
+        if (t instanceof JavacTaskImpl)
+            javacTaskImpl = (JavacTaskImpl) t;
     }
 
     public SourcePositions getSourcePositions() {
@@ -139,8 +147,8 @@
                 }
 
                 public long getEndPosition(CompilationUnitTree file, Tree tree) {
-                    Map<JCTree,Integer> endPositions = ((JCCompilationUnit) file).endPositions;
-                    return TreeInfo.getEndPos((JCTree) tree, endPositions);
+                    EndPosTable endPosTable = ((JCCompilationUnit) file).endPositions;
+                    return TreeInfo.getEndPos((JCTree) tree, endPosTable);
                 }
             };
     }
@@ -206,7 +214,7 @@
         if (sym == null && TreeInfo.isDeclaration(tree)) {
             for (TreePath p = path; p != null; p = p.getParentPath()) {
                 JCTree t = (JCTree) p.getLeaf();
-                if (t.getTag() == JCTree.CLASSDEF) {
+                if (t.hasTag(JCTree.Tag.CLASSDEF)) {
                     JCClassDecl ct = (JCClassDecl) t;
                     if (ct.sym != null) {
                         if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
@@ -263,9 +271,10 @@
         if (!(path.getLeaf() instanceof JCTree))  // implicit null-check
             throw new IllegalArgumentException();
 
-        // if we're being invoked via from a JSR199 client, we need to make sure
-        // all the classes have been entered; if we're being invoked from JSR269,
-        // then the classes will already have been entered.
+        // if we're being invoked from a Tree API client via parse/enter/analyze,
+        // we need to make sure all the classes have been entered;
+        // if we're being invoked from JSR 199 or JSR 269, then the classes
+        // will already have been entered.
         if (javacTaskImpl != null) {
             try {
                 javacTaskImpl.enter(null);
@@ -313,10 +322,19 @@
                     break;
                 case BLOCK: {
 //                    System.err.println("BLOCK: ");
-                    if (method != null)
-                        env = memberEnter.getMethodEnv(method, env);
-                    JCTree body = copier.copy((JCTree)tree, (JCTree) path.getLeaf());
-                    env = attribStatToTree(body, env, copier.leafCopy);
+                    if (method != null) {
+                        try {
+                            Assert.check(method.body == tree);
+                            method.body = copier.copy((JCBlock)tree, (JCTree) path.getLeaf());
+                            env = memberEnter.getMethodEnv(method, env);
+                            env = attribStatToTree(method.body, env, copier.leafCopy);
+                        } finally {
+                            method.body = (JCBlock) tree;
+                        }
+                    } else {
+                        JCBlock body = copier.copy((JCBlock)tree, (JCTree) path.getLeaf());
+                        env = attribStatToTree(body, env, copier.leafCopy);
+                    }
                     return env;
                 }
                 default:
@@ -329,7 +347,7 @@
                     }
             }
         }
-        return field != null ? memberEnter.getInitEnv(field, env) : env;
+        return (field != null) ? memberEnter.getInitEnv(field, env) : env;
     }
 
     private Env<AttrContext> attribStatToTree(JCTree stat, Env<AttrContext>env, JCTree tree) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/api/MultiTaskListener.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.api;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.util.Context;
+
+/**
+ * TODO.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class MultiTaskListener implements TaskListener {
+    /** The context key for the MultiTaskListener. */
+    public static final Context.Key<MultiTaskListener> taskListenerKey =
+        new Context.Key<MultiTaskListener>();
+
+    /** Get the MultiTaskListener instance for this context. */
+    public static MultiTaskListener instance(Context context) {
+        MultiTaskListener instance = context.get(taskListenerKey);
+        if (instance == null)
+            instance = new MultiTaskListener(context);
+        return instance;
+    }
+
+    protected MultiTaskListener(Context context) {
+        context.put(taskListenerKey, this);
+        ccw = ClientCodeWrapper.instance(context);
+    }
+
+    /**
+     * The current set of registered listeners.
+     * This is a mutable reference to an immutable array.
+     */
+    TaskListener[] listeners = { };
+
+    ClientCodeWrapper ccw;
+
+    public Collection<TaskListener> getTaskListeners() {
+        return Arrays.asList(listeners);
+    }
+
+    public boolean isEmpty() {
+        return (listeners.length == 0);
+    }
+
+    public void add(TaskListener listener) {
+        for (TaskListener l: listeners) {
+            if (ccw.unwrap(l) == listener)
+                throw new IllegalStateException();
+        }
+        TaskListener[] newListeners = new TaskListener[listeners.length + 1];
+        System.arraycopy(listeners, 0, newListeners, 0, listeners.length);
+        newListeners[newListeners.length - 1] = ccw.wrap(listener);
+        listeners = newListeners;
+    }
+
+    public void remove(TaskListener listener) {
+        for (int i = 0; i < listeners.length; i++) {
+            if (ccw.unwrap(listeners[i]) == listener) {
+                TaskListener[] newListeners = new TaskListener[listeners.length - 1];
+                System.arraycopy(listeners, 0, newListeners, 0, i);
+                System.arraycopy(listeners, i + 1, newListeners, i, newListeners.length - i);
+                listeners = newListeners;
+                break;
+            }
+        }
+    }
+
+    @Override
+    public void started(TaskEvent e) {
+        // guard against listeners being updated by a listener
+        TaskListener[] ll = this.listeners;
+        for (TaskListener l: ll)
+            l.started(e);
+    }
+
+    @Override
+    public void finished(TaskEvent e) {
+        // guard against listeners being updated by a listener
+        TaskListener[] ll = this.listeners;
+        for (TaskListener l: ll)
+            l.finished(e);
+    }
+
+    @Override
+    public String toString() {
+        return Arrays.toString(listeners);
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -221,7 +221,7 @@
 
     /** Flag that marks a hypothetical method that need not really be
      *  generated in the binary, but is present in the symbol table to
-     *  simplify checking for erasure clashes.
+     *  simplify checking for erasure clashes - also used for 292 poly sig methods.
      */
     public static final long HYPOTHETICAL   = 1L<<37;
 
@@ -236,26 +236,20 @@
     public static final long UNION = 1L<<39;
 
     /**
-     * Flag that marks a signature-polymorphic invoke method.
-     * (These occur inside java.lang.invoke.MethodHandle.)
-     */
-    public static final long POLYMORPHIC_SIGNATURE = 1L<<40;
-
-    /**
      * Flag that marks a special kind of bridge methods (the ones that
      * come from restricted supertype bounds)
      */
-    public static final long OVERRIDE_BRIDGE = 1L<<41;
+    public static final long OVERRIDE_BRIDGE = 1L<<40;
 
     /**
      * Flag that marks an 'effectively final' local variable
      */
-    public static final long EFFECTIVELY_FINAL = 1L<<42;
+    public static final long EFFECTIVELY_FINAL = 1L<<41;
 
     /**
      * Flag that marks non-override equivalent methods with the same signature
      */
-    public static final long CLASH = 1L<<43;
+    public static final long CLASH = 1L<<42;
 
     /** Modifier masks.
      */
--- a/src/share/classes/com/sun/tools/javac/code/Kinds.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Kinds.java	Tue May 29 00:27:58 2012 +0100
@@ -103,6 +103,8 @@
         VAL("kindname.value"),
         METHOD("kindname.method"),
         CLASS("kindname.class"),
+        STATIC_INIT("kindname.static.init"),
+        INSTANCE_INIT("kindname.instance.init"),
         PACKAGE("kindname.package");
 
         private String name;
@@ -170,9 +172,11 @@
             return KindName.CONSTRUCTOR;
 
         case METHOD:
+            return KindName.METHOD;
         case STATIC_INIT:
+            return KindName.STATIC_INIT;
         case INSTANCE_INIT:
-            return KindName.METHOD;
+            return KindName.INSTANCE_INIT;
 
         default:
             if (sym.kind == VAL)
--- a/src/share/classes/com/sun/tools/javac/code/Printer.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Printer.java	Tue May 29 00:27:58 2012 +0100
@@ -258,7 +258,7 @@
             ClassType norm = (ClassType) t.tsym.type;
             if (norm == null) {
                 s = localize(locale, "compiler.misc.anonymous.class", (Object) null);
-            } else if (norm.interfaces_field.nonEmpty()) {
+            } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
                 s = localize(locale, "compiler.misc.anonymous.class",
                         visit(norm.interfaces_field.head, locale));
             } else {
@@ -311,7 +311,7 @@
 
     @Override
     public String visitMethodSymbol(MethodSymbol s, Locale locale) {
-        if ((s.flags() & BLOCK) != 0) {
+        if (s.isStaticOrInstanceInit()) {
             return s.owner.name.toString();
         } else {
             String ms = (s.name == s.name.table.names.init)
--- a/src/share/classes/com/sun/tools/javac/code/Source.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Tue May 29 00:27:58 2012 +0100
@@ -32,7 +32,7 @@
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.jvm.Target;
 
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 
 /** The source language version accepted.
  *
@@ -194,6 +194,12 @@
     public boolean allowObjectToPrimitiveCast() {
         return compareTo(JDK1_7) >= 0;
     }
+    public boolean allowLambda() {
+        return compareTo(JDK1_8) >= 0;
+    }
+    public boolean allowMethodReferences() {
+        return compareTo(JDK1_8) >= 0;
+    }
     public static SourceVersion toSourceVersion(Source source) {
         switch(source) {
         case JDK1_2:
--- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -149,7 +149,8 @@
      * the default package; otherwise, the owner symbol is returned
      */
     public Symbol location() {
-        if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK && owner.kind != TYP)) {
+        if (owner.name == null || (owner.name.isEmpty() &&
+                (owner.flags() & BLOCK) == 0 && owner.kind != PCK && owner.kind != TYP)) {
             return null;
         }
         return owner;
@@ -201,16 +202,6 @@
         return (flags() & INTERFACE) != 0;
     }
 
-    /** Recognize if this symbol was marked @PolymorphicSignature in the source. */
-    public boolean isPolymorphicSignatureGeneric() {
-        return (flags() & (POLYMORPHIC_SIGNATURE | HYPOTHETICAL)) == POLYMORPHIC_SIGNATURE;
-    }
-
-    /** Recognize if this symbol was split from a @PolymorphicSignature symbol in the source. */
-    public boolean isPolymorphicSignatureInstance() {
-        return (flags() & (POLYMORPHIC_SIGNATURE | HYPOTHETICAL)) == (POLYMORPHIC_SIGNATURE | HYPOTHETICAL);
-    }
-
     /** Is this symbol declared (directly or indirectly) local
      *  to a method or variable initializer?
      *  Also includes fields of inner classes which are in
@@ -725,6 +716,11 @@
          */
         public JavaFileObject classfile;
 
+        /** the list of translated local classes (used for generating
+         * InnerClasses attribute)
+         */
+        public List<ClassSymbol> trans_local;
+
         /** the constant pool of the class
          */
         public Pool pool;
@@ -1229,7 +1225,7 @@
             // if origin is derived from a raw type, we might have missed
             // an implementation because we do not know enough about instantiations.
             // in this case continue with the supertype as origin.
-            if (types.isDerivedRaw(origin.type))
+            if (types.isDerivedRaw(origin.type) && !origin.isInterface())
                 return implementation(types.supertype(origin.type).tsym, types, checkResult);
             else
                 return null;
@@ -1299,10 +1295,36 @@
                 return ElementKind.CONSTRUCTOR;
             else if (name == name.table.names.clinit)
                 return ElementKind.STATIC_INIT;
+            else if ((flags() & BLOCK) != 0)
+                return isStatic() ? ElementKind.STATIC_INIT : ElementKind.INSTANCE_INIT;
             else
                 return ElementKind.METHOD;
         }
 
+        public boolean isStaticOrInstanceInit() {
+            return getKind() == ElementKind.STATIC_INIT ||
+                    getKind() == ElementKind.INSTANCE_INIT;
+        }
+
+        /**
+         * A polymorphic signature method (JLS SE 7, 8.4.1) is a method that
+         * (i) is declared in the java.lang.invoke.MethodHandle class, (ii) takes
+         * a single variable arity parameter (iii) whose declared type is Object[],
+         * (iv) has a return type of Object and (v) is native.
+         */
+        public boolean isSignaturePolymorphic(Types types) {
+            List<Type> argtypes = type.getParameterTypes();
+            Type firstElemType = argtypes.nonEmpty() ?
+                    types.elemtype(argtypes.head) :
+                    null;
+            return owner == types.syms.methodHandleType.tsym &&
+                    argtypes.length() == 1 &&
+                    firstElemType != null &&
+                    types.isSameType(firstElemType, types.syms.objectType) &&
+                    types.isSameType(type.getReturnType(), types.syms.objectType) &&
+                    (flags() & NATIVE) != 0;
+        }
+
         public Attribute getDefaultValue() {
             return defaultValue;
         }
--- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -126,7 +126,7 @@
     public final Type cloneableType;
     public final Type serializableType;
     public final Type methodHandleType;
-    public final Type polymorphicSignatureType;
+    public final Type nativeHeaderType;
     public final Type throwableType;
     public final Type errorType;
     public final Type interruptedExceptionType;
@@ -435,7 +435,6 @@
         throwableType = enterClass("java.lang.Throwable");
         serializableType = enterClass("java.io.Serializable");
         methodHandleType = enterClass("java.lang.invoke.MethodHandle");
-        polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature");
         errorType = enterClass("java.lang.Error");
         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
         interruptedExceptionType = enterClass("java.lang.InterruptedException");
@@ -477,11 +476,11 @@
                                             List.of(exceptionType), methodClass),
                              autoCloseableType.tsym);
         trustMeType = enterClass("java.lang.SafeVarargs");
+        nativeHeaderType = enterClass("javax.tools.annotation.GenerateNativeHeader");
 
         synthesizeEmptyInterfaceIfMissing(autoCloseableType);
         synthesizeEmptyInterfaceIfMissing(cloneableType);
         synthesizeEmptyInterfaceIfMissing(serializableType);
-        synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
         synthesizeBoxTypeIfMissing(doubleType);
         synthesizeBoxTypeIfMissing(floatType);
         synthesizeBoxTypeIfMissing(voidType);
--- a/src/share/classes/com/sun/tools/javac/code/Type.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Tue May 29 00:27:58 2012 +0100
@@ -1147,29 +1147,6 @@
         }
 
         /**
-         * Kind of type-constraint derived during type inference
-         */
-        public enum ConstraintKind {
-            /**
-             * upper bound constraint (a type variable must be instantiated
-             * with a type T, where T is a subtype of all the types specified by
-             * its EXTENDS constraints).
-             */
-            EXTENDS,
-            /**
-             * lower bound constraint (a type variable must be instantiated
-             * with a type T, where T is a supertype of all the types specified by
-             * its SUPER constraints).
-             */
-            SUPER,
-            /**
-             * equality constraint (a type variable must be instantiated to the type
-             * specified by its EQUAL constraint.
-             */
-            EQUAL;
-        }
-
-        /**
          * Get the type-constraints of a given kind for a given type-variable of
          * this ForAll type. Subclasses should override in order to return more
          * accurate sets of constraints.
@@ -1178,7 +1155,7 @@
          * @param ck the constraint kind to be retrieved
          * @return the list of types specified by the selected constraint
          */
-        public List<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
+        public List<Type> undetvars() {
             return List.nil();
         }
 
@@ -1220,6 +1197,7 @@
     public static class UndetVar extends DelegatedType {
         public List<Type> lobounds = List.nil();
         public List<Type> hibounds = List.nil();
+        public List<Type> eq = List.nil();
         public Type inst = null;
 
         @Override
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -269,14 +269,15 @@
 
     // <editor-fold defaultstate="collapsed" desc="isConvertible">
     /**
-     * Is t a subtype of or convertiable via boxing/unboxing
-     * convertions to s?
+     * Is t a subtype of or convertible via boxing/unboxing
+     * conversion to s?
      */
     public boolean isConvertible(Type t, Type s, Warner warn) {
+        if (t.tag == ERROR)
+            return true;
         boolean tPrimitive = t.isPrimitive();
         boolean sPrimitive = s.isPrimitive();
         if (tPrimitive == sPrimitive) {
-            checkUnsafeVarargsConversion(t, s, warn);
             return isSubtypeUnchecked(t, s, warn);
         }
         if (!allowBoxing) return false;
@@ -284,27 +285,6 @@
             ? isSubtype(boxedClass(t).type, s)
             : isSubtype(unboxedType(t), s);
     }
-    //where
-    private void checkUnsafeVarargsConversion(Type t, Type s, Warner warn) {
-        if (t.tag != ARRAY || isReifiable(t)) return;
-        ArrayType from = (ArrayType)t;
-        boolean shouldWarn = false;
-        switch (s.tag) {
-            case ARRAY:
-                ArrayType to = (ArrayType)s;
-                shouldWarn = from.isVarargs() &&
-                        !to.isVarargs() &&
-                        !isReifiable(from);
-                break;
-            case CLASS:
-                shouldWarn = from.isVarargs() &&
-                        isSubtype(from, s);
-                break;
-        }
-        if (shouldWarn) {
-            warn.warn(LintCategory.VARARGS);
-        }
-    }
 
     /**
      * Is t a subtype of or convertiable via boxing/unboxing
@@ -326,42 +306,58 @@
      * Is t an unchecked subtype of s?
      */
     public boolean isSubtypeUnchecked(Type t, Type s, Warner warn) {
-        if (t.tag == ARRAY && s.tag == ARRAY) {
-            if (((ArrayType)t).elemtype.tag <= lastBaseTag) {
-                return isSameType(elemtype(t), elemtype(s));
-            } else {
-                ArrayType from = (ArrayType)t;
-                ArrayType to = (ArrayType)s;
-                if (from.isVarargs() &&
-                        !to.isVarargs() &&
-                        !isReifiable(from)) {
-                    warn.warn(LintCategory.VARARGS);
-                }
-                return isSubtypeUnchecked(elemtype(t), elemtype(s), warn);
-            }
-        } else if (isSubtype(t, s)) {
-            return true;
+        boolean result = isSubtypeUncheckedInternal(t, s, warn);
+        if (result) {
+            checkUnsafeVarargsConversion(t, s, warn);
         }
-        else if (t.tag == TYPEVAR) {
-            return isSubtypeUnchecked(t.getUpperBound(), s, warn);
-        }
-        else if (s.tag == UNDETVAR) {
-            UndetVar uv = (UndetVar)s;
-            if (uv.inst != null)
-                return isSubtypeUnchecked(t, uv.inst, warn);
-        }
-        else if (!s.isRaw()) {
-            Type t2 = asSuper(t, s.tsym);
-            if (t2 != null && t2.isRaw()) {
-                if (isReifiable(s))
-                    warn.silentWarn(LintCategory.UNCHECKED);
-                else
-                    warn.warn(LintCategory.UNCHECKED);
+        return result;
+    }
+    //where
+        private boolean isSubtypeUncheckedInternal(Type t, Type s, Warner warn) {
+            if (t.tag == ARRAY && s.tag == ARRAY) {
+                if (((ArrayType)t).elemtype.tag <= lastBaseTag) {
+                    return isSameType(elemtype(t), elemtype(s));
+                } else {
+                    return isSubtypeUnchecked(elemtype(t), elemtype(s), warn);
+                }
+            } else if (isSubtype(t, s)) {
                 return true;
             }
+            else if (t.tag == TYPEVAR) {
+                return isSubtypeUnchecked(t.getUpperBound(), s, warn);
+            }
+            else if (!s.isRaw()) {
+                Type t2 = asSuper(t, s.tsym);
+                if (t2 != null && t2.isRaw()) {
+                    if (isReifiable(s))
+                        warn.silentWarn(LintCategory.UNCHECKED);
+                    else
+                        warn.warn(LintCategory.UNCHECKED);
+                    return true;
+                }
+            }
+            return false;
         }
-        return false;
-    }
+
+        private void checkUnsafeVarargsConversion(Type t, Type s, Warner warn) {
+            if (t.tag != ARRAY || isReifiable(t)) return;
+            ArrayType from = (ArrayType)t;
+            boolean shouldWarn = false;
+            switch (s.tag) {
+                case ARRAY:
+                    ArrayType to = (ArrayType)s;
+                    shouldWarn = from.isVarargs() &&
+                            !to.isVarargs() &&
+                            !isReifiable(from);
+                    break;
+                case CLASS:
+                    shouldWarn = from.isVarargs();
+                    break;
+            }
+            if (shouldWarn) {
+                warn.warn(LintCategory.VARARGS);
+            }
+        }
 
     /**
      * Is t a subtype of s?<br>
@@ -506,11 +502,13 @@
             @Override
             public Boolean visitUndetVar(UndetVar t, Type s) {
                 //todo: test against origin needed? or replace with substitution?
-                if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN)
+                if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN) {
                     return true;
-
-                if (t.inst != null)
-                    return isSubtypeNoCapture(t.inst, s); // TODO: ", warn"?
+                } else if (s.tag == BOT) {
+                    //if 's' is 'null' there's no instantiated type U for which
+                    //U <: s (but 'null' itself, which is not a valid type)
+                    return false;
+                }
 
                 t.hibounds = t.hibounds.prepend(s);
                 return true;
@@ -580,8 +578,6 @@
                 undet.qtype == s ||
                 s.tag == ERROR ||
                 s.tag == BOT) return true;
-            if (undet.inst != null)
-                return isSubtype(s, undet.inst);
             undet.lobounds = undet.lobounds.prepend(s);
             return true;
         }
@@ -727,18 +723,8 @@
                 if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN)
                     return true;
 
-                if (t.inst != null)
-                    return visit(t.inst, s);
-
-                t.inst = fromUnknownFun.apply(s);
-                for (List<Type> l = t.lobounds; l.nonEmpty(); l = l.tail) {
-                    if (!isSubtype(l.head, t.inst))
-                        return false;
-                }
-                for (List<Type> l = t.hibounds; l.nonEmpty(); l = l.tail) {
-                    if (!isSubtype(t.inst, l.head))
-                        return false;
-                }
+                t.eq = t.eq.prepend(s);
+
                 return true;
             }
 
@@ -773,23 +759,11 @@
                     case UNBOUND: //similar to ? extends Object
                     case EXTENDS: {
                         Type bound = upperBound(s);
-                        // We should check the new upper bound against any of the
-                        // undetvar's lower bounds.
-                        for (Type t2 : undetvar.lobounds) {
-                            if (!isSubtype(t2, bound))
-                                return false;
-                        }
                         undetvar.hibounds = undetvar.hibounds.prepend(bound);
                         break;
                     }
                     case SUPER: {
                         Type bound = lowerBound(s);
-                        // We should check the new lower bound against any of the
-                        // undetvar's lower bounds.
-                        for (Type t2 : undetvar.hibounds) {
-                            if (!isSubtype(bound, t2))
-                                return false;
-                        }
                         undetvar.lobounds = undetvar.lobounds.prepend(bound);
                         break;
                     }
@@ -2117,6 +2091,8 @@
             }
         }
 
+        List<TypeSymbol> seenTypes = List.nil();
+
         /** members closure visitor methods **/
 
         public CompoundScope visitType(Type t, Boolean skipInterface) {
@@ -2125,21 +2101,33 @@
 
         @Override
         public CompoundScope visitClassType(ClassType t, Boolean skipInterface) {
-            ClassSymbol csym = (ClassSymbol)t.tsym;
-            Entry e = _map.get(csym);
-            if (e == null || !e.matches(skipInterface)) {
-                CompoundScope membersClosure = new CompoundScope(csym);
-                if (!skipInterface) {
-                    for (Type i : interfaces(t)) {
-                        membersClosure.addSubScope(visit(i, skipInterface));
+            if (seenTypes.contains(t.tsym)) {
+                //this is possible when an interface is implemented in multiple
+                //superclasses, or when a classs hierarchy is circular - in such
+                //cases we don't need to recurse (empty scope is returned)
+                return new CompoundScope(t.tsym);
+            }
+            try {
+                seenTypes = seenTypes.prepend(t.tsym);
+                ClassSymbol csym = (ClassSymbol)t.tsym;
+                Entry e = _map.get(csym);
+                if (e == null || !e.matches(skipInterface)) {
+                    CompoundScope membersClosure = new CompoundScope(csym);
+                    if (!skipInterface) {
+                        for (Type i : interfaces(t)) {
+                            membersClosure.addSubScope(visit(i, skipInterface));
+                        }
                     }
+                    membersClosure.addSubScope(visit(supertype(t), skipInterface));
+                    membersClosure.addSubScope(csym.members());
+                    e = new Entry(skipInterface, membersClosure);
+                    _map.put(csym, e);
                 }
-                membersClosure.addSubScope(visit(supertype(t), skipInterface));
-                membersClosure.addSubScope(csym.members());
-                e = new Entry(skipInterface, membersClosure);
-                _map.put(csym, e);
+                return e.compoundScope;
             }
-            return e.compoundScope;
+            finally {
+                seenTypes = seenTypes.tail;
+            }
         }
 
         @Override
@@ -3580,39 +3568,44 @@
 
         @Override
         public Type visitCapturedType(CapturedType t, Void s) {
-            Type bound = visitWildcardType(t.wildcard, null);
-            return (bound.contains(t)) ?
-                    erasure(bound) :
-                    bound;
+            Type w_bound = t.wildcard.type;
+            Type bound = w_bound.contains(t) ?
+                        erasure(w_bound) :
+                        visit(w_bound);
+            return rewriteAsWildcardType(visit(bound), t.wildcard.bound, t.wildcard.kind);
         }
 
         @Override
         public Type visitTypeVar(TypeVar t, Void s) {
             if (rewriteTypeVars) {
-                Type bound = high ?
-                    (t.bound.contains(t) ?
+                Type bound = t.bound.contains(t) ?
                         erasure(t.bound) :
-                        visit(t.bound)) :
-                    syms.botType;
-                return rewriteAsWildcardType(bound, t);
+                        visit(t.bound);
+                return rewriteAsWildcardType(bound, t, EXTENDS);
+            } else {
+                return t;
             }
-            else
-                return t;
         }
 
         @Override
         public Type visitWildcardType(WildcardType t, Void s) {
-            Type bound = high ? t.getExtendsBound() :
-                                t.getSuperBound();
-            if (bound == null)
-            bound = high ? syms.objectType : syms.botType;
-            return rewriteAsWildcardType(visit(bound), t.bound);
+            Type bound2 = visit(t.type);
+            return t.type == bound2 ? t : rewriteAsWildcardType(bound2, t.bound, t.kind);
         }
 
-        private Type rewriteAsWildcardType(Type bound, TypeVar formal) {
-            return high ?
-                makeExtendsWildcard(B(bound), formal) :
-                makeSuperWildcard(B(bound), formal);
+        private Type rewriteAsWildcardType(Type bound, TypeVar formal, BoundKind bk) {
+            switch (bk) {
+               case EXTENDS: return high ?
+                       makeExtendsWildcard(B(bound), formal) :
+                       makeExtendsWildcard(syms.objectType, formal);
+               case SUPER: return high ?
+                       makeSuperWildcard(syms.botType, formal) :
+                       makeSuperWildcard(B(bound), formal);
+               case UNBOUND: return makeExtendsWildcard(syms.objectType, formal);
+               default:
+                   Assert.error("Invalid bound kind " + bk);
+                   return null;
+            }
         }
 
         Type B(Type t) {
--- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+
 /** Enter annotations on symbols.  Annotations accumulate in a queue,
  *  which is processed at the top level of any set of recursive calls
  *  requesting it be processed.
@@ -148,7 +150,7 @@
             return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil());
         }
         List<JCExpression> args = a.args;
-        if (args.length() == 1 && args.head.getTag() != JCTree.ASSIGN) {
+        if (args.length() == 1 && !args.head.hasTag(ASSIGN)) {
             // special case: elided "value=" assumed
             args.head = make.at(args.head.pos).
                 Assign(make.Ident(names.value), args.head);
@@ -157,12 +159,12 @@
             new ListBuffer<Pair<MethodSymbol,Attribute>>();
         for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
             JCExpression t = tl.head;
-            if (t.getTag() != JCTree.ASSIGN) {
+            if (!t.hasTag(ASSIGN)) {
                 log.error(t.pos(), "annotation.value.must.be.name.value");
                 continue;
             }
             JCAssign assign = (JCAssign)t;
-            if (assign.lhs.getTag() != JCTree.IDENT) {
+            if (!assign.lhs.hasTag(IDENT)) {
                 log.error(t.pos(), "annotation.value.must.be.name.value");
                 continue;
             }
@@ -222,14 +224,14 @@
                                        (((JCFieldAccess) tree).selected).type);
         }
         if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) {
-            if (tree.getTag() != JCTree.ANNOTATION) {
+            if (!tree.hasTag(ANNOTATION)) {
                 log.error(tree.pos(), "annotation.value.must.be.annotation");
                 expected = syms.errorType;
             }
             return enterAnnotation((JCAnnotation)tree, expected, env);
         }
         if (expected.tag == TypeTags.ARRAY) { // should really be isArray()
-            if (tree.getTag() != JCTree.NEWARRAY) {
+            if (!tree.hasTag(NEWARRAY)) {
                 tree = make.at(tree.pos).
                     NewArray(null, List.<JCExpression>nil(), List.of(tree));
             }
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.comp.Check.CheckContext;
 
 import com.sun.source.tree.IdentifierTree;
 import com.sun.source.tree.MemberSelectTree;
@@ -49,8 +50,13 @@
 import com.sun.source.util.SimpleTreeVisitor;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.ANNOTATION;
+import static com.sun.tools.javac.code.Flags.BLOCK;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Kinds.ERRONEOUS;
 import static com.sun.tools.javac.code.TypeTags.*;
+import static com.sun.tools.javac.code.TypeTags.WILDCARD;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** This is the main context-dependent analysis phase in GJC. It
  *  encompasses name resolution, type checking and constant folding as
@@ -127,6 +133,11 @@
         findDiamonds = options.get("findDiamond") != null &&
                  source.allowDiamond();
         useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
+
+        statInfo = new ResultInfo(NIL, Type.noType);
+        varInfo = new ResultInfo(VAR, Type.noType);
+        unknownExprInfo = new ResultInfo(VAL, Type.noType);
+        unknownTypeInfo = new ResultInfo(TYP, Type.noType);
     }
 
     /** Switch: relax some constraints for retrofit mode.
@@ -194,16 +205,15 @@
      *  @param tree     The tree whose kind and type is checked
      *  @param owntype  The computed type of the tree
      *  @param ownkind  The computed kind of the tree
-     *  @param pkind    The expected kind (or: protokind) of the tree
-     *  @param pt       The expected type (or: prototype) of the tree
+     *  @param resultInfo  The expected result of the tree
      */
-    Type check(JCTree tree, Type owntype, int ownkind, int pkind, Type pt) {
-        if (owntype.tag != ERROR && pt.tag != METHOD && pt.tag != FORALL) {
-            if ((ownkind & ~pkind) == 0) {
-                owntype = chk.checkType(tree.pos(), owntype, pt, errKey);
+    Type check(JCTree tree, Type owntype, int ownkind, ResultInfo resultInfo) {
+        if (owntype.tag != ERROR && resultInfo.pt.tag != METHOD && resultInfo.pt.tag != FORALL) {
+            if ((ownkind & ~resultInfo.pkind) == 0) {
+                owntype = resultInfo.check(tree, owntype);
             } else {
                 log.error(tree.pos(), "unexpected.type",
-                          kindNames(pkind),
+                          kindNames(resultInfo.pkind),
                           kindName(ownkind));
                 owntype = types.createErrorType(owntype);
             }
@@ -245,7 +255,7 @@
             ((v.flags() & HASINIT) != 0
              ||
              !((base == null ||
-               (base.getTag() == JCTree.IDENT && TreeInfo.name(base) == names._this)) &&
+               (base.hasTag(IDENT) && TreeInfo.name(base) == names._this)) &&
                isAssignableAsBlankFinal(v, env)))) {
             if (v.isResourceVariable()) { //TWR resource
                 log.error(pos, "try.resource.may.not.be.assigned", v);
@@ -263,7 +273,7 @@
      *  @param tree    The candidate tree.
      */
     boolean isStaticReference(JCTree tree) {
-        if (tree.getTag() == JCTree.SELECT) {
+        if (tree.hasTag(SELECT)) {
             Symbol lsym = TreeInfo.symbol(((JCFieldAccess) tree).selected);
             if (lsym == null || lsym.kind != TYP) {
                 return false;
@@ -328,7 +338,16 @@
     public Type attribType(JCTree node, TypeSymbol sym) {
         Env<AttrContext> env = enter.typeEnvs.get(sym);
         Env<AttrContext> localEnv = env.dup(node, env.info.dup());
-        return attribTree(node, localEnv, Kinds.TYP, Type.noType);
+        return attribTree(node, localEnv, unknownTypeInfo);
+    }
+
+    public Type attribImportQualifier(JCImport tree, Env<AttrContext> env) {
+        // Attribute qualifying package or class.
+        JCFieldAccess s = (JCFieldAccess)tree.qualid;
+        return attribTree(s.selected,
+                       env,
+                       new ResultInfo(tree.staticImport ? TYP : (TYP | PCK),
+                       Type.noType));
     }
 
     public Env<AttrContext> attribExprToTree(JCTree expr, Env<AttrContext> env, JCTree tree) {
@@ -381,6 +400,38 @@
         }
     }
 
+    class ResultInfo {
+        int pkind;
+        Type pt;
+        CheckContext checkContext;
+
+        ResultInfo(int pkind, Type pt) {
+            this(pkind, pt, chk.basicHandler);
+        }
+
+        protected ResultInfo(int pkind, Type pt, CheckContext checkContext) {
+            this.pkind = pkind;
+            this.pt = pt;
+            this.checkContext = checkContext;
+        }
+
+        protected Type check(DiagnosticPosition pos, Type found) {
+            return chk.checkType(pos, found, pt, checkContext);
+        }
+    }
+
+    private final ResultInfo statInfo;
+    private final ResultInfo varInfo;
+    private final ResultInfo unknownExprInfo;
+    private final ResultInfo unknownTypeInfo;
+
+    Type pt() {
+        return resultInfo.pt;
+    }
+
+    int pkind() {
+        return resultInfo.pkind;
+    }
 
 /* ************************************************************************
  * Visitor methods
@@ -390,17 +441,9 @@
      */
     Env<AttrContext> env;
 
-    /** Visitor argument: the currently expected proto-kind.
-     */
-    int pkind;
-
-    /** Visitor argument: the currently expected proto-type.
+    /** Visitor argument: the currently expected attribution result.
      */
-    Type pt;
-
-    /** Visitor argument: the error key to be generated when a type error occurs
-     */
-    String errKey;
+    ResultInfo resultInfo;
 
     /** Visitor result: the computed type.
      */
@@ -411,23 +454,14 @@
      *
      *  @param tree    The tree to be visited.
      *  @param env     The environment visitor argument.
-     *  @param pkind   The protokind visitor argument.
-     *  @param pt      The prototype visitor argument.
+     *  @param resultInfo   The result info visitor argument.
      */
-    Type attribTree(JCTree tree, Env<AttrContext> env, int pkind, Type pt) {
-        return attribTree(tree, env, pkind, pt, "incompatible.types");
-    }
-
-    Type attribTree(JCTree tree, Env<AttrContext> env, int pkind, Type pt, String errKey) {
+    private Type attribTree(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
         Env<AttrContext> prevEnv = this.env;
-        int prevPkind = this.pkind;
-        Type prevPt = this.pt;
-        String prevErrKey = this.errKey;
+        ResultInfo prevResult = this.resultInfo;
         try {
             this.env = env;
-            this.pkind = pkind;
-            this.pt = pt;
-            this.errKey = errKey;
+            this.resultInfo = resultInfo;
             tree.accept(this);
             if (tree == breakTree)
                 throw new BreakAttr(env);
@@ -437,27 +471,21 @@
             return chk.completionError(tree.pos(), ex);
         } finally {
             this.env = prevEnv;
-            this.pkind = prevPkind;
-            this.pt = prevPt;
-            this.errKey = prevErrKey;
+            this.resultInfo = prevResult;
         }
     }
 
     /** Derived visitor method: attribute an expression tree.
      */
     public Type attribExpr(JCTree tree, Env<AttrContext> env, Type pt) {
-        return attribTree(tree, env, VAL, pt.tag != ERROR ? pt : Type.noType);
-    }
-
-    public Type attribExpr(JCTree tree, Env<AttrContext> env, Type pt, String key) {
-        return attribTree(tree, env, VAL, pt.tag != ERROR ? pt : Type.noType, key);
+        return attribTree(tree, env, new ResultInfo(VAL, pt.tag != ERROR ? pt : Type.noType));
     }
 
     /** Derived visitor method: attribute an expression tree with
      *  no constraints on the computed type.
      */
     Type attribExpr(JCTree tree, Env<AttrContext> env) {
-        return attribTree(tree, env, VAL, Type.noType);
+        return attribTree(tree, env, unknownExprInfo);
     }
 
     /** Derived visitor method: attribute a type tree.
@@ -470,14 +498,14 @@
     /** Derived visitor method: attribute a type tree.
      */
     Type attribType(JCTree tree, Env<AttrContext> env, Type pt) {
-        Type result = attribTree(tree, env, TYP, pt);
+        Type result = attribTree(tree, env, new ResultInfo(TYP, pt));
         return result;
     }
 
     /** Derived visitor method: attribute a statement or definition tree.
      */
     public Type attribStat(JCTree tree, Env<AttrContext> env) {
-        return attribTree(tree, env, NIL, Type.noType);
+        return attribTree(tree, env, statInfo);
     }
 
     /** Attribute a list of expressions, returning a list of types.
@@ -502,7 +530,7 @@
         ListBuffer<Type> argtypes = new ListBuffer<Type>();
         for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail)
             argtypes.append(chk.checkNonVoid(
-                l.head.pos(), types.upperBound(attribTree(l.head, env, VAL, Infer.anyPoly))));
+                l.head.pos(), types.upperBound(attribExpr(l.head, env, Infer.anyPoly))));
         return argtypes.toList();
     }
 
@@ -594,7 +622,15 @@
             lintEnv = lintEnv.next;
 
         // Having found the enclosing lint value, we can initialize the lint value for this class
-        env.info.lint = lintEnv.info.lint.augment(env.info.enclVar.attributes_field, env.info.enclVar.flags());
+        // ... but ...
+        // There's a problem with evaluating annotations in the right order, such that
+        // env.info.enclVar.attributes_field might not yet have been evaluated, and so might be
+        // null. In that case, calling augment will throw an NPE. To avoid this, for now we
+        // revert to the jdk 6 behavior and ignore the (unevaluated) attributes.
+        if (env.info.enclVar.attributes_field == null)
+            env.info.lint = lintEnv.info.lint;
+        else
+            env.info.lint = lintEnv.info.lint.augment(env.info.enclVar.attributes_field, env.info.enclVar.flags());
 
         Lint prevLint = chk.setLint(env.info.lint);
         JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
@@ -685,7 +721,7 @@
             // disable implicit outer instance from being passed.
             // (This would be an illegal access to "this before super").
             if (env.info.isSelfCall &&
-                env.tree.getTag() == JCTree.NEWCLASS &&
+                env.tree.hasTag(NEWCLASS) &&
                 ((JCNewClass) env.tree).encl == null)
             {
                 c.flags_field |= NOOUTERTHIS;
@@ -855,7 +891,7 @@
             chk.checkDeprecatedAnnotation(tree.pos(), v);
 
             if (tree.init != null) {
-                if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS) {
+                if ((v.flags_field & FINAL) != 0 && !tree.init.hasTag(NEWCLASS)) {
                     // In this case, `v' is final.  Ensure that it's initializer is
                     // evaluated.
                     v.getConstValue(); // ensure initializer is evaluated
@@ -963,8 +999,8 @@
     public void visitLabelled(JCLabeledStatement tree) {
         // Check that label is not used in an enclosing statement
         Env<AttrContext> env1 = env;
-        while (env1 != null && env1.tree.getTag() != JCTree.CLASSDEF) {
-            if (env1.tree.getTag() == JCTree.LABELLED &&
+        while (env1 != null && !env1.tree.hasTag(CLASSDEF)) {
+            if (env1.tree.hasTag(LABELLED) &&
                 ((JCLabeledStatement) env1.tree).label == tree.label) {
                 log.error(tree.pos(), "label.already.in.use",
                           tree.label);
@@ -1044,14 +1080,14 @@
         private static void addVars(List<JCStatement> stats, Scope switchScope) {
             for (;stats.nonEmpty(); stats = stats.tail) {
                 JCTree stat = stats.head;
-                if (stat.getTag() == JCTree.VARDEF)
+                if (stat.hasTag(VARDEF))
                     switchScope.enter(((JCVariableDecl) stat).sym);
             }
         }
     // where
     /** Return the selected enumeration constant symbol, or null. */
     private Symbol enumConstant(JCTree tree, Type enumType) {
-        if (tree.getTag() != JCTree.IDENT) {
+        if (!tree.hasTag(IDENT)) {
             log.error(tree.pos(), "enum.label.must.be.unqualified.enum");
             return syms.errSymbol;
         }
@@ -1086,9 +1122,16 @@
             localEnv;
         // Attribute resource declarations
         for (JCTree resource : tree.resources) {
-            if (resource.getTag() == JCTree.VARDEF) {
+            CheckContext twrContext = new Check.NestedCheckContext(resultInfo.checkContext) {
+                @Override
+                public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
+                    chk.basicHandler.report(pos, found, req, diags.fragment("try.not.applicable.to.type", found));
+                }
+            };
+            ResultInfo twrResult = new ResultInfo(VAL, syms.autoCloseableType, twrContext);
+            if (resource.hasTag(VARDEF)) {
                 attribStat(resource, tryEnv);
-                chk.checkType(resource, resource.type, syms.autoCloseableType, "try.not.applicable.to.type");
+                twrResult.check(resource, resource.type);
 
                 //check that resource type cannot throw InterruptedException
                 checkAutoCloseable(resource.pos(), localEnv, resource.type);
@@ -1096,7 +1139,7 @@
                 VarSymbol var = (VarSymbol)TreeInfo.symbolFor(resource);
                 var.setData(ElementKind.RESOURCE_VARIABLE);
             } else {
-                attribExpr(resource, tryEnv, syms.autoCloseableType, "try.not.applicable.to.type");
+                attribTree(resource, tryEnv, twrResult);
             }
         }
         // Attribute body
@@ -1133,7 +1176,8 @@
 
     void checkAutoCloseable(DiagnosticPosition pos, Env<AttrContext> env, Type resource) {
         if (!resource.isErroneous() &&
-                types.asSuper(resource, syms.autoCloseableType.tsym) != null) {
+            types.asSuper(resource, syms.autoCloseableType.tsym) != null &&
+            !types.isSameType(resource, syms.autoCloseableType)) { // Don't emit warning for AutoCloseable itself
             Symbol close = syms.noSymbol;
             boolean prevDeferDiags = log.deferDiagnostics;
             Queue<JCDiagnostic> prevDeferredDiags = log.deferredDiagnostics;
@@ -1167,7 +1211,7 @@
         result = check(tree,
                        capture(condType(tree.pos(), tree.cond.type,
                                         tree.truepart.type, tree.falsepart.type)),
-                       VAL, pkind, pt);
+                       VAL, resultInfo);
     }
     //where
         /** Compute the type of a conditional expression, after
@@ -1304,7 +1348,7 @@
          *  @param env     The environment current at the jump statement.
          */
         private JCTree findJumpTarget(DiagnosticPosition pos,
-                                    int tag,
+                                    JCTree.Tag tag,
                                     Name label,
                                     Env<AttrContext> env) {
             // Search environments outwards from the point of jump.
@@ -1312,15 +1356,15 @@
             LOOP:
             while (env1 != null) {
                 switch (env1.tree.getTag()) {
-                case JCTree.LABELLED:
+                case LABELLED:
                     JCLabeledStatement labelled = (JCLabeledStatement)env1.tree;
                     if (label == labelled.label) {
                         // If jump is a continue, check that target is a loop.
-                        if (tag == JCTree.CONTINUE) {
-                            if (labelled.body.getTag() != JCTree.DOLOOP &&
-                                labelled.body.getTag() != JCTree.WHILELOOP &&
-                                labelled.body.getTag() != JCTree.FORLOOP &&
-                                labelled.body.getTag() != JCTree.FOREACHLOOP)
+                        if (tag == CONTINUE) {
+                            if (!labelled.body.hasTag(DOLOOP) &&
+                                !labelled.body.hasTag(WHILELOOP) &&
+                                !labelled.body.hasTag(FORLOOP) &&
+                                !labelled.body.hasTag(FOREACHLOOP))
                                 log.error(pos, "not.loop.label", label);
                             // Found labelled statement target, now go inwards
                             // to next non-labelled tree.
@@ -1330,17 +1374,17 @@
                         }
                     }
                     break;
-                case JCTree.DOLOOP:
-                case JCTree.WHILELOOP:
-                case JCTree.FORLOOP:
-                case JCTree.FOREACHLOOP:
+                case DOLOOP:
+                case WHILELOOP:
+                case FORLOOP:
+                case FOREACHLOOP:
                     if (label == null) return env1.tree;
                     break;
-                case JCTree.SWITCH:
-                    if (label == null && tag == JCTree.BREAK) return env1.tree;
+                case SWITCH:
+                    if (label == null && tag == BREAK) return env1.tree;
                     break;
-                case JCTree.METHODDEF:
-                case JCTree.CLASSDEF:
+                case METHODDEF:
+                case CLASSDEF:
                     break LOOP;
                 default:
                 }
@@ -1348,7 +1392,7 @@
             }
             if (label != null)
                 log.error(pos, "undef.label", label);
-            else if (tag == JCTree.CONTINUE)
+            else if (tag == CONTINUE)
                 log.error(pos, "cont.outside.loop");
             else
                 log.error(pos, "break.outside.switch.loop");
@@ -1444,7 +1488,7 @@
                     if (encl.tag == CLASS) {
                         // we are calling a nested class
 
-                        if (tree.meth.getTag() == JCTree.SELECT) {
+                        if (tree.meth.hasTag(SELECT)) {
                             JCTree qualifier = ((JCFieldAccess) tree.meth).selected;
 
                             // We are seeing a prefixed call, of the form
@@ -1460,7 +1504,7 @@
                             rs.resolveImplicitThis(tree.meth.pos(),
                                                    localEnv, site, true);
                         }
-                    } else if (tree.meth.getTag() == JCTree.SELECT) {
+                    } else if (tree.meth.hasTag(SELECT)) {
                         log.error(tree.meth.pos(), "illegal.qual.not.icls",
                                   site.tsym);
                     }
@@ -1486,8 +1530,8 @@
                     // ...and check that it is legal in the current context.
                     // (this will also set the tree's type)
                     Type mpt = newMethTemplate(argtypes, typeargtypes);
-                    checkId(tree.meth, site, sym, localEnv, MTH,
-                            mpt, tree.varargsElement != null);
+                    checkId(tree.meth, site, sym, localEnv, new ResultInfo(MTH, mpt),
+                            tree.varargsElement != null);
                 }
                 // Otherwise, `site' is an error type and we do nothing
             }
@@ -1504,8 +1548,6 @@
             Type mpt = newMethTemplate(argtypes, typeargtypes);
             localEnv.info.varArgs = false;
             Type mtype = attribExpr(tree.meth, localEnv, mpt);
-            if (localEnv.info.varArgs)
-                Assert.check(mtype.isErroneous() || tree.varargsElement != null);
 
             // Compute the result type.
             Type restype = mtype.getReturnType();
@@ -1514,7 +1556,7 @@
 
             // as a special case, array.clone() has a result that is
             // the same as static type of the array being cloned
-            if (tree.meth.getTag() == JCTree.SELECT &&
+            if (tree.meth.hasTag(SELECT) &&
                 allowCovariantReturns &&
                 methName == names.clone &&
                 types.isArray(((JCFieldAccess) tree.meth).selected.type))
@@ -1523,7 +1565,7 @@
             // as a special case, x.getClass() has type Class<? extends |X|>
             if (allowGenerics &&
                 methName == names.getClass && tree.args.isEmpty()) {
-                Type qualifier = (tree.meth.getTag() == JCTree.SELECT)
+                Type qualifier = (tree.meth.hasTag(SELECT))
                     ? ((JCFieldAccess) tree.meth).selected.type
                     : env.enclClass.sym.type;
                 restype = new
@@ -1538,7 +1580,10 @@
 
             // Check that value of resulting type is admissible in the
             // current context.  Also, capture the return type
-            result = check(tree, capture(restype), VAL, pkind, pt);
+            result = check(tree, capture(restype), VAL, resultInfo);
+
+            if (localEnv.info.varArgs)
+                Assert.check(result.isErroneous() || tree.varargsElement != null);
         }
         chk.validate(tree.typeargs, localEnv);
     }
@@ -1552,7 +1597,7 @@
             JCMethodDecl enclMethod = env.enclMethod;
             if (enclMethod != null && enclMethod.name == names.init) {
                 JCBlock body = enclMethod.body;
-                if (body.stats.head.getTag() == JCTree.EXEC &&
+                if (body.stats.head.hasTag(EXEC) &&
                     ((JCExpressionStatement) body.stats.head).expr == tree)
                     return true;
             }
@@ -1583,7 +1628,7 @@
         // complete class name to be fully qualified
         JCExpression clazz = tree.clazz; // Class field following new
         JCExpression clazzid =          // Identifier in class field
-            (clazz.getTag() == JCTree.TYPEAPPLY)
+            (clazz.hasTag(TYPEAPPLY))
             ? ((JCTypeApply) clazz).clazz
             : clazz;
 
@@ -1602,7 +1647,7 @@
                                              attribExpr(tree.encl, env));
             clazzid1 = make.at(clazz.pos).Select(make.Type(encltype),
                                                  ((JCIdent) clazzid).name);
-            if (clazz.getTag() == JCTree.TYPEAPPLY)
+            if (clazz.hasTag(TYPEAPPLY))
                 clazz = make.at(tree.pos).
                     TypeApply(clazzid1,
                               ((JCTypeApply) clazz).arguments);
@@ -1613,7 +1658,6 @@
         // Attribute clazz expression and store
         // symbol + type back into the attributed tree.
         Type clazztype = attribType(clazz, env);
-        Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype);
         clazztype = chk.checkDiamond(tree, clazztype);
         chk.validate(clazz, localEnv);
         if (tree.encl != null) {
@@ -1640,7 +1684,7 @@
         List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv);
 
         if (TreeInfo.isDiamond(tree) && !clazztype.isErroneous()) {
-            clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes);
+            clazztype = attribDiamond(localEnv, tree, clazztype, argtypes, typeargtypes);
             clazz.type = clazztype;
         } else if (allowDiamondFinder &&
                 tree.def == null &&
@@ -1657,7 +1701,6 @@
                 inferred = attribDiamond(localEnv,
                         tree,
                         clazztype,
-                        mapping,
                         argtypes,
                         typeargtypes);
             }
@@ -1668,7 +1711,7 @@
             if (inferred != null &&
                     !inferred.isErroneous() &&
                     inferred.tag == CLASS &&
-                    types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings)) {
+                    types.isAssignable(inferred, pt().tag == NONE ? clazztype : pt(), Warner.noWarnings)) {
                 String key = types.isSameType(clazztype, inferred) ?
                     "diamond.redundant.args" :
                     "diamond.redundant.args.1";
@@ -1681,7 +1724,7 @@
             // Enums may not be instantiated except implicitly
             if (allowEnums &&
                 (clazztype.tsym.flags_field&Flags.ENUM) != 0 &&
-                (env.tree.getTag() != JCTree.VARDEF ||
+                (!env.tree.hasTag(VARDEF) ||
                  (((JCVariableDecl) env.tree).mods.flags&Flags.ENUM) == 0 ||
                  ((JCVariableDecl) env.tree).init != tree))
                 log.error(tree.pos(), "enum.cant.be.instantiated");
@@ -1718,7 +1761,7 @@
                     tree.pos(), rsEnv, clazztype, argtypes, typeargtypes);
                 tree.constructorType = tree.constructor.type.isErroneous() ?
                     syms.errType :
-                    checkMethod(clazztype,
+                    checkConstructor(clazztype,
                         tree.constructor,
                         rsEnv,
                         tree.args,
@@ -1793,7 +1836,7 @@
                     tree.constructorType =  syms.errType;
                 }
                 else {
-                    tree.constructorType = checkMethod(clazztype,
+                    tree.constructorType = checkConstructor(clazztype,
                             tree.constructor,
                             localEnv,
                             tree.args,
@@ -1806,19 +1849,17 @@
             if (tree.constructor != null && tree.constructor.kind == MTH)
                 owntype = clazztype;
         }
-        result = check(tree, owntype, VAL, pkind, pt);
+        result = check(tree, owntype, VAL, resultInfo);
         chk.validate(tree.typeargs, localEnv);
     }
 
     Type attribDiamond(Env<AttrContext> env,
-                        JCNewClass tree,
+                        final JCNewClass tree,
                         Type clazztype,
-                        Pair<Scope, Scope> mapping,
                         List<Type> argtypes,
                         List<Type> typeargtypes) {
         if (clazztype.isErroneous() ||
-                clazztype.isInterface() ||
-                mapping == erroneousMapping) {
+                clazztype.isInterface()) {
             //if the type of the instance creation expression is erroneous,
             //or if it's an interface, or if something prevented us to form a valid
             //mapping, return the (possibly erroneous) type unchanged
@@ -1827,27 +1868,22 @@
 
         //dup attribution environment and augment the set of inference variables
         Env<AttrContext> localEnv = env.dup(tree);
-        localEnv.info.tvars = clazztype.tsym.type.getTypeArguments();
+
+        ClassType site = new ClassType(clazztype.getEnclosingType(),
+                    clazztype.tsym.type.getTypeArguments(),
+                    clazztype.tsym);
 
         //if the type of the instance creation expression is a class type
         //apply method resolution inference (JLS 15.12.2.7). The return type
         //of the resolved constructor will be a partially instantiated type
-        ((ClassSymbol) clazztype.tsym).members_field = mapping.snd;
-        Symbol constructor;
-        try {
-            constructor = rs.resolveDiamond(tree.pos(),
+        Symbol constructor = rs.resolveDiamond(tree.pos(),
                     localEnv,
-                    clazztype.tsym.type,
+                    site,
                     argtypes,
                     typeargtypes);
-        } finally {
-            ((ClassSymbol) clazztype.tsym).members_field = mapping.fst;
-        }
+
         if (constructor.kind == MTH) {
-            ClassType ct = new ClassType(clazztype.getEnclosingType(),
-                    clazztype.tsym.type.getTypeArguments(),
-                    clazztype.tsym);
-            clazztype = checkMethod(ct,
+            clazztype = checkMethod(site,
                     constructor,
                     localEnv,
                     tree.args,
@@ -1858,63 +1894,19 @@
             clazztype = syms.errType;
         }
 
-        if (clazztype.tag == FORALL && !pt.isErroneous()) {
-            //if the resolved constructor's return type has some uninferred
-            //type-variables, infer them using the expected type and declared
-            //bounds (JLS 15.12.2.8).
+        if (clazztype.tag == FORALL && !resultInfo.pt.isErroneous()) {
             try {
-                clazztype = infer.instantiateExpr((ForAll) clazztype,
-                        pt.tag == NONE ? syms.objectType : pt,
-                        Warner.noWarnings);
+                clazztype = resultInfo.checkContext.rawInstantiatePoly((ForAll)clazztype, pt(), Warner.noWarnings);
             } catch (Infer.InferenceException ex) {
                 //an error occurred while inferring uninstantiated type-variables
-                log.error(tree.clazz.pos(),
-                        "cant.apply.diamond.1",
-                        diags.fragment("diamond", clazztype.tsym),
-                        ex.diagnostic);
+                resultInfo.checkContext.report(tree.clazz.pos(), clazztype, resultInfo.pt,
+                        diags.fragment("cant.apply.diamond.1", diags.fragment("diamond", clazztype.tsym), ex.diagnostic));
             }
         }
-        return chk.checkClassType(tree.clazz.pos(),
-                clazztype,
-                true);
+
+        return chk.checkClassType(tree.clazz.pos(), clazztype, true);
     }
 
-    /** Creates a synthetic scope containing fake generic constructors.
-     *  Assuming that the original scope contains a constructor of the kind:
-     *  Foo(X x, Y y), where X,Y are class type-variables declared in Foo,
-     *  the synthetic scope is added a generic constructor of the kind:
-     *  <X,Y>Foo<X,Y>(X x, Y y). This is crucial in order to enable diamond
-     *  inference. The inferred return type of the synthetic constructor IS
-     *  the inferred type for the diamond operator.
-     */
-    private Pair<Scope, Scope> getSyntheticScopeMapping(Type ctype) {
-        if (ctype.tag != CLASS) {
-            return erroneousMapping;
-        }
-
-        Pair<Scope, Scope> mapping =
-                new Pair<Scope, Scope>(ctype.tsym.members(), new Scope(ctype.tsym));
-
-        //for each constructor in the original scope, create a synthetic constructor
-        //whose return type is the type of the class in which the constructor is
-        //declared, and insert it into the new scope.
-        for (Scope.Entry e = mapping.fst.lookup(names.init);
-                e.scope != null;
-                e = e.next()) {
-            Type synthRestype = new ClassType(ctype.getEnclosingType(),
-                        ctype.tsym.type.getTypeArguments(),
-                        ctype.tsym);
-            MethodSymbol synhConstr = new MethodSymbol(e.sym.flags(),
-                    names.init,
-                    types.createMethodTypeWithReturn(e.sym.type, synthRestype),
-                    e.sym.owner);
-            mapping.snd.enter(synhConstr);
-        }
-        return mapping;
-    }
-
-    private final Pair<Scope,Scope> erroneousMapping = new Pair<Scope,Scope>(null, null);
-
     /** Make an attributed null check tree.
      */
     public JCExpression makeNullCheck(JCExpression arg) {
@@ -1922,7 +1914,7 @@
         Name name = TreeInfo.name(arg);
         if (name == names._this || name == names._super) return arg;
 
-        int optag = JCTree.NULLCHK;
+        JCTree.Tag optag = NULLCHK;
         JCUnary tree = make.at(arg.pos).Unary(optag, arg);
         tree.operator = syms.nullcheck;
         tree.type = arg.type;
@@ -1943,14 +1935,14 @@
         } else {
             // we are seeing an untyped aggregate { ... }
             // this is allowed only if the prototype is an array
-            if (pt.tag == ARRAY) {
-                elemtype = types.elemtype(pt);
+            if (pt().tag == ARRAY) {
+                elemtype = types.elemtype(pt());
             } else {
-                if (pt.tag != ERROR) {
+                if (pt().tag != ERROR) {
                     log.error(tree.pos(), "illegal.initializer.for.type",
-                              pt);
+                              pt());
                 }
-                elemtype = types.createErrorType(pt);
+                elemtype = types.createErrorType(pt());
             }
         }
         if (tree.elems != null) {
@@ -1959,31 +1951,41 @@
         }
         if (!types.isReifiable(elemtype))
             log.error(tree.pos(), "generic.array.creation");
-        result = check(tree, owntype, VAL, pkind, pt);
+        result = check(tree, owntype, VAL, resultInfo);
+    }
+
+    @Override
+    public void visitLambda(JCLambda that) {
+        throw new UnsupportedOperationException("Lambda expression not supported yet");
+    }
+
+    @Override
+    public void visitReference(JCMemberReference that) {
+        throw new UnsupportedOperationException("Member references not supported yet");
     }
 
     public void visitParens(JCParens tree) {
-        Type owntype = attribTree(tree.expr, env, pkind, pt);
-        result = check(tree, owntype, pkind, pkind, pt);
+        Type owntype = attribTree(tree.expr, env, resultInfo);
+        result = check(tree, owntype, pkind(), resultInfo);
         Symbol sym = TreeInfo.symbol(tree);
         if (sym != null && (sym.kind&(TYP|PCK)) != 0)
             log.error(tree.pos(), "illegal.start.of.type");
     }
 
     public void visitAssign(JCAssign tree) {
-        Type owntype = attribTree(tree.lhs, env.dup(tree), VAR, Type.noType);
+        Type owntype = attribTree(tree.lhs, env.dup(tree), varInfo);
         Type capturedType = capture(owntype);
         attribExpr(tree.rhs, env, owntype);
-        result = check(tree, capturedType, VAL, pkind, pt);
+        result = check(tree, capturedType, VAL, resultInfo);
     }
 
     public void visitAssignop(JCAssignOp tree) {
         // Attribute arguments.
-        Type owntype = attribTree(tree.lhs, env, VAR, Type.noType);
+        Type owntype = attribTree(tree.lhs, env, varInfo);
         Type operand = attribExpr(tree.rhs, env);
         // Find operator.
         Symbol operator = tree.operator = rs.resolveBinaryOperator(
-            tree.pos(), tree.getTag() - JCTree.ASGOffset, env,
+            tree.pos(), tree.getTag().noAssignOp(), env,
             owntype, operand);
 
         if (operator.kind == MTH &&
@@ -1991,7 +1993,7 @@
                 !operand.isErroneous()) {
             chk.checkOperator(tree.pos(),
                               (OperatorSymbol)operator,
-                              tree.getTag() - JCTree.ASGOffset,
+                              tree.getTag().noAssignOp(),
                               owntype,
                               operand);
             chk.checkDivZero(tree.rhs.pos(), operator, operand);
@@ -1999,13 +2001,13 @@
                               operator.type.getReturnType(),
                               owntype);
         }
-        result = check(tree, owntype, VAL, pkind, pt);
+        result = check(tree, owntype, VAL, resultInfo);
     }
 
     public void visitUnary(JCUnary tree) {
         // Attribute arguments.
-        Type argtype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
-            ? attribTree(tree.arg, env, VAR, Type.noType)
+        Type argtype = (tree.getTag().isIncOrDecUnaryOp())
+            ? attribTree(tree.arg, env, varInfo)
             : chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env));
 
         // Find operator.
@@ -2015,7 +2017,7 @@
         Type owntype = types.createErrorType(tree.type);
         if (operator.kind == MTH &&
                 !argtype.isErroneous()) {
-            owntype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
+            owntype = (tree.getTag().isIncOrDecUnaryOp())
                 ? tree.arg.type
                 : operator.type.getReturnType();
             int opc = ((OperatorSymbol)operator).opcode;
@@ -2037,7 +2039,7 @@
                 }
             }
         }
-        result = check(tree, owntype, VAL, pkind, pt);
+        result = check(tree, owntype, VAL, resultInfo);
     }
 
     public void visitBinary(JCBinary tree) {
@@ -2090,7 +2092,7 @@
 
             chk.checkDivZero(tree.rhs.pos(), operator, right);
         }
-        result = check(tree, owntype, VAL, pkind, pt);
+        result = check(tree, owntype, VAL, resultInfo);
     }
 
     public void visitTypeCast(JCTypeCast tree) {
@@ -2103,7 +2105,8 @@
         Type owntype = chk.checkCastable(tree.expr.pos(), exprtype, clazztype);
         if (exprtype.constValue() != null)
             owntype = cfolder.coerce(exprtype, owntype);
-        result = check(tree, capture(owntype), VAL, pkind, pt);
+        result = check(tree, capture(owntype), VAL, resultInfo);
+        chk.checkRedundantCast(localEnv, tree);
     }
 
     public void visitTypeTest(JCInstanceOf tree) {
@@ -2113,7 +2116,7 @@
             tree.clazz.pos(), attribType(tree.clazz, env));
         chk.validate(tree.clazz, env, false);
         chk.checkCastable(tree.expr.pos(), exprtype, clazztype);
-        result = check(tree, syms.booleanType, VAL, pkind, pt);
+        result = check(tree, syms.booleanType, VAL, resultInfo);
     }
 
     public void visitIndexed(JCArrayAccess tree) {
@@ -2124,8 +2127,8 @@
             owntype = types.elemtype(atype);
         else if (atype.tag != ERROR)
             log.error(tree.pos(), "array.req.but.found", atype);
-        if ((pkind & VAR) == 0) owntype = capture(owntype);
-        result = check(tree, owntype, VAR, pkind, pt);
+        if ((pkind() & VAR) == 0) owntype = capture(owntype);
+        result = check(tree, owntype, VAR, resultInfo);
     }
 
     public void visitIdent(JCIdent tree) {
@@ -2133,16 +2136,16 @@
         boolean varArgs = false;
 
         // Find symbol
-        if (pt.tag == METHOD || pt.tag == FORALL) {
+        if (pt().tag == METHOD || pt().tag == FORALL) {
             // If we are looking for a method, the prototype `pt' will be a
             // method type with the type of the call's arguments as parameters.
             env.info.varArgs = false;
-            sym = rs.resolveMethod(tree.pos(), env, tree.name, pt.getParameterTypes(), pt.getTypeArguments());
+            sym = rs.resolveMethod(tree.pos(), env, tree.name, pt().getParameterTypes(), pt().getTypeArguments());
             varArgs = env.info.varArgs;
         } else if (tree.sym != null && tree.sym.kind != VAR) {
             sym = tree.sym;
         } else {
-            sym = rs.resolveIdent(tree.pos(), env, tree.name, pkind);
+            sym = rs.resolveIdent(tree.pos(), env, tree.name, pkind());
         }
         tree.sym = sym;
 
@@ -2189,7 +2192,7 @@
 
             // If we are expecting a variable (as opposed to a value), check
             // that the variable is assignable in the current environment.
-            if (pkind == VAR)
+            if (pkind() == VAR)
                 checkAssignable(tree.pos(), v, null, env);
         }
 
@@ -2210,7 +2213,7 @@
             while (env1.outer != null && !rs.isAccessible(env, env1.enclClass.sym.type, sym))
                 env1 = env1.outer;
         }
-        result = checkId(tree, env1.enclClass.sym.type, sym, env, pkind, pt, varArgs);
+        result = checkId(tree, env1.enclClass.sym.type, sym, env, resultInfo, varArgs);
     }
 
     public void visitSelect(JCFieldAccess tree) {
@@ -2221,14 +2224,14 @@
         {
             skind = TYP;
         } else {
-            if ((pkind & PCK) != 0) skind = skind | PCK;
-            if ((pkind & TYP) != 0) skind = skind | TYP | PCK;
-            if ((pkind & (VAL | MTH)) != 0) skind = skind | VAL | TYP;
+            if ((pkind() & PCK) != 0) skind = skind | PCK;
+            if ((pkind() & TYP) != 0) skind = skind | TYP | PCK;
+            if ((pkind() & (VAL | MTH)) != 0) skind = skind | VAL | TYP;
         }
 
         // Attribute the qualifier expression, and determine its symbol (if any).
-        Type site = attribTree(tree.selected, env, skind, Infer.anyPoly);
-        if ((pkind & (PCK | TYP)) == 0)
+        Type site = attribTree(tree.selected, env, new ResultInfo(skind, Infer.anyPoly));
+        if ((pkind() & (PCK | TYP)) == 0)
             site = capture(site); // Capture field access
 
         // don't allow T.class T[].class, etc
@@ -2263,10 +2266,10 @@
 
         // Determine the symbol represented by the selection.
         env.info.varArgs = false;
-        Symbol sym = selectSym(tree, sitesym, site, env, pt, pkind);
-        if (sym.exists() && !isType(sym) && (pkind & (PCK | TYP)) != 0) {
+        Symbol sym = selectSym(tree, sitesym, site, env, resultInfo);
+        if (sym.exists() && !isType(sym) && (pkind() & (PCK | TYP)) != 0) {
             site = capture(site);
-            sym = selectSym(tree, sitesym, site, env, pt, pkind);
+            sym = selectSym(tree, sitesym, site, env, resultInfo);
         }
         boolean varArgs = env.info.varArgs;
         tree.sym = sym;
@@ -2286,7 +2289,7 @@
 
             // If we are expecting a variable (as opposed to a value), check
             // that the variable is assignable in the current environment.
-            if (pkind == VAR)
+            if (pkind() == VAR)
                 checkAssignable(tree.pos(), v, tree.selected, env);
         }
 
@@ -2302,8 +2305,8 @@
 
         // Disallow selecting a type from an expression
         if (isType(sym) && (sitesym==null || (sitesym.kind&(TYP|PCK)) == 0)) {
-            tree.type = check(tree.selected, pt,
-                              sitesym == null ? VAL : sitesym.kind, TYP|PCK, pt);
+            tree.type = check(tree.selected, pt(),
+                              sitesym == null ? VAL : sitesym.kind, new ResultInfo(TYP|PCK, pt()));
         }
 
         if (isType(sitesym)) {
@@ -2343,7 +2346,7 @@
         }
 
         env.info.selectSuper = selectSuperPrev;
-        result = checkId(tree, site, sym, env, pkind, pt, varArgs);
+        result = checkId(tree, site, sym, env, resultInfo, varArgs);
         env.info.tvars = List.nil();
     }
     //where
@@ -2352,34 +2355,25 @@
          *  @param tree   The select tree.
          *  @param site   The type of the selected expression,
          *  @param env    The current environment.
-         *  @param pt     The current prototype.
-         *  @param pkind  The expected kind(s) of the Select expression.
+         *  @param resultInfo The current result.
          */
         private Symbol selectSym(JCFieldAccess tree,
-                                     Type site,
-                                     Env<AttrContext> env,
-                                     Type pt,
-                                     int pkind) {
-            return selectSym(tree, site.tsym, site, env, pt, pkind);
-        }
-        private Symbol selectSym(JCFieldAccess tree,
                                  Symbol location,
                                  Type site,
                                  Env<AttrContext> env,
-                                 Type pt,
-                                 int pkind) {
+                                 ResultInfo resultInfo) {
             DiagnosticPosition pos = tree.pos();
             Name name = tree.name;
             switch (site.tag) {
             case PACKAGE:
                 return rs.access(
-                    rs.findIdentInPackage(env, site.tsym, name, pkind),
+                    rs.findIdentInPackage(env, site.tsym, name, resultInfo.pkind),
                     pos, location, site, name, true);
             case ARRAY:
             case CLASS:
-                if (pt.tag == METHOD || pt.tag == FORALL) {
+                if (resultInfo.pt.tag == METHOD || resultInfo.pt.tag == FORALL) {
                     return rs.resolveQualifiedMethod(
-                        pos, env, location, site, name, pt.getParameterTypes(), pt.getTypeArguments());
+                        pos, env, location, site, name, resultInfo.pt.getParameterTypes(), resultInfo.pt.getTypeArguments());
                 } else if (name == names._this || name == names._super) {
                     return rs.resolveSelf(pos, env, site.tsym, name);
                 } else if (name == names._class) {
@@ -2394,8 +2388,8 @@
                         STATIC | PUBLIC | FINAL, names._class, t, site.tsym);
                 } else {
                     // We are seeing a plain identifier as selector.
-                    Symbol sym = rs.findIdentInType(env, site, name, pkind);
-                    if ((pkind & ERRONEOUS) == 0)
+                    Symbol sym = rs.findIdentInType(env, site, name, resultInfo.pkind);
+                    if ((resultInfo.pkind & ERRONEOUS) == 0)
                         sym = rs.access(sym, pos, location, site, name, true);
                     return sym;
                 }
@@ -2409,7 +2403,7 @@
                 // other words, we are seeing this illegal program:
                 // class B<T> extends A<T.foo> {}
                 Symbol sym = (site.getUpperBound() != null)
-                    ? selectSym(tree, location, capture(site.getUpperBound()), env, pt, pkind)
+                    ? selectSym(tree, location, capture(site.getUpperBound()), env, resultInfo)
                     : null;
                 if (sym == null) {
                     log.error(pos, "type.var.cant.be.deref");
@@ -2463,17 +2457,15 @@
          *                    expression, otherwise the type of the current class.
          *  @param sym        The symbol representing the identifier.
          *  @param env        The current environment.
-         *  @param pkind      The set of expected kinds.
-         *  @param pt         The expected type.
+         *  @param resultInfo    The expected result
          */
         Type checkId(JCTree tree,
                      Type site,
                      Symbol sym,
                      Env<AttrContext> env,
-                     int pkind,
-                     Type pt,
+                     ResultInfo resultInfo,
                      boolean useVarargs) {
-            if (pt.isErroneous()) return types.createErrorType(site);
+            if (resultInfo.pt.isErroneous()) return types.createErrorType(site);
             Type owntype; // The computed type of this identifier occurrence.
             switch (sym.kind) {
             case TYP:
@@ -2518,7 +2510,7 @@
                 // which is being assigned to, issue an unchecked warning if
                 // its type changes under erasure.
                 if (allowGenerics &&
-                    pkind == VAR &&
+                    resultInfo.pkind == VAR &&
                     v.owner.kind == TYP &&
                     (v.flags() & STATIC) == 0 &&
                     (site.tag == CLASS || site.tag == TYPEVAR)) {
@@ -2553,14 +2545,14 @@
                 if (v.getConstValue() != null && isStaticReference(tree))
                     owntype = owntype.constType(v.getConstValue());
 
-                if (pkind == VAL) {
+                if (resultInfo.pkind == VAL) {
                     owntype = capture(owntype); // capture "names as expressions"
                 }
                 break;
             case MTH: {
                 JCMethodInvocation app = (JCMethodInvocation)env.tree;
                 owntype = checkMethod(site, sym, env, app.args,
-                                      pt.getParameterTypes(), pt.getTypeArguments(),
+                                      resultInfo.pt.getParameterTypes(), resultInfo.pt.getTypeArguments(),
                                       env.info.varArgs);
                 break;
             }
@@ -2583,7 +2575,7 @@
 
             // Test (3): if symbol is a variable, check that its type and
             // kind are compatible with the prototype and protokind.
-            return check(tree, owntype, sym.kind, pkind, pt);
+            return check(tree, owntype, sym.kind, resultInfo);
         }
 
         /** Check that variable is initialized and evaluate the variable's
@@ -2613,7 +2605,7 @@
                 canOwnInitializer(env.info.scope.owner) &&
                 v.owner == env.info.scope.owner.enclClass() &&
                 ((v.flags() & STATIC) != 0) == Resolve.isStatic(env) &&
-                (env.tree.getTag() != JCTree.ASSIGN ||
+                (!env.tree.hasTag(ASSIGN) ||
                  TreeInfo.skipParens(((JCAssign) env.tree).lhs) != tree)) {
                 String suffix = (env.info.enclVar == v) ?
                                 "self.ref" : "forward.ref";
@@ -2696,7 +2688,7 @@
     Warner noteWarner = new Warner();
 
     /**
-     * Check that method arguments conform to its instantation.
+     * Check that method arguments conform to its instantiation.
      **/
     public Type checkMethod(Type site,
                             Symbol sym,
@@ -2733,112 +2725,44 @@
                                       true,
                                       useVarargs,
                                       noteWarner);
-        boolean warned = noteWarner.hasNonSilentLint(LintCategory.UNCHECKED);
+
+        boolean unchecked = noteWarner.hasNonSilentLint(LintCategory.UNCHECKED);
 
         // If this fails, something went wrong; we should not have
         // found the identifier in the first place.
         if (owntype == null) {
-            if (!pt.isErroneous())
+            if (!pt().isErroneous())
                 log.error(env.tree.pos(),
-                          "internal.error.cant.instantiate",
-                          sym, site,
-                          Type.toString(pt.getParameterTypes()));
+                           "internal.error.cant.instantiate",
+                           sym, site,
+                          Type.toString(pt().getParameterTypes()));
             owntype = types.createErrorType(site);
+            return types.createErrorType(site);
+        } else if (owntype.getReturnType().tag == FORALL && !unchecked) {
+            return owntype;
         } else {
-            // System.out.println("call   : " + env.tree);
-            // System.out.println("method : " + owntype);
-            // System.out.println("actuals: " + argtypes);
-            List<Type> formals = owntype.getParameterTypes();
-            Type last = useVarargs ? formals.last() : null;
-            if (sym.name==names.init &&
-                sym.owner == syms.enumSym)
-                formals = formals.tail.tail;
-            List<JCExpression> args = argtrees;
-            while (formals.head != last) {
-                JCTree arg = args.head;
-                Warner warn = chk.convertWarner(arg.pos(), arg.type, formals.head);
-                assertConvertible(arg, arg.type, formals.head, warn);
-                warned |= warn.hasNonSilentLint(LintCategory.UNCHECKED);
-                args = args.tail;
-                formals = formals.tail;
-            }
-            if (useVarargs) {
-                Type varArg = types.elemtype(last);
-                while (args.tail != null) {
-                    JCTree arg = args.head;
-                    Warner warn = chk.convertWarner(arg.pos(), arg.type, varArg);
-                    assertConvertible(arg, arg.type, varArg, warn);
-                    warned |= warn.hasNonSilentLint(LintCategory.UNCHECKED);
-                    args = args.tail;
-                }
-            } else if ((sym.flags() & VARARGS) != 0 && allowVarargs) {
-                // non-varargs call to varargs method
-                Type varParam = owntype.getParameterTypes().last();
-                Type lastArg = argtypes.last();
-                if (types.isSubtypeUnchecked(lastArg, types.elemtype(varParam)) &&
-                    !types.isSameType(types.erasure(varParam), types.erasure(lastArg)))
-                    log.warning(argtrees.last().pos(), "inexact.non-varargs.call",
-                                types.elemtype(varParam),
-                                varParam);
-            }
-
-            if (warned && sym.type.tag == FORALL) {
-                chk.warnUnchecked(env.tree.pos(),
-                                  "unchecked.meth.invocation.applied",
-                                  kindName(sym),
-                                  sym.name,
-                                  rs.methodArguments(sym.type.getParameterTypes()),
-                                  rs.methodArguments(argtypes),
-                                  kindName(sym.location()),
-                                  sym.location());
-                owntype = new MethodType(owntype.getParameterTypes(),
-                                         types.erasure(owntype.getReturnType()),
-                                         types.erasure(owntype.getThrownTypes()),
-                                         syms.methodClass);
-            }
-            if (useVarargs) {
-                JCTree tree = env.tree;
-                Type argtype = owntype.getParameterTypes().last();
-                if (owntype.getReturnType().tag != FORALL || warned) {
-                    chk.checkVararg(env.tree.pos(), owntype.getParameterTypes(), sym);
-                }
-                Type elemtype = types.elemtype(argtype);
-                switch (tree.getTag()) {
-                case JCTree.APPLY:
-                    ((JCMethodInvocation) tree).varargsElement = elemtype;
-                    break;
-                case JCTree.NEWCLASS:
-                    ((JCNewClass) tree).varargsElement = elemtype;
-                    break;
-                default:
-                    throw new AssertionError(""+tree);
-                }
-            }
+            return chk.checkMethod(owntype, sym, env, argtrees, argtypes, useVarargs, unchecked);
         }
+    }
+
+    /**
+     * Check that constructor arguments conform to its instantiation.
+     **/
+    public Type checkConstructor(Type site,
+                            Symbol sym,
+                            Env<AttrContext> env,
+                            final List<JCExpression> argtrees,
+                            List<Type> argtypes,
+                            List<Type> typeargtypes,
+                            boolean useVarargs) {
+        Type owntype = checkMethod(site, sym, env, argtrees, argtypes, typeargtypes, useVarargs);
+        chk.checkType(env.tree.pos(), owntype.getReturnType(), syms.voidType);
         return owntype;
     }
 
-    private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) {
-        if (types.isConvertible(actual, formal, warn))
-            return;
-
-        if (formal.isCompound()
-            && types.isSubtype(actual, types.supertype(formal))
-            && types.isSubtypeUnchecked(actual, types.interfaces(formal), warn))
-            return;
-
-        if (false) {
-            // TODO: make assertConvertible work
-            chk.typeError(tree.pos(), diags.fragment("incompatible.types"), actual, formal);
-            throw new AssertionError("Tree: " + tree
-                                     + " actual:" + actual
-                                     + " formal: " + formal);
-        }
-    }
-
     public void visitLiteral(JCLiteral tree) {
         result = check(
-            tree, litType(tree.typetag).constType(tree.value), VAL, pkind, pt);
+            tree, litType(tree.typetag).constType(tree.value), VAL, resultInfo);
     }
     //where
     /** Return the type of a literal with given type tag.
@@ -2848,13 +2772,13 @@
     }
 
     public void visitTypeIdent(JCPrimitiveTypeTree tree) {
-        result = check(tree, syms.typeOfTag[tree.typetag], TYP, pkind, pt);
+        result = check(tree, syms.typeOfTag[tree.typetag], TYP, resultInfo);
     }
 
     public void visitTypeArray(JCArrayTypeTree tree) {
         Type etype = attribType(tree.elemtype, env);
         Type type = new ArrayType(etype, syms.arrayClass);
-        result = check(tree, type, TYP, pkind, pt);
+        result = check(tree, type, TYP, resultInfo);
     }
 
     /** Visitor method for parameterized types.
@@ -2872,8 +2796,10 @@
 
         if (clazztype.tag == CLASS) {
             List<Type> formals = clazztype.tsym.type.getTypeArguments();
-
-            if (actuals.length() == formals.length() || actuals.length() == 0) {
+            if (actuals.isEmpty()) //diamond
+                actuals = formals;
+
+            if (actuals.length() == formals.length()) {
                 List<Type> a = actuals;
                 List<Type> f = formals;
                 while (a.nonEmpty()) {
@@ -2886,9 +2812,9 @@
                 if (clazzOuter.tag == CLASS) {
                     Type site;
                     JCExpression clazz = TreeInfo.typeIn(tree.clazz);
-                    if (clazz.getTag() == JCTree.IDENT) {
+                    if (clazz.hasTag(IDENT)) {
                         site = env.enclClass.sym.type;
-                    } else if (clazz.getTag() == JCTree.SELECT) {
+                    } else if (clazz.hasTag(SELECT)) {
                         site = ((JCFieldAccess) clazz).selected.type;
                     } else throw new AssertionError(""+tree);
                     if (clazzOuter.tag == CLASS && site != clazzOuter) {
@@ -2910,7 +2836,7 @@
                 owntype = types.createErrorType(tree.type);
             }
         }
-        result = check(tree, owntype, TYP, pkind, pt);
+        result = check(tree, owntype, TYP, resultInfo);
     }
 
     public void visitTypeUnion(JCTypeUnion tree) {
@@ -2947,7 +2873,7 @@
                 all_multicatchTypes.append(ctype);
             }
         }
-        Type t = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt);
+        Type t = check(tree, types.lub(multicatchTypes.toList()), TYP, resultInfo);
         if (t.tag == CLASS) {
             List<Type> alternatives =
                 ((all_multicatchTypes == null) ? multicatchTypes : all_multicatchTypes).toList();
@@ -3033,18 +2959,18 @@
         result = check(tree, new WildcardType(chk.checkRefType(tree.pos(), type),
                                               tree.kind.kind,
                                               syms.boundClass),
-                       TYP, pkind, pt);
+                       TYP, resultInfo);
     }
 
     public void visitAnnotation(JCAnnotation tree) {
-        log.error(tree.pos(), "annotation.not.valid.for.type", pt);
+        log.error(tree.pos(), "annotation.not.valid.for.type", pt());
         result = tree.type = syms.errType;
     }
 
     public void visitErroneous(JCErroneous tree) {
         if (tree.errs != null)
             for (JCTree err : tree.errs)
-                attribTree(err, env, ERR, pt);
+                attribTree(err, env, new ResultInfo(ERR, pt()));
         result = tree.type = syms.errType;
     }
 
@@ -3058,7 +2984,7 @@
      * Attribute an env for either a top level tree or class declaration.
      */
     public void attrib(Env<AttrContext> env) {
-        if (env.tree.getTag() == JCTree.TOPLEVEL)
+        if (env.tree.hasTag(TOPLEVEL))
             attribTopLevel(env);
         else
             attribClass(env.tree.pos(), env.enclClass.sym);
@@ -3235,7 +3161,7 @@
                 ((c.flags() & STATIC) == 0 || c.name == names.empty) &&
                 (TreeInfo.flags(l.head) & (STATIC | INTERFACE)) != 0) {
                 Symbol sym = null;
-                if (l.head.getTag() == JCTree.VARDEF) sym = ((JCVariableDecl) l.head).sym;
+                if (l.head.hasTag(VARDEF)) sym = ((JCVariableDecl) l.head).sym;
                 if (sym == null ||
                     sym.kind != VAR ||
                     ((VarSymbol) sym).getConstValue() == null)
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,10 +42,13 @@
 import com.sun.tools.javac.code.Symbol.*;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.ANNOTATION;
+import static com.sun.tools.javac.code.Flags.SYNCHRONIZED;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTags.*;
+import static com.sun.tools.javac.code.TypeTags.WILDCARD;
 
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** Type checking helper class for the attribution phase.
  *
@@ -60,6 +63,7 @@
 
     private final Names names;
     private final Log log;
+    private final Resolve rs;
     private final Symtab syms;
     private final Enter enter;
     private final Infer infer;
@@ -92,6 +96,7 @@
 
         names = Names.instance(context);
         log = Log.instance(context);
+        rs = Resolve.instance(context);
         syms = Symtab.instance(context);
         enter = Enter.instance(context);
         infer = Infer.instance(context);
@@ -103,10 +108,11 @@
 
         Source source = Source.instance(context);
         allowGenerics = source.allowGenerics();
+        allowVarargs = source.allowVarargs();
         allowAnnotations = source.allowAnnotations();
         allowCovariantReturns = source.allowCovariantReturns();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
-        complexInference = options.isSet(COMPLEXINFERENCE);
+        complexInference = options.isSet("complexinference");
         skipAnnotations = options.isSet("skipAnnotations");
         warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
         suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
@@ -134,6 +140,10 @@
      */
     boolean allowGenerics;
 
+    /** Switch: varargs enabled?
+     */
+    boolean allowVarargs;
+
     /** Switch: annotations enabled?
      */
     boolean allowAnnotations;
@@ -259,23 +269,6 @@
         else return syms.errType;
     }
 
-    /** Report a type error.
-     *  @param pos        Position to be used for error reporting.
-     *  @param problem    A string describing the error.
-     *  @param found      The type that was found.
-     *  @param req        The type that was required.
-     */
-    Type typeError(DiagnosticPosition pos, Object problem, Type found, Type req) {
-        log.error(pos, "prob.found.req",
-                  problem, found, req);
-        return types.createErrorType(found);
-    }
-
-    Type typeError(DiagnosticPosition pos, String problem, Type found, Type req, Object explanation) {
-        log.error(pos, "prob.found.req.1", problem, found, req, explanation);
-        return types.createErrorType(found);
-    }
-
     /** Report an error that wrong type tag was found.
      *  @param pos        Position to be used for error reporting.
      *  @param required   An internationalized string describing the type tag
@@ -306,7 +299,16 @@
      */
     void duplicateError(DiagnosticPosition pos, Symbol sym) {
         if (!sym.type.isErroneous()) {
-            log.error(pos, "already.defined", sym, sym.location());
+            Symbol location = sym.location();
+            if (location.kind == MTH &&
+                    ((MethodSymbol)location).isStaticOrInstanceInit()) {
+                log.error(pos, "already.defined.in.clinit", kindName(sym), sym,
+                        kindName(sym.location()), kindName(sym.location().enclClass()),
+                        sym.location().enclClass());
+            } else {
+                log.error(pos, "already.defined", kindName(sym), sym,
+                        kindName(sym.location()), sym.location());
+            }
         }
     }
 
@@ -411,6 +413,86 @@
  * Type Checking
  **************************************************************************/
 
+    /**
+     * A check context is an object that can be used to perform compatibility
+     * checks - depending on the check context, meaning of 'compatibility' might
+     * vary significantly.
+     */
+    interface CheckContext {
+        /**
+         * Is type 'found' compatible with type 'req' in given context
+         */
+        boolean compatible(Type found, Type req, Warner warn);
+        /**
+         * Instantiate a ForAll type against a given target type 'req' in given context
+         */
+        Type rawInstantiatePoly(ForAll found, Type req, Warner warn);
+        /**
+         * Report a check error
+         */
+        void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details);
+        /**
+         * Obtain a warner for this check context
+         */
+        public Warner checkWarner(DiagnosticPosition pos, Type found, Type req);
+    }
+
+    /**
+     * This class represent a check context that is nested within another check
+     * context - useful to check sub-expressions. The default behavior simply
+     * redirects all method calls to the enclosing check context leveraging
+     * the forwarding pattern.
+     */
+    static class NestedCheckContext implements CheckContext {
+        CheckContext enclosingContext;
+
+        NestedCheckContext(CheckContext enclosingContext) {
+            this.enclosingContext = enclosingContext;
+        }
+
+        public boolean compatible(Type found, Type req, Warner warn) {
+            return enclosingContext.compatible(found, req, warn);
+        }
+
+        public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) {
+            return enclosingContext.rawInstantiatePoly(found, req, warn);
+        }
+
+        public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
+            enclosingContext.report(pos, found, req, details);
+        }
+
+        public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) {
+            return enclosingContext.checkWarner(pos, found, req);
+        }
+    }
+
+    /**
+     * Check context to be used when evaluating assignment/return statements
+     */
+    CheckContext basicHandler = new CheckContext() {
+        public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
+            if (details == null) {
+                log.error(pos, "prob.found.req", found, req);
+            } else {
+                log.error(pos, "prob.found.req.1", details);
+            }
+        }
+        public boolean compatible(Type found, Type req, Warner warn) {
+            return types.isAssignable(found, req, warn);
+        }
+
+        public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) {
+            if (req.tag == NONE)
+                req = found.qtype.tag <= VOID ? found.qtype : syms.objectType;
+            return infer.instantiateExpr(found, req, warn);
+        }
+
+        public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) {
+            return convertWarner(pos, found, req);
+        }
+    };
+
     /** Check that a given type is assignable to a given proto-type.
      *  If it is, return the type, otherwise return errType.
      *  @param pos        Position to be used for error reporting.
@@ -418,64 +500,54 @@
      *  @param req        The type that was required.
      */
     Type checkType(DiagnosticPosition pos, Type found, Type req) {
-        return checkType(pos, found, req, "incompatible.types");
+        return checkType(pos, found, req, basicHandler);
     }
 
-    Type checkType(DiagnosticPosition pos, Type found, Type req, String errKey) {
+    Type checkType(final DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) {
         if (req.tag == ERROR)
             return req;
-        if (found.tag == FORALL)
-            return instantiatePoly(pos, (ForAll)found, req, convertWarner(pos, found, req));
+        if (found.tag == FORALL) {
+            ForAll fa = (ForAll)found;
+            Type owntype = instantiatePoly(pos, checkContext, fa, req, checkContext.checkWarner(pos, found, req));
+            return checkType(pos, owntype, req, checkContext);
+        }
         if (req.tag == NONE)
             return found;
-        if (types.isAssignable(found, req, convertWarner(pos, found, req)))
+        if (checkContext.compatible(found, req, checkContext.checkWarner(pos, found, req))) {
             return found;
-        if (found.tag <= DOUBLE && req.tag <= DOUBLE)
-            return typeError(pos, diags.fragment("possible.loss.of.precision"), found, req);
-        if (found.isSuperBound()) {
-            log.error(pos, "assignment.from.super-bound", found);
+        } else {
+            if (found.tag <= DOUBLE && req.tag <= DOUBLE) {
+                checkContext.report(pos, found, req, diags.fragment("possible.loss.of.precision"));
+                return types.createErrorType(found);
+            }
+            checkContext.report(pos, found, req, null);
             return types.createErrorType(found);
         }
-        if (req.isExtendsBound()) {
-            log.error(pos, "assignment.to.extends-bound", req);
-            return types.createErrorType(found);
-        }
-        return typeError(pos, diags.fragment(errKey), found, req);
     }
 
     /** Instantiate polymorphic type to some prototype, unless
      *  prototype is `anyPoly' in which case polymorphic type
      *  is returned unchanged.
      */
-    Type instantiatePoly(DiagnosticPosition pos, ForAll t, Type pt, Warner warn) throws Infer.NoInstanceException {
-        if (pt == Infer.anyPoly && complexInference) {
-            return t;
-        } else if (pt == Infer.anyPoly || pt.tag == NONE) {
-            Type newpt = t.qtype.tag <= VOID ? t.qtype : syms.objectType;
-            return instantiatePoly(pos, t, newpt, warn);
-        } else if (pt.tag == ERROR) {
-            return pt;
-        } else {
-            try {
-                return infer.instantiateExpr(t, pt, warn);
-            } catch (Infer.NoInstanceException ex) {
+    Type instantiatePoly(DiagnosticPosition pos, CheckContext checkContext, ForAll t, Type pt, Warner warn) throws Infer.NoInstanceException {
+        try {
+            return checkContext.rawInstantiatePoly(t, pt, warn);
+        } catch (final Infer.NoInstanceException ex) {
+            JCDiagnostic d = ex.getDiagnostic();
+            if (d != null) {
                 if (ex.isAmbiguous) {
-                    JCDiagnostic d = ex.getDiagnostic();
-                    log.error(pos,
-                              "undetermined.type" + (d!=null ? ".1" : ""),
-                              t, d);
-                    return types.createErrorType(pt);
-                } else {
-                    JCDiagnostic d = ex.getDiagnostic();
-                    return typeError(pos,
-                                     diags.fragment("incompatible.types" + (d!=null ? ".1" : ""), d),
-                                     t, pt);
+                    d = diags.fragment("undetermined.type", t, d);
                 }
-            } catch (Infer.InvalidInstanceException ex) {
-                JCDiagnostic d = ex.getDiagnostic();
-                log.error(pos, "invalid.inferred.types", t.tvars, d);
-                return types.createErrorType(pt);
             }
+            checkContext.report(pos, t, pt, d);
+            return types.createErrorType(pt);
+        } catch (Infer.InvalidInstanceException ex) {
+            JCDiagnostic d = ex.getDiagnostic();
+            if (d != null) {
+                d = diags.fragment("invalid.inferred.types", t.tvars, d);
+            }
+            checkContext.report(pos, t, pt, d);
+            return types.createErrorType(pt);
         }
     }
 
@@ -486,17 +558,48 @@
      *  @param req        The target type of the cast.
      */
     Type checkCastable(DiagnosticPosition pos, Type found, Type req) {
+        return checkCastable(pos, found, req, basicHandler);
+    }
+    Type checkCastable(DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) {
         if (found.tag == FORALL) {
-            instantiatePoly(pos, (ForAll) found, req, castWarner(pos, found, req));
+            instantiatePoly(pos, basicHandler, (ForAll) found, req, castWarner(pos, found, req));
             return req;
         } else if (types.isCastable(found, req, castWarner(pos, found, req))) {
             return req;
         } else {
-            return typeError(pos,
-                             diags.fragment("inconvertible.types"),
-                             found, req);
+            checkContext.report(pos, found, req, diags.fragment("inconvertible.types", found, req));
+            return types.createErrorType(found);
+        }
+    }
+
+    /** Check for redundant casts (i.e. where source type is a subtype of target type)
+     * The problem should only be reported for non-292 cast
+     */
+    public void checkRedundantCast(Env<AttrContext> env, JCTypeCast tree) {
+        if (!tree.type.isErroneous() &&
+            (env.info.lint == null || env.info.lint.isEnabled(Lint.LintCategory.CAST))
+            && types.isSameType(tree.expr.type, tree.clazz.type)
+            && !is292targetTypeCast(tree)) {
+            log.warning(Lint.LintCategory.CAST,
+                    tree.pos(), "redundant.cast", tree.expr.type);
         }
     }
+    //where
+            private boolean is292targetTypeCast(JCTypeCast tree) {
+                boolean is292targetTypeCast = false;
+                JCExpression expr = TreeInfo.skipParens(tree.expr);
+                if (expr.hasTag(APPLY)) {
+                    JCMethodInvocation apply = (JCMethodInvocation)expr;
+                    Symbol sym = TreeInfo.symbol(apply.meth);
+                    is292targetTypeCast = sym != null &&
+                        sym.kind == MTH &&
+                        (sym.flags() & HYPOTHETICAL) != 0;
+                }
+                return is292targetTypeCast;
+            }
+
+
+
 //where
         /** Is type a type variable, or a (possibly multi-dimensional) array of
          *  type variables?
@@ -513,16 +616,16 @@
      *  @param a             The type that should be bounded by bs.
      *  @param bs            The bound.
      */
-    private boolean checkExtends(Type a, TypeVar bs) {
+    private boolean checkExtends(Type a, Type bound) {
          if (a.isUnbound()) {
              return true;
          } else if (a.tag != WILDCARD) {
              a = types.upperBound(a);
-             return types.isSubtype(a, bs.bound);
+             return types.isSubtype(a, bound);
          } else if (a.isExtendsBound()) {
-             return types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings);
+             return types.isCastable(bound, types.upperBound(a), Warner.noWarnings);
          } else if (a.isSuperBound()) {
-             return !types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound());
+             return !types.notSoftSubtype(types.lowerBound(a), bound);
          }
          return true;
      }
@@ -731,22 +834,95 @@
                     (s.flags() & (STATIC | FINAL)) != 0);
         }
 
-    /**
-     * Check that vararg method call is sound
-     * @param pos Position to be used for error reporting.
-     * @param argtypes Actual arguments supplied to vararg method.
-     */
-    void checkVararg(DiagnosticPosition pos, List<Type> argtypes, Symbol msym) {
-        Type argtype = argtypes.last();
-        if (!types.isReifiable(argtype) &&
-                (!allowSimplifiedVarargs ||
-                msym.attribute(syms.trustMeType.tsym) == null ||
-                !isTrustMeAllowedOnMethod(msym))) {
-            warnUnchecked(pos,
-                              "unchecked.generic.array.creation",
-                              argtype);
+    Type checkMethod(Type owntype,
+                            Symbol sym,
+                            Env<AttrContext> env,
+                            final List<JCExpression> argtrees,
+                            List<Type> argtypes,
+                            boolean useVarargs,
+                            boolean unchecked) {
+        // System.out.println("call   : " + env.tree);
+        // System.out.println("method : " + owntype);
+        // System.out.println("actuals: " + argtypes);
+        List<Type> formals = owntype.getParameterTypes();
+        Type last = useVarargs ? formals.last() : null;
+        if (sym.name==names.init &&
+                sym.owner == syms.enumSym)
+                formals = formals.tail.tail;
+        List<JCExpression> args = argtrees;
+        while (formals.head != last) {
+            JCTree arg = args.head;
+            Warner warn = convertWarner(arg.pos(), arg.type, formals.head);
+            assertConvertible(arg, arg.type, formals.head, warn);
+            args = args.tail;
+            formals = formals.tail;
+        }
+        if (useVarargs) {
+            Type varArg = types.elemtype(last);
+            while (args.tail != null) {
+                JCTree arg = args.head;
+                Warner warn = convertWarner(arg.pos(), arg.type, varArg);
+                assertConvertible(arg, arg.type, varArg, warn);
+                args = args.tail;
+            }
+        } else if ((sym.flags() & VARARGS) != 0 && allowVarargs) {
+            // non-varargs call to varargs method
+            Type varParam = owntype.getParameterTypes().last();
+            Type lastArg = argtypes.last();
+            if (types.isSubtypeUnchecked(lastArg, types.elemtype(varParam)) &&
+                    !types.isSameType(types.erasure(varParam), types.erasure(lastArg)))
+                log.warning(argtrees.last().pos(), "inexact.non-varargs.call",
+                        types.elemtype(varParam), varParam);
         }
+        if (unchecked) {
+            warnUnchecked(env.tree.pos(),
+                    "unchecked.meth.invocation.applied",
+                    kindName(sym),
+                    sym.name,
+                    rs.methodArguments(sym.type.getParameterTypes()),
+                    rs.methodArguments(argtypes),
+                    kindName(sym.location()),
+                    sym.location());
+           owntype = new MethodType(owntype.getParameterTypes(),
+                   types.erasure(owntype.getReturnType()),
+                   types.erasure(owntype.getThrownTypes()),
+                   syms.methodClass);
+        }
+        if (useVarargs) {
+            JCTree tree = env.tree;
+            Type argtype = owntype.getParameterTypes().last();
+            if (!types.isReifiable(argtype) &&
+                    (!allowSimplifiedVarargs ||
+                    sym.attribute(syms.trustMeType.tsym) == null ||
+                    !isTrustMeAllowedOnMethod(sym))) {
+                warnUnchecked(env.tree.pos(),
+                                  "unchecked.generic.array.creation",
+                                  argtype);
+            }
+            Type elemtype = types.elemtype(argtype);
+            switch (tree.getTag()) {
+                case APPLY:
+                    ((JCMethodInvocation) tree).varargsElement = elemtype;
+                    break;
+                case NEWCLASS:
+                    ((JCNewClass) tree).varargsElement = elemtype;
+                    break;
+                default:
+                    throw new AssertionError(""+tree);
+            }
+         }
+         return owntype;
     }
+    //where
+        private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) {
+            if (types.isConvertible(actual, formal, warn))
+                return;
+
+            if (formal.isCompound()
+                && types.isSubtype(actual, types.supertype(formal))
+                && types.isSubtypeUnchecked(actual, types.interfaces(formal), warn))
+                return;
+        }
 
     /**
      * Check that type 't' is a valid instantiation of a generic class
@@ -764,18 +940,16 @@
             List<Type> actuals = type.allparams();
             List<Type> args = type.getTypeArguments();
             List<Type> forms = type.tsym.type.getTypeArguments();
-            ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
+            ListBuffer<Type> bounds_buf = new ListBuffer<Type>();
 
             // For matching pairs of actual argument types `a' and
             // formal type parameters with declared bound `b' ...
             while (args.nonEmpty() && forms.nonEmpty()) {
                 // exact type arguments needs to know their
                 // bounds (for upper and lower bound
-                // calculations).  So we create new TypeVars with
-                // bounds substed with actuals.
-                tvars_buf.append(types.substBound(((TypeVar)forms.head),
-                                                  formals,
-                                                  actuals));
+                // calculations).  So we create new bounds where
+                // type-parameters are replaced with actuals argument types.
+                bounds_buf.append(types.subst(forms.head.getUpperBound(), formals, actuals));
                 args = args.tail;
                 forms = forms.tail;
             }
@@ -792,32 +966,30 @@
             }
 
             args = type.getTypeArguments();
-            List<Type> tvars = tvars_buf.toList();
+            List<Type> bounds = bounds_buf.toList();
 
-            while (args.nonEmpty() && tvars.nonEmpty()) {
-                Type actual = types.subst(args.head,
-                    type.tsym.type.getTypeArguments(),
-                    tvars_buf.toList());
+            while (args.nonEmpty() && bounds.nonEmpty()) {
+                Type actual = args.head;
                 if (!isTypeArgErroneous(actual) &&
-                        !tvars.head.getUpperBound().isErroneous() &&
-                        !checkExtends(actual, (TypeVar)tvars.head)) {
+                        !bounds.head.isErroneous() &&
+                        !checkExtends(actual, bounds.head)) {
                     return args.head;
                 }
                 args = args.tail;
-                tvars = tvars.tail;
+                bounds = bounds.tail;
             }
 
             args = type.getTypeArguments();
-            tvars = tvars_buf.toList();
+            bounds = bounds_buf.toList();
 
             for (Type arg : types.capture(type).getTypeArguments()) {
                 if (arg.tag == TYPEVAR &&
                         arg.getUpperBound().isErroneous() &&
-                        !tvars.head.getUpperBound().isErroneous() &&
+                        !bounds.head.isErroneous() &&
                         !isTypeArgErroneous(args.head)) {
                     return args.head;
                 }
-                tvars = tvars.tail;
+                bounds = bounds.tail;
                 args = args.tail;
             }
 
@@ -978,7 +1150,7 @@
      *  <i>not</i> final.
      */
     private long implicitEnumFinalFlag(JCTree tree) {
-        if (tree.getTag() != JCTree.CLASSDEF) return 0;
+        if (!tree.hasTag(CLASSDEF)) return 0;
         class SpecialTreeVisitor extends JCTree.Visitor {
             boolean specialized;
             SpecialTreeVisitor() {
@@ -1090,7 +1262,7 @@
                 // not parameterized at all.
                 if (tree.type.getEnclosingType().isRaw())
                     log.error(tree.pos(), "improperly.formed.type.inner.raw.param");
-                if (tree.clazz.getTag() == JCTree.SELECT)
+                if (tree.clazz.hasTag(SELECT))
                     visitSelectInternal((JCFieldAccess)tree.clazz);
             }
         }
@@ -1160,12 +1332,17 @@
             if (lint.isEnabled(LintCategory.RAW) &&
                 tree.type.tag == CLASS &&
                 !TreeInfo.isDiamond(tree) &&
-                !env.enclClass.name.isEmpty() &&  //anonymous or intersection
+                !withinAnonConstr(env) &&
                 tree.type.isRaw()) {
                 log.warning(LintCategory.RAW,
                         tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
             }
         }
+
+        boolean withinAnonConstr(Env<AttrContext> env) {
+            return env.enclClass.name.isEmpty() &&
+                    env.enclMethod != null && env.enclMethod.name == names.init;
+        }
     }
 
 /* *************************************************************************
@@ -2097,25 +2274,26 @@
      */
     void checkOverrideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) {
          ClashFilter cf = new ClashFilter(site);
-         //for each method m1 that is a member of 'site'...
-         for (Symbol s1 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
-            //...find another method m2 that is overridden (directly or indirectly)
-            //by method 'sym' in 'site'
-            for (Symbol s2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
-                if (s1 == s2 || !sym.overrides(s2, site.tsym, types, false)) continue;
+        //for each method m1 that is overridden (directly or indirectly)
+        //by method 'sym' in 'site'...
+        for (Symbol m1 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
+            if (!sym.overrides(m1, site.tsym, types, false)) continue;
+             //...check each method m2 that is a member of 'site'
+             for (Symbol m2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
+                if (m2 == m1) continue;
                 //if (i) the signature of 'sym' is not a subsignature of m1 (seen as
                 //a member of 'site') and (ii) m1 has the same erasure as m2, issue an error
-                if (!types.isSubSignature(sym.type, types.memberType(site, s1), false) &&
-                        types.hasSameArgs(s1.erasure(types), s2.erasure(types))) {
+                if (!types.isSubSignature(sym.type, types.memberType(site, m2), false) &&
+                        types.hasSameArgs(m2.erasure(types), m1.erasure(types))) {
                     sym.flags_field |= CLASH;
-                    String key = s2 == sym ?
+                    String key = m1 == sym ?
                             "name.clash.same.erasure.no.override" :
                             "name.clash.same.erasure.no.override.1";
                     log.error(pos,
                             key,
                             sym, sym.location(),
-                            s1, s1.location(),
-                            s2, s2.location());
+                            m2, m2.location(),
+                            m1, m1.location());
                     return;
                 }
             }
@@ -2399,7 +2577,7 @@
 
         // count them off as they're annotated
         for (JCTree arg : a.args) {
-            if (arg.getTag() != JCTree.ASSIGN) continue; // recovery
+            if (!arg.hasTag(ASSIGN)) continue; // recovery
             JCAssign assign = (JCAssign) arg;
             Symbol m = TreeInfo.symbol(assign.lhs);
             if (m == null || m.type.isErroneous()) continue;
@@ -2428,12 +2606,12 @@
             a.args.tail == null)
             return;
 
-        if (a.args.head.getTag() != JCTree.ASSIGN) return; // error recovery
+        if (!a.args.head.hasTag(ASSIGN)) return; // error recovery
         JCAssign assign = (JCAssign) a.args.head;
         Symbol m = TreeInfo.symbol(assign.lhs);
         if (m.name != names.value) return;
         JCTree rhs = assign.rhs;
-        if (rhs.getTag() != JCTree.NEWARRAY) return;
+        if (!rhs.hasTag(NEWARRAY)) return;
         JCNewArray na = (JCNewArray) rhs;
         Set<Symbol> targets = new HashSet<Symbol>();
         for (JCTree elem : na.elems) {
@@ -2464,7 +2642,7 @@
                     warnDeprecated(pos, s);
                 }
             });
-        };
+        }
     }
 
     void checkSunAPI(final DiagnosticPosition pos, final Symbol s) {
@@ -2474,7 +2652,7 @@
                     if (enableSunApiLintControl)
                       warnSunApi(pos, "sun.proprietary", s);
                     else
-                      log.strictWarning(pos, "sun.proprietary", s);
+                      log.mandatoryWarning(pos, "sun.proprietary", s);
                 }
             });
         }
@@ -2492,7 +2670,7 @@
         try {
             tree.sym.flags_field |= LOCKED;
             for (JCTree def : tree.defs) {
-                if (def.getTag() != JCTree.METHODDEF) continue;
+                if (!def.hasTag(METHODDEF)) continue;
                 JCMethodDecl meth = (JCMethodDecl)def;
                 checkAnnotationResType(meth.pos(), meth.restype.type);
             }
@@ -2600,7 +2778,7 @@
      */
     int checkOperator(DiagnosticPosition pos,
                        OperatorSymbol operator,
-                       int tag,
+                       JCTree.Tag tag,
                        Type left,
                        Type right) {
         if (operator.opcode == ByteCodes.error) {
@@ -2636,7 +2814,8 @@
      * Check for empty statements after if
      */
     void checkEmptyIf(JCIf tree) {
-        if (tree.thenpart.getTag() == JCTree.SKIP && tree.elsepart == null && lint.isEnabled(LintCategory.EMPTY))
+        if (tree.thenpart.hasTag(SKIP) && tree.elsepart == null &&
+                lint.isEnabled(LintCategory.EMPTY))
             log.warning(LintCategory.EMPTY, tree.thenpart.pos(), "empty.if");
     }
 
@@ -2740,7 +2919,7 @@
     }
         // where
         private boolean isCanonical(JCTree tree) {
-            while (tree.getTag() == JCTree.SELECT) {
+            while (tree.hasTag(SELECT)) {
                 JCFieldAccess s = (JCFieldAccess) tree;
                 if (s.sym.owner != TreeInfo.symbol(s.selected))
                     return false;
--- a/src/share/classes/com/sun/tools/javac/comp/Enter.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Enter.java	Tue May 29 00:27:58 2012 +0100
@@ -34,7 +34,7 @@
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.main.RecognizedOptions.PkgInfo;
+import com.sun.tools.javac.main.Option.PkgInfo;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
@@ -228,7 +228,7 @@
      *  only, and members go into the class member scope.
      */
     Scope enterScope(Env<AttrContext> env) {
-        return (env.tree.getTag() == JCTree.CLASSDEF)
+        return (env.tree.hasTag(JCTree.Tag.CLASSDEF))
             ? ((JCClassDecl) env.tree).sym.members_field
             : env.info.scope;
     }
--- a/src/share/classes/com/sun/tools/javac/comp/Env.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Env.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -116,9 +116,9 @@
 
     /** Return closest enclosing environment which points to a tree with given tag.
      */
-    public Env<A> enclosing(int tag) {
+    public Env<A> enclosing(JCTree.Tag tag) {
         Env<A> env1 = this;
-        while (env1 != null && env1.tree.getTag() != tag) env1 = env1.next;
+        while (env1 != null && !env1.tree.hasTag(tag)) env1 = env1.next;
         return env1;
     }
 
--- a/src/share/classes/com/sun/tools/javac/comp/Flow.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,6 @@
 package com.sun.tools.javac.comp;
 
 import java.util.HashMap;
-import java.util.Map;
-import java.util.LinkedHashMap;
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.tree.*;
@@ -40,8 +38,10 @@
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.BLOCK;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTags.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** This pass implements dataflow analysis for Java programs.
  *  Liveness analysis checks that every statement is reachable.
@@ -177,7 +177,7 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class Flow extends TreeScanner {
+public class Flow {
     protected static final Context.Key<Flow> flowKey =
         new Context.Key<Flow>();
 
@@ -200,6 +200,11 @@
         return instance;
     }
 
+    public void analyzeTree(Env<AttrContext> env, TreeMaker make) {
+        new FlowAnalyzer().analyzeTree(env, make);
+        new AssignAnalyzer().analyzeTree(env, make);
+    }
+
     protected Flow(Context context) {
         context.put(flowKey, this);
         names = Names.instance(context);
@@ -214,1268 +219,1572 @@
         allowImprovedCatchAnalysis = source.allowImprovedCatchAnalysis();
     }
 
-    /** A flag that indicates whether the last statement could
-     *  complete normally.
-     */
-    private boolean alive;
-
-    /** The set of definitely assigned variables.
-     */
-    Bits inits;
-
-    /** The set of definitely unassigned variables.
-     */
-    Bits uninits;
-
-    HashMap<Symbol, List<Type>> preciseRethrowTypes;
-
-    /** The set of variables that are definitely unassigned everywhere
-     *  in current try block. This variable is maintained lazily; it is
-     *  updated only when something gets removed from uninits,
-     *  typically by being assigned in reachable code.  To obtain the
-     *  correct set of variables which are definitely unassigned
-     *  anywhere in current try block, intersect uninitsTry and
-     *  uninits.
-     */
-    Bits uninitsTry;
-
-    /** When analyzing a condition, inits and uninits are null.
-     *  Instead we have:
-     */
-    Bits initsWhenTrue;
-    Bits initsWhenFalse;
-    Bits uninitsWhenTrue;
-    Bits uninitsWhenFalse;
-
-    /** A mapping from addresses to variable symbols.
-     */
-    VarSymbol[] vars;
-
-    /** The current class being defined.
-     */
-    JCClassDecl classDef;
-
-    /** The first variable sequence number in this class definition.
+    /**
+     * Base visitor class for all visitors implementing dataflow analysis logic.
+     * This class define the shared logic for handling jumps (break/continue statements).
      */
-    int firstadr;
+    static abstract class BaseAnalyzer<P extends BaseAnalyzer.PendingExit> extends TreeScanner {
 
-    /** The next available variable sequence number.
-     */
-    int nextadr;
+        enum JumpKind {
+            BREAK(JCTree.Tag.BREAK) {
+                @Override
+                JCTree getTarget(JCTree tree) {
+                    return ((JCBreak)tree).target;
+                }
+            },
+            CONTINUE(JCTree.Tag.CONTINUE) {
+                @Override
+                JCTree getTarget(JCTree tree) {
+                    return ((JCContinue)tree).target;
+                }
+            };
 
-    /** The list of possibly thrown declarable exceptions.
-     */
-    List<Type> thrown;
+            JCTree.Tag treeTag;
 
-    /** The list of exceptions that are either caught or declared to be
-     *  thrown.
-     */
-    List<Type> caught;
+            private JumpKind(Tag treeTag) {
+                this.treeTag = treeTag;
+            }
+
+            abstract JCTree getTarget(JCTree tree);
+        }
 
-    /** The list of unreferenced automatic resources.
-     */
-    Scope unrefdResources;
+        /** The currently pending exits that go from current inner blocks
+         *  to an enclosing block, in source order.
+         */
+        ListBuffer<P> pendingExits;
 
-    /** Set when processing a loop body the second time for DU analysis. */
-    boolean loopPassTwo = false;
+        /** A pending exit.  These are the statements return, break, and
+         *  continue.  In addition, exception-throwing expressions or
+         *  statements are put here when not known to be caught.  This
+         *  will typically result in an error unless it is within a
+         *  try-finally whose finally block cannot complete normally.
+         */
+        abstract static class PendingExit {
+            JCTree tree;
 
-    /*-------------------- Environments ----------------------*/
+            PendingExit(JCTree tree) {
+                this.tree = tree;
+            }
+
+            abstract void resolveJump();
+        }
+
+        abstract void markDead();
+
+        /** Record an outward transfer of control. */
+        void recordExit(JCTree tree, P pe) {
+            pendingExits.append(pe);
+            markDead();
+        }
 
-    /** A pending exit.  These are the statements return, break, and
-     *  continue.  In addition, exception-throwing expressions or
-     *  statements are put here when not known to be caught.  This
-     *  will typically result in an error unless it is within a
-     *  try-finally whose finally block cannot complete normally.
-     */
-    static class PendingExit {
-        JCTree tree;
-        Bits inits;
-        Bits uninits;
-        Type thrown;
-        PendingExit(JCTree tree, Bits inits, Bits uninits) {
-            this.tree = tree;
-            this.inits = inits.dup();
-            this.uninits = uninits.dup();
+        /** Resolve all jumps of this statement. */
+        private boolean resolveJump(JCTree tree,
+                        ListBuffer<P> oldPendingExits,
+                        JumpKind jk) {
+            boolean resolved = false;
+            List<P> exits = pendingExits.toList();
+            pendingExits = oldPendingExits;
+            for (; exits.nonEmpty(); exits = exits.tail) {
+                P exit = exits.head;
+                if (exit.tree.hasTag(jk.treeTag) &&
+                        jk.getTarget(exit.tree) == tree) {
+                    exit.resolveJump();
+                    resolved = true;
+                } else {
+                    pendingExits.append(exit);
+                }
+            }
+            return resolved;
         }
-        PendingExit(JCTree tree, Type thrown) {
-            this.tree = tree;
-            this.thrown = thrown;
+
+        /** Resolve all breaks of this statement. */
+        boolean resolveContinues(JCTree tree) {
+            return resolveJump(tree, new ListBuffer<P>(), JumpKind.CONTINUE);
+        }
+
+        /** Resolve all continues of this statement. */
+        boolean resolveBreaks(JCTree tree, ListBuffer<P> oldPendingExits) {
+            return resolveJump(tree, oldPendingExits, JumpKind.BREAK);
         }
     }
 
-    /** The currently pending exits that go from current inner blocks
-     *  to an enclosing block, in source order.
-     */
-    ListBuffer<PendingExit> pendingExits;
-
-    /*-------------------- Exceptions ----------------------*/
-
-    /** Complain that pending exceptions are not caught.
+    /**
+     * This pass implements the first two steps of the dataflow analysis:
+     * (i) liveness analysis checks that every statement is reachable and (ii)
+     *  exception analysis to ensure that every checked exception that is
+     *  thrown is declared or caught.
      */
-    void errorUncaught() {
-        for (PendingExit exit = pendingExits.next();
-             exit != null;
-             exit = pendingExits.next()) {
-            if (classDef != null &&
-                classDef.pos == exit.tree.pos) {
-                log.error(exit.tree.pos(),
-                        "unreported.exception.default.constructor",
-                        exit.thrown);
-            } else if (exit.tree.getTag() == JCTree.VARDEF &&
-                    ((JCVariableDecl)exit.tree).sym.isResourceVariable()) {
-                log.error(exit.tree.pos(),
-                        "unreported.exception.implicit.close",
-                        exit.thrown,
-                        ((JCVariableDecl)exit.tree).sym.name);
-            } else {
-                log.error(exit.tree.pos(),
-                        "unreported.exception.need.to.catch.or.throw",
-                        exit.thrown);
+    class FlowAnalyzer extends BaseAnalyzer<FlowAnalyzer.FlowPendingExit> {
+
+        /** A flag that indicates whether the last statement could
+         *  complete normally.
+         */
+        private boolean alive;
+
+        HashMap<Symbol, List<Type>> preciseRethrowTypes;
+
+        /** The current class being defined.
+         */
+        JCClassDecl classDef;
+
+        /** The list of possibly thrown declarable exceptions.
+         */
+        List<Type> thrown;
+
+        /** The list of exceptions that are either caught or declared to be
+         *  thrown.
+         */
+        List<Type> caught;
+
+        class FlowPendingExit extends BaseAnalyzer.PendingExit {
+
+            Type thrown;
+
+            FlowPendingExit(JCTree tree, Type thrown) {
+                super(tree);
+                this.thrown = thrown;
+            }
+
+            void resolveJump() { /*do nothing*/ }
+        }
+
+        @Override
+        void markDead() {
+            alive = false;
+        }
+
+        /*-------------------- Exceptions ----------------------*/
+
+        /** Complain that pending exceptions are not caught.
+         */
+        void errorUncaught() {
+            for (FlowPendingExit exit = pendingExits.next();
+                 exit != null;
+                 exit = pendingExits.next()) {
+                if (classDef != null &&
+                    classDef.pos == exit.tree.pos) {
+                    log.error(exit.tree.pos(),
+                            "unreported.exception.default.constructor",
+                            exit.thrown);
+                } else if (exit.tree.hasTag(VARDEF) &&
+                        ((JCVariableDecl)exit.tree).sym.isResourceVariable()) {
+                    log.error(exit.tree.pos(),
+                            "unreported.exception.implicit.close",
+                            exit.thrown,
+                            ((JCVariableDecl)exit.tree).sym.name);
+                } else {
+                    log.error(exit.tree.pos(),
+                            "unreported.exception.need.to.catch.or.throw",
+                            exit.thrown);
+                }
+            }
+        }
+
+        /** Record that exception is potentially thrown and check that it
+         *  is caught.
+         */
+        void markThrown(JCTree tree, Type exc) {
+            if (!chk.isUnchecked(tree.pos(), exc)) {
+                if (!chk.isHandled(exc, caught))
+                    pendingExits.append(new FlowPendingExit(tree, exc));
+                    thrown = chk.incl(exc, thrown);
+            }
+        }
+
+    /*************************************************************************
+     * Visitor methods for statements and definitions
+     *************************************************************************/
+
+        /** Analyze a definition.
+         */
+        void scanDef(JCTree tree) {
+            scanStat(tree);
+            if (tree != null && tree.hasTag(JCTree.Tag.BLOCK) && !alive) {
+                log.error(tree.pos(),
+                          "initializer.must.be.able.to.complete.normally");
+            }
+        }
+
+        /** Analyze a statement. Check that statement is reachable.
+         */
+        void scanStat(JCTree tree) {
+            if (!alive && tree != null) {
+                log.error(tree.pos(), "unreachable.stmt");
+                if (!tree.hasTag(SKIP)) alive = true;
+            }
+            scan(tree);
+        }
+
+        /** Analyze list of statements.
+         */
+        void scanStats(List<? extends JCStatement> trees) {
+            if (trees != null)
+                for (List<? extends JCStatement> l = trees; l.nonEmpty(); l = l.tail)
+                    scanStat(l.head);
+        }
+
+        /* ------------ Visitor methods for various sorts of trees -------------*/
+
+        public void visitClassDef(JCClassDecl tree) {
+            if (tree.sym == null) return;
+
+            JCClassDecl classDefPrev = classDef;
+            List<Type> thrownPrev = thrown;
+            List<Type> caughtPrev = caught;
+            boolean alivePrev = alive;
+            ListBuffer<FlowPendingExit> pendingExitsPrev = pendingExits;
+            Lint lintPrev = lint;
+
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            if (tree.name != names.empty) {
+                caught = List.nil();
+            }
+            classDef = tree;
+            thrown = List.nil();
+            lint = lint.augment(tree.sym.attributes_field);
+
+            try {
+                // process all the static initializers
+                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                    if (!l.head.hasTag(METHODDEF) &&
+                        (TreeInfo.flags(l.head) & STATIC) != 0) {
+                        scanDef(l.head);
+                        errorUncaught();
+                    }
+                }
+
+                // add intersection of all thrown clauses of initial constructors
+                // to set of caught exceptions, unless class is anonymous.
+                if (tree.name != names.empty) {
+                    boolean firstConstructor = true;
+                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                        if (TreeInfo.isInitialConstructor(l.head)) {
+                            List<Type> mthrown =
+                                ((JCMethodDecl) l.head).sym.type.getThrownTypes();
+                            if (firstConstructor) {
+                                caught = mthrown;
+                                firstConstructor = false;
+                            } else {
+                                caught = chk.intersect(mthrown, caught);
+                            }
+                        }
+                    }
+                }
+
+                // process all the instance initializers
+                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                    if (!l.head.hasTag(METHODDEF) &&
+                        (TreeInfo.flags(l.head) & STATIC) == 0) {
+                        scanDef(l.head);
+                        errorUncaught();
+                    }
+                }
+
+                // in an anonymous class, add the set of thrown exceptions to
+                // the throws clause of the synthetic constructor and propagate
+                // outwards.
+                // Changing the throws clause on the fly is okay here because
+                // the anonymous constructor can't be invoked anywhere else,
+                // and its type hasn't been cached.
+                if (tree.name == names.empty) {
+                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                        if (TreeInfo.isInitialConstructor(l.head)) {
+                            JCMethodDecl mdef = (JCMethodDecl)l.head;
+                            mdef.thrown = make.Types(thrown);
+                            mdef.sym.type = types.createMethodTypeWithThrown(mdef.sym.type, thrown);
+                        }
+                    }
+                    thrownPrev = chk.union(thrown, thrownPrev);
+                }
+
+                // process all the methods
+                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                    if (l.head.hasTag(METHODDEF)) {
+                        scan(l.head);
+                        errorUncaught();
+                    }
+                }
+
+                thrown = thrownPrev;
+            } finally {
+                pendingExits = pendingExitsPrev;
+                alive = alivePrev;
+                caught = caughtPrev;
+                classDef = classDefPrev;
+                lint = lintPrev;
+            }
+        }
+
+        public void visitMethodDef(JCMethodDecl tree) {
+            if (tree.body == null) return;
+
+            List<Type> caughtPrev = caught;
+            List<Type> mthrown = tree.sym.type.getThrownTypes();
+            Lint lintPrev = lint;
+
+            lint = lint.augment(tree.sym.attributes_field);
+
+            Assert.check(pendingExits.isEmpty());
+
+            try {
+                for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
+                    JCVariableDecl def = l.head;
+                    scan(def);
+                }
+                if (TreeInfo.isInitialConstructor(tree))
+                    caught = chk.union(caught, mthrown);
+                else if ((tree.sym.flags() & (BLOCK | STATIC)) != BLOCK)
+                    caught = mthrown;
+                // else we are in an instance initializer block;
+                // leave caught unchanged.
+
+                alive = true;
+                scanStat(tree.body);
+
+                if (alive && tree.sym.type.getReturnType().tag != VOID)
+                    log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt");
+
+                List<FlowPendingExit> exits = pendingExits.toList();
+                pendingExits = new ListBuffer<FlowPendingExit>();
+                while (exits.nonEmpty()) {
+                    FlowPendingExit exit = exits.head;
+                    exits = exits.tail;
+                    if (exit.thrown == null) {
+                        Assert.check(exit.tree.hasTag(RETURN));
+                    } else {
+                        // uncaught throws will be reported later
+                        pendingExits.append(exit);
+                    }
+                }
+            } finally {
+                caught = caughtPrev;
+                lint = lintPrev;
+            }
+        }
+
+        public void visitVarDef(JCVariableDecl tree) {
+            if (tree.init != null) {
+                Lint lintPrev = lint;
+                lint = lint.augment(tree.sym.attributes_field);
+                try{
+                    scan(tree.init);
+                } finally {
+                    lint = lintPrev;
+                }
             }
         }
-    }
+
+        public void visitBlock(JCBlock tree) {
+            scanStats(tree.stats);
+        }
 
-    /** Record that exception is potentially thrown and check that it
-     *  is caught.
-     */
-    void markThrown(JCTree tree, Type exc) {
-        if (!chk.isUnchecked(tree.pos(), exc)) {
-            if (!chk.isHandled(exc, caught))
-                pendingExits.append(new PendingExit(tree, exc));
-                thrown = chk.incl(exc, thrown);
+        public void visitDoLoop(JCDoWhileLoop tree) {
+            ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            scanStat(tree.body);
+            alive |= resolveContinues(tree);
+            scan(tree.cond);
+            alive = alive && !tree.cond.type.isTrue();
+            alive |= resolveBreaks(tree, prevPendingExits);
         }
-    }
 
-    /*-------------- Processing variables ----------------------*/
+        public void visitWhileLoop(JCWhileLoop tree) {
+            ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            scan(tree.cond);
+            alive = !tree.cond.type.isFalse();
+            scanStat(tree.body);
+            alive |= resolveContinues(tree);
+            alive = resolveBreaks(tree, prevPendingExits) ||
+                !tree.cond.type.isTrue();
+        }
 
-    /** Do we need to track init/uninit state of this symbol?
-     *  I.e. is symbol either a local or a blank final variable?
-     */
-    boolean trackable(VarSymbol sym) {
-        return
-            (sym.owner.kind == MTH ||
-             ((sym.flags() & (FINAL | HASINIT | PARAMETER)) == FINAL &&
-              classDef.sym.isEnclosedBy((ClassSymbol)sym.owner)));
-    }
+        public void visitForLoop(JCForLoop tree) {
+            ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
+            scanStats(tree.init);
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            if (tree.cond != null) {
+                scan(tree.cond);
+                alive = !tree.cond.type.isFalse();
+            } else {
+                alive = true;
+            }
+            scanStat(tree.body);
+            alive |= resolveContinues(tree);
+            scan(tree.step);
+            alive = resolveBreaks(tree, prevPendingExits) ||
+                tree.cond != null && !tree.cond.type.isTrue();
+        }
 
-    /** Initialize new trackable variable by setting its address field
-     *  to the next available sequence number and entering it under that
-     *  index into the vars array.
-     */
-    void newVar(VarSymbol sym) {
-        if (nextadr == vars.length) {
-            VarSymbol[] newvars = new VarSymbol[nextadr * 2];
-            System.arraycopy(vars, 0, newvars, 0, nextadr);
-            vars = newvars;
+        public void visitForeachLoop(JCEnhancedForLoop tree) {
+            visitVarDef(tree.var);
+            ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
+            scan(tree.expr);
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            scanStat(tree.body);
+            alive |= resolveContinues(tree);
+            resolveBreaks(tree, prevPendingExits);
+            alive = true;
+        }
+
+        public void visitLabelled(JCLabeledStatement tree) {
+            ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            scanStat(tree.body);
+            alive |= resolveBreaks(tree, prevPendingExits);
         }
-        sym.adr = nextadr;
-        vars[nextadr] = sym;
-        inits.excl(nextadr);
-        uninits.incl(nextadr);
-        nextadr++;
-    }
+
+        public void visitSwitch(JCSwitch tree) {
+            ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            scan(tree.selector);
+            boolean hasDefault = false;
+            for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
+                alive = true;
+                JCCase c = l.head;
+                if (c.pat == null)
+                    hasDefault = true;
+                else
+                    scan(c.pat);
+                scanStats(c.stats);
+                // Warn about fall-through if lint switch fallthrough enabled.
+                if (alive &&
+                    lint.isEnabled(Lint.LintCategory.FALLTHROUGH) &&
+                    c.stats.nonEmpty() && l.tail.nonEmpty())
+                    log.warning(Lint.LintCategory.FALLTHROUGH,
+                                l.tail.head.pos(),
+                                "possible.fall-through.into.case");
+            }
+            if (!hasDefault) {
+                alive = true;
+            }
+            alive |= resolveBreaks(tree, prevPendingExits);
+        }
 
-    /** Record an initialization of a trackable variable.
-     */
-    void letInit(DiagnosticPosition pos, VarSymbol sym) {
-        if (sym.adr >= firstadr && trackable(sym)) {
-            if ((sym.flags() & FINAL) != 0) {
-                if ((sym.flags() & PARAMETER) != 0) {
-                    if ((sym.flags() & UNION) != 0) { //multi-catch parameter
-                        log.error(pos, "multicatch.parameter.may.not.be.assigned",
-                                  sym);
+        public void visitTry(JCTry tree) {
+            List<Type> caughtPrev = caught;
+            List<Type> thrownPrev = thrown;
+            thrown = List.nil();
+            for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
+                List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ?
+                        ((JCTypeUnion)l.head.param.vartype).alternatives :
+                        List.of(l.head.param.vartype);
+                for (JCExpression ct : subClauses) {
+                    caught = chk.incl(ct.type, caught);
+                }
+            }
+
+            ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<FlowPendingExit>();
+            for (JCTree resource : tree.resources) {
+                if (resource instanceof JCVariableDecl) {
+                    JCVariableDecl vdecl = (JCVariableDecl) resource;
+                    visitVarDef(vdecl);
+                } else if (resource instanceof JCExpression) {
+                    scan((JCExpression) resource);
+                } else {
+                    throw new AssertionError(tree);  // parser error
+                }
+            }
+            for (JCTree resource : tree.resources) {
+                List<Type> closeableSupertypes = resource.type.isCompound() ?
+                    types.interfaces(resource.type).prepend(types.supertype(resource.type)) :
+                    List.of(resource.type);
+                for (Type sup : closeableSupertypes) {
+                    if (types.asSuper(sup, syms.autoCloseableType.tsym) != null) {
+                        Symbol closeMethod = rs.resolveQualifiedMethod(tree,
+                                attrEnv,
+                                sup,
+                                names.close,
+                                List.<Type>nil(),
+                                List.<Type>nil());
+                        if (closeMethod.kind == MTH) {
+                            for (Type t : ((MethodSymbol)closeMethod).getThrownTypes()) {
+                                markThrown(resource, t);
+                            }
+                        }
                     }
-                    else {
-                        log.error(pos, "final.parameter.may.not.be.assigned",
-                              sym);
-                    }
-                } else if (!uninits.isMember(sym.adr)) {
-                    log.error(pos,
-                              loopPassTwo
-                              ? "var.might.be.assigned.in.loop"
-                              : "var.might.already.be.assigned",
-                              sym);
-                } else if (!inits.isMember(sym.adr)) {
-                    // reachable assignment
-                    uninits.excl(sym.adr);
-                    uninitsTry.excl(sym.adr);
-                } else {
-                    //log.rawWarning(pos, "unreachable assignment");//DEBUG
-                    uninits.excl(sym.adr);
                 }
             }
-            inits.incl(sym.adr);
-        } else if ((sym.flags() & FINAL) != 0) {
-            log.error(pos, "var.might.already.be.assigned", sym);
+            scanStat(tree.body);
+            List<Type> thrownInTry = allowImprovedCatchAnalysis ?
+                chk.union(thrown, List.of(syms.runtimeExceptionType, syms.errorType)) :
+                thrown;
+            thrown = thrownPrev;
+            caught = caughtPrev;
+            boolean aliveEnd = alive;
+
+            List<Type> caughtInTry = List.nil();
+            for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
+                alive = true;
+                JCVariableDecl param = l.head.param;
+                List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ?
+                        ((JCTypeUnion)l.head.param.vartype).alternatives :
+                        List.of(l.head.param.vartype);
+                List<Type> ctypes = List.nil();
+                List<Type> rethrownTypes = chk.diff(thrownInTry, caughtInTry);
+                for (JCExpression ct : subClauses) {
+                    Type exc = ct.type;
+                    if (exc != syms.unknownType) {
+                        ctypes = ctypes.append(exc);
+                        if (types.isSameType(exc, syms.objectType))
+                            continue;
+                        checkCaughtType(l.head.pos(), exc, thrownInTry, caughtInTry);
+                        caughtInTry = chk.incl(exc, caughtInTry);
+                    }
+                }
+                scan(param);
+                preciseRethrowTypes.put(param.sym, chk.intersect(ctypes, rethrownTypes));
+                scanStat(l.head.body);
+                preciseRethrowTypes.remove(param.sym);
+                aliveEnd |= alive;
+            }
+            if (tree.finalizer != null) {
+                List<Type> savedThrown = thrown;
+                thrown = List.nil();
+                ListBuffer<FlowPendingExit> exits = pendingExits;
+                pendingExits = prevPendingExits;
+                alive = true;
+                scanStat(tree.finalizer);
+                if (!alive) {
+                    // discard exits and exceptions from try and finally
+                    thrown = chk.union(thrown, thrownPrev);
+                    if (lint.isEnabled(Lint.LintCategory.FINALLY)) {
+                        log.warning(Lint.LintCategory.FINALLY,
+                                TreeInfo.diagEndPos(tree.finalizer),
+                                "finally.cannot.complete");
+                    }
+                } else {
+                    thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry));
+                    thrown = chk.union(thrown, savedThrown);
+                    // FIX: this doesn't preserve source order of exits in catch
+                    // versus finally!
+                    while (exits.nonEmpty()) {
+                        pendingExits.append(exits.next());
+                    }
+                    alive = aliveEnd;
+                }
+                tree.finallyCanCompleteNormally = alive;
+            } else {
+                thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry));
+                alive = aliveEnd;
+                ListBuffer<FlowPendingExit> exits = pendingExits;
+                pendingExits = prevPendingExits;
+                while (exits.nonEmpty()) pendingExits.append(exits.next());
+            }
         }
-    }
+
+        @Override
+        public void visitIf(JCIf tree) {
+            scan(tree.cond);
+            scanStat(tree.thenpart);
+            if (tree.elsepart != null) {
+                boolean aliveAfterThen = alive;
+                alive = true;
+                scanStat(tree.elsepart);
+                alive = alive | aliveAfterThen;
+            } else {
+                alive = true;
+            }
+        }
 
-    /** If tree is either a simple name or of the form this.name or
-     *  C.this.name, and tree represents a trackable variable,
-     *  record an initialization of the variable.
-     */
-    void letInit(JCTree tree) {
-        tree = TreeInfo.skipParens(tree);
-        if (tree.getTag() == JCTree.IDENT || tree.getTag() == JCTree.SELECT) {
-            Symbol sym = TreeInfo.symbol(tree);
-            if (sym.kind == VAR) {
-                letInit(tree.pos(), (VarSymbol)sym);
+        void checkCaughtType(DiagnosticPosition pos, Type exc, List<Type> thrownInTry, List<Type> caughtInTry) {
+            if (chk.subset(exc, caughtInTry)) {
+                log.error(pos, "except.already.caught", exc);
+            } else if (!chk.isUnchecked(pos, exc) &&
+                    !isExceptionOrThrowable(exc) &&
+                    !chk.intersects(exc, thrownInTry)) {
+                log.error(pos, "except.never.thrown.in.try", exc);
+            } else if (allowImprovedCatchAnalysis) {
+                List<Type> catchableThrownTypes = chk.intersect(List.of(exc), thrownInTry);
+                // 'catchableThrownTypes' cannnot possibly be empty - if 'exc' was an
+                // unchecked exception, the result list would not be empty, as the augmented
+                // thrown set includes { RuntimeException, Error }; if 'exc' was a checked
+                // exception, that would have been covered in the branch above
+                if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty() &&
+                        !isExceptionOrThrowable(exc)) {
+                    String key = catchableThrownTypes.length() == 1 ?
+                            "unreachable.catch" :
+                            "unreachable.catch.1";
+                    log.warning(pos, key, catchableThrownTypes);
+                }
+            }
+        }
+        //where
+            private boolean isExceptionOrThrowable(Type exc) {
+                return exc.tsym == syms.throwableType.tsym ||
+                    exc.tsym == syms.exceptionType.tsym;
+            }
+
+        public void visitBreak(JCBreak tree) {
+            recordExit(tree, new FlowPendingExit(tree, null));
+        }
+
+        public void visitContinue(JCContinue tree) {
+            recordExit(tree, new FlowPendingExit(tree, null));
+        }
+
+        public void visitReturn(JCReturn tree) {
+            scan(tree.expr);
+            // if not initial constructor, should markDead instead of recordExit
+            recordExit(tree, new FlowPendingExit(tree, null));
+        }
+
+        public void visitThrow(JCThrow tree) {
+            scan(tree.expr);
+            Symbol sym = TreeInfo.symbol(tree.expr);
+            if (sym != null &&
+                sym.kind == VAR &&
+                (sym.flags() & (FINAL | EFFECTIVELY_FINAL)) != 0 &&
+                preciseRethrowTypes.get(sym) != null &&
+                allowImprovedRethrowAnalysis) {
+                for (Type t : preciseRethrowTypes.get(sym)) {
+                    markThrown(tree, t);
+                }
+            }
+            else {
+                markThrown(tree, tree.expr.type);
+            }
+            markDead();
+        }
+
+        public void visitApply(JCMethodInvocation tree) {
+            scan(tree.meth);
+            scan(tree.args);
+            for (List<Type> l = tree.meth.type.getThrownTypes(); l.nonEmpty(); l = l.tail)
+                markThrown(tree, l.head);
+        }
+
+        public void visitNewClass(JCNewClass tree) {
+            scan(tree.encl);
+            scan(tree.args);
+           // scan(tree.def);
+            for (List<Type> l = tree.constructorType.getThrownTypes();
+                 l.nonEmpty();
+                 l = l.tail) {
+                markThrown(tree, l.head);
+            }
+            List<Type> caughtPrev = caught;
+            try {
+                // If the new class expression defines an anonymous class,
+                // analysis of the anonymous constructor may encounter thrown
+                // types which are unsubstituted type variables.
+                // However, since the constructor's actual thrown types have
+                // already been marked as thrown, it is safe to simply include
+                // each of the constructor's formal thrown types in the set of
+                // 'caught/declared to be thrown' types, for the duration of
+                // the class def analysis.
+                if (tree.def != null)
+                    for (List<Type> l = tree.constructor.type.getThrownTypes();
+                         l.nonEmpty();
+                         l = l.tail) {
+                        caught = chk.incl(l.head, caught);
+                    }
+                scan(tree.def);
+            }
+            finally {
+                caught = caughtPrev;
+            }
+        }
+
+        public void visitTopLevel(JCCompilationUnit tree) {
+            // Do nothing for TopLevel since each class is visited individually
+        }
+
+    /**************************************************************************
+     * main method
+     *************************************************************************/
+
+        /** Perform definite assignment/unassignment analysis on a tree.
+         */
+        public void analyzeTree(Env<AttrContext> env, TreeMaker make) {
+            try {
+                attrEnv = env;
+                JCTree tree = env.tree;
+                Flow.this.make = make;
+                pendingExits = new ListBuffer<FlowPendingExit>();
+                preciseRethrowTypes = new HashMap<Symbol, List<Type>>();
+                alive = true;
+                this.thrown = this.caught = null;
+                this.classDef = null;
+                scan(tree);
+            } finally {
+                pendingExits = null;
+                Flow.this.make = null;
+                this.thrown = this.caught = null;
+                this.classDef = null;
             }
         }
     }
 
-    /** Check that trackable variable is initialized.
+    /**
+     * This pass implements (i) definite assignment analysis, which ensures that
+     * each variable is assigned when used and (ii) definite unassignment analysis,
+     * which ensures that no final variable is assigned more than once. This visitor
+     * depends on the results of the liveliness analyzer.
      */
-    void checkInit(DiagnosticPosition pos, VarSymbol sym) {
-        if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
-            trackable(sym) &&
-            !inits.isMember(sym.adr)) {
-            log.error(pos, "var.might.not.have.been.initialized",
-                      sym);
-            inits.incl(sym.adr);
-        }
-    }
+    class AssignAnalyzer extends BaseAnalyzer<AssignAnalyzer.AssignPendingExit> {
+
+        /** The set of definitely assigned variables.
+         */
+        Bits inits;
+
+        /** The set of definitely unassigned variables.
+         */
+        Bits uninits;
 
-    /*-------------------- Handling jumps ----------------------*/
+        /** The set of variables that are definitely unassigned everywhere
+         *  in current try block. This variable is maintained lazily; it is
+         *  updated only when something gets removed from uninits,
+         *  typically by being assigned in reachable code.  To obtain the
+         *  correct set of variables which are definitely unassigned
+         *  anywhere in current try block, intersect uninitsTry and
+         *  uninits.
+         */
+        Bits uninitsTry;
 
-    /** Record an outward transfer of control. */
-    void recordExit(JCTree tree) {
-        pendingExits.append(new PendingExit(tree, inits, uninits));
-        markDead();
-    }
+        /** When analyzing a condition, inits and uninits are null.
+         *  Instead we have:
+         */
+        Bits initsWhenTrue;
+        Bits initsWhenFalse;
+        Bits uninitsWhenTrue;
+        Bits uninitsWhenFalse;
 
-    /** Resolve all breaks of this statement. */
-    boolean resolveBreaks(JCTree tree,
-                          ListBuffer<PendingExit> oldPendingExits) {
-        boolean result = false;
-        List<PendingExit> exits = pendingExits.toList();
-        pendingExits = oldPendingExits;
-        for (; exits.nonEmpty(); exits = exits.tail) {
-            PendingExit exit = exits.head;
-            if (exit.tree.getTag() == JCTree.BREAK &&
-                ((JCBreak) exit.tree).target == tree) {
-                inits.andSet(exit.inits);
-                uninits.andSet(exit.uninits);
-                result = true;
-            } else {
-                pendingExits.append(exit);
+        /** A mapping from addresses to variable symbols.
+         */
+        VarSymbol[] vars;
+
+        /** The current class being defined.
+         */
+        JCClassDecl classDef;
+
+        /** The first variable sequence number in this class definition.
+         */
+        int firstadr;
+
+        /** The next available variable sequence number.
+         */
+        int nextadr;
+
+        /** The list of unreferenced automatic resources.
+         */
+        Scope unrefdResources;
+
+        /** Set when processing a loop body the second time for DU analysis. */
+        boolean loopPassTwo = false;
+
+        class AssignPendingExit extends BaseAnalyzer.PendingExit {
+
+            Bits exit_inits;
+            Bits exit_uninits;
+
+            AssignPendingExit(JCTree tree, Bits inits, Bits uninits) {
+                super(tree);
+                this.exit_inits = inits.dup();
+                this.exit_uninits = uninits.dup();
             }
-        }
-        return result;
-    }
 
-    /** Resolve all continues of this statement. */
-    boolean resolveContinues(JCTree tree) {
-        boolean result = false;
-        List<PendingExit> exits = pendingExits.toList();
-        pendingExits = new ListBuffer<PendingExit>();
-        for (; exits.nonEmpty(); exits = exits.tail) {
-            PendingExit exit = exits.head;
-            if (exit.tree.getTag() == JCTree.CONTINUE &&
-                ((JCContinue) exit.tree).target == tree) {
-                inits.andSet(exit.inits);
-                uninits.andSet(exit.uninits);
-                result = true;
-            } else {
-                pendingExits.append(exit);
+            void resolveJump() {
+                inits.andSet(exit_inits);
+                uninits.andSet(exit_uninits);
             }
         }
-        return result;
-    }
 
-    /** Record that statement is unreachable.
-     */
-    void markDead() {
-        inits.inclRange(firstadr, nextadr);
-        uninits.inclRange(firstadr, nextadr);
-        alive = false;
-    }
+        @Override
+        void markDead() {
+            inits.inclRange(firstadr, nextadr);
+            uninits.inclRange(firstadr, nextadr);
+        }
+
+        /*-------------- Processing variables ----------------------*/
 
-    /** Split (duplicate) inits/uninits into WhenTrue/WhenFalse sets
-     */
-    void split(boolean setToNull) {
-        initsWhenFalse = inits.dup();
-        uninitsWhenFalse = uninits.dup();
-        initsWhenTrue = inits;
-        uninitsWhenTrue = uninits;
-        if (setToNull)
-            inits = uninits = null;
-    }
+        /** Do we need to track init/uninit state of this symbol?
+         *  I.e. is symbol either a local or a blank final variable?
+         */
+        boolean trackable(VarSymbol sym) {
+            return
+                (sym.owner.kind == MTH ||
+                 ((sym.flags() & (FINAL | HASINIT | PARAMETER)) == FINAL &&
+                  classDef.sym.isEnclosedBy((ClassSymbol)sym.owner)));
+        }
 
-    /** Merge (intersect) inits/uninits from WhenTrue/WhenFalse sets.
-     */
-    void merge() {
-        inits = initsWhenFalse.andSet(initsWhenTrue);
-        uninits = uninitsWhenFalse.andSet(uninitsWhenTrue);
-    }
-
-/* ************************************************************************
- * Visitor methods for statements and definitions
- *************************************************************************/
-
-    /** Analyze a definition.
-     */
-    void scanDef(JCTree tree) {
-        scanStat(tree);
-        if (tree != null && tree.getTag() == JCTree.BLOCK && !alive) {
-            log.error(tree.pos(),
-                      "initializer.must.be.able.to.complete.normally");
+        /** Initialize new trackable variable by setting its address field
+         *  to the next available sequence number and entering it under that
+         *  index into the vars array.
+         */
+        void newVar(VarSymbol sym) {
+            if (nextadr == vars.length) {
+                VarSymbol[] newvars = new VarSymbol[nextadr * 2];
+                System.arraycopy(vars, 0, newvars, 0, nextadr);
+                vars = newvars;
+            }
+            sym.adr = nextadr;
+            vars[nextadr] = sym;
+            inits.excl(nextadr);
+            uninits.incl(nextadr);
+            nextadr++;
         }
-    }
 
-    /** Analyze a statement. Check that statement is reachable.
-     */
-    void scanStat(JCTree tree) {
-        if (!alive && tree != null) {
-            log.error(tree.pos(), "unreachable.stmt");
-            if (tree.getTag() != JCTree.SKIP) alive = true;
-        }
-        scan(tree);
-    }
-
-    /** Analyze list of statements.
-     */
-    void scanStats(List<? extends JCStatement> trees) {
-        if (trees != null)
-            for (List<? extends JCStatement> l = trees; l.nonEmpty(); l = l.tail)
-                scanStat(l.head);
-    }
-
-    /** Analyze an expression. Make sure to set (un)inits rather than
-     *  (un)initsWhenTrue(WhenFalse) on exit.
-     */
-    void scanExpr(JCTree tree) {
-        if (tree != null) {
-            scan(tree);
-            if (inits == null) merge();
+        /** Record an initialization of a trackable variable.
+         */
+        void letInit(DiagnosticPosition pos, VarSymbol sym) {
+            if (sym.adr >= firstadr && trackable(sym)) {
+                if ((sym.flags() & FINAL) != 0) {
+                    if ((sym.flags() & PARAMETER) != 0) {
+                        if ((sym.flags() & UNION) != 0) { //multi-catch parameter
+                            log.error(pos, "multicatch.parameter.may.not.be.assigned",
+                                      sym);
+                        }
+                        else {
+                            log.error(pos, "final.parameter.may.not.be.assigned",
+                                  sym);
+                        }
+                    } else if (!uninits.isMember(sym.adr)) {
+                        log.error(pos,
+                                  loopPassTwo
+                                  ? "var.might.be.assigned.in.loop"
+                                  : "var.might.already.be.assigned",
+                                  sym);
+                    } else if (!inits.isMember(sym.adr)) {
+                        // reachable assignment
+                        uninits.excl(sym.adr);
+                        uninitsTry.excl(sym.adr);
+                    } else {
+                        //log.rawWarning(pos, "unreachable assignment");//DEBUG
+                        uninits.excl(sym.adr);
+                    }
+                }
+                inits.incl(sym.adr);
+            } else if ((sym.flags() & FINAL) != 0) {
+                log.error(pos, "var.might.already.be.assigned", sym);
+            }
         }
-    }
 
-    /** Analyze a list of expressions.
-     */
-    void scanExprs(List<? extends JCExpression> trees) {
-        if (trees != null)
-            for (List<? extends JCExpression> l = trees; l.nonEmpty(); l = l.tail)
-                scanExpr(l.head);
-    }
+        /** If tree is either a simple name or of the form this.name or
+         *  C.this.name, and tree represents a trackable variable,
+         *  record an initialization of the variable.
+         */
+        void letInit(JCTree tree) {
+            tree = TreeInfo.skipParens(tree);
+            if (tree.hasTag(IDENT) || tree.hasTag(SELECT)) {
+                Symbol sym = TreeInfo.symbol(tree);
+                if (sym.kind == VAR) {
+                    letInit(tree.pos(), (VarSymbol)sym);
+                }
+            }
+        }
 
-    /** Analyze a condition. Make sure to set (un)initsWhenTrue(WhenFalse)
-     *  rather than (un)inits on exit.
-     */
-    void scanCond(JCTree tree) {
-        if (tree.type.isFalse()) {
-            if (inits == null) merge();
-            initsWhenTrue = inits.dup();
-            initsWhenTrue.inclRange(firstadr, nextadr);
-            uninitsWhenTrue = uninits.dup();
-            uninitsWhenTrue.inclRange(firstadr, nextadr);
-            initsWhenFalse = inits;
-            uninitsWhenFalse = uninits;
-        } else if (tree.type.isTrue()) {
-            if (inits == null) merge();
+        /** Check that trackable variable is initialized.
+         */
+        void checkInit(DiagnosticPosition pos, VarSymbol sym) {
+            if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
+                trackable(sym) &&
+                !inits.isMember(sym.adr)) {
+                log.error(pos, "var.might.not.have.been.initialized",
+                          sym);
+                inits.incl(sym.adr);
+            }
+        }
+
+        /** Split (duplicate) inits/uninits into WhenTrue/WhenFalse sets
+         */
+        void split(boolean setToNull) {
             initsWhenFalse = inits.dup();
-            initsWhenFalse.inclRange(firstadr, nextadr);
             uninitsWhenFalse = uninits.dup();
-            uninitsWhenFalse.inclRange(firstadr, nextadr);
             initsWhenTrue = inits;
             uninitsWhenTrue = uninits;
-        } else {
-            scan(tree);
-            if (inits != null)
-                split(tree.type != syms.unknownType);
+            if (setToNull)
+                inits = uninits = null;
         }
-        if (tree.type != syms.unknownType)
-            inits = uninits = null;
-    }
 
-    /* ------------ Visitor methods for various sorts of trees -------------*/
+        /** Merge (intersect) inits/uninits from WhenTrue/WhenFalse sets.
+         */
+        void merge() {
+            inits = initsWhenFalse.andSet(initsWhenTrue);
+            uninits = uninitsWhenFalse.andSet(uninitsWhenTrue);
+        }
 
-    public void visitClassDef(JCClassDecl tree) {
-        if (tree.sym == null) return;
+    /* ************************************************************************
+     * Visitor methods for statements and definitions
+     *************************************************************************/
 
-        JCClassDecl classDefPrev = classDef;
-        List<Type> thrownPrev = thrown;
-        List<Type> caughtPrev = caught;
-        boolean alivePrev = alive;
-        int firstadrPrev = firstadr;
-        int nextadrPrev = nextadr;
-        ListBuffer<PendingExit> pendingExitsPrev = pendingExits;
-        Lint lintPrev = lint;
+        /** Analyze an expression. Make sure to set (un)inits rather than
+         *  (un)initsWhenTrue(WhenFalse) on exit.
+         */
+        void scanExpr(JCTree tree) {
+            if (tree != null) {
+                scan(tree);
+                if (inits == null) merge();
+            }
+        }
 
-        pendingExits = new ListBuffer<PendingExit>();
-        if (tree.name != names.empty) {
-            caught = List.nil();
-            firstadr = nextadr;
+        /** Analyze a list of expressions.
+         */
+        void scanExprs(List<? extends JCExpression> trees) {
+            if (trees != null)
+                for (List<? extends JCExpression> l = trees; l.nonEmpty(); l = l.tail)
+                    scanExpr(l.head);
         }
-        classDef = tree;
-        thrown = List.nil();
-        lint = lint.augment(tree.sym.attributes_field);
 
-        try {
-            // define all the static fields
-            for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
-                if (l.head.getTag() == JCTree.VARDEF) {
-                    JCVariableDecl def = (JCVariableDecl)l.head;
-                    if ((def.mods.flags & STATIC) != 0) {
-                        VarSymbol sym = def.sym;
-                        if (trackable(sym))
-                            newVar(sym);
-                    }
-                }
+        /** Analyze a condition. Make sure to set (un)initsWhenTrue(WhenFalse)
+         *  rather than (un)inits on exit.
+         */
+        void scanCond(JCTree tree) {
+            if (tree.type.isFalse()) {
+                if (inits == null) merge();
+                initsWhenTrue = inits.dup();
+                initsWhenTrue.inclRange(firstadr, nextadr);
+                uninitsWhenTrue = uninits.dup();
+                uninitsWhenTrue.inclRange(firstadr, nextadr);
+                initsWhenFalse = inits;
+                uninitsWhenFalse = uninits;
+            } else if (tree.type.isTrue()) {
+                if (inits == null) merge();
+                initsWhenFalse = inits.dup();
+                initsWhenFalse.inclRange(firstadr, nextadr);
+                uninitsWhenFalse = uninits.dup();
+                uninitsWhenFalse.inclRange(firstadr, nextadr);
+                initsWhenTrue = inits;
+                uninitsWhenTrue = uninits;
+            } else {
+                scan(tree);
+                if (inits != null)
+                    split(tree.type != syms.unknownType);
             }
+            if (tree.type != syms.unknownType)
+                inits = uninits = null;
+        }
 
-            // process all the static initializers
-            for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
-                if (l.head.getTag() != JCTree.METHODDEF &&
-                    (TreeInfo.flags(l.head) & STATIC) != 0) {
-                    scanDef(l.head);
-                    errorUncaught();
-                }
-            }
+        /* ------------ Visitor methods for various sorts of trees -------------*/
+
+        public void visitClassDef(JCClassDecl tree) {
+            if (tree.sym == null) return;
+
+            JCClassDecl classDefPrev = classDef;
+            int firstadrPrev = firstadr;
+            int nextadrPrev = nextadr;
+            ListBuffer<AssignPendingExit> pendingExitsPrev = pendingExits;
+            Lint lintPrev = lint;
 
-            // add intersection of all thrown clauses of initial constructors
-            // to set of caught exceptions, unless class is anonymous.
+            pendingExits = new ListBuffer<AssignPendingExit>();
             if (tree.name != names.empty) {
-                boolean firstConstructor = true;
+                firstadr = nextadr;
+            }
+            classDef = tree;
+            lint = lint.augment(tree.sym.attributes_field);
+
+            try {
+                // define all the static fields
                 for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
-                    if (TreeInfo.isInitialConstructor(l.head)) {
-                        List<Type> mthrown =
-                            ((JCMethodDecl) l.head).sym.type.getThrownTypes();
-                        if (firstConstructor) {
-                            caught = mthrown;
-                            firstConstructor = false;
-                        } else {
-                            caught = chk.intersect(mthrown, caught);
+                    if (l.head.hasTag(VARDEF)) {
+                        JCVariableDecl def = (JCVariableDecl)l.head;
+                        if ((def.mods.flags & STATIC) != 0) {
+                            VarSymbol sym = def.sym;
+                            if (trackable(sym))
+                                newVar(sym);
                         }
                     }
                 }
-            }
 
-            // define all the instance fields
-            for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
-                if (l.head.getTag() == JCTree.VARDEF) {
-                    JCVariableDecl def = (JCVariableDecl)l.head;
-                    if ((def.mods.flags & STATIC) == 0) {
-                        VarSymbol sym = def.sym;
-                        if (trackable(sym))
-                            newVar(sym);
+                // process all the static initializers
+                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                    if (!l.head.hasTag(METHODDEF) &&
+                        (TreeInfo.flags(l.head) & STATIC) != 0) {
+                        scan(l.head);
                     }
                 }
-            }
 
-            // process all the instance initializers
-            for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
-                if (l.head.getTag() != JCTree.METHODDEF &&
-                    (TreeInfo.flags(l.head) & STATIC) == 0) {
-                    scanDef(l.head);
-                    errorUncaught();
+                // define all the instance fields
+                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                    if (l.head.hasTag(VARDEF)) {
+                        JCVariableDecl def = (JCVariableDecl)l.head;
+                        if ((def.mods.flags & STATIC) == 0) {
+                            VarSymbol sym = def.sym;
+                            if (trackable(sym))
+                                newVar(sym);
+                        }
+                    }
                 }
-            }
 
-            // in an anonymous class, add the set of thrown exceptions to
-            // the throws clause of the synthetic constructor and propagate
-            // outwards.
-            // Changing the throws clause on the fly is okay here because
-            // the anonymous constructor can't be invoked anywhere else,
-            // and its type hasn't been cached.
-            if (tree.name == names.empty) {
+                // process all the instance initializers
                 for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
-                    if (TreeInfo.isInitialConstructor(l.head)) {
-                        JCMethodDecl mdef = (JCMethodDecl)l.head;
-                        mdef.thrown = make.Types(thrown);
-                        mdef.sym.type = types.createMethodTypeWithThrown(mdef.sym.type, thrown);
+                    if (!l.head.hasTag(METHODDEF) &&
+                        (TreeInfo.flags(l.head) & STATIC) == 0) {
+                        scan(l.head);
+                    }
+                }
+
+                // process all the methods
+                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
+                    if (l.head.hasTag(METHODDEF)) {
+                        scan(l.head);
                     }
                 }
-                thrownPrev = chk.union(thrown, thrownPrev);
+            } finally {
+                pendingExits = pendingExitsPrev;
+                nextadr = nextadrPrev;
+                firstadr = firstadrPrev;
+                classDef = classDefPrev;
+                lint = lintPrev;
             }
+        }
 
-            // process all the methods
-            for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
-                if (l.head.getTag() == JCTree.METHODDEF) {
-                    scan(l.head);
-                    errorUncaught();
-                }
-            }
+        public void visitMethodDef(JCMethodDecl tree) {
+            if (tree.body == null) return;
 
-            thrown = thrownPrev;
-        } finally {
-            pendingExits = pendingExitsPrev;
-            alive = alivePrev;
-            nextadr = nextadrPrev;
-            firstadr = firstadrPrev;
-            caught = caughtPrev;
-            classDef = classDefPrev;
-            lint = lintPrev;
-        }
-    }
+            Bits initsPrev = inits.dup();
+            Bits uninitsPrev = uninits.dup();
+            int nextadrPrev = nextadr;
+            int firstadrPrev = firstadr;
+            Lint lintPrev = lint;
 
-    public void visitMethodDef(JCMethodDecl tree) {
-        if (tree.body == null) return;
+            lint = lint.augment(tree.sym.attributes_field);
+
+            Assert.check(pendingExits.isEmpty());
 
-        List<Type> caughtPrev = caught;
-        List<Type> mthrown = tree.sym.type.getThrownTypes();
-        Bits initsPrev = inits.dup();
-        Bits uninitsPrev = uninits.dup();
-        int nextadrPrev = nextadr;
-        int firstadrPrev = firstadr;
-        Lint lintPrev = lint;
-
-        lint = lint.augment(tree.sym.attributes_field);
-
-        Assert.check(pendingExits.isEmpty());
+            try {
+                boolean isInitialConstructor =
+                    TreeInfo.isInitialConstructor(tree);
 
-        try {
-            boolean isInitialConstructor =
-                TreeInfo.isInitialConstructor(tree);
-
-            if (!isInitialConstructor)
-                firstadr = nextadr;
-            for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
-                JCVariableDecl def = l.head;
-                scan(def);
-                inits.incl(def.sym.adr);
-                uninits.excl(def.sym.adr);
-            }
-            if (isInitialConstructor)
-                caught = chk.union(caught, mthrown);
-            else if ((tree.sym.flags() & (BLOCK | STATIC)) != BLOCK)
-                caught = mthrown;
-            // else we are in an instance initializer block;
-            // leave caught unchanged.
+                if (!isInitialConstructor)
+                    firstadr = nextadr;
+                for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
+                    JCVariableDecl def = l.head;
+                    scan(def);
+                    inits.incl(def.sym.adr);
+                    uninits.excl(def.sym.adr);
+                }
+                // else we are in an instance initializer block;
+                // leave caught unchanged.
+                scan(tree.body);
 
-            alive = true;
-            scanStat(tree.body);
-
-            if (alive && tree.sym.type.getReturnType().tag != VOID)
-                log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt");
-
-            if (isInitialConstructor) {
-                for (int i = firstadr; i < nextadr; i++)
-                    if (vars[i].owner == classDef.sym)
-                        checkInit(TreeInfo.diagEndPos(tree.body), vars[i]);
-            }
-            List<PendingExit> exits = pendingExits.toList();
-            pendingExits = new ListBuffer<PendingExit>();
-            while (exits.nonEmpty()) {
-                PendingExit exit = exits.head;
-                exits = exits.tail;
-                if (exit.thrown == null) {
-                    Assert.check(exit.tree.getTag() == JCTree.RETURN);
+                if (isInitialConstructor) {
+                    for (int i = firstadr; i < nextadr; i++)
+                        if (vars[i].owner == classDef.sym)
+                            checkInit(TreeInfo.diagEndPos(tree.body), vars[i]);
+                }
+                List<AssignPendingExit> exits = pendingExits.toList();
+                pendingExits = new ListBuffer<AssignPendingExit>();
+                while (exits.nonEmpty()) {
+                    AssignPendingExit exit = exits.head;
+                    exits = exits.tail;
+                    Assert.check(exit.tree.hasTag(RETURN), exit.tree);
                     if (isInitialConstructor) {
-                        inits = exit.inits;
+                        inits = exit.exit_inits;
                         for (int i = firstadr; i < nextadr; i++)
                             checkInit(exit.tree.pos(), vars[i]);
                     }
-                } else {
-                    // uncaught throws will be reported later
-                    pendingExits.append(exit);
                 }
-            }
-        } finally {
-            inits = initsPrev;
-            uninits = uninitsPrev;
-            nextadr = nextadrPrev;
-            firstadr = firstadrPrev;
-            caught = caughtPrev;
-            lint = lintPrev;
-        }
-    }
-
-    public void visitVarDef(JCVariableDecl tree) {
-        boolean track = trackable(tree.sym);
-        if (track && tree.sym.owner.kind == MTH) newVar(tree.sym);
-        if (tree.init != null) {
-            Lint lintPrev = lint;
-            lint = lint.augment(tree.sym.attributes_field);
-            try{
-                scanExpr(tree.init);
-                if (track) letInit(tree.pos(), tree.sym);
             } finally {
+                inits = initsPrev;
+                uninits = uninitsPrev;
+                nextadr = nextadrPrev;
+                firstadr = firstadrPrev;
                 lint = lintPrev;
             }
         }
-    }
-
-    public void visitBlock(JCBlock tree) {
-        int nextadrPrev = nextadr;
-        scanStats(tree.stats);
-        nextadr = nextadrPrev;
-    }
 
-    public void visitDoLoop(JCDoWhileLoop tree) {
-        ListBuffer<PendingExit> prevPendingExits = pendingExits;
-        boolean prevLoopPassTwo = loopPassTwo;
-        pendingExits = new ListBuffer<PendingExit>();
-        int prevErrors = log.nerrors;
-        do {
-            Bits uninitsEntry = uninits.dup();
-            uninitsEntry.excludeFrom(nextadr);
-            scanStat(tree.body);
-            alive |= resolveContinues(tree);
-            scanCond(tree.cond);
-            if (log.nerrors !=  prevErrors ||
-                loopPassTwo ||
-                uninitsEntry.dup().diffSet(uninitsWhenTrue).nextBit(firstadr)==-1)
-                break;
-            inits = initsWhenTrue;
-            uninits = uninitsEntry.andSet(uninitsWhenTrue);
-            loopPassTwo = true;
-            alive = true;
-        } while (true);
-        loopPassTwo = prevLoopPassTwo;
-        inits = initsWhenFalse;
-        uninits = uninitsWhenFalse;
-        alive = alive && !tree.cond.type.isTrue();
-        alive |= resolveBreaks(tree, prevPendingExits);
-    }
+        public void visitVarDef(JCVariableDecl tree) {
+            boolean track = trackable(tree.sym);
+            if (track && tree.sym.owner.kind == MTH) newVar(tree.sym);
+            if (tree.init != null) {
+                Lint lintPrev = lint;
+                lint = lint.augment(tree.sym.attributes_field);
+                try{
+                    scanExpr(tree.init);
+                    if (track) letInit(tree.pos(), tree.sym);
+                } finally {
+                    lint = lintPrev;
+                }
+            }
+        }
+
+        public void visitBlock(JCBlock tree) {
+            int nextadrPrev = nextadr;
+            scan(tree.stats);
+            nextadr = nextadrPrev;
+        }
 
-    public void visitWhileLoop(JCWhileLoop tree) {
-        ListBuffer<PendingExit> prevPendingExits = pendingExits;
-        boolean prevLoopPassTwo = loopPassTwo;
-        Bits initsCond;
-        Bits uninitsCond;
-        pendingExits = new ListBuffer<PendingExit>();
-        int prevErrors = log.nerrors;
-        do {
-            Bits uninitsEntry = uninits.dup();
-            uninitsEntry.excludeFrom(nextadr);
-            scanCond(tree.cond);
-            initsCond = initsWhenFalse;
-            uninitsCond = uninitsWhenFalse;
-            inits = initsWhenTrue;
-            uninits = uninitsWhenTrue;
-            alive = !tree.cond.type.isFalse();
-            scanStat(tree.body);
-            alive |= resolveContinues(tree);
-            if (log.nerrors != prevErrors ||
-                loopPassTwo ||
-                uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
-                break;
-            uninits = uninitsEntry.andSet(uninits);
-            loopPassTwo = true;
-            alive = true;
-        } while (true);
-        loopPassTwo = prevLoopPassTwo;
-        inits = initsCond;
-        uninits = uninitsCond;
-        alive = resolveBreaks(tree, prevPendingExits) ||
-            !tree.cond.type.isTrue();
-    }
+        public void visitDoLoop(JCDoWhileLoop tree) {
+            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
+            boolean prevLoopPassTwo = loopPassTwo;
+            pendingExits = new ListBuffer<AssignPendingExit>();
+            int prevErrors = log.nerrors;
+            do {
+                Bits uninitsEntry = uninits.dup();
+                uninitsEntry.excludeFrom(nextadr);
+            scan(tree.body);
+            resolveContinues(tree);
+                scanCond(tree.cond);
+                if (log.nerrors !=  prevErrors ||
+                    loopPassTwo ||
+                    uninitsEntry.dup().diffSet(uninitsWhenTrue).nextBit(firstadr)==-1)
+                    break;
+                inits = initsWhenTrue;
+                uninits = uninitsEntry.andSet(uninitsWhenTrue);
+                loopPassTwo = true;
+            } while (true);
+            loopPassTwo = prevLoopPassTwo;
+            inits = initsWhenFalse;
+            uninits = uninitsWhenFalse;
+            resolveBreaks(tree, prevPendingExits);
+        }
 
-    public void visitForLoop(JCForLoop tree) {
-        ListBuffer<PendingExit> prevPendingExits = pendingExits;
-        boolean prevLoopPassTwo = loopPassTwo;
-        int nextadrPrev = nextadr;
-        scanStats(tree.init);
-        Bits initsCond;
-        Bits uninitsCond;
-        pendingExits = new ListBuffer<PendingExit>();
-        int prevErrors = log.nerrors;
-        do {
-            Bits uninitsEntry = uninits.dup();
-            uninitsEntry.excludeFrom(nextadr);
-            if (tree.cond != null) {
+        public void visitWhileLoop(JCWhileLoop tree) {
+            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
+            boolean prevLoopPassTwo = loopPassTwo;
+            Bits initsCond;
+            Bits uninitsCond;
+            pendingExits = new ListBuffer<AssignPendingExit>();
+            int prevErrors = log.nerrors;
+            do {
+                Bits uninitsEntry = uninits.dup();
+                uninitsEntry.excludeFrom(nextadr);
                 scanCond(tree.cond);
                 initsCond = initsWhenFalse;
                 uninitsCond = uninitsWhenFalse;
                 inits = initsWhenTrue;
                 uninits = uninitsWhenTrue;
-                alive = !tree.cond.type.isFalse();
-            } else {
-                initsCond = inits.dup();
-                initsCond.inclRange(firstadr, nextadr);
-                uninitsCond = uninits.dup();
-                uninitsCond.inclRange(firstadr, nextadr);
-                alive = true;
-            }
-            scanStat(tree.body);
-            alive |= resolveContinues(tree);
-            scan(tree.step);
-            if (log.nerrors != prevErrors ||
-                loopPassTwo ||
-                uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
-                break;
-            uninits = uninitsEntry.andSet(uninits);
-            loopPassTwo = true;
-            alive = true;
-        } while (true);
-        loopPassTwo = prevLoopPassTwo;
-        inits = initsCond;
-        uninits = uninitsCond;
-        alive = resolveBreaks(tree, prevPendingExits) ||
-            tree.cond != null && !tree.cond.type.isTrue();
-        nextadr = nextadrPrev;
-    }
+                scan(tree.body);
+                resolveContinues(tree);
+                if (log.nerrors != prevErrors ||
+                    loopPassTwo ||
+                    uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
+                    break;
+                uninits = uninitsEntry.andSet(uninits);
+                loopPassTwo = true;
+            } while (true);
+            loopPassTwo = prevLoopPassTwo;
+            inits = initsCond;
+            uninits = uninitsCond;
+            resolveBreaks(tree, prevPendingExits);
+        }
 
-    public void visitForeachLoop(JCEnhancedForLoop tree) {
-        visitVarDef(tree.var);
+        public void visitForLoop(JCForLoop tree) {
+            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
+            boolean prevLoopPassTwo = loopPassTwo;
+            int nextadrPrev = nextadr;
+            scan(tree.init);
+            Bits initsCond;
+            Bits uninitsCond;
+            pendingExits = new ListBuffer<AssignPendingExit>();
+            int prevErrors = log.nerrors;
+            do {
+                Bits uninitsEntry = uninits.dup();
+                uninitsEntry.excludeFrom(nextadr);
+                if (tree.cond != null) {
+                    scanCond(tree.cond);
+                    initsCond = initsWhenFalse;
+                    uninitsCond = uninitsWhenFalse;
+                    inits = initsWhenTrue;
+                    uninits = uninitsWhenTrue;
+                } else {
+                    initsCond = inits.dup();
+                    initsCond.inclRange(firstadr, nextadr);
+                    uninitsCond = uninits.dup();
+                    uninitsCond.inclRange(firstadr, nextadr);
+                }
+                scan(tree.body);
+                resolveContinues(tree);
+                scan(tree.step);
+                if (log.nerrors != prevErrors ||
+                    loopPassTwo ||
+                    uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
+                    break;
+                uninits = uninitsEntry.andSet(uninits);
+                loopPassTwo = true;
+            } while (true);
+            loopPassTwo = prevLoopPassTwo;
+            inits = initsCond;
+            uninits = uninitsCond;
+            resolveBreaks(tree, prevPendingExits);
+            nextadr = nextadrPrev;
+        }
 
-        ListBuffer<PendingExit> prevPendingExits = pendingExits;
-        boolean prevLoopPassTwo = loopPassTwo;
-        int nextadrPrev = nextadr;
-        scan(tree.expr);
-        Bits initsStart = inits.dup();
-        Bits uninitsStart = uninits.dup();
+        public void visitForeachLoop(JCEnhancedForLoop tree) {
+            visitVarDef(tree.var);
+
+            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
+            boolean prevLoopPassTwo = loopPassTwo;
+            int nextadrPrev = nextadr;
+            scan(tree.expr);
+            Bits initsStart = inits.dup();
+            Bits uninitsStart = uninits.dup();
+
+            letInit(tree.pos(), tree.var.sym);
+            pendingExits = new ListBuffer<AssignPendingExit>();
+            int prevErrors = log.nerrors;
+            do {
+                Bits uninitsEntry = uninits.dup();
+                uninitsEntry.excludeFrom(nextadr);
+                scan(tree.body);
+                resolveContinues(tree);
+                if (log.nerrors != prevErrors ||
+                    loopPassTwo ||
+                    uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
+                    break;
+                uninits = uninitsEntry.andSet(uninits);
+                loopPassTwo = true;
+            } while (true);
+            loopPassTwo = prevLoopPassTwo;
+            inits = initsStart;
+            uninits = uninitsStart.andSet(uninits);
+            resolveBreaks(tree, prevPendingExits);
+            nextadr = nextadrPrev;
+        }
+
+        public void visitLabelled(JCLabeledStatement tree) {
+            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<AssignPendingExit>();
+            scan(tree.body);
+            resolveBreaks(tree, prevPendingExits);
+        }
 
-        letInit(tree.pos(), tree.var.sym);
-        pendingExits = new ListBuffer<PendingExit>();
-        int prevErrors = log.nerrors;
-        do {
-            Bits uninitsEntry = uninits.dup();
-            uninitsEntry.excludeFrom(nextadr);
-            scanStat(tree.body);
-            alive |= resolveContinues(tree);
-            if (log.nerrors != prevErrors ||
-                loopPassTwo ||
-                uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
-                break;
-            uninits = uninitsEntry.andSet(uninits);
-            loopPassTwo = true;
-            alive = true;
-        } while (true);
-        loopPassTwo = prevLoopPassTwo;
-        inits = initsStart;
-        uninits = uninitsStart.andSet(uninits);
-        resolveBreaks(tree, prevPendingExits);
-        alive = true;
-        nextadr = nextadrPrev;
-    }
+        public void visitSwitch(JCSwitch tree) {
+            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<AssignPendingExit>();
+            int nextadrPrev = nextadr;
+            scanExpr(tree.selector);
+            Bits initsSwitch = inits;
+            Bits uninitsSwitch = uninits.dup();
+            boolean hasDefault = false;
+            for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
+                inits = initsSwitch.dup();
+                uninits = uninits.andSet(uninitsSwitch);
+                JCCase c = l.head;
+                if (c.pat == null)
+                    hasDefault = true;
+                else
+                    scanExpr(c.pat);
+                scan(c.stats);
+                addVars(c.stats, initsSwitch, uninitsSwitch);
+                // Warn about fall-through if lint switch fallthrough enabled.
+            }
+            if (!hasDefault) {
+                inits.andSet(initsSwitch);
+            }
+            resolveBreaks(tree, prevPendingExits);
+            nextadr = nextadrPrev;
+        }
+        // where
+            /** Add any variables defined in stats to inits and uninits. */
+            private void addVars(List<JCStatement> stats, Bits inits,
+                                        Bits uninits) {
+                for (;stats.nonEmpty(); stats = stats.tail) {
+                    JCTree stat = stats.head;
+                    if (stat.hasTag(VARDEF)) {
+                        int adr = ((JCVariableDecl) stat).sym.adr;
+                        inits.excl(adr);
+                        uninits.incl(adr);
+                    }
+                }
+            }
 
-    public void visitLabelled(JCLabeledStatement tree) {
-        ListBuffer<PendingExit> prevPendingExits = pendingExits;
-        pendingExits = new ListBuffer<PendingExit>();
-        scanStat(tree.body);
-        alive |= resolveBreaks(tree, prevPendingExits);
-    }
+        public void visitTry(JCTry tree) {
+            ListBuffer<JCVariableDecl> resourceVarDecls = ListBuffer.lb();
+            Bits uninitsTryPrev = uninitsTry;
+            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
+            pendingExits = new ListBuffer<AssignPendingExit>();
+            Bits initsTry = inits.dup();
+            uninitsTry = uninits.dup();
+            for (JCTree resource : tree.resources) {
+                if (resource instanceof JCVariableDecl) {
+                    JCVariableDecl vdecl = (JCVariableDecl) resource;
+                    visitVarDef(vdecl);
+                    unrefdResources.enter(vdecl.sym);
+                    resourceVarDecls.append(vdecl);
+                } else if (resource instanceof JCExpression) {
+                    scanExpr((JCExpression) resource);
+                } else {
+                    throw new AssertionError(tree);  // parser error
+                }
+            }
+            scan(tree.body);
+            uninitsTry.andSet(uninits);
+            Bits initsEnd = inits;
+            Bits uninitsEnd = uninits;
+            int nextadrCatch = nextadr;
+
+            if (!resourceVarDecls.isEmpty() &&
+                    lint.isEnabled(Lint.LintCategory.TRY)) {
+                for (JCVariableDecl resVar : resourceVarDecls) {
+                    if (unrefdResources.includes(resVar.sym)) {
+                        log.warning(Lint.LintCategory.TRY, resVar.pos(),
+                                    "try.resource.not.referenced", resVar.sym);
+                        unrefdResources.remove(resVar.sym);
+                    }
+                }
+            }
 
-    public void visitSwitch(JCSwitch tree) {
-        ListBuffer<PendingExit> prevPendingExits = pendingExits;
-        pendingExits = new ListBuffer<PendingExit>();
-        int nextadrPrev = nextadr;
-        scanExpr(tree.selector);
-        Bits initsSwitch = inits;
-        Bits uninitsSwitch = uninits.dup();
-        boolean hasDefault = false;
-        for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
-            alive = true;
-            inits = initsSwitch.dup();
-            uninits = uninits.andSet(uninitsSwitch);
-            JCCase c = l.head;
-            if (c.pat == null)
-                hasDefault = true;
-            else
-                scanExpr(c.pat);
-            scanStats(c.stats);
-            addVars(c.stats, initsSwitch, uninitsSwitch);
-            // Warn about fall-through if lint switch fallthrough enabled.
-            if (!loopPassTwo &&
-                alive &&
-                lint.isEnabled(Lint.LintCategory.FALLTHROUGH) &&
-                c.stats.nonEmpty() && l.tail.nonEmpty())
-                log.warning(Lint.LintCategory.FALLTHROUGH,
-                            l.tail.head.pos(),
-                            "possible.fall-through.into.case");
+            for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
+                JCVariableDecl param = l.head.param;
+                inits = initsTry.dup();
+                uninits = uninitsTry.dup();
+                scan(param);
+                inits.incl(param.sym.adr);
+                uninits.excl(param.sym.adr);
+                scan(l.head.body);
+                initsEnd.andSet(inits);
+                uninitsEnd.andSet(uninits);
+                nextadr = nextadrCatch;
+            }
+            if (tree.finalizer != null) {
+                inits = initsTry.dup();
+                uninits = uninitsTry.dup();
+                ListBuffer<AssignPendingExit> exits = pendingExits;
+                pendingExits = prevPendingExits;
+                scan(tree.finalizer);
+                if (!tree.finallyCanCompleteNormally) {
+                    // discard exits and exceptions from try and finally
+                } else {
+                    uninits.andSet(uninitsEnd);
+                    // FIX: this doesn't preserve source order of exits in catch
+                    // versus finally!
+                    while (exits.nonEmpty()) {
+                        AssignPendingExit exit = exits.next();
+                        if (exit.exit_inits != null) {
+                            exit.exit_inits.orSet(inits);
+                            exit.exit_uninits.andSet(uninits);
+                        }
+                        pendingExits.append(exit);
+                    }
+                    inits.orSet(initsEnd);
+                }
+            } else {
+                inits = initsEnd;
+                uninits = uninitsEnd;
+                ListBuffer<AssignPendingExit> exits = pendingExits;
+                pendingExits = prevPendingExits;
+                while (exits.nonEmpty()) pendingExits.append(exits.next());
+            }
+            uninitsTry.andSet(uninitsTryPrev).andSet(uninits);
         }
-        if (!hasDefault) {
-            inits.andSet(initsSwitch);
-            alive = true;
-        }
-        alive |= resolveBreaks(tree, prevPendingExits);
-        nextadr = nextadrPrev;
-    }
-    // where
-        /** Add any variables defined in stats to inits and uninits. */
-        private static void addVars(List<JCStatement> stats, Bits inits,
-                                    Bits uninits) {
-            for (;stats.nonEmpty(); stats = stats.tail) {
-                JCTree stat = stats.head;
-                if (stat.getTag() == JCTree.VARDEF) {
-                    int adr = ((JCVariableDecl) stat).sym.adr;
-                    inits.excl(adr);
-                    uninits.incl(adr);
-                }
+
+        public void visitConditional(JCConditional tree) {
+            scanCond(tree.cond);
+            Bits initsBeforeElse = initsWhenFalse;
+            Bits uninitsBeforeElse = uninitsWhenFalse;
+            inits = initsWhenTrue;
+            uninits = uninitsWhenTrue;
+            if (tree.truepart.type.tag == BOOLEAN &&
+                tree.falsepart.type.tag == BOOLEAN) {
+                // if b and c are boolean valued, then
+                // v is (un)assigned after a?b:c when true iff
+                //    v is (un)assigned after b when true and
+                //    v is (un)assigned after c when true
+                scanCond(tree.truepart);
+                Bits initsAfterThenWhenTrue = initsWhenTrue.dup();
+                Bits initsAfterThenWhenFalse = initsWhenFalse.dup();
+                Bits uninitsAfterThenWhenTrue = uninitsWhenTrue.dup();
+                Bits uninitsAfterThenWhenFalse = uninitsWhenFalse.dup();
+                inits = initsBeforeElse;
+                uninits = uninitsBeforeElse;
+                scanCond(tree.falsepart);
+                initsWhenTrue.andSet(initsAfterThenWhenTrue);
+                initsWhenFalse.andSet(initsAfterThenWhenFalse);
+                uninitsWhenTrue.andSet(uninitsAfterThenWhenTrue);
+                uninitsWhenFalse.andSet(uninitsAfterThenWhenFalse);
+            } else {
+                scanExpr(tree.truepart);
+                Bits initsAfterThen = inits.dup();
+                Bits uninitsAfterThen = uninits.dup();
+                inits = initsBeforeElse;
+                uninits = uninitsBeforeElse;
+                scanExpr(tree.falsepart);
+                inits.andSet(initsAfterThen);
+                uninits.andSet(uninitsAfterThen);
             }
         }
 
-    public void visitTry(JCTry tree) {
-        List<Type> caughtPrev = caught;
-        List<Type> thrownPrev = thrown;
-        thrown = List.nil();
-        for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
-            List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ?
-                    ((JCTypeUnion)l.head.param.vartype).alternatives :
-                    List.of(l.head.param.vartype);
-            for (JCExpression ct : subClauses) {
-                caught = chk.incl(ct.type, caught);
-            }
-        }
-        ListBuffer<JCVariableDecl> resourceVarDecls = ListBuffer.lb();
-        Bits uninitsTryPrev = uninitsTry;
-        ListBuffer<PendingExit> prevPendingExits = pendingExits;
-        pendingExits = new ListBuffer<PendingExit>();
-        Bits initsTry = inits.dup();
-        uninitsTry = uninits.dup();
-        for (JCTree resource : tree.resources) {
-            if (resource instanceof JCVariableDecl) {
-                JCVariableDecl vdecl = (JCVariableDecl) resource;
-                visitVarDef(vdecl);
-                unrefdResources.enter(vdecl.sym);
-                resourceVarDecls.append(vdecl);
-            } else if (resource instanceof JCExpression) {
-                scanExpr((JCExpression) resource);
+        public void visitIf(JCIf tree) {
+            scanCond(tree.cond);
+            Bits initsBeforeElse = initsWhenFalse;
+            Bits uninitsBeforeElse = uninitsWhenFalse;
+            inits = initsWhenTrue;
+            uninits = uninitsWhenTrue;
+            scan(tree.thenpart);
+            if (tree.elsepart != null) {
+                Bits initsAfterThen = inits.dup();
+                Bits uninitsAfterThen = uninits.dup();
+                inits = initsBeforeElse;
+                uninits = uninitsBeforeElse;
+                scan(tree.elsepart);
+                inits.andSet(initsAfterThen);
+                uninits.andSet(uninitsAfterThen);
             } else {
-                throw new AssertionError(tree);  // parser error
-            }
-        }
-        for (JCTree resource : tree.resources) {
-            List<Type> closeableSupertypes = resource.type.isCompound() ?
-                types.interfaces(resource.type).prepend(types.supertype(resource.type)) :
-                List.of(resource.type);
-            for (Type sup : closeableSupertypes) {
-                if (types.asSuper(sup, syms.autoCloseableType.tsym) != null) {
-                    Symbol closeMethod = rs.resolveQualifiedMethod(tree,
-                            attrEnv,
-                            sup,
-                            names.close,
-                            List.<Type>nil(),
-                            List.<Type>nil());
-                    if (closeMethod.kind == MTH) {
-                        for (Type t : ((MethodSymbol)closeMethod).getThrownTypes()) {
-                            markThrown(resource, t);
-                        }
-                    }
-                }
-            }
-        }
-        scanStat(tree.body);
-        List<Type> thrownInTry = allowImprovedCatchAnalysis ?
-            chk.union(thrown, List.of(syms.runtimeExceptionType, syms.errorType)) :
-            thrown;
-        thrown = thrownPrev;
-        caught = caughtPrev;
-        boolean aliveEnd = alive;
-        uninitsTry.andSet(uninits);
-        Bits initsEnd = inits;
-        Bits uninitsEnd = uninits;
-        int nextadrCatch = nextadr;
-
-        if (!resourceVarDecls.isEmpty() &&
-                lint.isEnabled(Lint.LintCategory.TRY)) {
-            for (JCVariableDecl resVar : resourceVarDecls) {
-                if (unrefdResources.includes(resVar.sym)) {
-                    log.warning(Lint.LintCategory.TRY, resVar.pos(),
-                                "try.resource.not.referenced", resVar.sym);
-                    unrefdResources.remove(resVar.sym);
-                }
+                inits.andSet(initsBeforeElse);
+                uninits.andSet(uninitsBeforeElse);
             }
         }
 
-        List<Type> caughtInTry = List.nil();
-        for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
-            alive = true;
-            JCVariableDecl param = l.head.param;
-            List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ?
-                    ((JCTypeUnion)l.head.param.vartype).alternatives :
-                    List.of(l.head.param.vartype);
-            List<Type> ctypes = List.nil();
-            List<Type> rethrownTypes = chk.diff(thrownInTry, caughtInTry);
-            for (JCExpression ct : subClauses) {
-                Type exc = ct.type;
-                if (exc != syms.unknownType) {
-                    ctypes = ctypes.append(exc);
-                    if (types.isSameType(exc, syms.objectType))
-                        continue;
-                    checkCaughtType(l.head.pos(), exc, thrownInTry, caughtInTry);
-                    caughtInTry = chk.incl(exc, caughtInTry);
-                }
+        public void visitBreak(JCBreak tree) {
+            recordExit(tree, new AssignPendingExit(tree, inits, uninits));
+        }
+
+        public void visitContinue(JCContinue tree) {
+            recordExit(tree, new AssignPendingExit(tree, inits, uninits));
+        }
+
+        public void visitReturn(JCReturn tree) {
+            scanExpr(tree.expr);
+            // if not initial constructor, should markDead instead of recordExit
+            recordExit(tree, new AssignPendingExit(tree, inits, uninits));
+        }
+
+        public void visitThrow(JCThrow tree) {
+            scanExpr(tree.expr);
+            markDead();
+        }
+
+        public void visitApply(JCMethodInvocation tree) {
+            scanExpr(tree.meth);
+            scanExprs(tree.args);
+        }
+
+        public void visitNewClass(JCNewClass tree) {
+            scanExpr(tree.encl);
+            scanExprs(tree.args);
+            scan(tree.def);
+        }
+
+        public void visitNewArray(JCNewArray tree) {
+            scanExprs(tree.dims);
+            scanExprs(tree.elems);
+        }
+
+        public void visitAssert(JCAssert tree) {
+            Bits initsExit = inits.dup();
+            Bits uninitsExit = uninits.dup();
+            scanCond(tree.cond);
+            uninitsExit.andSet(uninitsWhenTrue);
+            if (tree.detail != null) {
+                inits = initsWhenFalse;
+                uninits = uninitsWhenFalse;
+                scanExpr(tree.detail);
             }
-            inits = initsTry.dup();
-            uninits = uninitsTry.dup();
-            scan(param);
-            inits.incl(param.sym.adr);
-            uninits.excl(param.sym.adr);
-            preciseRethrowTypes.put(param.sym, chk.intersect(ctypes, rethrownTypes));
-            scanStat(l.head.body);
-            initsEnd.andSet(inits);
-            uninitsEnd.andSet(uninits);
-            nextadr = nextadrCatch;
-            preciseRethrowTypes.remove(param.sym);
-            aliveEnd |= alive;
+            inits = initsExit;
+            uninits = uninitsExit;
+        }
+
+        public void visitAssign(JCAssign tree) {
+            JCTree lhs = TreeInfo.skipParens(tree.lhs);
+            if (!(lhs instanceof JCIdent)) scanExpr(lhs);
+            scanExpr(tree.rhs);
+            letInit(lhs);
+        }
+
+        public void visitAssignop(JCAssignOp tree) {
+            scanExpr(tree.lhs);
+            scanExpr(tree.rhs);
+            letInit(tree.lhs);
+        }
+
+        public void visitUnary(JCUnary tree) {
+            switch (tree.getTag()) {
+            case NOT:
+                scanCond(tree.arg);
+                Bits t = initsWhenFalse;
+                initsWhenFalse = initsWhenTrue;
+                initsWhenTrue = t;
+                t = uninitsWhenFalse;
+                uninitsWhenFalse = uninitsWhenTrue;
+                uninitsWhenTrue = t;
+                break;
+            case PREINC: case POSTINC:
+            case PREDEC: case POSTDEC:
+                scanExpr(tree.arg);
+                letInit(tree.arg);
+                break;
+            default:
+                scanExpr(tree.arg);
+            }
         }
-        if (tree.finalizer != null) {
-            List<Type> savedThrown = thrown;
-            thrown = List.nil();
-            inits = initsTry.dup();
-            uninits = uninitsTry.dup();
-            ListBuffer<PendingExit> exits = pendingExits;
-            pendingExits = prevPendingExits;
-            alive = true;
-            scanStat(tree.finalizer);
-            if (!alive) {
-                // discard exits and exceptions from try and finally
-                thrown = chk.union(thrown, thrownPrev);
-                if (!loopPassTwo &&
-                    lint.isEnabled(Lint.LintCategory.FINALLY)) {
-                    log.warning(Lint.LintCategory.FINALLY,
-                            TreeInfo.diagEndPos(tree.finalizer),
-                            "finally.cannot.complete");
-                }
-            } else {
-                thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry));
-                thrown = chk.union(thrown, savedThrown);
-                uninits.andSet(uninitsEnd);
-                // FIX: this doesn't preserve source order of exits in catch
-                // versus finally!
-                while (exits.nonEmpty()) {
-                    PendingExit exit = exits.next();
-                    if (exit.inits != null) {
-                        exit.inits.orSet(inits);
-                        exit.uninits.andSet(uninits);
-                    }
-                    pendingExits.append(exit);
-                }
-                inits.orSet(initsEnd);
-                alive = aliveEnd;
+
+        public void visitBinary(JCBinary tree) {
+            switch (tree.getTag()) {
+            case AND:
+                scanCond(tree.lhs);
+                Bits initsWhenFalseLeft = initsWhenFalse;
+                Bits uninitsWhenFalseLeft = uninitsWhenFalse;
+                inits = initsWhenTrue;
+                uninits = uninitsWhenTrue;
+                scanCond(tree.rhs);
+                initsWhenFalse.andSet(initsWhenFalseLeft);
+                uninitsWhenFalse.andSet(uninitsWhenFalseLeft);
+                break;
+            case OR:
+                scanCond(tree.lhs);
+                Bits initsWhenTrueLeft = initsWhenTrue;
+                Bits uninitsWhenTrueLeft = uninitsWhenTrue;
+                inits = initsWhenFalse;
+                uninits = uninitsWhenFalse;
+                scanCond(tree.rhs);
+                initsWhenTrue.andSet(initsWhenTrueLeft);
+                uninitsWhenTrue.andSet(uninitsWhenTrueLeft);
+                break;
+            default:
+                scanExpr(tree.lhs);
+                scanExpr(tree.rhs);
+            }
+        }
+
+        public void visitIdent(JCIdent tree) {
+            if (tree.sym.kind == VAR) {
+                checkInit(tree.pos(), (VarSymbol)tree.sym);
+                referenced(tree.sym);
             }
-        } else {
-            thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry));
-            inits = initsEnd;
-            uninits = uninitsEnd;
-            alive = aliveEnd;
-            ListBuffer<PendingExit> exits = pendingExits;
-            pendingExits = prevPendingExits;
-            while (exits.nonEmpty()) pendingExits.append(exits.next());
+        }
+
+        void referenced(Symbol sym) {
+            unrefdResources.remove(sym);
         }
-        uninitsTry.andSet(uninitsTryPrev).andSet(uninits);
-    }
+
+        public void visitTopLevel(JCCompilationUnit tree) {
+            // Do nothing for TopLevel since each class is visited individually
+        }
+
+    /**************************************************************************
+     * main method
+     *************************************************************************/
 
-    void checkCaughtType(DiagnosticPosition pos, Type exc, List<Type> thrownInTry, List<Type> caughtInTry) {
-        if (chk.subset(exc, caughtInTry)) {
-            log.error(pos, "except.already.caught", exc);
-        } else if (!chk.isUnchecked(pos, exc) &&
-                !isExceptionOrThrowable(exc) &&
-                !chk.intersects(exc, thrownInTry)) {
-            log.error(pos, "except.never.thrown.in.try", exc);
-        } else if (allowImprovedCatchAnalysis) {
-            List<Type> catchableThrownTypes = chk.intersect(List.of(exc), thrownInTry);
-            // 'catchableThrownTypes' cannnot possibly be empty - if 'exc' was an
-            // unchecked exception, the result list would not be empty, as the augmented
-            // thrown set includes { RuntimeException, Error }; if 'exc' was a checked
-            // exception, that would have been covered in the branch above
-            if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty() &&
-                    !isExceptionOrThrowable(exc)) {
-                String key = catchableThrownTypes.length() == 1 ?
-                        "unreachable.catch" :
-                        "unreachable.catch.1";
-                log.warning(pos, key, catchableThrownTypes);
+        /** Perform definite assignment/unassignment analysis on a tree.
+         */
+        public void analyzeTree(Env<AttrContext> env, TreeMaker make) {
+            try {
+                attrEnv = env;
+                JCTree tree = env.tree;
+                Flow.this.make = make;
+                inits = new Bits();
+                uninits = new Bits();
+                uninitsTry = new Bits();
+                initsWhenTrue = initsWhenFalse =
+                    uninitsWhenTrue = uninitsWhenFalse = null;
+                if (vars == null)
+                    vars = new VarSymbol[32];
+                else
+                    for (int i=0; i<vars.length; i++)
+                        vars[i] = null;
+                firstadr = 0;
+                nextadr = 0;
+                pendingExits = new ListBuffer<AssignPendingExit>();
+                this.classDef = null;
+                unrefdResources = new Scope(env.enclClass.sym);
+                scan(tree);
+            } finally {
+                // note that recursive invocations of this method fail hard
+                inits = uninits = uninitsTry = null;
+                initsWhenTrue = initsWhenFalse =
+                    uninitsWhenTrue = uninitsWhenFalse = null;
+                if (vars != null) for (int i=0; i<vars.length; i++)
+                    vars[i] = null;
+                firstadr = 0;
+                nextadr = 0;
+                pendingExits = null;
+                Flow.this.make = null;
+                this.classDef = null;
+                unrefdResources = null;
             }
         }
     }
-    //where
-        private boolean isExceptionOrThrowable(Type exc) {
-            return exc.tsym == syms.throwableType.tsym ||
-                exc.tsym == syms.exceptionType.tsym;
-        }
-
-
-    public void visitConditional(JCConditional tree) {
-        scanCond(tree.cond);
-        Bits initsBeforeElse = initsWhenFalse;
-        Bits uninitsBeforeElse = uninitsWhenFalse;
-        inits = initsWhenTrue;
-        uninits = uninitsWhenTrue;
-        if (tree.truepart.type.tag == BOOLEAN &&
-            tree.falsepart.type.tag == BOOLEAN) {
-            // if b and c are boolean valued, then
-            // v is (un)assigned after a?b:c when true iff
-            //    v is (un)assigned after b when true and
-            //    v is (un)assigned after c when true
-            scanCond(tree.truepart);
-            Bits initsAfterThenWhenTrue = initsWhenTrue.dup();
-            Bits initsAfterThenWhenFalse = initsWhenFalse.dup();
-            Bits uninitsAfterThenWhenTrue = uninitsWhenTrue.dup();
-            Bits uninitsAfterThenWhenFalse = uninitsWhenFalse.dup();
-            inits = initsBeforeElse;
-            uninits = uninitsBeforeElse;
-            scanCond(tree.falsepart);
-            initsWhenTrue.andSet(initsAfterThenWhenTrue);
-            initsWhenFalse.andSet(initsAfterThenWhenFalse);
-            uninitsWhenTrue.andSet(uninitsAfterThenWhenTrue);
-            uninitsWhenFalse.andSet(uninitsAfterThenWhenFalse);
-        } else {
-            scanExpr(tree.truepart);
-            Bits initsAfterThen = inits.dup();
-            Bits uninitsAfterThen = uninits.dup();
-            inits = initsBeforeElse;
-            uninits = uninitsBeforeElse;
-            scanExpr(tree.falsepart);
-            inits.andSet(initsAfterThen);
-            uninits.andSet(uninitsAfterThen);
-        }
-    }
-
-    public void visitIf(JCIf tree) {
-        scanCond(tree.cond);
-        Bits initsBeforeElse = initsWhenFalse;
-        Bits uninitsBeforeElse = uninitsWhenFalse;
-        inits = initsWhenTrue;
-        uninits = uninitsWhenTrue;
-        scanStat(tree.thenpart);
-        if (tree.elsepart != null) {
-            boolean aliveAfterThen = alive;
-            alive = true;
-            Bits initsAfterThen = inits.dup();
-            Bits uninitsAfterThen = uninits.dup();
-            inits = initsBeforeElse;
-            uninits = uninitsBeforeElse;
-            scanStat(tree.elsepart);
-            inits.andSet(initsAfterThen);
-            uninits.andSet(uninitsAfterThen);
-            alive = alive | aliveAfterThen;
-        } else {
-            inits.andSet(initsBeforeElse);
-            uninits.andSet(uninitsBeforeElse);
-            alive = true;
-        }
-    }
-
-
-
-    public void visitBreak(JCBreak tree) {
-        recordExit(tree);
-    }
-
-    public void visitContinue(JCContinue tree) {
-        recordExit(tree);
-    }
-
-    public void visitReturn(JCReturn tree) {
-        scanExpr(tree.expr);
-        // if not initial constructor, should markDead instead of recordExit
-        recordExit(tree);
-    }
-
-    public void visitThrow(JCThrow tree) {
-        scanExpr(tree.expr);
-        Symbol sym = TreeInfo.symbol(tree.expr);
-        if (sym != null &&
-            sym.kind == VAR &&
-            (sym.flags() & (FINAL | EFFECTIVELY_FINAL)) != 0 &&
-            preciseRethrowTypes.get(sym) != null &&
-            allowImprovedRethrowAnalysis) {
-            for (Type t : preciseRethrowTypes.get(sym)) {
-                markThrown(tree, t);
-            }
-        }
-        else {
-            markThrown(tree, tree.expr.type);
-        }
-        markDead();
-    }
-
-    public void visitApply(JCMethodInvocation tree) {
-        scanExpr(tree.meth);
-        scanExprs(tree.args);
-        for (List<Type> l = tree.meth.type.getThrownTypes(); l.nonEmpty(); l = l.tail)
-            markThrown(tree, l.head);
-    }
-
-    public void visitNewClass(JCNewClass tree) {
-        scanExpr(tree.encl);
-        scanExprs(tree.args);
-       // scan(tree.def);
-        for (List<Type> l = tree.constructorType.getThrownTypes();
-             l.nonEmpty();
-             l = l.tail) {
-            markThrown(tree, l.head);
-        }
-        List<Type> caughtPrev = caught;
-        try {
-            // If the new class expression defines an anonymous class,
-            // analysis of the anonymous constructor may encounter thrown
-            // types which are unsubstituted type variables.
-            // However, since the constructor's actual thrown types have
-            // already been marked as thrown, it is safe to simply include
-            // each of the constructor's formal thrown types in the set of
-            // 'caught/declared to be thrown' types, for the duration of
-            // the class def analysis.
-            if (tree.def != null)
-                for (List<Type> l = tree.constructor.type.getThrownTypes();
-                     l.nonEmpty();
-                     l = l.tail) {
-                    caught = chk.incl(l.head, caught);
-                }
-            scan(tree.def);
-        }
-        finally {
-            caught = caughtPrev;
-        }
-    }
-
-    public void visitNewArray(JCNewArray tree) {
-        scanExprs(tree.dims);
-        scanExprs(tree.elems);
-    }
-
-    public void visitAssert(JCAssert tree) {
-        Bits initsExit = inits.dup();
-        Bits uninitsExit = uninits.dup();
-        scanCond(tree.cond);
-        uninitsExit.andSet(uninitsWhenTrue);
-        if (tree.detail != null) {
-            inits = initsWhenFalse;
-            uninits = uninitsWhenFalse;
-            scanExpr(tree.detail);
-        }
-        inits = initsExit;
-        uninits = uninitsExit;
-    }
-
-    public void visitAssign(JCAssign tree) {
-        JCTree lhs = TreeInfo.skipParens(tree.lhs);
-        if (!(lhs instanceof JCIdent)) scanExpr(lhs);
-        scanExpr(tree.rhs);
-        letInit(lhs);
-    }
-
-    public void visitAssignop(JCAssignOp tree) {
-        scanExpr(tree.lhs);
-        scanExpr(tree.rhs);
-        letInit(tree.lhs);
-    }
-
-    public void visitUnary(JCUnary tree) {
-        switch (tree.getTag()) {
-        case JCTree.NOT:
-            scanCond(tree.arg);
-            Bits t = initsWhenFalse;
-            initsWhenFalse = initsWhenTrue;
-            initsWhenTrue = t;
-            t = uninitsWhenFalse;
-            uninitsWhenFalse = uninitsWhenTrue;
-            uninitsWhenTrue = t;
-            break;
-        case JCTree.PREINC: case JCTree.POSTINC:
-        case JCTree.PREDEC: case JCTree.POSTDEC:
-            scanExpr(tree.arg);
-            letInit(tree.arg);
-            break;
-        default:
-            scanExpr(tree.arg);
-        }
-    }
-
-    public void visitBinary(JCBinary tree) {
-        switch (tree.getTag()) {
-        case JCTree.AND:
-            scanCond(tree.lhs);
-            Bits initsWhenFalseLeft = initsWhenFalse;
-            Bits uninitsWhenFalseLeft = uninitsWhenFalse;
-            inits = initsWhenTrue;
-            uninits = uninitsWhenTrue;
-            scanCond(tree.rhs);
-            initsWhenFalse.andSet(initsWhenFalseLeft);
-            uninitsWhenFalse.andSet(uninitsWhenFalseLeft);
-            break;
-        case JCTree.OR:
-            scanCond(tree.lhs);
-            Bits initsWhenTrueLeft = initsWhenTrue;
-            Bits uninitsWhenTrueLeft = uninitsWhenTrue;
-            inits = initsWhenFalse;
-            uninits = uninitsWhenFalse;
-            scanCond(tree.rhs);
-            initsWhenTrue.andSet(initsWhenTrueLeft);
-            uninitsWhenTrue.andSet(uninitsWhenTrueLeft);
-            break;
-        default:
-            scanExpr(tree.lhs);
-            scanExpr(tree.rhs);
-        }
-    }
-
-    public void visitIdent(JCIdent tree) {
-        if (tree.sym.kind == VAR) {
-            checkInit(tree.pos(), (VarSymbol)tree.sym);
-            referenced(tree.sym);
-        }
-    }
-
-    void referenced(Symbol sym) {
-        unrefdResources.remove(sym);
-    }
-
-    public void visitTypeCast(JCTypeCast tree) {
-        super.visitTypeCast(tree);
-        if (!tree.type.isErroneous()
-            && lint.isEnabled(Lint.LintCategory.CAST)
-            && types.isSameType(tree.expr.type, tree.clazz.type)
-            && !is292targetTypeCast(tree)) {
-            log.warning(Lint.LintCategory.CAST,
-                    tree.pos(), "redundant.cast", tree.expr.type);
-        }
-    }
-    //where
-        private boolean is292targetTypeCast(JCTypeCast tree) {
-            boolean is292targetTypeCast = false;
-            JCExpression expr = TreeInfo.skipParens(tree.expr);
-            if (expr.getTag() == JCTree.APPLY) {
-                JCMethodInvocation apply = (JCMethodInvocation)expr;
-                Symbol sym = TreeInfo.symbol(apply.meth);
-                is292targetTypeCast = sym != null &&
-                    sym.kind == MTH &&
-                    (sym.flags() & POLYMORPHIC_SIGNATURE) != 0;
-            }
-            return is292targetTypeCast;
-        }
-
-    public void visitTopLevel(JCCompilationUnit tree) {
-        // Do nothing for TopLevel since each class is visited individually
-    }
-
-/**************************************************************************
- * main method
- *************************************************************************/
-
-    /** Perform definite assignment/unassignment analysis on a tree.
-     */
-    public void analyzeTree(Env<AttrContext> env, TreeMaker make) {
-        try {
-            attrEnv = env;
-            JCTree tree = env.tree;
-            this.make = make;
-            inits = new Bits();
-            uninits = new Bits();
-            uninitsTry = new Bits();
-            initsWhenTrue = initsWhenFalse =
-                uninitsWhenTrue = uninitsWhenFalse = null;
-            if (vars == null)
-                vars = new VarSymbol[32];
-            else
-                for (int i=0; i<vars.length; i++)
-                    vars[i] = null;
-            firstadr = 0;
-            nextadr = 0;
-            pendingExits = new ListBuffer<PendingExit>();
-            preciseRethrowTypes = new HashMap<Symbol, List<Type>>();
-            alive = true;
-            this.thrown = this.caught = null;
-            this.classDef = null;
-            unrefdResources = new Scope(env.enclClass.sym);
-            scan(tree);
-        } finally {
-            // note that recursive invocations of this method fail hard
-            inits = uninits = uninitsTry = null;
-            initsWhenTrue = initsWhenFalse =
-                uninitsWhenTrue = uninitsWhenFalse = null;
-            if (vars != null) for (int i=0; i<vars.length; i++)
-                vars[i] = null;
-            firstadr = 0;
-            nextadr = 0;
-            pendingExits = null;
-            this.make = null;
-            this.thrown = this.caught = null;
-            this.classDef = null;
-            unrefdResources = null;
-        }
-    }
 }
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,10 @@
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Type.*;
-import com.sun.tools.javac.code.Type.ForAll.ConstraintKind;
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
+import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import static com.sun.tools.javac.code.TypeTags.*;
 
@@ -56,6 +57,7 @@
     Types types;
     Check chk;
     Resolve rs;
+    Log log;
     JCDiagnostic.Factory diags;
 
     public static Infer instance(Context context) {
@@ -70,6 +72,7 @@
         syms = Symtab.instance(context);
         types = Types.instance(context);
         rs = Resolve.instance(context);
+        log = Log.instance(context);
         chk = Check.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         ambiguousNoInstanceException =
@@ -81,7 +84,7 @@
 
     }
 
-    public static class InferenceException extends Resolve.InapplicableMethodException {
+    public static class InferenceException extends InapplicableMethodException {
         private static final long serialVersionUID = 0;
 
         InferenceException(JCDiagnostic.Factory diags) {
@@ -118,84 +121,21 @@
 
     /** A mapping that turns type variables into undetermined type variables.
      */
-    Mapping fromTypeVarFun = new Mapping("fromTypeVarFun") {
-            public Type apply(Type t) {
-                if (t.tag == TYPEVAR) return new UndetVar(t);
-                else return t.map(this);
-            }
-        };
-
-    /** A mapping that returns its type argument with every UndetVar replaced
-     *  by its `inst' field. Throws a NoInstanceException
-     *  if this not possible because an `inst' field is null.
-     *  Note: mutually referring undertvars will be left uninstantiated
-     *  (that is, they will be replaced by the underlying type-variable).
-     */
-
-    Mapping getInstFun = new Mapping("getInstFun") {
-            public Type apply(Type t) {
-                switch (t.tag) {
-                    case UNKNOWN:
-                        throw ambiguousNoInstanceException
-                            .setMessage("undetermined.type");
-                    case UNDETVAR:
-                        UndetVar that = (UndetVar) t;
-                        if (that.inst == null)
-                            throw ambiguousNoInstanceException
-                                .setMessage("type.variable.has.undetermined.type",
-                                            that.qtype);
-                        return isConstraintCyclic(that) ?
-                            that.qtype :
-                            apply(that.inst);
-                        default:
-                            return t.map(this);
+    List<Type> makeUndetvars(List<Type> tvars) {
+        List<Type> undetvars = Type.map(tvars, fromTypeVarFun);
+        for (Type t : undetvars) {
+            UndetVar uv = (UndetVar)t;
+            uv.hibounds = types.getBounds((TypeVar)uv.qtype);
+        }
+        return undetvars;
+    }
+    //where
+            Mapping fromTypeVarFun = new Mapping("fromTypeVarFun") {
+                public Type apply(Type t) {
+                    if (t.tag == TYPEVAR) return new UndetVar(t);
+                    else return t.map(this);
                 }
-            }
-
-            private boolean isConstraintCyclic(UndetVar uv) {
-                Types.UnaryVisitor<Boolean> constraintScanner =
-                        new Types.UnaryVisitor<Boolean>() {
-
-                    List<Type> seen = List.nil();
-
-                    Boolean visit(List<Type> ts) {
-                        for (Type t : ts) {
-                            if (visit(t)) return true;
-                        }
-                        return false;
-                    }
-
-                    public Boolean visitType(Type t, Void ignored) {
-                        return false;
-                    }
-
-                    @Override
-                    public Boolean visitClassType(ClassType t, Void ignored) {
-                        if (t.isCompound()) {
-                            return visit(types.supertype(t)) ||
-                                    visit(types.interfaces(t));
-                        } else {
-                            return visit(t.getTypeArguments());
-                        }
-                    }
-                    @Override
-                    public Boolean visitWildcardType(WildcardType t, Void ignored) {
-                        return visit(t.type);
-                    }
-
-                    @Override
-                    public Boolean visitUndetVar(UndetVar t, Void ignored) {
-                        if (seen.contains(t)) {
-                            return true;
-                        } else {
-                            seen = seen.prepend(t);
-                            return visit(t.inst);
-                        }
-                    }
-                };
-                return constraintScanner.visit(uv);
-            }
-        };
+            };
 
 /***************************************************************************
  * Mini/Maximization of UndetVars
@@ -206,13 +146,15 @@
      */
     void maximizeInst(UndetVar that, Warner warn) throws NoInstanceException {
         List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
-        if (that.inst == null) {
+        if (that.eq.isEmpty()) {
             if (hibounds.isEmpty())
                 that.inst = syms.objectType;
             else if (hibounds.tail.isEmpty())
                 that.inst = hibounds.head;
             else
                 that.inst = types.glb(hibounds);
+        } else {
+            that.inst = that.eq.head;
         }
         if (that.inst == null ||
             that.inst.isErroneous())
@@ -220,27 +162,6 @@
                 .setMessage("no.unique.maximal.instance.exists",
                             that.qtype, hibounds);
     }
-    //where
-        private boolean isSubClass(Type t, final List<Type> ts) {
-            t = t.baseType();
-            if (t.tag == TYPEVAR) {
-                List<Type> bounds = types.getBounds((TypeVar)t);
-                for (Type s : ts) {
-                    if (!types.isSameType(t, s.baseType())) {
-                        for (Type bound : bounds) {
-                            if (!isSubClass(bound, List.of(s.baseType())))
-                                return false;
-                        }
-                    }
-                }
-            } else {
-                for (Type s : ts) {
-                    if (!t.tsym.isSubClass(s.baseType().tsym, types))
-                        return false;
-                }
-            }
-            return true;
-        }
 
     private Filter<Type> errorFilter = new Filter<Type>() {
         @Override
@@ -254,7 +175,7 @@
      */
     void minimizeInst(UndetVar that, Warner warn) throws NoInstanceException {
         List<Type> lobounds = Type.filter(that.lobounds, errorFilter);
-        if (that.inst == null) {
+        if (that.eq.isEmpty()) {
             if (lobounds.isEmpty())
                 that.inst = syms.botType;
             else if (lobounds.tail.isEmpty())
@@ -266,27 +187,23 @@
                     throw ambiguousNoInstanceException
                         .setMessage("no.unique.minimal.instance.exists",
                                     that.qtype, lobounds);
-            // VGJ: sort of inlined maximizeInst() below.  Adding
-            // bounds can cause lobounds that are above hibounds.
-            List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
-            if (hibounds.isEmpty())
-                return;
-            Type hb = null;
-            if (hibounds.tail.isEmpty())
-                hb = hibounds.head;
-            else for (List<Type> bs = hibounds;
-                      bs.nonEmpty() && hb == null;
-                      bs = bs.tail) {
-                if (isSubClass(bs.head, hibounds))
-                    hb = types.fromUnknownFun.apply(bs.head);
-            }
-            if (hb == null ||
-                !types.isSubtypeUnchecked(hb, hibounds, warn) ||
-                !types.isSubtypeUnchecked(that.inst, hb, warn))
-                throw ambiguousNoInstanceException;
+        } else {
+            that.inst = that.eq.head;
         }
     }
 
+    Type asUndetType(Type t, List<Type> undetvars) {
+        return types.subst(t, inferenceVars(undetvars), undetvars);
+    }
+
+    List<Type> inferenceVars(List<Type> undetvars) {
+        ListBuffer<Type> tvars = ListBuffer.lb();
+        for (Type uv : undetvars) {
+            tvars.append(((UndetVar)uv).qtype);
+        }
+        return tvars.toList();
+    }
+
 /***************************************************************************
  * Exported Methods
  ***************************************************************************/
@@ -300,21 +217,7 @@
     public Type instantiateExpr(ForAll that,
                                 Type to,
                                 Warner warn) throws InferenceException {
-        List<Type> undetvars = Type.map(that.tvars, fromTypeVarFun);
-        for (List<Type> l = undetvars; l.nonEmpty(); l = l.tail) {
-            UndetVar uv = (UndetVar) l.head;
-            TypeVar tv = (TypeVar)uv.qtype;
-            ListBuffer<Type> hibounds = new ListBuffer<Type>();
-            for (Type t : that.getConstraints(tv, ConstraintKind.EXTENDS)) {
-                hibounds.append(types.subst(t, that.tvars, undetvars));
-            }
-
-            List<Type> inst = that.getConstraints(tv, ConstraintKind.EQUAL);
-            if (inst.nonEmpty() && inst.head.tag != BOT) {
-                uv.inst = inst.head;
-            }
-            uv.hibounds = hibounds.toList();
-        }
+        List<Type> undetvars = that.undetvars();
         Type qtype1 = types.subst(that.qtype, that.tvars, undetvars);
         if (!types.isSubtype(qtype1,
                 qtype1.tag == UNDETVAR ? types.boxedTypeOrType(to) : to)) {
@@ -322,37 +225,72 @@
                 .setMessage("infer.no.conforming.instance.exists",
                             that.tvars, that.qtype, to);
         }
-        for (List<Type> l = undetvars; l.nonEmpty(); l = l.tail)
-            maximizeInst((UndetVar) l.head, warn);
-        // System.out.println(" = " + qtype1.map(getInstFun));//DEBUG
 
-        // check bounds
-        List<Type> targs = Type.map(undetvars, getInstFun);
-        if (Type.containsAny(targs, that.tvars)) {
-            //replace uninferred type-vars
-            targs = types.subst(targs,
+        List<Type> insttypes;
+        while (true) {
+            boolean stuck = true;
+            insttypes = List.nil();
+            for (Type t : undetvars) {
+                UndetVar uv = (UndetVar)t;
+                if (uv.inst == null && (uv.eq.nonEmpty() || !Type.containsAny(uv.hibounds, that.tvars))) {
+                    maximizeInst((UndetVar)t, warn);
+                    stuck = false;
+                }
+                insttypes = insttypes.append(uv.inst == null ? uv.qtype : uv.inst);
+            }
+            if (!Type.containsAny(insttypes, that.tvars)) {
+                //all variables have been instantiated - exit
+                break;
+            } else if (stuck) {
+                //some variables could not be instantiated because of cycles in
+                //upper bounds - provide a (possibly recursive) default instantiation
+                insttypes = types.subst(insttypes,
                     that.tvars,
-                    instaniateAsUninferredVars(undetvars, that.tvars));
+                    instantiateAsUninferredVars(undetvars, that.tvars));
+                break;
+            } else {
+                //some variables have been instantiated - replace newly instantiated
+                //variables in remaining upper bounds and continue
+                for (Type t : undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    uv.hibounds = types.subst(uv.hibounds, that.tvars, insttypes);
+                }
+            }
         }
-        return chk.checkType(warn.pos(), that.inst(targs, types), to);
+        return that.inst(insttypes, types);
     }
-    //where
-    private List<Type> instaniateAsUninferredVars(List<Type> undetvars, List<Type> tvars) {
-        ListBuffer<Type> new_targs = ListBuffer.lb();
-        //step 1 - create syntethic captured vars
+
+    /**
+     * Infer cyclic inference variables as described in 15.12.2.8.
+     */
+    private List<Type> instantiateAsUninferredVars(List<Type> undetvars, List<Type> tvars) {
+        Assert.check(undetvars.length() == tvars.length());
+        ListBuffer<Type> insttypes = ListBuffer.lb();
+        ListBuffer<Type> todo = ListBuffer.lb();
+        //step 1 - create fresh tvars
         for (Type t : undetvars) {
             UndetVar uv = (UndetVar)t;
-            Type newArg = new CapturedType(t.tsym.name, t.tsym, uv.inst, syms.botType, null);
-            new_targs = new_targs.append(newArg);
+            if (uv.inst == null) {
+                TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
+                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.hibounds), null);
+                todo.append(uv);
+                uv.inst = fresh_tvar.type;
+            }
+            insttypes.append(uv.inst);
         }
-        //step 2 - replace synthetic vars in their bounds
-        for (Type t : new_targs.toList()) {
-            CapturedType ct = (CapturedType)t;
-            ct.bound = types.subst(ct.bound, tvars, new_targs.toList());
-            WildcardType wt = new WildcardType(ct.bound, BoundKind.EXTENDS, syms.boundClass);
-            ct.wildcard = wt;
+        //step 2 - replace fresh tvars in their bounds
+        List<Type> formals = tvars;
+        for (Type t : todo) {
+            UndetVar uv = (UndetVar)t;
+            TypeVar ct = (TypeVar)uv.inst;
+            ct.bound = types.glb(types.subst(types.getBounds(ct), tvars, insttypes.toList()));
+            if (ct.bound.isErroneous()) {
+                //report inference error if glb fails
+                reportBoundError(uv, BoundErrorKind.BAD_UPPER);
+            }
+            formals = formals.tail;
         }
-        return new_targs.toList();
+        return insttypes.toList();
     }
 
     /** Instantiate method type `mt' by finding instantiations of
@@ -367,63 +305,11 @@
                                   final boolean useVarargs,
                                   final Warner warn) throws InferenceException {
         //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG
-        List<Type> undetvars = Type.map(tvars, fromTypeVarFun);
-        List<Type> formals = mt.argtypes;
-        //need to capture exactly once - otherwise subsequent
-        //applicability checks might fail
-        final List<Type> capturedArgs = types.capture(argtypes);
-        List<Type> actuals = capturedArgs;
-        List<Type> actualsNoCapture = argtypes;
-        // instantiate all polymorphic argument types and
-        // set up lower bounds constraints for undetvars
-        Type varargsFormal = useVarargs ? formals.last() : null;
-        if (varargsFormal == null &&
-                actuals.size() != formals.size()) {
-            throw unambiguousNoInstanceException
-                .setMessage("infer.arg.length.mismatch");
-        }
-        while (actuals.nonEmpty() && formals.head != varargsFormal) {
-            Type formal = formals.head;
-            Type actual = actuals.head.baseType();
-            Type actualNoCapture = actualsNoCapture.head.baseType();
-            if (actual.tag == FORALL)
-                actual = instantiateArg((ForAll)actual, formal, tvars, warn);
-            Type undetFormal = types.subst(formal, tvars, undetvars);
-            boolean works = allowBoxing
-                ? types.isConvertible(actual, undetFormal, warn)
-                : types.isSubtypeUnchecked(actual, undetFormal, warn);
-            if (!works) {
-                throw unambiguousNoInstanceException
-                    .setMessage("infer.no.conforming.assignment.exists",
-                                tvars, actualNoCapture, formal);
-            }
-            formals = formals.tail;
-            actuals = actuals.tail;
-            actualsNoCapture = actualsNoCapture.tail;
-        }
+        final List<Type> undetvars =  makeUndetvars(tvars);
 
-        if (formals.head != varargsFormal) // not enough args
-            throw unambiguousNoInstanceException.setMessage("infer.arg.length.mismatch");
-
-        // for varargs arguments as well
-        if (useVarargs) {
-            Type elemType = types.elemtype(varargsFormal);
-            Type elemUndet = types.subst(elemType, tvars, undetvars);
-            while (actuals.nonEmpty()) {
-                Type actual = actuals.head.baseType();
-                Type actualNoCapture = actualsNoCapture.head.baseType();
-                if (actual.tag == FORALL)
-                    actual = instantiateArg((ForAll)actual, elemType, tvars, warn);
-                boolean works = types.isConvertible(actual, elemUndet, warn);
-                if (!works) {
-                    throw unambiguousNoInstanceException
-                        .setMessage("infer.no.conforming.assignment.exists",
-                                    tvars, actualNoCapture, elemType);
-                }
-                actuals = actuals.tail;
-                actualsNoCapture = actualsNoCapture.tail;
-            }
-        }
+        final List<Type> capturedArgs =
+                rs.checkRawArgumentsAcceptable(env, undetvars, argtypes, mt.getParameterTypes(),
+                    allowBoxing, useVarargs, warn, new InferenceCheckHandler(undetvars));
 
         // minimize as yet undetermined type variables
         for (Type t : undetvars)
@@ -454,7 +340,7 @@
                 undettypes.append(uv.inst);
             }
         }
-        checkWithinBounds(tvars, undettypes.toList(), warn);
+        checkWithinBounds(tvars, undetvars, insttypes.toList(), warn);
 
         mt = (MethodType)types.subst(mt, tvars, insttypes.toList());
 
@@ -463,32 +349,26 @@
             // quantify result type with them
             final List<Type> inferredTypes = insttypes.toList();
             final List<Type> all_tvars = tvars; //this is the wrong tvars
-            return new UninferredMethodType(mt, restvars.toList()) {
+            return new UninferredMethodType(env.tree.pos(), msym, mt, restvars.toList()) {
                 @Override
-                List<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
-                    for (Type t : restundet.toList()) {
-                        UndetVar uv = (UndetVar)t;
-                        if (uv.qtype == tv) {
-                            switch (ck) {
-                                case EXTENDS: return uv.hibounds.appendList(types.subst(types.getBounds(tv), all_tvars, inferredTypes));
-                                case SUPER: return uv.lobounds;
-                                case EQUAL: return uv.inst != null ? List.of(uv.inst) : List.<Type>nil();
-                            }
-                        }
-                    }
-                    return List.nil();
+                List<Type> undetvars() {
+                    return restundet.toList();
                 }
                 @Override
-                void check(List<Type> inferred, Types types) throws NoInstanceException {
+                void instantiateReturnType(Type restype, List<Type> inferred, Types types) throws NoInstanceException {
+                    Type owntype = new MethodType(types.subst(getParameterTypes(), tvars, inferred),
+                                       restype,
+                                       types.subst(getThrownTypes(), tvars, inferred),
+                                       qtype.tsym);
                     // check that actuals conform to inferred formals
-                    checkArgumentsAcceptable(env, capturedArgs, getParameterTypes(), allowBoxing, useVarargs, warn);
+                    warn.clear();
+                    checkArgumentsAcceptable(env, capturedArgs, owntype.getParameterTypes(), allowBoxing, useVarargs, warn);
                     // check that inferred bounds conform to their bounds
-                    checkWithinBounds(all_tvars,
+                    checkWithinBounds(all_tvars, undetvars,
                            types.subst(inferredTypes, tvars, inferred), warn);
-                    if (useVarargs) {
-                        chk.checkVararg(env.tree.pos(), getParameterTypes(), msym);
-                    }
-            }};
+                    qtype = chk.checkMethod(owntype, msym, env, TreeInfo.args(env.tree), capturedArgs, useVarargs, warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED));
+                }
+            };
         }
         else {
             // check that actuals conform to inferred formals
@@ -499,19 +379,48 @@
     }
     //where
 
+        /** inference check handler **/
+        class InferenceCheckHandler implements Resolve.MethodCheckHandler {
+
+            List<Type> undetvars;
+
+            public InferenceCheckHandler(List<Type> undetvars) {
+                this.undetvars = undetvars;
+            }
+
+            public InapplicableMethodException arityMismatch() {
+                return unambiguousNoInstanceException.setMessage("infer.arg.length.mismatch");
+            }
+            public InapplicableMethodException argumentMismatch(boolean varargs, Type found, Type expected) {
+                String key = varargs ?
+                    "infer.varargs.argument.mismatch" :
+                    "infer.no.conforming.assignment.exists";
+                return unambiguousNoInstanceException.setMessage(key,
+                        inferenceVars(undetvars), found, expected);
+            }
+            public InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected) {
+                return unambiguousNoInstanceException.setMessage("inaccessible.varargs.type",
+                        expected, Kinds.kindName(location), location);
+            }
+        }
+
         /**
          * A delegated type representing a partially uninferred method type.
          * The return type of a partially uninferred method type is a ForAll
          * type - when the return type is instantiated (see Infer.instantiateExpr)
          * the underlying method type is also updated.
          */
-        static abstract class UninferredMethodType extends DelegatedType {
+        abstract class UninferredMethodType extends DelegatedType {
 
             final List<Type> tvars;
+            final Symbol msym;
+            final DiagnosticPosition pos;
 
-            public UninferredMethodType(MethodType mtype, List<Type> tvars) {
+            public UninferredMethodType(DiagnosticPosition pos, Symbol msym, MethodType mtype, List<Type> tvars) {
                 super(METHOD, new MethodType(mtype.argtypes, null, mtype.thrown, mtype.tsym));
                 this.tvars = tvars;
+                this.msym = msym;
+                this.pos = pos;
                 asMethodType().restype = new UninferredReturnType(tvars, mtype.restype);
             }
 
@@ -525,18 +434,9 @@
                 return qtype.map(f);
             }
 
-            void instantiateReturnType(Type restype, List<Type> inferred, Types types) throws NoInstanceException {
-                //update method type with newly inferred type-arguments
-                qtype = new MethodType(types.subst(getParameterTypes(), tvars, inferred),
-                                       restype,
-                                       types.subst(UninferredMethodType.this.getThrownTypes(), tvars, inferred),
-                                       UninferredMethodType.this.qtype.tsym);
-                check(inferred, types);
-            }
+            abstract void instantiateReturnType(Type restype, List<Type> inferred, Types types);
 
-            abstract void check(List<Type> inferred, Types types) throws NoInstanceException;
-
-            abstract List<Type> getConstraints(TypeVar tv, ConstraintKind ck);
+            abstract List<Type> undetvars();
 
             class UninferredReturnType extends ForAll {
                 public UninferredReturnType(List<Type> tvars, Type restype) {
@@ -546,11 +446,14 @@
                 public Type inst(List<Type> actuals, Types types) {
                     Type newRestype = super.inst(actuals, types);
                     instantiateReturnType(newRestype, actuals, types);
-                    return newRestype;
+                    if (rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
+                        log.note(pos, "deferred.method.inst", msym, UninferredMethodType.this.qtype, newRestype);
+                    }
+                    return UninferredMethodType.this.qtype.getReturnType();
                 }
                 @Override
-                public List<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
-                    return UninferredMethodType.this.getConstraints(tv, ck);
+                public List<Type> undetvars() {
+                    return UninferredMethodType.this.undetvars();
                 }
             }
         }
@@ -561,49 +464,100 @@
                 rs.checkRawArgumentsAcceptable(env, actuals, formals,
                        allowBoxing, useVarargs, warn);
             }
-            catch (Resolve.InapplicableMethodException ex) {
+            catch (InapplicableMethodException ex) {
                 // inferred method is not applicable
                 throw invalidInstanceException.setMessage(ex.getDiagnostic());
             }
         }
 
-    /** Try to instantiate argument type `that' to given type `to'.
-     *  If this fails, try to insantiate `that' to `to' where
-     *  every occurrence of a type variable in `tvars' is replaced
-     *  by an unknown type.
+    /** check that type parameters are within their bounds.
      */
-    private Type instantiateArg(ForAll that,
-                                Type to,
-                                List<Type> tvars,
-                                Warner warn) throws InferenceException {
-        List<Type> targs;
-        try {
-            return instantiateExpr(that, to, warn);
-        } catch (NoInstanceException ex) {
-            Type to1 = to;
-            for (List<Type> l = tvars; l.nonEmpty(); l = l.tail)
-                to1 = types.subst(to1, List.of(l.head), List.of(syms.unknownType));
-            return instantiateExpr(that, to1, warn);
+    void checkWithinBounds(List<Type> tvars,
+                           List<Type> undetvars,
+                           List<Type> arguments,
+                           Warner warn)
+        throws InvalidInstanceException {
+        List<Type> args = arguments;
+        for (Type t : undetvars) {
+            UndetVar uv = (UndetVar)t;
+            uv.hibounds = types.subst(uv.hibounds, tvars, arguments);
+            uv.lobounds = types.subst(uv.lobounds, tvars, arguments);
+            uv.eq = types.subst(uv.eq, tvars, arguments);
+            checkCompatibleUpperBounds(uv, tvars);
+            if (args.head.tag != TYPEVAR || !args.head.containsAny(tvars)) {
+                Type inst = args.head;
+                for (Type u : uv.hibounds) {
+                    if (!types.isSubtypeUnchecked(inst, types.subst(u, tvars, undetvars), warn)) {
+                        reportBoundError(uv, BoundErrorKind.UPPER);
+                    }
+                }
+                for (Type l : uv.lobounds) {
+                    if (!types.isSubtypeUnchecked(types.subst(l, tvars, undetvars), inst, warn)) {
+                        reportBoundError(uv, BoundErrorKind.LOWER);
+                    }
+                }
+                for (Type e : uv.eq) {
+                    if (!types.isSameType(inst, types.subst(e, tvars, undetvars))) {
+                        reportBoundError(uv, BoundErrorKind.EQ);
+                    }
+                }
+            }
+            args = args.tail;
         }
     }
 
-    /** check that type parameters are within their bounds.
-     */
-    void checkWithinBounds(List<Type> tvars,
-                                   List<Type> arguments,
-                                   Warner warn)
-        throws InvalidInstanceException {
-        for (List<Type> tvs = tvars, args = arguments;
-             tvs.nonEmpty();
-             tvs = tvs.tail, args = args.tail) {
-            if (args.head instanceof UndetVar ||
-                    tvars.head.getUpperBound().isErroneous()) continue;
-            List<Type> bounds = types.subst(types.getBounds((TypeVar)tvs.head), tvars, arguments);
-            if (!types.isSubtypeUnchecked(args.head, bounds, warn))
-                throw invalidInstanceException
-                    .setMessage("inferred.do.not.conform.to.bounds",
-                                args.head, bounds);
+    void checkCompatibleUpperBounds(UndetVar uv, List<Type> tvars) {
+        // VGJ: sort of inlined maximizeInst() below.  Adding
+        // bounds can cause lobounds that are above hibounds.
+        ListBuffer<Type> hiboundsNoVars = ListBuffer.lb();
+        for (Type t : Type.filter(uv.hibounds, errorFilter)) {
+            if (!t.containsAny(tvars)) {
+                hiboundsNoVars.append(t);
+            }
         }
+        List<Type> hibounds = hiboundsNoVars.toList();
+        Type hb = null;
+        if (hibounds.isEmpty())
+            hb = syms.objectType;
+        else if (hibounds.tail.isEmpty())
+            hb = hibounds.head;
+        else
+            hb = types.glb(hibounds);
+        if (hb == null || hb.isErroneous())
+            reportBoundError(uv, BoundErrorKind.BAD_UPPER);
+    }
+
+    enum BoundErrorKind {
+        BAD_UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("incompatible.upper.bounds", uv.qtype, uv.hibounds);
+            }
+        },
+        UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.upper.bounds", uv.inst, uv.hibounds);
+            }
+        },
+        LOWER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.lower.bounds", uv.inst, uv.lobounds);
+            }
+        },
+        EQ() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.eq.bounds", uv.inst, uv.eq);
+            }
+        };
+
+        abstract InapplicableMethodException setMessage(InferenceException ex, UndetVar uv);
+    }
+    //where
+    void reportBoundError(UndetVar uv, BoundErrorKind bk) {
+        throw bk.setMessage(uv.inst == null ? ambiguousNoInstanceException : invalidInstanceException, uv);
     }
 
     /**
@@ -611,8 +565,7 @@
      * method signature. The target return type is computed from the immediately
      * enclosing scope surrounding the polymorphic-signature call.
      */
-    Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env, Type site,
-                                            Name name,
+    Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env,
                                             MethodSymbol spMethod,  // sig. poly. method or null if none
                                             List<Type> argtypes) {
         final Type restype;
@@ -626,13 +579,13 @@
         //the polymorphic signature call environment is nested.
 
         switch (env.next.tree.getTag()) {
-            case JCTree.TYPECAST:
+            case TYPECAST:
                 JCTypeCast castTree = (JCTypeCast)env.next.tree;
                 restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ?
                     castTree.clazz.type :
                     syms.objectType;
                 break;
-            case JCTree.EXEC:
+            case EXEC:
                 JCTree.JCExpressionStatement execTree =
                         (JCTree.JCExpressionStatement)env.next.tree;
                 restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ?
--- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Tue May 29 00:27:58 2012 +0100
@@ -29,7 +29,7 @@
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.main.RecognizedOptions.PkgInfo;
+import com.sun.tools.javac.main.Option.PkgInfo;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -40,11 +40,14 @@
 import com.sun.tools.javac.code.Type.*;
 
 import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.parser.EndPosTable;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.BLOCK;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTags.*;
 import static com.sun.tools.javac.jvm.ByteCodes.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** This pass translates away some syntactic sugar: inner classes,
  *  class literals, assertions, foreach loops, etc.
@@ -125,7 +128,7 @@
 
     /** A hash table mapping syntax trees to their ending source positions.
      */
-    Map<JCTree, Integer> endPositions;
+    EndPosTable endPosTable;
 
 /**************************************************************************
  * Global mappings
@@ -303,7 +306,7 @@
                 Symbol constructor = TreeInfo.symbol(tree.meth);
                 ClassSymbol c = (ClassSymbol)constructor.owner;
                 if (c.hasOuterInstance() &&
-                    tree.meth.getTag() != JCTree.SELECT &&
+                    !tree.meth.hasTag(SELECT) &&
                     outerThisStack.head != null)
                     visitSymbol(outerThisStack.head);
             }
@@ -508,7 +511,7 @@
      *  @param optag    The operators tree tag.
      *  @param arg      The operator's argument.
      */
-    JCUnary makeUnary(int optag, JCExpression arg) {
+    JCUnary makeUnary(JCTree.Tag optag, JCExpression arg) {
         JCUnary tree = make.Unary(optag, arg);
         tree.operator = rs.resolveUnaryOperator(
             make_pos, optag, attrEnv, arg.type);
@@ -521,7 +524,7 @@
      *  @param lhs      The operator's left argument.
      *  @param rhs      The operator's right argument.
      */
-    JCBinary makeBinary(int optag, JCExpression lhs, JCExpression rhs) {
+    JCBinary makeBinary(JCTree.Tag optag, JCExpression lhs, JCExpression rhs) {
         JCBinary tree = make.Binary(optag, lhs, rhs);
         tree.operator = rs.resolveBinaryOperator(
             make_pos, optag, attrEnv, lhs.type, rhs.type);
@@ -534,10 +537,10 @@
      *  @param lhs      The operator's left argument.
      *  @param rhs      The operator's right argument.
      */
-    JCAssignOp makeAssignop(int optag, JCTree lhs, JCTree rhs) {
+    JCAssignOp makeAssignop(JCTree.Tag optag, JCTree lhs, JCTree rhs) {
         JCAssignOp tree = make.Assignop(optag, lhs, rhs);
         tree.operator = rs.resolveBinaryOperator(
-            make_pos, tree.getTag() - JCTree.ASGOffset, attrEnv, lhs.type, rhs.type);
+            make_pos, tree.getTag().noAssignOp(), attrEnv, lhs.type, rhs.type);
         tree.type = lhs.type;
         return tree;
     }
@@ -720,7 +723,7 @@
     // where
     private boolean isTranslatedClassAvailable(ClassSymbol c) {
         for (JCTree tree: translated) {
-            if (tree.getTag() == JCTree.CLASSDEF
+            if (tree.hasTag(CLASSDEF)
                     && ((JCClassDecl) tree).sym == c) {
                 return true;
             }
@@ -802,13 +805,13 @@
     private static int accessCode(JCTree tree, JCTree enclOp) {
         if (enclOp == null)
             return DEREFcode;
-        else if (enclOp.getTag() == JCTree.ASSIGN &&
+        else if (enclOp.hasTag(ASSIGN) &&
                  tree == TreeInfo.skipParens(((JCAssign) enclOp).lhs))
             return ASSIGNcode;
-        else if (JCTree.PREINC <= enclOp.getTag() && enclOp.getTag() <= JCTree.POSTDEC &&
+        else if (enclOp.getTag().isIncOrDecUnaryOp() &&
                  tree == TreeInfo.skipParens(((JCUnary) enclOp).arg))
-            return (enclOp.getTag() - JCTree.PREINC) * 2 + PREINCcode;
-        else if (JCTree.BITOR_ASG <= enclOp.getTag() && enclOp.getTag() <= JCTree.MOD_ASG &&
+            return mapTagToUnaryOpCode(enclOp.getTag());
+        else if (enclOp.getTag().isAssignop() &&
                  tree == TreeInfo.skipParens(((JCAssignOp) enclOp).lhs))
             return accessCode(((OperatorSymbol) ((JCAssignOp) enclOp).operator).opcode);
         else
@@ -832,39 +835,39 @@
     /** Return tree tag for assignment operation corresponding
      *  to given binary operator.
      */
-    private static int treeTag(OperatorSymbol operator) {
+    private static JCTree.Tag treeTag(OperatorSymbol operator) {
         switch (operator.opcode) {
         case ByteCodes.ior: case ByteCodes.lor:
-            return JCTree.BITOR_ASG;
+            return BITOR_ASG;
         case ByteCodes.ixor: case ByteCodes.lxor:
-            return JCTree.BITXOR_ASG;
+            return BITXOR_ASG;
         case ByteCodes.iand: case ByteCodes.land:
-            return JCTree.BITAND_ASG;
+            return BITAND_ASG;
         case ByteCodes.ishl: case ByteCodes.lshl:
         case ByteCodes.ishll: case ByteCodes.lshll:
-            return JCTree.SL_ASG;
+            return SL_ASG;
         case ByteCodes.ishr: case ByteCodes.lshr:
         case ByteCodes.ishrl: case ByteCodes.lshrl:
-            return JCTree.SR_ASG;
+            return SR_ASG;
         case ByteCodes.iushr: case ByteCodes.lushr:
         case ByteCodes.iushrl: case ByteCodes.lushrl:
-            return JCTree.USR_ASG;
+            return USR_ASG;
         case ByteCodes.iadd: case ByteCodes.ladd:
         case ByteCodes.fadd: case ByteCodes.dadd:
         case ByteCodes.string_add:
-            return JCTree.PLUS_ASG;
+            return PLUS_ASG;
         case ByteCodes.isub: case ByteCodes.lsub:
         case ByteCodes.fsub: case ByteCodes.dsub:
-            return JCTree.MINUS_ASG;
+            return MINUS_ASG;
         case ByteCodes.imul: case ByteCodes.lmul:
         case ByteCodes.fmul: case ByteCodes.dmul:
-            return JCTree.MUL_ASG;
+            return MUL_ASG;
         case ByteCodes.idiv: case ByteCodes.ldiv:
         case ByteCodes.fdiv: case ByteCodes.ddiv:
-            return JCTree.DIV_ASG;
+            return DIV_ASG;
         case ByteCodes.imod: case ByteCodes.lmod:
         case ByteCodes.fmod: case ByteCodes.dmod:
-            return JCTree.MOD_ASG;
+            return MOD_ASG;
         default:
             throw new AssertionError();
         }
@@ -1003,7 +1006,7 @@
         if (!currentClass.isSubClass(sym.owner, types))
             return true;
         if ((sym.flags() & STATIC) != 0 ||
-            tree.getTag() != JCTree.SELECT ||
+            !tree.hasTag(SELECT) ||
             TreeInfo.name(((JCFieldAccess) tree).selected) == names._super)
             return false;
         return !((JCFieldAccess) tree).selected.type.tsym.isSubClass(currentClass, types);
@@ -1018,7 +1021,7 @@
         if (protAccess) {
             Symbol qualifier = null;
             ClassSymbol c = currentClass;
-            if (tree.getTag() == JCTree.SELECT && (sym.flags() & STATIC) == 0) {
+            if (tree.hasTag(SELECT) && (sym.flags() & STATIC) == 0) {
                 qualifier = ((JCFieldAccess) tree).selected.type.tsym;
                 while (!qualifier.isSubClass(c, types)) {
                     c = c.owner.enclClass();
@@ -1058,7 +1061,7 @@
             Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
             tree = make.at(tree.pos).Ident(sym);
         }
-        JCExpression base = (tree.getTag() == JCTree.SELECT) ? ((JCFieldAccess) tree).selected : null;
+        JCExpression base = (tree.hasTag(SELECT)) ? ((JCFieldAccess) tree).selected : null;
         switch (sym.kind) {
         case TYP:
             if (sym.owner.kind != PCK) {
@@ -1068,11 +1071,11 @@
                 while (base != null &&
                        TreeInfo.symbol(base) != null &&
                        TreeInfo.symbol(base).kind != PCK) {
-                    base = (base.getTag() == JCTree.SELECT)
+                    base = (base.hasTag(SELECT))
                         ? ((JCFieldAccess) base).selected
                         : null;
                 }
-                if (tree.getTag() == JCTree.IDENT) {
+                if (tree.hasTag(IDENT)) {
                     ((JCIdent) tree).name = flatname;
                 } else if (base == null) {
                     tree = make.at(tree.pos).Ident(sym);
@@ -1220,6 +1223,42 @@
         }
     }
 
+    /** Maps unary operator integer codes to JCTree.Tag objects
+     *  @param unaryOpCode the unary operator code
+     */
+    private static Tag mapUnaryOpCodeToTag(int unaryOpCode){
+        switch (unaryOpCode){
+            case PREINCcode:
+                return PREINC;
+            case PREDECcode:
+                return PREDEC;
+            case POSTINCcode:
+                return POSTINC;
+            case POSTDECcode:
+                return POSTDEC;
+            default:
+                return NO_TAG;
+        }
+    }
+
+    /** Maps JCTree.Tag objects to unary operator integer codes
+     *  @param tag the JCTree.Tag
+     */
+    private static int mapTagToUnaryOpCode(Tag tag){
+        switch (tag){
+            case PREINC:
+                return PREINCcode;
+            case PREDEC:
+                return PREDECcode;
+            case POSTINC:
+                return POSTINCcode;
+            case POSTDEC:
+                return POSTDECcode;
+            default:
+                return -1;
+        }
+    }
+
     /** Construct definition of an access method.
      *  @param pos        The source code position of the definition.
      *  @param vsym       The private or protected symbol.
@@ -1259,8 +1298,7 @@
                 expr = make.Assign(ref, args.head);
                 break;
             case PREINCcode: case POSTINCcode: case PREDECcode: case POSTDECcode:
-                expr = makeUnary(
-                    ((acode1 - PREINCcode) >> 1) + JCTree.PREINC, ref);
+                expr = makeUnary(mapUnaryOpCodeToTag(acode1), ref);
                 break;
             default:
                 expr = make.Assignop(
@@ -1568,6 +1606,11 @@
     }
 
     private JCStatement makeResourceCloseInvocation(JCExpression resource) {
+        // convert to AutoCloseable if needed
+        if (types.asSuper(resource.type, syms.autoCloseableType.tsym) == null) {
+            resource = (JCExpression) convert(resource, syms.autoCloseableType);
+        }
+
         // create resource.close() method invocation
         JCExpression resourceClose = makeCall(resource,
                                               names.close,
@@ -1576,7 +1619,7 @@
     }
 
     private JCExpression makeNonNullCheck(JCExpression expression) {
-        return makeBinary(JCTree.NE, expression, makeNull());
+        return makeBinary(NE, expression, makeNull());
     }
 
     /** Construct a tree that represents the outer instance
@@ -1808,7 +1851,7 @@
             // $newcache.getClass().getComponentType().getClassLoader() : cl$"
             JCExpression clvalue =
                 make.Conditional(
-                    makeBinary(JCTree.EQ, make.Ident(clsym), makeNull()),
+                    makeBinary(EQ, make.Ident(clsym), makeNull()),
                     make.Assign(
                         make.Ident(clsym),
                         makeCall(
@@ -1976,7 +2019,7 @@
                 writer.xClassName(type).toString().replace('/', '.');
             Symbol cs = cacheSym(pos, sig);
             return make_at(pos).Conditional(
-                makeBinary(JCTree.EQ, make.Ident(cs), makeNull()),
+                makeBinary(EQ, make.Ident(cs), makeNull()),
                 make.Assign(
                     make.Ident(cs),
                     make.App(
@@ -2023,7 +2066,7 @@
                                                             List.<Type>nil());
             JCClassDecl containerDef = classDef(container);
             make_at(containerDef.pos());
-            JCExpression notStatus = makeUnary(JCTree.NOT, make.App(make.Select(
+            JCExpression notStatus = makeUnary(NOT, make.App(make.Select(
                     classOfType(types.erasure(outermostClass.type),
                                 containerDef.pos()),
                     desiredAssertionStatusSym)));
@@ -2032,7 +2075,7 @@
             containerDef.defs = containerDef.defs.prepend(assertDisabledDef);
         }
         make_at(pos);
-        return makeUnary(JCTree.NOT, make.Ident(assertDisabledSym));
+        return makeUnary(NOT, make.Ident(assertDisabledSym));
     }
 
 
@@ -2062,9 +2105,9 @@
     JCTree abstractRval(JCTree rval, Type type, TreeBuilder builder) {
         rval = TreeInfo.skipParens(rval);
         switch (rval.getTag()) {
-        case JCTree.LITERAL:
+        case LITERAL:
             return builder.build(rval);
-        case JCTree.IDENT:
+        case IDENT:
             JCIdent id = (JCIdent) rval;
             if ((id.sym.flags() & FINAL) != 0 && id.sym.owner.kind == MTH)
                 return builder.build(rval);
@@ -2097,9 +2140,9 @@
     JCTree abstractLval(JCTree lval, final TreeBuilder builder) {
         lval = TreeInfo.skipParens(lval);
         switch (lval.getTag()) {
-        case JCTree.IDENT:
+        case IDENT:
             return builder.build(lval);
-        case JCTree.SELECT: {
+        case SELECT: {
             final JCFieldAccess s = (JCFieldAccess)lval;
             JCTree selected = TreeInfo.skipParens(s.selected);
             Symbol lid = TreeInfo.symbol(s.selected);
@@ -2110,7 +2153,7 @@
                     }
                 });
         }
-        case JCTree.INDEXED: {
+        case INDEXED: {
             final JCArrayAccess i = (JCArrayAccess)lval;
             return abstractRval(i.indexed, new TreeBuilder() {
                     public JCTree build(final JCTree indexed) {
@@ -2125,7 +2168,7 @@
                     }
                 });
         }
-        case JCTree.TYPECAST: {
+        case TYPECAST: {
             return abstractLval(((JCTypeCast)lval).expr, builder);
         }
         }
@@ -2158,9 +2201,8 @@
         } else {
             make_at(tree.pos());
             T result = super.translate(tree);
-            if (endPositions != null && result != tree) {
-                Integer endPos = endPositions.remove(tree);
-                if (endPos != null) endPositions.put(result, endPos);
+            if (endPosTable != null && result != tree) {
+                endPosTable.replaceTree(tree, result);
             }
             return result;
         }
@@ -2271,6 +2313,14 @@
         tree.extending = translate(tree.extending);
         tree.implementing = translate(tree.implementing);
 
+        if (currentClass.isLocal()) {
+            ClassSymbol encl = currentClass.owner.enclClass();
+            if (encl.trans_local == null) {
+                encl.trans_local = List.nil();
+            }
+            encl.trans_local = encl.trans_local.prepend(currentClass);
+        }
+
         // Recursively translate members, taking into account that new members
         // might be created during the translation and prepended to the member
         // list `tree.defs'.
@@ -2337,7 +2387,7 @@
         for (List<JCTree> defs = tree.defs;
              defs.nonEmpty();
              defs=defs.tail) {
-            if (defs.head.getTag() == JCTree.VARDEF && (((JCVariableDecl) defs.head).mods.flags & ENUM) != 0) {
+            if (defs.head.hasTag(VARDEF) && (((JCVariableDecl) defs.head).mods.flags & ENUM) != 0) {
                 JCVariableDecl var = (JCVariableDecl)defs.head;
                 visitEnumConstantDef(var, nextOrdinal++);
                 values.append(make.QualIdent(var.sym));
@@ -2749,9 +2799,9 @@
                 List.<JCExpression>nil() : List.of(translate(tree.detail));
             if (!tree.cond.type.isFalse()) {
                 cond = makeBinary
-                    (JCTree.AND,
+                    (AND,
                      cond,
-                     makeUnary(JCTree.NOT, tree.cond));
+                     makeUnary(NOT, tree.cond));
             }
             result =
                 make.If(cond,
@@ -2808,7 +2858,7 @@
             // first argument.
             if (c.hasOuterInstance()) {
                 JCExpression thisArg;
-                if (tree.meth.getTag() == JCTree.SELECT) {
+                if (tree.meth.hasTag(SELECT)) {
                     thisArg = attr.
                         makeNullCheck(translate(((JCFieldAccess) tree.meth).selected));
                     tree.meth = make.Ident(constructor);
@@ -2829,7 +2879,7 @@
             // If the translated method itself is an Apply tree, we are
             // seeing an access method invocation. In this case, append
             // the method arguments to the arguments of the access method.
-            if (tree.meth.getTag() == JCTree.APPLY) {
+            if (tree.meth.hasTag(APPLY)) {
                 JCMethodInvocation app = (JCMethodInvocation)tree.meth;
                 app.args = tree.args.prependList(app.args);
                 result = app;
@@ -2963,7 +3013,7 @@
         // If translated left hand side is an Apply, we are
         // seeing an access method invocation. In this case, append
         // right hand side as last argument of the access method.
-        if (tree.lhs.getTag() == JCTree.APPLY) {
+        if (tree.lhs.hasTag(APPLY)) {
             JCMethodInvocation app = (JCMethodInvocation)tree.lhs;
             app.args = List.of(tree.rhs).prependList(app.args);
             result = app;
@@ -2980,7 +3030,7 @@
             // (but without recomputing x)
             JCTree newTree = abstractLval(tree.lhs, new TreeBuilder() {
                     public JCTree build(final JCTree lhs) {
-                        int newTag = tree.getTag() - JCTree.ASGOffset;
+                        JCTree.Tag newTag = tree.getTag().noAssignOp();
                         // Erasure (TransTypes) can change the type of
                         // tree.lhs.  However, we can still get the
                         // unerased type of tree.lhs as it is stored
@@ -3010,7 +3060,7 @@
         // If translated left hand side is an Apply, we are
         // seeing an access method invocation. In this case, append
         // right hand side as last argument of the access method.
-        if (tree.lhs.getTag() == JCTree.APPLY) {
+        if (tree.lhs.hasTag(APPLY)) {
             JCMethodInvocation app = (JCMethodInvocation)tree.lhs;
             // if operation is a += on strings,
             // make sure to convert argument to string
@@ -3030,13 +3080,13 @@
         // or
         // translate to tmp1=lval(e); tmp2=tmp1; (typeof tree)tmp1 OP 1; tmp2
         // where OP is += or -=
-        final boolean cast = TreeInfo.skipParens(tree.arg).getTag() == JCTree.TYPECAST;
+        final boolean cast = TreeInfo.skipParens(tree.arg).hasTag(TYPECAST);
         return abstractLval(tree.arg, new TreeBuilder() {
                 public JCTree build(final JCTree tmp1) {
                     return abstractRval(tmp1, tree.arg.type, new TreeBuilder() {
                             public JCTree build(final JCTree tmp2) {
-                                int opcode = (tree.getTag() == JCTree.POSTINC)
-                                    ? JCTree.PLUS_ASG : JCTree.MINUS_ASG;
+                                JCTree.Tag opcode = (tree.hasTag(POSTINC))
+                                    ? PLUS_ASG : MINUS_ASG;
                                 JCTree lhs = cast
                                     ? make.TypeCast(tree.arg.type, (JCExpression)tmp1)
                                     : tmp1;
@@ -3051,25 +3101,24 @@
     }
 
     public void visitUnary(JCUnary tree) {
-        boolean isUpdateOperator =
-            JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC;
+        boolean isUpdateOperator = tree.getTag().isIncOrDecUnaryOp();
         if (isUpdateOperator && !tree.arg.type.isPrimitive()) {
             switch(tree.getTag()) {
-            case JCTree.PREINC:            // ++ e
+            case PREINC:            // ++ e
                     // translate to e += 1
-            case JCTree.PREDEC:            // -- e
+            case PREDEC:            // -- e
                     // translate to e -= 1
                 {
-                    int opcode = (tree.getTag() == JCTree.PREINC)
-                        ? JCTree.PLUS_ASG : JCTree.MINUS_ASG;
+                    JCTree.Tag opcode = (tree.hasTag(PREINC))
+                        ? PLUS_ASG : MINUS_ASG;
                     JCAssignOp newTree = makeAssignop(opcode,
                                                     tree.arg,
                                                     make.Literal(1));
                     result = translate(newTree, tree.type);
                     return;
                 }
-            case JCTree.POSTINC:           // e ++
-            case JCTree.POSTDEC:           // e --
+            case POSTINC:           // e ++
+            case POSTDEC:           // e --
                 {
                     result = translate(lowerBoxedPostop(tree), tree.type);
                     return;
@@ -3080,14 +3129,14 @@
 
         tree.arg = boxIfNeeded(translate(tree.arg, tree), tree.type);
 
-        if (tree.getTag() == JCTree.NOT && tree.arg.type.constValue() != null) {
+        if (tree.hasTag(NOT) && tree.arg.type.constValue() != null) {
             tree.type = cfolder.fold1(bool_not, tree.arg.type);
         }
 
         // If translated left hand side is an Apply, we are
         // seeing an access method invocation. In this case, return
         // that access method invocation as result.
-        if (isUpdateOperator && tree.arg.getTag() == JCTree.APPLY) {
+        if (isUpdateOperator && tree.arg.hasTag(APPLY)) {
             result = tree.arg;
         } else {
             result = tree;
@@ -3098,7 +3147,7 @@
         List<Type> formals = tree.operator.type.getParameterTypes();
         JCTree lhs = tree.lhs = translate(tree.lhs, formals.head);
         switch (tree.getTag()) {
-        case JCTree.OR:
+        case OR:
             if (lhs.type.isTrue()) {
                 result = lhs;
                 return;
@@ -3108,7 +3157,7 @@
                 return;
             }
             break;
-        case JCTree.AND:
+        case AND:
             if (lhs.type.isFalse()) {
                 result = lhs;
                 return;
@@ -3178,9 +3227,9 @@
             indexdef.init.type = indexdef.type = syms.intType.constType(0);
 
             List<JCStatement> loopinit = List.of(arraycachedef, lencachedef, indexdef);
-            JCBinary cond = makeBinary(JCTree.LT, make.Ident(index), make.Ident(lencache));
-
-            JCExpressionStatement step = make.Exec(makeUnary(JCTree.PREINC, make.Ident(index)));
+            JCBinary cond = makeBinary(LT, make.Ident(index), make.Ident(lencache));
+
+            JCExpressionStatement step = make.Exec(makeUnary(PREINC, make.Ident(index)));
 
             Type elemtype = types.elemtype(tree.expr.type);
             JCExpression loopvarinit = make.Indexed(make.Ident(arraycache),
@@ -3450,6 +3499,7 @@
                 JCExpression expression = oneCase.getExpression();
 
                 if (expression != null) { // expression for a "default" case is null
+                    expression = TreeInfo.skipParens(expression);
                     String labelExpr = (String) expression.type.constValue();
                     Integer mapping = caseLabelToPosition.put(labelExpr, casePosition);
                     Assert.checkNull(mapping);
@@ -3555,8 +3605,8 @@
                 if (isDefault)
                     caseExpr = null;
                 else {
-                    caseExpr = make.Literal(caseLabelToPosition.get((String)oneCase.
-                                                                    getExpression().
+                    caseExpr = make.Literal(caseLabelToPosition.get((String)TreeInfo.skipParens(oneCase.
+                                                                                                getExpression()).
                                                                     type.constValue()));
                 }
 
@@ -3583,7 +3633,7 @@
         // need to special case-access of the form C.super.x
         // these will always need an access method.
         boolean qualifiedSuperAccess =
-            tree.selected.getTag() == JCTree.SELECT &&
+            tree.selected.hasTag(SELECT) &&
             TreeInfo.name(tree.selected) == names._super;
         tree.selected = translate(tree.selected);
         if (tree.name == names._class)
@@ -3630,10 +3680,10 @@
         try {
             attrEnv = env;
             this.make = make;
-            endPositions = env.toplevel.endPositions;
+            endPosTable = env.toplevel.endPositions;
             currentClass = null;
             currentMethodDef = null;
-            outermostClassDef = (cdef.getTag() == JCTree.CLASSDEF) ? (JCClassDecl)cdef : null;
+            outermostClassDef = (cdef.hasTag(CLASSDEF)) ? (JCClassDecl)cdef : null;
             outermostMemberDef = null;
             this.translated = new ListBuffer<JCTree>();
             classdefs = new HashMap<ClassSymbol,JCClassDecl>();
@@ -3659,7 +3709,7 @@
             // note that recursive invocations of this method fail hard
             attrEnv = null;
             this.make = null;
-            endPositions = null;
+            endPosTable = null;
             currentClass = null;
             currentMethodDef = null;
             outermostClassDef = null;
@@ -3829,7 +3879,7 @@
 
         JCIdent fLocUsageId = make.Ident(otherVarSym);
         JCExpression sel = make.Select(fLocUsageId, ordinalSymbol);
-        JCBinary bin = makeBinary(JCTree.MINUS, id1, sel);
+        JCBinary bin = makeBinary(MINUS, id1, sel);
         JCReturn ret = make.Return(bin);
         blockStatements.append(ret);
         JCMethodDecl compareToMethod = make.MethodDef((MethodSymbol)compareToSym,
--- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,8 +40,11 @@
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.ANNOTATION;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTags.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 /** This is the second phase of Enter, in which classes are completed
@@ -140,7 +143,7 @@
                 JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
                 throw new FatalError(msg);
             } else {
-                log.error(pos, "doesnt.exist", tsym);
+                log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
             }
         }
         env.toplevel.starImportScope.importAll(tsym.members());
@@ -526,24 +529,17 @@
 
     // process the non-static imports and the static imports of types.
     public void visitImport(JCImport tree) {
-        JCTree imp = tree.qualid;
+        JCFieldAccess imp = (JCFieldAccess)tree.qualid;
         Name name = TreeInfo.name(imp);
-        TypeSymbol p;
 
         // Create a local environment pointing to this tree to disable
         // effects of other imports in Resolve.findGlobalType
         Env<AttrContext> localEnv = env.dup(tree);
 
-        // Attribute qualifying package or class.
-        JCFieldAccess s = (JCFieldAccess) imp;
-        p = attr.
-            attribTree(s.selected,
-                       localEnv,
-                       tree.staticImport ? TYP : (TYP | PCK),
-                       Type.noType).tsym;
+        TypeSymbol p = attr.attribImportQualifier(tree, localEnv).tsym;
         if (name == names.asterisk) {
             // Import on demand.
-            chk.checkCanonical(s.selected);
+            chk.checkCanonical(imp.selected);
             if (tree.staticImport)
                 importStaticAll(tree.pos, p, env);
             else
@@ -552,7 +548,7 @@
             // Named type import.
             if (tree.staticImport) {
                 importNamedStatic(tree.pos(), p, name, localEnv);
-                chk.checkCanonical(s.selected);
+                chk.checkCanonical(imp.selected);
             } else {
                 TypeSymbol c = attribImportType(imp, localEnv).tsym;
                 chk.checkCanonical(imp);
@@ -644,7 +640,7 @@
         tree.sym = v;
         if (tree.init != null) {
             v.flags_field |= HASINIT;
-            if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS) {
+            if ((v.flags_field & FINAL) != 0 && !tree.init.hasTag(NEWCLASS)) {
                 Env<AttrContext> initEnv = getInitEnv(tree, env);
                 initEnv.info.enclVar = v;
                 v.setLazyConstValue(initEnv(tree, initEnv), attr, tree.init);
@@ -785,20 +781,6 @@
                 && s.owner.kind != MTH
                 && types.isSameType(c.type, syms.deprecatedType))
                 s.flags_field |= Flags.DEPRECATED;
-            // Internally to java.lang.invoke, a @PolymorphicSignature annotation
-            // acts like a classfile attribute.
-            if (!c.type.isErroneous() &&
-                types.isSameType(c.type, syms.polymorphicSignatureType)) {
-                if (!target.hasMethodHandles()) {
-                    // Somebody is compiling JDK7 source code to a JDK6 target.
-                    // Make it an error, since it is unlikely but important.
-                    log.error(env.tree.pos(),
-                            "wrong.target.for.polymorphic.signature.definition",
-                            target.name);
-                }
-                // Pull the flag through for better diagnostics, even on a bad target.
-                s.flags_field |= Flags.POLYMORPHIC_SIGNATURE;
-            }
             if (!annotated.add(a.type.tsym))
                 log.error(a.pos, "duplicate.annotation");
         }
@@ -868,7 +850,7 @@
             // If this is a toplevel-class, make sure any preceding import
             // clauses have been seen.
             if (c.owner.kind == PCK) {
-                memberEnter(env.toplevel, env.enclosing(JCTree.TOPLEVEL));
+                memberEnter(env.toplevel, env.enclosing(TOPLEVEL));
                 todo.append(env);
             }
 
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,29 +25,38 @@
 
 package com.sun.tools.javac.comp;
 
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.api.Formattable.LocalizedString;
 import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.tree.*;
-import com.sun.tools.javac.api.Formattable.LocalizedString;
-import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
-
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.Attr.ResultInfo;
+import com.sun.tools.javac.comp.Check.CheckContext;
+import com.sun.tools.javac.comp.Resolve.MethodResolutionContext.Candidate;
+import com.sun.tools.javac.jvm.*;
+import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.lang.model.element.ElementVisitor;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.BLOCK;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Kinds.ERRONEOUS;
 import static com.sun.tools.javac.code.TypeTags.*;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
-import javax.lang.model.element.ElementVisitor;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.HashMap;
-import java.util.HashSet;
+import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** Helper class for name resolution, used mostly by the attribution phase.
  *
@@ -63,6 +72,7 @@
     Names names;
     Log log;
     Symtab syms;
+    Attr attr;
     Check chk;
     Infer infer;
     ClassReader reader;
@@ -73,16 +83,10 @@
     public final boolean varargsEnabled; // = source.allowVarargs();
     public final boolean allowMethodHandles;
     private final boolean debugResolve;
+    final EnumSet<VerboseResolutionMode> verboseResolutionMode;
 
     Scope polymorphicSignatureScope;
 
-    public static Resolve instance(Context context) {
-        Resolve instance = context.get(resolveKey);
-        if (instance == null)
-            instance = new Resolve(context);
-        return instance;
-    }
-
     protected Resolve(Context context) {
         context.put(resolveKey, this);
         syms = Symtab.instance(context);
@@ -90,9 +94,9 @@
         varNotFound = new
             SymbolNotFoundError(ABSENT_VAR);
         wrongMethod = new
-            InapplicableSymbolError(syms.errSymbol);
+            InapplicableSymbolError();
         wrongMethods = new
-            InapplicableSymbolsError(syms.errSymbol);
+            InapplicableSymbolsError();
         methodNotFound = new
             SymbolNotFoundError(ABSENT_MTH);
         typeNotFound = new
@@ -100,6 +104,7 @@
 
         names = Names.instance(context);
         log = Log.instance(context);
+        attr = Attr.instance(context);
         chk = Check.instance(context);
         infer = Infer.instance(context);
         reader = ClassReader.instance(context);
@@ -111,6 +116,7 @@
         varargsEnabled = source.allowVarargs();
         Options options = Options.instance(context);
         debugResolve = options.isSet("debugresolve");
+        verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options);
         Target target = Target.instance(context);
         allowMethodHandles = target.hasMethodHandles();
         polymorphicSignatureScope = new Scope(syms.noSymbol);
@@ -120,11 +126,123 @@
 
     /** error symbols, which are returned when resolution fails
      */
-    final SymbolNotFoundError varNotFound;
-    final InapplicableSymbolError wrongMethod;
-    final InapplicableSymbolsError wrongMethods;
-    final SymbolNotFoundError methodNotFound;
-    final SymbolNotFoundError typeNotFound;
+    private final SymbolNotFoundError varNotFound;
+    private final InapplicableSymbolError wrongMethod;
+    private final InapplicableSymbolsError wrongMethods;
+    private final SymbolNotFoundError methodNotFound;
+    private final SymbolNotFoundError typeNotFound;
+
+    public static Resolve instance(Context context) {
+        Resolve instance = context.get(resolveKey);
+        if (instance == null)
+            instance = new Resolve(context);
+        return instance;
+    }
+
+    // <editor-fold defaultstate="collapsed" desc="Verbose resolution diagnostics support">
+    enum VerboseResolutionMode {
+        SUCCESS("success"),
+        FAILURE("failure"),
+        APPLICABLE("applicable"),
+        INAPPLICABLE("inapplicable"),
+        DEFERRED_INST("deferred-inference"),
+        PREDEF("predef"),
+        OBJECT_INIT("object-init"),
+        INTERNAL("internal");
+
+        String opt;
+
+        private VerboseResolutionMode(String opt) {
+            this.opt = opt;
+        }
+
+        static EnumSet<VerboseResolutionMode> getVerboseResolutionMode(Options opts) {
+            String s = opts.get("verboseResolution");
+            EnumSet<VerboseResolutionMode> res = EnumSet.noneOf(VerboseResolutionMode.class);
+            if (s == null) return res;
+            if (s.contains("all")) {
+                res = EnumSet.allOf(VerboseResolutionMode.class);
+            }
+            Collection<String> args = Arrays.asList(s.split(","));
+            for (VerboseResolutionMode mode : values()) {
+                if (args.contains(mode.opt)) {
+                    res.add(mode);
+                } else if (args.contains("-" + mode.opt)) {
+                    res.remove(mode);
+                }
+            }
+            return res;
+        }
+    }
+
+    void reportVerboseResolutionDiagnostic(DiagnosticPosition dpos, Name name, Type site,
+            List<Type> argtypes, List<Type> typeargtypes, Symbol bestSoFar) {
+        boolean success = bestSoFar.kind < ERRONEOUS;
+
+        if (success && !verboseResolutionMode.contains(VerboseResolutionMode.SUCCESS)) {
+            return;
+        } else if (!success && !verboseResolutionMode.contains(VerboseResolutionMode.FAILURE)) {
+            return;
+        }
+
+        if (bestSoFar.name == names.init &&
+                bestSoFar.owner == syms.objectType.tsym &&
+                !verboseResolutionMode.contains(VerboseResolutionMode.OBJECT_INIT)) {
+            return; //skip diags for Object constructor resolution
+        } else if (site == syms.predefClass.type &&
+                !verboseResolutionMode.contains(VerboseResolutionMode.PREDEF)) {
+            return; //skip spurious diags for predef symbols (i.e. operators)
+        } else if (currentResolutionContext.internalResolution &&
+                !verboseResolutionMode.contains(VerboseResolutionMode.INTERNAL)) {
+            return;
+        }
+
+        int pos = 0;
+        int mostSpecificPos = -1;
+        ListBuffer<JCDiagnostic> subDiags = ListBuffer.lb();
+        for (Candidate c : currentResolutionContext.candidates) {
+            if (currentResolutionContext.step != c.step ||
+                    (c.isApplicable() && !verboseResolutionMode.contains(VerboseResolutionMode.APPLICABLE)) ||
+                    (!c.isApplicable() && !verboseResolutionMode.contains(VerboseResolutionMode.INAPPLICABLE))) {
+                continue;
+            } else {
+                subDiags.append(c.isApplicable() ?
+                        getVerboseApplicableCandidateDiag(pos, c.sym, c.mtype) :
+                        getVerboseInapplicableCandidateDiag(pos, c.sym, c.details));
+                if (c.sym == bestSoFar)
+                    mostSpecificPos = pos;
+                pos++;
+            }
+        }
+        String key = success ? "verbose.resolve.multi" : "verbose.resolve.multi.1";
+        JCDiagnostic main = diags.note(log.currentSource(), dpos, key, name,
+                site.tsym, mostSpecificPos, currentResolutionContext.step,
+                methodArguments(argtypes), methodArguments(typeargtypes));
+        JCDiagnostic d = new JCDiagnostic.MultilineDiagnostic(main, subDiags.toList());
+        log.report(d);
+    }
+
+    JCDiagnostic getVerboseApplicableCandidateDiag(int pos, Symbol sym, Type inst) {
+        JCDiagnostic subDiag = null;
+        if (inst.getReturnType().tag == FORALL) {
+            Type diagType = types.createMethodTypeWithReturn(inst.asMethodType(),
+                                                            ((ForAll)inst.getReturnType()).qtype);
+            subDiag = diags.fragment("partial.inst.sig", diagType);
+        } else if (sym.type.tag == FORALL) {
+            subDiag = diags.fragment("full.inst.sig", inst.asMethodType());
+        }
+
+        String key = subDiag == null ?
+                "applicable.method.found" :
+                "applicable.method.found.1";
+
+        return diags.fragment(key, pos, sym, subDiag);
+    }
+
+    JCDiagnostic getVerboseInapplicableCandidateDiag(int pos, Symbol sym, JCDiagnostic subDiag) {
+        return diags.fragment("not.applicable.method.found", pos, sym, subDiag);
+    }
+    // </editor-fold>
 
 /* ************************************************************************
  * Identifier resolution
@@ -281,7 +399,6 @@
         else {
             Symbol s2 = ((MethodSymbol)sym).implementation(site.tsym, types, true);
             return (s2 == null || s2 == sym || sym.owner == s2.owner ||
-                    s2.isPolymorphicSignatureGeneric() ||
                     !types.isSubSignature(types.memberType(site, s2), types.memberType(site, sym)));
         }
     }
@@ -331,7 +448,6 @@
                         boolean useVarargs,
                         Warner warn)
         throws Infer.InferenceException {
-        boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles;
         if (useVarargs && (m.flags() & VARARGS) == 0)
             throw inapplicableMethodException.setMessage();
         Type mt = types.memberType(site, m);
@@ -372,8 +488,7 @@
         }
 
         // find out whether we need to go the slow route via infer
-        boolean instNeeded = tvars.tail != null || /*inlined: tvars.nonEmpty()*/
-                polymorphicSignature;
+        boolean instNeeded = tvars.tail != null; /*inlined: tvars.nonEmpty()*/
         for (List<Type> l = argtypes;
              l.tail != null/*inlined: l.nonEmpty()*/ && !instNeeded;
              l = l.tail) {
@@ -381,9 +496,7 @@
         }
 
         if (instNeeded)
-            return polymorphicSignature ?
-                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes) :
-                infer.instantiateMethod(env,
+            return infer.instantiateMethod(env,
                                     tvars,
                                     (MethodType)mt,
                                     m,
@@ -430,86 +543,226 @@
             return false;
         }
     }
+    /**
+     * A check handler is used by the main method applicability routine in order
+     * to handle specific method applicability failures. It is assumed that a class
+     * implementing this interface should throw exceptions that are a subtype of
+     * InapplicableMethodException (see below). Such exception will terminate the
+     * method applicability check and propagate important info outwards (for the
+     * purpose of generating better diagnostics).
+     */
+    interface MethodCheckHandler {
+        /* The number of actuals and formals differ */
+        InapplicableMethodException arityMismatch();
+        /* An actual argument type does not conform to the corresponding formal type */
+        InapplicableMethodException argumentMismatch(boolean varargs, Type found, Type expected);
+        /* The element type of a varargs is not accessible in the current context */
+        InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected);
+    }
+
+    /**
+     * Basic method check handler used within Resolve - all methods end up
+     * throwing InapplicableMethodException; a diagnostic fragment that describes
+     * the cause as to why the method is not applicable is set on the exception
+     * before it is thrown.
+     */
+    MethodCheckHandler resolveHandler = new MethodCheckHandler() {
+            public InapplicableMethodException arityMismatch() {
+                return inapplicableMethodException.setMessage("arg.length.mismatch");
+            }
+            public InapplicableMethodException argumentMismatch(boolean varargs, Type found, Type expected) {
+                String key = varargs ?
+                        "varargs.argument.mismatch" :
+                        "no.conforming.assignment.exists";
+                return inapplicableMethodException.setMessage(key,
+                        found, expected);
+            }
+            public InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected) {
+                return inapplicableMethodException.setMessage("inaccessible.varargs.type",
+                        expected, Kinds.kindName(location), location);
+            }
+    };
+
     void checkRawArgumentsAcceptable(Env<AttrContext> env,
                                 List<Type> argtypes,
                                 List<Type> formals,
                                 boolean allowBoxing,
                                 boolean useVarargs,
                                 Warner warn) {
+        checkRawArgumentsAcceptable(env, List.<Type>nil(), argtypes, formals,
+                allowBoxing, useVarargs, warn, resolveHandler);
+    }
+
+    /**
+     * Main method applicability routine. Given a list of actual types A,
+     * a list of formal types F, determines whether the types in A are
+     * compatible (by method invocation conversion) with the types in F.
+     *
+     * Since this routine is shared between overload resolution and method
+     * type-inference, it is crucial that actual types are converted to the
+     * corresponding 'undet' form (i.e. where inference variables are replaced
+     * with undetvars) so that constraints can be propagated and collected.
+     *
+     * Moreover, if one or more types in A is a poly type, this routine calls
+     * Infer.instantiateArg in order to complete the poly type (this might involve
+     * deferred attribution).
+     *
+     * A method check handler (see above) is used in order to report errors.
+     */
+    List<Type> checkRawArgumentsAcceptable(Env<AttrContext> env,
+                                List<Type> undetvars,
+                                List<Type> argtypes,
+                                List<Type> formals,
+                                boolean allowBoxing,
+                                boolean useVarargs,
+                                Warner warn,
+                                MethodCheckHandler handler) {
         Type varargsFormal = useVarargs ? formals.last() : null;
+        ListBuffer<Type> checkedArgs = ListBuffer.lb();
+
         if (varargsFormal == null &&
                 argtypes.size() != formals.size()) {
-            throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args
+            throw handler.arityMismatch(); // not enough args
         }
 
         while (argtypes.nonEmpty() && formals.head != varargsFormal) {
-            boolean works = allowBoxing
-                ? types.isConvertible(argtypes.head, formals.head, warn)
-                : types.isSubtypeUnchecked(argtypes.head, formals.head, warn);
-            if (!works)
-                throw inapplicableMethodException.setMessage("no.conforming.assignment.exists",
-                        argtypes.head,
-                        formals.head);
+            ResultInfo resultInfo = methodCheckResult(formals.head, allowBoxing, false, undetvars, handler, warn);
+            checkedArgs.append(resultInfo.check(env.tree.pos(), argtypes.head));
             argtypes = argtypes.tail;
             formals = formals.tail;
         }
 
-        if (formals.head != varargsFormal)
-            throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args
+        if (formals.head != varargsFormal) {
+            throw handler.arityMismatch(); // not enough args
+        }
 
         if (useVarargs) {
+            //note: if applicability check is triggered by most specific test,
+            //the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
             Type elt = types.elemtype(varargsFormal);
             while (argtypes.nonEmpty()) {
-                if (!types.isConvertible(argtypes.head, elt, warn))
-                    throw inapplicableMethodException.setMessage("varargs.argument.mismatch",
-                            argtypes.head,
-                            elt);
+                ResultInfo resultInfo = methodCheckResult(elt, allowBoxing, true, undetvars, handler, warn);
+                checkedArgs.append(resultInfo.check(env.tree.pos(), argtypes.head));
                 argtypes = argtypes.tail;
             }
             //check varargs element type accessibility
-            if (!isAccessible(env, elt)) {
+            if (undetvars.isEmpty() && !isAccessible(env, elt)) {
                 Symbol location = env.enclClass.sym;
-                throw inapplicableMethodException.setMessage("inaccessible.varargs.type",
-                            elt,
-                            Kinds.kindName(location),
-                            location);
+                throw handler.inaccessibleVarargs(location, elt);
             }
         }
-        return;
+        return checkedArgs.toList();
     }
-    // where
-        public static class InapplicableMethodException extends RuntimeException {
-            private static final long serialVersionUID = 0;
+
+    /**
+     * Check context to be used during method applicability checks. A method check
+     * context might contain inference variables.
+     */
+    abstract class MethodCheckContext implements CheckContext {
+
+        MethodCheckHandler handler;
+        boolean useVarargs;
+        List<Type> undetvars;
+        Warner rsWarner;
+
+        public MethodCheckContext(MethodCheckHandler handler, boolean useVarargs, List<Type> undetvars, Warner rsWarner) {
+            this.handler = handler;
+            this.useVarargs = useVarargs;
+            this.undetvars = undetvars;
+            this.rsWarner = rsWarner;
+        }
+
+        public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
+            throw handler.argumentMismatch(useVarargs, found, req);
+        }
+
+        public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) {
+            throw new AssertionError("ForAll in argument position");
+        }
+
+        public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) {
+            return rsWarner;
+        }
+    }
 
-            JCDiagnostic diagnostic;
-            JCDiagnostic.Factory diags;
+    /**
+     * Subclass of method check context class that implements strict method conversion.
+     * Strict method conversion checks compatibility between types using subtyping tests.
+     */
+    class StrictMethodContext extends MethodCheckContext {
+
+        public StrictMethodContext(MethodCheckHandler handler, boolean useVarargs, List<Type> undetvars, Warner rsWarner) {
+            super(handler, useVarargs, undetvars, rsWarner);
+        }
+
+        public boolean compatible(Type found, Type req, Warner warn) {
+            return types.isSubtypeUnchecked(found, infer.asUndetType(req, undetvars), warn);
+        }
+    }
+
+    /**
+     * Subclass of method check context class that implements loose method conversion.
+     * Loose method conversion checks compatibility between types using method conversion tests.
+     */
+    class LooseMethodContext extends MethodCheckContext {
 
-            InapplicableMethodException(JCDiagnostic.Factory diags) {
-                this.diagnostic = null;
-                this.diags = diags;
-            }
-            InapplicableMethodException setMessage() {
-                this.diagnostic = null;
-                return this;
+        public LooseMethodContext(MethodCheckHandler handler, boolean useVarargs, List<Type> undetvars, Warner rsWarner) {
+            super(handler, useVarargs, undetvars, rsWarner);
+        }
+
+        public boolean compatible(Type found, Type req, Warner warn) {
+            return types.isConvertible(found, infer.asUndetType(req, undetvars), warn);
+        }
+    }
+
+    /**
+     * Create a method check context to be used during method applicability check
+     */
+    ResultInfo methodCheckResult(Type to, boolean allowBoxing, boolean useVarargs,
+            List<Type> undetvars, MethodCheckHandler methodHandler, Warner rsWarner) {
+        MethodCheckContext checkContext = allowBoxing ?
+                new LooseMethodContext(methodHandler, useVarargs, undetvars, rsWarner) :
+                new StrictMethodContext(methodHandler, useVarargs, undetvars, rsWarner);
+        return attr.new ResultInfo(VAL, to, checkContext) {
+            @Override
+            protected Type check(DiagnosticPosition pos, Type found) {
+                return super.check(pos, chk.checkNonVoid(pos, types.capture(types.upperBound(found))));
             }
-            InapplicableMethodException setMessage(String key) {
-                this.diagnostic = key != null ? diags.fragment(key) : null;
-                return this;
-            }
-            InapplicableMethodException setMessage(String key, Object... args) {
-                this.diagnostic = key != null ? diags.fragment(key, args) : null;
-                return this;
-            }
-            InapplicableMethodException setMessage(JCDiagnostic diag) {
-                this.diagnostic = diag;
-                return this;
-            }
+        };
+    }
+
+    public static class InapplicableMethodException extends RuntimeException {
+        private static final long serialVersionUID = 0;
+
+        JCDiagnostic diagnostic;
+        JCDiagnostic.Factory diags;
 
-            public JCDiagnostic getDiagnostic() {
-                return diagnostic;
-            }
+        InapplicableMethodException(JCDiagnostic.Factory diags) {
+            this.diagnostic = null;
+            this.diags = diags;
+        }
+        InapplicableMethodException setMessage() {
+            this.diagnostic = null;
+            return this;
+        }
+        InapplicableMethodException setMessage(String key) {
+            this.diagnostic = key != null ? diags.fragment(key) : null;
+            return this;
         }
-        private final InapplicableMethodException inapplicableMethodException;
+        InapplicableMethodException setMessage(String key, Object... args) {
+            this.diagnostic = key != null ? diags.fragment(key, args) : null;
+            return this;
+        }
+        InapplicableMethodException setMessage(JCDiagnostic diag) {
+            this.diagnostic = diag;
+            return this;
+        }
+
+        public JCDiagnostic getDiagnostic() {
+            return diagnostic;
+        }
+    }
+    private final InapplicableMethodException inapplicableMethodException;
 
 /* ***************************************************************************
  *  Symbol lookup
@@ -684,16 +937,20 @@
         if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
         Assert.check(sym.kind < AMBIGUOUS);
         try {
-            rawInstantiate(env, site, sym, argtypes, typeargtypes,
+            Type mt = rawInstantiate(env, site, sym, argtypes, typeargtypes,
                                allowBoxing, useVarargs, Warner.noWarnings);
+            if (!operator)
+                currentResolutionContext.addApplicableCandidate(sym, mt);
         } catch (InapplicableMethodException ex) {
+            if (!operator)
+                currentResolutionContext.addInapplicableCandidate(sym, ex.getDiagnostic());
             switch (bestSoFar.kind) {
             case ABSENT_MTH:
-                return wrongMethod.setWrongSym(sym, ex.getDiagnostic());
+                return wrongMethod;
             case WRONG_MTH:
-                wrongMethods.addCandidate(currentStep, wrongMethod.sym, wrongMethod.explanation);
+                if (operator) return bestSoFar;
             case WRONG_MTHS:
-                return wrongMethods.addCandidate(currentStep, sym, ex.getDiagnostic());
+                return wrongMethods;
             default:
                 return bestSoFar;
             }
@@ -702,7 +959,7 @@
             return (bestSoFar.kind == ABSENT_MTH)
                 ? new AccessError(env, site, sym)
                 : bestSoFar;
-            }
+        }
         return (bestSoFar.kind > AMBIGUOUS)
             ? sym
             : mostSpecific(sym, bestSoFar, env, site,
@@ -767,16 +1024,13 @@
                                        m2.erasure(types).getParameterTypes()))
                     return ambiguityError(m1, m2);
                 // both abstract, neither overridden; merge throws clause and result type
-                Symbol mostSpecific;
-                if (types.returnTypeSubstitutable(mt1, mt2))
-                    mostSpecific = m1;
-                else if (types.returnTypeSubstitutable(mt2, mt1))
-                    mostSpecific = m2;
-                else {
+                Type mst = mostSpecificReturnType(mt1, mt2);
+                if (mst == null) {
                     // Theoretically, this can't happen, but it is possible
                     // due to error recovery or mixing incompatible class files
                     return ambiguityError(m1, m2);
                 }
+                Symbol mostSpecific = mst == mt1 ? m1 : m2;
                 List<Type> allThrown = chk.intersect(mt1.getThrownTypes(), mt2.getThrownTypes());
                 Type newSig = types.createMethodTypeWithThrown(mostSpecific.type, allThrown);
                 MethodSymbol result = new MethodSymbol(
@@ -859,6 +1113,28 @@
         }
     }
     //where
+    Type mostSpecificReturnType(Type mt1, Type mt2) {
+        Type rt1 = mt1.getReturnType();
+        Type rt2 = mt2.getReturnType();
+
+        if (mt1.tag == FORALL && mt2.tag == FORALL) {
+            //if both are generic methods, adjust return type ahead of subtyping check
+            rt1 = types.subst(rt1, mt1.getTypeArguments(), mt2.getTypeArguments());
+        }
+        //first use subtyping, then return type substitutability
+        if (types.isSubtype(rt1, rt2)) {
+            return mt1;
+        } else if (types.isSubtype(rt2, rt1)) {
+            return mt2;
+        } else if (types.returnTypeSubstitutable(mt1, mt2)) {
+            return mt1;
+        } else if (types.returnTypeSubstitutable(mt2, mt1)) {
+            return mt2;
+        } else {
+            return null;
+        }
+    }
+    //where
     Symbol ambiguityError(Symbol m1, Symbol m2) {
         if (((m1.flags() | m2.flags()) & CLASH) != 0) {
             return (m1.flags() & CLASH) == 0 ? m1 : m2;
@@ -887,7 +1163,7 @@
                       boolean useVarargs,
                       boolean operator) {
         Symbol bestSoFar = methodNotFound;
-        return findMethod(env,
+        bestSoFar = findMethod(env,
                           site,
                           name,
                           argtypes,
@@ -899,6 +1175,8 @@
                           useVarargs,
                           operator,
                           new HashSet<TypeSymbol>());
+        reportVerboseResolutionDiagnostic(env.tree.pos(), name, site, argtypes, typeargtypes, bestSoFar);
+        return bestSoFar;
     }
     // where
     private Symbol findMethod(Env<AttrContext> env,
@@ -1144,7 +1422,7 @@
                 staticOnly = true;
         }
 
-        if (env.tree.getTag() != JCTree.IMPORT) {
+        if (!env.tree.hasTag(IMPORT)) {
             sym = findGlobalType(env, env.toplevel.namedImportScope, name);
             if (sym.exists()) return sym;
             else if (sym.kind < bestSoFar.kind) bestSoFar = sym;
@@ -1389,32 +1667,33 @@
                          Name name,
                          List<Type> argtypes,
                          List<Type> typeargtypes) {
-        Symbol sym = startResolution();
-        List<MethodResolutionPhase> steps = methodResolutionSteps;
-        while (steps.nonEmpty() &&
-               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
-               sym.kind >= ERRONEOUS) {
-            currentStep = steps.head;
-            sym = findFun(env, name, argtypes, typeargtypes,
-                    steps.head.isBoxingRequired,
-                    env.info.varArgs = steps.head.isVarargsRequired);
-            methodResolutionCache.put(steps.head, sym);
-            steps = steps.tail;
+        MethodResolutionContext prevResolutionContext = currentResolutionContext;
+        try {
+            currentResolutionContext = new MethodResolutionContext();
+            Symbol sym = methodNotFound;
+            List<MethodResolutionPhase> steps = methodResolutionSteps;
+            while (steps.nonEmpty() &&
+                   steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+                   sym.kind >= ERRONEOUS) {
+                currentResolutionContext.step = steps.head;
+                sym = findFun(env, name, argtypes, typeargtypes,
+                        steps.head.isBoxingRequired,
+                        env.info.varArgs = steps.head.isVarargsRequired);
+                currentResolutionContext.resolutionCache.put(steps.head, sym);
+                steps = steps.tail;
+            }
+            if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
+                MethodResolutionPhase errPhase =
+                        currentResolutionContext.firstErroneousResolutionPhase();
+                sym = access(currentResolutionContext.resolutionCache.get(errPhase),
+                        pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes);
+                env.info.varArgs = errPhase.isVarargsRequired;
+            }
+            return sym;
         }
-        if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
-            MethodResolutionPhase errPhase =
-                    firstErroneousResolutionPhase();
-            sym = access(methodResolutionCache.get(errPhase),
-                    pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes);
-            env.info.varArgs = errPhase.isVarargsRequired;
+        finally {
+            currentResolutionContext = prevResolutionContext;
         }
-        return sym;
-    }
-
-    private Symbol startResolution() {
-        wrongMethod.clear();
-        wrongMethods.clear();
-        return methodNotFound;
     }
 
     /** Resolve a qualified method identifier
@@ -1434,80 +1713,71 @@
     Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
                                   Symbol location, Type site, Name name, List<Type> argtypes,
                                   List<Type> typeargtypes) {
-        Symbol sym = startResolution();
-        List<MethodResolutionPhase> steps = methodResolutionSteps;
-        while (steps.nonEmpty() &&
-               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
-               sym.kind >= ERRONEOUS) {
-            currentStep = steps.head;
-            sym = findMethod(env, site, name, argtypes, typeargtypes,
-                    steps.head.isBoxingRequired(),
-                    env.info.varArgs = steps.head.isVarargsRequired(), false);
-            methodResolutionCache.put(steps.head, sym);
-            steps = steps.tail;
-        }
-        if (sym.kind >= AMBIGUOUS) {
-            if (site.tsym.isPolymorphicSignatureGeneric()) {
-                //polymorphic receiver - synthesize new method symbol
-                env.info.varArgs = false;
-                sym = findPolymorphicSignatureInstance(env,
-                        site, name, null, argtypes);
+        return resolveQualifiedMethod(new MethodResolutionContext(), pos, env, location, site, name, argtypes, typeargtypes);
+    }
+    private Symbol resolveQualifiedMethod(MethodResolutionContext resolveContext,
+                                  DiagnosticPosition pos, Env<AttrContext> env,
+                                  Symbol location, Type site, Name name, List<Type> argtypes,
+                                  List<Type> typeargtypes) {
+        MethodResolutionContext prevResolutionContext = currentResolutionContext;
+        try {
+            currentResolutionContext = resolveContext;
+            Symbol sym = methodNotFound;
+            List<MethodResolutionPhase> steps = methodResolutionSteps;
+            while (steps.nonEmpty() &&
+                   steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+                   sym.kind >= ERRONEOUS) {
+                currentResolutionContext.step = steps.head;
+                sym = findMethod(env, site, name, argtypes, typeargtypes,
+                        steps.head.isBoxingRequired(),
+                        env.info.varArgs = steps.head.isVarargsRequired(), false);
+                currentResolutionContext.resolutionCache.put(steps.head, sym);
+                steps = steps.tail;
             }
-            else {
+            if (sym.kind >= AMBIGUOUS) {
                 //if nothing is found return the 'first' error
                 MethodResolutionPhase errPhase =
-                        firstErroneousResolutionPhase();
-                sym = access(methodResolutionCache.get(errPhase),
+                        currentResolutionContext.firstErroneousResolutionPhase();
+                sym = access(currentResolutionContext.resolutionCache.get(errPhase),
                         pos, location, site, name, true, argtypes, typeargtypes);
                 env.info.varArgs = errPhase.isVarargsRequired;
+            } else if (allowMethodHandles) {
+                MethodSymbol msym = (MethodSymbol)sym;
+                if (msym.isSignaturePolymorphic(types)) {
+                    env.info.varArgs = false;
+                    return findPolymorphicSignatureInstance(env, sym, argtypes);
+                }
             }
-        } else if (allowMethodHandles && sym.isPolymorphicSignatureGeneric()) {
-            //non-instantiated polymorphic signature - synthesize new method symbol
-            env.info.varArgs = false;
-            sym = findPolymorphicSignatureInstance(env,
-                    site, name, (MethodSymbol)sym, argtypes);
+            return sym;
         }
-        return sym;
+        finally {
+            currentResolutionContext = prevResolutionContext;
+        }
     }
 
     /** Find or create an implicit method of exactly the given type (after erasure).
      *  Searches in a side table, not the main scope of the site.
      *  This emulates the lookup process required by JSR 292 in JVM.
      *  @param env       Attribution environment
-     *  @param site      The original type from where the selection takes place.
-     *  @param name      The method's name.
-     *  @param spMethod  A template for the implicit method, or null.
-     *  @param argtypes  The required argument types.
-     *  @param typeargtypes  The required type arguments.
+     *  @param spMethod  signature polymorphic method - i.e. MH.invokeExact
+     *  @param argtypes  The required argument types
      */
-    Symbol findPolymorphicSignatureInstance(Env<AttrContext> env, Type site,
-                                            Name name,
-                                            MethodSymbol spMethod,  // sig. poly. method or null if none
+    Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
+                                            Symbol spMethod,
                                             List<Type> argtypes) {
         Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
-                site, name, spMethod, argtypes);
-        long flags = ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE |
-                    (spMethod != null ?
-                        spMethod.flags() & Flags.AccessFlags :
-                        Flags.PUBLIC | Flags.STATIC);
-        Symbol m = null;
-        for (Scope.Entry e = polymorphicSignatureScope.lookup(name);
-             e.scope != null;
-             e = e.next()) {
-            Symbol sym = e.sym;
-            if (types.isSameType(mtype, sym.type) &&
-                (sym.flags() & Flags.STATIC) == (flags & Flags.STATIC) &&
-                types.isSameType(sym.owner.type, site)) {
-               m = sym;
-               break;
+                (MethodSymbol)spMethod, argtypes);
+        for (Symbol sym : polymorphicSignatureScope.getElementsByName(spMethod.name)) {
+            if (types.isSameType(mtype, sym.type)) {
+               return sym;
             }
         }
-        if (m == null) {
-            // create the desired method
-            m = new MethodSymbol(flags, name, mtype, site.tsym);
-            polymorphicSignatureScope.enter(m);
-        }
-        return m;
+
+        // create the desired method
+        long flags = ABSTRACT | HYPOTHETICAL | spMethod.flags() & Flags.AccessFlags;
+        Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner);
+        polymorphicSignatureScope.enter(msym);
+        return msym;
     }
 
     /** Resolve a qualified method identifier, throw a fatal error if not
@@ -1524,8 +1794,10 @@
                                         Type site, Name name,
                                         List<Type> argtypes,
                                         List<Type> typeargtypes) {
-        Symbol sym = resolveQualifiedMethod(
-            pos, env, site.tsym, site, name, argtypes, typeargtypes);
+        MethodResolutionContext resolveContext = new MethodResolutionContext();
+        resolveContext.internalResolution = true;
+        Symbol sym = resolveQualifiedMethod(resolveContext, pos, env, site.tsym,
+                site, name, argtypes, typeargtypes);
         if (sym.kind == MTH) return (MethodSymbol)sym;
         else throw new FatalError(
                  diags.fragment("fatal.err.cant.locate.meth",
@@ -1546,25 +1818,40 @@
                               Type site,
                               List<Type> argtypes,
                               List<Type> typeargtypes) {
-        Symbol sym = startResolution();
-        List<MethodResolutionPhase> steps = methodResolutionSteps;
-        while (steps.nonEmpty() &&
-               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
-               sym.kind >= ERRONEOUS) {
-            currentStep = steps.head;
-            sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
-                    steps.head.isBoxingRequired(),
-                    env.info.varArgs = steps.head.isVarargsRequired());
-            methodResolutionCache.put(steps.head, sym);
-            steps = steps.tail;
+        return resolveConstructor(new MethodResolutionContext(), pos, env, site, argtypes, typeargtypes);
+    }
+    private Symbol resolveConstructor(MethodResolutionContext resolveContext,
+                              DiagnosticPosition pos,
+                              Env<AttrContext> env,
+                              Type site,
+                              List<Type> argtypes,
+                              List<Type> typeargtypes) {
+        MethodResolutionContext prevResolutionContext = currentResolutionContext;
+        try {
+            currentResolutionContext = resolveContext;
+            Symbol sym = methodNotFound;
+            List<MethodResolutionPhase> steps = methodResolutionSteps;
+            while (steps.nonEmpty() &&
+                   steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+                   sym.kind >= ERRONEOUS) {
+                currentResolutionContext.step = steps.head;
+                sym = findConstructor(pos, env, site, argtypes, typeargtypes,
+                        steps.head.isBoxingRequired(),
+                        env.info.varArgs = steps.head.isVarargsRequired());
+                currentResolutionContext.resolutionCache.put(steps.head, sym);
+                steps = steps.tail;
+            }
+            if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
+                MethodResolutionPhase errPhase = currentResolutionContext.firstErroneousResolutionPhase();
+                sym = access(currentResolutionContext.resolutionCache.get(errPhase),
+                        pos, site, names.init, true, argtypes, typeargtypes);
+                env.info.varArgs = errPhase.isVarargsRequired();
+            }
+            return sym;
         }
-        if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
-            MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
-            sym = access(methodResolutionCache.get(errPhase),
-                    pos, site, names.init, true, argtypes, typeargtypes);
-            env.info.varArgs = errPhase.isVarargsRequired();
+        finally {
+            currentResolutionContext = prevResolutionContext;
         }
-        return sym;
     }
 
     /** Resolve constructor using diamond inference.
@@ -1582,38 +1869,82 @@
                               Type site,
                               List<Type> argtypes,
                               List<Type> typeargtypes) {
-        Symbol sym = startResolution();
-        List<MethodResolutionPhase> steps = methodResolutionSteps;
-        while (steps.nonEmpty() &&
-               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
-               sym.kind >= ERRONEOUS) {
-            currentStep = steps.head;
-            sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
-                    steps.head.isBoxingRequired(),
-                    env.info.varArgs = steps.head.isVarargsRequired());
-            methodResolutionCache.put(steps.head, sym);
-            steps = steps.tail;
+        MethodResolutionContext prevResolutionContext = currentResolutionContext;
+        try {
+            currentResolutionContext = new MethodResolutionContext();
+            Symbol sym = methodNotFound;
+            List<MethodResolutionPhase> steps = methodResolutionSteps;
+            while (steps.nonEmpty() &&
+                   steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+                   sym.kind >= ERRONEOUS) {
+                currentResolutionContext.step = steps.head;
+                sym = findDiamond(env, site, argtypes, typeargtypes,
+                        steps.head.isBoxingRequired(),
+                        env.info.varArgs = steps.head.isVarargsRequired());
+                currentResolutionContext.resolutionCache.put(steps.head, sym);
+                steps = steps.tail;
+            }
+            if (sym.kind >= AMBIGUOUS) {
+                final JCDiagnostic details = sym.kind == WRONG_MTH ?
+                                currentResolutionContext.candidates.head.details :
+                                null;
+                Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
+                    @Override
+                    JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
+                            Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+                        String key = details == null ?
+                            "cant.apply.diamond" :
+                            "cant.apply.diamond.1";
+                        return diags.create(dkind, log.currentSource(), pos, key,
+                                diags.fragment("diamond", site.tsym), details);
+                    }
+                };
+                MethodResolutionPhase errPhase = currentResolutionContext.firstErroneousResolutionPhase();
+                sym = access(errSym, pos, site, names.init, true, argtypes, typeargtypes);
+                env.info.varArgs = errPhase.isVarargsRequired();
+            }
+            return sym;
         }
-        if (sym.kind >= AMBIGUOUS) {
-            final JCDiagnostic details = sym.kind == WRONG_MTH ?
-                ((InapplicableSymbolError)sym).explanation :
-                null;
-            Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
-                @Override
-                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
-                        Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
-                    String key = details == null ?
-                        "cant.apply.diamond" :
-                        "cant.apply.diamond.1";
-                    return diags.create(dkind, log.currentSource(), pos, key,
-                            diags.fragment("diamond", site.tsym), details);
-                }
-            };
-            MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
-            sym = access(errSym, pos, site, names.init, true, argtypes, typeargtypes);
-            env.info.varArgs = errPhase.isVarargsRequired();
+        finally {
+            currentResolutionContext = prevResolutionContext;
         }
-        return sym;
+    }
+
+    /** This method scans all the constructor symbol in a given class scope -
+     *  assuming that the original scope contains a constructor of the kind:
+     *  Foo(X x, Y y), where X,Y are class type-variables declared in Foo,
+     *  a method check is executed against the modified constructor type:
+     *  <X,Y>Foo<X,Y>(X x, Y y). This is crucial in order to enable diamond
+     *  inference. The inferred return type of the synthetic constructor IS
+     *  the inferred type for the diamond operator.
+     */
+    private Symbol findDiamond(Env<AttrContext> env,
+                              Type site,
+                              List<Type> argtypes,
+                              List<Type> typeargtypes,
+                              boolean allowBoxing,
+                              boolean useVarargs) {
+        Symbol bestSoFar = methodNotFound;
+        for (Scope.Entry e = site.tsym.members().lookup(names.init);
+             e.scope != null;
+             e = e.next()) {
+            //- System.out.println(" e " + e.sym);
+            if (e.sym.kind == MTH &&
+                (e.sym.flags_field & SYNTHETIC) == 0) {
+                    List<Type> oldParams = e.sym.type.tag == FORALL ?
+                            ((ForAll)e.sym.type).tvars :
+                            List.<Type>nil();
+                    Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),
+                            types.createMethodTypeWithReturn(e.sym.type.asMethodType(), site));
+                    bestSoFar = selectBest(env, site, argtypes, typeargtypes,
+                            new MethodSymbol(e.sym.flags(), names.init, constrType, site.tsym),
+                            bestSoFar,
+                            allowBoxing,
+                            useVarargs,
+                            false);
+            }
+        }
+        return bestSoFar;
     }
 
     /** Resolve constructor.
@@ -1632,10 +1963,25 @@
                               List<Type> typeargtypes,
                               boolean allowBoxing,
                               boolean useVarargs) {
+        MethodResolutionContext prevResolutionContext = currentResolutionContext;
+        try {
+            currentResolutionContext = new MethodResolutionContext();
+            return findConstructor(pos, env, site, argtypes, typeargtypes, allowBoxing, useVarargs);
+        }
+        finally {
+            currentResolutionContext = prevResolutionContext;
+        }
+    }
+
+    Symbol findConstructor(DiagnosticPosition pos, Env<AttrContext> env,
+                              Type site, List<Type> argtypes,
+                              List<Type> typeargtypes,
+                              boolean allowBoxing,
+                              boolean useVarargs) {
         Symbol sym = findMethod(env, site,
-                                names.init, argtypes,
-                                typeargtypes, allowBoxing,
-                                useVarargs, false);
+                                    names.init, argtypes,
+                                    typeargtypes, allowBoxing,
+                                    useVarargs, false);
         chk.checkDeprecated(pos, env.info.scope.owner, sym);
         return sym;
     }
@@ -1651,8 +1997,9 @@
                                         Type site,
                                         List<Type> argtypes,
                                         List<Type> typeargtypes) {
-        Symbol sym = resolveConstructor(
-            pos, env, site, argtypes, typeargtypes);
+        MethodResolutionContext resolveContext = new MethodResolutionContext();
+        resolveContext.internalResolution = true;
+        Symbol sym = resolveConstructor(resolveContext, pos, env, site, argtypes, typeargtypes);
         if (sym.kind == MTH) return (MethodSymbol)sym;
         else throw new FatalError(
                  diags.fragment("fatal.err.cant.locate.ctor", site));
@@ -1664,16 +2011,23 @@
      *  @param env       The environment current at the operation.
      *  @param argtypes  The types of the operands.
      */
-    Symbol resolveOperator(DiagnosticPosition pos, int optag,
+    Symbol resolveOperator(DiagnosticPosition pos, JCTree.Tag optag,
                            Env<AttrContext> env, List<Type> argtypes) {
-        Name name = treeinfo.operatorName(optag);
-        Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
-                                null, false, false, true);
-        if (boxingEnabled && sym.kind >= WRONG_MTHS)
-            sym = findMethod(env, syms.predefClass.type, name, argtypes,
-                             null, true, false, true);
-        return access(sym, pos, env.enclClass.sym.type, name,
-                      false, argtypes, null);
+        MethodResolutionContext prevResolutionContext = currentResolutionContext;
+        try {
+            currentResolutionContext = new MethodResolutionContext();
+            Name name = treeinfo.operatorName(optag);
+            Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
+                                    null, false, false, true);
+            if (boxingEnabled && sym.kind >= WRONG_MTHS)
+                sym = findMethod(env, syms.predefClass.type, name, argtypes,
+                                 null, true, false, true);
+            return access(sym, pos, env.enclClass.sym.type, name,
+                          false, argtypes, null);
+        }
+        finally {
+            currentResolutionContext = prevResolutionContext;
+        }
     }
 
     /** Resolve operator.
@@ -1682,7 +2036,7 @@
      *  @param env       The environment current at the operation.
      *  @param arg       The type of the operand.
      */
-    Symbol resolveUnaryOperator(DiagnosticPosition pos, int optag, Env<AttrContext> env, Type arg) {
+    Symbol resolveUnaryOperator(DiagnosticPosition pos, JCTree.Tag optag, Env<AttrContext> env, Type arg) {
         return resolveOperator(pos, optag, env, List.of(arg));
     }
 
@@ -1694,7 +2048,7 @@
      *  @param right     The types of the right operand.
      */
     Symbol resolveBinaryOperator(DiagnosticPosition pos,
-                                 int optag,
+                                 JCTree.Tag optag,
                                  Env<AttrContext> env,
                                  Type left,
                                  Type right) {
@@ -1786,9 +2140,10 @@
  *  ResolveError classes, indicating error situations when accessing symbols
  ****************************************************************************/
 
-    public void logAccessError(Env<AttrContext> env, JCTree tree, Type type) {
-        AccessError error = new AccessError(env, type.getEnclosingType(), type.tsym);
-        logResolveError(error, tree.pos(), type.getEnclosingType().tsym, type.getEnclosingType(), null, null, null);
+    //used by TransTypes when checking target type of synthetic cast
+    public void logAccessErrorInternal(Env<AttrContext> env, JCTree tree, Type type) {
+        AccessError error = new AccessError(env, env.enclClass.type, type.tsym);
+        logResolveError(error, tree.pos(), env.enclClass.sym, env.enclClass.type, null, null, null);
     }
     //where
     private void logResolveError(ResolveError error,
@@ -1809,7 +2164,7 @@
     private final LocalizedString noArgs = new LocalizedString("compiler.misc.no.args");
 
     public Object methodArguments(List<Type> argtypes) {
-        return argtypes.isEmpty() ? noArgs : argtypes;
+        return argtypes == null || argtypes.isEmpty() ? noArgs : argtypes;
     }
 
     /**
@@ -2017,34 +2372,24 @@
      * (either a method, a constructor or an operand) is not applicable
      * given an actual arguments/type argument list.
      */
-    class InapplicableSymbolError extends InvalidSymbolError {
+    class InapplicableSymbolError extends ResolveError {
 
-        /** An auxiliary explanation set in case of instantiation errors. */
-        JCDiagnostic explanation;
-
-        InapplicableSymbolError(Symbol sym) {
-            super(WRONG_MTH, sym, "inapplicable symbol error");
+        InapplicableSymbolError() {
+            super(WRONG_MTH, "inapplicable symbol error");
         }
 
-        /** Update sym and explanation and return this.
-         */
-        InapplicableSymbolError setWrongSym(Symbol sym, JCDiagnostic explanation) {
-            this.sym = sym;
-            if (this.sym == sym && explanation != null)
-                this.explanation = explanation; //update the details
-            return this;
-        }
-
-        /** Update sym and return this.
-         */
-        InapplicableSymbolError setWrongSym(Symbol sym) {
-            this.sym = sym;
-            return this;
+        protected InapplicableSymbolError(int kind, String debugName) {
+            super(kind, debugName);
         }
 
         @Override
         public String toString() {
-            return super.toString() + " explanation=" + explanation;
+            return super.toString();
+        }
+
+        @Override
+        public boolean exists() {
+            return true;
         }
 
         @Override
@@ -2069,27 +2414,40 @@
                         key, name, first, second);
             }
             else {
-                Symbol ws = sym.asMemberOf(site, types);
+                Candidate c = errCandidate();
+                Symbol ws = c.sym.asMemberOf(site, types);
                 return diags.create(dkind, log.currentSource(), pos,
-                          "cant.apply.symbol" + (explanation != null ? ".1" : ""),
+                          "cant.apply.symbol" + (c.details != null ? ".1" : ""),
                           kindName(ws),
                           ws.name == names.init ? ws.owner.name : ws.name,
                           methodArguments(ws.type.getParameterTypes()),
                           methodArguments(argtypes),
                           kindName(ws.owner),
                           ws.owner.type,
-                          explanation);
+                          c.details);
             }
         }
 
-        void clear() {
-            explanation = null;
-        }
-
         @Override
         public Symbol access(Name name, TypeSymbol location) {
             return types.createErrorType(name, location, syms.errSymbol.type).tsym;
         }
+
+        protected boolean shouldReport(Candidate c) {
+            return !c.isApplicable() &&
+                    (((c.sym.flags() & VARARGS) != 0 && c.step == VARARITY) ||
+                      (c.sym.flags() & VARARGS) == 0 && c.step == (boxingEnabled ? BOX : BASIC));
+        }
+
+        private Candidate errCandidate() {
+            for (Candidate c : currentResolutionContext.candidates) {
+                if (shouldReport(c)) {
+                    return c;
+                }
+            }
+            Assert.error();
+            return null;
+        }
     }
 
     /**
@@ -2097,11 +2455,9 @@
      * (either methods, constructors or operands) is not applicable
      * given an actual arguments/type argument list.
      */
-    class InapplicableSymbolsError extends ResolveError {
+    class InapplicableSymbolsError extends InapplicableSymbolError {
 
-        private List<Candidate> candidates = List.nil();
-
-        InapplicableSymbolsError(Symbol sym) {
+        InapplicableSymbolsError() {
             super(WRONG_MTHS, "inapplicable symbols");
         }
 
@@ -2113,7 +2469,7 @@
                 Name name,
                 List<Type> argtypes,
                 List<Type> typeargtypes) {
-            if (candidates.nonEmpty()) {
+            if (currentResolutionContext.candidates.nonEmpty()) {
                 JCDiagnostic err = diags.create(dkind,
                         log.currentSource(),
                         pos,
@@ -2131,68 +2487,24 @@
         //where
         List<JCDiagnostic> candidateDetails(Type site) {
             List<JCDiagnostic> details = List.nil();
-            for (Candidate c : candidates)
-                details = details.prepend(c.getDiagnostic(site));
+            for (Candidate c : currentResolutionContext.candidates) {
+                if (!shouldReport(c)) continue;
+                JCDiagnostic detailDiag = diags.fragment("inapplicable.method",
+                        Kinds.kindName(c.sym),
+                        c.sym.location(site, types),
+                        c.sym.asMemberOf(site, types),
+                        c.details);
+                details = details.prepend(detailDiag);
+            }
             return details.reverse();
         }
 
-        Symbol addCandidate(MethodResolutionPhase currentStep, Symbol sym, JCDiagnostic details) {
-            Candidate c = new Candidate(currentStep, sym, details);
-            if (c.isValid() && !candidates.contains(c))
-                candidates = candidates.append(c);
-            return this;
-        }
-
-        void clear() {
-            candidates = List.nil();
-        }
-
         private Name getName() {
-            Symbol sym = candidates.head.sym;
+            Symbol sym = currentResolutionContext.candidates.head.sym;
             return sym.name == names.init ?
                 sym.owner.name :
                 sym.name;
         }
-
-        private class Candidate {
-
-            final MethodResolutionPhase step;
-            final Symbol sym;
-            final JCDiagnostic details;
-
-            private Candidate(MethodResolutionPhase step, Symbol sym, JCDiagnostic details) {
-                this.step = step;
-                this.sym = sym;
-                this.details = details;
-            }
-
-            JCDiagnostic getDiagnostic(Type site) {
-                return diags.fragment("inapplicable.method",
-                        Kinds.kindName(sym),
-                        sym.location(site, types),
-                        sym.asMemberOf(site, types),
-                        details);
-            }
-
-            @Override
-            public boolean equals(Object o) {
-                if (o instanceof Candidate) {
-                    Symbol s1 = this.sym;
-                    Symbol s2 = ((Candidate)o).sym;
-                    if  ((s1 != s2 &&
-                        (s1.overrides(s2, s1.owner.type.tsym, types, false) ||
-                        (s2.overrides(s1, s2.owner.type.tsym, types, false)))) ||
-                        ((s1.isConstructor() || s2.isConstructor()) && s1.owner != s2.owner))
-                        return true;
-                }
-                return false;
-            }
-
-            boolean isValid() {
-                return  (((sym.flags() & VARARGS) != 0 && step == VARARITY) ||
-                          (sym.flags() & VARARGS) == 0 && step == (boxingEnabled ? BOX : BASIC));
-            }
-        }
     }
 
     /**
@@ -2353,24 +2665,91 @@
         }
     }
 
-    private Map<MethodResolutionPhase, Symbol> methodResolutionCache =
-        new HashMap<MethodResolutionPhase, Symbol>(MethodResolutionPhase.values().length);
-
     final List<MethodResolutionPhase> methodResolutionSteps = List.of(BASIC, BOX, VARARITY);
 
-    private MethodResolutionPhase currentStep = null;
+    /**
+     * A resolution context is used to keep track of intermediate results of
+     * overload resolution, such as list of method that are not applicable
+     * (used to generate more precise diagnostics) and so on. Resolution contexts
+     * can be nested - this means that when each overload resolution routine should
+     * work within the resolution context it created.
+     */
+    class MethodResolutionContext {
+
+        private List<Candidate> candidates = List.nil();
+
+        private Map<MethodResolutionPhase, Symbol> resolutionCache =
+            new EnumMap<MethodResolutionPhase, Symbol>(MethodResolutionPhase.class);
+
+        private MethodResolutionPhase step = null;
+
+        private boolean internalResolution = false;
+
+        private MethodResolutionPhase firstErroneousResolutionPhase() {
+            MethodResolutionPhase bestSoFar = BASIC;
+            Symbol sym = methodNotFound;
+            List<MethodResolutionPhase> steps = methodResolutionSteps;
+            while (steps.nonEmpty() &&
+                   steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+                   sym.kind >= WRONG_MTHS) {
+                sym = resolutionCache.get(steps.head);
+                bestSoFar = steps.head;
+                steps = steps.tail;
+            }
+            return bestSoFar;
+        }
+
+        void addInapplicableCandidate(Symbol sym, JCDiagnostic details) {
+            Candidate c = new Candidate(currentResolutionContext.step, sym, details, null);
+            if (!candidates.contains(c))
+                candidates = candidates.append(c);
+        }
+
+        void addApplicableCandidate(Symbol sym, Type mtype) {
+            Candidate c = new Candidate(currentResolutionContext.step, sym, null, mtype);
+            candidates = candidates.append(c);
+        }
 
-    private MethodResolutionPhase firstErroneousResolutionPhase() {
-        MethodResolutionPhase bestSoFar = BASIC;
-        Symbol sym = methodNotFound;
-        List<MethodResolutionPhase> steps = methodResolutionSteps;
-        while (steps.nonEmpty() &&
-               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
-               sym.kind >= WRONG_MTHS) {
-            sym = methodResolutionCache.get(steps.head);
-            bestSoFar = steps.head;
-            steps = steps.tail;
+        /**
+         * This class represents an overload resolution candidate. There are two
+         * kinds of candidates: applicable methods and inapplicable methods;
+         * applicable methods have a pointer to the instantiated method type,
+         * while inapplicable candidates contain further details about the
+         * reason why the method has been considered inapplicable.
+         */
+        class Candidate {
+
+            final MethodResolutionPhase step;
+            final Symbol sym;
+            final JCDiagnostic details;
+            final Type mtype;
+
+            private Candidate(MethodResolutionPhase step, Symbol sym, JCDiagnostic details, Type mtype) {
+                this.step = step;
+                this.sym = sym;
+                this.details = details;
+                this.mtype = mtype;
+            }
+
+            @Override
+            public boolean equals(Object o) {
+                if (o instanceof Candidate) {
+                    Symbol s1 = this.sym;
+                    Symbol s2 = ((Candidate)o).sym;
+                    if  ((s1 != s2 &&
+                        (s1.overrides(s2, s1.owner.type.tsym, types, false) ||
+                        (s2.overrides(s1, s2.owner.type.tsym, types, false)))) ||
+                        ((s1.isConstructor() || s2.isConstructor()) && s1.owner != s2.owner))
+                        return true;
+                }
+                return false;
+            }
+
+            boolean isApplicable() {
+                return mtype != null;
+            }
         }
-        return bestSoFar;
     }
+
+    MethodResolutionContext currentResolutionContext = null;
 }
--- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Tue May 29 00:27:58 2012 +0100
@@ -107,7 +107,7 @@
         make.at(tree.pos);
         if (!types.isSameType(tree.type, target)) {
             if (!resolve.isAccessible(env, target.tsym))
-                resolve.logAccessError(env, tree, target);
+                resolve.logAccessErrorInternal(env, tree, target);
             tree = make.TypeCast(make.Type(target), tree).setType(target);
         }
         make.pos = oldpos;
--- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Tue May 29 00:27:58 2012 +0100
@@ -25,7 +25,6 @@
 
 package com.sun.tools.javac.file;
 
-import java.util.Comparator;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -41,6 +40,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -56,14 +56,12 @@
 
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
-import com.sun.tools.javac.main.OptionName;
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 
 import static javax.tools.StandardLocation.*;
-import static com.sun.tools.javac.main.OptionName.*;
 
 /**
  * This class provides access to the source, class and other files
@@ -83,32 +81,14 @@
             return buffer.toString().toCharArray();
     }
 
-    /** Encapsulates knowledge of paths
-     */
-    private Paths paths;
-
     private FSInfo fsInfo;
 
     private boolean contextUseOptimizedZip;
     private ZipFileIndexCache zipFileIndexCache;
 
-    private final File uninited = new File("U N I N I T E D");
-
     private final Set<JavaFileObject.Kind> sourceOrClass =
         EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS);
 
-    /** The standard output directory, primarily used for classes.
-     *  Initialized by the "-d" option.
-     *  If classOutDir = null, files are written into same directory as the sources
-     *  they were generated from.
-     */
-    private File classOutDir = uninited;
-
-    /** The output directory, used when generating sources while processing annotations.
-     *  Initialized by the "-s" option.
-     */
-    private File sourceOutDir = uninited;
-
     protected boolean mmappedIO;
     protected boolean ignoreSymbolFile;
 
@@ -154,13 +134,6 @@
     @Override
     public void setContext(Context context) {
         super.setContext(context);
-        if (paths == null) {
-            paths = Paths.instance(context);
-        } else {
-            // Reuse the Paths object as it stores the locations that
-            // have been set with setLocation, etc.
-            paths.setContext(context);
-        }
 
         fsInfo = FSInfo.instance(context);
 
@@ -179,7 +152,7 @@
 
     @Override
     public boolean isDefaultBootClassPath() {
-        return paths.isDefaultBootClassPath();
+        return locations.isDefaultBootClassPath();
     }
 
     public JavaFileObject getFileForInput(String name) {
@@ -493,7 +466,7 @@
      */
     private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
         File origZipFileName = zipFileName;
-        if (!ignoreSymbolFile && paths.isDefaultBootClassPathRtJar(zipFileName)) {
+        if (!ignoreSymbolFile && locations.isDefaultBootClassPathRtJar(zipFileName)) {
             File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
             if (new File(file.getName()).equals(new File("jre")))
                 file = file.getParentFile();
@@ -780,7 +753,7 @@
         } else if (location == SOURCE_OUTPUT) {
             dir = (getSourceOutDir() != null ? getSourceOutDir() : getClassOutDir());
         } else {
-            Iterable<? extends File> path = paths.getPathForLocation(location);
+            Iterable<? extends File> path = locations.getLocation(location);
             dir = null;
             for (File f: path) {
                 dir = f;
@@ -815,64 +788,20 @@
         throws IOException
     {
         nullCheck(location);
-        paths.lazy();
-
-        final File dir = location.isOutputLocation() ? getOutputDirectory(path) : null;
-
-        if (location == CLASS_OUTPUT)
-            classOutDir = getOutputLocation(dir, D);
-        else if (location == SOURCE_OUTPUT)
-            sourceOutDir = getOutputLocation(dir, S);
-        else
-            paths.setPathForLocation(location, path);
-    }
-    // where
-        private File getOutputDirectory(Iterable<? extends File> path) throws IOException {
-            if (path == null)
-                return null;
-            Iterator<? extends File> pathIter = path.iterator();
-            if (!pathIter.hasNext())
-                throw new IllegalArgumentException("empty path for directory");
-            File dir = pathIter.next();
-            if (pathIter.hasNext())
-                throw new IllegalArgumentException("path too long for directory");
-            if (!dir.exists())
-                throw new FileNotFoundException(dir + ": does not exist");
-            else if (!dir.isDirectory())
-                throw new IOException(dir + ": not a directory");
-            return dir;
-        }
-
-    private File getOutputLocation(File dir, OptionName defaultOptionName) {
-        if (dir != null)
-            return dir;
-        String arg = options.get(defaultOptionName);
-        if (arg == null)
-            return null;
-        return new File(arg);
+        locations.setLocation(location, path);
     }
 
     public Iterable<? extends File> getLocation(Location location) {
         nullCheck(location);
-        paths.lazy();
-        if (location == CLASS_OUTPUT) {
-            return (getClassOutDir() == null ? null : List.of(getClassOutDir()));
-        } else if (location == SOURCE_OUTPUT) {
-            return (getSourceOutDir() == null ? null : List.of(getSourceOutDir()));
-        } else
-            return paths.getPathForLocation(location);
+        return locations.getLocation(location);
     }
 
     private File getClassOutDir() {
-        if (classOutDir == uninited)
-            classOutDir = getOutputLocation(null, D);
-        return classOutDir;
+        return locations.getOutputLocation(CLASS_OUTPUT);
     }
 
     private File getSourceOutDir() {
-        if (sourceOutDir == uninited)
-            sourceOutDir = getOutputLocation(null, S);
-        return sourceOutDir;
+        return locations.getOutputLocation(SOURCE_OUTPUT);
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/file/Locations.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,772 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.file;
+
+import java.io.FileNotFoundException;
+import java.util.Iterator;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.zip.ZipFile;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.javac.code.Lint;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Options;
+
+import javax.tools.JavaFileManager;
+import static javax.tools.StandardLocation.*;
+import static com.sun.tools.javac.main.Option.*;
+
+/** This class converts command line arguments, environment variables
+ *  and system properties (in File.pathSeparator-separated String form)
+ *  into a boot class path, user class path, and source path (in
+ *  Collection<String> form).
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class Locations {
+
+    /** The log to use for warning output */
+    private Log log;
+
+    /** Collection of command-line options */
+    private Options options;
+
+    /** Handler for -Xlint options */
+    private Lint lint;
+
+    /** Access to (possibly cached) file info */
+    private FSInfo fsInfo;
+
+    /** Whether to warn about non-existent path elements */
+    private boolean warn;
+
+    // TODO: remove need for this
+    private boolean inited = false; // TODO? caching bad?
+
+    public Locations() {
+        initHandlers();
+    }
+
+    public void update(Log log, Options options, Lint lint, FSInfo fsInfo) {
+        this.log = log;
+        this.options = options;
+        this.lint = lint;
+        this.fsInfo = fsInfo;
+    }
+
+    public Collection<File> bootClassPath() {
+        return getLocation(PLATFORM_CLASS_PATH);
+    }
+
+    public boolean isDefaultBootClassPath() {
+        BootClassPathLocationHandler h =
+                (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH);
+        return h.isDefault();
+    }
+
+    boolean isDefaultBootClassPathRtJar(File file) {
+        BootClassPathLocationHandler h =
+                (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH);
+        return h.isDefaultRtJar(file);
+    }
+
+    public Collection<File> userClassPath() {
+        return getLocation(CLASS_PATH);
+    }
+
+    public Collection<File> sourcePath() {
+        Collection<File> p = getLocation(SOURCE_PATH);
+        // TODO: this should be handled by the LocationHandler
+        return p == null || p.isEmpty() ? null : p;
+    }
+
+    /**
+     * Split a path into its elements. Empty path elements will be ignored.
+     * @param path The path to be split
+     * @return The elements of the path
+     */
+    private static Iterable<File> getPathEntries(String path) {
+        return getPathEntries(path, null);
+    }
+
+    /**
+     * Split a path into its elements. If emptyPathDefault is not null, all
+     * empty elements in the path, including empty elements at either end of
+     * the path, will be replaced with the value of emptyPathDefault.
+     * @param path The path to be split
+     * @param emptyPathDefault The value to substitute for empty path elements,
+     *  or null, to ignore empty path elements
+     * @return The elements of the path
+     */
+    private static Iterable<File> getPathEntries(String path, File emptyPathDefault) {
+        ListBuffer<File> entries = new ListBuffer<File>();
+        int start = 0;
+        while (start <= path.length()) {
+            int sep = path.indexOf(File.pathSeparatorChar, start);
+            if (sep == -1)
+                sep = path.length();
+            if (start < sep)
+                entries.add(new File(path.substring(start, sep)));
+            else if (emptyPathDefault != null)
+                entries.add(emptyPathDefault);
+            start = sep + 1;
+        }
+        return entries;
+    }
+
+    /**
+     * Utility class to help evaluate a path option.
+     * Duplicate entries are ignored, jar class paths can be expanded.
+     */
+    private class Path extends LinkedHashSet<File> {
+        private static final long serialVersionUID = 0;
+
+        private boolean expandJarClassPaths = false;
+        private Set<File> canonicalValues = new HashSet<File>();
+
+        public Path expandJarClassPaths(boolean x) {
+            expandJarClassPaths = x;
+            return this;
+        }
+
+        /** What to use when path element is the empty string */
+        private File emptyPathDefault = null;
+
+        public Path emptyPathDefault(File x) {
+            emptyPathDefault = x;
+            return this;
+        }
+
+        public Path() { super(); }
+
+        public Path addDirectories(String dirs, boolean warn) {
+            boolean prev = expandJarClassPaths;
+            expandJarClassPaths = true;
+            try {
+                if (dirs != null)
+                    for (File dir : getPathEntries(dirs))
+                        addDirectory(dir, warn);
+                return this;
+            } finally {
+                expandJarClassPaths = prev;
+            }
+        }
+
+        public Path addDirectories(String dirs) {
+            return addDirectories(dirs, warn);
+        }
+
+        private void addDirectory(File dir, boolean warn) {
+            if (!dir.isDirectory()) {
+                if (warn)
+                    log.warning(Lint.LintCategory.PATH,
+                            "dir.path.element.not.found", dir);
+                return;
+            }
+
+            File[] files = dir.listFiles();
+            if (files == null)
+                return;
+
+            for (File direntry : files) {
+                if (isArchive(direntry))
+                    addFile(direntry, warn);
+            }
+        }
+
+        public Path addFiles(String files, boolean warn) {
+            if (files != null) {
+                addFiles(getPathEntries(files, emptyPathDefault), warn);
+            }
+            return this;
+        }
+
+        public Path addFiles(String files) {
+            return addFiles(files, warn);
+        }
+
+        public Path addFiles(Iterable<? extends File> files, boolean warn) {
+            if (files != null) {
+                for (File file: files)
+                    addFile(file, warn);
+            }
+            return this;
+        }
+
+        public Path addFiles(Iterable<? extends File> files) {
+            return addFiles(files, warn);
+        }
+
+        public void addFile(File file, boolean warn) {
+            if (contains(file)) {
+                // discard duplicates
+                return;
+            }
+
+            if (! fsInfo.exists(file)) {
+                /* No such file or directory exists */
+                if (warn) {
+                    log.warning(Lint.LintCategory.PATH,
+                            "path.element.not.found", file);
+                }
+                super.add(file);
+                return;
+            }
+
+            File canonFile = fsInfo.getCanonicalFile(file);
+            if (canonicalValues.contains(canonFile)) {
+                /* Discard duplicates and avoid infinite recursion */
+                return;
+            }
+
+            if (fsInfo.isFile(file)) {
+                /* File is an ordinary file. */
+                if (!isArchive(file)) {
+                    /* Not a recognized extension; open it to see if
+                     it looks like a valid zip file. */
+                    try {
+                        ZipFile z = new ZipFile(file);
+                        z.close();
+                        if (warn) {
+                            log.warning(Lint.LintCategory.PATH,
+                                    "unexpected.archive.file", file);
+                        }
+                    } catch (IOException e) {
+                        // FIXME: include e.getLocalizedMessage in warning
+                        if (warn) {
+                            log.warning(Lint.LintCategory.PATH,
+                                    "invalid.archive.file", file);
+                        }
+                        return;
+                    }
+                }
+            }
+
+            /* Now what we have left is either a directory or a file name
+               conforming to archive naming convention */
+            super.add(file);
+            canonicalValues.add(canonFile);
+
+            if (expandJarClassPaths && fsInfo.isFile(file))
+                addJarClassPath(file, warn);
+        }
+
+        // Adds referenced classpath elements from a jar's Class-Path
+        // Manifest entry.  In some future release, we may want to
+        // update this code to recognize URLs rather than simple
+        // filenames, but if we do, we should redo all path-related code.
+        private void addJarClassPath(File jarFile, boolean warn) {
+            try {
+                for (File f: fsInfo.getJarClassPath(jarFile)) {
+                    addFile(f, warn);
+                }
+            } catch (IOException e) {
+                log.error("error.reading.file", jarFile, JavacFileManager.getMessage(e));
+            }
+        }
+    }
+
+    /**
+     * Base class for handling support for the representation of Locations.
+     * Implementations are responsible for handling the interactions between
+     * the command line options for a location, and API access via setLocation.
+     * @see #initHandlers
+     * @see #getHandler
+     */
+    protected abstract class LocationHandler {
+        final Location location;
+        final Set<Option> options;
+
+        /**
+         * Create a handler. The location and options provide a way to map
+         * from a location or an option to the corresponding handler.
+         * @see #initHandlers
+         */
+        protected LocationHandler(Location location, Option... options) {
+            this.location = location;
+            this.options = options.length == 0 ?
+                EnumSet.noneOf(Option.class):
+                EnumSet.copyOf(Arrays.asList(options));
+        }
+
+        // TODO: TEMPORARY, while Options still used for command line options
+        void update(Options optionTable) {
+            for (Option o: options) {
+                String v = optionTable.get(o);
+                if (v != null) {
+                    handleOption(o, v);
+                }
+            }
+        }
+
+        /** @see JavaFileManager#handleOption. */
+        abstract boolean handleOption(Option option, String value);
+        /** @see JavaFileManager#getLocation. */
+        abstract Collection<File> getLocation();
+        /** @see JavaFileManager#setLocation. */
+        abstract void setLocation(Iterable<? extends File> files) throws IOException;
+    }
+
+    /**
+     * General purpose implementation for output locations,
+     * such as -d/CLASS_OUTPUT and -s/SOURCE_OUTPUT.
+     * All options are treated as equivalent (i.e. aliases.)
+     * The value is a single file, possibly null.
+     */
+    private class OutputLocationHandler extends LocationHandler {
+        private File outputDir;
+
+        OutputLocationHandler(Location location, Option... options) {
+            super(location, options);
+        }
+
+        @Override
+        boolean handleOption(Option option, String value) {
+            if (!options.contains(option))
+                return false;
+
+            // TODO: could/should validate outputDir exists and is a directory
+            // need to decide how best to report issue for benefit of
+            // direct API call on JavaFileManager.handleOption(specifies IAE)
+            // vs. command line decoding.
+            outputDir = new File(value);
+            return true;
+        }
+
+        @Override
+        Collection<File> getLocation() {
+            return (outputDir == null) ? null : Collections.singleton(outputDir);
+        }
+
+        @Override
+        void setLocation(Iterable<? extends File> files) throws IOException {
+            if (files == null) {
+                outputDir = null;
+            } else {
+                Iterator<? extends File> pathIter = files.iterator();
+                if (!pathIter.hasNext())
+                    throw new IllegalArgumentException("empty path for directory");
+                File dir = pathIter.next();
+                if (pathIter.hasNext())
+                    throw new IllegalArgumentException("path too long for directory");
+                if (!dir.exists())
+                    throw new FileNotFoundException(dir + ": does not exist");
+                else if (!dir.isDirectory())
+                    throw new IOException(dir + ": not a directory");
+                outputDir = dir;
+            }
+        }
+    }
+
+    /**
+     * General purpose implementation for search path locations,
+     * such as -sourcepath/SOURCE_PATH and -processorPath/ANNOTATION_PROCESS_PATH.
+     * All options are treated as equivalent (i.e. aliases.)
+     * The value is an ordered set of files and/or directories.
+     */
+    private class SimpleLocationHandler extends LocationHandler {
+        protected Collection<File> searchPath;
+
+        SimpleLocationHandler(Location location, Option... options) {
+            super(location, options);
+        }
+
+        @Override
+        boolean handleOption(Option option, String value) {
+            if (!options.contains(option))
+                return false;
+            searchPath = value == null ? null :
+                    Collections.unmodifiableCollection(computePath(value));
+            return true;
+        }
+
+        protected Path computePath(String value) {
+            return new Path().addFiles(value);
+        }
+
+        @Override
+        Collection<File> getLocation() {
+            return searchPath;
+        }
+
+        @Override
+        void setLocation(Iterable<? extends File> files) {
+            Path p;
+            if (files == null) {
+                p = computePath(null);
+            } else {
+                p = new Path().addFiles(files);
+            }
+            searchPath = Collections.unmodifiableCollection(p);
+        }
+    }
+
+    /**
+     * Subtype of SimpleLocationHandler for -classpath/CLASS_PATH.
+     * If no value is given, a default is provided, based on system properties
+     * and other values.
+     */
+    private class ClassPathLocationHandler extends SimpleLocationHandler {
+        ClassPathLocationHandler() {
+            super(StandardLocation.CLASS_PATH,
+                    Option.CLASSPATH, Option.CP);
+        }
+
+        @Override
+        Collection<File> getLocation() {
+            lazy();
+            return searchPath;
+        }
+
+        @Override
+        protected Path computePath(String value) {
+            String cp = value;
+
+            // CLASSPATH environment variable when run from `javac'.
+            if (cp == null) cp = System.getProperty("env.class.path");
+
+            // If invoked via a java VM (not the javac launcher), use the
+            // platform class path
+            if (cp == null && System.getProperty("application.home") == null)
+                cp = System.getProperty("java.class.path");
+
+            // Default to current working directory.
+            if (cp == null) cp = ".";
+
+            return new Path()
+                .expandJarClassPaths(true)        // Only search user jars for Class-Paths
+                .emptyPathDefault(new File("."))  // Empty path elt ==> current directory
+                .addFiles(cp);
+            }
+
+        private void lazy() {
+            if (searchPath == null)
+                setLocation(null);
+        }
+    }
+
+    /**
+     * Custom subtype of LocationHandler for PLATFORM_CLASS_PATH.
+     * Various options are supported for different components of the
+     * platform class path.
+     * Setting a value with setLocation overrides all existing option values.
+     * Setting any option overrides any value set with setLocation, and reverts
+     * to using default values for options that have not been set.
+     * Setting -bootclasspath or -Xbootclasspath overrides any existing
+     * value for -Xbootclasspath/p: and -Xbootclasspath/a:.
+     */
+    private class BootClassPathLocationHandler extends LocationHandler {
+        private Collection<File> searchPath;
+        final Map<Option, String> optionValues = new EnumMap<Option,String>(Option.class);
+
+        /**
+         * rt.jar as found on the default bootclasspath.
+         * If the user specified a bootclasspath, null is used.
+         */
+        private File defaultBootClassPathRtJar = null;
+
+        /**
+         *  Is bootclasspath the default?
+         */
+        private boolean isDefaultBootClassPath;
+
+        BootClassPathLocationHandler() {
+            super(StandardLocation.PLATFORM_CLASS_PATH,
+                    Option.BOOTCLASSPATH, Option.XBOOTCLASSPATH,
+                    Option.XBOOTCLASSPATH_PREPEND,
+                    Option.XBOOTCLASSPATH_APPEND,
+                    Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
+                    Option.EXTDIRS, Option.DJAVA_EXT_DIRS);
+        }
+
+        boolean isDefault() {
+            lazy();
+            return isDefaultBootClassPath;
+        }
+
+        boolean isDefaultRtJar(File file) {
+            lazy();
+            return file.equals(defaultBootClassPathRtJar);
+        }
+
+        @Override
+        boolean handleOption(Option option, String value) {
+            if (!options.contains(option))
+                return false;
+
+            option = canonicalize(option);
+            optionValues.put(option, value);
+            if (option == BOOTCLASSPATH) {
+                optionValues.remove(XBOOTCLASSPATH_PREPEND);
+                optionValues.remove(XBOOTCLASSPATH_APPEND);
+            }
+            searchPath = null;  // reset to "uninitialized"
+            return true;
+        }
+        // where
+            // TODO: would be better if option aliasing was handled at a higher
+            // level
+            private Option canonicalize(Option option) {
+                switch (option) {
+                    case XBOOTCLASSPATH:
+                        return Option.BOOTCLASSPATH;
+                    case DJAVA_ENDORSED_DIRS:
+                        return Option.ENDORSEDDIRS;
+                    case DJAVA_EXT_DIRS:
+                        return Option.EXTDIRS;
+                    default:
+                        return option;
+                }
+            }
+
+        @Override
+        Collection<File> getLocation() {
+            lazy();
+            return searchPath;
+        }
+
+        @Override
+        void setLocation(Iterable<? extends File> files) {
+            if (files == null) {
+                searchPath = null;  // reset to "uninitialized"
+            } else {
+                defaultBootClassPathRtJar = null;
+                isDefaultBootClassPath = false;
+                Path p = new Path().addFiles(files, false);
+                searchPath = Collections.unmodifiableCollection(p);
+                optionValues.clear();
+            }
+        }
+
+        Path computePath() {
+            defaultBootClassPathRtJar = null;
+            Path path = new Path();
+
+            String bootclasspathOpt = optionValues.get(BOOTCLASSPATH);
+            String endorseddirsOpt = optionValues.get(ENDORSEDDIRS);
+            String extdirsOpt = optionValues.get(EXTDIRS);
+            String xbootclasspathPrependOpt = optionValues.get(XBOOTCLASSPATH_PREPEND);
+            String xbootclasspathAppendOpt = optionValues.get(XBOOTCLASSPATH_APPEND);
+
+            path.addFiles(xbootclasspathPrependOpt);
+
+            if (endorseddirsOpt != null)
+                path.addDirectories(endorseddirsOpt);
+            else
+                path.addDirectories(System.getProperty("java.endorsed.dirs"), false);
+
+            if (bootclasspathOpt != null) {
+                path.addFiles(bootclasspathOpt);
+            } else {
+                // Standard system classes for this compiler's release.
+                String files = System.getProperty("sun.boot.class.path");
+                path.addFiles(files, false);
+                File rt_jar = new File("rt.jar");
+                for (File file : getPathEntries(files)) {
+                    if (new File(file.getName()).equals(rt_jar))
+                        defaultBootClassPathRtJar = file;
+                }
+            }
+
+            path.addFiles(xbootclasspathAppendOpt);
+
+            // Strictly speaking, standard extensions are not bootstrap
+            // classes, but we treat them identically, so we'll pretend
+            // that they are.
+            if (extdirsOpt != null)
+                path.addDirectories(extdirsOpt);
+            else
+                path.addDirectories(System.getProperty("java.ext.dirs"), false);
+
+            isDefaultBootClassPath =
+                    (xbootclasspathPrependOpt == null) &&
+                    (bootclasspathOpt == null) &&
+                    (xbootclasspathAppendOpt == null);
+
+            return path;
+        }
+
+        private void lazy() {
+            if (searchPath == null)
+                searchPath = Collections.unmodifiableCollection(computePath());
+        }
+    }
+
+    Map<Location, LocationHandler> handlersForLocation;
+    Map<Option, LocationHandler> handlersForOption;
+
+    void initHandlers() {
+        handlersForLocation = new HashMap<Location, LocationHandler>();
+        handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);
+
+        LocationHandler[] handlers = {
+            new BootClassPathLocationHandler(),
+            new ClassPathLocationHandler(),
+            new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
+            new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
+            new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
+            new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
+            new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
+        };
+
+        for (LocationHandler h: handlers) {
+            handlersForLocation.put(h.location, h);
+            for (Option o: h.options)
+                handlersForOption.put(o, h);
+        }
+    }
+
+    boolean handleOption(Option option, String value) {
+        LocationHandler h = handlersForOption.get(option);
+        return (h == null ? false : h.handleOption(option, value));
+    }
+
+    Collection<File> getLocation(Location location) {
+        LocationHandler h = getHandler(location);
+        return (h == null ? null : h.getLocation());
+    }
+
+    File getOutputLocation(Location location) {
+        if (!location.isOutputLocation())
+            throw new IllegalArgumentException();
+        LocationHandler h = getHandler(location);
+        return ((OutputLocationHandler) h).outputDir;
+    }
+
+    void setLocation(Location location, Iterable<? extends File> files) throws IOException {
+        LocationHandler h = getHandler(location);
+        if (h == null) {
+            if (location.isOutputLocation())
+                h = new OutputLocationHandler(location);
+            else
+                h = new SimpleLocationHandler(location);
+            handlersForLocation.put(location, h);
+        }
+        h.setLocation(files);
+    }
+
+    protected LocationHandler getHandler(Location location) {
+        location.getClass(); // null check
+        lazy();
+        return handlersForLocation.get(location);
+    }
+
+// TOGO
+    protected void lazy() {
+        if (!inited) {
+            warn = lint.isEnabled(Lint.LintCategory.PATH);
+
+            for (LocationHandler h: handlersForLocation.values()) {
+                h.update(options);
+            }
+
+            inited = true;
+        }
+    }
+
+    /** Is this the name of an archive file? */
+    private boolean isArchive(File file) {
+        String n = file.getName().toLowerCase();
+        return fsInfo.isFile(file)
+            && (n.endsWith(".jar") || n.endsWith(".zip"));
+    }
+
+    /**
+     * Utility method for converting a search path string to an array
+     * of directory and JAR file URLs.
+     *
+     * Note that this method is called by apt and the DocletInvoker.
+     *
+     * @param path the search path string
+     * @return the resulting array of directory and JAR file URLs
+     */
+    public static URL[] pathToURLs(String path) {
+        StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
+        URL[] urls = new URL[st.countTokens()];
+        int count = 0;
+        while (st.hasMoreTokens()) {
+            URL url = fileToURL(new File(st.nextToken()));
+            if (url != null) {
+                urls[count++] = url;
+            }
+        }
+        if (urls.length != count) {
+            URL[] tmp = new URL[count];
+            System.arraycopy(urls, 0, tmp, 0, count);
+            urls = tmp;
+        }
+        return urls;
+    }
+
+    /**
+     * Returns the directory or JAR file URL corresponding to the specified
+     * local file name.
+     *
+     * @param file the File object
+     * @return the resulting directory or JAR file URL, or null if unknown
+     */
+    private static URL fileToURL(File file) {
+        String name;
+        try {
+            name = file.getCanonicalPath();
+        } catch (IOException e) {
+            name = file.getAbsolutePath();
+        }
+        name = name.replace(File.separatorChar, '/');
+        if (!name.startsWith("/")) {
+            name = "/" + name;
+        }
+        // If the file does not exist, then assume that it's a directory
+        if (!file.isFile()) {
+            name = name + "/";
+        }
+        try {
+            return new URL("file", "", name);
+        } catch (MalformedURLException e) {
+            throw new IllegalArgumentException(file.toString());
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/file/Paths.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,558 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.file;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.StringTokenizer;
-import java.util.zip.ZipFile;
-import javax.tools.JavaFileManager.Location;
-
-import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Options;
-
-import static javax.tools.StandardLocation.*;
-import static com.sun.tools.javac.main.OptionName.*;
-
-/** This class converts command line arguments, environment variables
- *  and system properties (in File.pathSeparator-separated String form)
- *  into a boot class path, user class path, and source path (in
- *  Collection<String> form).
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class Paths {
-
-    /** The context key for the todo list */
-    protected static final Context.Key<Paths> pathsKey =
-        new Context.Key<Paths>();
-
-    /** Get the Paths instance for this context.
-     *  @param context the context
-     *  @return the Paths instance for this context
-     */
-    public static Paths instance(Context context) {
-        Paths instance = context.get(pathsKey);
-        if (instance == null)
-            instance = new Paths(context);
-        return instance;
-    }
-
-    /** The log to use for warning output */
-    private Log log;
-
-    /** Collection of command-line options */
-    private Options options;
-
-    /** Handler for -Xlint options */
-    private Lint lint;
-
-    /** Access to (possibly cached) file info */
-    private FSInfo fsInfo;
-
-    protected Paths(Context context) {
-        context.put(pathsKey, this);
-        pathsForLocation = new HashMap<Location,Path>(16);
-        setContext(context);
-    }
-
-    void setContext(Context context) {
-        log = Log.instance(context);
-        options = Options.instance(context);
-        lint = Lint.instance(context);
-        fsInfo = FSInfo.instance(context);
-    }
-
-    /** Whether to warn about non-existent path elements */
-    private boolean warn;
-
-    private Map<Location, Path> pathsForLocation;
-
-    private boolean inited = false; // TODO? caching bad?
-
-    /**
-     * rt.jar as found on the default bootclass path.  If the user specified a
-     * bootclasspath, null is used.
-     */
-    private File defaultBootClassPathRtJar = null;
-
-    /**
-     *  Is bootclasspath the default?
-     */
-    private boolean isDefaultBootClassPath;
-
-    Path getPathForLocation(Location location) {
-        Path path = pathsForLocation.get(location);
-        if (path == null)
-            setPathForLocation(location, null);
-        return pathsForLocation.get(location);
-    }
-
-    void setPathForLocation(Location location, Iterable<? extends File> path) {
-        // TODO? if (inited) throw new IllegalStateException
-        // TODO: otherwise reset sourceSearchPath, classSearchPath as needed
-        Path p;
-        if (path == null) {
-            if (location == CLASS_PATH)
-                p = computeUserClassPath();
-            else if (location == PLATFORM_CLASS_PATH)
-                p = computeBootClassPath(); // sets isDefaultBootClassPath
-            else if (location == ANNOTATION_PROCESSOR_PATH)
-                p = computeAnnotationProcessorPath();
-            else if (location == SOURCE_PATH)
-                p = computeSourcePath();
-            else
-                // no defaults for other paths
-                p = null;
-        } else {
-            if (location == PLATFORM_CLASS_PATH) {
-                defaultBootClassPathRtJar = null;
-                isDefaultBootClassPath = false;
-            }
-            p = new Path();
-            for (File f: path)
-                p.addFile(f, warn); // TODO: is use of warn appropriate?
-        }
-        pathsForLocation.put(location, p);
-    }
-
-    public boolean isDefaultBootClassPath() {
-        lazy();
-        return isDefaultBootClassPath;
-    }
-
-    protected void lazy() {
-        if (!inited) {
-            warn = lint.isEnabled(Lint.LintCategory.PATH);
-
-            pathsForLocation.put(PLATFORM_CLASS_PATH, computeBootClassPath());
-            pathsForLocation.put(CLASS_PATH, computeUserClassPath());
-            pathsForLocation.put(SOURCE_PATH, computeSourcePath());
-
-            inited = true;
-        }
-    }
-
-    public Collection<File> bootClassPath() {
-        lazy();
-        return Collections.unmodifiableCollection(getPathForLocation(PLATFORM_CLASS_PATH));
-    }
-    public Collection<File> userClassPath() {
-        lazy();
-        return Collections.unmodifiableCollection(getPathForLocation(CLASS_PATH));
-    }
-    public Collection<File> sourcePath() {
-        lazy();
-        Path p = getPathForLocation(SOURCE_PATH);
-        return p == null || p.size() == 0
-            ? null
-            : Collections.unmodifiableCollection(p);
-    }
-
-    boolean isDefaultBootClassPathRtJar(File file) {
-        return file.equals(defaultBootClassPathRtJar);
-    }
-
-    /**
-     * Split a path into its elements. Empty path elements will be ignored.
-     * @param path The path to be split
-     * @return The elements of the path
-     */
-    private static Iterable<File> getPathEntries(String path) {
-        return getPathEntries(path, null);
-    }
-
-    /**
-     * Split a path into its elements. If emptyPathDefault is not null, all
-     * empty elements in the path, including empty elements at either end of
-     * the path, will be replaced with the value of emptyPathDefault.
-     * @param path The path to be split
-     * @param emptyPathDefault The value to substitute for empty path elements,
-     *  or null, to ignore empty path elements
-     * @return The elements of the path
-     */
-    private static Iterable<File> getPathEntries(String path, File emptyPathDefault) {
-        ListBuffer<File> entries = new ListBuffer<File>();
-        int start = 0;
-        while (start <= path.length()) {
-            int sep = path.indexOf(File.pathSeparatorChar, start);
-            if (sep == -1)
-                sep = path.length();
-            if (start < sep)
-                entries.add(new File(path.substring(start, sep)));
-            else if (emptyPathDefault != null)
-                entries.add(emptyPathDefault);
-            start = sep + 1;
-        }
-        return entries;
-    }
-
-    private class Path extends LinkedHashSet<File> {
-        private static final long serialVersionUID = 0;
-
-        private boolean expandJarClassPaths = false;
-        private Set<File> canonicalValues = new HashSet<File>();
-
-        public Path expandJarClassPaths(boolean x) {
-            expandJarClassPaths = x;
-            return this;
-        }
-
-        /** What to use when path element is the empty string */
-        private File emptyPathDefault = null;
-
-        public Path emptyPathDefault(File x) {
-            emptyPathDefault = x;
-            return this;
-        }
-
-        public Path() { super(); }
-
-        public Path addDirectories(String dirs, boolean warn) {
-            boolean prev = expandJarClassPaths;
-            expandJarClassPaths = true;
-            try {
-                if (dirs != null)
-                    for (File dir : getPathEntries(dirs))
-                        addDirectory(dir, warn);
-                return this;
-            } finally {
-                expandJarClassPaths = prev;
-            }
-        }
-
-        public Path addDirectories(String dirs) {
-            return addDirectories(dirs, warn);
-        }
-
-        private void addDirectory(File dir, boolean warn) {
-            if (!dir.isDirectory()) {
-                if (warn)
-                    log.warning(Lint.LintCategory.PATH,
-                            "dir.path.element.not.found", dir);
-                return;
-            }
-
-            File[] files = dir.listFiles();
-            if (files == null)
-                return;
-
-            for (File direntry : files) {
-                if (isArchive(direntry))
-                    addFile(direntry, warn);
-            }
-        }
-
-        public Path addFiles(String files, boolean warn) {
-            if (files != null) {
-                for (File file : getPathEntries(files, emptyPathDefault))
-                    addFile(file, warn);
-            }
-            return this;
-        }
-
-        public Path addFiles(String files) {
-            return addFiles(files, warn);
-        }
-
-        public void addFile(File file, boolean warn) {
-            if (contains(file)) {
-                // discard duplicates
-                return;
-            }
-
-            if (! fsInfo.exists(file)) {
-                /* No such file or directory exists */
-                if (warn) {
-                    log.warning(Lint.LintCategory.PATH,
-                            "path.element.not.found", file);
-                }
-                super.add(file);
-                return;
-            }
-
-            File canonFile = fsInfo.getCanonicalFile(file);
-            if (canonicalValues.contains(canonFile)) {
-                /* Discard duplicates and avoid infinite recursion */
-                return;
-            }
-
-            if (fsInfo.isFile(file)) {
-                /* File is an ordinary file. */
-                if (!isArchive(file)) {
-                    /* Not a recognized extension; open it to see if
-                     it looks like a valid zip file. */
-                    try {
-                        ZipFile z = new ZipFile(file);
-                        z.close();
-                        if (warn) {
-                            log.warning(Lint.LintCategory.PATH,
-                                    "unexpected.archive.file", file);
-                        }
-                    } catch (IOException e) {
-                        // FIXME: include e.getLocalizedMessage in warning
-                        if (warn) {
-                            log.warning(Lint.LintCategory.PATH,
-                                    "invalid.archive.file", file);
-                        }
-                        return;
-                    }
-                }
-            }
-
-            /* Now what we have left is either a directory or a file name
-               conforming to archive naming convention */
-            super.add(file);
-            canonicalValues.add(canonFile);
-
-            if (expandJarClassPaths && fsInfo.isFile(file))
-                addJarClassPath(file, warn);
-        }
-
-        // Adds referenced classpath elements from a jar's Class-Path
-        // Manifest entry.  In some future release, we may want to
-        // update this code to recognize URLs rather than simple
-        // filenames, but if we do, we should redo all path-related code.
-        private void addJarClassPath(File jarFile, boolean warn) {
-            try {
-                for (File f: fsInfo.getJarClassPath(jarFile)) {
-                    addFile(f, warn);
-                }
-            } catch (IOException e) {
-                log.error("error.reading.file", jarFile, JavacFileManager.getMessage(e));
-            }
-        }
-    }
-
-    private Path computeBootClassPath() {
-        defaultBootClassPathRtJar = null;
-        Path path = new Path();
-
-        String bootclasspathOpt = options.get(BOOTCLASSPATH);
-        String endorseddirsOpt = options.get(ENDORSEDDIRS);
-        String extdirsOpt = options.get(EXTDIRS);
-        String xbootclasspathPrependOpt = options.get(XBOOTCLASSPATH_PREPEND);
-        String xbootclasspathAppendOpt = options.get(XBOOTCLASSPATH_APPEND);
-
-        path.addFiles(xbootclasspathPrependOpt);
-
-        if (endorseddirsOpt != null)
-            path.addDirectories(endorseddirsOpt);
-        else
-            path.addDirectories(System.getProperty("java.endorsed.dirs"), false);
-
-        if (bootclasspathOpt != null) {
-            path.addFiles(bootclasspathOpt);
-        } else {
-            // Standard system classes for this compiler's release.
-            String files = System.getProperty("sun.boot.class.path");
-            path.addFiles(files, false);
-            File rt_jar = new File("rt.jar");
-            for (File file : getPathEntries(files)) {
-                if (new File(file.getName()).equals(rt_jar))
-                    defaultBootClassPathRtJar = file;
-            }
-        }
-
-        path.addFiles(xbootclasspathAppendOpt);
-
-        // Strictly speaking, standard extensions are not bootstrap
-        // classes, but we treat them identically, so we'll pretend
-        // that they are.
-        if (extdirsOpt != null)
-            path.addDirectories(extdirsOpt);
-        else
-            path.addDirectories(System.getProperty("java.ext.dirs"), false);
-
-        isDefaultBootClassPath =
-                (xbootclasspathPrependOpt == null) &&
-                (bootclasspathOpt == null) &&
-                (xbootclasspathAppendOpt == null);
-
-        return path;
-    }
-
-    private Path computeUserClassPath() {
-        String cp = options.get(CLASSPATH);
-
-        // CLASSPATH environment variable when run from `javac'.
-        if (cp == null) cp = System.getProperty("env.class.path");
-
-        // If invoked via a java VM (not the javac launcher), use the
-        // platform class path
-        if (cp == null && System.getProperty("application.home") == null)
-            cp = System.getProperty("java.class.path");
-
-        // Default to current working directory.
-        if (cp == null) cp = ".";
-
-        return new Path()
-            .expandJarClassPaths(true)        // Only search user jars for Class-Paths
-            .emptyPathDefault(new File("."))  // Empty path elt ==> current directory
-            .addFiles(cp);
-    }
-
-    private Path computeSourcePath() {
-        String sourcePathArg = options.get(SOURCEPATH);
-        if (sourcePathArg == null)
-            return null;
-
-        return new Path().addFiles(sourcePathArg);
-    }
-
-    private Path computeAnnotationProcessorPath() {
-        String processorPathArg = options.get(PROCESSORPATH);
-        if (processorPathArg == null)
-            return null;
-
-        return new Path().addFiles(processorPathArg);
-    }
-
-    /** The actual effective locations searched for sources */
-    private Path sourceSearchPath;
-
-    public Collection<File> sourceSearchPath() {
-        if (sourceSearchPath == null) {
-            lazy();
-            Path sourcePath = getPathForLocation(SOURCE_PATH);
-            Path userClassPath = getPathForLocation(CLASS_PATH);
-            sourceSearchPath = sourcePath != null ? sourcePath : userClassPath;
-        }
-        return Collections.unmodifiableCollection(sourceSearchPath);
-    }
-
-    /** The actual effective locations searched for classes */
-    private Path classSearchPath;
-
-    public Collection<File> classSearchPath() {
-        if (classSearchPath == null) {
-            lazy();
-            Path bootClassPath = getPathForLocation(PLATFORM_CLASS_PATH);
-            Path userClassPath = getPathForLocation(CLASS_PATH);
-            classSearchPath = new Path();
-            classSearchPath.addAll(bootClassPath);
-            classSearchPath.addAll(userClassPath);
-        }
-        return Collections.unmodifiableCollection(classSearchPath);
-    }
-
-    /** The actual effective locations for non-source, non-class files */
-    private Path otherSearchPath;
-
-    Collection<File> otherSearchPath() {
-        if (otherSearchPath == null) {
-            lazy();
-            Path userClassPath = getPathForLocation(CLASS_PATH);
-            Path sourcePath = getPathForLocation(SOURCE_PATH);
-            if (sourcePath == null)
-                otherSearchPath = userClassPath;
-            else {
-                otherSearchPath = new Path();
-                otherSearchPath.addAll(userClassPath);
-                otherSearchPath.addAll(sourcePath);
-            }
-        }
-        return Collections.unmodifiableCollection(otherSearchPath);
-    }
-
-    /** Is this the name of an archive file? */
-    private boolean isArchive(File file) {
-        String n = file.getName().toLowerCase();
-        return fsInfo.isFile(file)
-            && (n.endsWith(".jar") || n.endsWith(".zip"));
-    }
-
-    /**
-     * Utility method for converting a search path string to an array
-     * of directory and JAR file URLs.
-     *
-     * Note that this method is called by apt and the DocletInvoker.
-     *
-     * @param path the search path string
-     * @return the resulting array of directory and JAR file URLs
-     */
-    public static URL[] pathToURLs(String path) {
-        StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
-        URL[] urls = new URL[st.countTokens()];
-        int count = 0;
-        while (st.hasMoreTokens()) {
-            URL url = fileToURL(new File(st.nextToken()));
-            if (url != null) {
-                urls[count++] = url;
-            }
-        }
-        if (urls.length != count) {
-            URL[] tmp = new URL[count];
-            System.arraycopy(urls, 0, tmp, 0, count);
-            urls = tmp;
-        }
-        return urls;
-    }
-
-    /**
-     * Returns the directory or JAR file URL corresponding to the specified
-     * local file name.
-     *
-     * @param file the File object
-     * @return the resulting directory or JAR file URL, or null if unknown
-     */
-    private static URL fileToURL(File file) {
-        String name;
-        try {
-            name = file.getCanonicalPath();
-        } catch (IOException e) {
-            name = file.getAbsolutePath();
-        }
-        name = name.replace(File.separatorChar, '/');
-        if (!name.startsWith("/")) {
-            name = "/" + name;
-        }
-        // If the file does not exist, then assume that it's a directory
-        if (!file.isFile()) {
-            name = name + "/";
-        }
-        try {
-            return new URL("file", "", name);
-        } catch (MalformedURLException e) {
-            throw new IllegalArgumentException(file.toString());
-        }
-    }
-}
--- a/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
 
     @Override
     public OutputStream openOutputStream() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new FileOutputStream(file);
     }
@@ -128,6 +129,7 @@
 
     @Override
     public Writer openWriter() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new OutputStreamWriter(new FileOutputStream(file), fileManager.getEncodingName());
     }
--- a/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Tue May 29 00:27:58 2012 +0100
@@ -31,6 +31,7 @@
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.parser.EndPosTable;
 
 /** This class contains the CharacterRangeTable for some method
  *  and the hashtable for mapping trees or lists of trees to their
@@ -54,9 +55,9 @@
      */
     private Map<Object,SourceRange> positions = new HashMap<Object,SourceRange>();
 
-    /** The hashtable for ending positions stored in the parser.
+    /** The object for ending positions stored in the parser.
      */
-    private Map<JCTree, Integer> endPositions;
+    private EndPosTable endPosTable;
 
     /** The tree of the method this table is intended for.
      *  We should traverse this tree to get source ranges.
@@ -65,9 +66,9 @@
 
     /** Constructor
      */
-    public CRTable(JCTree.JCMethodDecl tree, Map<JCTree, Integer> endPositions) {
+    public CRTable(JCTree.JCMethodDecl tree, EndPosTable endPosTable) {
         this.methodTree = tree;
-        this.endPositions = endPositions;
+        this.endPosTable = endPosTable;
     }
 
     /** Create a new CRTEntry and add it to the entries.
@@ -532,12 +533,9 @@
          */
         public int endPos(JCTree tree) {
             if (tree == null) return Position.NOPOS;
-            if (tree.getTag() == JCTree.BLOCK)
+            if (tree.hasTag(JCTree.Tag.BLOCK))
                 return ((JCBlock) tree).endpos;
-            Integer endpos = endPositions.get(tree);
-            if (endpos != null)
-                return endpos.intValue();
-            return Position.NOPOS;
+            return endPosTable.getEndPos(tree);
         }
     }
 
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
 import static com.sun.tools.javac.jvm.ClassFile.*;
 import static com.sun.tools.javac.jvm.ClassFile.Version.*;
 
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 
 /** This class provides operations to read a classfile into an internal
  *  representation. The internal representation is anchored in a
@@ -1320,10 +1320,6 @@
                     sym.flags_field |= PROPRIETARY;
                 else
                     proxies.append(proxy);
-                if (majorVersion >= V51.major &&
-                    proxy.type.tsym == syms.polymorphicSignatureType.tsym) {
-                    sym.flags_field |= POLYMORPHIC_SIGNATURE;
-                }
             }
             annotate.later(new AnnotationCompleter(sym, proxies.toList()));
         }
@@ -2539,7 +2535,7 @@
      *  @param arg An argument for substitution into the output string.
      */
     private void printCCF(String key, Object arg) {
-        log.printNoteLines(key, arg);
+        log.printLines(key, arg);
     }
 
 
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTags.*;
 import static com.sun.tools.javac.jvm.UninitializedType.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 import static javax.tools.StandardLocation.CLASS_OUTPUT;
 
 
@@ -69,11 +69,11 @@
      */
     private boolean verbose;
 
-    /** Switch: scrable private names.
+    /** Switch: scramble private names.
      */
     private boolean scramble;
 
-    /** Switch: scrable private names.
+    /** Switch: scramble private names.
      */
     private boolean scrambleAll;
 
@@ -863,10 +863,10 @@
         }
         if (c.type.tag != CLASS) return; // arrays
         if (pool != null && // pool might be null if called from xClassName
-            c.owner.kind != PCK &&
+            c.owner.enclClass() != null &&
             (innerClasses == null || !innerClasses.contains(c))) {
 //          log.errWriter.println("enter inner " + c);//DEBUG
-            if (c.owner.kind == TYP) enterInner((ClassSymbol)c.owner);
+            enterInner(c.owner.enclClass());
             pool.put(c);
             pool.put(c.name);
             if (innerClasses == null) {
@@ -892,8 +892,9 @@
             if ((flags & INTERFACE) != 0) flags |= ABSTRACT; // Interfaces are always ABSTRACT
             if (inner.name.isEmpty()) flags &= ~FINAL; // Anonymous class: unset FINAL flag
             if (dumpInnerClassModifiers) {
-                log.errWriter.println("INNERCLASS  " + inner.name);
-                log.errWriter.println("---" + flagNames(flags));
+                PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
+                pw.println("INNERCLASS  " + inner.name);
+                pw.println("---" + flagNames(flags));
             }
             databuf.appendChar(pool.get(inner));
             databuf.appendChar(
@@ -911,8 +912,9 @@
         int flags = adjustFlags(v.flags());
         databuf.appendChar(flags);
         if (dumpFieldModifiers) {
-            log.errWriter.println("FIELD  " + fieldName(v));
-            log.errWriter.println("---" + flagNames(v.flags()));
+            PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
+            pw.println("FIELD  " + fieldName(v));
+            pw.println("---" + flagNames(v.flags()));
         }
         databuf.appendChar(pool.put(fieldName(v)));
         databuf.appendChar(pool.put(typeSig(v.erasure(types))));
@@ -934,8 +936,9 @@
         int flags = adjustFlags(m.flags());
         databuf.appendChar(flags);
         if (dumpMethodModifiers) {
-            log.errWriter.println("METHOD  " + fieldName(m));
-            log.errWriter.println("---" + flagNames(m.flags()));
+            PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
+            pw.println("METHOD  " + fieldName(m));
+            pw.println("---" + flagNames(m.flags()));
         }
         databuf.appendChar(pool.put(fieldName(m)));
         databuf.appendChar(pool.put(typeSig(m.externalType(types))));
@@ -1483,9 +1486,10 @@
         if ((flags & INTERFACE) == 0) flags |= ACC_SUPER;
         if (c.isInner() && c.name.isEmpty()) flags &= ~FINAL;
         if (dumpClassModifiers) {
-            log.errWriter.println();
-            log.errWriter.println("CLASSFILE  " + c.getQualifiedName());
-            log.errWriter.println("---" + flagNames(flags));
+            PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
+            pw.println();
+            pw.println("CLASSFILE  " + c.getQualifiedName());
+            pw.println("---" + flagNames(flags));
         }
         databuf.appendChar(flags);
 
@@ -1505,6 +1509,13 @@
             default : Assert.error();
             }
         }
+
+        if (c.trans_local != null) {
+            for (ClassSymbol local : c.trans_local) {
+                enterInner(local);
+            }
+        }
+
         databuf.appendChar(fieldsCount);
         writeFields(c.members().elems);
         databuf.appendChar(methodsCount);
--- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Tue May 29 00:27:58 2012 +0100
@@ -1542,7 +1542,28 @@
      */
     public void addCatch(
         char startPc, char endPc, char handlerPc, char catchType) {
-        catchInfo.append(new char[]{startPc, endPc, handlerPc, catchType});
+            catchInfo.append(new char[]{startPc, endPc, handlerPc, catchType});
+        }
+
+
+    public void compressCatchTable() {
+        ListBuffer<char[]> compressedCatchInfo = ListBuffer.lb();
+        List<Integer> handlerPcs = List.nil();
+        for (char[] catchEntry : catchInfo.elems) {
+            handlerPcs = handlerPcs.prepend((int)catchEntry[2]);
+        }
+        for (char[] catchEntry : catchInfo.elems) {
+            int startpc = catchEntry[0];
+            int endpc = catchEntry[1];
+            if (startpc == endpc ||
+                    (startpc == (endpc - 1) &&
+                    handlerPcs.contains(startpc))) {
+                continue;
+            } else {
+                compressedCatchInfo.append(catchEntry);
+            }
+        }
+        catchInfo = compressedCatchInfo;
     }
 
 
--- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue May 29 00:27:58 2012 +0100
@@ -26,8 +26,6 @@
 package com.sun.tools.javac.jvm;
 import java.util.*;
 
-import javax.lang.model.element.ElementKind;
-
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
@@ -39,6 +37,7 @@
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.jvm.Code.*;
 import com.sun.tools.javac.jvm.Items.*;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -46,7 +45,9 @@
 import static com.sun.tools.javac.code.TypeTags.*;
 import static com.sun.tools.javac.jvm.ByteCodes.*;
 import static com.sun.tools.javac.jvm.CRTFlags.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.BLOCK;
 
 /** This pass maps flat Java (i.e. without inner classes) to bytecodes.
  *
@@ -195,9 +196,10 @@
      */
     private int nerrs = 0;
 
-    /** A hash table mapping syntax trees to their ending source positions.
+    /** An object containing mappings of syntax trees to their
+     *  ending source positions.
      */
-    private Map<JCTree, Integer> endPositions;
+    EndPosTable endPosTable;
 
     /** Generate code to load an integer constant.
      *  @param n     The integer to be loaded.
@@ -433,7 +435,7 @@
      */
     boolean hasFinally(JCTree target, Env<GenContext> env) {
         while (env.tree != target) {
-            if (env.tree.getTag() == JCTree.TRY && env.info.finalize.hasFinalizer())
+            if (env.tree.hasTag(TRY) && env.info.finalize.hasFinalizer())
                 return true;
             env = env.next;
         }
@@ -460,17 +462,17 @@
         for (List<JCTree> l = defs; l.nonEmpty(); l = l.tail) {
             JCTree def = l.head;
             switch (def.getTag()) {
-            case JCTree.BLOCK:
+            case BLOCK:
                 JCBlock block = (JCBlock)def;
                 if ((block.flags & STATIC) != 0)
                     clinitCode.append(block);
                 else
                     initCode.append(block);
                 break;
-            case JCTree.METHODDEF:
+            case METHODDEF:
                 methodDefs.append(def);
                 break;
-            case JCTree.VARDEF:
+            case VARDEF:
                 JCVariableDecl vdef = (JCVariableDecl) def;
                 VarSymbol sym = vdef.sym;
                 checkDimension(vdef.pos(), sym.type);
@@ -480,20 +482,14 @@
                         JCStatement init = make.at(vdef.pos()).
                             Assignment(sym, vdef.init);
                         initCode.append(init);
-                        if (endPositions != null) {
-                            Integer endPos = endPositions.remove(vdef);
-                            if (endPos != null) endPositions.put(init, endPos);
-                        }
+                        endPosTable.replaceTree(vdef, init);
                     } else if (sym.getConstValue() == null) {
                         // Initialize class (static) variables only if
                         // they are not compile-time constants.
                         JCStatement init = make.at(vdef.pos).
                             Assignment(sym, vdef.init);
                         clinitCode.append(init);
-                        if (endPositions != null) {
-                            Integer endPos = endPositions.remove(vdef);
-                            if (endPos != null) endPositions.put(init, endPos);
-                        }
+                        endPosTable.replaceTree(vdef, init);
                     } else {
                         checkStringConstant(vdef.init.pos(), sym.getConstValue());
                     }
@@ -707,7 +703,7 @@
         }
         int startpc = code.curPc();
         genStat(tree, env);
-        if (tree.getTag() == JCTree.BLOCK) crtFlags |= CRT_BLOCK;
+        if (tree.hasTag(BLOCK)) crtFlags |= CRT_BLOCK;
         code.crt.put(tree, crtFlags, startpc, code.curPc());
     }
 
@@ -717,7 +713,7 @@
         if (code.isAlive()) {
             code.statBegin(tree.pos);
             genDef(tree, env);
-        } else if (env.info.isSwitch && tree.getTag() == JCTree.VARDEF) {
+        } else if (env.info.isSwitch && tree.hasTag(VARDEF)) {
             // variables whose declarations are in a switch
             // can be used even if the decl is unreachable.
             code.newLocal(((JCVariableDecl) tree).sym);
@@ -784,7 +780,7 @@
      */
     public CondItem genCond(JCTree _tree, boolean markBranches) {
         JCTree inner_tree = TreeInfo.skipParens(_tree);
-        if (inner_tree.getTag() == JCTree.CONDEXPR) {
+        if (inner_tree.hasTag(CONDEXPR)) {
             JCConditional tree = (JCConditional)inner_tree;
             CondItem cond = genCond(tree.cond, CRT_FLOW_CONTROLLER);
             if (cond.isTrue()) {
@@ -959,6 +955,9 @@
                     code.lastFrame = null;
                     code.frameBeforeLast = null;
                 }
+
+                //compress exception table
+                code.compressCatchTable();
             }
         }
 
@@ -1030,7 +1029,7 @@
         Env<GenContext> localEnv = env.dup(tree, new GenContext());
         genStats(tree.stats, localEnv);
         // End the scope of all block-local variables in variable info.
-        if (env.tree.getTag() != JCTree.METHODDEF) {
+        if (!env.tree.hasTag(METHODDEF)) {
             code.statBegin(tree.endpos);
             code.endScopes(limit);
             code.pendingStatPos = Position.NOPOS;
@@ -1437,7 +1436,6 @@
                     code.markDead();
                 }
             }
-
             // Resolve all breaks.
             code.resolve(exitChain);
 
@@ -1496,23 +1494,21 @@
         void registerCatch(DiagnosticPosition pos,
                            int startpc, int endpc,
                            int handler_pc, int catch_type) {
-            if (startpc != endpc) {
-                char startpc1 = (char)startpc;
-                char endpc1 = (char)endpc;
-                char handler_pc1 = (char)handler_pc;
-                if (startpc1 == startpc &&
-                    endpc1 == endpc &&
-                    handler_pc1 == handler_pc) {
-                    code.addCatch(startpc1, endpc1, handler_pc1,
-                                  (char)catch_type);
+            char startpc1 = (char)startpc;
+            char endpc1 = (char)endpc;
+            char handler_pc1 = (char)handler_pc;
+            if (startpc1 == startpc &&
+                endpc1 == endpc &&
+                handler_pc1 == handler_pc) {
+                code.addCatch(startpc1, endpc1, handler_pc1,
+                              (char)catch_type);
+            } else {
+                if (!useJsrLocally && !target.generateStackMapTable()) {
+                    useJsrLocally = true;
+                    throw new CodeSizeOverflow();
                 } else {
-                    if (!useJsrLocally && !target.generateStackMapTable()) {
-                        useJsrLocally = true;
-                        throw new CodeSizeOverflow();
-                    } else {
-                        log.error(pos, "limit.code.too.large.for.try.stmt");
-                        nerrs++;
-                    }
+                    log.error(pos, "limit.code.too.large.for.try.stmt");
+                    nerrs++;
                 }
             }
         }
@@ -1628,11 +1624,11 @@
         // Optimize x++ to ++x and x-- to --x.
         JCExpression e = tree.expr;
         switch (e.getTag()) {
-            case JCTree.POSTINC:
-                ((JCUnary) e).setTag(JCTree.PREINC);
+            case POSTINC:
+                ((JCUnary) e).setTag(PREINC);
                 break;
-            case JCTree.POSTDEC:
-                ((JCUnary) e).setTag(JCTree.PREDEC);
+            case POSTDEC:
+                ((JCUnary) e).setTag(PREDEC);
                 break;
         }
         genExpr(tree.expr, tree.expr.type).drop();
@@ -1689,6 +1685,8 @@
         // outer instance of a super(...) call appears as first parameter).
         genArgs(tree.args,
                 TreeInfo.symbol(tree.meth).externalType(types).getParameterTypes());
+        code.statBegin(tree.pos);
+        code.markStatBegin();
         result = m.invoke();
     }
 
@@ -1817,13 +1815,13 @@
             // If we have an increment of -32768 to +32767 of a local
             // int variable we can use an incr instruction instead of
             // proceeding further.
-            if ((tree.getTag() == JCTree.PLUS_ASG || tree.getTag() == JCTree.MINUS_ASG) &&
+            if ((tree.hasTag(PLUS_ASG) || tree.hasTag(MINUS_ASG)) &&
                 l instanceof LocalItem &&
                 tree.lhs.type.tag <= INT &&
                 tree.rhs.type.tag <= INT &&
                 tree.rhs.type.constValue() != null) {
                 int ival = ((Number) tree.rhs.type.constValue()).intValue();
-                if (tree.getTag() == JCTree.MINUS_ASG) ival = -ival;
+                if (tree.hasTag(MINUS_ASG)) ival = -ival;
                 ((LocalItem)l).incr(ival);
                 result = l;
                 return;
@@ -1839,29 +1837,29 @@
 
     public void visitUnary(JCUnary tree) {
         OperatorSymbol operator = (OperatorSymbol)tree.operator;
-        if (tree.getTag() == JCTree.NOT) {
+        if (tree.hasTag(NOT)) {
             CondItem od = genCond(tree.arg, false);
             result = od.negate();
         } else {
             Item od = genExpr(tree.arg, operator.type.getParameterTypes().head);
             switch (tree.getTag()) {
-            case JCTree.POS:
+            case POS:
                 result = od.load();
                 break;
-            case JCTree.NEG:
+            case NEG:
                 result = od.load();
                 code.emitop0(operator.opcode);
                 break;
-            case JCTree.COMPL:
+            case COMPL:
                 result = od.load();
                 emitMinusOne(od.typecode);
                 code.emitop0(operator.opcode);
                 break;
-            case JCTree.PREINC: case JCTree.PREDEC:
+            case PREINC: case PREDEC:
                 od.duplicate();
                 if (od instanceof LocalItem &&
                     (operator.opcode == iadd || operator.opcode == isub)) {
-                    ((LocalItem)od).incr(tree.getTag() == JCTree.PREINC ? 1 : -1);
+                    ((LocalItem)od).incr(tree.hasTag(PREINC) ? 1 : -1);
                     result = od;
                 } else {
                     od.load();
@@ -1875,12 +1873,12 @@
                     result = items.makeAssignItem(od);
                 }
                 break;
-            case JCTree.POSTINC: case JCTree.POSTDEC:
+            case POSTINC: case POSTDEC:
                 od.duplicate();
                 if (od instanceof LocalItem &&
                     (operator.opcode == iadd || operator.opcode == isub)) {
                     Item res = od.load();
-                    ((LocalItem)od).incr(tree.getTag() == JCTree.POSTINC ? 1 : -1);
+                    ((LocalItem)od).incr(tree.hasTag(POSTINC) ? 1 : -1);
                     result = res;
                 } else {
                     Item res = od.load();
@@ -1896,7 +1894,7 @@
                     result = res;
                 }
                 break;
-            case JCTree.NULLCHK:
+            case NULLCHK:
                 result = od.load();
                 code.emitop0(dup);
                 genNullCheck(tree.pos());
@@ -1924,7 +1922,7 @@
             // Convert buffer to string.
             bufferToString(tree.pos());
             result = items.makeStackItem(syms.stringType);
-        } else if (tree.getTag() == JCTree.AND) {
+        } else if (tree.hasTag(AND)) {
             CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER);
             if (!lcond.isFalse()) {
                 Chain falseJumps = lcond.jumpFalse();
@@ -1938,7 +1936,7 @@
             } else {
                 result = lcond;
             }
-        } else if (tree.getTag() == JCTree.OR) {
+        } else if (tree.hasTag(OR)) {
             CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER);
             if (!lcond.isTrue()) {
                 Chain trueJumps = lcond.jumpTrue();
@@ -1995,7 +1993,7 @@
          */
         void appendStrings(JCTree tree) {
             tree = TreeInfo.skipParens(tree);
-            if (tree.getTag() == JCTree.PLUS && tree.type.constValue() == null) {
+            if (tree.hasTag(PLUS) && tree.type.constValue() == null) {
                 JCBinary op = (JCBinary) tree;
                 if (op.operator.kind == MTH &&
                     ((OperatorSymbol) op.operator).opcode == string_add) {
@@ -2213,7 +2211,7 @@
             attrEnv = env;
             ClassSymbol c = cdef.sym;
             this.toplevel = env.toplevel;
-            this.endPositions = toplevel.endPositions;
+            this.endPosTable = toplevel.endPositions;
             // If this is a class definition requiring Miranda methods,
             // add them.
             if (generateIproxies &&
@@ -2238,7 +2236,7 @@
             if (nerrs != 0) {
                 // if errors, discard code
                 for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) {
-                    if (l.head.getTag() == JCTree.METHODDEF)
+                    if (l.head.hasTag(METHODDEF))
                         ((JCMethodDecl) l.head).sym.code = null;
                 }
             }
@@ -2249,7 +2247,7 @@
             attrEnv = null;
             this.env = null;
             toplevel = null;
-            endPositions = null;
+            endPosTable = null;
             nerrs = 0;
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,856 @@
+/*
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.jvm;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+import java.util.StringTokenizer;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.NoType;
+import javax.lang.model.type.PrimitiveType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.TypeVariable;
+import javax.lang.model.type.TypeVisitor;
+import javax.lang.model.util.ElementFilter;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.SimpleTypeVisitor8;
+import javax.lang.model.util.Types;
+
+import javax.tools.FileObject;
+import javax.tools.JavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.model.JavacElements;
+import com.sun.tools.javac.model.JavacTypes;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Options;
+
+import static com.sun.tools.javac.main.Option.*;
+
+/** This class provides operations to write native header files for classes.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class JNIWriter {
+    protected static final Context.Key<JNIWriter> jniWriterKey =
+        new Context.Key<JNIWriter>();
+
+    /** Access to files. */
+    private final JavaFileManager fileManager;
+
+    JavacElements elements;
+    JavacTypes types;
+
+    /** The log to use for verbose output.
+     */
+    private final Log log;
+
+    /** Switch: verbose output.
+     */
+    private boolean verbose;
+
+    /** Switch: check all nested classes of top level class
+     */
+    private boolean checkAll;
+
+    private Mangle mangler;
+
+    private Context context;
+
+    private Symtab syms;
+
+    private String lineSep;
+
+    private final boolean isWindows =
+        System.getProperty("os.name").startsWith("Windows");
+
+    /** Get the ClassWriter instance for this context. */
+    public static JNIWriter instance(Context context) {
+        JNIWriter instance = context.get(jniWriterKey);
+        if (instance == null)
+            instance = new JNIWriter(context);
+        return instance;
+    }
+
+    /** Construct a class writer, given an options table.
+     */
+    private JNIWriter(Context context) {
+        context.put(jniWriterKey, this);
+        fileManager = context.get(JavaFileManager.class);
+        log = Log.instance(context);
+
+        Options options = Options.instance(context);
+        verbose = options.isSet(VERBOSE);
+        checkAll = options.isSet("javah:full");
+
+        this.context = context; // for lazyInit()
+        syms = Symtab.instance(context);
+
+        lineSep = System.getProperty("line.separator");
+    }
+
+    private void lazyInit() {
+        if (mangler == null) {
+            elements = JavacElements.instance(context);
+            types = JavacTypes.instance(context);
+            mangler = new Mangle(elements, types);
+        }
+    }
+
+    public boolean needsHeader(ClassSymbol c) {
+        if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
+            return false;
+
+        if (checkAll)
+            return needsHeader(c.outermostClass(), true);
+        else
+            return needsHeader(c, false);
+    }
+
+    private boolean needsHeader(ClassSymbol c, boolean checkNestedClasses) {
+        if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
+            return false;
+
+        for (Attribute.Compound a: c.attributes_field) {
+            if (a.type.tsym == syms.nativeHeaderType.tsym)
+                return true;
+        }
+        for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
+            if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
+                return true;
+        }
+        if (checkNestedClasses) {
+            for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
+                if ((i.sym.kind == Kinds.TYP) && needsHeader(((ClassSymbol) i.sym), true))
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    /** Emit a class file for a given class.
+     *  @param c      The class from which a class file is generated.
+     */
+    public FileObject write(ClassSymbol c)
+        throws IOException
+    {
+        String className = c.flatName().toString();
+        FileObject outFile
+            = fileManager.getFileForOutput(StandardLocation.NATIVE_HEADER_OUTPUT,
+                "", className.replaceAll("[.$]", "_") + ".h", null);
+        Writer out = outFile.openWriter();
+        try {
+            write(out, c);
+            if (verbose)
+                log.printVerbose("wrote.file", outFile);
+            out.close();
+            out = null;
+        } finally {
+            if (out != null) {
+                // if we are propogating an exception, delete the file
+                out.close();
+                outFile.delete();
+                outFile = null;
+            }
+        }
+        return outFile; // may be null if write failed
+    }
+
+    public void write(Writer out, ClassSymbol sym)
+            throws IOException {
+        lazyInit();
+        try {
+            String cname = mangler.mangle(sym.fullname, Mangle.Type.CLASS);
+            println(out, fileTop());
+            println(out, includes());
+            println(out, guardBegin(cname));
+            println(out, cppGuardBegin());
+
+            writeStatics(out, sym);
+            writeMethods(out, sym, cname);
+
+            println(out, cppGuardEnd());
+            println(out, guardEnd(cname));
+        } catch (TypeSignature.SignatureException e) {
+            throw new IOException(e);
+        }
+    }
+
+    protected void writeStatics(Writer out, ClassSymbol sym) throws IOException {
+        List<VariableElement> classfields = getAllFields(sym);
+
+        for (VariableElement v: classfields) {
+            if (!v.getModifiers().contains(Modifier.STATIC))
+                continue;
+            String s = null;
+            s = defineForStatic(sym, v);
+            if (s != null) {
+                println(out, s);
+            }
+        }
+    }
+
+    /**
+     * Including super class fields.
+     */
+    List<VariableElement> getAllFields(TypeElement subclazz) {
+        List<VariableElement> fields = new ArrayList<VariableElement>();
+        TypeElement cd = null;
+        Stack<TypeElement> s = new Stack<TypeElement>();
+
+        cd = subclazz;
+        while (true) {
+            s.push(cd);
+            TypeElement c = (TypeElement) (types.asElement(cd.getSuperclass()));
+            if (c == null)
+                break;
+            cd = c;
+        }
+
+        while (!s.empty()) {
+            cd = s.pop();
+            fields.addAll(ElementFilter.fieldsIn(cd.getEnclosedElements()));
+        }
+
+        return fields;
+    }
+
+    protected String defineForStatic(TypeElement c, VariableElement f) {
+        CharSequence cnamedoc = c.getQualifiedName();
+        CharSequence fnamedoc = f.getSimpleName();
+
+        String cname = mangler.mangle(cnamedoc, Mangle.Type.CLASS);
+        String fname = mangler.mangle(fnamedoc, Mangle.Type.FIELDSTUB);
+
+        Assert.check(f.getModifiers().contains(Modifier.STATIC));
+
+        if (f.getModifiers().contains(Modifier.FINAL)) {
+            Object value = null;
+
+            value = f.getConstantValue();
+
+            if (value != null) { /* so it is a ConstantExpression */
+                String constString = null;
+                if ((value instanceof Integer)
+                    || (value instanceof Byte)
+                    || (value instanceof Short)) {
+                    /* covers byte, short, int */
+                    constString = value.toString() + "L";
+                } else if (value instanceof Boolean) {
+                    constString = ((Boolean) value) ? "1L" : "0L";
+                } else if (value instanceof Character) {
+                    Character ch = (Character) value;
+                    constString = String.valueOf(((int) ch) & 0xffff) + "L";
+                } else if (value instanceof Long) {
+                    // Visual C++ supports the i64 suffix, not LL.
+                    if (isWindows)
+                        constString = value.toString() + "i64";
+                    else
+                        constString = value.toString() + "LL";
+                } else if (value instanceof Float) {
+                    /* bug for bug */
+                    float fv = ((Float)value).floatValue();
+                    if (Float.isInfinite(fv))
+                        constString = ((fv < 0) ? "-" : "") + "Inff";
+                    else
+                        constString = value.toString() + "f";
+                } else if (value instanceof Double) {
+                    /* bug for bug */
+                    double d = ((Double)value).doubleValue();
+                    if (Double.isInfinite(d))
+                        constString = ((d < 0) ? "-" : "") + "InfD";
+                    else
+                        constString = value.toString();
+                }
+
+                if (constString != null) {
+                    StringBuilder s = new StringBuilder("#undef ");
+                    s.append(cname); s.append("_"); s.append(fname); s.append(lineSep);
+                    s.append("#define "); s.append(cname); s.append("_");
+                    s.append(fname); s.append(" "); s.append(constString);
+                    return s.toString();
+                }
+
+            }
+        }
+
+        return null;
+    }
+
+
+    protected void writeMethods(Writer out, ClassSymbol sym, String cname)
+            throws IOException, TypeSignature.SignatureException {
+        List<ExecutableElement> classmethods = ElementFilter.methodsIn(sym.getEnclosedElements());
+        for (ExecutableElement md: classmethods) {
+            if(md.getModifiers().contains(Modifier.NATIVE)){
+                TypeMirror mtr = types.erasure(md.getReturnType());
+                String sig = signature(md);
+                TypeSignature newtypesig = new TypeSignature(elements);
+                CharSequence methodName = md.getSimpleName();
+                boolean longName = false;
+                for (ExecutableElement md2: classmethods) {
+                    if ((md2 != md)
+                        && (methodName.equals(md2.getSimpleName()))
+                        && (md2.getModifiers().contains(Modifier.NATIVE)))
+                        longName = true;
+
+                }
+                println(out, "/*");
+                println(out, " * Class:     " + cname);
+                println(out, " * Method:    " +
+                           mangler.mangle(methodName, Mangle.Type.FIELDSTUB));
+                println(out, " * Signature: " + newtypesig.getTypeSignature(sig, mtr));
+                println(out, " */");
+                println(out, "JNIEXPORT " + jniType(mtr) +
+                           " JNICALL " +
+                           mangler.mangleMethod(md, sym,
+                                               (longName) ?
+                                               Mangle.Type.METHOD_JNI_LONG :
+                                               Mangle.Type.METHOD_JNI_SHORT));
+                print(out, "  (JNIEnv *, ");
+                List<? extends VariableElement> paramargs = md.getParameters();
+                List<TypeMirror> args = new ArrayList<TypeMirror>();
+                for (VariableElement p: paramargs) {
+                    args.add(types.erasure(p.asType()));
+                }
+                if (md.getModifiers().contains(Modifier.STATIC))
+                    print(out, "jclass");
+                else
+                    print(out, "jobject");
+
+                for (TypeMirror arg: args) {
+                    print(out, ", ");
+                    print(out, jniType(arg));
+                }
+                println(out, ");"
+                        + lineSep);
+            }
+        }
+    }
+
+    // c.f. MethodDoc.signature
+    String signature(ExecutableElement e) {
+        StringBuilder sb = new StringBuilder("(");
+        String sep = "";
+        for (VariableElement p: e.getParameters()) {
+            sb.append(sep);
+            sb.append(types.erasure(p.asType()).toString());
+            sep = ",";
+        }
+        sb.append(")");
+        return sb.toString();
+    }
+
+    protected final String jniType(TypeMirror t) {
+        TypeElement throwable = elements.getTypeElement("java.lang.Throwable");
+        TypeElement jClass = elements.getTypeElement("java.lang.Class");
+        TypeElement jString = elements.getTypeElement("java.lang.String");
+        Element tclassDoc = types.asElement(t);
+
+
+        switch (t.getKind()) {
+            case ARRAY: {
+                TypeMirror ct = ((ArrayType) t).getComponentType();
+                switch (ct.getKind()) {
+                    case BOOLEAN:  return "jbooleanArray";
+                    case BYTE:     return "jbyteArray";
+                    case CHAR:     return "jcharArray";
+                    case SHORT:    return "jshortArray";
+                    case INT:      return "jintArray";
+                    case LONG:     return "jlongArray";
+                    case FLOAT:    return "jfloatArray";
+                    case DOUBLE:   return "jdoubleArray";
+                    case ARRAY:
+                    case DECLARED: return "jobjectArray";
+                    default: throw new Error(ct.toString());
+                }
+            }
+
+            case VOID:     return "void";
+            case BOOLEAN:  return "jboolean";
+            case BYTE:     return "jbyte";
+            case CHAR:     return "jchar";
+            case SHORT:    return "jshort";
+            case INT:      return "jint";
+            case LONG:     return "jlong";
+            case FLOAT:    return "jfloat";
+            case DOUBLE:   return "jdouble";
+
+            case DECLARED: {
+                if (tclassDoc.equals(jString))
+                    return "jstring";
+                else if (types.isAssignable(t, throwable.asType()))
+                    return "jthrowable";
+                else if (types.isAssignable(t, jClass.asType()))
+                    return "jclass";
+                else
+                    return "jobject";
+            }
+        }
+
+        Assert.check(false, "jni unknown type");
+        return null; /* dead code. */
+    }
+
+    protected String fileTop() {
+        return "/* DO NOT EDIT THIS FILE - it is machine generated */";
+    }
+
+    protected String includes() {
+        return "#include <jni.h>";
+    }
+
+    /*
+     * Deal with the C pre-processor.
+     */
+    protected String cppGuardBegin() {
+        return "#ifdef __cplusplus" + lineSep
+                + "extern \"C\" {" + lineSep
+                + "#endif";
+    }
+
+    protected String cppGuardEnd() {
+        return "#ifdef __cplusplus" + lineSep
+                + "}" + lineSep
+                + "#endif";
+    }
+
+    protected String guardBegin(String cname) {
+        return "/* Header for class " + cname + " */" + lineSep
+                + lineSep
+                + "#ifndef _Included_" + cname + lineSep
+                + "#define _Included_" + cname;
+    }
+
+    protected String guardEnd(String cname) {
+        return "#endif";
+    }
+
+    protected void print(Writer out, String text) throws IOException {
+        out.write(text);
+    }
+
+    protected void println(Writer out, String text) throws IOException {
+        out.write(text);
+        out.write(lineSep);
+    }
+
+
+    private static class Mangle {
+
+        public static class Type {
+            public static final int CLASS            = 1;
+            public static final int FIELDSTUB        = 2;
+            public static final int FIELD            = 3;
+            public static final int JNI              = 4;
+            public static final int SIGNATURE        = 5;
+            public static final int METHOD_JDK_1     = 6;
+            public static final int METHOD_JNI_SHORT = 7;
+            public static final int METHOD_JNI_LONG  = 8;
+        };
+
+        private Elements elems;
+        private Types types;
+
+        Mangle(Elements elems, Types types) {
+            this.elems = elems;
+            this.types = types;
+        }
+
+        public final String mangle(CharSequence name, int mtype) {
+            StringBuilder result = new StringBuilder(100);
+            int length = name.length();
+
+            for (int i = 0; i < length; i++) {
+                char ch = name.charAt(i);
+                if (isalnum(ch)) {
+                    result.append(ch);
+                } else if ((ch == '.') &&
+                           mtype == Mangle.Type.CLASS) {
+                    result.append('_');
+                } else if (( ch == '$') &&
+                           mtype == Mangle.Type.CLASS) {
+                    result.append('_');
+                    result.append('_');
+                } else if (ch == '_' && mtype == Mangle.Type.FIELDSTUB) {
+                    result.append('_');
+                } else if (ch == '_' && mtype == Mangle.Type.CLASS) {
+                    result.append('_');
+                } else if (mtype == Mangle.Type.JNI) {
+                    String esc = null;
+                    if (ch == '_')
+                        esc = "_1";
+                    else if (ch == '.')
+                        esc = "_";
+                    else if (ch == ';')
+                        esc = "_2";
+                    else if (ch == '[')
+                        esc = "_3";
+                    if (esc != null) {
+                        result.append(esc);
+                    } else {
+                        result.append(mangleChar(ch));
+                    }
+                } else if (mtype == Mangle.Type.SIGNATURE) {
+                    if (isprint(ch)) {
+                        result.append(ch);
+                    } else {
+                        result.append(mangleChar(ch));
+                    }
+                } else {
+                    result.append(mangleChar(ch));
+                }
+            }
+
+            return result.toString();
+        }
+
+        public String mangleMethod(ExecutableElement method, TypeElement clazz,
+                                          int mtype) throws TypeSignature.SignatureException {
+            StringBuilder result = new StringBuilder(100);
+            result.append("Java_");
+
+            if (mtype == Mangle.Type.METHOD_JDK_1) {
+                result.append(mangle(clazz.getQualifiedName(), Mangle.Type.CLASS));
+                result.append('_');
+                result.append(mangle(method.getSimpleName(),
+                                     Mangle.Type.FIELD));
+                result.append("_stub");
+                return result.toString();
+            }
+
+            /* JNI */
+            result.append(mangle(getInnerQualifiedName(clazz), Mangle.Type.JNI));
+            result.append('_');
+            result.append(mangle(method.getSimpleName(),
+                                 Mangle.Type.JNI));
+            if (mtype == Mangle.Type.METHOD_JNI_LONG) {
+                result.append("__");
+                String typesig = signature(method);
+                TypeSignature newTypeSig = new TypeSignature(elems);
+                String sig = newTypeSig.getTypeSignature(typesig,  method.getReturnType());
+                sig = sig.substring(1);
+                sig = sig.substring(0, sig.lastIndexOf(')'));
+                sig = sig.replace('/', '.');
+                result.append(mangle(sig, Mangle.Type.JNI));
+            }
+
+            return result.toString();
+        }
+        //where
+            private String getInnerQualifiedName(TypeElement clazz) {
+                return elems.getBinaryName(clazz).toString();
+            }
+
+        public final String mangleChar(char ch) {
+            String s = Integer.toHexString(ch);
+            int nzeros = 5 - s.length();
+            char[] result = new char[6];
+            result[0] = '_';
+            for (int i = 1; i <= nzeros; i++)
+                result[i] = '0';
+            for (int i = nzeros+1, j = 0; i < 6; i++, j++)
+                result[i] = s.charAt(j);
+            return new String(result);
+        }
+
+        // Warning: duplicated in Gen
+        private String signature(ExecutableElement e) {
+            StringBuilder sb = new StringBuilder();
+            String sep = "(";
+            for (VariableElement p: e.getParameters()) {
+                sb.append(sep);
+                sb.append(types.erasure(p.asType()).toString());
+                sep = ",";
+            }
+            sb.append(")");
+            return sb.toString();
+        }
+
+        /* Warning: Intentional ASCII operation. */
+        private static boolean isalnum(char ch) {
+            return ch <= 0x7f && /* quick test */
+                ((ch >= 'A' && ch <= 'Z') ||
+                 (ch >= 'a' && ch <= 'z') ||
+                 (ch >= '0' && ch <= '9'));
+        }
+
+        /* Warning: Intentional ASCII operation. */
+        private static boolean isprint(char ch) {
+            return ch >= 32 && ch <= 126;
+        }
+    }
+
+    private static class TypeSignature {
+        static class SignatureException extends Exception {
+            private static final long serialVersionUID = 1L;
+            SignatureException(String reason) {
+                super(reason);
+            }
+        }
+
+        Elements elems;
+
+        /* Signature Characters */
+
+        private static final String SIG_VOID                   = "V";
+        private static final String SIG_BOOLEAN                = "Z";
+        private static final String SIG_BYTE                   = "B";
+        private static final String SIG_CHAR                   = "C";
+        private static final String SIG_SHORT                  = "S";
+        private static final String SIG_INT                    = "I";
+        private static final String SIG_LONG                   = "J";
+        private static final String SIG_FLOAT                  = "F";
+        private static final String SIG_DOUBLE                 = "D";
+        private static final String SIG_ARRAY                  = "[";
+        private static final String SIG_CLASS                  = "L";
+
+
+
+        public TypeSignature(Elements elems){
+            this.elems = elems;
+        }
+
+        /*
+         * Returns the type signature of a field according to JVM specs
+         */
+        public String getTypeSignature(String javasignature) throws SignatureException {
+            return getParamJVMSignature(javasignature);
+        }
+
+        /*
+         * Returns the type signature of a method according to JVM specs
+         */
+        public String getTypeSignature(String javasignature, TypeMirror returnType)
+                throws SignatureException {
+            String signature = null; //Java type signature.
+            String typeSignature = null; //Internal type signature.
+            List<String> params = new ArrayList<String>(); //List of parameters.
+            String paramsig = null; //Java parameter signature.
+            String paramJVMSig = null; //Internal parameter signature.
+            String returnSig = null; //Java return type signature.
+            String returnJVMType = null; //Internal return type signature.
+            int dimensions = 0; //Array dimension.
+
+            int startIndex = -1;
+            int endIndex = -1;
+            StringTokenizer st = null;
+            int i = 0;
+
+            // Gets the actual java signature without parentheses.
+            if (javasignature != null) {
+                startIndex = javasignature.indexOf("(");
+                endIndex = javasignature.indexOf(")");
+            }
+
+            if (((startIndex != -1) && (endIndex != -1))
+                &&(startIndex+1 < javasignature.length())
+                &&(endIndex < javasignature.length())) {
+                signature = javasignature.substring(startIndex+1, endIndex);
+            }
+
+            // Separates parameters.
+            if (signature != null) {
+                if (signature.indexOf(",") != -1) {
+                    st = new StringTokenizer(signature, ",");
+                    if (st != null) {
+                        while (st.hasMoreTokens()) {
+                            params.add(st.nextToken());
+                        }
+                    }
+                } else {
+                    params.add(signature);
+                }
+            }
+
+            /* JVM type signature. */
+            typeSignature = "(";
+
+            // Gets indivisual internal parameter signature.
+            while (params.isEmpty() != true) {
+                paramsig = params.remove(i).trim();
+                paramJVMSig  = getParamJVMSignature(paramsig);
+                if (paramJVMSig != null) {
+                    typeSignature += paramJVMSig;
+                }
+            }
+
+            typeSignature += ")";
+
+            // Get internal return type signature.
+
+            returnJVMType = "";
+            if (returnType != null) {
+                dimensions = dimensions(returnType);
+            }
+
+            //Gets array dimension of return type.
+            while (dimensions-- > 0) {
+                returnJVMType += "[";
+            }
+            if (returnType != null) {
+                returnSig = qualifiedTypeName(returnType);
+                returnJVMType += getComponentType(returnSig);
+            } else {
+                System.out.println("Invalid return type.");
+            }
+
+            typeSignature += returnJVMType;
+
+            return typeSignature;
+        }
+
+        /*
+         * Returns internal signature of a parameter.
+         */
+        private String getParamJVMSignature(String paramsig) throws SignatureException {
+            String paramJVMSig = "";
+            String componentType ="";
+
+            if(paramsig != null){
+
+                if(paramsig.indexOf("[]") != -1) {
+                    // Gets array dimension.
+                    int endindex = paramsig.indexOf("[]");
+                    componentType = paramsig.substring(0, endindex);
+                    String dimensionString =  paramsig.substring(endindex);
+                    if(dimensionString != null){
+                        while(dimensionString.indexOf("[]") != -1){
+                            paramJVMSig += "[";
+                            int beginindex = dimensionString.indexOf("]") + 1;
+                            if(beginindex < dimensionString.length()){
+                                dimensionString = dimensionString.substring(beginindex);
+                            }else
+                                dimensionString = "";
+                        }
+                    }
+                } else componentType = paramsig;
+
+                paramJVMSig += getComponentType(componentType);
+            }
+            return paramJVMSig;
+        }
+
+        /*
+         * Returns internal signature of a component.
+         */
+        private String getComponentType(String componentType) throws SignatureException {
+
+            String JVMSig = "";
+
+            if(componentType != null){
+                if(componentType.equals("void")) JVMSig += SIG_VOID ;
+                else if(componentType.equals("boolean"))  JVMSig += SIG_BOOLEAN ;
+                else if(componentType.equals("byte")) JVMSig += SIG_BYTE ;
+                else if(componentType.equals("char"))  JVMSig += SIG_CHAR ;
+                else if(componentType.equals("short"))  JVMSig += SIG_SHORT ;
+                else if(componentType.equals("int"))  JVMSig += SIG_INT ;
+                else if(componentType.equals("long"))  JVMSig += SIG_LONG ;
+                else if(componentType.equals("float")) JVMSig += SIG_FLOAT ;
+                else if(componentType.equals("double"))  JVMSig += SIG_DOUBLE ;
+                else {
+                    if(!componentType.equals("")){
+                        TypeElement classNameDoc = elems.getTypeElement(componentType);
+
+                        if(classNameDoc == null){
+                            throw new SignatureException(componentType);
+                        }else {
+                            String classname = classNameDoc.getQualifiedName().toString();
+                            String newclassname = classname.replace('.', '/');
+                            JVMSig += "L";
+                            JVMSig += newclassname;
+                            JVMSig += ";";
+                        }
+                    }
+                }
+            }
+            return JVMSig;
+        }
+
+        int dimensions(TypeMirror t) {
+            if (t.getKind() != TypeKind.ARRAY)
+                return 0;
+            return 1 + dimensions(((ArrayType) t).getComponentType());
+        }
+
+
+        String qualifiedTypeName(TypeMirror type) {
+            TypeVisitor<Name, Void> v = new SimpleTypeVisitor8<Name, Void>() {
+                @Override
+                public Name visitArray(ArrayType t, Void p) {
+                    return t.getComponentType().accept(this, p);
+                }
+
+                @Override
+                public Name visitDeclared(DeclaredType t, Void p) {
+                    return ((TypeElement) t.asElement()).getQualifiedName();
+                }
+
+                @Override
+                public Name visitPrimitive(PrimitiveType t, Void p) {
+                    return elems.getName(t.toString());
+                }
+
+                @Override
+                public Name visitNoType(NoType t, Void p) {
+                    if (t.getKind() == TypeKind.VOID)
+                        return elems.getName("void");
+                    return defaultAction(t, p);
+                }
+
+                @Override
+                public Name visitTypeVariable(TypeVariable t, Void p) {
+                    return t.getUpperBound().accept(this, p);
+                }
+            };
+            return v.visit(type).toString();
+        }
+    }
+
+}
--- a/src/share/classes/com/sun/tools/javac/jvm/Target.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Target.java	Tue May 29 00:27:58 2012 +0100
@@ -31,7 +31,7 @@
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.util.*;
 
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 
 /** The classfile version target.
  *
--- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,8 @@
 import java.io.*;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.MissingResourceException;
 import java.util.Queue;
@@ -41,27 +41,29 @@
 
 import javax.annotation.processing.Processor;
 import javax.lang.model.SourceVersion;
+import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
-import javax.tools.DiagnosticListener;
+import javax.tools.StandardLocation;
+
+import static javax.tools.StandardLocation.CLASS_OUTPUT;
 
 import com.sun.source.util.TaskEvent;
-import com.sun.source.util.TaskListener;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.api.MultiTaskListener;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.*;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.jvm.*;
+import com.sun.tools.javac.parser.*;
+import com.sun.tools.javac.processing.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.parser.*;
-import com.sun.tools.javac.comp.*;
-import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.processing.*;
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.Log.WriterKind;
 
-import static javax.tools.StandardLocation.CLASS_OUTPUT;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
 import static com.sun.tools.javac.util.ListBuffer.lb;
 
@@ -228,6 +230,10 @@
      */
     protected ClassWriter writer;
 
+    /** The native header writer.
+     */
+    protected JNIWriter jniWriter;
+
     /** The module for the symbol table entry phases.
      */
     protected Enter enter;
@@ -288,9 +294,9 @@
      */
     protected ParserFactory parserFactory;
 
-    /** Optional listener for progress events
+    /** Broadcasting listener for progress events
      */
-    protected TaskListener taskListener;
+    protected MultiTaskListener taskListener;
 
     /**
      * Annotation processing may require and provide a new instance
@@ -331,6 +337,7 @@
         reader = ClassReader.instance(context);
         make = TreeMaker.instance(context);
         writer = ClassWriter.instance(context);
+        jniWriter = JNIWriter.instance(context);
         enter = Enter.instance(context);
         todo = Todo.instance(context);
 
@@ -355,7 +362,7 @@
         lower = Lower.instance(context);
         annotate = Annotate.instance(context);
         types = Types.instance(context);
-        taskListener = context.get(TaskListener.class);
+        taskListener = MultiTaskListener.instance(context);
 
         reader.sourceCompleter = this;
 
@@ -488,6 +495,10 @@
      */
     public Todo todo;
 
+    /** A list of items to be closed when the compilation is complete.
+     */
+    public List<Closeable> closeables = List.nil();
+
     /** Ordered list of compiler phases for each compilation unit. */
     public enum CompileState {
         PARSE(1),
@@ -587,7 +598,7 @@
             if (verbose) {
                 log.printVerbose("parsing.started", filename);
             }
-            if (taskListener != null) {
+            if (!taskListener.isEmpty()) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
                 taskListener.started(e);
             }
@@ -600,7 +611,7 @@
 
         tree.sourcefile = filename;
 
-        if (content != null && taskListener != null) {
+        if (content != null && !taskListener.isEmpty()) {
             TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, tree);
             taskListener.finished(e);
         }
@@ -746,14 +757,14 @@
             log.useSource(prev);
         }
 
-        if (taskListener != null) {
+        if (!taskListener.isEmpty()) {
             TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, tree);
             taskListener.started(e);
         }
 
         enter.complete(List.of(tree), c);
 
-        if (taskListener != null) {
+        if (!taskListener.isEmpty()) {
             TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, tree);
             taskListener.finished(e);
         }
@@ -812,8 +823,8 @@
 
         // forcibly set the equivalent of -Xlint:-options, so that no further
         // warnings about command line options are generated from this point on
-        options.put(XLINT_CUSTOM + "-" + LintCategory.OPTIONS.option, "true");
-        options.remove(XLINT_CUSTOM + LintCategory.OPTIONS.option);
+        options.put(XLINT_CUSTOM.text + "-" + LintCategory.OPTIONS.option, "true");
+        options.remove(XLINT_CUSTOM.text + LintCategory.OPTIONS.option);
 
         start_msec = now();
 
@@ -919,7 +930,7 @@
      */
     public List<JCCompilationUnit> enterTrees(List<JCCompilationUnit> roots) {
         //enter symbols for all files
-        if (taskListener != null) {
+        if (!taskListener.isEmpty()) {
             for (JCCompilationUnit unit: roots) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, unit);
                 taskListener.started(e);
@@ -928,7 +939,7 @@
 
         enter.main(roots);
 
-        if (taskListener != null) {
+        if (!taskListener.isEmpty()) {
             for (JCCompilationUnit unit: roots) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, unit);
                 taskListener.finished(e);
@@ -997,7 +1008,7 @@
                 reader.saveParameterNames = true;
                 keepComments = true;
                 genEndPos = true;
-                if (taskListener != null)
+                if (!taskListener.isEmpty())
                     taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING));
                 log.deferDiagnostics = true;
             } else { // free resources
@@ -1012,7 +1023,7 @@
     }
 
     /**
-     * Process any anotations found in the specifed compilation units.
+     * Process any annotations found in the specified compilation units.
      * @param roots a list of compilation units
      * @return an instance of the compiler in which to complete the compilation
      */
@@ -1072,7 +1083,9 @@
                     boolean errors = false;
                     for (String nameStr : classnames) {
                         Symbol sym = resolveBinaryNameOrIdent(nameStr);
-                        if (sym == null || (sym.kind == Kinds.PCK && !processPcks)) {
+                        if (sym == null ||
+                            (sym.kind == Kinds.PCK && !processPcks) ||
+                            sym.kind == Kinds.ABSENT_TYP) {
                             log.error("proc.cant.find.class", nameStr);
                             errors = true;
                             continue;
@@ -1169,7 +1182,7 @@
         if (verbose)
             log.printVerbose("checking.attribution", env.enclClass.sym);
 
-        if (taskListener != null) {
+        if (!taskListener.isEmpty()) {
             TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
             taskListener.started(e);
         }
@@ -1252,7 +1265,7 @@
             }
         }
         finally {
-            if (taskListener != null) {
+            if (!taskListener.isEmpty()) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
                 taskListener.finished(e);
             }
@@ -1433,7 +1446,7 @@
                                + " " + cdef.sym + "]");
             }
 
-            if (taskListener != null) {
+            if (!taskListener.isEmpty()) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.GENERATE, env.toplevel, cdef.sym);
                 taskListener.started(e);
             }
@@ -1445,8 +1458,13 @@
                 JavaFileObject file;
                 if (usePrintSource)
                     file = printSource(env, cdef);
-                else
+                else {
+                    if (fileManager.hasLocation(StandardLocation.NATIVE_HEADER_OUTPUT)
+                            && jniWriter.needsHeader(cdef.sym)) {
+                        jniWriter.write(cdef.sym);
+                    }
                     file = genCode(env, cdef);
+                }
                 if (results != null && file != null)
                     results.add(file);
             } catch (IOException ex) {
@@ -1457,7 +1475,7 @@
                 log.useSource(prev);
             }
 
-            if (taskListener != null) {
+            if (!taskListener.isEmpty()) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.GENERATE, env.toplevel, cdef.sym);
                 taskListener.finished(e);
             }
@@ -1502,20 +1520,20 @@
                     for (List<JCTree> it = tree.defs; it.tail != null; it = it.tail) {
                         JCTree t = it.head;
                         switch (t.getTag()) {
-                        case JCTree.CLASSDEF:
+                        case CLASSDEF:
                             if (isInterface ||
                                 (((JCClassDecl) t).mods.flags & (Flags.PROTECTED|Flags.PUBLIC)) != 0 ||
                                 (((JCClassDecl) t).mods.flags & (Flags.PRIVATE)) == 0 && ((JCClassDecl) t).sym.packge().getQualifiedName() == names.java_lang)
                                 newdefs.append(t);
                             break;
-                        case JCTree.METHODDEF:
+                        case METHODDEF:
                             if (isInterface ||
                                 (((JCMethodDecl) t).mods.flags & (Flags.PROTECTED|Flags.PUBLIC)) != 0 ||
                                 ((JCMethodDecl) t).sym.name == names.init ||
                                 (((JCMethodDecl) t).mods.flags & (Flags.PRIVATE)) == 0 && ((JCMethodDecl) t).sym.packge().getQualifiedName() == names.java_lang)
                                 newdefs.append(t);
                             break;
-                        case JCTree.VARDEF:
+                        case VARDEF:
                             if (isInterface || (((JCVariableDecl) t).mods.flags & (Flags.PROTECTED|Flags.PUBLIC)) != 0 ||
                                 (((JCVariableDecl) t).mods.flags & (Flags.PRIVATE)) == 0 && ((JCVariableDecl) t).sym.packge().getQualifiedName() == names.java_lang)
                                 newdefs.append(t);
@@ -1581,11 +1599,24 @@
             if (names != null && disposeNames)
                 names.dispose();
             names = null;
+
+            for (Closeable c: closeables) {
+                try {
+                    c.close();
+                } catch (IOException e) {
+                    // When javac uses JDK 7 as a baseline, this code would be
+                    // better written to set any/all exceptions from all the
+                    // Closeables as suppressed exceptions on the FatalError
+                    // that is thrown.
+                    JCDiagnostic msg = diagFactory.fragment("fatal.err.cant.close");
+                    throw new FatalError(msg, e);
+                }
+            }
         }
     }
 
     protected void printNote(String lines) {
-        Log.printLines(log.noticeWriter, lines);
+        log.printRawLines(Log.WriterKind.NOTICE, lines);
     }
 
     /** Print numbers of errors and warnings.
@@ -1597,8 +1628,8 @@
                 key = "count." + kind;
             else
                 key = "count." + kind + ".plural";
-            log.printErrLines(key, String.valueOf(count));
-            log.errWriter.flush();
+            log.printLines(WriterKind.ERROR, key, String.valueOf(count));
+            log.flush(Log.WriterKind.ERROR);
         }
     }
 
@@ -1615,6 +1646,8 @@
         keepComments = prev.keepComments;
         start_msec = prev.start_msec;
         hasBeenUsed = true;
+        closeables = prev.closeables;
+        prev.closeables = List.nil();
     }
 
     public static void enableLogging() {
--- a/src/share/classes/com/sun/tools/javac/main/JavacOption.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.main;
-
-import java.io.PrintWriter;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Options;
-
-/**
- * TODO: describe com.sun.tools.javac.main.JavacOption
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk.  This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public interface JavacOption {
-
-    OptionKind getKind();
-
-    /** Does this option take a (separate) operand?
-     *  @return true if this option takes a separate operand
-     */
-    boolean hasArg();
-
-    /** Does argument string match option pattern?
-     *  @param arg   the command line argument string
-     *  @return true if {@code arg} matches this option
-     */
-    boolean matches(String arg);
-
-    /** Process an option with an argument.
-     *  @param options the accumulated set of analyzed options
-     *  @param option  the option to be processed
-     *  @param arg     the arg for the option to be processed
-     *  @return true if an error was detected
-     */
-    boolean process(Options options, String option, String arg);
-
-    /** Process the option with no argument.
-     *  @param options the accumulated set of analyzed options
-     *  @param option  the option to be processed
-     *  @return true if an error was detected
-     */
-    boolean process(Options options, String option);
-
-    OptionName getName();
-
-    enum OptionKind {
-        NORMAL,
-        EXTENDED,
-        HIDDEN,
-    }
-
-    enum ChoiceKind {
-        ONEOF,
-        ANYOF
-    }
-
-    /** This class represents an option recognized by the main program
-     */
-    static class Option implements JavacOption {
-
-        /** Option string.
-         */
-        OptionName name;
-
-        /** Documentation key for arguments.
-         */
-        String argsNameKey;
-
-        /** Documentation key for description.
-         */
-        String descrKey;
-
-        /** Suffix option (-foo=bar or -foo:bar)
-         */
-        boolean hasSuffix;
-
-        /** The kind of choices for this option, if any.
-         */
-        ChoiceKind choiceKind;
-
-        /** The choices for this option, if any, and whether or not the choices
-         *  are hidden
-         */
-        Map<String,Boolean> choices;
-
-        Option(OptionName name, String argsNameKey, String descrKey) {
-            this.name = name;
-            this.argsNameKey = argsNameKey;
-            this.descrKey = descrKey;
-            char lastChar = name.optionName.charAt(name.optionName.length()-1);
-            hasSuffix = lastChar == ':' || lastChar == '=';
-        }
-
-        Option(OptionName name, String descrKey) {
-            this(name, null, descrKey);
-        }
-
-        Option(OptionName name, String descrKey, ChoiceKind choiceKind, String... choices) {
-            this(name, descrKey, choiceKind, createChoices(choices));
-        }
-
-        private static Map<String,Boolean> createChoices(String... choices) {
-            Map<String,Boolean> map = new LinkedHashMap<String,Boolean>();
-            for (String c: choices)
-                map.put(c, false);
-            return map;
-        }
-
-        Option(OptionName name, String descrKey, ChoiceKind choiceKind,
-                Map<String,Boolean> choices) {
-            this(name, null, descrKey);
-            if (choiceKind == null || choices == null)
-                throw new NullPointerException();
-            this.choiceKind = choiceKind;
-            this.choices = choices;
-        }
-
-        @Override
-        public String toString() {
-            return name.optionName;
-        }
-
-        public boolean hasArg() {
-            return argsNameKey != null && !hasSuffix;
-        }
-
-        public boolean matches(String option) {
-            if (!hasSuffix)
-                return option.equals(name.optionName);
-
-            if (!option.startsWith(name.optionName))
-                return false;
-
-            if (choices != null) {
-                String arg = option.substring(name.optionName.length());
-                if (choiceKind == ChoiceKind.ONEOF)
-                    return choices.keySet().contains(arg);
-                else {
-                    for (String a: arg.split(",+")) {
-                        if (!choices.keySet().contains(a))
-                            return false;
-                    }
-                }
-            }
-
-            return true;
-        }
-
-        /** Print a line of documentation describing this option, if standard.
-         * @param out the stream to which to write the documentation
-         */
-        void help(PrintWriter out) {
-            String s = "  " + helpSynopsis();
-            out.print(s);
-            for (int j = Math.min(s.length(), 28); j < 29; j++) out.print(" ");
-            Log.printLines(out, Main.getLocalizedString(descrKey));
-        }
-
-        String helpSynopsis() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(name);
-            if (argsNameKey == null) {
-                if (choices != null) {
-                    String sep = "{";
-                    for (Map.Entry<String,Boolean> e: choices.entrySet()) {
-                        if (!e.getValue()) {
-                            sb.append(sep);
-                            sb.append(e.getKey());
-                            sep = ",";
-                        }
-                    }
-                    sb.append("}");
-                }
-            } else {
-                if (!hasSuffix)
-                    sb.append(" ");
-                sb.append(Main.getLocalizedString(argsNameKey));
-            }
-
-            return sb.toString();
-        }
-
-        /** Print a line of documentation describing this option, if non-standard.
-         *  @param out the stream to which to write the documentation
-         */
-        void xhelp(PrintWriter out) {}
-
-        /** Process the option (with arg). Return true if error detected.
-         */
-        public boolean process(Options options, String option, String arg) {
-            if (options != null) {
-                if (choices != null) {
-                    if (choiceKind == ChoiceKind.ONEOF) {
-                        // some clients like to see just one of option+choice set
-                        for (String s: choices.keySet())
-                            options.remove(option + s);
-                        String opt = option + arg;
-                        options.put(opt, opt);
-                        // some clients like to see option (without trailing ":")
-                        // set to arg
-                        String nm = option.substring(0, option.length() - 1);
-                        options.put(nm, arg);
-                    } else {
-                        // set option+word for each word in arg
-                        for (String a: arg.split(",+")) {
-                            String opt = option + a;
-                            options.put(opt, opt);
-                        }
-                    }
-                }
-                options.put(option, arg);
-            }
-            return false;
-        }
-
-        /** Process the option (without arg). Return true if error detected.
-         */
-        public boolean process(Options options, String option) {
-            if (hasSuffix)
-                return process(options, name.optionName, option.substring(name.optionName.length()));
-            else
-                return process(options, option, option);
-        }
-
-        public OptionKind getKind() { return OptionKind.NORMAL; }
-
-        public OptionName getName() { return name; }
-    };
-
-    /** A nonstandard or extended (-X) option
-     */
-    static class XOption extends Option {
-        XOption(OptionName name, String argsNameKey, String descrKey) {
-            super(name, argsNameKey, descrKey);
-        }
-        XOption(OptionName name, String descrKey) {
-            this(name, null, descrKey);
-        }
-        XOption(OptionName name, String descrKey, ChoiceKind kind, String... choices) {
-            super(name, descrKey, kind, choices);
-        }
-        XOption(OptionName name, String descrKey, ChoiceKind kind, Map<String,Boolean> choices) {
-            super(name, descrKey, kind, choices);
-        }
-        @Override
-        void help(PrintWriter out) {}
-        @Override
-        void xhelp(PrintWriter out) { super.help(out); }
-        @Override
-        public OptionKind getKind() { return OptionKind.EXTENDED; }
-    };
-
-    /** A hidden (implementor) option
-     */
-    static class HiddenOption extends Option {
-        HiddenOption(OptionName name) {
-            super(name, null, null);
-        }
-        HiddenOption(OptionName name, String argsNameKey) {
-            super(name, argsNameKey, null);
-        }
-        @Override
-        void help(PrintWriter out) {}
-        @Override
-        void xhelp(PrintWriter out) {}
-        @Override
-        public OptionKind getKind() { return OptionKind.HIDDEN; }
-    };
-
-}
--- a/src/share/classes/com/sun/tools/javac/main/Main.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Tue May 29 00:27:58 2012 +0100
@@ -31,7 +31,10 @@
 import java.net.URL;
 import java.security.DigestInputStream;
 import java.security.MessageDigest;
-import java.util.MissingResourceException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.annotation.processing.Processor;
@@ -40,12 +43,12 @@
 import com.sun.tools.javac.file.CacheFSInfo;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.jvm.Target;
-import com.sun.tools.javac.main.JavacOption.Option;
-import com.sun.tools.javac.main.RecognizedOptions.OptionHelper;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.Log.WriterKind;
+import com.sun.tools.javac.util.Log.PrefixKind;
 import com.sun.tools.javac.processing.AnnotationProcessingError;
 
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 
 /** This class provides a commandline interface to the GJC compiler.
  *
@@ -64,6 +67,10 @@
      */
     PrintWriter out;
 
+    /** The log to use for diagnostic output.
+     */
+    Log log;
+
     /**
      * If true, certain errors will cause an exception, such as command line
      * arg errors, or exceptions in user provided code.
@@ -73,49 +80,69 @@
 
     /** Result codes.
      */
-    static final int
-        EXIT_OK = 0,        // Compilation completed with no errors.
-        EXIT_ERROR = 1,     // Completed but reported errors.
-        EXIT_CMDERR = 2,    // Bad command-line arguments
-        EXIT_SYSERR = 3,    // System error or resource exhaustion.
-        EXIT_ABNORMAL = 4;  // Compiler terminated abnormally
+    public enum Result {
+        OK(0),        // Compilation completed with no errors.
+        ERROR(1),     // Completed but reported errors.
+        CMDERR(2),    // Bad command-line arguments
+        SYSERR(3),    // System error or resource exhaustion.
+        ABNORMAL(4);  // Compiler terminated abnormally
 
-    private Option[] recognizedOptions = RecognizedOptions.getJavaCompilerOptions(new OptionHelper() {
+        Result(int exitCode) {
+            this.exitCode = exitCode;
+        }
 
-        public void setOut(PrintWriter out) {
-            Main.this.out = out;
+        public boolean isOK() {
+            return (exitCode == 0);
         }
 
+        public final int exitCode;
+    }
+
+    private Option[] recognizedOptions =
+            Option.getJavaCompilerOptions().toArray(new Option[0]);
+
+    private OptionHelper optionHelper = new OptionHelper() {
+        @Override
+        public String get(Option option) {
+            return options.get(option);
+        }
+
+        @Override
+        public void put(String name, String value) {
+            options.put(name, value);
+        }
+
+        @Override
+        public void remove(String name) {
+            options.remove(name);
+        }
+
+        @Override
+        public Log getLog() {
+            return log;
+        }
+
+        @Override
+        public String getOwnName() {
+            return ownName;
+        }
+
+        @Override
         public void error(String key, Object... args) {
             Main.this.error(key, args);
         }
 
-        public void printVersion() {
-            Log.printLines(out, getLocalizedString("version", ownName,  JavaCompiler.version()));
-        }
-
-        public void printFullVersion() {
-            Log.printLines(out, getLocalizedString("fullVersion", ownName,  JavaCompiler.fullVersion()));
+        @Override
+        public void addFile(File f) {
+            filenames.add(f);
         }
 
-        public void printHelp() {
-            help();
-        }
-
-        public void printXhelp() {
-            xhelp();
-        }
-
-        public void addFile(File f) {
-            if (!filenames.contains(f))
-                filenames.append(f);
-        }
-
+        @Override
         public void addClassName(String s) {
             classnames.append(s);
         }
 
-    });
+    };
 
     /**
      * Construct a compiler instance.
@@ -136,48 +163,27 @@
 
     /** The list of source files to process
      */
-    public ListBuffer<File> filenames = null; // XXX sb protected
+    public Set<File> filenames = null; // XXX sb protected
 
     /** List of class files names passed on the command line
      */
     public ListBuffer<String> classnames = null; // XXX sb protected
 
-    /** Print a string that explains usage.
-     */
-    void help() {
-        Log.printLines(out, getLocalizedString("msg.usage.header", ownName));
-        for (int i=0; i<recognizedOptions.length; i++) {
-            recognizedOptions[i].help(out);
-        }
-        out.println();
-    }
-
-    /** Print a string that explains usage for X options.
-     */
-    void xhelp() {
-        for (int i=0; i<recognizedOptions.length; i++) {
-            recognizedOptions[i].xhelp(out);
-        }
-        out.println();
-        Log.printLines(out, getLocalizedString("msg.usage.nonstandard.footer"));
-    }
-
     /** Report a usage error.
      */
     void error(String key, Object... args) {
         if (apiMode) {
-            String msg = getLocalizedString(key, args);
+            String msg = log.localize(PrefixKind.JAVAC, key, args);
             throw new PropagatedException(new IllegalStateException(msg));
         }
         warning(key, args);
-        Log.printLines(out, getLocalizedString("msg.usage", ownName));
+        log.printLines(PrefixKind.JAVAC, "msg.usage", ownName);
     }
 
     /** Report a warning.
      */
     void warning(String key, Object... args) {
-        Log.printLines(out, ownName + ": "
-                       + getLocalizedString(key, args));
+        log.printRawLines(ownName + ": " + log.localize(PrefixKind.JAVAC, key, args));
     }
 
     public Option getOption(String flag) {
@@ -202,7 +208,11 @@
      *  in `options' table and return all source filenames.
      *  @param flags    The array of command line arguments.
      */
-    public List<File> processArgs(String[] flags) { // XXX sb protected
+    public Collection<File> processArgs(String[] flags) { // XXX sb protected
+        return processArgs(flags, null);
+    }
+
+    public Collection<File> processArgs(String[] flags, String[] classNames) { // XXX sb protected
         int ac = 0;
         while (ac < flags.length) {
             String flag = flags[ac];
@@ -235,14 +245,18 @@
                 }
                 String operand = flags[ac];
                 ac++;
-                if (option.process(options, flag, operand))
+                if (option.process(optionHelper, flag, operand))
                     return null;
             } else {
-                if (option.process(options, flag))
+                if (option.process(optionHelper, flag))
                     return null;
             }
         }
 
+        if (this.classnames != null && classNames != null) {
+            this.classnames.addAll(Arrays.asList(classNames));
+        }
+
         if (!checkDirectory(D))
             return null;
         if (!checkDirectory(S))
@@ -294,11 +308,13 @@
             showClass(showClass);
         }
 
-        return filenames.toList();
+        options.notifyListeners();
+
+        return filenames;
     }
     // where
-        private boolean checkDirectory(OptionName optName) {
-            String value = options.get(optName);
+        private boolean checkDirectory(Option option) {
+            String value = options.get(option);
             if (value == null)
                 return true;
             File file = new File(value);
@@ -316,10 +332,10 @@
     /** Programmatic interface for main function.
      * @param args    The command line parameters.
      */
-    public int compile(String[] args) {
+    public Result compile(String[] args) {
         Context context = new Context();
         JavacFileManager.preRegister(context); // can't create it until Log has been set up
-        int result = compile(args, context);
+        Result result = compile(args, context);
         if (fileManager instanceof JavacFileManager) {
             // A fresh context was created above, so jfm must be a JavacFileManager
             ((JavacFileManager)fileManager).close();
@@ -327,22 +343,34 @@
         return result;
     }
 
-    public int compile(String[] args, Context context) {
+    public Result compile(String[] args, Context context) {
         return compile(args, context, List.<JavaFileObject>nil(), null);
     }
 
     /** Programmatic interface for main function.
      * @param args    The command line parameters.
      */
-    public int compile(String[] args,
+    public Result compile(String[] args,
                        Context context,
                        List<JavaFileObject> fileObjects,
                        Iterable<? extends Processor> processors)
     {
+        return compile(args,  null, context, fileObjects, processors);
+    }
+
+    public Result compile(String[] args,
+                       String[] classNames,
+                       Context context,
+                       List<JavaFileObject> fileObjects,
+                       Iterable<? extends Processor> processors)
+    {
+        context.put(Log.outKey, out);
+        log = Log.instance(context);
+
         if (options == null)
             options = Options.instance(context); // creates a new one
 
-        filenames = new ListBuffer<File>();
+        filenames = new LinkedHashSet<File>();
         classnames = new ListBuffer<String>();
         JavaCompiler comp = null;
         /*
@@ -351,46 +379,44 @@
          * into account.
          */
         try {
-            if (args.length == 0 && fileObjects.isEmpty()) {
-                help();
-                return EXIT_CMDERR;
+            if (args.length == 0
+                    && (classNames == null || classNames.length == 0)
+                    && fileObjects.isEmpty()) {
+                Option.HELP.process(optionHelper, "-help");
+                return Result.CMDERR;
             }
 
-            List<File> files;
+            Collection<File> files;
             try {
-                files = processArgs(CommandLine.parse(args));
+                files = processArgs(CommandLine.parse(args), classNames);
                 if (files == null) {
                     // null signals an error in options, abort
-                    return EXIT_CMDERR;
+                    return Result.CMDERR;
                 } else if (files.isEmpty() && fileObjects.isEmpty() && classnames.isEmpty()) {
                     // it is allowed to compile nothing if just asking for help or version info
                     if (options.isSet(HELP)
                         || options.isSet(X)
                         || options.isSet(VERSION)
                         || options.isSet(FULLVERSION))
-                        return EXIT_OK;
+                        return Result.OK;
                     if (JavaCompiler.explicitAnnotationProcessingRequested(options)) {
                         error("err.no.source.files.classes");
                     } else {
                         error("err.no.source.files");
                     }
-                    return EXIT_CMDERR;
+                    return Result.CMDERR;
                 }
             } catch (java.io.FileNotFoundException e) {
-                Log.printLines(out, ownName + ": " +
-                               getLocalizedString("err.file.not.found",
-                                                  e.getMessage()));
-                return EXIT_SYSERR;
+                warning("err.file.not.found", e.getMessage());
+                return Result.SYSERR;
             }
 
             boolean forceStdOut = options.isSet("stdout");
             if (forceStdOut) {
-                out.flush();
-                out = new PrintWriter(System.out, true);
+                log.flush();
+                log.setWriters(new PrintWriter(System.out, true));
             }
 
-            context.put(Log.outKey, out);
-
             // allow System property in following line as a Mustang legacy
             boolean batchMode = (options.isUnset("nonBatchMode")
                         && System.getProperty("nonBatchMode") == null);
@@ -400,9 +426,7 @@
             fileManager = context.get(JavaFileManager.class);
 
             comp = JavaCompiler.instance(context);
-            if (comp == null) return EXIT_SYSERR;
-
-            Log log = Log.instance(context);
+            if (comp == null) return Result.SYSERR;
 
             if (!files.isEmpty()) {
                 // add filenames to fileObjects
@@ -420,33 +444,33 @@
 
             if (log.expectDiagKeys != null) {
                 if (log.expectDiagKeys.isEmpty()) {
-                    Log.printLines(log.noticeWriter, "all expected diagnostics found");
-                    return EXIT_OK;
+                    log.printRawLines("all expected diagnostics found");
+                    return Result.OK;
                 } else {
-                    Log.printLines(log.noticeWriter, "expected diagnostic keys not found: " + log.expectDiagKeys);
-                    return EXIT_ERROR;
+                    log.printRawLines("expected diagnostic keys not found: " + log.expectDiagKeys);
+                    return Result.ERROR;
                 }
             }
 
             if (comp.errorCount() != 0)
-                return EXIT_ERROR;
+                return Result.ERROR;
         } catch (IOException ex) {
             ioMessage(ex);
-            return EXIT_SYSERR;
+            return Result.SYSERR;
         } catch (OutOfMemoryError ex) {
             resourceMessage(ex);
-            return EXIT_SYSERR;
+            return Result.SYSERR;
         } catch (StackOverflowError ex) {
             resourceMessage(ex);
-            return EXIT_SYSERR;
+            return Result.SYSERR;
         } catch (FatalError ex) {
             feMessage(ex);
-            return EXIT_SYSERR;
+            return Result.SYSERR;
         } catch (AnnotationProcessingError ex) {
             if (apiMode)
                 throw new RuntimeException(ex.getCause());
             apMessage(ex);
-            return EXIT_SYSERR;
+            return Result.SYSERR;
         } catch (ClientCodeException ex) {
             // as specified by javax.tools.JavaCompiler#getTask
             // and javax.tools.JavaCompiler.CompilationTask#call
@@ -460,7 +484,7 @@
             if (comp == null || comp.errorCount() == 0 ||
                 options == null || options.isSet("dev"))
                 bugMessage(ex);
-            return EXIT_ABNORMAL;
+            return Result.ABNORMAL;
         } finally {
             if (comp != null) {
                 try {
@@ -472,58 +496,56 @@
             filenames = null;
             options = null;
         }
-        return EXIT_OK;
+        return Result.OK;
     }
 
     /** Print a message reporting an internal error.
      */
     void bugMessage(Throwable ex) {
-        Log.printLines(out, getLocalizedString("msg.bug",
-                                               JavaCompiler.version()));
-        ex.printStackTrace(out);
+        log.printLines(PrefixKind.JAVAC, "msg.bug", JavaCompiler.version());
+        ex.printStackTrace(log.getWriter(WriterKind.NOTICE));
     }
 
     /** Print a message reporting a fatal error.
      */
     void feMessage(Throwable ex) {
-        Log.printLines(out, ex.getMessage());
+        log.printRawLines(ex.getMessage());
         if (ex.getCause() != null && options.isSet("dev")) {
-            ex.getCause().printStackTrace(out);
+            ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE));
         }
     }
 
     /** Print a message reporting an input/output error.
      */
     void ioMessage(Throwable ex) {
-        Log.printLines(out, getLocalizedString("msg.io"));
-        ex.printStackTrace(out);
+        log.printLines(PrefixKind.JAVAC, "msg.io");
+        ex.printStackTrace(log.getWriter(WriterKind.NOTICE));
     }
 
     /** Print a message reporting an out-of-resources error.
      */
     void resourceMessage(Throwable ex) {
-        Log.printLines(out, getLocalizedString("msg.resource"));
-//      System.out.println("(name buffer len = " + Name.names.length + " " + Name.nc);//DEBUG
-        ex.printStackTrace(out);
+        log.printLines(PrefixKind.JAVAC, "msg.resource");
+        ex.printStackTrace(log.getWriter(WriterKind.NOTICE));
     }
 
     /** Print a message reporting an uncaught exception from an
      * annotation processor.
      */
     void apMessage(AnnotationProcessingError ex) {
-        Log.printLines(out,
-                       getLocalizedString("msg.proc.annotation.uncaught.exception"));
-        ex.getCause().printStackTrace(out);
+        log.printLines("msg.proc.annotation.uncaught.exception");
+        ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE));
     }
 
     /** Display the location and checksum of a class. */
     void showClass(String className) {
-        out.println("javac: show class: " + className);
+        PrintWriter pw = log.getWriter(WriterKind.NOTICE);
+        pw.println("javac: show class: " + className);
         URL url = getClass().getResource('/' + className.replace('.', '/') + ".class");
         if (url == null)
-            out.println("  class not found");
+            pw.println("  class not found");
         else {
-            out.println("  " + url);
+            pw.println("  " + url);
             try {
                 final String algorithm = "MD5";
                 byte[] digest;
@@ -540,9 +562,9 @@
                 StringBuilder sb = new StringBuilder();
                 for (byte b: digest)
                     sb.append(String.format("%02x", b));
-                out.println("  " + algorithm + " checksum: " + sb);
+                pw.println("  " + algorithm + " checksum: " + sb);
             } catch (Exception e) {
-                out.println("  cannot compute digest: " + e);
+                pw.println("  cannot compute digest: " + e);
             }
         }
     }
@@ -553,35 +575,35 @@
      * Internationalization
      *************************************************************************/
 
-    /** Find a localized string in the resource bundle.
-     *  @param key     The key for the localized string.
-     */
-    public static String getLocalizedString(String key, Object... args) { // FIXME sb private
-        try {
-            if (messages == null)
-                messages = new JavacMessages(javacBundleName);
-            return messages.getLocalizedString("javac." + key, args);
-        }
-        catch (MissingResourceException e) {
-            throw new Error("Fatal Error: Resource for javac is missing", e);
-        }
-    }
+//    /** Find a localized string in the resource bundle.
+//     *  @param key     The key for the localized string.
+//     */
+//    public static String getLocalizedString(String key, Object... args) { // FIXME sb private
+//        try {
+//            if (messages == null)
+//                messages = new JavacMessages(javacBundleName);
+//            return messages.getLocalizedString("javac." + key, args);
+//        }
+//        catch (MissingResourceException e) {
+//            throw new Error("Fatal Error: Resource for javac is missing", e);
+//        }
+//    }
+//
+//    public static void useRawMessages(boolean enable) {
+//        if (enable) {
+//            messages = new JavacMessages(javacBundleName) {
+//                    @Override
+//                    public String getLocalizedString(String key, Object... args) {
+//                        return key;
+//                    }
+//                };
+//        } else {
+//            messages = new JavacMessages(javacBundleName);
+//        }
+//    }
 
-    public static void useRawMessages(boolean enable) {
-        if (enable) {
-            messages = new JavacMessages(javacBundleName) {
-                    @Override
-                    public String getLocalizedString(String key, Object... args) {
-                        return key;
-                    }
-                };
-        } else {
-            messages = new JavacMessages(javacBundleName);
-        }
-    }
-
-    private static final String javacBundleName =
+    public static final String javacBundleName =
         "com.sun.tools.javac.resources.javac";
-
-    private static JavacMessages messages;
+//
+//    private static JavacMessages messages;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/main/Option.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,712 @@
+/*
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.main;
+
+import java.util.Collections;
+import com.sun.tools.javac.util.Log.PrefixKind;
+import com.sun.tools.javac.util.Log.WriterKind;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.code.Lint;
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.util.Options;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.EnumSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import javax.lang.model.SourceVersion;
+
+import static com.sun.tools.javac.main.Option.ChoiceKind.*;
+import static com.sun.tools.javac.main.Option.OptionKind.*;
+import static com.sun.tools.javac.main.Option.OptionGroup.*;
+
+/**
+ * Options for javac. The specific Option to handle a command-line option
+ * is identified by searching the members of this enum in order, looking
+ * the first {@link #matches match}. The action for an Option is performed
+ * by calling {@link #process process}, and by providing a suitable
+ * {@link OptionHelper} to provide access the compiler state.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public enum Option {
+    G("-g", "opt.g", STANDARD, BASIC),
+
+    G_NONE("-g:none", "opt.g.none", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            helper.put("-g:", "none");
+            return false;
+        }
+    },
+
+    G_CUSTOM("-g:",  "opt.g.lines.vars.source",
+            STANDARD, BASIC, ANYOF, "lines", "vars", "source"),
+
+    XLINT("-Xlint", "opt.Xlint", EXTENDED, BASIC),
+
+    XLINT_CUSTOM("-Xlint:", "opt.Xlint.suboptlist",
+            EXTENDED,   BASIC, ANYOF, getXLintChoices()),
+
+    // -nowarn is retained for command-line backward compatibility
+    NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            helper.put("-Xlint:none", option);
+            return false;
+        }
+    },
+
+    VERBOSE("-verbose", "opt.verbose", STANDARD, BASIC),
+
+    // -deprecation is retained for command-line backward compatibility
+    DEPRECATION("-deprecation", "opt.deprecation", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            helper.put("-Xlint:deprecation", option);
+            return false;
+        }
+    },
+
+    CLASSPATH("-classpath", "opt.arg.path", "opt.classpath", STANDARD, FILEMANAGER),
+
+    CP("-cp", "opt.arg.path", "opt.classpath", STANDARD, FILEMANAGER) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String arg) {
+            return super.process(helper, "-classpath", arg);
+        }
+    },
+
+    SOURCEPATH("-sourcepath", "opt.arg.path", "opt.sourcepath", STANDARD, FILEMANAGER),
+
+    BOOTCLASSPATH("-bootclasspath", "opt.arg.path", "opt.bootclasspath", STANDARD, FILEMANAGER) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String arg) {
+            helper.remove("-Xbootclasspath/p:");
+            helper.remove("-Xbootclasspath/a:");
+            return super.process(helper, option, arg);
+        }
+    },
+
+    XBOOTCLASSPATH_PREPEND("-Xbootclasspath/p:", "opt.arg.path", "opt.Xbootclasspath.p", EXTENDED, FILEMANAGER),
+
+    XBOOTCLASSPATH_APPEND("-Xbootclasspath/a:", "opt.arg.path", "opt.Xbootclasspath.a", EXTENDED, FILEMANAGER),
+
+    XBOOTCLASSPATH("-Xbootclasspath:", "opt.arg.path", "opt.bootclasspath", EXTENDED, FILEMANAGER) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String arg) {
+            helper.remove("-Xbootclasspath/p:");
+            helper.remove("-Xbootclasspath/a:");
+            return super.process(helper, "-bootclasspath", arg);
+        }
+    },
+
+    EXTDIRS("-extdirs", "opt.arg.dirs", "opt.extdirs", STANDARD, FILEMANAGER),
+
+    DJAVA_EXT_DIRS("-Djava.ext.dirs=", "opt.arg.dirs", "opt.extdirs", EXTENDED, FILEMANAGER) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String arg) {
+            return super.process(helper, "-extdirs", arg);
+        }
+    },
+
+    ENDORSEDDIRS("-endorseddirs", "opt.arg.dirs", "opt.endorseddirs", STANDARD, FILEMANAGER),
+
+    DJAVA_ENDORSED_DIRS("-Djava.endorsed.dirs=", "opt.arg.dirs", "opt.endorseddirs", EXTENDED, FILEMANAGER) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String arg) {
+            return super.process(helper, "-endorseddirs", arg);
+        }
+    },
+
+    PROC("-proc:", "opt.proc.none.only", STANDARD, BASIC,  ONEOF, "none", "only"),
+
+    PROCESSOR("-processor", "opt.arg.class.list", "opt.processor", STANDARD, BASIC),
+
+    PROCESSORPATH("-processorpath", "opt.arg.path", "opt.processorpath", STANDARD, FILEMANAGER),
+
+    D("-d", "opt.arg.directory", "opt.d", STANDARD, FILEMANAGER),
+
+    S("-s", "opt.arg.directory", "opt.sourceDest", STANDARD, FILEMANAGER),
+
+    H("-h", "opt.arg.directory", "opt.headerDest", STANDARD, FILEMANAGER),
+
+    IMPLICIT("-implicit:", "opt.implicit", STANDARD, BASIC, ONEOF, "none", "class"),
+
+    ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String operand) {
+//            System.err.println("process encoding " + operand);
+            return super.process(helper, option, operand);
+        }
+
+    },
+
+    SOURCE("-source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String operand) {
+            Source source = Source.lookup(operand);
+            if (source == null) {
+                helper.error("err.invalid.source", operand);
+                return true;
+            }
+            return super.process(helper, option, operand);
+        }
+    },
+
+    TARGET("-target", "opt.arg.release", "opt.target", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String operand) {
+            Target target = Target.lookup(operand);
+            if (target == null) {
+                helper.error("err.invalid.target", operand);
+                return true;
+            }
+            return super.process(helper, option, operand);
+        }
+    },
+
+    VERSION("-version", "opt.version", STANDARD, INFO) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            Log log = helper.getLog();
+            String ownName = helper.getOwnName();
+            log.printLines(PrefixKind.JAVAC, "version", ownName,  JavaCompiler.version());
+            return super.process(helper, option);
+        }
+    },
+
+    FULLVERSION("-fullversion", null, HIDDEN, INFO) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            Log log = helper.getLog();
+            String ownName = helper.getOwnName();
+            log.printLines(PrefixKind.JAVAC, "fullVersion", ownName,  JavaCompiler.fullVersion());
+            return super.process(helper, option);
+        }
+    },
+
+    DIAGS("-XDdiags=", null, HIDDEN, INFO) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            option = option.substring(option.indexOf('=') + 1);
+            String diagsOption = option.contains("%") ?
+                "-XDdiagsFormat=" :
+                "-XDdiags=";
+            diagsOption += option;
+            if (XD.matches(diagsOption))
+                return XD.process(helper, diagsOption);
+            else
+                return false;
+        }
+    },
+
+    HELP("-help", "opt.help", STANDARD, INFO) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            Log log = helper.getLog();
+            String ownName = helper.getOwnName();
+            log.printLines(PrefixKind.JAVAC, "msg.usage.header", ownName);
+            for (Option o: getJavaCompilerOptions()) {
+                o.help(log, OptionKind.STANDARD);
+            }
+            log.printNewline();
+            return super.process(helper, option);
+        }
+    },
+
+    A("-A", "opt.arg.key.equals.value", "opt.A", STANDARD, BASIC) {
+        { hasSuffix = true; }
+
+        @Override
+        public boolean matches(String arg) {
+            return arg.startsWith("-A");
+        }
+
+        @Override
+        public boolean hasArg() {
+            return false;
+        }
+        // Mapping for processor options created in
+        // JavacProcessingEnvironment
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            int argLength = option.length();
+            if (argLength == 2) {
+                helper.error("err.empty.A.argument");
+                return true;
+            }
+            int sepIndex = option.indexOf('=');
+            String key = option.substring(2, (sepIndex != -1 ? sepIndex : argLength) );
+            if (!JavacProcessingEnvironment.isValidOptionName(key)) {
+                helper.error("err.invalid.A.key", option);
+                return true;
+            }
+            return process(helper, option, option);
+        }
+    },
+
+    X("-X", "opt.X", STANDARD, INFO) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            Log log = helper.getLog();
+            for (Option o: getJavaCompilerOptions()) {
+                o.help(log, OptionKind.EXTENDED);
+            }
+            log.printNewline();
+            log.printLines(PrefixKind.JAVAC, "msg.usage.nonstandard.footer");
+            return super.process(helper, option);
+        }
+    },
+
+    // This option exists only for the purpose of documenting itself.
+    // It's actually implemented by the launcher.
+    J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO) {
+        { hasSuffix = true; }
+
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            throw new AssertionError
+                ("the -J flag should be caught by the launcher.");
+        }
+    },
+
+    // stop after parsing and attributing.
+    // new HiddenOption("-attrparseonly"),
+
+    // new Option("-moreinfo",                                      "opt.moreinfo") {
+    MOREINFO("-moreinfo", null, HIDDEN, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            Type.moreInfo = true;
+            return super.process(helper, option);
+        }
+    },
+
+    // treat warnings as errors
+    WERROR("-Werror", "opt.Werror", STANDARD, BASIC),
+
+//    // use complex inference from context in the position of a method call argument
+//    COMPLEXINFERENCE("-complexinference", null, HIDDEN, BASIC),
+
+    // generare source stubs
+    // new HiddenOption("-stubs"),
+
+    // relax some constraints to allow compiling from stubs
+    // new HiddenOption("-relax"),
+
+    // output source after translating away inner classes
+    // new Option("-printflat",                             "opt.printflat"),
+    // new HiddenOption("-printflat"),
+
+    // display scope search details
+    // new Option("-printsearch",                           "opt.printsearch"),
+    // new HiddenOption("-printsearch"),
+
+    // prompt after each error
+    // new Option("-prompt",                                        "opt.prompt"),
+    PROMPT("-prompt", null, HIDDEN, BASIC),
+
+    // dump stack on error
+    DOE("-doe", null, HIDDEN, BASIC),
+
+    // output source after type erasure
+    // new Option("-s",                                     "opt.s"),
+    PRINTSOURCE("-printsource", null, HIDDEN, BASIC),
+
+    // output shrouded class files
+    // new Option("-scramble",                              "opt.scramble"),
+    // new Option("-scrambleall",                           "opt.scrambleall"),
+
+    // display warnings for generic unchecked operations
+    WARNUNCHECKED("-warnunchecked", null, HIDDEN, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            helper.put("-Xlint:unchecked", option);
+            return false;
+        }
+    },
+
+    XMAXERRS("-Xmaxerrs", "opt.arg.number", "opt.maxerrs", EXTENDED, BASIC),
+
+    XMAXWARNS("-Xmaxwarns", "opt.arg.number", "opt.maxwarns", EXTENDED, BASIC),
+
+    XSTDOUT("-Xstdout", "opt.arg.file", "opt.Xstdout", EXTENDED, INFO) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String arg) {
+            try {
+                Log log = helper.getLog();
+                // TODO: this file should be closed at the end of compilation
+                log.setWriters(new PrintWriter(new FileWriter(arg), true));
+            } catch (java.io.IOException e) {
+                helper.error("err.error.writing.file", arg, e);
+                return true;
+            }
+            return super.process(helper, option, arg);
+        }
+    },
+
+    XPRINT("-Xprint", "opt.print", EXTENDED, BASIC),
+
+    XPRINTROUNDS("-XprintRounds", "opt.printRounds", EXTENDED, BASIC),
+
+    XPRINTPROCESSORINFO("-XprintProcessorInfo", "opt.printProcessorInfo", EXTENDED, BASIC),
+
+    XPREFER("-Xprefer:", "opt.prefer", EXTENDED, BASIC, ONEOF, "source", "newer"),
+
+    XPKGINFO("-Xpkginfo:", "opt.pkginfo", EXTENDED, BASIC, ONEOF, "always", "legacy", "nonempty"),
+
+    /* -O is a no-op, accepted for backward compatibility. */
+    O("-O", null, HIDDEN, BASIC),
+
+    /* -Xjcov produces tables to support the code coverage tool jcov. */
+    XJCOV("-Xjcov", null, HIDDEN, BASIC),
+
+    /* This is a back door to the compiler's option table.
+     * -XDx=y sets the option x to the value y.
+     * -XDx sets the option x to the value x.
+     */
+    XD("-XD", null, HIDDEN, BASIC) {
+        String s;
+        @Override
+        public boolean matches(String s) {
+            this.s = s;
+            return s.startsWith(text);
+        }
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            s = s.substring(text.length());
+            int eq = s.indexOf('=');
+            String key = (eq < 0) ? s : s.substring(0, eq);
+            String value = (eq < 0) ? s : s.substring(eq+1);
+            helper.put(key, value);
+            return false;
+        }
+    },
+
+    // This option exists only for the purpose of documenting itself.
+    // It's actually implemented by the CommandLine class.
+    AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO) {
+        { hasSuffix = true; }
+
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            throw new AssertionError("the @ flag should be caught by CommandLine.");
+        }
+    },
+
+    /*
+     * TODO: With apt, the matches method accepts anything if
+     * -XclassAsDecls is used; code elsewhere does the lookup to
+     * see if the class name is both legal and found.
+     *
+     * In apt, the process method adds the candidate class file
+     * name to a separate list.
+     */
+    SOURCEFILE("sourcefile", null, HIDDEN, INFO) {
+        String s;
+        @Override
+        public boolean matches(String s) {
+            this.s = s;
+            return s.endsWith(".java")  // Java source file
+                || SourceVersion.isName(s);   // Legal type name
+        }
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            if (s.endsWith(".java") ) {
+                File f = new File(s);
+                if (!f.exists()) {
+                    helper.error("err.file.not.found", f);
+                    return true;
+                }
+                if (!f.isFile()) {
+                    helper.error("err.file.not.file", f);
+                    return true;
+                }
+                helper.addFile(f);
+            }
+            else
+                helper.addClassName(s);
+            return false;
+        }
+    };
+
+    /** The kind of an Option. This is used by the -help and -X options. */
+    public enum OptionKind {
+        /** A standard option, documented by -help. */
+        STANDARD,
+        /** An extended option, documented by -X. */
+        EXTENDED,
+        /** A hidden option, not documented. */
+        HIDDEN,
+    }
+
+    /** The group for an Option. This determines the situations in which the
+     *  option is applicable. */
+    enum OptionGroup {
+        /** A basic option, available for use on the command line or via the
+         *  Compiler API. */
+        BASIC,
+        /** An option for javac's standard JavaFileManager. Other file managers
+         *  may or may not support these options. */
+        FILEMANAGER,
+        /** A command-line option that requests information, such as -help. */
+        INFO,
+        /** A command-line "option" representing a file or class name. */
+        OPERAND
+    }
+
+    /** The kind of choice for "choice" options. */
+    enum ChoiceKind {
+        /** The expected value is exactly one of the set of choices. */
+        ONEOF,
+        /** The expected value is one of more of the set of choices. */
+        ANYOF
+    }
+
+    public final String text;
+
+    final OptionKind kind;
+
+    final OptionGroup group;
+
+    /** Documentation key for arguments.
+     */
+    final String argsNameKey;
+
+    /** Documentation key for description.
+     */
+    final String descrKey;
+
+    /** Suffix option (-foo=bar or -foo:bar)
+     */
+    boolean hasSuffix;
+
+    /** The kind of choices for this option, if any.
+     */
+    final ChoiceKind choiceKind;
+
+    /** The choices for this option, if any, and whether or not the choices
+     *  are hidden
+     */
+    final Map<String,Boolean> choices;
+
+
+    Option(String text, String descrKey,
+            OptionKind kind, OptionGroup group) {
+        this(text, null, descrKey, kind, group, null, null);
+    }
+
+    Option(String text, String argsNameKey, String descrKey,
+            OptionKind kind, OptionGroup group) {
+        this(text, argsNameKey, descrKey, kind, group, null, null);
+    }
+
+    Option(String text, String descrKey,
+            OptionKind kind, OptionGroup group,
+            ChoiceKind choiceKind, Map<String,Boolean> choices) {
+        this(text, null, descrKey, kind, group, choiceKind, choices);
+    }
+
+    Option(String text, String descrKey,
+            OptionKind kind, OptionGroup group,
+            ChoiceKind choiceKind, String... choices) {
+        this(text, null, descrKey, kind, group, choiceKind, createChoices(choices));
+    }
+    // where
+        private static Map<String,Boolean> createChoices(String... choices) {
+            Map<String,Boolean> map = new LinkedHashMap<String,Boolean>();
+            for (String c: choices)
+                map.put(c, false);
+            return map;
+        }
+
+    private Option(String text, String argsNameKey, String descrKey,
+            OptionKind kind, OptionGroup group,
+            ChoiceKind choiceKind, Map<String,Boolean> choices) {
+        this.text = text;
+        this.argsNameKey = argsNameKey;
+        this.descrKey = descrKey;
+        this.kind = kind;
+        this.group = group;
+        this.choiceKind = choiceKind;
+        this.choices = choices;
+        char lastChar = text.charAt(text.length()-1);
+        hasSuffix = lastChar == ':' || lastChar == '=';
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public OptionKind getKind() {
+        return kind;
+    }
+
+    public boolean hasArg() {
+        return argsNameKey != null && !hasSuffix;
+    }
+
+    public boolean matches(String option) {
+        if (!hasSuffix)
+            return option.equals(text);
+
+        if (!option.startsWith(text))
+            return false;
+
+        if (choices != null) {
+            String arg = option.substring(text.length());
+            if (choiceKind == ChoiceKind.ONEOF)
+                return choices.keySet().contains(arg);
+            else {
+                for (String a: arg.split(",+")) {
+                    if (!choices.keySet().contains(a))
+                        return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    public boolean process(OptionHelper helper, String option, String arg) {
+        if (choices != null) {
+            if (choiceKind == ChoiceKind.ONEOF) {
+                // some clients like to see just one of option+choice set
+                for (String s: choices.keySet())
+                    helper.remove(option + s);
+                String opt = option + arg;
+                helper.put(opt, opt);
+                // some clients like to see option (without trailing ":")
+                // set to arg
+                String nm = option.substring(0, option.length() - 1);
+                helper.put(nm, arg);
+            } else {
+                // set option+word for each word in arg
+                for (String a: arg.split(",+")) {
+                    String opt = option + a;
+                    helper.put(opt, opt);
+                }
+            }
+        }
+        helper.put(option, arg);
+        return false;
+    }
+
+    public boolean process(OptionHelper helper, String option) {
+        if (hasSuffix)
+            return process(helper, text, option.substring(text.length()));
+        else
+            return process(helper, option, option);
+    }
+
+    void help(Log log, OptionKind kind) {
+        if (this.kind != kind)
+            return;
+
+        log.printRawLines(WriterKind.NOTICE,
+                String.format("  %-26s %s",
+                    helpSynopsis(log),
+                    log.localize(PrefixKind.JAVAC, descrKey)));
+
+    }
+
+    private String helpSynopsis(Log log) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(text);
+        if (argsNameKey == null) {
+            if (choices != null) {
+                String sep = "{";
+                for (Map.Entry<String,Boolean> e: choices.entrySet()) {
+                    if (!e.getValue()) {
+                        sb.append(sep);
+                        sb.append(e.getKey());
+                        sep = ",";
+                    }
+                }
+                sb.append("}");
+            }
+        } else {
+            if (!hasSuffix)
+                sb.append(" ");
+            sb.append(log.localize(PrefixKind.JAVAC, argsNameKey));
+
+        }
+
+        return sb.toString();
+    }
+
+    // For -XpkgInfo:value
+    public enum PkgInfo {
+        ALWAYS, LEGACY, NONEMPTY;
+        public static PkgInfo get(Options options) {
+            String v = options.get(XPKGINFO);
+            return (v == null
+                    ? PkgInfo.LEGACY
+                    : PkgInfo.valueOf(v.toUpperCase()));
+        }
+    }
+
+    private static Map<String,Boolean> getXLintChoices() {
+        Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>();
+        choices.put("all", false);
+        for (Lint.LintCategory c : Lint.LintCategory.values())
+            choices.put(c.option, c.hidden);
+        for (Lint.LintCategory c : Lint.LintCategory.values())
+            choices.put("-" + c.option, c.hidden);
+        choices.put("none", false);
+        return choices;
+    }
+
+    static Set<Option> getJavaCompilerOptions() {
+        return EnumSet.allOf(Option.class);
+    }
+
+    public static Set<Option> getJavacFileManagerOptions() {
+        return getOptions(EnumSet.of(FILEMANAGER));
+    }
+
+    public static Set<Option> getJavacToolOptions() {
+        return getOptions(EnumSet.of(BASIC));
+    }
+
+    static Set<Option> getOptions(Set<OptionGroup> desired) {
+        Set<Option> options = EnumSet.noneOf(Option.class);
+        for (Option option : Option.values())
+            if (desired.contains(option.group))
+                options.add(option);
+        return Collections.unmodifiableSet(options);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/main/OptionHelper.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.main;
+
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Log.PrefixKind;
+import java.io.File;
+
+/**
+ * Helper object to be used by {@link Option#process}, providing access to
+ * the compilation environment.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+
+public abstract class OptionHelper {
+
+    /** Get the current value of an option. */
+    public abstract String get(Option option);
+
+    /** Set the value of an option. */
+    public abstract void put(String name, String value);
+
+    /** Remove any prior value for an option. */
+    public abstract void remove(String name);
+
+    /** Get access to the Log for the compilation. */
+    public abstract Log getLog();
+
+    /** Get the name of the tool, such as "javac", to be used in info like -help. */
+    public abstract String getOwnName();
+
+    /** Report an error. */
+    abstract void error(String key, Object... args);
+
+    /** Record a file to be compiled. */
+    abstract void addFile(File f);
+
+    /** Record the name of a class for annotation processing. */
+    abstract void addClassName(String s);
+
+    /** An implementation of OptionHelper that mostly throws exceptions. */
+    public static class GrumpyHelper extends OptionHelper {
+        private final Log log;
+
+        public GrumpyHelper(Log log) {
+            this.log = log;
+        }
+
+        @Override
+        public Log getLog() {
+            return log;
+        }
+
+        @Override
+        public String getOwnName() {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public String get(Option option) {
+            throw new IllegalArgumentException();
+        }
+
+        @Override
+        public void put(String name, String value) {
+            throw new IllegalArgumentException();
+        }
+
+        @Override
+        public void remove(String name) {
+            throw new IllegalArgumentException();
+        }
+
+        @Override
+        void error(String key, Object... args) {
+            throw new IllegalArgumentException(log.localize(PrefixKind.JAVAC, key, args));
+        }
+
+        @Override
+        public void addFile(File f) {
+            throw new IllegalArgumentException(f.getPath());
+        }
+
+        @Override
+        public void addClassName(String s) {
+            throw new IllegalArgumentException(s);
+        }
+    }
+
+}
--- a/src/share/classes/com/sun/tools/javac/main/OptionName.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.main;
-
-
-/**
- * TODO: describe com.sun.tools.javac.main.OptionName
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk.  This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public enum OptionName {
-    G("-g"),
-    G_NONE("-g:none"),
-    G_CUSTOM("-g:"),
-    XLINT("-Xlint"),
-    XLINT_CUSTOM("-Xlint:"),
-    DIAGS("-XDdiags="),
-    NOWARN("-nowarn"),
-    VERBOSE("-verbose"),
-    DEPRECATION("-deprecation"),
-    CLASSPATH("-classpath"),
-    CP("-cp"),
-    SOURCEPATH("-sourcepath"),
-    BOOTCLASSPATH("-bootclasspath"),
-    XBOOTCLASSPATH_PREPEND("-Xbootclasspath/p:"),
-    XBOOTCLASSPATH_APPEND("-Xbootclasspath/a:"),
-    XBOOTCLASSPATH("-Xbootclasspath:"),
-    EXTDIRS("-extdirs"),
-    DJAVA_EXT_DIRS("-Djava.ext.dirs="),
-    ENDORSEDDIRS("-endorseddirs"),
-    DJAVA_ENDORSED_DIRS("-Djava.endorsed.dirs="),
-    PROC("-proc:"),
-    PROCESSOR("-processor"),
-    PROCESSORPATH("-processorpath"),
-    D("-d"),
-    S("-s"),
-    IMPLICIT("-implicit:"),
-    ENCODING("-encoding"),
-    SOURCE("-source"),
-    TARGET("-target"),
-    VERSION("-version"),
-    FULLVERSION("-fullversion"),
-    HELP("-help"),
-    A("-A"),
-    X("-X"),
-    J("-J"),
-    MOREINFO("-moreinfo"),
-    WERROR("-Werror"),
-    COMPLEXINFERENCE("-complexinference"),
-    PROMPT("-prompt"),
-    DOE("-doe"),
-    PRINTSOURCE("-printsource"),
-    WARNUNCHECKED("-warnunchecked"),
-    XMAXERRS("-Xmaxerrs"),
-    XMAXWARNS("-Xmaxwarns"),
-    XSTDOUT("-Xstdout"),
-    XPKGINFO("-Xpkginfo:"),
-    XPRINT("-Xprint"),
-    XPRINTROUNDS("-XprintRounds"),
-    XPRINTPROCESSORINFO("-XprintProcessorInfo"),
-    XPREFER("-Xprefer:"),
-    O("-O"),
-    XJCOV("-Xjcov"),
-    XD("-XD"),
-    AT("@"),
-    SOURCEFILE("sourcefile");
-
-    public final String optionName;
-
-    OptionName(String optionName) {
-        this.optionName = optionName;
-    }
-
-    @Override
-    public String toString() {
-        return optionName;
-    }
-
-}
--- a/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,643 +0,0 @@
-/*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.main;
-
-import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.code.Source;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.jvm.Target;
-import com.sun.tools.javac.main.JavacOption.HiddenOption;
-import com.sun.tools.javac.main.JavacOption.Option;
-import com.sun.tools.javac.main.JavacOption.XOption;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Options;
-import com.sun.tools.javac.processing.JavacProcessingEnvironment;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.EnumSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import javax.lang.model.SourceVersion;
-
-import static com.sun.tools.javac.main.OptionName.*;
-
-/**
- * TODO: describe com.sun.tools.javac.main.RecognizedOptions
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk.  This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public class RecognizedOptions {
-
-    private RecognizedOptions() {}
-
-    public interface OptionHelper {
-
-        void setOut(PrintWriter out);
-
-        void error(String key, Object... args);
-
-        void printVersion();
-
-        void printFullVersion();
-
-        void printHelp();
-
-        void printXhelp();
-
-        void addFile(File f);
-
-        void addClassName(String s);
-
-    }
-
-    public static class GrumpyHelper implements OptionHelper {
-
-        public void setOut(PrintWriter out) {
-            throw new IllegalArgumentException();
-        }
-
-        public void error(String key, Object... args) {
-            throw new IllegalArgumentException(Main.getLocalizedString(key, args));
-        }
-
-        public void printVersion() {
-            throw new IllegalArgumentException();
-        }
-
-        public void printFullVersion() {
-            throw new IllegalArgumentException();
-        }
-
-        public void printHelp() {
-            throw new IllegalArgumentException();
-        }
-
-        public void printXhelp() {
-            throw new IllegalArgumentException();
-        }
-
-        public void addFile(File f) {
-            throw new IllegalArgumentException(f.getPath());
-        }
-
-        public void addClassName(String s) {
-            throw new IllegalArgumentException(s);
-        }
-
-    }
-
-    static Set<OptionName> javacOptions = EnumSet.of(
-        G,
-        G_NONE,
-        G_CUSTOM,
-        XLINT,
-        XLINT_CUSTOM,
-        NOWARN,
-        VERBOSE,
-        DEPRECATION,
-        CLASSPATH,
-        CP,
-        SOURCEPATH,
-        BOOTCLASSPATH,
-        XBOOTCLASSPATH_PREPEND,
-        XBOOTCLASSPATH_APPEND,
-        XBOOTCLASSPATH,
-        EXTDIRS,
-        DJAVA_EXT_DIRS,
-        ENDORSEDDIRS,
-        DJAVA_ENDORSED_DIRS,
-        PROC,
-        PROCESSOR,
-        PROCESSORPATH,
-        D,
-        S,
-        IMPLICIT,
-        ENCODING,
-        SOURCE,
-        TARGET,
-        VERSION,
-        FULLVERSION,
-        DIAGS,
-        HELP,
-        A,
-        X,
-        J,
-        MOREINFO,
-        WERROR,
-        // COMPLEXINFERENCE,
-        PROMPT,
-        DOE,
-        PRINTSOURCE,
-        WARNUNCHECKED,
-        XMAXERRS,
-        XMAXWARNS,
-        XSTDOUT,
-        XPKGINFO,
-        XPRINT,
-        XPRINTROUNDS,
-        XPRINTPROCESSORINFO,
-        XPREFER,
-        O,
-        XJCOV,
-        XD,
-        AT,
-        SOURCEFILE);
-
-    static Set<OptionName> javacFileManagerOptions = EnumSet.of(
-        CLASSPATH,
-        CP,
-        SOURCEPATH,
-        BOOTCLASSPATH,
-        XBOOTCLASSPATH_PREPEND,
-        XBOOTCLASSPATH_APPEND,
-        XBOOTCLASSPATH,
-        EXTDIRS,
-        DJAVA_EXT_DIRS,
-        ENDORSEDDIRS,
-        DJAVA_ENDORSED_DIRS,
-        PROCESSORPATH,
-        D,
-        S,
-        ENCODING,
-        SOURCE);
-
-    static Set<OptionName> javacToolOptions = EnumSet.of(
-        G,
-        G_NONE,
-        G_CUSTOM,
-        XLINT,
-        XLINT_CUSTOM,
-        NOWARN,
-        VERBOSE,
-        DEPRECATION,
-        PROC,
-        PROCESSOR,
-        IMPLICIT,
-        SOURCE,
-        TARGET,
-        // VERSION,
-        // FULLVERSION,
-        // HELP,
-        A,
-        // X,
-        // J,
-        MOREINFO,
-        WERROR,
-        // COMPLEXINFERENCE,
-        PROMPT,
-        DOE,
-        PRINTSOURCE,
-        WARNUNCHECKED,
-        XMAXERRS,
-        XMAXWARNS,
-        // XSTDOUT,
-        XPKGINFO,
-        XPRINT,
-        XPRINTROUNDS,
-        XPRINTPROCESSORINFO,
-        XPREFER,
-        O,
-        XJCOV,
-        XD);
-
-    static Option[] getJavaCompilerOptions(OptionHelper helper) {
-        return getOptions(helper, javacOptions);
-    }
-
-    public static Option[] getJavacFileManagerOptions(OptionHelper helper) {
-        return getOptions(helper, javacFileManagerOptions);
-    }
-
-    public static Option[] getJavacToolOptions(OptionHelper helper) {
-        return getOptions(helper, javacToolOptions);
-    }
-
-    static Option[] getOptions(OptionHelper helper, Set<OptionName> desired) {
-        ListBuffer<Option> options = new ListBuffer<Option>();
-        for (Option option : getAll(helper))
-            if (desired.contains(option.getName()))
-                options.append(option);
-        return options.toArray(new Option[options.length()]);
-    }
-
-    /**
-     * Get all the recognized options.
-     * @param helper an {@code OptionHelper} to help when processing options
-     * @return an array of options
-     */
-    public static Option[] getAll(final OptionHelper helper) {
-        return new Option[] {
-        new Option(G,                                           "opt.g"),
-        new Option(G_NONE,                                      "opt.g.none") {
-            @Override
-            public boolean process(Options options, String option) {
-                options.put("-g:", "none");
-                return false;
-            }
-        },
-
-        new Option(G_CUSTOM,                                    "opt.g.lines.vars.source",
-                Option.ChoiceKind.ANYOF, "lines", "vars", "source"),
-
-        new XOption(XLINT,                                      "opt.Xlint"),
-        new XOption(XLINT_CUSTOM,                               "opt.Xlint.suboptlist",
-                Option.ChoiceKind.ANYOF, getXLintChoices()),
-
-        // -nowarn is retained for command-line backward compatibility
-        new Option(NOWARN,                                      "opt.nowarn") {
-            @Override
-            public boolean process(Options options, String option) {
-                options.put("-Xlint:none", option);
-                return false;
-            }
-        },
-
-        new Option(VERBOSE,                                     "opt.verbose"),
-
-        // -deprecation is retained for command-line backward compatibility
-        new Option(DEPRECATION,                                 "opt.deprecation") {
-            @Override
-            public boolean process(Options options, String option) {
-                options.put("-Xlint:deprecation", option);
-                return false;
-            }
-        },
-
-        new Option(CLASSPATH,              "opt.arg.path",      "opt.classpath"),
-        new Option(CP,                     "opt.arg.path",      "opt.classpath") {
-            @Override
-            public boolean process(Options options, String option, String arg) {
-                return super.process(options, "-classpath", arg);
-            }
-        },
-        new Option(SOURCEPATH,             "opt.arg.path",      "opt.sourcepath"),
-        new Option(BOOTCLASSPATH,          "opt.arg.path",      "opt.bootclasspath") {
-            @Override
-            public boolean process(Options options, String option, String arg) {
-                options.remove("-Xbootclasspath/p:");
-                options.remove("-Xbootclasspath/a:");
-                return super.process(options, option, arg);
-            }
-        },
-        new XOption(XBOOTCLASSPATH_PREPEND,"opt.arg.path", "opt.Xbootclasspath.p"),
-        new XOption(XBOOTCLASSPATH_APPEND, "opt.arg.path", "opt.Xbootclasspath.a"),
-        new XOption(XBOOTCLASSPATH,        "opt.arg.path", "opt.bootclasspath") {
-            @Override
-            public boolean process(Options options, String option, String arg) {
-                options.remove("-Xbootclasspath/p:");
-                options.remove("-Xbootclasspath/a:");
-                return super.process(options, "-bootclasspath", arg);
-            }
-        },
-        new Option(EXTDIRS,                "opt.arg.dirs",      "opt.extdirs"),
-        new XOption(DJAVA_EXT_DIRS,        "opt.arg.dirs",      "opt.extdirs") {
-            @Override
-            public boolean process(Options options, String option, String arg) {
-                return super.process(options, "-extdirs", arg);
-            }
-        },
-        new Option(ENDORSEDDIRS,            "opt.arg.dirs",     "opt.endorseddirs"),
-        new XOption(DJAVA_ENDORSED_DIRS,    "opt.arg.dirs",     "opt.endorseddirs") {
-            @Override
-            public boolean process(Options options, String option, String arg) {
-                return super.process(options, "-endorseddirs", arg);
-            }
-        },
-        new Option(PROC,                                 "opt.proc.none.only",
-                Option.ChoiceKind.ONEOF, "none", "only"),
-        new Option(PROCESSOR,           "opt.arg.class.list",   "opt.processor"),
-        new Option(PROCESSORPATH,       "opt.arg.path",         "opt.processorpath"),
-        new Option(D,                   "opt.arg.directory",    "opt.d"),
-        new Option(S,                   "opt.arg.directory",    "opt.sourceDest"),
-        new Option(IMPLICIT,                                    "opt.implicit",
-                Option.ChoiceKind.ONEOF, "none", "class"),
-        new Option(ENCODING,            "opt.arg.encoding",     "opt.encoding"),
-        new Option(SOURCE,              "opt.arg.release",      "opt.source") {
-            @Override
-            public boolean process(Options options, String option, String operand) {
-                Source source = Source.lookup(operand);
-                if (source == null) {
-                    helper.error("err.invalid.source", operand);
-                    return true;
-                }
-                return super.process(options, option, operand);
-            }
-        },
-        new Option(TARGET,              "opt.arg.release",      "opt.target") {
-            @Override
-            public boolean process(Options options, String option, String operand) {
-                Target target = Target.lookup(operand);
-                if (target == null) {
-                    helper.error("err.invalid.target", operand);
-                    return true;
-                }
-                return super.process(options, option, operand);
-            }
-        },
-        new Option(VERSION,                                     "opt.version") {
-            @Override
-            public boolean process(Options options, String option) {
-                helper.printVersion();
-                return super.process(options, option);
-            }
-        },
-        new HiddenOption(FULLVERSION) {
-            @Override
-            public boolean process(Options options, String option) {
-                helper.printFullVersion();
-                return super.process(options, option);
-            }
-        },
-        new HiddenOption(DIAGS) {
-            @Override
-            public boolean process(Options options, String option) {
-                Option xd = getOptions(helper, EnumSet.of(XD))[0];
-                option = option.substring(option.indexOf('=') + 1);
-                String diagsOption = option.contains("%") ?
-                    "-XDdiagsFormat=" :
-                    "-XDdiags=";
-                diagsOption += option;
-                if (xd.matches(diagsOption))
-                    return xd.process(options, diagsOption);
-                else
-                    return false;
-            }
-        },
-        new Option(HELP,                                        "opt.help") {
-            @Override
-            public boolean process(Options options, String option) {
-                helper.printHelp();
-                return super.process(options, option);
-            }
-        },
-        new Option(A,                "opt.arg.key.equals.value","opt.A") {
-            @Override
-            String helpSynopsis() {
-                hasSuffix = true;
-                return super.helpSynopsis();
-            }
-
-            @Override
-            public boolean matches(String arg) {
-                return arg.startsWith("-A");
-            }
-
-            @Override
-            public boolean hasArg() {
-                return false;
-            }
-            // Mapping for processor options created in
-            // JavacProcessingEnvironment
-            @Override
-            public boolean process(Options options, String option) {
-                int argLength = option.length();
-                if (argLength == 2) {
-                    helper.error("err.empty.A.argument");
-                    return true;
-                }
-                int sepIndex = option.indexOf('=');
-                String key = option.substring(2, (sepIndex != -1 ? sepIndex : argLength) );
-                if (!JavacProcessingEnvironment.isValidOptionName(key)) {
-                    helper.error("err.invalid.A.key", option);
-                    return true;
-                }
-                return process(options, option, option);
-            }
-        },
-        new Option(X,                                           "opt.X") {
-            @Override
-            public boolean process(Options options, String option) {
-                helper.printXhelp();
-                return super.process(options, option);
-            }
-        },
-
-        // This option exists only for the purpose of documenting itself.
-        // It's actually implemented by the launcher.
-        new Option(J,                   "opt.arg.flag",         "opt.J") {
-            @Override
-            String helpSynopsis() {
-                hasSuffix = true;
-                return super.helpSynopsis();
-            }
-            @Override
-            public boolean process(Options options, String option) {
-                throw new AssertionError
-                    ("the -J flag should be caught by the launcher.");
-            }
-        },
-
-        // stop after parsing and attributing.
-        // new HiddenOption("-attrparseonly"),
-
-        // new Option("-moreinfo",                                      "opt.moreinfo") {
-        new HiddenOption(MOREINFO) {
-            @Override
-            public boolean process(Options options, String option) {
-                Type.moreInfo = true;
-                return super.process(options, option);
-            }
-        },
-
-        // treat warnings as errors
-        new Option(WERROR,                                      "opt.Werror"),
-
-        // use complex inference from context in the position of a method call argument
-        new HiddenOption(COMPLEXINFERENCE),
-
-        // generare source stubs
-        // new HiddenOption("-stubs"),
-
-        // relax some constraints to allow compiling from stubs
-        // new HiddenOption("-relax"),
-
-        // output source after translating away inner classes
-        // new Option("-printflat",                             "opt.printflat"),
-        // new HiddenOption("-printflat"),
-
-        // display scope search details
-        // new Option("-printsearch",                           "opt.printsearch"),
-        // new HiddenOption("-printsearch"),
-
-        // prompt after each error
-        // new Option("-prompt",                                        "opt.prompt"),
-        new HiddenOption(PROMPT),
-
-        // dump stack on error
-        new HiddenOption(DOE),
-
-        // output source after type erasure
-        // new Option("-s",                                     "opt.s"),
-        new HiddenOption(PRINTSOURCE),
-
-        // output shrouded class files
-        // new Option("-scramble",                              "opt.scramble"),
-        // new Option("-scrambleall",                           "opt.scrambleall"),
-
-        // display warnings for generic unchecked operations
-        new HiddenOption(WARNUNCHECKED) {
-            @Override
-            public boolean process(Options options, String option) {
-                options.put("-Xlint:unchecked", option);
-                return false;
-            }
-        },
-
-        new XOption(XMAXERRS,           "opt.arg.number",       "opt.maxerrs"),
-        new XOption(XMAXWARNS,          "opt.arg.number",       "opt.maxwarns"),
-        new XOption(XSTDOUT,            "opt.arg.file",         "opt.Xstdout") {
-            @Override
-            public boolean process(Options options, String option, String arg) {
-                try {
-                    helper.setOut(new PrintWriter(new FileWriter(arg), true));
-                } catch (java.io.IOException e) {
-                    helper.error("err.error.writing.file", arg, e);
-                    return true;
-                }
-                return super.process(options, option, arg);
-            }
-        },
-
-        new XOption(XPRINT,                                     "opt.print"),
-
-        new XOption(XPRINTROUNDS,                               "opt.printRounds"),
-
-        new XOption(XPRINTPROCESSORINFO,                        "opt.printProcessorInfo"),
-
-        new XOption(XPREFER,                                    "opt.prefer",
-                Option.ChoiceKind.ONEOF, "source", "newer"),
-
-        new XOption(XPKGINFO,                                   "opt.pkginfo",
-                Option.ChoiceKind.ONEOF, "always", "legacy", "nonempty"),
-
-        /* -O is a no-op, accepted for backward compatibility. */
-        new HiddenOption(O),
-
-        /* -Xjcov produces tables to support the code coverage tool jcov. */
-        new HiddenOption(XJCOV),
-
-        /* This is a back door to the compiler's option table.
-         * -XDx=y sets the option x to the value y.
-         * -XDx sets the option x to the value x.
-         */
-        new HiddenOption(XD) {
-            String s;
-            @Override
-            public boolean matches(String s) {
-                this.s = s;
-                return s.startsWith(name.optionName);
-            }
-            @Override
-            public boolean process(Options options, String option) {
-                s = s.substring(name.optionName.length());
-                int eq = s.indexOf('=');
-                String key = (eq < 0) ? s : s.substring(0, eq);
-                String value = (eq < 0) ? s : s.substring(eq+1);
-                options.put(key, value);
-                return false;
-            }
-        },
-
-        // This option exists only for the purpose of documenting itself.
-        // It's actually implemented by the CommandLine class.
-        new Option(AT,                   "opt.arg.file",         "opt.AT") {
-            @Override
-            String helpSynopsis() {
-                hasSuffix = true;
-                return super.helpSynopsis();
-            }
-            @Override
-            public boolean process(Options options, String option) {
-                throw new AssertionError
-                    ("the @ flag should be caught by CommandLine.");
-            }
-        },
-
-        /*
-         * TODO: With apt, the matches method accepts anything if
-         * -XclassAsDecls is used; code elsewhere does the lookup to
-         * see if the class name is both legal and found.
-         *
-         * In apt, the process method adds the candidate class file
-         * name to a separate list.
-         */
-        new HiddenOption(SOURCEFILE) {
-            String s;
-            @Override
-            public boolean matches(String s) {
-                this.s = s;
-                return s.endsWith(".java")  // Java source file
-                    || SourceVersion.isName(s);   // Legal type name
-            }
-            @Override
-            public boolean process(Options options, String option) {
-                if (s.endsWith(".java") ) {
-                    File f = new File(s);
-                    if (!f.exists()) {
-                        helper.error("err.file.not.found", f);
-                        return true;
-                    }
-                    if (!f.isFile()) {
-                        helper.error("err.file.not.file", f);
-                        return true;
-                    }
-                    helper.addFile(f);
-                }
-                else
-                    helper.addClassName(s);
-                return false;
-            }
-        },
-    };
-    }
-
-    public enum PkgInfo {
-        ALWAYS, LEGACY, NONEMPTY;
-        public static PkgInfo get(Options options) {
-            String v = options.get(XPKGINFO);
-            return (v == null
-                    ? PkgInfo.LEGACY
-                    : PkgInfo.valueOf(v.toUpperCase()));
-        }
-    }
-
-    private static Map<String,Boolean> getXLintChoices() {
-        Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>();
-        choices.put("all", false);
-        for (Lint.LintCategory c : Lint.LintCategory.values())
-            choices.put(c.option, c.hidden);
-        for (Lint.LintCategory c : Lint.LintCategory.values())
-            choices.put("-" + c.option, c.hidden);
-        choices.put("none", false);
-        return choices;
-    }
-
-}
--- a/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,7 @@
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.Name;
 
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 import static javax.lang.model.util.ElementFilter.methodsIn;
 
 /**
@@ -288,7 +289,7 @@
                 }
             }
             public void visitArray(Attribute.Array array) {
-                if (tree.getTag() == JCTree.NEWARRAY &&
+                if (tree.hasTag(NEWARRAY) &&
                         types.elemtype(array.type).tsym == findme.type.tsym) {
                     List<JCExpression> elems = ((JCNewArray) tree).elems;
                     for (Attribute value : array.values) {
@@ -327,7 +328,7 @@
                     scan(t.args);
             }
             public void visitAssign(JCAssign t) {
-                if (t.lhs.getTag() == JCTree.IDENT) {
+                if (t.lhs.hasTag(IDENT)) {
                     JCIdent ident = (JCIdent) t.lhs;
                     if (ident.sym == sym)
                         result = t.rhs;
--- a/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Tue May 29 00:27:58 2012 +0100
@@ -25,9 +25,7 @@
 
 package com.sun.tools.javac.nio;
 
-
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -60,13 +58,12 @@
 import static java.nio.file.FileVisitOption.*;
 import static javax.tools.StandardLocation.*;
 
-import com.sun.tools.javac.file.Paths;
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 
 
 // NOTE the imports carefully for this compilation unit.
@@ -125,9 +122,8 @@
      * Set the context for JavacPathFileManager.
      */
     @Override
-    protected void setContext(Context context) {
+    public void setContext(Context context) {
         super.setContext(context);
-        searchPaths = Paths.instance(context);
     }
 
     @Override
@@ -173,7 +169,7 @@
 
     @Override
     public boolean isDefaultBootClassPath() {
-        return searchPaths.isDefaultBootClassPath();
+        return locations.isDefaultBootClassPath();
     }
 
     // <editor-fold defaultstate="collapsed" desc="Location handling">
@@ -231,13 +227,13 @@
         if (locn instanceof StandardLocation) {
             switch ((StandardLocation) locn) {
                 case CLASS_PATH:
-                    files = searchPaths.userClassPath();
+                    files = locations.userClassPath();
                     break;
                 case PLATFORM_CLASS_PATH:
-                    files = searchPaths.bootClassPath();
+                    files = locations.bootClassPath();
                     break;
                 case SOURCE_PATH:
-                    files = searchPaths.sourcePath();
+                    files = locations.sourcePath();
                     break;
                 case CLASS_OUTPUT: {
                     String arg = options.get(D);
@@ -272,7 +268,6 @@
         private boolean inited = false;
 
     private Map<Location, PathsForLocation> pathsForLocation;
-    private Paths searchPaths;
 
     private static class PathsForLocation extends LinkedHashSet<Path> {
         private static final long serialVersionUID = 6788510222394486733L;
--- a/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Tue May 29 00:27:58 2012 +0100
@@ -205,6 +205,7 @@
 
     @Override
     public OutputStream openOutputStream() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return Files.newOutputStream(path);
     }
@@ -241,6 +242,7 @@
 
     @Override
     public Writer openWriter() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new OutputStreamWriter(Files.newOutputStream(path), fileManager.getEncodingName());
     }
--- a/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,420 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import java.nio.*;
-
-import com.sun.tools.javac.util.*;
-import static com.sun.tools.javac.util.LayoutCharacters.*;
-
-/** An extension to the base lexical analyzer that captures
- *  and processes the contents of doc comments.  It does so by
- *  translating Unicode escape sequences and by stripping the
- *  leading whitespace and starts from each line of the comment.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class DocCommentScanner extends Scanner {
-
-    /** Create a scanner from the input buffer.  buffer must implement
-     *  array() and compact(), and remaining() must be less than limit().
-     */
-    protected DocCommentScanner(ScannerFactory fac, CharBuffer buffer) {
-        super(fac, buffer);
-    }
-
-    /** Create a scanner from the input array.  The array must have at
-     *  least a single character of extra space.
-     */
-    protected DocCommentScanner(ScannerFactory fac, char[] input, int inputLength) {
-        super(fac, input, inputLength);
-    }
-
-    /** Starting position of the comment in original source
-     */
-    private int pos;
-
-    /** The comment input buffer, index of next chacter to be read,
-     *  index of one past last character in buffer.
-     */
-    private char[] buf;
-    private int bp;
-    private int buflen;
-
-    /** The current character.
-     */
-    private char ch;
-
-    /** The column number position of the current character.
-     */
-    private int col;
-
-    /** The buffer index of the last converted Unicode character
-     */
-    private int unicodeConversionBp = 0;
-
-    /**
-     * Buffer for doc comment.
-     */
-    private char[] docCommentBuffer = new char[1024];
-
-    /**
-     * Number of characters in doc comment buffer.
-     */
-    private int docCommentCount;
-
-    /**
-     * Translated and stripped contents of doc comment
-     */
-    private String docComment = null;
-
-
-    /** Unconditionally expand the comment buffer.
-     */
-    private void expandCommentBuffer() {
-        char[] newBuffer = new char[docCommentBuffer.length * 2];
-        System.arraycopy(docCommentBuffer, 0, newBuffer,
-                         0, docCommentBuffer.length);
-        docCommentBuffer = newBuffer;
-    }
-
-    /** Convert an ASCII digit from its base (8, 10, or 16)
-     *  to its value.
-     */
-    private int digit(int base) {
-        char c = ch;
-        int result = Character.digit(c, base);
-        if (result >= 0 && c > 0x7f) {
-            ch = "0123456789abcdef".charAt(result);
-        }
-        return result;
-    }
-
-    /** Convert Unicode escape; bp points to initial '\' character
-     *  (Spec 3.3).
-     */
-    private void convertUnicode() {
-        if (ch == '\\' && unicodeConversionBp != bp) {
-            bp++; ch = buf[bp]; col++;
-            if (ch == 'u') {
-                do {
-                    bp++; ch = buf[bp]; col++;
-                } while (ch == 'u');
-                int limit = bp + 3;
-                if (limit < buflen) {
-                    int d = digit(16);
-                    int code = d;
-                    while (bp < limit && d >= 0) {
-                        bp++; ch = buf[bp]; col++;
-                        d = digit(16);
-                        code = (code << 4) + d;
-                    }
-                    if (d >= 0) {
-                        ch = (char)code;
-                        unicodeConversionBp = bp;
-                        return;
-                    }
-                }
-                // "illegal.Unicode.esc", reported by base scanner
-            } else {
-                bp--;
-                ch = '\\';
-                col--;
-            }
-        }
-    }
-
-
-    /** Read next character.
-     */
-    private void scanChar() {
-        bp++;
-        ch = buf[bp];
-        switch (ch) {
-        case '\r': // return
-            col = 0;
-            break;
-        case '\n': // newline
-            if (bp == 0 || buf[bp-1] != '\r') {
-                col = 0;
-            }
-            break;
-        case '\t': // tab
-            col = (col / TabInc * TabInc) + TabInc;
-            break;
-        case '\\': // possible Unicode
-            col++;
-            convertUnicode();
-            break;
-        default:
-            col++;
-            break;
-        }
-    }
-
-    /**
-     * Read next character in doc comment, skipping over double '\' characters.
-     * If a double '\' is skipped, put in the buffer and update buffer count.
-     */
-    private void scanDocCommentChar() {
-        scanChar();
-        if (ch == '\\') {
-            if (buf[bp+1] == '\\' && unicodeConversionBp != bp) {
-                if (docCommentCount == docCommentBuffer.length)
-                    expandCommentBuffer();
-                docCommentBuffer[docCommentCount++] = ch;
-                bp++; col++;
-            } else {
-                convertUnicode();
-            }
-        }
-    }
-
-    /* Reset doc comment before reading each new token
-     */
-    public void nextToken() {
-        docComment = null;
-        super.nextToken();
-    }
-
-    /**
-     * Returns the documentation string of the current token.
-     */
-    public String docComment() {
-        return docComment;
-    }
-
-    /**
-     * Process a doc comment and make the string content available.
-     * Strips leading whitespace and stars.
-     */
-    @SuppressWarnings("fallthrough")
-    protected void processComment(CommentStyle style) {
-        if (style != CommentStyle.JAVADOC) {
-            return;
-        }
-
-        pos = pos();
-        buf = getRawCharacters(pos, endPos());
-        buflen = buf.length;
-        bp = 0;
-        col = 0;
-
-        docCommentCount = 0;
-
-        boolean firstLine = true;
-
-        // Skip over first slash
-        scanDocCommentChar();
-        // Skip over first star
-        scanDocCommentChar();
-
-        // consume any number of stars
-        while (bp < buflen && ch == '*') {
-            scanDocCommentChar();
-        }
-        // is the comment in the form /**/, /***/, /****/, etc. ?
-        if (bp < buflen && ch == '/') {
-            docComment = "";
-            return;
-        }
-
-        // skip a newline on the first line of the comment.
-        if (bp < buflen) {
-            if (ch == LF) {
-                scanDocCommentChar();
-                firstLine = false;
-            } else if (ch == CR) {
-                scanDocCommentChar();
-                if (ch == LF) {
-                    scanDocCommentChar();
-                    firstLine = false;
-                }
-            }
-        }
-
-    outerLoop:
-
-        // The outerLoop processes the doc comment, looping once
-        // for each line.  For each line, it first strips off
-        // whitespace, then it consumes any stars, then it
-        // puts the rest of the line into our buffer.
-        while (bp < buflen) {
-
-            // The wsLoop consumes whitespace from the beginning
-            // of each line.
-        wsLoop:
-
-            while (bp < buflen) {
-                switch(ch) {
-                case ' ':
-                    scanDocCommentChar();
-                    break;
-                case '\t':
-                    col = ((col - 1) / TabInc * TabInc) + TabInc;
-                    scanDocCommentChar();
-                    break;
-                case FF:
-                    col = 0;
-                    scanDocCommentChar();
-                    break;
-// Treat newline at beginning of line (blank line, no star)
-// as comment text.  Old Javadoc compatibility requires this.
-/*---------------------------------*
-                case CR: // (Spec 3.4)
-                    scanDocCommentChar();
-                    if (ch == LF) {
-                        col = 0;
-                        scanDocCommentChar();
-                    }
-                    break;
-                case LF: // (Spec 3.4)
-                    scanDocCommentChar();
-                    break;
-*---------------------------------*/
-                default:
-                    // we've seen something that isn't whitespace;
-                    // jump out.
-                    break wsLoop;
-                }
-            }
-
-            // Are there stars here?  If so, consume them all
-            // and check for the end of comment.
-            if (ch == '*') {
-                // skip all of the stars
-                do {
-                    scanDocCommentChar();
-                } while (ch == '*');
-
-                // check for the closing slash.
-                if (ch == '/') {
-                    // We're done with the doc comment
-                    // scanChar() and breakout.
-                    break outerLoop;
-                }
-            } else if (! firstLine) {
-                //The current line does not begin with a '*' so we will indent it.
-                for (int i = 1; i < col; i++) {
-                    if (docCommentCount == docCommentBuffer.length)
-                        expandCommentBuffer();
-                    docCommentBuffer[docCommentCount++] = ' ';
-                }
-            }
-
-            // The textLoop processes the rest of the characters
-            // on the line, adding them to our buffer.
-        textLoop:
-            while (bp < buflen) {
-                switch (ch) {
-                case '*':
-                    // Is this just a star?  Or is this the
-                    // end of a comment?
-                    scanDocCommentChar();
-                    if (ch == '/') {
-                        // This is the end of the comment,
-                        // set ch and return our buffer.
-                        break outerLoop;
-                    }
-                    // This is just an ordinary star.  Add it to
-                    // the buffer.
-                    if (docCommentCount == docCommentBuffer.length)
-                        expandCommentBuffer();
-                    docCommentBuffer[docCommentCount++] = '*';
-                    break;
-                case ' ':
-                case '\t':
-                    if (docCommentCount == docCommentBuffer.length)
-                        expandCommentBuffer();
-                    docCommentBuffer[docCommentCount++] = ch;
-                    scanDocCommentChar();
-                    break;
-                case FF:
-                    scanDocCommentChar();
-                    break textLoop; // treat as end of line
-                case CR: // (Spec 3.4)
-                    scanDocCommentChar();
-                    if (ch != LF) {
-                        // Canonicalize CR-only line terminator to LF
-                        if (docCommentCount == docCommentBuffer.length)
-                            expandCommentBuffer();
-                        docCommentBuffer[docCommentCount++] = (char)LF;
-                        break textLoop;
-                    }
-                    /* fall through to LF case */
-                case LF: // (Spec 3.4)
-                    // We've seen a newline.  Add it to our
-                    // buffer and break out of this loop,
-                    // starting fresh on a new line.
-                    if (docCommentCount == docCommentBuffer.length)
-                        expandCommentBuffer();
-                    docCommentBuffer[docCommentCount++] = ch;
-                    scanDocCommentChar();
-                    break textLoop;
-                default:
-                    // Add the character to our buffer.
-                    if (docCommentCount == docCommentBuffer.length)
-                        expandCommentBuffer();
-                    docCommentBuffer[docCommentCount++] = ch;
-                    scanDocCommentChar();
-                }
-            } // end textLoop
-            firstLine = false;
-        } // end outerLoop
-
-        if (docCommentCount > 0) {
-            int i = docCommentCount - 1;
-        trailLoop:
-            while (i > -1) {
-                switch (docCommentBuffer[i]) {
-                case '*':
-                    i--;
-                    break;
-                default:
-                    break trailLoop;
-                }
-            }
-            docCommentCount = i + 1;
-
-            // Store the text of the doc comment
-            docComment = new String(docCommentBuffer, 0 , docCommentCount);
-        } else {
-            docComment = "";
-        }
-    }
-
-    /** Build a map for translating between line numbers and
-     * positions in the input.
-     *
-     * @return a LineMap */
-    public Position.LineMap getLineMap() {
-        char[] buf = getRawCharacters();
-        return Position.makeLineMap(buf, buf.length, true);
-    }
-}
--- a/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import java.util.Map;
-import java.util.HashMap;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.TreeInfo;
-
-import static com.sun.tools.javac.tree.JCTree.*;
-
-/**
- * This class is similar to Parser except that it stores ending
- * positions for the tree nodes.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b></p>
- */
-public class EndPosParser extends JavacParser {
-
-    public EndPosParser(ParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap) {
-        super(fac, S, keepDocComments, keepLineMap);
-        this.S = S;
-        endPositions = new HashMap<JCTree,Integer>();
-    }
-
-    private Lexer S;
-
-    /** A hashtable to store ending positions
-     *  of source ranges indexed by the tree nodes.
-     *  Defined only if option flag genEndPos is set.
-     */
-    Map<JCTree, Integer> endPositions;
-
-    /** {@inheritDoc} */
-    @Override
-    protected void storeEnd(JCTree tree, int endpos) {
-        int errorEndPos = getErrorEndPos();
-        endPositions.put(tree, errorEndPos > endpos ? errorEndPos : endpos);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected <T extends JCTree> T to(T t) {
-        storeEnd(t, S.endPos());
-        return t;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected <T extends JCTree> T toP(T t) {
-        storeEnd(t, S.prevEndPos());
-        return t;
-    }
-
-    @Override
-    public JCCompilationUnit parseCompilationUnit() {
-        JCCompilationUnit t = super.parseCompilationUnit();
-        t.endPositions = endPositions;
-        return t;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    JCExpression parExpression() {
-        int pos = S.pos();
-        JCExpression t = super.parExpression();
-        return toP(F.at(pos).Parens(t));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getEndPos(JCTree tree) {
-        return TreeInfo.getEndPos(tree, endPositions);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/EndPosTable.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.parser;
+
+import com.sun.tools.javac.tree.JCTree;
+
+/**
+ * Specifies the methods to access a mappings of syntax trees to end positions.
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public interface EndPosTable {
+
+    /**
+     * This method will return the end position of a given tree, otherwise a
+     * Positions.NOPOS will be returned.
+     * @param tree JCTree
+     * @return position of the source tree or Positions.NOPOS for non-existent mapping
+     */
+    public int getEndPos(JCTree tree);
+
+    /**
+     * Give an old tree and a new tree, the old tree will be replaced with
+     * the new tree, the position of the new tree will be that of the old
+     * tree.
+     * not exist.
+     * @param oldtree a JCTree to be replaced
+     * @param newtree a JCTree to be replaced with
+     * @return position of the old tree or Positions.NOPOS for non-existent mapping
+     */
+    public int replaceTree(JCTree oldtree, JCTree newtree);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,879 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.parser;
+
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
+import com.sun.tools.javac.util.*;
+
+import java.nio.CharBuffer;
+
+import static com.sun.tools.javac.parser.Tokens.*;
+import static com.sun.tools.javac.util.LayoutCharacters.*;
+
+/** The lexical analyzer maps an input stream consisting of
+ *  ASCII characters and Unicode escapes into a token sequence.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class JavaTokenizer {
+
+    private static boolean scannerDebug = false;
+
+    /** Allow hex floating-point literals.
+     */
+    private boolean allowHexFloats;
+
+    /** Allow binary literals.
+     */
+    private boolean allowBinaryLiterals;
+
+    /** Allow underscores in literals.
+     */
+    private boolean allowUnderscoresInLiterals;
+
+    /** The source language setting.
+     */
+    private Source source;
+
+    /** The log to be used for error reporting.
+     */
+    private final Log log;
+
+    /** The token factory. */
+    private final Tokens tokens;
+
+    /** The token kind, set by nextToken().
+     */
+    protected TokenKind tk;
+
+    /** The token's radix, set by nextToken().
+     */
+    protected int radix;
+
+    /** The token's name, set by nextToken().
+     */
+    protected Name name;
+
+    /** The position where a lexical error occurred;
+     */
+    protected int errPos = Position.NOPOS;
+
+    /** The Unicode reader (low-level stream reader).
+     */
+    protected UnicodeReader reader;
+
+    protected ScannerFactory fac;
+
+    private static final boolean hexFloatsWork = hexFloatsWork();
+    private static boolean hexFloatsWork() {
+        try {
+            Float.valueOf("0x1.0p1");
+            return true;
+        } catch (NumberFormatException ex) {
+            return false;
+        }
+    }
+
+    /**
+     * Create a scanner from the input array.  This method might
+     * modify the array.  To avoid copying the input array, ensure
+     * that {@code inputLength < input.length} or
+     * {@code input[input.length -1]} is a white space character.
+     *
+     * @param fac the factory which created this Scanner
+     * @param input the input, might be modified
+     * @param inputLength the size of the input.
+     * Must be positive and less than or equal to input.length.
+     */
+    protected JavaTokenizer(ScannerFactory fac, CharBuffer buf) {
+        this(fac, new UnicodeReader(fac, buf));
+    }
+
+    protected JavaTokenizer(ScannerFactory fac, char[] buf, int inputLength) {
+        this(fac, new UnicodeReader(fac, buf, inputLength));
+    }
+
+    protected JavaTokenizer(ScannerFactory fac, UnicodeReader reader) {
+        this.fac = fac;
+        this.log = fac.log;
+        this.tokens = fac.tokens;
+        this.source = fac.source;
+        this.reader = reader;
+        this.allowBinaryLiterals = source.allowBinaryLiterals();
+        this.allowHexFloats = source.allowHexFloats();
+        this.allowUnderscoresInLiterals = source.allowUnderscoresInLiterals();
+    }
+
+    /** Report an error at the given position using the provided arguments.
+     */
+    protected void lexError(int pos, String key, Object... args) {
+        log.error(pos, key, args);
+        tk = TokenKind.ERROR;
+        errPos = pos;
+    }
+
+    /** Read next character in character or string literal and copy into sbuf.
+     */
+    private void scanLitChar(int pos) {
+        if (reader.ch == '\\') {
+            if (reader.peekChar() == '\\' && !reader.isUnicode()) {
+                reader.skipChar();
+                reader.putChar('\\', true);
+            } else {
+                reader.scanChar();
+                switch (reader.ch) {
+                case '0': case '1': case '2': case '3':
+                case '4': case '5': case '6': case '7':
+                    char leadch = reader.ch;
+                    int oct = reader.digit(pos, 8);
+                    reader.scanChar();
+                    if ('0' <= reader.ch && reader.ch <= '7') {
+                        oct = oct * 8 + reader.digit(pos, 8);
+                        reader.scanChar();
+                        if (leadch <= '3' && '0' <= reader.ch && reader.ch <= '7') {
+                            oct = oct * 8 + reader.digit(pos, 8);
+                            reader.scanChar();
+                        }
+                    }
+                    reader.putChar((char)oct);
+                    break;
+                case 'b':
+                    reader.putChar('\b', true); break;
+                case 't':
+                    reader.putChar('\t', true); break;
+                case 'n':
+                    reader.putChar('\n', true); break;
+                case 'f':
+                    reader.putChar('\f', true); break;
+                case 'r':
+                    reader.putChar('\r', true); break;
+                case '\'':
+                    reader.putChar('\'', true); break;
+                case '\"':
+                    reader.putChar('\"', true); break;
+                case '\\':
+                    reader.putChar('\\', true); break;
+                default:
+                    lexError(reader.bp, "illegal.esc.char");
+                }
+            }
+        } else if (reader.bp != reader.buflen) {
+            reader.putChar(true);
+        }
+    }
+
+    private void scanDigits(int pos, int digitRadix) {
+        char saveCh;
+        int savePos;
+        do {
+            if (reader.ch != '_') {
+                reader.putChar(false);
+            } else {
+                if (!allowUnderscoresInLiterals) {
+                    lexError(pos, "unsupported.underscore.lit", source.name);
+                    allowUnderscoresInLiterals = true;
+                }
+            }
+            saveCh = reader.ch;
+            savePos = reader.bp;
+            reader.scanChar();
+        } while (reader.digit(pos, digitRadix) >= 0 || reader.ch == '_');
+        if (saveCh == '_')
+            lexError(savePos, "illegal.underscore");
+    }
+
+    /** Read fractional part of hexadecimal floating point number.
+     */
+    private void scanHexExponentAndSuffix(int pos) {
+        if (reader.ch == 'p' || reader.ch == 'P') {
+            reader.putChar(true);
+            skipIllegalUnderscores();
+            if (reader.ch == '+' || reader.ch == '-') {
+                reader.putChar(true);
+            }
+            skipIllegalUnderscores();
+            if ('0' <= reader.ch && reader.ch <= '9') {
+                scanDigits(pos, 10);
+                if (!allowHexFloats) {
+                    lexError(pos, "unsupported.fp.lit", source.name);
+                    allowHexFloats = true;
+                }
+                else if (!hexFloatsWork)
+                    lexError(pos, "unsupported.cross.fp.lit");
+            } else
+                lexError(pos, "malformed.fp.lit");
+        } else {
+            lexError(pos, "malformed.fp.lit");
+        }
+        if (reader.ch == 'f' || reader.ch == 'F') {
+            reader.putChar(true);
+            tk = TokenKind.FLOATLITERAL;
+            radix = 16;
+        } else {
+            if (reader.ch == 'd' || reader.ch == 'D') {
+                reader.putChar(true);
+            }
+            tk = TokenKind.DOUBLELITERAL;
+            radix = 16;
+        }
+    }
+
+    /** Read fractional part of floating point number.
+     */
+    private void scanFraction(int pos) {
+        skipIllegalUnderscores();
+        if ('0' <= reader.ch && reader.ch <= '9') {
+            scanDigits(pos, 10);
+        }
+        int sp1 = reader.sp;
+        if (reader.ch == 'e' || reader.ch == 'E') {
+            reader.putChar(true);
+            skipIllegalUnderscores();
+            if (reader.ch == '+' || reader.ch == '-') {
+                reader.putChar(true);
+            }
+            skipIllegalUnderscores();
+            if ('0' <= reader.ch && reader.ch <= '9') {
+                scanDigits(pos, 10);
+                return;
+            }
+            lexError(pos, "malformed.fp.lit");
+            reader.sp = sp1;
+        }
+    }
+
+    /** Read fractional part and 'd' or 'f' suffix of floating point number.
+     */
+    private void scanFractionAndSuffix(int pos) {
+        radix = 10;
+        scanFraction(pos);
+        if (reader.ch == 'f' || reader.ch == 'F') {
+            reader.putChar(true);
+            tk = TokenKind.FLOATLITERAL;
+        } else {
+            if (reader.ch == 'd' || reader.ch == 'D') {
+                reader.putChar(true);
+            }
+            tk = TokenKind.DOUBLELITERAL;
+        }
+    }
+
+    /** Read fractional part and 'd' or 'f' suffix of floating point number.
+     */
+    private void scanHexFractionAndSuffix(int pos, boolean seendigit) {
+        radix = 16;
+        Assert.check(reader.ch == '.');
+        reader.putChar(true);
+        skipIllegalUnderscores();
+        if (reader.digit(pos, 16) >= 0) {
+            seendigit = true;
+            scanDigits(pos, 16);
+        }
+        if (!seendigit)
+            lexError(pos, "invalid.hex.number");
+        else
+            scanHexExponentAndSuffix(pos);
+    }
+
+    private void skipIllegalUnderscores() {
+        if (reader.ch == '_') {
+            lexError(reader.bp, "illegal.underscore");
+            while (reader.ch == '_')
+                reader.scanChar();
+        }
+    }
+
+    /** Read a number.
+     *  @param radix  The radix of the number; one of 2, j8, 10, 16.
+     */
+    private void scanNumber(int pos, int radix) {
+        // for octal, allow base-10 digit in case it's a float literal
+        this.radix = radix;
+        int digitRadix = (radix == 8 ? 10 : radix);
+        boolean seendigit = false;
+        if (reader.digit(pos, digitRadix) >= 0) {
+            seendigit = true;
+            scanDigits(pos, digitRadix);
+        }
+        if (radix == 16 && reader.ch == '.') {
+            scanHexFractionAndSuffix(pos, seendigit);
+        } else if (seendigit && radix == 16 && (reader.ch == 'p' || reader.ch == 'P')) {
+            scanHexExponentAndSuffix(pos);
+        } else if (digitRadix == 10 && reader.ch == '.') {
+            reader.putChar(true);
+            scanFractionAndSuffix(pos);
+        } else if (digitRadix == 10 &&
+                   (reader.ch == 'e' || reader.ch == 'E' ||
+                    reader.ch == 'f' || reader.ch == 'F' ||
+                    reader.ch == 'd' || reader.ch == 'D')) {
+            scanFractionAndSuffix(pos);
+        } else {
+            if (reader.ch == 'l' || reader.ch == 'L') {
+                reader.scanChar();
+                tk = TokenKind.LONGLITERAL;
+            } else {
+                tk = TokenKind.INTLITERAL;
+            }
+        }
+    }
+
+    /** Read an identifier.
+     */
+    private void scanIdent() {
+        boolean isJavaIdentifierPart;
+        char high;
+        do {
+            reader.putChar(true);
+            switch (reader.ch) {
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z':
+            case '$': case '_':
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case '\u0000': case '\u0001': case '\u0002': case '\u0003':
+            case '\u0004': case '\u0005': case '\u0006': case '\u0007':
+            case '\u0008': case '\u000E': case '\u000F': case '\u0010':
+            case '\u0011': case '\u0012': case '\u0013': case '\u0014':
+            case '\u0015': case '\u0016': case '\u0017':
+            case '\u0018': case '\u0019': case '\u001B':
+            case '\u007F':
+                break;
+            case '\u001A': // EOI is also a legal identifier part
+                if (reader.bp >= reader.buflen) {
+                    name = reader.name();
+                    tk = tokens.lookupKind(name);
+                    return;
+                }
+                break;
+            default:
+                if (reader.ch < '\u0080') {
+                    // all ASCII range chars already handled, above
+                    isJavaIdentifierPart = false;
+                } else {
+                    high = reader.scanSurrogates();
+                    if (high != 0) {
+                        reader.putChar(high);
+                        isJavaIdentifierPart = Character.isJavaIdentifierPart(
+                            Character.toCodePoint(high, reader.ch));
+                    } else {
+                        isJavaIdentifierPart = Character.isJavaIdentifierPart(reader.ch);
+                    }
+                }
+                if (!isJavaIdentifierPart) {
+                    name = reader.name();
+                    tk = tokens.lookupKind(name);
+                    return;
+                }
+            }
+        } while (true);
+    }
+
+    /** Return true if reader.ch can be part of an operator.
+     */
+    private boolean isSpecial(char ch) {
+        switch (ch) {
+        case '!': case '%': case '&': case '*': case '?':
+        case '+': case '-': case ':': case '<': case '=':
+        case '>': case '^': case '|': case '~':
+        case '@':
+            return true;
+        default:
+            return false;
+        }
+    }
+
+    /** Read longest possible sequence of special characters and convert
+     *  to token.
+     */
+    private void scanOperator() {
+        while (true) {
+            reader.putChar(false);
+            Name newname = reader.name();
+            TokenKind tk1 = tokens.lookupKind(newname);
+            if (tk1 == TokenKind.IDENTIFIER) {
+                reader.sp--;
+                break;
+            }
+            tk = tk1;
+            reader.scanChar();
+            if (!isSpecial(reader.ch)) break;
+        }
+    }
+
+    /** Read token.
+     */
+    public Token readToken() {
+
+        reader.sp = 0;
+        name = null;
+        radix = 0;
+
+        int pos = 0;
+        int endPos = 0;
+        List<Comment> comments = null;
+
+        try {
+            loop: while (true) {
+                pos = reader.bp;
+                switch (reader.ch) {
+                case ' ': // (Spec 3.6)
+                case '\t': // (Spec 3.6)
+                case FF: // (Spec 3.6)
+                    do {
+                        reader.scanChar();
+                    } while (reader.ch == ' ' || reader.ch == '\t' || reader.ch == FF);
+                    processWhiteSpace(pos, reader.bp);
+                    break;
+                case LF: // (Spec 3.4)
+                    reader.scanChar();
+                    processLineTerminator(pos, reader.bp);
+                    break;
+                case CR: // (Spec 3.4)
+                    reader.scanChar();
+                    if (reader.ch == LF) {
+                        reader.scanChar();
+                    }
+                    processLineTerminator(pos, reader.bp);
+                    break;
+                case 'A': case 'B': case 'C': case 'D': case 'E':
+                case 'F': case 'G': case 'H': case 'I': case 'J':
+                case 'K': case 'L': case 'M': case 'N': case 'O':
+                case 'P': case 'Q': case 'R': case 'S': case 'T':
+                case 'U': case 'V': case 'W': case 'X': case 'Y':
+                case 'Z':
+                case 'a': case 'b': case 'c': case 'd': case 'e':
+                case 'f': case 'g': case 'h': case 'i': case 'j':
+                case 'k': case 'l': case 'm': case 'n': case 'o':
+                case 'p': case 'q': case 'r': case 's': case 't':
+                case 'u': case 'v': case 'w': case 'x': case 'y':
+                case 'z':
+                case '$': case '_':
+                    scanIdent();
+                    break loop;
+                case '0':
+                    reader.scanChar();
+                    if (reader.ch == 'x' || reader.ch == 'X') {
+                        reader.scanChar();
+                        skipIllegalUnderscores();
+                        if (reader.ch == '.') {
+                            scanHexFractionAndSuffix(pos, false);
+                        } else if (reader.digit(pos, 16) < 0) {
+                            lexError(pos, "invalid.hex.number");
+                        } else {
+                            scanNumber(pos, 16);
+                        }
+                    } else if (reader.ch == 'b' || reader.ch == 'B') {
+                        if (!allowBinaryLiterals) {
+                            lexError(pos, "unsupported.binary.lit", source.name);
+                            allowBinaryLiterals = true;
+                        }
+                        reader.scanChar();
+                        skipIllegalUnderscores();
+                        if (reader.digit(pos, 2) < 0) {
+                            lexError(pos, "invalid.binary.number");
+                        } else {
+                            scanNumber(pos, 2);
+                        }
+                    } else {
+                        reader.putChar('0');
+                        if (reader.ch == '_') {
+                            int savePos = reader.bp;
+                            do {
+                                reader.scanChar();
+                            } while (reader.ch == '_');
+                            if (reader.digit(pos, 10) < 0) {
+                                lexError(savePos, "illegal.underscore");
+                            }
+                        }
+                        scanNumber(pos, 8);
+                    }
+                    break loop;
+                case '1': case '2': case '3': case '4':
+                case '5': case '6': case '7': case '8': case '9':
+                    scanNumber(pos, 10);
+                    break loop;
+                case '.':
+                    reader.scanChar();
+                    if ('0' <= reader.ch && reader.ch <= '9') {
+                        reader.putChar('.');
+                        scanFractionAndSuffix(pos);
+                    } else if (reader.ch == '.') {
+                        int savePos = reader.bp;
+                        reader.putChar('.'); reader.putChar('.', true);
+                        if (reader.ch == '.') {
+                            reader.scanChar();
+                            reader.putChar('.');
+                            tk = TokenKind.ELLIPSIS;
+                        } else {
+                            lexError(savePos, "illegal.dot");
+                        }
+                    } else {
+                        tk = TokenKind.DOT;
+                    }
+                    break loop;
+                case ',':
+                    reader.scanChar(); tk = TokenKind.COMMA; break loop;
+                case ';':
+                    reader.scanChar(); tk = TokenKind.SEMI; break loop;
+                case '(':
+                    reader.scanChar(); tk = TokenKind.LPAREN; break loop;
+                case ')':
+                    reader.scanChar(); tk = TokenKind.RPAREN; break loop;
+                case '[':
+                    reader.scanChar(); tk = TokenKind.LBRACKET; break loop;
+                case ']':
+                    reader.scanChar(); tk = TokenKind.RBRACKET; break loop;
+                case '{':
+                    reader.scanChar(); tk = TokenKind.LBRACE; break loop;
+                case '}':
+                    reader.scanChar(); tk = TokenKind.RBRACE; break loop;
+                case '/':
+                    reader.scanChar();
+                    if (reader.ch == '/') {
+                        do {
+                            reader.scanCommentChar();
+                        } while (reader.ch != CR && reader.ch != LF && reader.bp < reader.buflen);
+                        if (reader.bp < reader.buflen) {
+                            comments = addDocReader(comments, processComment(pos, reader.bp, CommentStyle.LINE));
+                        }
+                        break;
+                    } else if (reader.ch == '*') {
+                        boolean isEmpty = false;
+                        reader.scanChar();
+                        CommentStyle style;
+                        if (reader.ch == '*') {
+                            style = CommentStyle.JAVADOC;
+                            reader.scanCommentChar();
+                            if (reader.ch == '/') {
+                                isEmpty = true;
+                            }
+                        } else {
+                            style = CommentStyle.BLOCK;
+                        }
+                        while (!isEmpty && reader.bp < reader.buflen) {
+                            if (reader.ch == '*') {
+                                reader.scanChar();
+                                if (reader.ch == '/') break;
+                            } else {
+                                reader.scanCommentChar();
+                            }
+                        }
+                        if (reader.ch == '/') {
+                            reader.scanChar();
+                            comments = addDocReader(comments, processComment(pos, reader.bp, style));
+                            break;
+                        } else {
+                            lexError(pos, "unclosed.comment");
+                            break loop;
+                        }
+                    } else if (reader.ch == '=') {
+                        tk = TokenKind.SLASHEQ;
+                        reader.scanChar();
+                    } else {
+                        tk = TokenKind.SLASH;
+                    }
+                    break loop;
+                case '\'':
+                    reader.scanChar();
+                    if (reader.ch == '\'') {
+                        lexError(pos, "empty.char.lit");
+                    } else {
+                        if (reader.ch == CR || reader.ch == LF)
+                            lexError(pos, "illegal.line.end.in.char.lit");
+                        scanLitChar(pos);
+                        char ch2 = reader.ch;
+                        if (reader.ch == '\'') {
+                            reader.scanChar();
+                            tk = TokenKind.CHARLITERAL;
+                        } else {
+                            lexError(pos, "unclosed.char.lit");
+                        }
+                    }
+                    break loop;
+                case '\"':
+                    reader.scanChar();
+                    while (reader.ch != '\"' && reader.ch != CR && reader.ch != LF && reader.bp < reader.buflen)
+                        scanLitChar(pos);
+                    if (reader.ch == '\"') {
+                        tk = TokenKind.STRINGLITERAL;
+                        reader.scanChar();
+                    } else {
+                        lexError(pos, "unclosed.str.lit");
+                    }
+                    break loop;
+                case '#':
+                    reader.scanChar();
+                    tk = TokenKind.HASH;
+                    break loop;
+                default:
+                    if (isSpecial(reader.ch)) {
+                        scanOperator();
+                    } else {
+                        boolean isJavaIdentifierStart;
+                        if (reader.ch < '\u0080') {
+                            // all ASCII range chars already handled, above
+                            isJavaIdentifierStart = false;
+                        } else {
+                            char high = reader.scanSurrogates();
+                            if (high != 0) {
+                                reader.putChar(high);
+
+                                isJavaIdentifierStart = Character.isJavaIdentifierStart(
+                                    Character.toCodePoint(high, reader.ch));
+                            } else {
+                                isJavaIdentifierStart = Character.isJavaIdentifierStart(reader.ch);
+                            }
+                        }
+                        if (isJavaIdentifierStart) {
+                            scanIdent();
+                        } else if (reader.bp == reader.buflen || reader.ch == EOI && reader.bp + 1 == reader.buflen) { // JLS 3.5
+                            tk = TokenKind.EOF;
+                            pos = reader.buflen;
+                        } else {
+                            lexError(pos, "illegal.char", String.valueOf((int)reader.ch));
+                            reader.scanChar();
+                        }
+                    }
+                    break loop;
+                }
+            }
+            endPos = reader.bp;
+            switch (tk.tag) {
+                case DEFAULT: return new Token(tk, pos, endPos, comments);
+                case NAMED: return new NamedToken(tk, pos, endPos, name, comments);
+                case STRING: return new StringToken(tk, pos, endPos, reader.chars(), comments);
+                case NUMERIC: return new NumericToken(tk, pos, endPos, reader.chars(), radix, comments);
+                default: throw new AssertionError();
+            }
+        }
+        finally {
+            if (scannerDebug) {
+                    System.out.println("nextToken(" + pos
+                                       + "," + endPos + ")=|" +
+                                       new String(reader.getRawCharacters(pos, endPos))
+                                       + "|");
+            }
+        }
+    }
+    //where
+        List<Comment> addDocReader(List<Comment> docReaders, Comment docReader) {
+            return docReaders == null ?
+                    List.of(docReader) :
+                    docReaders.prepend(docReader);
+        }
+
+    /** Return the position where a lexical error occurred;
+     */
+    public int errPos() {
+        return errPos;
+    }
+
+    /** Set the position where a lexical error occurred;
+     */
+    public void errPos(int pos) {
+        errPos = pos;
+    }
+
+    /**
+     * Called when a complete comment has been scanned. pos and endPos
+     * will mark the comment boundary.
+     */
+    protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
+        if (scannerDebug)
+            System.out.println("processComment(" + pos
+                               + "," + endPos + "," + style + ")=|"
+                               + new String(reader.getRawCharacters(pos, endPos))
+                               + "|");
+        char[] buf = reader.getRawCharacters(pos, endPos);
+        return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
+    }
+
+    /**
+     * Called when a complete whitespace run has been scanned. pos and endPos
+     * will mark the whitespace boundary.
+     */
+    protected void processWhiteSpace(int pos, int endPos) {
+        if (scannerDebug)
+            System.out.println("processWhitespace(" + pos
+                               + "," + endPos + ")=|" +
+                               new String(reader.getRawCharacters(pos, endPos))
+                               + "|");
+    }
+
+    /**
+     * Called when a line terminator has been processed.
+     */
+    protected void processLineTerminator(int pos, int endPos) {
+        if (scannerDebug)
+            System.out.println("processTerminator(" + pos
+                               + "," + endPos + ")=|" +
+                               new String(reader.getRawCharacters(pos, endPos))
+                               + "|");
+    }
+
+    /** Build a map for translating between line numbers and
+     * positions in the input.
+     *
+     * @return a LineMap */
+    public Position.LineMap getLineMap() {
+        return Position.makeLineMap(reader.getRawCharacters(), reader.buflen, false);
+    }
+
+
+    /**
+    * Scan a documentation comment; determine if a deprecated tag is present.
+    * Called once the initial /, * have been skipped, positioned at the second *
+    * (which is treated as the beginning of the first line).
+    * Stops positioned at the closing '/'.
+    */
+    protected class BasicComment<U extends UnicodeReader> implements Comment {
+
+        CommentStyle cs;
+        U comment_reader;
+
+        protected boolean deprecatedFlag = false;
+        protected boolean scanned = false;
+
+        protected BasicComment(U comment_reader, CommentStyle cs) {
+            this.comment_reader = comment_reader;
+            this.cs = cs;
+        }
+
+        public String getText() {
+            return null;
+        }
+
+        public CommentStyle getStyle() {
+            return cs;
+        }
+
+        public boolean isDeprecated() {
+            if (!scanned && cs == CommentStyle.JAVADOC) {
+                scanDocComment();
+            }
+            return deprecatedFlag;
+        }
+
+        @SuppressWarnings("fallthrough")
+        protected void scanDocComment() {
+            try {
+                boolean deprecatedPrefix = false;
+
+                comment_reader.bp += 3; // '/**'
+                comment_reader.ch = comment_reader.buf[comment_reader.bp];
+
+                forEachLine:
+                while (comment_reader.bp < comment_reader.buflen) {
+
+                    // Skip optional WhiteSpace at beginning of line
+                    while (comment_reader.bp < comment_reader.buflen && (comment_reader.ch == ' ' || comment_reader.ch == '\t' || comment_reader.ch == FF)) {
+                        comment_reader.scanCommentChar();
+                    }
+
+                    // Skip optional consecutive Stars
+                    while (comment_reader.bp < comment_reader.buflen && comment_reader.ch == '*') {
+                        comment_reader.scanCommentChar();
+                        if (comment_reader.ch == '/') {
+                            return;
+                        }
+                    }
+
+                    // Skip optional WhiteSpace after Stars
+                    while (comment_reader.bp < comment_reader.buflen && (comment_reader.ch == ' ' || comment_reader.ch == '\t' || comment_reader.ch == FF)) {
+                        comment_reader.scanCommentChar();
+                    }
+
+                    deprecatedPrefix = false;
+                    // At beginning of line in the JavaDoc sense.
+                    if (!deprecatedFlag) {
+                        String deprecated = "@deprecated";
+                        int i = 0;
+                        while (comment_reader.bp < comment_reader.buflen && comment_reader.ch == deprecated.charAt(i)) {
+                            comment_reader.scanCommentChar();
+                            i++;
+                            if (i == deprecated.length()) {
+                                deprecatedPrefix = true;
+                                break;
+                            }
+                        }
+                    }
+
+                    if (deprecatedPrefix && comment_reader.bp < comment_reader.buflen) {
+                        if (Character.isWhitespace(comment_reader.ch)) {
+                            deprecatedFlag = true;
+                        } else if (comment_reader.ch == '*') {
+                            comment_reader.scanCommentChar();
+                            if (comment_reader.ch == '/') {
+                                deprecatedFlag = true;
+                                return;
+                            }
+                        }
+                    }
+
+                    // Skip rest of line
+                    while (comment_reader.bp < comment_reader.buflen) {
+                        switch (comment_reader.ch) {
+                            case '*':
+                                comment_reader.scanCommentChar();
+                                if (comment_reader.ch == '/') {
+                                    return;
+                                }
+                                break;
+                            case CR: // (Spec 3.4)
+                                comment_reader.scanCommentChar();
+                                if (comment_reader.ch != LF) {
+                                    continue forEachLine;
+                                }
+                            /* fall through to LF case */
+                            case LF: // (Spec 3.4)
+                                comment_reader.scanCommentChar();
+                                continue forEachLine;
+                            default:
+                                comment_reader.scanCommentChar();
+                        }
+                    } // rest of line
+                } // forEachLine
+                return;
+            } finally {
+                scanned = true;
+            }
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,16 +27,28 @@
 
 import java.util.*;
 
+import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
+
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.parser.Tokens.*;
+import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
 import com.sun.tools.javac.tree.*;
-import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
-import static com.sun.tools.javac.util.ListBuffer.lb;
 
-import com.sun.tools.javac.tree.JCTree.*;
-
-import static com.sun.tools.javac.parser.Token.*;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.*;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.ASSERT;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.CASE;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.CATCH;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.EQ;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.GT;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.IMPORT;
+import static com.sun.tools.javac.parser.Tokens.TokenKind.LT;
+import static com.sun.tools.javac.util.ListBuffer.lb;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** The parser maps a token sequence into an abstract syntax
  *  tree. It operates by recursive descent, with code derived
@@ -57,7 +69,7 @@
 
     /** The scanner used for lexical analysis.
      */
-    private Lexer S;
+    protected Lexer S;
 
     /** The factory to be used for abstract syntax tree construction.
      */
@@ -67,27 +79,27 @@
      */
     private Log log;
 
-    /** The keyword table. */
-    private Keywords keywords;
-
     /** The Source language setting. */
     private Source source;
 
     /** The name table. */
     private Names names;
 
+    /** End position mappings container */
+    private final AbstractEndPosTable endPosTable;
+
     /** Construct a parser from a given scanner, tree factory and log.
      */
     protected JavacParser(ParserFactory fac,
                      Lexer S,
                      boolean keepDocComments,
-                     boolean keepLineMap) {
+                     boolean keepLineMap,
+                     boolean keepEndPositions) {
         this.S = S;
-        S.nextToken(); // prime the pump
+        nextToken(); // prime the pump
         this.F = fac.F;
         this.log = fac.log;
         this.names = fac.names;
-        this.keywords = fac.keywords;
         this.source = fac.source;
         this.allowGenerics = source.allowGenerics();
         this.allowVarargs = source.allowVarargs();
@@ -99,13 +111,23 @@
         this.allowTWR = source.allowTryWithResources();
         this.allowDiamond = source.allowDiamond();
         this.allowMulticatch = source.allowMulticatch();
+        this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true);
+        this.allowLambda = source.allowLambda() &&
+                fac.options.isSet("allowLambda");
+        this.allowMethodReferences = source.allowMethodReferences() &&
+                fac.options.isSet("allowMethodReferences");
         this.keepDocComments = keepDocComments;
-        if (keepDocComments)
-            docComments = new HashMap<JCTree,String>();
+        docComments = keepDocComments ? new HashMap<JCTree,String>() : null;
         this.keepLineMap = keepLineMap;
         this.errorTree = F.Erroneous();
+        endPosTable = newEndPosTable(keepEndPositions);
     }
 
+    protected AbstractEndPosTable newEndPosTable(boolean keepEndPositions) {
+        return  keepEndPositions
+                ? new SimpleEndPosTable()
+                : new EmptyEndPosTable();
+    }
     /** Switch: Should generics be recognized?
      */
     boolean allowGenerics;
@@ -146,6 +168,18 @@
      */
     boolean allowTWR;
 
+    /** Switch: should we fold strings?
+     */
+    boolean allowStringFolding;
+
+    /** Switch: should we recognize lambda expressions?
+     */
+    boolean allowLambda;
+
+    /** Switch: should we allow method/constructor references?
+     */
+    boolean allowMethodReferences;
+
     /** Switch: should we keep docComments?
      */
     boolean keepDocComments;
@@ -174,7 +208,40 @@
      */
     private int lastmode = 0;
 
-/* ---------- error recovery -------------- */
+    /* ---------- token management -------------- */
+
+    protected Token token;
+
+    protected void nextToken() {
+        S.nextToken();
+        token = S.token();
+    }
+
+    protected boolean peekToken(TokenKind tk) {
+        return S.token(1).kind == tk;
+    }
+
+    protected boolean peekToken(TokenKind tk1, TokenKind tk2) {
+        return S.token(1).kind == tk1 &&
+                S.token(2).kind == tk2;
+    }
+
+    protected boolean peekToken(TokenKind tk1, TokenKind tk2, TokenKind tk3) {
+        return S.token(1).kind == tk1 &&
+                S.token(2).kind == tk2 &&
+                S.token(3).kind == tk3;
+    }
+
+    protected boolean peekToken(TokenKind... kinds) {
+        for (int lookahead = 0 ; lookahead < kinds.length ; lookahead++) {
+            if (S.token(lookahead + 1).kind != kinds[lookahead]) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /* ---------- error recovery -------------- */
 
     private JCErroneous errorTree;
 
@@ -182,9 +249,9 @@
      */
     private void skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement) {
          while (true) {
-             switch (S.token()) {
+             switch (token.kind) {
                 case SEMI:
-                    S.nextToken();
+                    nextToken();
                     return;
                 case PUBLIC:
                 case FINAL:
@@ -245,36 +312,54 @@
                         return;
                     break;
             }
-            S.nextToken();
+            nextToken();
         }
     }
 
-    private JCErroneous syntaxError(int pos, String key, Token... args) {
-        return syntaxError(pos, null, key, args);
+    private JCErroneous syntaxError(int pos, String key, TokenKind... args) {
+        return syntaxError(pos, List.<JCTree>nil(), key, args);
     }
 
-    private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, Token... args) {
+    private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) {
         setErrorEndPos(pos);
-        reportSyntaxError(pos, key, (Object[])args);
-        return toP(F.at(pos).Erroneous(errs));
+        JCErroneous err = F.at(pos).Erroneous(errs);
+        reportSyntaxError(err, key, (Object[])args);
+        if (errs != null) {
+            JCTree last = errs.last();
+            if (last != null)
+                storeEnd(last, pos);
+        }
+        return toP(err);
     }
 
     private int errorPos = Position.NOPOS;
+
     /**
-     * Report a syntax error at given position using the given
-     * argument unless one was already reported at the same position.
+     * Report a syntax using the given the position parameter and arguments,
+     * unless one was already reported at the same position.
      */
     private void reportSyntaxError(int pos, String key, Object... args) {
+        JCDiagnostic.DiagnosticPosition diag = new JCDiagnostic.SimpleDiagnosticPosition(pos);
+        reportSyntaxError(diag, key, args);
+    }
+
+    /**
+     * Report a syntax error using the given DiagnosticPosition object and
+     * arguments, unless one was already reported at the same position.
+     */
+    private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
+        int pos = diagPos.getPreferredPosition();
         if (pos > S.errPos() || pos == Position.NOPOS) {
-            if (S.token() == EOF)
-                error(pos, "premature.eof");
-            else
-                error(pos, key, args);
+            if (token.kind == EOF) {
+                error(diagPos, "premature.eof");
+            } else {
+                error(diagPos, key, args);
+            }
         }
         S.errPos(pos);
-        if (S.pos() == errorPos)
-            S.nextToken(); // guarantee progress
-        errorPos = S.pos();
+        if (token.pos == errorPos)
+            nextToken(); // guarantee progress
+        errorPos = token.pos;
     }
 
 
@@ -282,32 +367,32 @@
      *  reported at the same position.
      */
     private JCErroneous syntaxError(String key) {
-        return syntaxError(S.pos(), key);
+        return syntaxError(token.pos, key);
     }
 
     /** Generate a syntax error at current position unless one was
      *  already reported at the same position.
      */
-    private JCErroneous syntaxError(String key, Token arg) {
-        return syntaxError(S.pos(), key, arg);
+    private JCErroneous syntaxError(String key, TokenKind arg) {
+        return syntaxError(token.pos, key, arg);
     }
 
     /** If next input token matches given token, skip it, otherwise report
      *  an error.
      */
-    public void accept(Token token) {
-        if (S.token() == token) {
-            S.nextToken();
+    public void accept(TokenKind tk) {
+        if (token.kind == tk) {
+            nextToken();
         } else {
-            setErrorEndPos(S.pos());
-            reportSyntaxError(S.prevEndPos(), "expected", token);
+            setErrorEndPos(token.pos);
+            reportSyntaxError(S.prevToken().endPos, "expected", tk);
         }
     }
 
     /** Report an illegal start of expression/type error at given position.
      */
     JCExpression illegal(int pos) {
-        setErrorEndPos(S.pos());
+        setErrorEndPos(pos);
         if ((mode & EXPR) != 0)
             return syntaxError(pos, "illegal.start.of.expr");
         else
@@ -318,14 +403,14 @@
     /** Report an illegal start of expression/type error at current position.
      */
     JCExpression illegal() {
-        return illegal(S.pos());
+        return illegal(token.pos);
     }
 
     /** Diagnose a modifier flag from the set, if any. */
     void checkNoMods(long mods) {
         if (mods != 0) {
             long lowestMod = mods & -mods;
-            error(S.pos(), "mod.not.allowed.here",
+            error(token.pos, "mod.not.allowed.here",
                       Flags.asFlagSet(lowestMod));
         }
     }
@@ -336,7 +421,7 @@
      *  indexed by the tree nodes they refer to.
      *  defined only if option flag keepDocComment is set.
      */
-    Map<JCTree, String> docComments;
+    private final Map<JCTree, String> docComments;
 
     /** Make an entry into docComments hashtable,
      *  provided flag keepDocComments is set and given doc comment is non-null.
@@ -352,37 +437,21 @@
 
 /* -------- source positions ------- */
 
-    private int errorEndPos = -1;
-
     private void setErrorEndPos(int errPos) {
-        if (errPos > errorEndPos)
-            errorEndPos = errPos;
+        endPosTable.setErrorEndPos(errPos);
     }
 
-    protected int getErrorEndPos() {
-        return errorEndPos;
+    private void storeEnd(JCTree tree, int endpos) {
+        endPosTable.storeEnd(tree, endpos);
     }
 
-    /**
-     * Store ending position for a tree.
-     * @param tree   The tree.
-     * @param endpos The ending position to associate with the tree.
-     */
-    protected void storeEnd(JCTree tree, int endpos) {}
+    private <T extends JCTree> T to(T t) {
+        return endPosTable.to(t);
+    }
 
-    /**
-     * Store ending position for a tree.  The ending position should
-     * be the ending position of the current token.
-     * @param t The tree.
-     */
-    protected <T extends JCTree> T to(T t) { return t; }
-
-    /**
-     * Store ending position for a tree.  The ending position should
-     * be greater of the ending position of the previous token and errorEndPos.
-     * @param t The tree.
-     */
-    protected <T extends JCTree> T toP(T t) { return t; }
+    private <T extends JCTree> T toP(T t) {
+        return endPosTable.toP(t);
+    }
 
     /** Get the start position for a tree node.  The start position is
      * defined to be the position of the first character of the first
@@ -402,7 +471,7 @@
      * @param tree  The tree node
      */
     public int getEndPos(JCTree tree) {
-        return Position.NOPOS;
+        return endPosTable.getEndPos(tree);
     }
 
 
@@ -413,30 +482,30 @@
      * Ident = IDENTIFIER
      */
     Name ident() {
-        if (S.token() == IDENTIFIER) {
-            Name name = S.name();
-            S.nextToken();
+        if (token.kind == IDENTIFIER) {
+            Name name = token.name();
+            nextToken();
             return name;
-        } else if (S.token() == ASSERT) {
+        } else if (token.kind == ASSERT) {
             if (allowAsserts) {
-                error(S.pos(), "assert.as.identifier");
-                S.nextToken();
+                error(token.pos, "assert.as.identifier");
+                nextToken();
                 return names.error;
             } else {
-                warning(S.pos(), "assert.as.identifier");
-                Name name = S.name();
-                S.nextToken();
+                warning(token.pos, "assert.as.identifier");
+                Name name = token.name();
+                nextToken();
                 return name;
             }
-        } else if (S.token() == ENUM) {
+        } else if (token.kind == ENUM) {
             if (allowEnums) {
-                error(S.pos(), "enum.as.identifier");
-                S.nextToken();
+                error(token.pos, "enum.as.identifier");
+                nextToken();
                 return names.error;
             } else {
-                warning(S.pos(), "enum.as.identifier");
-                Name name = S.name();
-                S.nextToken();
+                warning(token.pos, "enum.as.identifier");
+                Name name = token.name();
+                nextToken();
                 return name;
             }
         } else {
@@ -449,15 +518,19 @@
      * Qualident = Ident { DOT Ident }
      */
     public JCExpression qualident() {
-        JCExpression t = toP(F.at(S.pos()).Ident(ident()));
-        while (S.token() == DOT) {
-            int pos = S.pos();
-            S.nextToken();
+        JCExpression t = toP(F.at(token.pos).Ident(ident()));
+        while (token.kind == DOT) {
+            int pos = token.pos;
+            nextToken();
             t = toP(F.at(pos).Select(t, ident()));
         }
         return t;
     }
 
+    JCExpression literal(Name prefix) {
+        return literal(prefix, token.pos);
+    }
+
     /**
      * Literal =
      *     INTLITERAL
@@ -470,30 +543,31 @@
      *   | FALSE
      *   | NULL
      */
-    JCExpression literal(Name prefix) {
-        int pos = S.pos();
+    JCExpression literal(Name prefix, int pos) {
         JCExpression t = errorTree;
-        switch (S.token()) {
+        switch (token.kind) {
         case INTLITERAL:
             try {
                 t = F.at(pos).Literal(
                     TypeTags.INT,
-                    Convert.string2int(strval(prefix), S.radix()));
+                    Convert.string2int(strval(prefix), token.radix()));
             } catch (NumberFormatException ex) {
-                error(S.pos(), "int.number.too.large", strval(prefix));
+                error(token.pos, "int.number.too.large", strval(prefix));
             }
             break;
         case LONGLITERAL:
             try {
                 t = F.at(pos).Literal(
                     TypeTags.LONG,
-                    new Long(Convert.string2long(strval(prefix), S.radix())));
+                    new Long(Convert.string2long(strval(prefix), token.radix())));
             } catch (NumberFormatException ex) {
-                error(S.pos(), "int.number.too.large", strval(prefix));
+                error(token.pos, "int.number.too.large", strval(prefix));
             }
             break;
         case FLOATLITERAL: {
-            String proper = (S.radix() == 16 ? ("0x"+ S.stringVal()) : S.stringVal());
+            String proper = token.radix() == 16 ?
+                    ("0x"+ token.stringVal()) :
+                    token.stringVal();
             Float n;
             try {
                 n = Float.valueOf(proper);
@@ -502,15 +576,17 @@
                 n = Float.NaN;
             }
             if (n.floatValue() == 0.0f && !isZero(proper))
-                error(S.pos(), "fp.number.too.small");
+                error(token.pos, "fp.number.too.small");
             else if (n.floatValue() == Float.POSITIVE_INFINITY)
-                error(S.pos(), "fp.number.too.large");
+                error(token.pos, "fp.number.too.large");
             else
                 t = F.at(pos).Literal(TypeTags.FLOAT, n);
             break;
         }
         case DOUBLELITERAL: {
-            String proper = (S.radix() == 16 ? ("0x"+ S.stringVal()) : S.stringVal());
+            String proper = token.radix() == 16 ?
+                    ("0x"+ token.stringVal()) :
+                    token.stringVal();
             Double n;
             try {
                 n = Double.valueOf(proper);
@@ -519,9 +595,9 @@
                 n = Double.NaN;
             }
             if (n.doubleValue() == 0.0d && !isZero(proper))
-                error(S.pos(), "fp.number.too.small");
+                error(token.pos, "fp.number.too.small");
             else if (n.doubleValue() == Double.POSITIVE_INFINITY)
-                error(S.pos(), "fp.number.too.large");
+                error(token.pos, "fp.number.too.large");
             else
                 t = F.at(pos).Literal(TypeTags.DOUBLE, n);
             break;
@@ -529,17 +605,17 @@
         case CHARLITERAL:
             t = F.at(pos).Literal(
                 TypeTags.CHAR,
-                S.stringVal().charAt(0) + 0);
+                token.stringVal().charAt(0) + 0);
             break;
         case STRINGLITERAL:
             t = F.at(pos).Literal(
                 TypeTags.CLASS,
-                S.stringVal());
+                token.stringVal());
             break;
         case TRUE: case FALSE:
             t = F.at(pos).Literal(
                 TypeTags.BOOLEAN,
-                (S.token() == TRUE ? 1 : 0));
+                (token.kind == TRUE ? 1 : 0));
             break;
         case NULL:
             t = F.at(pos).Literal(
@@ -551,8 +627,8 @@
         }
         if (t == errorTree)
             t = F.at(pos).Erroneous();
-        storeEnd(t, S.endPos());
-        S.nextToken();
+        storeEnd(t, token.endPos);
+        nextToken();
         return t;
     }
 //where
@@ -565,7 +641,7 @@
         }
 
         String strval(Name prefix) {
-            String s = S.stringVal();
+            String s = token.stringVal();
             return prefix.isEmpty() ? s : prefix + s;
         }
 
@@ -602,17 +678,17 @@
     JCExpression term() {
         JCExpression t = term1();
         if ((mode & EXPR) != 0 &&
-            S.token() == EQ || PLUSEQ.compareTo(S.token()) <= 0 && S.token().compareTo(GTGTGTEQ) <= 0)
+            token.kind == EQ || PLUSEQ.compareTo(token.kind) <= 0 && token.kind.compareTo(GTGTGTEQ) <= 0)
             return termRest(t);
         else
             return t;
     }
 
     JCExpression termRest(JCExpression t) {
-        switch (S.token()) {
+        switch (token.kind) {
         case EQ: {
-            int pos = S.pos();
-            S.nextToken();
+            int pos = token.pos;
+            nextToken();
             mode = EXPR;
             JCExpression t1 = term();
             return toP(F.at(pos).Assign(t, t1));
@@ -628,12 +704,12 @@
         case LTLTEQ:
         case GTGTEQ:
         case GTGTGTEQ:
-            int pos = S.pos();
-            Token token = S.token();
-            S.nextToken();
+            int pos = token.pos;
+            TokenKind tk = token.kind;
+            nextToken();
             mode = EXPR;
             JCExpression t1 = term();
-            return F.at(pos).Assignop(optag(token), t, t1);
+            return F.at(pos).Assignop(optag(tk), t, t1);
         default:
             return t;
         }
@@ -645,7 +721,7 @@
      */
     JCExpression term1() {
         JCExpression t = term2();
-        if ((mode & EXPR) != 0 && S.token() == QUES) {
+        if ((mode & EXPR) != 0 && token.kind == QUES) {
             mode = EXPR;
             return term1Rest(t);
         } else {
@@ -656,9 +732,9 @@
     /** Expression1Rest = ["?" Expression ":" Expression1]
      */
     JCExpression term1Rest(JCExpression t) {
-        if (S.token() == QUES) {
-            int pos = S.pos();
-            S.nextToken();
+        if (token.kind == QUES) {
+            int pos = token.pos;
+            nextToken();
             JCExpression t1 = term();
             accept(COLON);
             JCExpression t2 = term1();
@@ -674,7 +750,7 @@
      */
     JCExpression term2() {
         JCExpression t = term3();
-        if ((mode & EXPR) != 0 && prec(S.token()) >= TreeInfo.orPrec) {
+        if ((mode & EXPR) != 0 && prec(token.kind) >= TreeInfo.orPrec) {
             mode = EXPR;
             return term2Rest(t, TreeInfo.orPrec);
         } else {
@@ -700,34 +776,29 @@
         JCExpression[] odStack = newOdStack();
         List<Token[]> savedOp = opStackSupply.elems;
         Token[] opStack = newOpStack();
-        List<int[]> savedPos = posStackSupply.elems;
-        int[] posStack = newPosStack();
+
         // optimization, was odStack = new Tree[...]; opStack = new Tree[...];
         int top = 0;
         odStack[0] = t;
-        int startPos = S.pos();
-        Token topOp = ERROR;
-        int topOpPos = Position.NOPOS;
-        while (prec(S.token()) >= minprec) {
-            posStack[top] = topOpPos;
+        int startPos = token.pos;
+        Token topOp = Tokens.DUMMY;
+        while (prec(token.kind) >= minprec) {
             opStack[top] = topOp;
             top++;
-            topOp = S.token();
-            topOpPos = S.pos();
-            S.nextToken();
-            odStack[top] = (topOp == INSTANCEOF) ? parseType() : term3();
-            while (top > 0 && prec(topOp) >= prec(S.token())) {
-                odStack[top-1] = makeOp(topOpPos, topOp, odStack[top-1],
+            topOp = token;
+            nextToken();
+            odStack[top] = (topOp.kind == INSTANCEOF) ? parseType() : term3();
+            while (top > 0 && prec(topOp.kind) >= prec(token.kind)) {
+                odStack[top-1] = makeOp(topOp.pos, topOp.kind, odStack[top-1],
                                         odStack[top]);
                 top--;
                 topOp = opStack[top];
-                topOpPos = posStack[top];
             }
         }
         Assert.check(top == 0);
         t = odStack[0];
 
-        if (t.getTag() == JCTree.PLUS) {
+        if (t.hasTag(JCTree.Tag.PLUS)) {
             StringBuffer buf = foldStrings(t);
             if (buf != null) {
                 t = toP(F.at(startPos).Literal(TypeTags.CLASS, buf.toString()));
@@ -736,14 +807,13 @@
 
         odStackSupply.elems = savedOd; // optimization
         opStackSupply.elems = savedOp; // optimization
-        posStackSupply.elems = savedPos; // optimization
         return t;
     }
 //where
         /** Construct a binary or type test node.
          */
         private JCExpression makeOp(int pos,
-                                    Token topOp,
+                                    TokenKind topOp,
                                     JCExpression od1,
                                     JCExpression od2)
         {
@@ -757,9 +827,11 @@
          *  by a single literal representing the concatenated string.
          */
         protected StringBuffer foldStrings(JCTree tree) {
+            if (!allowStringFolding)
+                return null;
             List<String> buf = List.nil();
             while (true) {
-                if (tree.getTag() == JCTree.LITERAL) {
+                if (tree.hasTag(LITERAL)) {
                     JCLiteral lit = (JCLiteral) tree;
                     if (lit.typetag == TypeTags.CLASS) {
                         StringBuffer sbuf =
@@ -770,9 +842,9 @@
                         }
                         return sbuf;
                     }
-                } else if (tree.getTag() == JCTree.PLUS) {
+                } else if (tree.hasTag(JCTree.Tag.PLUS)) {
                     JCBinary op = (JCBinary)tree;
-                    if (op.rhs.getTag() == JCTree.LITERAL) {
+                    if (op.rhs.hasTag(LITERAL)) {
                         JCLiteral lit = (JCLiteral) op.rhs;
                         if (lit.typetag == TypeTags.CLASS) {
                             buf = buf.prepend((String) lit.value);
@@ -790,7 +862,6 @@
          */
         ListBuffer<JCExpression[]> odStackSupply = new ListBuffer<JCExpression[]>();
         ListBuffer<Token[]> opStackSupply = new ListBuffer<Token[]>();
-        ListBuffer<int[]> posStackSupply = new ListBuffer<int[]>();
 
         private JCExpression[] newOdStack() {
             if (odStackSupply.elems == odStackSupply.last)
@@ -808,14 +879,6 @@
             return opStack;
         }
 
-        private int[] newPosStack() {
-            if (posStackSupply.elems == posStackSupply.last)
-                posStackSupply.append(new int[infixPrecedenceLevels + 1]);
-            int[] posStack = posStackSupply.elems.head;
-            posStackSupply.elems = posStackSupply.elems.tail;
-            return posStack;
-        }
-
     /** Expression3    = PrefixOp Expression3
      *                 | "(" Expr | TypeNoParams ")" Expression3
      *                 | Primary {Selector} {PostfixOp}
@@ -824,7 +887,10 @@
      *                 | [TypeArguments] THIS [Arguments]
      *                 | [TypeArguments] SUPER SuperSuffix
      *                 | NEW [TypeArguments] Creator
+     *                 | "(" Arguments ")" "->" ( Expression | Block )
+     *                 | Ident "->" ( Expression | Block )
      *                 | Ident { "." Ident }
+     *                 | Expression3 MemberReferenceSuffix
      *                   [ "[" ( "]" BracketsOpt "." CLASS | Expression "]" )
      *                   | Arguments
      *                   | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator )
@@ -844,10 +910,10 @@
      *  SuperSuffix    = Arguments | "." Ident [Arguments]
      */
     protected JCExpression term3() {
-        int pos = S.pos();
+        int pos = token.pos;
         JCExpression t;
         List<JCExpression> typeArgs = typeArgumentsOpt(EXPR);
-        switch (S.token()) {
+        switch (token.kind) {
         case QUES:
             if ((mode & TYPE) != 0 && (mode & (TYPEARG|NOPARAMS)) == TYPEARG) {
                 mode = TYPE;
@@ -856,64 +922,92 @@
                 return illegal();
         case PLUSPLUS: case SUBSUB: case BANG: case TILDE: case PLUS: case SUB:
             if (typeArgs == null && (mode & EXPR) != 0) {
-                Token token = S.token();
-                S.nextToken();
+                TokenKind tk = token.kind;
+                nextToken();
                 mode = EXPR;
-                if (token == SUB &&
-                    (S.token() == INTLITERAL || S.token() == LONGLITERAL) &&
-                    S.radix() == 10) {
+                if (tk == SUB &&
+                    (token.kind == INTLITERAL || token.kind == LONGLITERAL) &&
+                    token.radix() == 10) {
                     mode = EXPR;
-                    t = literal(names.hyphen);
+                    t = literal(names.hyphen, pos);
                 } else {
                     t = term3();
-                    return F.at(pos).Unary(unoptag(token), t);
+                    return F.at(pos).Unary(unoptag(tk), t);
                 }
             } else return illegal();
             break;
         case LPAREN:
             if (typeArgs == null && (mode & EXPR) != 0) {
-                S.nextToken();
-                mode = EXPR | TYPE | NOPARAMS;
-                t = term3();
-                if ((mode & TYPE) != 0 && S.token() == LT) {
-                    // Could be a cast to a parameterized type
-                    int op = JCTree.LT;
-                    int pos1 = S.pos();
-                    S.nextToken();
-                    mode &= (EXPR | TYPE);
-                    mode |= TYPEARG;
-                    JCExpression t1 = term3();
-                    if ((mode & TYPE) != 0 &&
-                        (S.token() == COMMA || S.token() == GT)) {
-                        mode = TYPE;
-                        ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
-                        args.append(t1);
-                        while (S.token() == COMMA) {
-                            S.nextToken();
-                            args.append(typeArgument());
+                if (peekToken(FINAL) ||
+                        peekToken(RPAREN) ||
+                        peekToken(IDENTIFIER, COMMA) ||
+                        peekToken(IDENTIFIER, RPAREN, ARROW)) {
+                    //implicit n-ary lambda
+                    t = lambdaExpressionOrStatement(true, peekToken(FINAL), pos);
+                    break;
+                } else {
+                    nextToken();
+                    mode = EXPR | TYPE | NOPARAMS;
+                    t = term3();
+                    if ((mode & TYPE) != 0 && token.kind == LT) {
+                        // Could be a cast to a parameterized type
+                        JCTree.Tag op = JCTree.Tag.LT;
+                        int pos1 = token.pos;
+                        nextToken();
+                        mode &= (EXPR | TYPE);
+                        mode |= TYPEARG;
+                        JCExpression t1 = term3();
+                        if ((mode & TYPE) != 0 &&
+                            (token.kind == COMMA || token.kind == GT)) {
+                            mode = TYPE;
+                            ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+                            args.append(t1);
+                            while (token.kind == COMMA) {
+                                nextToken();
+                                args.append(typeArgument());
+                            }
+                            accept(GT);
+                            t = toP(F.at(pos1).TypeApply(t, args.toList()));
+                            checkGenerics();
+                            mode = EXPR | TYPE; //could be a lambda or a method ref or a cast to a type
+                            t = term3Rest(t, typeArgs);
+                            if (token.kind == IDENTIFIER || token.kind == ELLIPSIS) {
+                                //explicit lambda (w/ generic type)
+                                mode = EXPR;
+                                JCModifiers mods = F.at(token.pos).Modifiers(Flags.PARAMETER);
+                                if (token.kind == ELLIPSIS) {
+                                    mods.flags = Flags.VARARGS;
+                                    t = to(F.at(token.pos).TypeArray(t));
+                                    nextToken();
+                                }
+                                t = lambdaExpressionOrStatement(variableDeclaratorId(mods, t), pos);
+                                break;
+                            }
+                        } else if ((mode & EXPR) != 0) {
+                            mode = EXPR;
+                            JCExpression e = term2Rest(t1, TreeInfo.shiftPrec);
+                            t = F.at(pos1).Binary(op, t, e);
+                            t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
+                        } else {
+                            accept(GT);
                         }
-                        accept(GT);
-                        t = toP(F.at(pos1).TypeApply(t, args.toList()));
-                        checkGenerics();
-                        while (S.token() == DOT) {
-                            S.nextToken();
-                            mode = TYPE;
-                            t = toP(F.at(S.pos()).Select(t, ident()));
-                            t = typeArgumentsOpt(t);
+                    } else if ((mode & TYPE) != 0 &&
+                            (token.kind == IDENTIFIER || token.kind == ELLIPSIS)) {
+                        //explicit lambda (w/ non-generic type)
+                        mode = EXPR;
+                        JCModifiers mods = F.at(token.pos).Modifiers(Flags.PARAMETER);
+                        if (token.kind == ELLIPSIS) {
+                            mods.flags = Flags.VARARGS;
+                            t = to(F.at(token.pos).TypeArray(t));
+                            nextToken();
                         }
-                        t = bracketsOpt(toP(t));
-                    } else if ((mode & EXPR) != 0) {
-                        mode = EXPR;
-                        JCExpression e = term2Rest(t1, TreeInfo.shiftPrec);
-                        t = F.at(pos1).Binary(op, t, e);
+                        t = lambdaExpressionOrStatement(variableDeclaratorId(mods, t), pos);
+                        break;
+                    } else {
                         t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
-                    } else {
-                        accept(GT);
                     }
                 }
-                else {
-                    t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
-                }
+
                 accept(RPAREN);
                 lastmode = mode;
                 mode = EXPR;
@@ -921,28 +1015,30 @@
                     JCExpression t1 = term3();
                     return F.at(pos).TypeCast(t, t1);
                 } else if ((lastmode & TYPE) != 0) {
-                    switch (S.token()) {
+                    switch (token.kind) {
                     /*case PLUSPLUS: case SUBSUB: */
                     case BANG: case TILDE:
                     case LPAREN: case THIS: case SUPER:
                     case INTLITERAL: case LONGLITERAL: case FLOATLITERAL:
                     case DOUBLELITERAL: case CHARLITERAL: case STRINGLITERAL:
                     case TRUE: case FALSE: case NULL:
-                    case NEW: case IDENTIFIER: case ASSERT: case ENUM:
+                        case NEW: case IDENTIFIER: case ASSERT: case ENUM:
                     case BYTE: case SHORT: case CHAR: case INT:
                     case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID:
                         JCExpression t1 = term3();
                         return F.at(pos).TypeCast(t, t1);
                     }
                 }
-            } else return illegal();
+            } else {
+                return illegal();
+            }
             t = toP(F.at(pos).Parens(t));
             break;
         case THIS:
             if ((mode & EXPR) != 0) {
                 mode = EXPR;
                 t = to(F.at(pos).Ident(names._this));
-                S.nextToken();
+                nextToken();
                 if (typeArgs == null)
                     t = argumentsOpt(null, t);
                 else
@@ -970,83 +1066,116 @@
             if (typeArgs != null) return illegal();
             if ((mode & EXPR) != 0) {
                 mode = EXPR;
-                S.nextToken();
-                if (S.token() == LT) typeArgs = typeArguments(false);
+                nextToken();
+                if (token.kind == LT) typeArgs = typeArguments(false);
                 t = creator(pos, typeArgs);
                 typeArgs = null;
             } else return illegal();
             break;
         case IDENTIFIER: case ASSERT: case ENUM:
             if (typeArgs != null) return illegal();
-            t = toP(F.at(S.pos()).Ident(ident()));
-            loop: while (true) {
-                pos = S.pos();
-                switch (S.token()) {
-                case LBRACKET:
-                    S.nextToken();
-                    if (S.token() == RBRACKET) {
-                        S.nextToken();
-                        t = bracketsOpt(t);
-                        t = toP(F.at(pos).TypeArray(t));
-                        t = bracketsSuffix(t);
-                    } else {
+            if ((mode & EXPR) != 0 && peekToken(ARROW)) {
+                t = lambdaExpressionOrStatement(false, false, pos);
+            } else {
+                t = toP(F.at(token.pos).Ident(ident()));
+                loop: while (true) {
+                    pos = token.pos;
+                    switch (token.kind) {
+                    case LBRACKET:
+                        nextToken();
+                        if (token.kind == RBRACKET) {
+                            nextToken();
+                            t = bracketsOpt(t);
+                            t = toP(F.at(pos).TypeArray(t));
+                            t = bracketsSuffix(t);
+                        } else {
+                            if ((mode & EXPR) != 0) {
+                                mode = EXPR;
+                                JCExpression t1 = term();
+                                t = to(F.at(pos).Indexed(t, t1));
+                            }
+                            accept(RBRACKET);
+                        }
+                        break loop;
+                    case LPAREN:
                         if ((mode & EXPR) != 0) {
                             mode = EXPR;
-                            JCExpression t1 = term();
-                            t = to(F.at(pos).Indexed(t, t1));
+                            t = arguments(typeArgs, t);
+                            typeArgs = null;
                         }
-                        accept(RBRACKET);
-                    }
-                    break loop;
-                case LPAREN:
-                    if ((mode & EXPR) != 0) {
-                        mode = EXPR;
-                        t = arguments(typeArgs, t);
-                        typeArgs = null;
-                    }
-                    break loop;
-                case DOT:
-                    S.nextToken();
-                    int oldmode = mode;
-                    mode &= ~NOPARAMS;
-                    typeArgs = typeArgumentsOpt(EXPR);
-                    mode = oldmode;
-                    if ((mode & EXPR) != 0) {
-                        switch (S.token()) {
-                        case CLASS:
-                            if (typeArgs != null) return illegal();
+                        break loop;
+                    case DOT:
+                        nextToken();
+                        int oldmode = mode;
+                        mode &= ~NOPARAMS;
+                        typeArgs = typeArgumentsOpt(EXPR);
+                        mode = oldmode;
+                        if ((mode & EXPR) != 0) {
+                            switch (token.kind) {
+                            case CLASS:
+                                if (typeArgs != null) return illegal();
+                                mode = EXPR;
+                                t = to(F.at(pos).Select(t, names._class));
+                                nextToken();
+                                break loop;
+                            case THIS:
+                                if (typeArgs != null) return illegal();
+                                mode = EXPR;
+                                t = to(F.at(pos).Select(t, names._this));
+                                nextToken();
+                                break loop;
+                            case SUPER:
+                                mode = EXPR;
+                                t = to(F.at(pos).Select(t, names._super));
+                                t = superSuffix(typeArgs, t);
+                                typeArgs = null;
+                                break loop;
+                            case NEW:
+                                if (typeArgs != null) return illegal();
+                                mode = EXPR;
+                                int pos1 = token.pos;
+                                nextToken();
+                                if (token.kind == LT) typeArgs = typeArguments(false);
+                                t = innerCreator(pos1, typeArgs, t);
+                                typeArgs = null;
+                                break loop;
+                            }
+                        }
+                        // typeArgs saved for next loop iteration.
+                        t = toP(F.at(pos).Select(t, ident()));
+                        break;
+                    case LT:
+                        if ((mode & TYPE) == 0 && isUnboundMemberRef()) {
+                            //this is an unbound method reference whose qualifier
+                            //is a generic type i.e. A<S>#m
+                            int pos1 = token.pos;
+                            accept(LT);
+                            ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+                            args.append(typeArgument());
+                            while (token.kind == COMMA) {
+                                nextToken();
+                                args.append(typeArgument());
+                            }
+                            accept(GT);
+                            t = toP(F.at(pos1).TypeApply(t, args.toList()));
+                            checkGenerics();
+                            while (token.kind == DOT) {
+                                nextToken();
+                                mode = TYPE;
+                                t = toP(F.at(token.pos).Select(t, ident()));
+                                t = typeArgumentsOpt(t);
+                            }
+                            if (token.kind != HASH) {
+                                //method reference expected here
+                                t = illegal();
+                            }
                             mode = EXPR;
-                            t = to(F.at(pos).Select(t, names._class));
-                            S.nextToken();
-                            break loop;
-                        case THIS:
-                            if (typeArgs != null) return illegal();
-                            mode = EXPR;
-                            t = to(F.at(pos).Select(t, names._this));
-                            S.nextToken();
-                            break loop;
-                        case SUPER:
-                            mode = EXPR;
-                            t = to(F.at(pos).Select(t, names._super));
-                            t = superSuffix(typeArgs, t);
-                            typeArgs = null;
-                            break loop;
-                        case NEW:
-                            if (typeArgs != null) return illegal();
-                            mode = EXPR;
-                            int pos1 = S.pos();
-                            S.nextToken();
-                            if (S.token() == LT) typeArgs = typeArguments(false);
-                            t = innerCreator(pos1, typeArgs, t);
-                            typeArgs = null;
-                            break loop;
+                            return term3Rest(t, typeArgs);
                         }
+                        break loop;
+                    default:
+                        break loop;
                     }
-                    // typeArgs saved for next loop iteration.
-                    t = toP(F.at(pos).Select(t, ident()));
-                    break;
-                default:
-                    break loop;
                 }
             }
             if (typeArgs != null) illegal();
@@ -1060,8 +1189,8 @@
         case VOID:
             if (typeArgs != null) illegal();
             if ((mode & EXPR) != 0) {
-                S.nextToken();
-                if (S.token() == DOT) {
+                nextToken();
+                if (token.kind == DOT) {
                     JCPrimitiveTypeTree ti = toP(F.at(pos).TypeIdent(TypeTags.VOID));
                     t = bracketsSuffix(ti);
                 } else {
@@ -1072,7 +1201,7 @@
                 // a void type (like other primitive types) to the next phase.
                 // The error will be reported in Attr.attribTypes or Attr.visitApply.
                 JCPrimitiveTypeTree ti = to(F.at(pos).TypeIdent(TypeTags.VOID));
-                S.nextToken();
+                nextToken();
                 return ti;
                 //return illegal();
             }
@@ -1080,16 +1209,20 @@
         default:
             return illegal();
         }
+        return term3Rest(t, typeArgs);
+    }
+
+    JCExpression term3Rest(JCExpression t, List<JCExpression> typeArgs) {
         if (typeArgs != null) illegal();
         while (true) {
-            int pos1 = S.pos();
-            if (S.token() == LBRACKET) {
-                S.nextToken();
+            int pos1 = token.pos;
+            if (token.kind == LBRACKET) {
+                nextToken();
                 if ((mode & TYPE) != 0) {
                     int oldmode = mode;
                     mode = TYPE;
-                    if (S.token() == RBRACKET) {
-                        S.nextToken();
+                    if (token.kind == RBRACKET) {
+                        nextToken();
                         t = bracketsOpt(t);
                         t = toP(F.at(pos1).TypeArray(t));
                         return t;
@@ -1102,21 +1235,21 @@
                     t = to(F.at(pos1).Indexed(t, t1));
                 }
                 accept(RBRACKET);
-            } else if (S.token() == DOT) {
-                S.nextToken();
+            } else if (token.kind == DOT) {
+                nextToken();
                 typeArgs = typeArgumentsOpt(EXPR);
-                if (S.token() == SUPER && (mode & EXPR) != 0) {
+                if (token.kind == SUPER && (mode & EXPR) != 0) {
                     mode = EXPR;
                     t = to(F.at(pos1).Select(t, names._super));
-                    S.nextToken();
+                    nextToken();
                     t = arguments(typeArgs, t);
                     typeArgs = null;
-                } else if (S.token() == NEW && (mode & EXPR) != 0) {
+                } else if (token.kind == NEW && (mode & EXPR) != 0) {
                     if (typeArgs != null) return illegal();
                     mode = EXPR;
-                    int pos2 = S.pos();
-                    S.nextToken();
-                    if (S.token() == LT) typeArgs = typeArguments(false);
+                    int pos2 = token.pos;
+                    nextToken();
+                    if (token.kind == LT) typeArgs = typeArguments(false);
                     t = innerCreator(pos2, typeArgs, t);
                     typeArgs = null;
                 } else {
@@ -1124,29 +1257,116 @@
                     t = argumentsOpt(typeArgs, typeArgumentsOpt(t));
                     typeArgs = null;
                 }
+            } else if ((mode & EXPR) != 0 && token.kind == HASH) {
+                mode = EXPR;
+                if (typeArgs != null) return illegal();
+                accept(HASH);
+                t = memberReferenceSuffix(pos1, t);
             } else {
                 break;
             }
         }
-        while ((S.token() == PLUSPLUS || S.token() == SUBSUB) && (mode & EXPR) != 0) {
+        while ((token.kind == PLUSPLUS || token.kind == SUBSUB) && (mode & EXPR) != 0) {
             mode = EXPR;
-            t = to(F.at(S.pos()).Unary(
-                  S.token() == PLUSPLUS ? JCTree.POSTINC : JCTree.POSTDEC, t));
-            S.nextToken();
+            t = to(F.at(token.pos).Unary(
+                  token.kind == PLUSPLUS ? POSTINC : POSTDEC, t));
+            nextToken();
         }
         return toP(t);
     }
 
+    /**
+     * If we see an identifier followed by a '&lt;' it could be an unbound
+     * method reference or a binary expression. To disambiguate, look for a
+     * matching '&gt;' and see if the subsequent terminal is either '.' or '#'.
+     */
+    @SuppressWarnings("fallthrough")
+    boolean isUnboundMemberRef() {
+        int pos = 0, depth = 0;
+        for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
+            switch (t.kind) {
+                case IDENTIFIER: case QUES: case EXTENDS: case SUPER:
+                case DOT: case RBRACKET: case LBRACKET: case COMMA:
+                case BYTE: case SHORT: case INT: case LONG: case FLOAT:
+                case DOUBLE: case BOOLEAN: case CHAR:
+                    break;
+                case LT:
+                    depth++; break;
+                case GTGTGT:
+                    depth--;
+                case GTGT:
+                    depth--;
+                case GT:
+                    depth--;
+                    if (depth == 0) {
+                        return
+                            S.token(pos + 1).kind == TokenKind.DOT ||
+                            S.token(pos + 1).kind == TokenKind.HASH;
+                    }
+                    break;
+                default:
+                    return false;
+            }
+        }
+    }
+
+    JCExpression lambdaExpressionOrStatement(JCVariableDecl firstParam, int pos) {
+        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+        params.append(firstParam);
+        JCVariableDecl lastParam = firstParam;
+        while ((lastParam.mods.flags & Flags.VARARGS) == 0 && token.kind == COMMA) {
+            nextToken();
+            params.append(lastParam = formalParameter());
+        }
+        accept(RPAREN);
+        return lambdaExpressionOrStatementRest(params.toList(), pos);
+    }
+
+    JCExpression lambdaExpressionOrStatement(boolean hasParens, boolean explicitParams, int pos) {
+        List<JCVariableDecl> params = explicitParams ?
+                formalParameters() :
+                implicitParameters(hasParens);
+
+        return lambdaExpressionOrStatementRest(params, pos);
+    }
+
+    JCExpression lambdaExpressionOrStatementRest(List<JCVariableDecl> args, int pos) {
+        if (token.kind != ARROW) {
+            //better error recovery
+            return F.at(pos).Erroneous(args);
+        }
+
+        checkLambda();
+        accept(ARROW);
+
+        return token.kind == LBRACE ?
+            lambdaStatement(args, pos, pos) :
+            lambdaExpression(args, pos);
+    }
+
+    JCExpression lambdaStatement(List<JCVariableDecl> args, int pos, int pos2) {
+        JCBlock block = block(pos2, 0);
+        return toP(F.at(pos).Lambda(args, block));
+    }
+
+    JCExpression lambdaExpression(List<JCVariableDecl> args, int pos) {
+        JCTree expr = parseExpression();
+        return toP(F.at(pos).Lambda(args, expr));
+    }
+
     /** SuperSuffix = Arguments | "." [TypeArguments] Ident [Arguments]
      */
     JCExpression superSuffix(List<JCExpression> typeArgs, JCExpression t) {
-        S.nextToken();
-        if (S.token() == LPAREN || typeArgs != null) {
+        nextToken();
+        if (token.kind == LPAREN || typeArgs != null) {
             t = arguments(typeArgs, t);
+        } else if (token.kind == HASH) {
+            if (typeArgs != null) return illegal();
+            t = memberReferenceSuffix(t);
         } else {
-            int pos = S.pos();
+            int pos = token.pos;
             accept(DOT);
-            typeArgs = (S.token() == LT) ? typeArguments(false) : null;
+            typeArgs = (token.kind == LT) ? typeArguments(false) : null;
             t = toP(F.at(pos).Select(t, ident()));
             t = argumentsOpt(typeArgs, t);
         }
@@ -1156,15 +1376,15 @@
     /** BasicType = BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE | BOOLEAN
      */
     JCPrimitiveTypeTree basicType() {
-        JCPrimitiveTypeTree t = to(F.at(S.pos()).TypeIdent(typetag(S.token())));
-        S.nextToken();
+        JCPrimitiveTypeTree t = to(F.at(token.pos).TypeIdent(typetag(token.kind)));
+        nextToken();
         return t;
     }
 
     /** ArgumentsOpt = [ Arguments ]
      */
     JCExpression argumentsOpt(List<JCExpression> typeArgs, JCExpression t) {
-        if ((mode & EXPR) != 0 && S.token() == LPAREN || typeArgs != null) {
+        if ((mode & EXPR) != 0 && token.kind == LPAREN || typeArgs != null) {
             mode = EXPR;
             return arguments(typeArgs, t);
         } else {
@@ -1176,24 +1396,24 @@
      */
     List<JCExpression> arguments() {
         ListBuffer<JCExpression> args = lb();
-        if (S.token() == LPAREN) {
-            S.nextToken();
-            if (S.token() != RPAREN) {
+        if (token.kind == LPAREN) {
+            nextToken();
+            if (token.kind != RPAREN) {
                 args.append(parseExpression());
-                while (S.token() == COMMA) {
-                    S.nextToken();
+                while (token.kind == COMMA) {
+                    nextToken();
                     args.append(parseExpression());
                 }
             }
             accept(RPAREN);
         } else {
-            syntaxError(S.pos(), "expected", LPAREN);
+            syntaxError(token.pos, "expected", LPAREN);
         }
         return args.toList();
     }
 
     JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) {
-        int pos = S.pos();
+        int pos = token.pos;
         List<JCExpression> args = arguments();
         return toP(F.at(pos).Apply(typeArgs, t, args));
     }
@@ -1201,7 +1421,7 @@
     /**  TypeArgumentsOpt = [ TypeArguments ]
      */
     JCExpression typeArgumentsOpt(JCExpression t) {
-        if (S.token() == LT &&
+        if (token.kind == LT &&
             (mode & TYPE) != 0 &&
             (mode & NOPARAMS) == 0) {
             mode = TYPE;
@@ -1216,7 +1436,7 @@
     }
 
     List<JCExpression> typeArgumentsOpt(int useMode) {
-        if (S.token() == LT) {
+        if (token.kind == LT) {
             checkGenerics();
             if ((mode & useMode) == 0 ||
                 (mode & NOPARAMS) != 0) {
@@ -1231,45 +1451,37 @@
     /**  TypeArguments  = "<" TypeArgument {"," TypeArgument} ">"
      */
     List<JCExpression> typeArguments(boolean diamondAllowed) {
-        if (S.token() == LT) {
-            S.nextToken();
-            if (S.token() == GT && diamondAllowed) {
+        if (token.kind == LT) {
+            nextToken();
+            if (token.kind == GT && diamondAllowed) {
                 checkDiamond();
                 mode |= DIAMOND;
-                S.nextToken();
+                nextToken();
                 return List.nil();
             } else {
                 ListBuffer<JCExpression> args = ListBuffer.lb();
                 args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
-                while (S.token() == COMMA) {
-                    S.nextToken();
+                while (token.kind == COMMA) {
+                    nextToken();
                     args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
                 }
-                switch (S.token()) {
-                case GTGTGTEQ:
-                    S.token(GTGTEQ);
-                    break;
-                case GTGTEQ:
-                    S.token(GTEQ);
+                switch (token.kind) {
+
+                case GTGTGTEQ: case GTGTEQ: case GTEQ:
+                case GTGTGT: case GTGT:
+                    token = S.split();
                     break;
-                case GTEQ:
-                    S.token(EQ);
-                    break;
-                case GTGTGT:
-                    S.token(GTGT);
-                    break;
-                case GTGT:
-                    S.token(GT);
+                case GT:
+                    nextToken();
                     break;
                 default:
-                    accept(GT);
+                    args.append(syntaxError(token.pos, "expected", GT));
                     break;
                 }
                 return args.toList();
             }
         } else {
-            syntaxError(S.pos(), "expected", LT);
-            return List.nil();
+            return List.<JCExpression>of(syntaxError(token.pos, "expected", LT));
         }
     }
 
@@ -1279,27 +1491,27 @@
      *               | "?" SUPER Type
      */
     JCExpression typeArgument() {
-        if (S.token() != QUES) return parseType();
-        int pos = S.pos();
-        S.nextToken();
-        if (S.token() == EXTENDS) {
+        if (token.kind != QUES) return parseType();
+        int pos = token.pos;
+        nextToken();
+        if (token.kind == EXTENDS) {
             TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.EXTENDS));
-            S.nextToken();
+            nextToken();
             JCExpression bound = parseType();
             return F.at(pos).Wildcard(t, bound);
-        } else if (S.token() == SUPER) {
+        } else if (token.kind == SUPER) {
             TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.SUPER));
-            S.nextToken();
+            nextToken();
             JCExpression bound = parseType();
             return F.at(pos).Wildcard(t, bound);
-        } else if (S.token() == IDENTIFIER) {
+        } else if (token.kind == IDENTIFIER) {
             //error recovery
-            reportSyntaxError(S.prevEndPos(), "expected3",
-                    GT, EXTENDS, SUPER);
             TypeBoundKind t = F.at(Position.NOPOS).TypeBoundKind(BoundKind.UNBOUND);
             JCExpression wc = toP(F.at(pos).Wildcard(t, null));
-            JCIdent id = toP(F.at(S.pos()).Ident(ident()));
-            return F.at(pos).Erroneous(List.<JCTree>of(wc, id));
+            JCIdent id = toP(F.at(token.pos).Ident(ident()));
+            JCErroneous err = F.at(pos).Erroneous(List.<JCTree>of(wc, id));
+            reportSyntaxError(err, "expected3", GT, EXTENDS, SUPER);
+            return err;
         } else {
             TypeBoundKind t = toP(F.at(pos).TypeBoundKind(BoundKind.UNBOUND));
             return toP(F.at(pos).Wildcard(t, null));
@@ -1307,7 +1519,7 @@
     }
 
     JCTypeApply typeArguments(JCExpression t, boolean diamondAllowed) {
-        int pos = S.pos();
+        int pos = token.pos;
         List<JCExpression> args = typeArguments(diamondAllowed);
         return toP(F.at(pos).TypeApply(t, args));
     }
@@ -1315,9 +1527,9 @@
     /** BracketsOpt = {"[" "]"}
      */
     private JCExpression bracketsOpt(JCExpression t) {
-        if (S.token() == LBRACKET) {
-            int pos = S.pos();
-            S.nextToken();
+        if (token.kind == LBRACKET) {
+            int pos = token.pos;
+            nextToken();
             t = bracketsOptCont(t, pos);
             F.at(pos);
         }
@@ -1334,17 +1546,17 @@
      *  BracketsSuffixType =
      */
     JCExpression bracketsSuffix(JCExpression t) {
-        if ((mode & EXPR) != 0 && S.token() == DOT) {
+        if ((mode & EXPR) != 0 && token.kind == DOT) {
             mode = EXPR;
-            int pos = S.pos();
-            S.nextToken();
+            int pos = token.pos;
+            nextToken();
             accept(CLASS);
-            if (S.pos() == errorEndPos) {
+            if (token.pos == endPosTable.errorEndPos) {
                 // error recovery
                 Name name = null;
-                if (S.token() == IDENTIFIER) {
-                    name = S.name();
-                    S.nextToken();
+                if (token.kind == IDENTIFIER) {
+                    name = token.name();
+                    nextToken();
                 } else {
                     name = names.error;
                 }
@@ -1355,15 +1567,45 @@
         } else if ((mode & TYPE) != 0) {
             mode = TYPE;
         } else {
-            syntaxError(S.pos(), "dot.class.expected");
+            syntaxError(token.pos, "dot.class.expected");
         }
         return t;
     }
 
+    /**
+     * MemberReferenceSuffix = "#" [TypeArguments] Ident
+     *                       | "#" [TypeArguments] "new"
+     */
+    JCExpression memberReferenceSuffix(JCExpression t) {
+        int pos1 = token.pos;
+        accept(HASH);
+        return memberReferenceSuffix(pos1, t);
+    }
+
+    JCExpression memberReferenceSuffix(int pos1, JCExpression t) {
+        checkMethodReferences();
+        mode = EXPR;
+        List<JCExpression> typeArgs = null;
+        if (token.kind == LT) {
+            typeArgs = typeArguments(false);
+        }
+        Name refName = null;
+        ReferenceMode refMode = null;
+        if (token.kind == NEW) {
+            refMode = ReferenceMode.NEW;
+            refName = names.init;
+            nextToken();
+        } else {
+            refMode = ReferenceMode.INVOKE;
+            refName = ident();
+        }
+        return toP(F.at(t.getStartPosition()).Reference(refMode, refName, t, typeArgs));
+    }
+
     /** Creator = Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest )
      */
     JCExpression creator(int newpos, List<JCExpression> typeArgs) {
-        switch (S.token()) {
+        switch (token.kind) {
         case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT:
         case DOUBLE: case BOOLEAN:
             if (typeArgs == null)
@@ -1375,29 +1617,36 @@
         int oldmode = mode;
         mode = TYPE;
         boolean diamondFound = false;
-        if (S.token() == LT) {
+        int lastTypeargsPos = -1;
+        if (token.kind == LT) {
             checkGenerics();
+            lastTypeargsPos = token.pos;
             t = typeArguments(t, true);
             diamondFound = (mode & DIAMOND) != 0;
         }
-        while (S.token() == DOT) {
+        while (token.kind == DOT) {
             if (diamondFound) {
                 //cannot select after a diamond
-                illegal(S.pos());
+                illegal();
             }
-            int pos = S.pos();
-            S.nextToken();
+            int pos = token.pos;
+            nextToken();
             t = toP(F.at(pos).Select(t, ident()));
-            if (S.token() == LT) {
+            if (token.kind == LT) {
+                lastTypeargsPos = token.pos;
                 checkGenerics();
                 t = typeArguments(t, true);
                 diamondFound = (mode & DIAMOND) != 0;
             }
         }
         mode = oldmode;
-        if (S.token() == LBRACKET) {
+        if (token.kind == LBRACKET) {
             JCExpression e = arrayCreatorRest(newpos, t);
-            if (typeArgs != null) {
+            if (diamondFound) {
+                reportSyntaxError(lastTypeargsPos, "cannot.create.array.with.diamond");
+                return toP(F.at(newpos).Erroneous(List.of(e)));
+            }
+            else if (typeArgs != null) {
                 int pos = newpos;
                 if (!typeArgs.isEmpty() && typeArgs.head.pos != Position.NOPOS) {
                     // note: this should always happen but we should
@@ -1405,16 +1654,17 @@
                     // modified to improve error recovery.
                     pos = typeArgs.head.pos;
                 }
-                setErrorEndPos(S.prevEndPos());
-                reportSyntaxError(pos, "cannot.create.array.with.type.arguments");
-                return toP(F.at(newpos).Erroneous(typeArgs.prepend(e)));
+                setErrorEndPos(S.prevToken().endPos);
+                JCErroneous err = F.at(pos).Erroneous(typeArgs.prepend(e));
+                reportSyntaxError(err, "cannot.create.array.with.type.arguments");
+                return toP(err);
             }
             return e;
-        } else if (S.token() == LPAREN) {
+        } else if (token.kind == LPAREN) {
             return classCreatorRest(newpos, null, typeArgs, t);
         } else {
-            reportSyntaxError(S.pos(), "expected2",
-                               LPAREN, LBRACKET);
+            setErrorEndPos(token.pos);
+            reportSyntaxError(token.pos, "expected2", LPAREN, LBRACKET);
             t = toP(F.at(newpos).NewClass(null, typeArgs, t, List.<JCExpression>nil(), null));
             return toP(F.at(newpos).Erroneous(List.<JCTree>of(t)));
         }
@@ -1423,8 +1673,8 @@
     /** InnerCreator = Ident [TypeArguments] ClassCreatorRest
      */
     JCExpression innerCreator(int newpos, List<JCExpression> typeArgs, JCExpression encl) {
-        JCExpression t = toP(F.at(S.pos()).Ident(ident()));
-        if (S.token() == LT) {
+        JCExpression t = toP(F.at(token.pos).Ident(ident()));
+        if (token.kind == LT) {
             int oldmode = mode;
             checkGenerics();
             t = typeArguments(t, true);
@@ -1438,22 +1688,23 @@
      */
     JCExpression arrayCreatorRest(int newpos, JCExpression elemtype) {
         accept(LBRACKET);
-        if (S.token() == RBRACKET) {
+        if (token.kind == RBRACKET) {
             accept(RBRACKET);
             elemtype = bracketsOpt(elemtype);
-            if (S.token() == LBRACE) {
+            if (token.kind == LBRACE) {
                 return arrayInitializer(newpos, elemtype);
             } else {
-                return syntaxError(S.pos(), "array.dimension.missing");
+                JCExpression t = toP(F.at(newpos).NewArray(elemtype, List.<JCExpression>nil(), null));
+                return syntaxError(token.pos, List.<JCTree>of(t), "array.dimension.missing");
             }
         } else {
             ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
             dims.append(parseExpression());
             accept(RBRACKET);
-            while (S.token() == LBRACKET) {
-                int pos = S.pos();
-                S.nextToken();
-                if (S.token() == RBRACKET) {
+            while (token.kind == LBRACKET) {
+                int pos = token.pos;
+                nextToken();
+                if (token.kind == RBRACKET) {
                     elemtype = bracketsOptCont(elemtype, pos);
                 } else {
                     dims.append(parseExpression());
@@ -1473,8 +1724,8 @@
     {
         List<JCExpression> args = arguments();
         JCClassDecl body = null;
-        if (S.token() == LBRACE) {
-            int pos = S.pos();
+        if (token.kind == LBRACE) {
+            int pos = token.pos;
             List<JCTree> defs = classOrInterfaceBody(names.empty, false);
             JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
             body = toP(F.at(pos).AnonymousClassDef(mods, defs));
@@ -1487,13 +1738,13 @@
     JCExpression arrayInitializer(int newpos, JCExpression t) {
         accept(LBRACE);
         ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
-        if (S.token() == COMMA) {
-            S.nextToken();
-        } else if (S.token() != RBRACE) {
+        if (token.kind == COMMA) {
+            nextToken();
+        } else if (token.kind != RBRACE) {
             elems.append(variableInitializer());
-            while (S.token() == COMMA) {
-                S.nextToken();
-                if (S.token() == RBRACE) break;
+            while (token.kind == COMMA) {
+                nextToken();
+                if (token.kind == RBRACE) break;
                 elems.append(variableInitializer());
             }
         }
@@ -1504,16 +1755,17 @@
     /** VariableInitializer = ArrayInitializer | Expression
      */
     public JCExpression variableInitializer() {
-        return S.token() == LBRACE ? arrayInitializer(S.pos(), null) : parseExpression();
+        return token.kind == LBRACE ? arrayInitializer(token.pos, null) : parseExpression();
     }
 
     /** ParExpression = "(" Expression ")"
      */
     JCExpression parExpression() {
+        int pos = token.pos;
         accept(LPAREN);
         JCExpression t = parseExpression();
         accept(RPAREN);
-        return t;
+        return toP(F.at(pos).Parens(t));
     }
 
     /** Block = "{" BlockStatements "}"
@@ -1522,19 +1774,19 @@
         accept(LBRACE);
         List<JCStatement> stats = blockStatements();
         JCBlock t = F.at(pos).Block(flags, stats);
-        while (S.token() == CASE || S.token() == DEFAULT) {
-            syntaxError("orphaned", S.token());
+        while (token.kind == CASE || token.kind == DEFAULT) {
+            syntaxError("orphaned", token.kind);
             switchBlockStatementGroups();
         }
         // the Block node has a field "endpos" for first char of last token, which is
         // usually but not necessarily the last char of the last token.
-        t.endpos = S.pos();
+        t.endpos = token.pos;
         accept(RBRACE);
         return toP(t);
     }
 
     public JCBlock block() {
-        return block(S.pos(), 0);
+        return block(token.pos, 0);
     }
 
     /** BlockStatements = { BlockStatement }
@@ -1546,97 +1798,127 @@
      */
     @SuppressWarnings("fallthrough")
     List<JCStatement> blockStatements() {
-//todo: skip to anchor on error(?)
-        int lastErrPos = -1;
+        //todo: skip to anchor on error(?)
         ListBuffer<JCStatement> stats = new ListBuffer<JCStatement>();
         while (true) {
-            int pos = S.pos();
-            switch (S.token()) {
-            case RBRACE: case CASE: case DEFAULT: case EOF:
+            List<JCStatement> stat = blockStatement();
+            if (stat.isEmpty()) {
                 return stats.toList();
-            case LBRACE: case IF: case FOR: case WHILE: case DO: case TRY:
-            case SWITCH: case SYNCHRONIZED: case RETURN: case THROW: case BREAK:
-            case CONTINUE: case SEMI: case ELSE: case FINALLY: case CATCH:
-                stats.append(parseStatement());
+            } else {
+                if (token.pos <= endPosTable.errorEndPos) {
+                    skip(false, true, true, true);
+                }
+                stats.addAll(stat);
+            }
+        }
+    }
+
+    /*
+     * This method parses a statement treating it as a block, relaxing the
+     * JLS restrictions, allows us to parse more faulty code, doing so
+     * enables us to provide better and accurate diagnostics to the user.
+     */
+    JCStatement parseStatementAsBlock() {
+        int pos = token.pos;
+        List<JCStatement> stats = blockStatement();
+        if (stats.isEmpty()) {
+            JCErroneous e = F.at(pos).Erroneous();
+            error(e, "illegal.start.of.stmt");
+            return F.at(pos).Exec(e);
+        } else {
+            JCStatement first = stats.head;
+            String error = null;
+            switch (first.getTag()) {
+            case CLASSDEF:
+                error = "class.not.allowed";
                 break;
-            case MONKEYS_AT:
-            case FINAL: {
-                String dc = S.docComment();
-                JCModifiers mods = modifiersOpt();
-                if (S.token() == INTERFACE ||
-                    S.token() == CLASS ||
-                    allowEnums && S.token() == ENUM) {
-                    stats.append(classOrInterfaceOrEnumDeclaration(mods, dc));
-                } else {
-                    JCExpression t = parseType();
-                    stats.appendList(variableDeclarators(mods, t,
-                                                         new ListBuffer<JCStatement>()));
-                    // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
-                    storeEnd(stats.elems.last(), S.endPos());
-                    accept(SEMI);
-                }
-                break;
-            }
-            case ABSTRACT: case STRICTFP: {
-                String dc = S.docComment();
-                JCModifiers mods = modifiersOpt();
-                stats.append(classOrInterfaceOrEnumDeclaration(mods, dc));
+            case VARDEF:
+                error = "variable.not.allowed";
                 break;
             }
-            case INTERFACE:
-            case CLASS:
-                stats.append(classOrInterfaceOrEnumDeclaration(modifiersOpt(),
-                                                               S.docComment()));
-                break;
-            case ENUM:
-            case ASSERT:
-                if (allowEnums && S.token() == ENUM) {
-                    error(S.pos(), "local.enum");
-                    stats.
-                        append(classOrInterfaceOrEnumDeclaration(modifiersOpt(),
-                                                                 S.docComment()));
-                    break;
-                } else if (allowAsserts && S.token() == ASSERT) {
-                    stats.append(parseStatement());
-                    break;
-                }
-                /* fall through to default */
-            default:
-                Name name = S.name();
-                JCExpression t = term(EXPR | TYPE);
-                if (S.token() == COLON && t.getTag() == JCTree.IDENT) {
-                    S.nextToken();
-                    JCStatement stat = parseStatement();
-                    stats.append(F.at(pos).Labelled(name, stat));
-                } else if ((lastmode & TYPE) != 0 &&
-                           (S.token() == IDENTIFIER ||
-                            S.token() == ASSERT ||
-                            S.token() == ENUM)) {
-                    pos = S.pos();
-                    JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
-                    F.at(pos);
-                    stats.appendList(variableDeclarators(mods, t,
-                                                         new ListBuffer<JCStatement>()));
-                    // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
-                    storeEnd(stats.elems.last(), S.endPos());
-                    accept(SEMI);
-                } else {
-                    // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
-                    stats.append(to(F.at(pos).Exec(checkExprStat(t))));
-                    accept(SEMI);
-                }
+            if (error != null) {
+                error(first, error);
+                List<JCBlock> blist = List.of(F.at(first.pos).Block(0, stats));
+                return toP(F.at(pos).Exec(F.at(first.pos).Erroneous(blist)));
+            }
+            return first;
+        }
+    }
+
+    @SuppressWarnings("fallthrough")
+    List<JCStatement> blockStatement() {
+        //todo: skip to anchor on error(?)
+        int pos = token.pos;
+        switch (token.kind) {
+        case RBRACE: case CASE: case DEFAULT: case EOF:
+            return List.nil();
+        case LBRACE: case IF: case FOR: case WHILE: case DO: case TRY:
+        case SWITCH: case SYNCHRONIZED: case RETURN: case THROW: case BREAK:
+        case CONTINUE: case SEMI: case ELSE: case FINALLY: case CATCH:
+            return List.of(parseStatement());
+        case MONKEYS_AT:
+        case FINAL: {
+            String dc = token.comment(CommentStyle.JAVADOC);
+            JCModifiers mods = modifiersOpt();
+            if (token.kind == INTERFACE ||
+                token.kind == CLASS ||
+                allowEnums && token.kind == ENUM) {
+                return List.of(classOrInterfaceOrEnumDeclaration(mods, dc));
+            } else {
+                JCExpression t = parseType();
+                ListBuffer<JCStatement> stats =
+                        variableDeclarators(mods, t, new ListBuffer<JCStatement>());
+                // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
+                storeEnd(stats.elems.last(), token.endPos);
+                accept(SEMI);
+                return stats.toList();
             }
-
-            // error recovery
-            if (S.pos() == lastErrPos)
+        }
+        case ABSTRACT: case STRICTFP: {
+            String dc = token.comment(CommentStyle.JAVADOC);
+            JCModifiers mods = modifiersOpt();
+            return List.of(classOrInterfaceOrEnumDeclaration(mods, dc));
+        }
+        case INTERFACE:
+        case CLASS:
+            String dc = token.comment(CommentStyle.JAVADOC);
+            return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
+        case ENUM:
+        case ASSERT:
+            if (allowEnums && token.kind == ENUM) {
+                error(token.pos, "local.enum");
+                dc = token.comment(CommentStyle.JAVADOC);
+                return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
+            } else if (allowAsserts && token.kind == ASSERT) {
+                return List.of(parseStatement());
+            }
+            /* fall through to default */
+        default:
+            Token prevToken = token;
+            JCExpression t = term(EXPR | TYPE);
+            if (token.kind == COLON && t.hasTag(IDENT)) {
+                nextToken();
+                JCStatement stat = parseStatement();
+                return List.<JCStatement>of(F.at(pos).Labelled(prevToken.name(), stat));
+            } else if ((lastmode & TYPE) != 0 &&
+                       (token.kind == IDENTIFIER ||
+                        token.kind == ASSERT ||
+                        token.kind == ENUM)) {
+                pos = token.pos;
+                JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
+                F.at(pos);
+                ListBuffer<JCStatement> stats =
+                        variableDeclarators(mods, t, new ListBuffer<JCStatement>());
+                // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
+                storeEnd(stats.elems.last(), token.endPos);
+                accept(SEMI);
                 return stats.toList();
-            if (S.pos() <= errorEndPos) {
-                skip(false, true, true, true);
-                lastErrPos = S.pos();
+            } else {
+                // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
+                JCExpressionStatement expr = to(F.at(pos).Exec(checkExprStat(t)));
+                accept(SEMI);
+                return List.<JCStatement>of(expr);
             }
-
-            // ensure no dangling /** @deprecated */ active
-            S.resetDeprecatedFlag();
         }
     }
 
@@ -1662,55 +1944,55 @@
      */
     @SuppressWarnings("fallthrough")
     public JCStatement parseStatement() {
-        int pos = S.pos();
-        switch (S.token()) {
+        int pos = token.pos;
+        switch (token.kind) {
         case LBRACE:
             return block();
         case IF: {
-            S.nextToken();
+            nextToken();
             JCExpression cond = parExpression();
-            JCStatement thenpart = parseStatement();
+            JCStatement thenpart = parseStatementAsBlock();
             JCStatement elsepart = null;
-            if (S.token() == ELSE) {
-                S.nextToken();
-                elsepart = parseStatement();
+            if (token.kind == ELSE) {
+                nextToken();
+                elsepart = parseStatementAsBlock();
             }
             return F.at(pos).If(cond, thenpart, elsepart);
         }
         case FOR: {
-            S.nextToken();
+            nextToken();
             accept(LPAREN);
-            List<JCStatement> inits = S.token() == SEMI ? List.<JCStatement>nil() : forInit();
+            List<JCStatement> inits = token.kind == SEMI ? List.<JCStatement>nil() : forInit();
             if (inits.length() == 1 &&
-                inits.head.getTag() == JCTree.VARDEF &&
+                inits.head.hasTag(VARDEF) &&
                 ((JCVariableDecl) inits.head).init == null &&
-                S.token() == COLON) {
+                token.kind == COLON) {
                 checkForeach();
                 JCVariableDecl var = (JCVariableDecl)inits.head;
                 accept(COLON);
                 JCExpression expr = parseExpression();
                 accept(RPAREN);
-                JCStatement body = parseStatement();
+                JCStatement body = parseStatementAsBlock();
                 return F.at(pos).ForeachLoop(var, expr, body);
             } else {
                 accept(SEMI);
-                JCExpression cond = S.token() == SEMI ? null : parseExpression();
+                JCExpression cond = token.kind == SEMI ? null : parseExpression();
                 accept(SEMI);
-                List<JCExpressionStatement> steps = S.token() == RPAREN ? List.<JCExpressionStatement>nil() : forUpdate();
+                List<JCExpressionStatement> steps = token.kind == RPAREN ? List.<JCExpressionStatement>nil() : forUpdate();
                 accept(RPAREN);
-                JCStatement body = parseStatement();
+                JCStatement body = parseStatementAsBlock();
                 return F.at(pos).ForLoop(inits, cond, steps, body);
             }
         }
         case WHILE: {
-            S.nextToken();
+            nextToken();
             JCExpression cond = parExpression();
-            JCStatement body = parseStatement();
+            JCStatement body = parseStatementAsBlock();
             return F.at(pos).WhileLoop(cond, body);
         }
         case DO: {
-            S.nextToken();
-            JCStatement body = parseStatement();
+            nextToken();
+            JCStatement body = parseStatementAsBlock();
             accept(WHILE);
             JCExpression cond = parExpression();
             JCDoWhileLoop t = to(F.at(pos).DoLoop(body, cond));
@@ -1718,21 +2000,21 @@
             return t;
         }
         case TRY: {
-            S.nextToken();
+            nextToken();
             List<JCTree> resources = List.<JCTree>nil();
-            if (S.token() == LPAREN) {
+            if (token.kind == LPAREN) {
                 checkTryWithResources();
-                S.nextToken();
+                nextToken();
                 resources = resources();
                 accept(RPAREN);
             }
             JCBlock body = block();
             ListBuffer<JCCatch> catchers = new ListBuffer<JCCatch>();
             JCBlock finalizer = null;
-            if (S.token() == CATCH || S.token() == FINALLY) {
-                while (S.token() == CATCH) catchers.append(catchClause());
-                if (S.token() == FINALLY) {
-                    S.nextToken();
+            if (token.kind == CATCH || token.kind == FINALLY) {
+                while (token.kind == CATCH) catchers.append(catchClause());
+                if (token.kind == FINALLY) {
+                    nextToken();
                     finalizer = block();
                 }
             } else {
@@ -1745,7 +2027,7 @@
             return F.at(pos).Try(resources, body, catchers.toList(), finalizer);
         }
         case SWITCH: {
-            S.nextToken();
+            nextToken();
             JCExpression selector = parExpression();
             accept(LBRACE);
             List<JCCase> cases = switchBlockStatementGroups();
@@ -1754,41 +2036,41 @@
             return t;
         }
         case SYNCHRONIZED: {
-            S.nextToken();
+            nextToken();
             JCExpression lock = parExpression();
             JCBlock body = block();
             return F.at(pos).Synchronized(lock, body);
         }
         case RETURN: {
-            S.nextToken();
-            JCExpression result = S.token() == SEMI ? null : parseExpression();
+            nextToken();
+            JCExpression result = token.kind == SEMI ? null : parseExpression();
             JCReturn t = to(F.at(pos).Return(result));
             accept(SEMI);
             return t;
         }
         case THROW: {
-            S.nextToken();
+            nextToken();
             JCExpression exc = parseExpression();
             JCThrow t = to(F.at(pos).Throw(exc));
             accept(SEMI);
             return t;
         }
         case BREAK: {
-            S.nextToken();
-            Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null;
+            nextToken();
+            Name label = (token.kind == IDENTIFIER || token.kind == ASSERT || token.kind == ENUM) ? ident() : null;
             JCBreak t = to(F.at(pos).Break(label));
             accept(SEMI);
             return t;
         }
         case CONTINUE: {
-            S.nextToken();
-            Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null;
+            nextToken();
+            Name label = (token.kind == IDENTIFIER || token.kind == ASSERT || token.kind == ENUM) ? ident() : null;
             JCContinue t =  to(F.at(pos).Continue(label));
             accept(SEMI);
             return t;
         }
         case SEMI:
-            S.nextToken();
+            nextToken();
             return toP(F.at(pos).Skip());
         case ELSE:
             return toP(F.Exec(syntaxError("else.without.if")));
@@ -1797,12 +2079,12 @@
         case CATCH:
             return toP(F.Exec(syntaxError("catch.without.try")));
         case ASSERT: {
-            if (allowAsserts && S.token() == ASSERT) {
-                S.nextToken();
+            if (allowAsserts && token.kind == ASSERT) {
+                nextToken();
                 JCExpression assertion = parseExpression();
                 JCExpression message = null;
-                if (S.token() == COLON) {
-                    S.nextToken();
+                if (token.kind == COLON) {
+                    nextToken();
                     message = parseExpression();
                 }
                 JCAssert t = to(F.at(pos).Assert(assertion, message));
@@ -1813,12 +2095,12 @@
         }
         case ENUM:
         default:
-            Name name = S.name();
+            Token prevToken = token;
             JCExpression expr = parseExpression();
-            if (S.token() == COLON && expr.getTag() == JCTree.IDENT) {
-                S.nextToken();
+            if (token.kind == COLON && expr.hasTag(IDENT)) {
+                nextToken();
                 JCStatement stat = parseStatement();
-                return F.at(pos).Labelled(name, stat);
+                return F.at(pos).Labelled(prevToken.name(), stat);
             } else {
                 // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
                 JCExpressionStatement stat = to(F.at(pos).Exec(checkExprStat(expr)));
@@ -1830,8 +2112,8 @@
 
     /** CatchClause     = CATCH "(" FormalParameter ")" Block
      */
-    JCCatch catchClause() {
-        int pos = S.pos();
+    protected JCCatch catchClause() {
+        int pos = token.pos;
         accept(CATCH);
         accept(LPAREN);
         JCModifiers mods = optFinal(Flags.PARAMETER);
@@ -1848,9 +2130,9 @@
     List<JCExpression> catchTypes() {
         ListBuffer<JCExpression> catchTypes = ListBuffer.lb();
         catchTypes.add(parseType());
-        while (S.token() == BAR) {
+        while (token.kind == BAR) {
             checkMulticatch();
-            S.nextToken();
+            nextToken();
             catchTypes.add(qualident());
         }
         return catchTypes.toList();
@@ -1863,33 +2145,33 @@
     List<JCCase> switchBlockStatementGroups() {
         ListBuffer<JCCase> cases = new ListBuffer<JCCase>();
         while (true) {
-            int pos = S.pos();
-            switch (S.token()) {
+            int pos = token.pos;
+            switch (token.kind) {
             case CASE: {
-                S.nextToken();
+                nextToken();
                 JCExpression pat = parseExpression();
                 accept(COLON);
                 List<JCStatement> stats = blockStatements();
                 JCCase c = F.at(pos).Case(pat, stats);
                 if (stats.isEmpty())
-                    storeEnd(c, S.prevEndPos());
+                    storeEnd(c, S.prevToken().endPos);
                 cases.append(c);
                 break;
             }
             case DEFAULT: {
-                S.nextToken();
+                nextToken();
                 accept(COLON);
                 List<JCStatement> stats = blockStatements();
                 JCCase c = F.at(pos).Case(null, stats);
                 if (stats.isEmpty())
-                    storeEnd(c, S.prevEndPos());
+                    storeEnd(c, S.prevToken().endPos);
                 cases.append(c);
                 break;
             }
             case RBRACE: case EOF:
                 return cases.toList();
             default:
-                S.nextToken(); // to ensure progress
+                nextToken(); // to ensure progress
                 syntaxError(pos, "expected3",
                     CASE, DEFAULT, RBRACE);
             }
@@ -1903,9 +2185,9 @@
                                                                     T stats) {
         // This Exec is a "StatementExpression"; it subsumes no terminating token
         stats.append(toP(F.at(pos).Exec(checkExprStat(first))));
-        while (S.token() == COMMA) {
-            S.nextToken();
-            pos = S.pos();
+        while (token.kind == COMMA) {
+            nextToken();
+            pos = token.pos;
             JCExpression t = parseExpression();
             // This Exec is a "StatementExpression"; it subsumes no terminating token
             stats.append(toP(F.at(pos).Exec(checkExprStat(t))));
@@ -1918,23 +2200,28 @@
      */
     List<JCStatement> forInit() {
         ListBuffer<JCStatement> stats = lb();
-        int pos = S.pos();
-        if (S.token() == FINAL || S.token() == MONKEYS_AT) {
+        int pos = token.pos;
+        if (token.kind == FINAL || token.kind == MONKEYS_AT) {
             return variableDeclarators(optFinal(0), parseType(), stats).toList();
         } else {
             JCExpression t = term(EXPR | TYPE);
             if ((lastmode & TYPE) != 0 &&
-                (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM))
+                (token.kind == IDENTIFIER || token.kind == ASSERT ||
+                 token.kind == ENUM)) {
                 return variableDeclarators(modifiersOpt(), t, stats).toList();
-            else
+            } else if ((lastmode & TYPE) != 0 && token.kind == COLON) {
+                error(pos, "bad.initializer", "for-loop");
+                return List.of((JCStatement)F.at(pos).VarDef(null, null, t, null));
+            } else {
                 return moreStatementExpressions(pos, t, stats).toList();
+            }
         }
     }
 
     /** ForUpdate = StatementExpression MoreStatementExpressions
      */
     List<JCExpressionStatement> forUpdate() {
-        return moreStatementExpressions(S.pos(),
+        return moreStatementExpressions(token.pos,
                                         parseExpression(),
                                         new ListBuffer<JCExpressionStatement>()).toList();
     }
@@ -1942,11 +2229,11 @@
     /** AnnotationsOpt = { '@' Annotation }
      */
     List<JCAnnotation> annotationsOpt() {
-        if (S.token() != MONKEYS_AT) return List.nil(); // optimization
+        if (token.kind != MONKEYS_AT) return List.nil(); // optimization
         ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>();
-        while (S.token() == MONKEYS_AT) {
-            int pos = S.pos();
-            S.nextToken();
+        while (token.kind == MONKEYS_AT) {
+            int pos = token.pos;
+            nextToken();
             buf.append(annotation(pos));
         }
         return buf.toList();
@@ -1960,27 +2247,26 @@
     JCModifiers modifiersOpt() {
         return modifiersOpt(null);
     }
-    JCModifiers modifiersOpt(JCModifiers partial) {
+    protected JCModifiers modifiersOpt(JCModifiers partial) {
         long flags;
         ListBuffer<JCAnnotation> annotations = new ListBuffer<JCAnnotation>();
         int pos;
         if (partial == null) {
             flags = 0;
-            pos = S.pos();
+            pos = token.pos;
         } else {
             flags = partial.flags;
             annotations.appendList(partial.annotations);
             pos = partial.pos;
         }
-        if (S.deprecatedFlag()) {
+        if (token.deprecatedFlag()) {
             flags |= Flags.DEPRECATED;
-            S.resetDeprecatedFlag();
         }
         int lastPos = Position.NOPOS;
     loop:
         while (true) {
             long flag;
-            switch (S.token()) {
+            switch (token.kind) {
             case PRIVATE     : flag = Flags.PRIVATE; break;
             case PROTECTED   : flag = Flags.PROTECTED; break;
             case PUBLIC      : flag = Flags.PUBLIC; break;
@@ -1993,14 +2279,15 @@
             case SYNCHRONIZED: flag = Flags.SYNCHRONIZED; break;
             case STRICTFP    : flag = Flags.STRICTFP; break;
             case MONKEYS_AT  : flag = Flags.ANNOTATION; break;
+            case ERROR       : flag = 0; nextToken(); break;
             default: break loop;
             }
-            if ((flags & flag) != 0) error(S.pos(), "repeated.modifier");
-            lastPos = S.pos();
-            S.nextToken();
+            if ((flags & flag) != 0) error(token.pos, "repeated.modifier");
+            lastPos = token.pos;
+            nextToken();
             if (flag == Flags.ANNOTATION) {
                 checkAnnotations();
-                if (S.token() != INTERFACE) {
+                if (token.kind != INTERFACE) {
                     JCAnnotation ann = annotation(lastPos);
                     // if first modifier is an annotation, set pos to annotation's.
                     if (flags == 0 && annotations.isEmpty())
@@ -2012,7 +2299,7 @@
             }
             flags |= flag;
         }
-        switch (S.token()) {
+        switch (token.kind) {
         case ENUM: flags |= Flags.ENUM; break;
         case INTERFACE: flags |= Flags.INTERFACE; break;
         default: break;
@@ -2025,7 +2312,7 @@
 
         JCModifiers mods = F.at(pos).Modifiers(flags, annotations.toList());
         if (pos != Position.NOPOS)
-            storeEnd(mods, S.prevEndPos());
+            storeEnd(mods, S.prevToken().endPos);
         return mods;
     }
 
@@ -2038,22 +2325,22 @@
         JCTree ident = qualident();
         List<JCExpression> fieldValues = annotationFieldValuesOpt();
         JCAnnotation ann = F.at(pos).Annotation(ident, fieldValues);
-        storeEnd(ann, S.prevEndPos());
+        storeEnd(ann, S.prevToken().endPos);
         return ann;
     }
 
     List<JCExpression> annotationFieldValuesOpt() {
-        return (S.token() == LPAREN) ? annotationFieldValues() : List.<JCExpression>nil();
+        return (token.kind == LPAREN) ? annotationFieldValues() : List.<JCExpression>nil();
     }
 
     /** AnnotationFieldValues   = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" */
     List<JCExpression> annotationFieldValues() {
         accept(LPAREN);
         ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
-        if (S.token() != RPAREN) {
+        if (token.kind != RPAREN) {
             buf.append(annotationFieldValue());
-            while (S.token() == COMMA) {
-                S.nextToken();
+            while (token.kind == COMMA) {
+                nextToken();
                 buf.append(annotationFieldValue());
             }
         }
@@ -2065,11 +2352,11 @@
      *                          | Identifier "=" AnnotationValue
      */
     JCExpression annotationFieldValue() {
-        if (S.token() == IDENTIFIER) {
+        if (token.kind == IDENTIFIER) {
             mode = EXPR;
             JCExpression t1 = term1();
-            if (t1.getTag() == JCTree.IDENT && S.token() == EQ) {
-                int pos = S.pos();
+            if (t1.hasTag(IDENT) && token.kind == EQ) {
+                int pos = token.pos;
                 accept(EQ);
                 JCExpression v = annotationValue();
                 return toP(F.at(pos).Assign(t1, v));
@@ -2086,20 +2373,20 @@
      */
     JCExpression annotationValue() {
         int pos;
-        switch (S.token()) {
+        switch (token.kind) {
         case MONKEYS_AT:
-            pos = S.pos();
-            S.nextToken();
+            pos = token.pos;
+            nextToken();
             return annotation(pos);
         case LBRACE:
-            pos = S.pos();
+            pos = token.pos;
             accept(LBRACE);
             ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
-            if (S.token() != RBRACE) {
+            if (token.kind != RBRACE) {
                 buf.append(annotationValue());
-                while (S.token() == COMMA) {
-                    S.nextToken();
-                    if (S.token() == RBRACE) break;
+                while (token.kind == COMMA) {
+                    nextToken();
+                    if (token.kind == RBRACE) break;
                     buf.append(annotationValue());
                 }
             }
@@ -2117,7 +2404,7 @@
                                                                          JCExpression type,
                                                                          T vdefs)
     {
-        return variableDeclaratorsRest(S.pos(), mods, type, ident(), false, null, vdefs);
+        return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs);
     }
 
     /** VariableDeclaratorsRest = VariableDeclaratorRest { "," VariableDeclarator }
@@ -2135,10 +2422,10 @@
                                                                      T vdefs)
     {
         vdefs.append(variableDeclaratorRest(pos, mods, type, name, reqInit, dc));
-        while (S.token() == COMMA) {
+        while (token.kind == COMMA) {
             // All but last of multiple declarators subsume a comma
-            storeEnd((JCTree)vdefs.elems.last(), S.endPos());
-            S.nextToken();
+            storeEnd((JCTree)vdefs.elems.last(), token.endPos);
+            nextToken();
             vdefs.append(variableDeclarator(mods, type, reqInit, dc));
         }
         return vdefs;
@@ -2148,7 +2435,7 @@
      *  ConstantDeclarator = Ident ConstantDeclaratorRest
      */
     JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, String dc) {
-        return variableDeclaratorRest(S.pos(), mods, type, ident(), reqInit, dc);
+        return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc);
     }
 
     /** VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer]
@@ -2161,11 +2448,11 @@
                                   boolean reqInit, String dc) {
         type = bracketsOpt(type);
         JCExpression init = null;
-        if (S.token() == EQ) {
-            S.nextToken();
+        if (token.kind == EQ) {
+            nextToken();
             init = variableInitializer();
         }
-        else if (reqInit) syntaxError(S.pos(), "expected", EQ);
+        else if (reqInit) syntaxError(token.pos, "expected", EQ);
         JCVariableDecl result =
             toP(F.at(pos).VarDef(mods, name, type, init));
         attach(result, dc);
@@ -2175,11 +2462,11 @@
     /** VariableDeclaratorId = Ident BracketsOpt
      */
     JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
-        int pos = S.pos();
+        int pos = token.pos;
         Name name = ident();
         if ((mods.flags & Flags.VARARGS) != 0 &&
-                S.token() == LBRACKET) {
-            log.error(S.pos(), "varargs.and.old.array.syntax");
+                token.kind == LBRACKET) {
+            log.error(token.pos, "varargs.and.old.array.syntax");
         }
         type = bracketsOpt(type);
         return toP(F.at(pos).VarDef(mods, name, type, null));
@@ -2190,12 +2477,12 @@
     List<JCTree> resources() {
         ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
         defs.append(resource());
-        while (S.token() == SEMI) {
+        while (token.kind == SEMI) {
             // All but last of multiple declarators must subsume a semicolon
-            storeEnd(defs.elems.last(), S.endPos());
-            int semiColonPos = S.pos();
-            S.nextToken();
-            if (S.token() == RPAREN) { // Optional trailing semicolon
+            storeEnd(defs.elems.last(), token.endPos);
+            int semiColonPos = token.pos;
+            nextToken();
+            if (token.kind == RPAREN) { // Optional trailing semicolon
                                        // after last resource
                 break;
             }
@@ -2206,92 +2493,103 @@
 
     /** Resource = VariableModifiersOpt Type VariableDeclaratorId = Expression
      */
-    JCTree resource() {
-        return variableDeclaratorRest(S.pos(), optFinal(Flags.FINAL),
-                                      parseType(), ident(), true, null);
+    protected JCTree resource() {
+        JCModifiers optFinal = optFinal(Flags.FINAL);
+        JCExpression type = parseType();
+        int pos = token.pos;
+        Name ident = ident();
+        return variableDeclaratorRest(pos, optFinal, type, ident, true, null);
     }
 
     /** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
      */
     public JCTree.JCCompilationUnit parseCompilationUnit() {
-        int pos = S.pos();
+        Token firstToken = token;
         JCExpression pid = null;
-        String dc = S.docComment();
         JCModifiers mods = null;
+        boolean consumedToplevelDoc = false;
+        boolean seenImport = false;
+        boolean seenPackage = false;
         List<JCAnnotation> packageAnnotations = List.nil();
-        if (S.token() == MONKEYS_AT)
+        if (token.kind == MONKEYS_AT)
             mods = modifiersOpt();
 
-        if (S.token() == PACKAGE) {
+        if (token.kind == PACKAGE) {
+            seenPackage = true;
             if (mods != null) {
                 checkNoMods(mods.flags);
                 packageAnnotations = mods.annotations;
                 mods = null;
             }
-            S.nextToken();
+            nextToken();
             pid = qualident();
             accept(SEMI);
         }
         ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
         boolean checkForImports = true;
-        while (S.token() != EOF) {
-            if (S.pos() <= errorEndPos) {
+        boolean firstTypeDecl = true;
+        while (token.kind != EOF) {
+            if (token.pos <= endPosTable.errorEndPos) {
                 // error recovery
                 skip(checkForImports, false, false, false);
-                if (S.token() == EOF)
+                if (token.kind == EOF)
                     break;
             }
-            if (checkForImports && mods == null && S.token() == IMPORT) {
+            if (checkForImports && mods == null && token.kind == IMPORT) {
+                seenImport = true;
                 defs.append(importDeclaration());
             } else {
-                JCTree def = typeDeclaration(mods);
-                if (keepDocComments && dc != null && docComments.get(def) == dc) {
-                    // If the first type declaration has consumed the first doc
-                    // comment, then don't use it for the top level comment as well.
-                    dc = null;
+                String docComment = token.comment(CommentStyle.JAVADOC);
+                if (firstTypeDecl && !seenImport && !seenPackage) {
+                    docComment = firstToken.comment(CommentStyle.JAVADOC);
+                    consumedToplevelDoc = true;
                 }
+                JCTree def = typeDeclaration(mods, docComment);
                 if (def instanceof JCExpressionStatement)
                     def = ((JCExpressionStatement)def).expr;
                 defs.append(def);
                 if (def instanceof JCClassDecl)
                     checkForImports = false;
                 mods = null;
+                firstTypeDecl = false;
             }
         }
-        JCTree.JCCompilationUnit toplevel = F.at(pos).TopLevel(packageAnnotations, pid, defs.toList());
-        attach(toplevel, dc);
+        JCTree.JCCompilationUnit toplevel = F.at(firstToken.pos).TopLevel(packageAnnotations, pid, defs.toList());
+        if (!consumedToplevelDoc)
+            attach(toplevel, firstToken.comment(CommentStyle.JAVADOC));
         if (defs.elems.isEmpty())
-            storeEnd(toplevel, S.prevEndPos());
+            storeEnd(toplevel, S.prevToken().endPos);
         if (keepDocComments)
             toplevel.docComments = docComments;
         if (keepLineMap)
             toplevel.lineMap = S.getLineMap();
+        toplevel.endPositions = this.endPosTable;
         return toplevel;
     }
 
     /** ImportDeclaration = IMPORT [ STATIC ] Ident { "." Ident } [ "." "*" ] ";"
      */
     JCTree importDeclaration() {
-        int pos = S.pos();
-        S.nextToken();
+        int pos = token.pos;
+        nextToken();
         boolean importStatic = false;
-        if (S.token() == STATIC) {
+        if (token.kind == STATIC) {
             checkStaticImports();
             importStatic = true;
-            S.nextToken();
+            nextToken();
         }
-        JCExpression pid = toP(F.at(S.pos()).Ident(ident()));
+        JCExpression pid = toP(F.at(token.pos).Ident(ident()));
         do {
-            int pos1 = S.pos();
+            int pos1 = token.pos;
             accept(DOT);
-            if (S.token() == STAR) {
+            if (token.kind == STAR) {
                 pid = to(F.at(pos1).Select(pid, names.asterisk));
-                S.nextToken();
+                nextToken();
                 break;
             } else {
                 pid = toP(F.at(pos1).Select(pid, ident()));
             }
-        } while (S.token() == DOT);
+        } while (token.kind == DOT);
         accept(SEMI);
         return toP(F.at(pos).Import(pid, importStatic));
     }
@@ -2299,14 +2597,13 @@
     /** TypeDeclaration = ClassOrInterfaceOrEnumDeclaration
      *                  | ";"
      */
-    JCTree typeDeclaration(JCModifiers mods) {
-        int pos = S.pos();
-        if (mods == null && S.token() == SEMI) {
-            S.nextToken();
+    JCTree typeDeclaration(JCModifiers mods, String docComment) {
+        int pos = token.pos;
+        if (mods == null && token.kind == SEMI) {
+            nextToken();
             return toP(F.at(pos).Skip());
         } else {
-            String dc = S.docComment();
-            return classOrInterfaceOrEnumDeclaration(modifiersOpt(mods), dc);
+            return classOrInterfaceOrEnumDeclaration(modifiersOpt(mods), docComment);
         }
     }
 
@@ -2316,19 +2613,19 @@
      *  @param dc       The documentation comment for the class, or null.
      */
     JCStatement classOrInterfaceOrEnumDeclaration(JCModifiers mods, String dc) {
-        if (S.token() == CLASS) {
+        if (token.kind == CLASS) {
             return classDeclaration(mods, dc);
-        } else if (S.token() == INTERFACE) {
+        } else if (token.kind == INTERFACE) {
             return interfaceDeclaration(mods, dc);
         } else if (allowEnums) {
-            if (S.token() == ENUM) {
+            if (token.kind == ENUM) {
                 return enumDeclaration(mods, dc);
             } else {
-                int pos = S.pos();
+                int pos = token.pos;
                 List<JCTree> errs;
-                if (S.token() == IDENTIFIER) {
+                if (token.kind == IDENTIFIER) {
                     errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
-                    setErrorEndPos(S.pos());
+                    setErrorEndPos(token.pos);
                 } else {
                     errs = List.<JCTree>of(mods);
                 }
@@ -2336,16 +2633,16 @@
                                               CLASS, INTERFACE, ENUM)));
             }
         } else {
-            if (S.token() == ENUM) {
-                error(S.pos(), "enums.not.supported.in.source", source.name);
+            if (token.kind == ENUM) {
+                error(token.pos, "enums.not.supported.in.source", source.name);
                 allowEnums = true;
                 return enumDeclaration(mods, dc);
             }
-            int pos = S.pos();
+            int pos = token.pos;
             List<JCTree> errs;
-            if (S.token() == IDENTIFIER) {
+            if (token.kind == IDENTIFIER) {
                 errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
-                setErrorEndPos(S.pos());
+                setErrorEndPos(token.pos);
             } else {
                 errs = List.<JCTree>of(mods);
             }
@@ -2359,21 +2656,21 @@
      *  @param mods    The modifiers starting the class declaration
      *  @param dc       The documentation comment for the class, or null.
      */
-    JCClassDecl classDeclaration(JCModifiers mods, String dc) {
-        int pos = S.pos();
+    protected JCClassDecl classDeclaration(JCModifiers mods, String dc) {
+        int pos = token.pos;
         accept(CLASS);
         Name name = ident();
 
         List<JCTypeParameter> typarams = typeParametersOpt();
 
         JCExpression extending = null;
-        if (S.token() == EXTENDS) {
-            S.nextToken();
+        if (token.kind == EXTENDS) {
+            nextToken();
             extending = parseType();
         }
         List<JCExpression> implementing = List.nil();
-        if (S.token() == IMPLEMENTS) {
-            S.nextToken();
+        if (token.kind == IMPLEMENTS) {
+            nextToken();
             implementing = typeList();
         }
         List<JCTree> defs = classOrInterfaceBody(name, false);
@@ -2388,16 +2685,16 @@
      *  @param mods    The modifiers starting the interface declaration
      *  @param dc       The documentation comment for the interface, or null.
      */
-    JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) {
-        int pos = S.pos();
+    protected JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) {
+        int pos = token.pos;
         accept(INTERFACE);
         Name name = ident();
 
         List<JCTypeParameter> typarams = typeParametersOpt();
 
         List<JCExpression> extending = List.nil();
-        if (S.token() == EXTENDS) {
-            S.nextToken();
+        if (token.kind == EXTENDS) {
+            nextToken();
             extending = typeList();
         }
         List<JCTree> defs = classOrInterfaceBody(name, true);
@@ -2411,14 +2708,14 @@
      *  @param mods    The modifiers starting the enum declaration
      *  @param dc       The documentation comment for the enum, or null.
      */
-    JCClassDecl enumDeclaration(JCModifiers mods, String dc) {
-        int pos = S.pos();
+    protected JCClassDecl enumDeclaration(JCModifiers mods, String dc) {
+        int pos = token.pos;
         accept(ENUM);
         Name name = ident();
 
         List<JCExpression> implementing = List.nil();
-        if (S.token() == IMPLEMENTS) {
-            S.nextToken();
+        if (token.kind == IMPLEMENTS) {
+            nextToken();
             implementing = typeList();
         }
 
@@ -2437,27 +2734,27 @@
     List<JCTree> enumBody(Name enumName) {
         accept(LBRACE);
         ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
-        if (S.token() == COMMA) {
-            S.nextToken();
-        } else if (S.token() != RBRACE && S.token() != SEMI) {
+        if (token.kind == COMMA) {
+            nextToken();
+        } else if (token.kind != RBRACE && token.kind != SEMI) {
             defs.append(enumeratorDeclaration(enumName));
-            while (S.token() == COMMA) {
-                S.nextToken();
-                if (S.token() == RBRACE || S.token() == SEMI) break;
+            while (token.kind == COMMA) {
+                nextToken();
+                if (token.kind == RBRACE || token.kind == SEMI) break;
                 defs.append(enumeratorDeclaration(enumName));
             }
-            if (S.token() != SEMI && S.token() != RBRACE) {
-                defs.append(syntaxError(S.pos(), "expected3",
+            if (token.kind != SEMI && token.kind != RBRACE) {
+                defs.append(syntaxError(token.pos, "expected3",
                                 COMMA, RBRACE, SEMI));
-                S.nextToken();
+                nextToken();
             }
         }
-        if (S.token() == SEMI) {
-            S.nextToken();
-            while (S.token() != RBRACE && S.token() != EOF) {
+        if (token.kind == SEMI) {
+            nextToken();
+            while (token.kind != RBRACE && token.kind != EOF) {
                 defs.appendList(classOrInterfaceBodyDeclaration(enumName,
                                                                 false));
-                if (S.pos() <= errorEndPos) {
+                if (token.pos <= endPosTable.errorEndPos) {
                     // error recovery
                    skip(false, true, true, false);
                 }
@@ -2470,23 +2767,22 @@
     /** EnumeratorDeclaration = AnnotationsOpt [TypeArguments] IDENTIFIER [ Arguments ] [ "{" ClassBody "}" ]
      */
     JCTree enumeratorDeclaration(Name enumName) {
-        String dc = S.docComment();
+        String dc = token.comment(CommentStyle.JAVADOC);
         int flags = Flags.PUBLIC|Flags.STATIC|Flags.FINAL|Flags.ENUM;
-        if (S.deprecatedFlag()) {
+        if (token.deprecatedFlag()) {
             flags |= Flags.DEPRECATED;
-            S.resetDeprecatedFlag();
         }
-        int pos = S.pos();
+        int pos = token.pos;
         List<JCAnnotation> annotations = annotationsOpt();
         JCModifiers mods = F.at(annotations.isEmpty() ? Position.NOPOS : pos).Modifiers(flags, annotations);
         List<JCExpression> typeArgs = typeArgumentsOpt();
-        int identPos = S.pos();
+        int identPos = token.pos;
         Name name = ident();
-        int createPos = S.pos();
-        List<JCExpression> args = (S.token() == LPAREN)
+        int createPos = token.pos;
+        List<JCExpression> args = (token.kind == LPAREN)
             ? arguments() : List.<JCExpression>nil();
         JCClassDecl body = null;
-        if (S.token() == LBRACE) {
+        if (token.kind == LBRACE) {
             JCModifiers mods1 = F.at(Position.NOPOS).Modifiers(Flags.ENUM | Flags.STATIC);
             List<JCTree> defs = classOrInterfaceBody(names.empty, false);
             body = toP(F.at(identPos).AnonymousClassDef(mods1, defs));
@@ -2496,7 +2792,7 @@
         JCIdent ident = F.at(identPos).Ident(enumName);
         JCNewClass create = F.at(createPos).NewClass(null, typeArgs, ident, args, body);
         if (createPos != identPos)
-            storeEnd(create, S.prevEndPos());
+            storeEnd(create, S.prevToken().endPos);
         ident = F.at(identPos).Ident(enumName);
         JCTree result = toP(F.at(pos).VarDef(mods, name, ident, create));
         attach(result, dc);
@@ -2508,8 +2804,8 @@
     List<JCExpression> typeList() {
         ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
         ts.append(parseType());
-        while (S.token() == COMMA) {
-            S.nextToken();
+        while (token.kind == COMMA) {
+            nextToken();
             ts.append(parseType());
         }
         return ts.toList();
@@ -2520,16 +2816,16 @@
      */
     List<JCTree> classOrInterfaceBody(Name className, boolean isInterface) {
         accept(LBRACE);
-        if (S.pos() <= errorEndPos) {
+        if (token.pos <= endPosTable.errorEndPos) {
             // error recovery
             skip(false, true, false, false);
-            if (S.token() == LBRACE)
-                S.nextToken();
+            if (token.kind == LBRACE)
+                nextToken();
         }
         ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
-        while (S.token() != RBRACE && S.token() != EOF) {
+        while (token.kind != RBRACE && token.kind != EOF) {
             defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface));
-            if (S.pos() <= errorEndPos) {
+            if (token.pos <= endPosTable.errorEndPos) {
                // error recovery
                skip(false, true, true, false);
            }
@@ -2555,24 +2851,24 @@
      *    | ModifiersOpt Type Ident
      *      ( ConstantDeclaratorsRest | InterfaceMethodDeclaratorRest ";" )
      */
-    List<JCTree> classOrInterfaceBodyDeclaration(Name className, boolean isInterface) {
-        if (S.token() == SEMI) {
-            S.nextToken();
+    protected List<JCTree> classOrInterfaceBodyDeclaration(Name className, boolean isInterface) {
+        if (token.kind == SEMI) {
+            nextToken();
             return List.<JCTree>nil();
         } else {
-            String dc = S.docComment();
-            int pos = S.pos();
+            String dc = token.comment(CommentStyle.JAVADOC);
+            int pos = token.pos;
             JCModifiers mods = modifiersOpt();
-            if (S.token() == CLASS ||
-                S.token() == INTERFACE ||
-                allowEnums && S.token() == ENUM) {
+            if (token.kind == CLASS ||
+                token.kind == INTERFACE ||
+                allowEnums && token.kind == ENUM) {
                 return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
-            } else if (S.token() == LBRACE && !isInterface &&
+            } else if (token.kind == LBRACE && !isInterface &&
                        (mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
                        mods.annotations.isEmpty()) {
                 return List.<JCTree>of(block(pos, mods.flags));
             } else {
-                pos = S.pos();
+                pos = token.pos;
                 List<JCTypeParameter> typarams = typeParametersOpt();
                 // if there are type parameters but no modifiers, save the start
                 // position of the method in the modifiers.
@@ -2580,26 +2876,26 @@
                     mods.pos = pos;
                     storeEnd(mods, pos);
                 }
-                Name name = S.name();
-                pos = S.pos();
+                Token tk = token;
+                pos = token.pos;
                 JCExpression type;
-                boolean isVoid = S.token() == VOID;
+                boolean isVoid = token.kind == VOID;
                 if (isVoid) {
                     type = to(F.at(pos).TypeIdent(TypeTags.VOID));
-                    S.nextToken();
+                    nextToken();
                 } else {
                     type = parseType();
                 }
-                if (S.token() == LPAREN && !isInterface && type.getTag() == JCTree.IDENT) {
-                    if (isInterface || name != className)
+                if (token.kind == LPAREN && !isInterface && type.hasTag(IDENT)) {
+                    if (isInterface || tk.name() != className)
                         error(pos, "invalid.meth.decl.ret.type.req");
                     return List.of(methodDeclaratorRest(
                         pos, mods, null, names.init, typarams,
                         isInterface, true, dc));
                 } else {
-                    pos = S.pos();
-                    name = ident();
-                    if (S.token() == LPAREN) {
+                    pos = token.pos;
+                    Name name = ident();
+                    if (token.kind == LPAREN) {
                         return List.of(methodDeclaratorRest(
                             pos, mods, type, name, typarams,
                             isInterface, isVoid, dc));
@@ -2607,16 +2903,16 @@
                         List<JCTree> defs =
                             variableDeclaratorsRest(pos, mods, type, name, isInterface, dc,
                                                     new ListBuffer<JCTree>()).toList();
-                        storeEnd(defs.last(), S.endPos());
+                        storeEnd(defs.last(), token.endPos);
                         accept(SEMI);
                         return defs;
                     } else {
-                        pos = S.pos();
+                        pos = token.pos;
                         List<JCTree> err = isVoid
                             ? List.<JCTree>of(toP(F.at(pos).MethodDef(mods, name, type, typarams,
                                 List.<JCVariableDecl>nil(), List.<JCExpression>nil(), null, null)))
                             : null;
-                        return List.<JCTree>of(syntaxError(S.pos(), err, "expected", LPAREN));
+                        return List.<JCTree>of(syntaxError(token.pos, err, "expected", LPAREN));
                     }
                 }
             }
@@ -2634,7 +2930,7 @@
      *  ConstructorDeclaratorRest =
      *      "(" FormalParameterListOpt ")" [THROWS TypeList] MethodBody
      */
-    JCTree methodDeclaratorRest(int pos,
+    protected JCTree methodDeclaratorRest(int pos,
                               JCModifiers mods,
                               JCExpression type,
                               Name name,
@@ -2644,27 +2940,27 @@
         List<JCVariableDecl> params = formalParameters();
         if (!isVoid) type = bracketsOpt(type);
         List<JCExpression> thrown = List.nil();
-        if (S.token() == THROWS) {
-            S.nextToken();
+        if (token.kind == THROWS) {
+            nextToken();
             thrown = qualidentList();
         }
         JCBlock body = null;
         JCExpression defaultValue;
-        if (S.token() == LBRACE) {
+        if (token.kind == LBRACE) {
             body = block();
             defaultValue = null;
         } else {
-            if (S.token() == DEFAULT) {
+            if (token.kind == DEFAULT) {
                 accept(DEFAULT);
                 defaultValue = annotationValue();
             } else {
                 defaultValue = null;
             }
             accept(SEMI);
-            if (S.pos() <= errorEndPos) {
+            if (token.pos <= endPosTable.errorEndPos) {
                 // error recovery
                 skip(false, true, false, false);
-                if (S.token() == LBRACE) {
+                if (token.kind == LBRACE) {
                     body = block();
                 }
             }
@@ -2683,8 +2979,8 @@
     List<JCExpression> qualidentList() {
         ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
         ts.append(qualident());
-        while (S.token() == COMMA) {
-            S.nextToken();
+        while (token.kind == COMMA) {
+            nextToken();
             ts.append(qualident());
         }
         return ts.toList();
@@ -2693,13 +2989,13 @@
     /** TypeParametersOpt = ["<" TypeParameter {"," TypeParameter} ">"]
      */
     List<JCTypeParameter> typeParametersOpt() {
-        if (S.token() == LT) {
+        if (token.kind == LT) {
             checkGenerics();
             ListBuffer<JCTypeParameter> typarams = new ListBuffer<JCTypeParameter>();
-            S.nextToken();
+            nextToken();
             typarams.append(typeParameter());
-            while (S.token() == COMMA) {
-                S.nextToken();
+            while (token.kind == COMMA) {
+                nextToken();
                 typarams.append(typeParameter());
             }
             accept(GT);
@@ -2714,14 +3010,14 @@
      *  TypeVariable = Ident
      */
     JCTypeParameter typeParameter() {
-        int pos = S.pos();
+        int pos = token.pos;
         Name name = ident();
         ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>();
-        if (S.token() == EXTENDS) {
-            S.nextToken();
+        if (token.kind == EXTENDS) {
+            nextToken();
             bounds.append(parseType());
-            while (S.token() == AMP) {
-                S.nextToken();
+            while (token.kind == AMP) {
+                nextToken();
                 bounds.append(parseType());
             }
         }
@@ -2736,10 +3032,10 @@
         ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
         JCVariableDecl lastParam = null;
         accept(LPAREN);
-        if (S.token() != RPAREN) {
+        if (token.kind != RPAREN) {
             params.append(lastParam = formalParameter());
-            while ((lastParam.mods.flags & Flags.VARARGS) == 0 && S.token() == COMMA) {
-                S.nextToken();
+            while ((lastParam.mods.flags & Flags.VARARGS) == 0 && token.kind == COMMA) {
+                nextToken();
                 params.append(lastParam = formalParameter());
             }
         }
@@ -2747,6 +3043,24 @@
         return params.toList();
     }
 
+    List<JCVariableDecl> implicitParameters(boolean hasParens) {
+        if (hasParens) {
+            accept(LPAREN);
+        }
+        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+        if (token.kind != RPAREN && token.kind != ARROW) {
+            params.append(implicitParameter());
+            while (token.kind == COMMA) {
+                nextToken();
+                params.append(implicitParameter());
+            }
+        }
+        if (hasParens) {
+            accept(RPAREN);
+        }
+        return params.toList();
+    }
+
     JCModifiers optFinal(long flags) {
         JCModifiers mods = modifiersOpt();
         checkNoMods(mods.flags & ~(Flags.FINAL | Flags.DEPRECATED));
@@ -2757,24 +3071,33 @@
     /** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId
      *  LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter
      */
-    JCVariableDecl formalParameter() {
+    protected JCVariableDecl formalParameter() {
         JCModifiers mods = optFinal(Flags.PARAMETER);
         JCExpression type = parseType();
-        if (S.token() == ELLIPSIS) {
+        if (token.kind == ELLIPSIS) {
             checkVarargs();
             mods.flags |= Flags.VARARGS;
-            type = to(F.at(S.pos()).TypeArray(type));
-            S.nextToken();
+            type = to(F.at(token.pos).TypeArray(type));
+            nextToken();
         }
         return variableDeclaratorId(mods, type);
     }
 
+    protected JCVariableDecl implicitParameter() {
+        JCModifiers mods = F.at(token.pos).Modifiers(Flags.PARAMETER);
+        return variableDeclaratorId(mods, null);
+    }
+
 /* ---------- auxiliary methods -------------- */
 
     void error(int pos, String key, Object ... args) {
         log.error(DiagnosticFlag.SYNTAX, pos, key, args);
     }
 
+    void error(DiagnosticPosition pos, String key, Object ... args) {
+        log.error(DiagnosticFlag.SYNTAX, pos, key, args);
+    }
+
     void warning(int pos, String key, Object ... args) {
         log.warning(pos, key, args);
     }
@@ -2783,28 +3106,29 @@
      */
     protected JCExpression checkExprStat(JCExpression t) {
         switch(t.getTag()) {
-        case JCTree.PREINC: case JCTree.PREDEC:
-        case JCTree.POSTINC: case JCTree.POSTDEC:
-        case JCTree.ASSIGN:
-        case JCTree.BITOR_ASG: case JCTree.BITXOR_ASG: case JCTree.BITAND_ASG:
-        case JCTree.SL_ASG: case JCTree.SR_ASG: case JCTree.USR_ASG:
-        case JCTree.PLUS_ASG: case JCTree.MINUS_ASG:
-        case JCTree.MUL_ASG: case JCTree.DIV_ASG: case JCTree.MOD_ASG:
-        case JCTree.APPLY: case JCTree.NEWCLASS:
-        case JCTree.ERRONEOUS:
+        case PREINC: case PREDEC:
+        case POSTINC: case POSTDEC:
+        case ASSIGN:
+        case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG:
+        case SL_ASG: case SR_ASG: case USR_ASG:
+        case PLUS_ASG: case MINUS_ASG:
+        case MUL_ASG: case DIV_ASG: case MOD_ASG:
+        case APPLY: case NEWCLASS:
+        case ERRONEOUS:
             return t;
         default:
-            error(t.pos, "not.stmt");
-            return F.at(t.pos).Erroneous(List.<JCTree>of(t));
+            JCExpression ret = F.at(t.pos).Erroneous(List.<JCTree>of(t));
+            error(ret, "not.stmt");
+            return ret;
         }
     }
 
     /** Return precedence of operator represented by token,
      *  -1 if token is not a binary operator. @see TreeInfo.opPrec
      */
-    static int prec(Token token) {
-        int oc = optag(token);
-        return (oc >= 0) ? TreeInfo.opPrec(oc) : -1;
+    static int prec(TokenKind token) {
+        JCTree.Tag oc = optag(token);
+        return (oc != NO_TAG) ? TreeInfo.opPrec(oc) : -1;
     }
 
     /**
@@ -2820,103 +3144,103 @@
     }
 
     /** Return operation tag of binary operator represented by token,
-     *  -1 if token is not a binary operator.
+     *  No_TAG if token is not a binary operator.
      */
-    static int optag(Token token) {
+    static JCTree.Tag optag(TokenKind token) {
         switch (token) {
         case BARBAR:
-            return JCTree.OR;
+            return OR;
         case AMPAMP:
-            return JCTree.AND;
+            return AND;
         case BAR:
-            return JCTree.BITOR;
+            return BITOR;
         case BAREQ:
-            return JCTree.BITOR_ASG;
+            return BITOR_ASG;
         case CARET:
-            return JCTree.BITXOR;
+            return BITXOR;
         case CARETEQ:
-            return JCTree.BITXOR_ASG;
+            return BITXOR_ASG;
         case AMP:
-            return JCTree.BITAND;
+            return BITAND;
         case AMPEQ:
-            return JCTree.BITAND_ASG;
+            return BITAND_ASG;
         case EQEQ:
-            return JCTree.EQ;
+            return JCTree.Tag.EQ;
         case BANGEQ:
-            return JCTree.NE;
+            return NE;
         case LT:
-            return JCTree.LT;
+            return JCTree.Tag.LT;
         case GT:
-            return JCTree.GT;
+            return JCTree.Tag.GT;
         case LTEQ:
-            return JCTree.LE;
+            return LE;
         case GTEQ:
-            return JCTree.GE;
+            return GE;
         case LTLT:
-            return JCTree.SL;
+            return SL;
         case LTLTEQ:
-            return JCTree.SL_ASG;
+            return SL_ASG;
         case GTGT:
-            return JCTree.SR;
+            return SR;
         case GTGTEQ:
-            return JCTree.SR_ASG;
+            return SR_ASG;
         case GTGTGT:
-            return JCTree.USR;
+            return USR;
         case GTGTGTEQ:
-            return JCTree.USR_ASG;
+            return USR_ASG;
         case PLUS:
-            return JCTree.PLUS;
+            return JCTree.Tag.PLUS;
         case PLUSEQ:
-            return JCTree.PLUS_ASG;
+            return PLUS_ASG;
         case SUB:
-            return JCTree.MINUS;
+            return MINUS;
         case SUBEQ:
-            return JCTree.MINUS_ASG;
+            return MINUS_ASG;
         case STAR:
-            return JCTree.MUL;
+            return MUL;
         case STAREQ:
-            return JCTree.MUL_ASG;
+            return MUL_ASG;
         case SLASH:
-            return JCTree.DIV;
+            return DIV;
         case SLASHEQ:
-            return JCTree.DIV_ASG;
+            return DIV_ASG;
         case PERCENT:
-            return JCTree.MOD;
+            return MOD;
         case PERCENTEQ:
-            return JCTree.MOD_ASG;
+            return MOD_ASG;
         case INSTANCEOF:
-            return JCTree.TYPETEST;
+            return TYPETEST;
         default:
-            return -1;
+            return NO_TAG;
         }
     }
 
     /** Return operation tag of unary operator represented by token,
-     *  -1 if token is not a binary operator.
+     *  No_TAG if token is not a binary operator.
      */
-    static int unoptag(Token token) {
+    static JCTree.Tag unoptag(TokenKind token) {
         switch (token) {
         case PLUS:
-            return JCTree.POS;
+            return POS;
         case SUB:
-            return JCTree.NEG;
+            return NEG;
         case BANG:
-            return JCTree.NOT;
+            return NOT;
         case TILDE:
-            return JCTree.COMPL;
+            return COMPL;
         case PLUSPLUS:
-            return JCTree.PREINC;
+            return PREINC;
         case SUBSUB:
-            return JCTree.PREDEC;
+            return PREDEC;
         default:
-            return -1;
+            return NO_TAG;
         }
     }
 
     /** Return type tag of basic type represented by token,
      *  -1 if token is not a basic type identifier.
      */
-    static int typetag(Token token) {
+    static int typetag(TokenKind token) {
         switch (token) {
         case BYTE:
             return TypeTags.BYTE;
@@ -2941,50 +3265,170 @@
 
     void checkGenerics() {
         if (!allowGenerics) {
-            error(S.pos(), "generics.not.supported.in.source", source.name);
+            error(token.pos, "generics.not.supported.in.source", source.name);
             allowGenerics = true;
         }
     }
     void checkVarargs() {
         if (!allowVarargs) {
-            error(S.pos(), "varargs.not.supported.in.source", source.name);
+            error(token.pos, "varargs.not.supported.in.source", source.name);
             allowVarargs = true;
         }
     }
     void checkForeach() {
         if (!allowForeach) {
-            error(S.pos(), "foreach.not.supported.in.source", source.name);
+            error(token.pos, "foreach.not.supported.in.source", source.name);
             allowForeach = true;
         }
     }
     void checkStaticImports() {
         if (!allowStaticImport) {
-            error(S.pos(), "static.import.not.supported.in.source", source.name);
+            error(token.pos, "static.import.not.supported.in.source", source.name);
             allowStaticImport = true;
         }
     }
     void checkAnnotations() {
         if (!allowAnnotations) {
-            error(S.pos(), "annotations.not.supported.in.source", source.name);
+            error(token.pos, "annotations.not.supported.in.source", source.name);
             allowAnnotations = true;
         }
     }
     void checkDiamond() {
         if (!allowDiamond) {
-            error(S.pos(), "diamond.not.supported.in.source", source.name);
+            error(token.pos, "diamond.not.supported.in.source", source.name);
             allowDiamond = true;
         }
     }
     void checkMulticatch() {
         if (!allowMulticatch) {
-            error(S.pos(), "multicatch.not.supported.in.source", source.name);
+            error(token.pos, "multicatch.not.supported.in.source", source.name);
             allowMulticatch = true;
         }
     }
     void checkTryWithResources() {
         if (!allowTWR) {
-            error(S.pos(), "try.with.resources.not.supported.in.source", source.name);
+            error(token.pos, "try.with.resources.not.supported.in.source", source.name);
             allowTWR = true;
         }
     }
+    void checkLambda() {
+        if (!allowLambda) {
+            log.error(token.pos, "lambda.not.supported.in.source", source.name);
+            allowLambda = true;
+        }
+    }
+    void checkMethodReferences() {
+        if (!allowMethodReferences) {
+            log.error(token.pos, "method.references.not.supported.in.source", source.name);
+            allowMethodReferences = true;
+        }
+    }
+
+    /*
+     * a functional source tree and end position mappings
+     */
+    protected class SimpleEndPosTable extends AbstractEndPosTable {
+
+        private final Map<JCTree, Integer> endPosMap;
+
+        SimpleEndPosTable() {
+            endPosMap = new HashMap<JCTree, Integer>();
+        }
+
+        protected void storeEnd(JCTree tree, int endpos) {
+            endPosMap.put(tree, errorEndPos > endpos ? errorEndPos : endpos);
+        }
+
+        protected <T extends JCTree> T to(T t) {
+            storeEnd(t, token.endPos);
+            return t;
+        }
+
+        protected <T extends JCTree> T toP(T t) {
+            storeEnd(t, S.prevToken().endPos);
+            return t;
+        }
+
+        public int getEndPos(JCTree tree) {
+            Integer value = endPosMap.get(tree);
+            return (value == null) ? Position.NOPOS : value;
+        }
+
+        public int replaceTree(JCTree oldTree, JCTree newTree) {
+            Integer pos = endPosMap.remove(oldTree);
+            if (pos != null) {
+                endPosMap.put(newTree, pos);
+                return pos;
+            }
+            return Position.NOPOS;
+        }
+    }
+
+    /*
+     * a default skeletal implementation without any mapping overhead.
+     */
+    protected class EmptyEndPosTable extends AbstractEndPosTable {
+
+        protected void storeEnd(JCTree tree, int endpos) { /* empty */ }
+
+        protected <T extends JCTree> T to(T t) {
+            return t;
+        }
+
+        protected <T extends JCTree> T toP(T t) {
+            return t;
+        }
+
+        public int getEndPos(JCTree tree) {
+            return Position.NOPOS;
+        }
+
+        public int replaceTree(JCTree oldTree, JCTree newTree) {
+            return Position.NOPOS;
+        }
+
+    }
+
+    protected abstract class AbstractEndPosTable implements EndPosTable {
+
+        /**
+         * Store the last error position.
+         */
+        protected int errorEndPos;
+
+        /**
+         * Store ending position for a tree, the value of which is the greater
+         * of last error position and the given ending position.
+         * @param tree   The tree.
+         * @param endpos The ending position to associate with the tree.
+         */
+        protected abstract void storeEnd(JCTree tree, int endpos);
+
+        /**
+         * Store current token's ending position for a tree, the value of which
+         * will be the greater of last error position and the ending position of
+         * the current token.
+         * @param t The tree.
+         */
+        protected abstract <T extends JCTree> T to(T t);
+
+        /**
+         * Store current token's ending position for a tree, the value of which
+         * will be the greater of last error position and the ending position of
+         * the previous token.
+         * @param t The tree.
+         */
+        protected abstract <T extends JCTree> T toP(T t);
+
+        /**
+         * Set the error position during the parsing phases, the value of which
+         * will be set only if it is greater than the last stored error position.
+         * @param errPos The error position
+         */
+        protected void setErrorEndPos(int errPos) {
+            if (errPos > errorEndPos) {
+                errorEndPos = errPos;
+            }
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,355 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.parser;
+
+import com.sun.tools.javac.parser.Tokens.Comment;
+import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
+import com.sun.tools.javac.util.*;
+
+import java.nio.*;
+
+import static com.sun.tools.javac.util.LayoutCharacters.*;
+
+/** An extension to the base lexical analyzer that captures
+ *  and processes the contents of doc comments.  It does so by
+ *  translating Unicode escape sequences and by stripping the
+ *  leading whitespace and starts from each line of the comment.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class JavadocTokenizer extends JavaTokenizer {
+
+    /** Create a scanner from the input buffer.  buffer must implement
+     *  array() and compact(), and remaining() must be less than limit().
+     */
+    protected JavadocTokenizer(ScannerFactory fac, CharBuffer buffer) {
+        super(fac, buffer);
+    }
+
+    /** Create a scanner from the input array.  The array must have at
+     *  least a single character of extra space.
+     */
+    protected JavadocTokenizer(ScannerFactory fac, char[] input, int inputLength) {
+        super(fac, input, inputLength);
+    }
+
+    @Override
+    protected Comment processComment(int pos, int endPos, CommentStyle style) {
+        char[] buf = reader.getRawCharacters(pos, endPos);
+        return new JavadocComment(new ColReader(fac, buf, buf.length), style);
+    }
+
+    /**
+     * This is a specialized version of UnicodeReader that keeps track of the
+     * column position within a given character stream (used for Javadoc processing).
+     */
+    static class ColReader extends UnicodeReader {
+
+         int col;
+
+         ColReader(ScannerFactory fac, char[] input, int inputLength) {
+             super(fac, input, inputLength);
+         }
+
+         @Override
+         protected void convertUnicode() {
+             if (ch == '\\' && unicodeConversionBp != bp) {
+                 bp++; ch = buf[bp]; col++;
+                 if (ch == 'u') {
+                     do {
+                         bp++; ch = buf[bp]; col++;
+                     } while (ch == 'u');
+                     int limit = bp + 3;
+                     if (limit < buflen) {
+                         int d = digit(bp, 16);
+                         int code = d;
+                         while (bp < limit && d >= 0) {
+                             bp++; ch = buf[bp]; col++;
+                             d = digit(bp, 16);
+                             code = (code << 4) + d;
+                         }
+                         if (d >= 0) {
+                             ch = (char)code;
+                             unicodeConversionBp = bp;
+                             return;
+                         }
+                     }
+                     // "illegal.Unicode.esc", reported by base scanner
+                 } else {
+                     bp--;
+                     ch = '\\';
+                     col--;
+                 }
+             }
+         }
+
+         @Override
+         protected void scanCommentChar() {
+             scanChar();
+             if (ch == '\\') {
+                 if (peekChar() == '\\' && !isUnicode()) {
+                     putChar(ch, false);
+                     bp++; col++;
+                 } else {
+                     convertUnicode();
+                 }
+             }
+         }
+
+         @Override
+         protected void scanChar() {
+             bp++;
+             ch = buf[bp];
+             switch (ch) {
+             case '\r': // return
+                 col = 0;
+                 break;
+             case '\n': // newline
+                 if (bp == 0 || buf[bp-1] != '\r') {
+                     col = 0;
+                 }
+                 break;
+             case '\t': // tab
+                 col = (col / TabInc * TabInc) + TabInc;
+                 break;
+             case '\\': // possible Unicode
+                 col++;
+                 convertUnicode();
+                 break;
+             default:
+                 col++;
+                 break;
+             }
+         }
+     }
+
+     protected class JavadocComment extends JavaTokenizer.BasicComment<ColReader> {
+
+        /**
+        * Translated and stripped contents of doc comment
+        */
+        private String docComment = null;
+
+        JavadocComment(ColReader comment_reader, CommentStyle cs) {
+            super(comment_reader, cs);
+        }
+
+        public String getText() {
+            if (!scanned && cs == CommentStyle.JAVADOC) {
+                scanDocComment();
+            }
+            return docComment;
+        }
+
+        @Override
+        @SuppressWarnings("fallthrough")
+        protected void scanDocComment() {
+             try {
+                 boolean firstLine = true;
+
+                 // Skip over first slash
+                 comment_reader.scanCommentChar();
+                 // Skip over first star
+                 comment_reader.scanCommentChar();
+
+                 // consume any number of stars
+                 while (comment_reader.bp < comment_reader.buflen && comment_reader.ch == '*') {
+                     comment_reader.scanCommentChar();
+                 }
+                 // is the comment in the form /**/, /***/, /****/, etc. ?
+                 if (comment_reader.bp < comment_reader.buflen && comment_reader.ch == '/') {
+                     docComment = "";
+                     return;
+                 }
+
+                 // skip a newline on the first line of the comment.
+                 if (comment_reader.bp < comment_reader.buflen) {
+                     if (comment_reader.ch == LF) {
+                         comment_reader.scanCommentChar();
+                         firstLine = false;
+                     } else if (comment_reader.ch == CR) {
+                         comment_reader.scanCommentChar();
+                         if (comment_reader.ch == LF) {
+                             comment_reader.scanCommentChar();
+                             firstLine = false;
+                         }
+                     }
+                 }
+
+             outerLoop:
+
+                 // The outerLoop processes the doc comment, looping once
+                 // for each line.  For each line, it first strips off
+                 // whitespace, then it consumes any stars, then it
+                 // puts the rest of the line into our buffer.
+                 while (comment_reader.bp < comment_reader.buflen) {
+
+                     // The wsLoop consumes whitespace from the beginning
+                     // of each line.
+                 wsLoop:
+
+                     while (comment_reader.bp < comment_reader.buflen) {
+                         switch(comment_reader.ch) {
+                         case ' ':
+                             comment_reader.scanCommentChar();
+                             break;
+                         case '\t':
+                             comment_reader.col = ((comment_reader.col - 1) / TabInc * TabInc) + TabInc;
+                             comment_reader.scanCommentChar();
+                             break;
+                         case FF:
+                             comment_reader.col = 0;
+                             comment_reader.scanCommentChar();
+                             break;
+         // Treat newline at beginning of line (blank line, no star)
+         // as comment text.  Old Javadoc compatibility requires this.
+         /*---------------------------------*
+                         case CR: // (Spec 3.4)
+                             doc_reader.scanCommentChar();
+                             if (ch == LF) {
+                                 col = 0;
+                                 doc_reader.scanCommentChar();
+                             }
+                             break;
+                         case LF: // (Spec 3.4)
+                             doc_reader.scanCommentChar();
+                             break;
+         *---------------------------------*/
+                         default:
+                             // we've seen something that isn't whitespace;
+                             // jump out.
+                             break wsLoop;
+                         }
+                     }
+
+                     // Are there stars here?  If so, consume them all
+                     // and check for the end of comment.
+                     if (comment_reader.ch == '*') {
+                         // skip all of the stars
+                         do {
+                             comment_reader.scanCommentChar();
+                         } while (comment_reader.ch == '*');
+
+                         // check for the closing slash.
+                         if (comment_reader.ch == '/') {
+                             // We're done with the doc comment
+                             // scanChar() and breakout.
+                             break outerLoop;
+                         }
+                     } else if (! firstLine) {
+                         //The current line does not begin with a '*' so we will indent it.
+                         for (int i = 1; i < comment_reader.col; i++) {
+                             comment_reader.putChar(' ', false);
+                         }
+                     }
+                     // The textLoop processes the rest of the characters
+                     // on the line, adding them to our buffer.
+                 textLoop:
+                     while (comment_reader.bp < comment_reader.buflen) {
+                         switch (comment_reader.ch) {
+                         case '*':
+                             // Is this just a star?  Or is this the
+                             // end of a comment?
+                             comment_reader.scanCommentChar();
+                             if (comment_reader.ch == '/') {
+                                 // This is the end of the comment,
+                                 // set ch and return our buffer.
+                                 break outerLoop;
+                             }
+                             // This is just an ordinary star.  Add it to
+                             // the buffer.
+                             comment_reader.putChar('*', false);
+                             break;
+                         case ' ':
+                         case '\t':
+                             comment_reader.putChar(comment_reader.ch, false);
+                             comment_reader.scanCommentChar();
+                             break;
+                         case FF:
+                             comment_reader.scanCommentChar();
+                             break textLoop; // treat as end of line
+                         case CR: // (Spec 3.4)
+                             comment_reader.scanCommentChar();
+                             if (comment_reader.ch != LF) {
+                                 // Canonicalize CR-only line terminator to LF
+                                 comment_reader.putChar((char)LF, false);
+                                 break textLoop;
+                             }
+                             /* fall through to LF case */
+                         case LF: // (Spec 3.4)
+                             // We've seen a newline.  Add it to our
+                             // buffer and break out of this loop,
+                             // starting fresh on a new line.
+                             comment_reader.putChar(comment_reader.ch, false);
+                             comment_reader.scanCommentChar();
+                             break textLoop;
+                         default:
+                             // Add the character to our buffer.
+                             comment_reader.putChar(comment_reader.ch, false);
+                             comment_reader.scanCommentChar();
+                         }
+                     } // end textLoop
+                     firstLine = false;
+                 } // end outerLoop
+
+                 if (comment_reader.sp > 0) {
+                     int i = comment_reader.sp - 1;
+                 trailLoop:
+                     while (i > -1) {
+                         switch (comment_reader.sbuf[i]) {
+                         case '*':
+                             i--;
+                             break;
+                         default:
+                             break trailLoop;
+                         }
+                     }
+                     comment_reader.sp = i + 1;
+
+                     // Store the text of the doc comment
+                    docComment = comment_reader.chars();
+                } else {
+                    docComment = "";
+                }
+            } finally {
+                scanned = true;
+                if (docComment != null &&
+                        docComment.matches("(?sm).*^\\s*@deprecated( |$).*")) {
+                    deprecatedFlag = true;
+                }
+            }
+        }
+    }
+
+    @Override
+    public Position.LineMap getLineMap() {
+        char[] buf = reader.getRawCharacters();
+        return Position.makeLineMap(buf, buf.length, true);
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/parser/Keywords.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-
-import static com.sun.tools.javac.parser.Token.*;
-
-/**
- * Map from Name to Token and Token to String.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Keywords {
-    public static final Context.Key<Keywords> keywordsKey =
-        new Context.Key<Keywords>();
-
-    public static Keywords instance(Context context) {
-        Keywords instance = context.get(keywordsKey);
-        if (instance == null)
-            instance = new Keywords(context);
-        return instance;
-    }
-
-    private final Names names;
-
-    protected Keywords(Context context) {
-        context.put(keywordsKey, this);
-        names = Names.instance(context);
-
-        for (Token t : Token.values()) {
-            if (t.name != null)
-                enterKeyword(t.name, t);
-            else
-                tokenName[t.ordinal()] = null;
-        }
-
-        key = new Token[maxKey+1];
-        for (int i = 0; i <= maxKey; i++) key[i] = IDENTIFIER;
-        for (Token t : Token.values()) {
-            if (t.name != null)
-                key[tokenName[t.ordinal()].getIndex()] = t;
-        }
-    }
-
-
-    public Token key(Name name) {
-        return (name.getIndex() > maxKey) ? IDENTIFIER : key[name.getIndex()];
-    }
-
-    /**
-     * Keyword array. Maps name indices to Token.
-     */
-    private final Token[] key;
-
-    /**  The number of the last entered keyword.
-     */
-    private int maxKey = 0;
-
-    /** The names of all tokens.
-     */
-    private Name[] tokenName = new Name[Token.values().length];
-
-    private void enterKeyword(String s, Token token) {
-        Name n = names.fromString(s);
-        tokenName[token.ordinal()] = n;
-        if (n.getIndex() > maxKey) maxKey = n.getIndex();
-    }
-}
--- a/src/share/classes/com/sun/tools/javac/parser/Lexer.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/Lexer.java	Tue May 29 00:27:58 2012 +0100
@@ -25,7 +25,7 @@
 
 package com.sun.tools.javac.parser;
 
-import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.parser.Tokens.*;
 import com.sun.tools.javac.util.Position.LineMap;
 
 /**
@@ -40,22 +40,31 @@
 public interface Lexer {
 
     /**
-     * Has a @deprecated been encountered in last doc comment?
-     * This needs to be reset by client with resetDeprecatedFlag.
+     * Consume the next token.
      */
-    boolean deprecatedFlag();
+    void nextToken();
 
-    void resetDeprecatedFlag();
+    /**
+     * Return current token.
+     */
+    Token token();
 
     /**
-     * Returns the documentation string of the current token.
+     * Return token with given lookahead.
      */
-    String docComment();
+    Token token(int lookahead);
 
     /**
-     * Return the last character position of the current token.
+     * Return the last character position of the previous token.
      */
-    int endPos();
+    Token prevToken();
+
+    /**
+     * Splits the current token in two and return the first (splitted) token.
+     * For instance '<<<' is splitted into two tokens '<' and '<<' respectively,
+     * and the latter is returned.
+     */
+    Token split();
 
     /**
      * Return the position where a lexical error occurred;
@@ -74,69 +83,4 @@
      * @return a LineMap
      */
     LineMap getLineMap();
-
-    /**
-     * Returns a copy of the input buffer, up to its inputLength.
-     * Unicode escape sequences are not translated.
-     */
-    char[] getRawCharacters();
-
-    /**
-     * Returns a copy of a character array subset of the input buffer.
-     * The returned array begins at the <code>beginIndex</code> and
-     * extends to the character at index <code>endIndex - 1</code>.
-     * Thus the length of the substring is <code>endIndex-beginIndex</code>.
-     * This behavior is like
-     * <code>String.substring(beginIndex, endIndex)</code>.
-     * Unicode escape sequences are not translated.
-     *
-     * @param beginIndex the beginning index, inclusive.
-     * @param endIndex the ending index, exclusive.
-     * @throws IndexOutOfBounds if either offset is outside of the
-     *         array bounds
-     */
-    char[] getRawCharacters(int beginIndex, int endIndex);
-
-    /**
-     * Return the name of an identifier or token for the current token.
-     */
-    Name name();
-
-    /**
-     * Read token.
-     */
-    void nextToken();
-
-    /**
-     * Return the current token's position: a 0-based
-     *  offset from beginning of the raw input stream
-     *  (before unicode translation)
-     */
-    int pos();
-
-    /**
-     * Return the last character position of the previous token.
-     */
-    int prevEndPos();
-
-    /**
-     * Return the radix of a numeric literal token.
-     */
-    int radix();
-
-    /**
-     * The value of a literal token, recorded as a string.
-     *  For integers, leading 0x and 'l' suffixes are suppressed.
-     */
-    String stringVal();
-
-    /**
-     * Return the current token, set by nextToken().
-     */
-    Token token();
-
-    /**
-     * Sets the current token.
-     */
-    void token(Token token);
 }
--- a/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
 
     final TreeMaker F;
     final Log log;
-    final Keywords keywords;
+    final Tokens tokens;
     final Source source;
     final Names names;
     final Options options;
@@ -67,7 +67,7 @@
         this.F = TreeMaker.instance(context);
         this.log = Log.instance(context);
         this.names = Names.instance(context);
-        this.keywords = Keywords.instance(context);
+        this.tokens = Tokens.instance(context);
         this.source = Source.instance(context);
         this.options = Options.instance(context);
         this.scannerFactory = ScannerFactory.instance(context);
@@ -75,10 +75,6 @@
 
     public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
         Lexer lexer = scannerFactory.newScanner(input, keepDocComments);
-        if (keepEndPos) {
-            return new EndPosParser(this, lexer, keepDocComments, keepLineMap);
-        } else {
-            return new JavacParser(this, lexer, keepDocComments, keepLineMap);
-        }
+        return new JavacParser(this, lexer, keepDocComments, keepLineMap, keepEndPos);
     }
 }
--- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Tue May 29 00:27:58 2012 +0100
@@ -26,14 +26,13 @@
 package com.sun.tools.javac.parser;
 
 import java.nio.*;
+import java.util.List;
+import java.util.ArrayList;
 
-import com.sun.tools.javac.code.Source;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.Position.LineMap;
+import com.sun.tools.javac.parser.JavaTokenizer.*;
 
-
-import static com.sun.tools.javac.parser.Token.*;
-import static com.sun.tools.javac.util.LayoutCharacters.*;
+import static com.sun.tools.javac.parser.Tokens.*;
 
 /** The lexical analyzer maps an input stream consisting of
  *  ASCII characters and Unicode escapes into a token sequence.
@@ -45,119 +44,21 @@
  */
 public class Scanner implements Lexer {
 
-    private static boolean scannerDebug = false;
-
-    /* Output variables; set by nextToken():
-     */
+    private Tokens tokens;
 
     /** The token, set by nextToken().
      */
     private Token token;
 
-    /** Allow hex floating-point literals.
-     */
-    private boolean allowHexFloats;
-
-    /** Allow binary literals.
-     */
-    private boolean allowBinaryLiterals;
-
-    /** Allow underscores in literals.
-     */
-    private boolean allowUnderscoresInLiterals;
-
-    /** The source language setting.
-     */
-    private Source source;
-
-    /** The token's position, 0-based offset from beginning of text.
-     */
-    private int pos;
-
-    /** Character position just after the last character of the token.
+    /** The previous token, set by nextToken().
      */
-    private int endPos;
-
-    /** The last character position of the previous token.
-     */
-    private int prevEndPos;
-
-    /** The position where a lexical error occurred;
-     */
-    private int errPos = Position.NOPOS;
-
-    /** The name of an identifier or token:
-     */
-    private Name name;
-
-    /** The radix of a numeric literal token.
-     */
-    private int radix;
-
-    /** Has a @deprecated been encountered in last doc comment?
-     *  this needs to be reset by client.
-     */
-    protected boolean deprecatedFlag = false;
-
-    /** A character buffer for literals.
-     */
-    private char[] sbuf = new char[128];
-    private int sp;
+    private Token prevToken;
 
-    /** The input buffer, index of next chacter to be read,
-     *  index of one past last character in buffer.
-     */
-    private char[] buf;
-    private int bp;
-    private int buflen;
-    private int eofPos;
-
-    /** The current character.
+    /** Buffer of saved tokens (used during lookahead)
      */
-    private char ch;
-
-    /** The buffer index of the last converted unicode character
-     */
-    private int unicodeConversionBp = -1;
-
-    /** The log to be used for error reporting.
-     */
-    private final Log log;
-
-    /** The name table. */
-    private final Names names;
-
-    /** The keyword table. */
-    private final Keywords keywords;
+    private List<Token> savedTokens = new ArrayList<Token>();
 
-    /** Common code for constructors. */
-    private Scanner(ScannerFactory fac) {
-        log = fac.log;
-        names = fac.names;
-        keywords = fac.keywords;
-        source = fac.source;
-        allowBinaryLiterals = source.allowBinaryLiterals();
-        allowHexFloats = source.allowHexFloats();
-        allowUnderscoresInLiterals = source.allowUnderscoresInLiterals();
-    }
-
-    private static final boolean hexFloatsWork = hexFloatsWork();
-    private static boolean hexFloatsWork() {
-        try {
-            Float.valueOf("0x1.0p1");
-            return true;
-        } catch (NumberFormatException ex) {
-            return false;
-        }
-    }
-
-    /** Create a scanner from the input buffer.  buffer must implement
-     *  array() and compact(), and remaining() must be less than limit().
-     */
-    protected Scanner(ScannerFactory fac, CharBuffer buffer) {
-        this(fac, JavacFileManager.toArray(buffer), buffer.limit());
-    }
-
+    private JavaTokenizer tokenizer;
     /**
      * Create a scanner from the input array.  This method might
      * modify the array.  To avoid copying the input array, ensure
@@ -169,964 +70,68 @@
      * @param inputLength the size of the input.
      * Must be positive and less than or equal to input.length.
      */
-    protected Scanner(ScannerFactory fac, char[] input, int inputLength) {
-        this(fac);
-        eofPos = inputLength;
-        if (inputLength == input.length) {
-            if (input.length > 0 && Character.isWhitespace(input[input.length - 1])) {
-                inputLength--;
-            } else {
-                char[] newInput = new char[inputLength + 1];
-                System.arraycopy(input, 0, newInput, 0, input.length);
-                input = newInput;
-            }
-        }
-        buf = input;
-        buflen = inputLength;
-        buf[buflen] = EOI;
-        bp = -1;
-        scanChar();
-    }
-
-    /** Report an error at the given position using the provided arguments.
-     */
-    private void lexError(int pos, String key, Object... args) {
-        log.error(pos, key, args);
-        token = ERROR;
-        errPos = pos;
-    }
-
-    /** Report an error at the current token position using the provided
-     *  arguments.
-     */
-    private void lexError(String key, Object... args) {
-        lexError(pos, key, args);
-    }
-
-    /** Convert an ASCII digit from its base (8, 10, or 16)
-     *  to its value.
-     */
-    private int digit(int base) {
-        char c = ch;
-        int result = Character.digit(c, base);
-        if (result >= 0 && c > 0x7f) {
-            lexError(pos+1, "illegal.nonascii.digit");
-            ch = "0123456789abcdef".charAt(result);
-        }
-        return result;
+    protected Scanner(ScannerFactory fac, CharBuffer buf) {
+        this(fac, new JavaTokenizer(fac, buf));
     }
 
-    /** Convert unicode escape; bp points to initial '\' character
-     *  (Spec 3.3).
-     */
-    private void convertUnicode() {
-        if (ch == '\\' && unicodeConversionBp != bp) {
-            bp++; ch = buf[bp];
-            if (ch == 'u') {
-                do {
-                    bp++; ch = buf[bp];
-                } while (ch == 'u');
-                int limit = bp + 3;
-                if (limit < buflen) {
-                    int d = digit(16);
-                    int code = d;
-                    while (bp < limit && d >= 0) {
-                        bp++; ch = buf[bp];
-                        d = digit(16);
-                        code = (code << 4) + d;
-                    }
-                    if (d >= 0) {
-                        ch = (char)code;
-                        unicodeConversionBp = bp;
-                        return;
-                    }
-                }
-                lexError(bp, "illegal.unicode.esc");
-            } else {
-                bp--;
-                ch = '\\';
-            }
-        }
-    }
-
-    /** Read next character.
-     */
-    private void scanChar() {
-        ch = buf[++bp];
-        if (ch == '\\') {
-            convertUnicode();
-        }
-    }
-
-    /** Read next character in comment, skipping over double '\' characters.
-     */
-    private void scanCommentChar() {
-        scanChar();
-        if (ch == '\\') {
-            if (buf[bp+1] == '\\' && unicodeConversionBp != bp) {
-                bp++;
-            } else {
-                convertUnicode();
-            }
-        }
+    protected Scanner(ScannerFactory fac, char[] buf, int inputLength) {
+        this(fac, new JavaTokenizer(fac, buf, inputLength));
     }
 
-    /** Append a character to sbuf.
-     */
-    private void putChar(char ch) {
-        if (sp == sbuf.length) {
-            char[] newsbuf = new char[sbuf.length * 2];
-            System.arraycopy(sbuf, 0, newsbuf, 0, sbuf.length);
-            sbuf = newsbuf;
-        }
-        sbuf[sp++] = ch;
+    protected Scanner(ScannerFactory fac, JavaTokenizer tokenizer) {
+        this.tokenizer = tokenizer;
+        tokens = fac.tokens;
+        token = prevToken = DUMMY;
     }
 
-    /** Read next character in character or string literal and copy into sbuf.
-     */
-    private void scanLitChar() {
-        if (ch == '\\') {
-            if (buf[bp+1] == '\\' && unicodeConversionBp != bp) {
-                bp++;
-                putChar('\\');
-                scanChar();
-            } else {
-                scanChar();
-                switch (ch) {
-                case '0': case '1': case '2': case '3':
-                case '4': case '5': case '6': case '7':
-                    char leadch = ch;
-                    int oct = digit(8);
-                    scanChar();
-                    if ('0' <= ch && ch <= '7') {
-                        oct = oct * 8 + digit(8);
-                        scanChar();
-                        if (leadch <= '3' && '0' <= ch && ch <= '7') {
-                            oct = oct * 8 + digit(8);
-                            scanChar();
-                        }
-                    }
-                    putChar((char)oct);
-                    break;
-                case 'b':
-                    putChar('\b'); scanChar(); break;
-                case 't':
-                    putChar('\t'); scanChar(); break;
-                case 'n':
-                    putChar('\n'); scanChar(); break;
-                case 'f':
-                    putChar('\f'); scanChar(); break;
-                case 'r':
-                    putChar('\r'); scanChar(); break;
-                case '\'':
-                    putChar('\''); scanChar(); break;
-                case '\"':
-                    putChar('\"'); scanChar(); break;
-                case '\\':
-                    putChar('\\'); scanChar(); break;
-                default:
-                    lexError(bp, "illegal.esc.char");
-                }
-            }
-        } else if (bp != buflen) {
-            putChar(ch); scanChar();
-        }
-    }
-
-    private void scanDigits(int digitRadix) {
-        char saveCh;
-        int savePos;
-        do {
-            if (ch != '_') {
-                putChar(ch);
-            } else {
-                if (!allowUnderscoresInLiterals) {
-                    lexError("unsupported.underscore.lit", source.name);
-                    allowUnderscoresInLiterals = true;
-                }
-            }
-            saveCh = ch;
-            savePos = bp;
-            scanChar();
-        } while (digit(digitRadix) >= 0 || ch == '_');
-        if (saveCh == '_')
-            lexError(savePos, "illegal.underscore");
-    }
-
-    /** Read fractional part of hexadecimal floating point number.
-     */
-    private void scanHexExponentAndSuffix() {
-        if (ch == 'p' || ch == 'P') {
-            putChar(ch);
-            scanChar();
-            skipIllegalUnderscores();
-            if (ch == '+' || ch == '-') {
-                putChar(ch);
-                scanChar();
-            }
-            skipIllegalUnderscores();
-            if ('0' <= ch && ch <= '9') {
-                scanDigits(10);
-                if (!allowHexFloats) {
-                    lexError("unsupported.fp.lit", source.name);
-                    allowHexFloats = true;
-                }
-                else if (!hexFloatsWork)
-                    lexError("unsupported.cross.fp.lit");
-            } else
-                lexError("malformed.fp.lit");
-        } else {
-            lexError("malformed.fp.lit");
-        }
-        if (ch == 'f' || ch == 'F') {
-            putChar(ch);
-            scanChar();
-            token = FLOATLITERAL;
-        } else {
-            if (ch == 'd' || ch == 'D') {
-                putChar(ch);
-                scanChar();
-            }
-            token = DOUBLELITERAL;
-        }
+    public Token token() {
+        return token(0);
     }
 
-    /** Read fractional part of floating point number.
-     */
-    private void scanFraction() {
-        skipIllegalUnderscores();
-        if ('0' <= ch && ch <= '9') {
-            scanDigits(10);
-        }
-        int sp1 = sp;
-        if (ch == 'e' || ch == 'E') {
-            putChar(ch);
-            scanChar();
-            skipIllegalUnderscores();
-            if (ch == '+' || ch == '-') {
-                putChar(ch);
-                scanChar();
-            }
-            skipIllegalUnderscores();
-            if ('0' <= ch && ch <= '9') {
-                scanDigits(10);
-                return;
-            }
-            lexError("malformed.fp.lit");
-            sp = sp1;
-        }
-    }
-
-    /** Read fractional part and 'd' or 'f' suffix of floating point number.
-     */
-    private void scanFractionAndSuffix() {
-        this.radix = 10;
-        scanFraction();
-        if (ch == 'f' || ch == 'F') {
-            putChar(ch);
-            scanChar();
-            token = FLOATLITERAL;
+    public Token token(int lookahead) {
+        if (lookahead == 0) {
+            return token;
         } else {
-            if (ch == 'd' || ch == 'D') {
-                putChar(ch);
-                scanChar();
-            }
-            token = DOUBLELITERAL;
+            ensureLookahead(lookahead);
+            return savedTokens.get(lookahead - 1);
         }
     }
-
-    /** Read fractional part and 'd' or 'f' suffix of floating point number.
-     */
-    private void scanHexFractionAndSuffix(boolean seendigit) {
-        this.radix = 16;
-        Assert.check(ch == '.');
-        putChar(ch);
-        scanChar();
-        skipIllegalUnderscores();
-        if (digit(16) >= 0) {
-            seendigit = true;
-            scanDigits(16);
-        }
-        if (!seendigit)
-            lexError("invalid.hex.number");
-        else
-            scanHexExponentAndSuffix();
-    }
-
-    private void skipIllegalUnderscores() {
-        if (ch == '_') {
-            lexError(bp, "illegal.underscore");
-            while (ch == '_')
-                scanChar();
-        }
-    }
-
-    /** Read a number.
-     *  @param radix  The radix of the number; one of 2, j8, 10, 16.
-     */
-    private void scanNumber(int radix) {
-        this.radix = radix;
-        // for octal, allow base-10 digit in case it's a float literal
-        int digitRadix = (radix == 8 ? 10 : radix);
-        boolean seendigit = false;
-        if (digit(digitRadix) >= 0) {
-            seendigit = true;
-            scanDigits(digitRadix);
-        }
-        if (radix == 16 && ch == '.') {
-            scanHexFractionAndSuffix(seendigit);
-        } else if (seendigit && radix == 16 && (ch == 'p' || ch == 'P')) {
-            scanHexExponentAndSuffix();
-        } else if (digitRadix == 10 && ch == '.') {
-            putChar(ch);
-            scanChar();
-            scanFractionAndSuffix();
-        } else if (digitRadix == 10 &&
-                   (ch == 'e' || ch == 'E' ||
-                    ch == 'f' || ch == 'F' ||
-                    ch == 'd' || ch == 'D')) {
-            scanFractionAndSuffix();
-        } else {
-            if (ch == 'l' || ch == 'L') {
-                scanChar();
-                token = LONGLITERAL;
-            } else {
-                token = INTLITERAL;
+    //where
+        private void ensureLookahead(int lookahead) {
+            for (int i = savedTokens.size() ; i < lookahead ; i ++) {
+                savedTokens.add(tokenizer.readToken());
             }
         }
+
+    public Token prevToken() {
+        return prevToken;
     }
 
-    /** Read an identifier.
-     */
-    private void scanIdent() {
-        boolean isJavaIdentifierPart;
-        char high;
-        do {
-            if (sp == sbuf.length) putChar(ch); else sbuf[sp++] = ch;
-            // optimization, was: putChar(ch);
-
-            scanChar();
-            switch (ch) {
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-            case '$': case '_':
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case '\u0000': case '\u0001': case '\u0002': case '\u0003':
-            case '\u0004': case '\u0005': case '\u0006': case '\u0007':
-            case '\u0008': case '\u000E': case '\u000F': case '\u0010':
-            case '\u0011': case '\u0012': case '\u0013': case '\u0014':
-            case '\u0015': case '\u0016': case '\u0017':
-            case '\u0018': case '\u0019': case '\u001B':
-            case '\u007F':
-                break;
-            case '\u001A': // EOI is also a legal identifier part
-                if (bp >= buflen) {
-                    name = names.fromChars(sbuf, 0, sp);
-                    token = keywords.key(name);
-                    return;
-                }
-                break;
-            default:
-                if (ch < '\u0080') {
-                    // all ASCII range chars already handled, above
-                    isJavaIdentifierPart = false;
-                } else {
-                    high = scanSurrogates();
-                    if (high != 0) {
-                        if (sp == sbuf.length) {
-                            putChar(high);
-                        } else {
-                            sbuf[sp++] = high;
-                        }
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(
-                            Character.toCodePoint(high, ch));
-                    } else {
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(ch);
-                    }
-                }
-                if (!isJavaIdentifierPart) {
-                    name = names.fromChars(sbuf, 0, sp);
-                    token = keywords.key(name);
-                    return;
-                }
-            }
-        } while (true);
-    }
-
-    /** Are surrogates supported?
-     */
-    final static boolean surrogatesSupported = surrogatesSupported();
-    private static boolean surrogatesSupported() {
-        try {
-            Character.isHighSurrogate('a');
-            return true;
-        } catch (NoSuchMethodError ex) {
-            return false;
-        }
-    }
-
-    /** Scan surrogate pairs.  If 'ch' is a high surrogate and
-     *  the next character is a low surrogate, then put the low
-     *  surrogate in 'ch', and return the high surrogate.
-     *  otherwise, just return 0.
-     */
-    private char scanSurrogates() {
-        if (surrogatesSupported && Character.isHighSurrogate(ch)) {
-            char high = ch;
-
-            scanChar();
-
-            if (Character.isLowSurrogate(ch)) {
-                return high;
-            }
-
-            ch = high;
-        }
-
-        return 0;
-    }
-
-    /** Return true if ch can be part of an operator.
-     */
-    private boolean isSpecial(char ch) {
-        switch (ch) {
-        case '!': case '%': case '&': case '*': case '?':
-        case '+': case '-': case ':': case '<': case '=':
-        case '>': case '^': case '|': case '~':
-        case '@':
-            return true;
-        default:
-            return false;
-        }
-    }
-
-    /** Read longest possible sequence of special characters and convert
-     *  to token.
-     */
-    private void scanOperator() {
-        while (true) {
-            putChar(ch);
-            Name newname = names.fromChars(sbuf, 0, sp);
-            if (keywords.key(newname) == IDENTIFIER) {
-                sp--;
-                break;
-            }
-            name = newname;
-            token = keywords.key(newname);
-            scanChar();
-            if (!isSpecial(ch)) break;
+    public void nextToken() {
+        prevToken = token;
+        if (!savedTokens.isEmpty()) {
+            token = savedTokens.remove(0);
+        } else {
+            token = tokenizer.readToken();
         }
     }
 
-    /**
-     * Scan a documention comment; determine if a deprecated tag is present.
-     * Called once the initial /, * have been skipped, positioned at the second *
-     * (which is treated as the beginning of the first line).
-     * Stops positioned at the closing '/'.
-     */
-    @SuppressWarnings("fallthrough")
-    private void scanDocComment() {
-        boolean deprecatedPrefix = false;
-
-        forEachLine:
-        while (bp < buflen) {
-
-            // Skip optional WhiteSpace at beginning of line
-            while (bp < buflen && (ch == ' ' || ch == '\t' || ch == FF)) {
-                scanCommentChar();
-            }
-
-            // Skip optional consecutive Stars
-            while (bp < buflen && ch == '*') {
-                scanCommentChar();
-                if (ch == '/') {
-                    return;
-                }
-            }
-
-            // Skip optional WhiteSpace after Stars
-            while (bp < buflen && (ch == ' ' || ch == '\t' || ch == FF)) {
-                scanCommentChar();
-            }
-
-            deprecatedPrefix = false;
-            // At beginning of line in the JavaDoc sense.
-            if (bp < buflen && ch == '@' && !deprecatedFlag) {
-                scanCommentChar();
-                if (bp < buflen && ch == 'd') {
-                    scanCommentChar();
-                    if (bp < buflen && ch == 'e') {
-                        scanCommentChar();
-                        if (bp < buflen && ch == 'p') {
-                            scanCommentChar();
-                            if (bp < buflen && ch == 'r') {
-                                scanCommentChar();
-                                if (bp < buflen && ch == 'e') {
-                                    scanCommentChar();
-                                    if (bp < buflen && ch == 'c') {
-                                        scanCommentChar();
-                                        if (bp < buflen && ch == 'a') {
-                                            scanCommentChar();
-                                            if (bp < buflen && ch == 't') {
-                                                scanCommentChar();
-                                                if (bp < buflen && ch == 'e') {
-                                                    scanCommentChar();
-                                                    if (bp < buflen && ch == 'd') {
-                                                        deprecatedPrefix = true;
-                                                        scanCommentChar();
-                                                    }}}}}}}}}}}
-            if (deprecatedPrefix && bp < buflen) {
-                if (Character.isWhitespace(ch)) {
-                    deprecatedFlag = true;
-                } else if (ch == '*') {
-                    scanCommentChar();
-                    if (ch == '/') {
-                        deprecatedFlag = true;
-                        return;
-                    }
-                }
-            }
-
-            // Skip rest of line
-            while (bp < buflen) {
-                switch (ch) {
-                case '*':
-                    scanCommentChar();
-                    if (ch == '/') {
-                        return;
-                    }
-                    break;
-                case CR: // (Spec 3.4)
-                    scanCommentChar();
-                    if (ch != LF) {
-                        continue forEachLine;
-                    }
-                    /* fall through to LF case */
-                case LF: // (Spec 3.4)
-                    scanCommentChar();
-                    continue forEachLine;
-                default:
-                    scanCommentChar();
-                }
-            } // rest of line
-        } // forEachLine
-        return;
-    }
-
-    /** The value of a literal token, recorded as a string.
-     *  For integers, leading 0x and 'l' suffixes are suppressed.
-     */
-    public String stringVal() {
-        return new String(sbuf, 0, sp);
-    }
-
-    /** Read token.
-     */
-    public void nextToken() {
-
-        try {
-            prevEndPos = endPos;
-            sp = 0;
-
-            while (true) {
-                pos = bp;
-                switch (ch) {
-                case ' ': // (Spec 3.6)
-                case '\t': // (Spec 3.6)
-                case FF: // (Spec 3.6)
-                    do {
-                        scanChar();
-                    } while (ch == ' ' || ch == '\t' || ch == FF);
-                    endPos = bp;
-                    processWhiteSpace();
-                    break;
-                case LF: // (Spec 3.4)
-                    scanChar();
-                    endPos = bp;
-                    processLineTerminator();
-                    break;
-                case CR: // (Spec 3.4)
-                    scanChar();
-                    if (ch == LF) {
-                        scanChar();
-                    }
-                    endPos = bp;
-                    processLineTerminator();
-                    break;
-                case 'A': case 'B': case 'C': case 'D': case 'E':
-                case 'F': case 'G': case 'H': case 'I': case 'J':
-                case 'K': case 'L': case 'M': case 'N': case 'O':
-                case 'P': case 'Q': case 'R': case 'S': case 'T':
-                case 'U': case 'V': case 'W': case 'X': case 'Y':
-                case 'Z':
-                case 'a': case 'b': case 'c': case 'd': case 'e':
-                case 'f': case 'g': case 'h': case 'i': case 'j':
-                case 'k': case 'l': case 'm': case 'n': case 'o':
-                case 'p': case 'q': case 'r': case 's': case 't':
-                case 'u': case 'v': case 'w': case 'x': case 'y':
-                case 'z':
-                case '$': case '_':
-                    scanIdent();
-                    return;
-                case '0':
-                    scanChar();
-                    if (ch == 'x' || ch == 'X') {
-                        scanChar();
-                        skipIllegalUnderscores();
-                        if (ch == '.') {
-                            scanHexFractionAndSuffix(false);
-                        } else if (digit(16) < 0) {
-                            lexError("invalid.hex.number");
-                        } else {
-                            scanNumber(16);
-                        }
-                    } else if (ch == 'b' || ch == 'B') {
-                        if (!allowBinaryLiterals) {
-                            lexError("unsupported.binary.lit", source.name);
-                            allowBinaryLiterals = true;
-                        }
-                        scanChar();
-                        skipIllegalUnderscores();
-                        if (digit(2) < 0) {
-                            lexError("invalid.binary.number");
-                        } else {
-                            scanNumber(2);
-                        }
-                    } else {
-                        putChar('0');
-                        if (ch == '_') {
-                            int savePos = bp;
-                            do {
-                                scanChar();
-                            } while (ch == '_');
-                            if (digit(10) < 0) {
-                                lexError(savePos, "illegal.underscore");
-                            }
-                        }
-                        scanNumber(8);
-                    }
-                    return;
-                case '1': case '2': case '3': case '4':
-                case '5': case '6': case '7': case '8': case '9':
-                    scanNumber(10);
-                    return;
-                case '.':
-                    scanChar();
-                    if ('0' <= ch && ch <= '9') {
-                        putChar('.');
-                        scanFractionAndSuffix();
-                    } else if (ch == '.') {
-                        putChar('.'); putChar('.');
-                        scanChar();
-                        if (ch == '.') {
-                            scanChar();
-                            putChar('.');
-                            token = ELLIPSIS;
-                        } else {
-                            lexError("malformed.fp.lit");
-                        }
-                    } else {
-                        token = DOT;
-                    }
-                    return;
-                case ',':
-                    scanChar(); token = COMMA; return;
-                case ';':
-                    scanChar(); token = SEMI; return;
-                case '(':
-                    scanChar(); token = LPAREN; return;
-                case ')':
-                    scanChar(); token = RPAREN; return;
-                case '[':
-                    scanChar(); token = LBRACKET; return;
-                case ']':
-                    scanChar(); token = RBRACKET; return;
-                case '{':
-                    scanChar(); token = LBRACE; return;
-                case '}':
-                    scanChar(); token = RBRACE; return;
-                case '/':
-                    scanChar();
-                    if (ch == '/') {
-                        do {
-                            scanCommentChar();
-                        } while (ch != CR && ch != LF && bp < buflen);
-                        if (bp < buflen) {
-                            endPos = bp;
-                            processComment(CommentStyle.LINE);
-                        }
-                        break;
-                    } else if (ch == '*') {
-                        scanChar();
-                        CommentStyle style;
-                        if (ch == '*') {
-                            style = CommentStyle.JAVADOC;
-                            scanDocComment();
-                        } else {
-                            style = CommentStyle.BLOCK;
-                            while (bp < buflen) {
-                                if (ch == '*') {
-                                    scanChar();
-                                    if (ch == '/') break;
-                                } else {
-                                    scanCommentChar();
-                                }
-                            }
-                        }
-                        if (ch == '/') {
-                            scanChar();
-                            endPos = bp;
-                            processComment(style);
-                            break;
-                        } else {
-                            lexError("unclosed.comment");
-                            return;
-                        }
-                    } else if (ch == '=') {
-                        name = names.slashequals;
-                        token = SLASHEQ;
-                        scanChar();
-                    } else {
-                        name = names.slash;
-                        token = SLASH;
-                    }
-                    return;
-                case '\'':
-                    scanChar();
-                    if (ch == '\'') {
-                        lexError("empty.char.lit");
-                    } else {
-                        if (ch == CR || ch == LF)
-                            lexError(pos, "illegal.line.end.in.char.lit");
-                        scanLitChar();
-                        if (ch == '\'') {
-                            scanChar();
-                            token = CHARLITERAL;
-                        } else {
-                            lexError(pos, "unclosed.char.lit");
-                        }
-                    }
-                    return;
-                case '\"':
-                    scanChar();
-                    while (ch != '\"' && ch != CR && ch != LF && bp < buflen)
-                        scanLitChar();
-                    if (ch == '\"') {
-                        token = STRINGLITERAL;
-                        scanChar();
-                    } else {
-                        lexError(pos, "unclosed.str.lit");
-                    }
-                    return;
-                default:
-                    if (isSpecial(ch)) {
-                        scanOperator();
-                    } else {
-                        boolean isJavaIdentifierStart;
-                        if (ch < '\u0080') {
-                            // all ASCII range chars already handled, above
-                            isJavaIdentifierStart = false;
-                        } else {
-                            char high = scanSurrogates();
-                            if (high != 0) {
-                                if (sp == sbuf.length) {
-                                    putChar(high);
-                                } else {
-                                    sbuf[sp++] = high;
-                                }
-
-                                isJavaIdentifierStart = Character.isJavaIdentifierStart(
-                                    Character.toCodePoint(high, ch));
-                            } else {
-                                isJavaIdentifierStart = Character.isJavaIdentifierStart(ch);
-                            }
-                        }
-                        if (isJavaIdentifierStart) {
-                            scanIdent();
-                        } else if (bp == buflen || ch == EOI && bp+1 == buflen) { // JLS 3.5
-                            token = EOF;
-                            pos = bp = eofPos;
-                        } else {
-                            lexError("illegal.char", String.valueOf((int)ch));
-                            scanChar();
-                        }
-                    }
-                    return;
-                }
-            }
-        } finally {
-            endPos = bp;
-            if (scannerDebug)
-                System.out.println("nextToken(" + pos
-                                   + "," + endPos + ")=|" +
-                                   new String(getRawCharacters(pos, endPos))
-                                   + "|");
-        }
-    }
-
-    /** Return the current token, set by nextToken().
-     */
-    public Token token() {
+    public Token split() {
+        Token[] splitTokens = token.split(tokens);
+        prevToken = splitTokens[0];
+        token = splitTokens[1];
         return token;
     }
 
-    /** Sets the current token.
-     */
-    public void token(Token token) {
-        this.token = token;
-    }
-
-    /** Return the current token's position: a 0-based
-     *  offset from beginning of the raw input stream
-     *  (before unicode translation)
-     */
-    public int pos() {
-        return pos;
-    }
-
-    /** Return the last character position of the current token.
-     */
-    public int endPos() {
-        return endPos;
-    }
-
-    /** Return the last character position of the previous token.
-     */
-    public int prevEndPos() {
-        return prevEndPos;
-    }
-
-    /** Return the position where a lexical error occurred;
-     */
-    public int errPos() {
-        return errPos;
-    }
-
-    /** Set the position where a lexical error occurred;
-     */
-    public void errPos(int pos) {
-        errPos = pos;
-    }
-
-    /** Return the name of an identifier or token for the current token.
-     */
-    public Name name() {
-        return name;
-    }
-
-    /** Return the radix of a numeric literal token.
-     */
-    public int radix() {
-        return radix;
-    }
-
-    /** Has a @deprecated been encountered in last doc comment?
-     *  This needs to be reset by client with resetDeprecatedFlag.
-     */
-    public boolean deprecatedFlag() {
-        return deprecatedFlag;
-    }
-
-    public void resetDeprecatedFlag() {
-        deprecatedFlag = false;
-    }
-
-    /**
-     * Returns the documentation string of the current token.
-     */
-    public String docComment() {
-        return null;
+    public LineMap getLineMap() {
+        return tokenizer.getLineMap();
     }
 
-    /**
-     * Returns a copy of the input buffer, up to its inputLength.
-     * Unicode escape sequences are not translated.
-     */
-    public char[] getRawCharacters() {
-        char[] chars = new char[buflen];
-        System.arraycopy(buf, 0, chars, 0, buflen);
-        return chars;
-    }
-
-    /**
-     * Returns a copy of a character array subset of the input buffer.
-     * The returned array begins at the <code>beginIndex</code> and
-     * extends to the character at index <code>endIndex - 1</code>.
-     * Thus the length of the substring is <code>endIndex-beginIndex</code>.
-     * This behavior is like
-     * <code>String.substring(beginIndex, endIndex)</code>.
-     * Unicode escape sequences are not translated.
-     *
-     * @param beginIndex the beginning index, inclusive.
-     * @param endIndex the ending index, exclusive.
-     * @throws IndexOutOfBounds if either offset is outside of the
-     *         array bounds
-     */
-    public char[] getRawCharacters(int beginIndex, int endIndex) {
-        int length = endIndex - beginIndex;
-        char[] chars = new char[length];
-        System.arraycopy(buf, beginIndex, chars, 0, length);
-        return chars;
-    }
-
-    public enum CommentStyle {
-        LINE,
-        BLOCK,
-        JAVADOC,
+    public int errPos() {
+        return tokenizer.errPos();
     }
 
-    /**
-     * Called when a complete comment has been scanned. pos and endPos
-     * will mark the comment boundary.
-     */
-    protected void processComment(CommentStyle style) {
-        if (scannerDebug)
-            System.out.println("processComment(" + pos
-                               + "," + endPos + "," + style + ")=|"
-                               + new String(getRawCharacters(pos, endPos))
-                               + "|");
+    public void errPos(int pos) {
+        tokenizer.errPos(pos);
     }
-
-    /**
-     * Called when a complete whitespace run has been scanned. pos and endPos
-     * will mark the whitespace boundary.
-     */
-    protected void processWhiteSpace() {
-        if (scannerDebug)
-            System.out.println("processWhitespace(" + pos
-                               + "," + endPos + ")=|" +
-                               new String(getRawCharacters(pos, endPos))
-                               + "|");
-    }
-
-    /**
-     * Called when a line terminator has been processed.
-     */
-    protected void processLineTerminator() {
-        if (scannerDebug)
-            System.out.println("processTerminator(" + pos
-                               + "," + endPos + ")=|" +
-                               new String(getRawCharacters(pos, endPos))
-                               + "|");
-    }
-
-    /** Build a map for translating between line numbers and
-     * positions in the input.
-     *
-     * @return a LineMap */
-    public Position.LineMap getLineMap() {
-        return Position.makeLineMap(buf, buflen, false);
-    }
-
 }
--- a/src/share/classes/com/sun/tools/javac/parser/ScannerFactory.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/ScannerFactory.java	Tue May 29 00:27:58 2012 +0100
@@ -57,7 +57,7 @@
     final Log log;
     final Names names;
     final Source source;
-    final Keywords keywords;
+    final Tokens tokens;
 
     /** Create a new scanner factory. */
     protected ScannerFactory(Context context) {
@@ -65,14 +65,14 @@
         this.log = Log.instance(context);
         this.names = Names.instance(context);
         this.source = Source.instance(context);
-        this.keywords = Keywords.instance(context);
+        this.tokens = Tokens.instance(context);
     }
 
     public Scanner newScanner(CharSequence input, boolean keepDocComments) {
         if (input instanceof CharBuffer) {
             CharBuffer buf = (CharBuffer) input;
             if (keepDocComments)
-                return new DocCommentScanner(this, buf);
+                return new Scanner(this, new JavadocTokenizer(this, buf));
             else
                 return new Scanner(this, buf);
         } else {
@@ -83,7 +83,7 @@
 
     public Scanner newScanner(char[] input, int inputLength, boolean keepDocComments) {
         if (keepDocComments)
-            return new DocCommentScanner(this, input, inputLength);
+            return new Scanner(this, new JavadocTokenizer(this, input, inputLength));
         else
             return new Scanner(this, input, inputLength);
     }
--- a/src/share/classes/com/sun/tools/javac/parser/Token.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import java.util.Locale;
-
-import com.sun.tools.javac.api.Formattable;
-import com.sun.tools.javac.api.Messages;
-
-/** An interface that defines codes for Java source tokens
- *  returned from lexical analysis.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public enum Token implements Formattable {
-    EOF,
-    ERROR,
-    IDENTIFIER,
-    ABSTRACT("abstract"),
-    ASSERT("assert"),
-    BOOLEAN("boolean"),
-    BREAK("break"),
-    BYTE("byte"),
-    CASE("case"),
-    CATCH("catch"),
-    CHAR("char"),
-    CLASS("class"),
-    CONST("const"),
-    CONTINUE("continue"),
-    DEFAULT("default"),
-    DO("do"),
-    DOUBLE("double"),
-    ELSE("else"),
-    ENUM("enum"),
-    EXTENDS("extends"),
-    FINAL("final"),
-    FINALLY("finally"),
-    FLOAT("float"),
-    FOR("for"),
-    GOTO("goto"),
-    IF("if"),
-    IMPLEMENTS("implements"),
-    IMPORT("import"),
-    INSTANCEOF("instanceof"),
-    INT("int"),
-    INTERFACE("interface"),
-    LONG("long"),
-    NATIVE("native"),
-    NEW("new"),
-    PACKAGE("package"),
-    PRIVATE("private"),
-    PROTECTED("protected"),
-    PUBLIC("public"),
-    RETURN("return"),
-    SHORT("short"),
-    STATIC("static"),
-    STRICTFP("strictfp"),
-    SUPER("super"),
-    SWITCH("switch"),
-    SYNCHRONIZED("synchronized"),
-    THIS("this"),
-    THROW("throw"),
-    THROWS("throws"),
-    TRANSIENT("transient"),
-    TRY("try"),
-    VOID("void"),
-    VOLATILE("volatile"),
-    WHILE("while"),
-    INTLITERAL,
-    LONGLITERAL,
-    FLOATLITERAL,
-    DOUBLELITERAL,
-    CHARLITERAL,
-    STRINGLITERAL,
-    TRUE("true"),
-    FALSE("false"),
-    NULL("null"),
-    LPAREN("("),
-    RPAREN(")"),
-    LBRACE("{"),
-    RBRACE("}"),
-    LBRACKET("["),
-    RBRACKET("]"),
-    SEMI(";"),
-    COMMA(","),
-    DOT("."),
-    ELLIPSIS("..."),
-    EQ("="),
-    GT(">"),
-    LT("<"),
-    BANG("!"),
-    TILDE("~"),
-    QUES("?"),
-    COLON(":"),
-    EQEQ("=="),
-    LTEQ("<="),
-    GTEQ(">="),
-    BANGEQ("!="),
-    AMPAMP("&&"),
-    BARBAR("||"),
-    PLUSPLUS("++"),
-    SUBSUB("--"),
-    PLUS("+"),
-    SUB("-"),
-    STAR("*"),
-    SLASH("/"),
-    AMP("&"),
-    BAR("|"),
-    CARET("^"),
-    PERCENT("%"),
-    LTLT("<<"),
-    GTGT(">>"),
-    GTGTGT(">>>"),
-    PLUSEQ("+="),
-    SUBEQ("-="),
-    STAREQ("*="),
-    SLASHEQ("/="),
-    AMPEQ("&="),
-    BAREQ("|="),
-    CARETEQ("^="),
-    PERCENTEQ("%="),
-    LTLTEQ("<<="),
-    GTGTEQ(">>="),
-    GTGTGTEQ(">>>="),
-    MONKEYS_AT("@"),
-    CUSTOM;
-
-    Token() {
-        this(null);
-    }
-    Token(String name) {
-        this.name = name;
-    }
-
-    public final String name;
-
-    public String toString() {
-        switch (this) {
-        case IDENTIFIER:
-            return "token.identifier";
-        case CHARLITERAL:
-            return "token.character";
-        case STRINGLITERAL:
-            return "token.string";
-        case INTLITERAL:
-            return "token.integer";
-        case LONGLITERAL:
-            return "token.long-integer";
-        case FLOATLITERAL:
-            return "token.float";
-        case DOUBLELITERAL:
-            return "token.double";
-        case ERROR:
-            return "token.bad-symbol";
-        case EOF:
-            return "token.end-of-input";
-        case DOT: case COMMA: case SEMI: case LPAREN: case RPAREN:
-        case LBRACKET: case RBRACKET: case LBRACE: case RBRACE:
-            return "'" + name + "'";
-        default:
-            return name;
-        }
-    }
-
-    public String getKind() {
-        return "Token";
-    }
-
-    public String toString(Locale locale, Messages messages) {
-        return name != null ? toString() : messages.getLocalizedString(locale, "compiler.misc." + toString());
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/Tokens.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,474 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.parser;
+
+import java.util.Locale;
+
+import com.sun.tools.javac.api.Formattable;
+import com.sun.tools.javac.api.Messages;
+import com.sun.tools.javac.parser.Tokens.Token.Tag;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Names;
+
+/** A class that defines codes/utilities for Java source tokens
+ *  returned from lexical analysis.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class Tokens {
+
+    private final Names names;
+
+    /**
+     * Keyword array. Maps name indices to Token.
+     */
+    private final TokenKind[] key;
+
+    /**  The number of the last entered keyword.
+     */
+    private int maxKey = 0;
+
+    /** The names of all tokens.
+     */
+    private Name[] tokenName = new Name[TokenKind.values().length];
+
+    public static final Context.Key<Tokens> tokensKey =
+        new Context.Key<Tokens>();
+
+    public static Tokens instance(Context context) {
+        Tokens instance = context.get(tokensKey);
+        if (instance == null)
+            instance = new Tokens(context);
+        return instance;
+    }
+
+    protected Tokens(Context context) {
+        context.put(tokensKey, this);
+        names = Names.instance(context);
+
+        for (TokenKind t : TokenKind.values()) {
+            if (t.name != null)
+                enterKeyword(t.name, t);
+            else
+                tokenName[t.ordinal()] = null;
+        }
+
+        key = new TokenKind[maxKey+1];
+        for (int i = 0; i <= maxKey; i++) key[i] = TokenKind.IDENTIFIER;
+        for (TokenKind t : TokenKind.values()) {
+            if (t.name != null)
+            key[tokenName[t.ordinal()].getIndex()] = t;
+        }
+    }
+
+    private void enterKeyword(String s, TokenKind token) {
+        Name n = names.fromString(s);
+        tokenName[token.ordinal()] = n;
+        if (n.getIndex() > maxKey) maxKey = n.getIndex();
+    }
+
+    /**
+     * Create a new token given a name; if the name corresponds to a token name,
+     * a new token of the corresponding kind is returned; otherwise, an
+     * identifier token is returned.
+     */
+    TokenKind lookupKind(Name name) {
+        return (name.getIndex() > maxKey) ? TokenKind.IDENTIFIER : key[name.getIndex()];
+    }
+
+    TokenKind lookupKind(String name) {
+        return lookupKind(names.fromString(name));
+    }
+
+    /**
+     * This enum defines all tokens used by the javac scanner. A token is
+     * optionally associated with a name.
+     */
+    public enum TokenKind implements Formattable {
+        EOF(),
+        ERROR(),
+        IDENTIFIER(Tag.NAMED),
+        ABSTRACT("abstract"),
+        ASSERT("assert", Tag.NAMED),
+        BOOLEAN("boolean", Tag.NAMED),
+        BREAK("break"),
+        BYTE("byte", Tag.NAMED),
+        CASE("case"),
+        CATCH("catch"),
+        CHAR("char", Tag.NAMED),
+        CLASS("class"),
+        CONST("const"),
+        CONTINUE("continue"),
+        DEFAULT("default"),
+        DO("do"),
+        DOUBLE("double", Tag.NAMED),
+        ELSE("else"),
+        ENUM("enum", Tag.NAMED),
+        EXTENDS("extends"),
+        FINAL("final"),
+        FINALLY("finally"),
+        FLOAT("float", Tag.NAMED),
+        FOR("for"),
+        GOTO("goto"),
+        IF("if"),
+        IMPLEMENTS("implements"),
+        IMPORT("import"),
+        INSTANCEOF("instanceof"),
+        INT("int", Tag.NAMED),
+        INTERFACE("interface"),
+        LONG("long", Tag.NAMED),
+        NATIVE("native"),
+        NEW("new"),
+        PACKAGE("package"),
+        PRIVATE("private"),
+        PROTECTED("protected"),
+        PUBLIC("public"),
+        RETURN("return"),
+        SHORT("short", Tag.NAMED),
+        STATIC("static"),
+        STRICTFP("strictfp"),
+        SUPER("super", Tag.NAMED),
+        SWITCH("switch"),
+        SYNCHRONIZED("synchronized"),
+        THIS("this", Tag.NAMED),
+        THROW("throw"),
+        THROWS("throws"),
+        TRANSIENT("transient"),
+        TRY("try"),
+        VOID("void", Tag.NAMED),
+        VOLATILE("volatile"),
+        WHILE("while"),
+        INTLITERAL(Tag.NUMERIC),
+        LONGLITERAL(Tag.NUMERIC),
+        FLOATLITERAL(Tag.NUMERIC),
+        DOUBLELITERAL(Tag.NUMERIC),
+        CHARLITERAL(Tag.NUMERIC),
+        STRINGLITERAL(Tag.STRING),
+        TRUE("true", Tag.NAMED),
+        FALSE("false", Tag.NAMED),
+        NULL("null", Tag.NAMED),
+        ARROW("->"),
+        HASH("#"),
+        LPAREN("("),
+        RPAREN(")"),
+        LBRACE("{"),
+        RBRACE("}"),
+        LBRACKET("["),
+        RBRACKET("]"),
+        SEMI(";"),
+        COMMA(","),
+        DOT("."),
+        ELLIPSIS("..."),
+        EQ("="),
+        GT(">"),
+        LT("<"),
+        BANG("!"),
+        TILDE("~"),
+        QUES("?"),
+        COLON(":"),
+        EQEQ("=="),
+        LTEQ("<="),
+        GTEQ(">="),
+        BANGEQ("!="),
+        AMPAMP("&&"),
+        BARBAR("||"),
+        PLUSPLUS("++"),
+        SUBSUB("--"),
+        PLUS("+"),
+        SUB("-"),
+        STAR("*"),
+        SLASH("/"),
+        AMP("&"),
+        BAR("|"),
+        CARET("^"),
+        PERCENT("%"),
+        LTLT("<<"),
+        GTGT(">>"),
+        GTGTGT(">>>"),
+        PLUSEQ("+="),
+        SUBEQ("-="),
+        STAREQ("*="),
+        SLASHEQ("/="),
+        AMPEQ("&="),
+        BAREQ("|="),
+        CARETEQ("^="),
+        PERCENTEQ("%="),
+        LTLTEQ("<<="),
+        GTGTEQ(">>="),
+        GTGTGTEQ(">>>="),
+        MONKEYS_AT("@"),
+        CUSTOM;
+
+        public final String name;
+        public final Tag tag;
+
+        TokenKind() {
+            this(null, Tag.DEFAULT);
+        }
+
+        TokenKind(String name) {
+            this(name, Tag.DEFAULT);
+        }
+
+        TokenKind(Tag tag) {
+            this(null, tag);
+        }
+
+        TokenKind(String name, Tag tag) {
+            this.name = name;
+            this.tag = tag;
+        }
+
+        public String toString() {
+            switch (this) {
+            case IDENTIFIER:
+                return "token.identifier";
+            case CHARLITERAL:
+                return "token.character";
+            case STRINGLITERAL:
+                return "token.string";
+            case INTLITERAL:
+                return "token.integer";
+            case LONGLITERAL:
+                return "token.long-integer";
+            case FLOATLITERAL:
+                return "token.float";
+            case DOUBLELITERAL:
+                return "token.double";
+            case ERROR:
+                return "token.bad-symbol";
+            case EOF:
+                return "token.end-of-input";
+            case DOT: case COMMA: case SEMI: case LPAREN: case RPAREN:
+            case LBRACKET: case RBRACKET: case LBRACE: case RBRACE:
+                return "'" + name + "'";
+            default:
+                return name;
+            }
+        }
+
+        public String getKind() {
+            return "Token";
+        }
+
+        public String toString(Locale locale, Messages messages) {
+            return name != null ? toString() : messages.getLocalizedString(locale, "compiler.misc." + toString());
+        }
+    }
+
+    public interface Comment {
+
+        enum CommentStyle {
+            LINE,
+            BLOCK,
+            JAVADOC,
+        }
+
+        String getText();
+        CommentStyle getStyle();
+        boolean isDeprecated();
+    }
+
+    /**
+     * This is the class representing a javac token. Each token has several fields
+     * that are set by the javac lexer (i.e. start/end position, string value, etc).
+     */
+    public static class Token {
+
+        /** tags constants **/
+        enum Tag {
+            DEFAULT,
+            NAMED,
+            STRING,
+            NUMERIC;
+        }
+
+        /** The token kind */
+        public final TokenKind kind;
+
+        /** The start position of this token */
+        public final int pos;
+
+        /** The end position of this token */
+        public final int endPos;
+
+        /** Comment reader associated with this token */
+        public final List<Comment> comments;
+
+        Token(TokenKind kind, int pos, int endPos, List<Comment> comments) {
+            this.kind = kind;
+            this.pos = pos;
+            this.endPos = endPos;
+            this.comments = comments;
+            checkKind();
+        }
+
+        Token[] split(Tokens tokens) {
+            if (kind.name.length() < 2 || kind.tag != Tag.DEFAULT) {
+                throw new AssertionError("Cant split" + kind);
+            }
+
+            TokenKind t1 = tokens.lookupKind(kind.name.substring(0, 1));
+            TokenKind t2 = tokens.lookupKind(kind.name.substring(1));
+
+            if (t1 == null || t2 == null) {
+                throw new AssertionError("Cant split - bad subtokens");
+            }
+            return new Token[] {
+                new Token(t1, pos, pos + t1.name.length(), comments),
+                new Token(t2, pos + t1.name.length(), endPos, null)
+            };
+        }
+
+        protected void checkKind() {
+            if (kind.tag != Tag.DEFAULT) {
+                throw new AssertionError("Bad token kind - expected " + Tag.STRING);
+            }
+        }
+
+        public Name name() {
+            throw new UnsupportedOperationException();
+        }
+
+        public String stringVal() {
+            throw new UnsupportedOperationException();
+        }
+
+        public int radix() {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * Preserve classic semantics - if multiple javadocs are found on the token
+         * the last one is returned
+         */
+        public String comment(Comment.CommentStyle style) {
+            List<Comment> readers = getReaders(Comment.CommentStyle.JAVADOC);
+            return readers.isEmpty() ?
+                    null :
+                    readers.head.getText();
+        }
+
+        /**
+         * Preserve classic semantics - deprecated should be set if at least one
+         * javadoc comment attached to this token contains the '@deprecated' string
+         */
+        public boolean deprecatedFlag() {
+            for (Comment r : getReaders(Comment.CommentStyle.JAVADOC)) {
+                if (r.isDeprecated()) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        private List<Comment> getReaders(Comment.CommentStyle style) {
+            if (comments == null) {
+                return List.nil();
+            } else {
+                ListBuffer<Comment> buf = ListBuffer.lb();
+                for (Comment r : comments) {
+                    if (r.getStyle() == style) {
+                        buf.add(r);
+                    }
+                }
+                return buf.toList();
+            }
+        }
+    }
+
+    final static class NamedToken extends Token {
+        /** The name of this token */
+        public final Name name;
+
+        public NamedToken(TokenKind kind, int pos, int endPos, Name name, List<Comment> comments) {
+            super(kind, pos, endPos, comments);
+            this.name = name;
+        }
+
+        protected void checkKind() {
+            if (kind.tag != Tag.NAMED) {
+                throw new AssertionError("Bad token kind - expected " + Tag.NAMED);
+            }
+        }
+
+        @Override
+        public Name name() {
+            return name;
+        }
+    }
+
+    static class StringToken extends Token {
+        /** The string value of this token */
+        public final String stringVal;
+
+        public StringToken(TokenKind kind, int pos, int endPos, String stringVal, List<Comment> comments) {
+            super(kind, pos, endPos, comments);
+            this.stringVal = stringVal;
+        }
+
+        protected void checkKind() {
+            if (kind.tag != Tag.STRING) {
+                throw new AssertionError("Bad token kind - expected " + Tag.STRING);
+            }
+        }
+
+        @Override
+        public String stringVal() {
+            return stringVal;
+        }
+    }
+
+    final static class NumericToken extends StringToken {
+        /** The 'radix' value of this token */
+        public final int radix;
+
+        public NumericToken(TokenKind kind, int pos, int endPos, String stringVal, int radix, List<Comment> comments) {
+            super(kind, pos, endPos, stringVal, comments);
+            this.radix = radix;
+        }
+
+        protected void checkKind() {
+            if (kind.tag != Tag.NUMERIC) {
+                throw new AssertionError("Bad token kind - expected " + Tag.NUMERIC);
+            }
+        }
+
+        @Override
+        public int radix() {
+            return radix;
+        }
+    }
+
+    public static final Token DUMMY =
+                new Token(TokenKind.ERROR, 0, 0, null);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.parser;
+
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
+
+import java.nio.CharBuffer;
+
+import static com.sun.tools.javac.util.LayoutCharacters.*;
+
+/** The char reader used by the javac lexer/tokenizer. Returns the sequence of
+ * characters contained in the input stream, handling unicode escape accordingly.
+ * Additionally, it provide features for saving chars into a buffer and to retrieve
+ * them at a later stage.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class UnicodeReader {
+
+    /** The input buffer, index of next character to be read,
+     *  index of one past last character in buffer.
+     */
+    protected char[] buf;
+    protected int bp;
+    protected final int buflen;
+
+    /** The current character.
+     */
+    protected char ch;
+
+    /** The buffer index of the last converted unicode character
+     */
+    protected int unicodeConversionBp = -1;
+
+    protected Log log;
+    protected Names names;
+
+    /** A character buffer for saved chars.
+     */
+    protected char[] sbuf = new char[128];
+    protected int sp;
+
+    /**
+     * Create a scanner from the input array.  This method might
+     * modify the array.  To avoid copying the input array, ensure
+     * that {@code inputLength < input.length} or
+     * {@code input[input.length -1]} is a white space character.
+     *
+     * @param fac the factory which created this Scanner
+     * @param input the input, might be modified
+     * @param inputLength the size of the input.
+     * Must be positive and less than or equal to input.length.
+     */
+    protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
+        this(sf, JavacFileManager.toArray(buffer), buffer.limit());
+    }
+
+    protected UnicodeReader(ScannerFactory sf, char[] input, int inputLength) {
+        log = sf.log;
+        names = sf.names;
+        if (inputLength == input.length) {
+            if (input.length > 0 && Character.isWhitespace(input[input.length - 1])) {
+                inputLength--;
+            } else {
+                char[] newInput = new char[inputLength + 1];
+                System.arraycopy(input, 0, newInput, 0, input.length);
+                input = newInput;
+            }
+        }
+        buf = input;
+        buflen = inputLength;
+        buf[buflen] = EOI;
+        bp = -1;
+        scanChar();
+    }
+
+    /** Read next character.
+     */
+    protected void scanChar() {
+        if (bp < buflen) {
+            ch = buf[++bp];
+            if (ch == '\\') {
+                convertUnicode();
+            }
+        }
+    }
+
+    /** Read next character in comment, skipping over double '\' characters.
+     */
+    protected void scanCommentChar() {
+        scanChar();
+        if (ch == '\\') {
+            if (peekChar() == '\\' && !isUnicode()) {
+                skipChar();
+            } else {
+                convertUnicode();
+            }
+        }
+    }
+
+    /** Append a character to sbuf.
+     */
+    protected void putChar(char ch, boolean scan) {
+        if (sp == sbuf.length) {
+            char[] newsbuf = new char[sbuf.length * 2];
+            System.arraycopy(sbuf, 0, newsbuf, 0, sbuf.length);
+            sbuf = newsbuf;
+        }
+        sbuf[sp++] = ch;
+        if (scan)
+            scanChar();
+    }
+
+    protected void putChar(char ch) {
+        putChar(ch, false);
+    }
+
+    protected void putChar(boolean scan) {
+        putChar(ch, scan);
+    }
+
+    Name name() {
+        return names.fromChars(sbuf, 0, sp);
+    }
+
+    String chars() {
+        return new String(sbuf, 0, sp);
+    }
+
+    /** Convert unicode escape; bp points to initial '\' character
+     *  (Spec 3.3).
+     */
+    protected void convertUnicode() {
+        if (ch == '\\' && unicodeConversionBp != bp) {
+            bp++; ch = buf[bp];
+            if (ch == 'u') {
+                do {
+                    bp++; ch = buf[bp];
+                } while (ch == 'u');
+                int limit = bp + 3;
+                if (limit < buflen) {
+                    int d = digit(bp, 16);
+                    int code = d;
+                    while (bp < limit && d >= 0) {
+                        bp++; ch = buf[bp];
+                        d = digit(bp, 16);
+                        code = (code << 4) + d;
+                    }
+                    if (d >= 0) {
+                        ch = (char)code;
+                        unicodeConversionBp = bp;
+                        return;
+                    }
+                }
+                log.error(bp, "illegal.unicode.esc");
+            } else {
+                bp--;
+                ch = '\\';
+            }
+        }
+    }
+
+    /** Are surrogates supported?
+     */
+    final static boolean surrogatesSupported = surrogatesSupported();
+    private static boolean surrogatesSupported() {
+        try {
+            Character.isHighSurrogate('a');
+            return true;
+        } catch (NoSuchMethodError ex) {
+            return false;
+        }
+    }
+
+    /** Scan surrogate pairs.  If 'ch' is a high surrogate and
+     *  the next character is a low surrogate, then put the low
+     *  surrogate in 'ch', and return the high surrogate.
+     *  otherwise, just return 0.
+     */
+    protected char scanSurrogates() {
+        if (surrogatesSupported && Character.isHighSurrogate(ch)) {
+            char high = ch;
+
+            scanChar();
+
+            if (Character.isLowSurrogate(ch)) {
+                return high;
+            }
+
+            ch = high;
+        }
+
+        return 0;
+    }
+
+    /** Convert an ASCII digit from its base (8, 10, or 16)
+     *  to its value.
+     */
+    protected int digit(int pos, int base) {
+        char c = ch;
+        int result = Character.digit(c, base);
+        if (result >= 0 && c > 0x7f) {
+            log.error(pos + 1, "illegal.nonascii.digit");
+            ch = "0123456789abcdef".charAt(result);
+        }
+        return result;
+    }
+
+    protected boolean isUnicode() {
+        return unicodeConversionBp == bp;
+    }
+
+    protected void skipChar() {
+        bp++;
+    }
+
+    protected char peekChar() {
+        return buf[bp + 1];
+    }
+
+    /**
+     * Returns a copy of the input buffer, up to its inputLength.
+     * Unicode escape sequences are not translated.
+     */
+    public char[] getRawCharacters() {
+        char[] chars = new char[buflen];
+        System.arraycopy(buf, 0, chars, 0, buflen);
+        return chars;
+    }
+
+    /**
+     * Returns a copy of a character array subset of the input buffer.
+     * The returned array begins at the <code>beginIndex</code> and
+     * extends to the character at index <code>endIndex - 1</code>.
+     * Thus the length of the substring is <code>endIndex-beginIndex</code>.
+     * This behavior is like
+     * <code>String.substring(beginIndex, endIndex)</code>.
+     * Unicode escape sequences are not translated.
+     *
+     * @param beginIndex the beginning index, inclusive.
+     * @param endIndex the ending index, exclusive.
+     * @throws IndexOutOfBounds if either offset is outside of the
+     *         array bounds
+     */
+    public char[] getRawCharacters(int beginIndex, int endIndex) {
+        int length = endIndex - beginIndex;
+        char[] chars = new char[length];
+        System.arraycopy(buf, beginIndex, chars, 0, length);
+        return chars;
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -455,9 +455,24 @@
         // TODO: Only support reading resources in selected output
         // locations?  Only allow reading of non-source, non-class
         // files from the supported input locations?
-        FileObject fileObject = fileManager.getFileForInput(location,
+
+        // In the following, getFileForInput is the "obvious" method
+        // to use, but it does not have the "obvious" semantics for
+        // SOURCE_OUTPUT and CLASS_OUTPUT. Conversely, getFileForOutput
+        // does not have the correct semantics for any "path" location
+        // with more than one component. So, for now, we use a hybrid
+        // invocation.
+        FileObject fileObject;
+        if (location.isOutputLocation()) {
+            fileObject = fileManager.getFileForOutput(location,
+                    pkg.toString(),
+                    relativeName.toString(),
+                    null);
+        } else {
+            fileObject = fileManager.getFileForInput(location,
                     pkg.toString(),
                     relativeName.toString());
+        }
         if (fileObject == null) {
             String name = (pkg.length() == 0)
                     ? relativeName.toString() : (pkg + "/" + relativeName);
--- a/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,6 +99,7 @@
         if (treeTop != null) {
             newSource = treeTop.snd.sourcefile;
             if (newSource != null) {
+                // save the old version and reinstate it later
                 oldSource = log.useSource(newSource);
                 pos = treeTop.fst.pos();
             }
@@ -131,7 +132,8 @@
                 break;
             }
         } finally {
-            if (oldSource != null)
+            // reinstate the saved version, only if it was saved earlier
+            if (newSource != null)
                 log.useSource(oldSource);
         }
     }
--- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,34 +25,33 @@
 
 package com.sun.tools.javac.processing;
 
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.regex.*;
-
-import java.net.URL;
 import java.io.Closeable;
 import java.io.File;
 import java.io.PrintWriter;
-import java.io.IOException;
 import java.io.StringWriter;
 import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import java.util.regex.*;
 
 import javax.annotation.processing.*;
 import javax.lang.model.SourceVersion;
 import javax.lang.model.element.AnnotationMirror;
 import javax.lang.model.element.Element;
+import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.PackageElement;
 import javax.lang.model.util.*;
+import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.DiagnosticListener;
+import static javax.tools.StandardLocation.*;
 
+import com.sun.source.util.JavacTask;
 import com.sun.source.util.TaskEvent;
-import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.javac.api.MultiTaskListener;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.file.FSInfo;
@@ -71,19 +70,16 @@
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
-import com.sun.tools.javac.util.FatalError;
 import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Options;
-
-import static javax.tools.StandardLocation.*;
+import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
+import static com.sun.tools.javac.main.Option.*;
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
-import static com.sun.tools.javac.main.OptionName.*;
-import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
 
 /**
  * Objects of this class hold and manage the state needed to support
@@ -157,6 +153,8 @@
      */
     private JavacMessages messages;
 
+    private MultiTaskListener taskListener;
+
     private Context context;
 
     public JavacProcessingEnvironment(Context context, Iterable<? extends Processor> processors) {
@@ -185,6 +183,7 @@
         processorOptions = initProcessorOptions(context);
         unmatchedProcessorOptions = initUnmatchedProcessorOptions();
         messages = JavacMessages.instance(context);
+        taskListener = MultiTaskListener.instance(context);
         initProcessorIterator(context, processors);
     }
 
@@ -225,6 +224,11 @@
                     ? fileManager.getClassLoader(ANNOTATION_PROCESSOR_PATH)
                     : fileManager.getClassLoader(CLASS_PATH);
 
+                if (processorClassLoader != null && processorClassLoader instanceof Closeable) {
+                    JavaCompiler compiler = JavaCompiler.instance(context);
+                    compiler.closeables = compiler.closeables.prepend((Closeable) processorClassLoader);
+                }
+
                 /*
                  * If the "-processor" option is used, search the appropriate
                  * path for the named class.  Otherwise, use a service
@@ -683,7 +687,7 @@
                 ps.removeSupportedOptions(unmatchedProcessorOptions);
 
                 if (printProcessorInfo || verbose) {
-                    log.printNoteLines("x.print.processor.info",
+                    log.printLines("x.print.processor.info",
                             ps.processor.getClass().getName(),
                             matchedNames.toString(),
                             processingResult);
@@ -720,7 +724,7 @@
      * Leave class public for external testing purposes.
      */
     public static class ComputeAnnotationSet extends
-        ElementScanner7<Set<TypeElement>, Set<TypeElement>> {
+        ElementScanner8<Set<TypeElement>, Set<TypeElement>> {
         final Elements elements;
 
         public ComputeAnnotationSet(Elements elements) {
@@ -971,8 +975,7 @@
         void run(boolean lastRound, boolean errorStatus) {
             printRoundInfo(lastRound);
 
-            TaskListener taskListener = context.get(TaskListener.class);
-            if (taskListener != null)
+            if (!taskListener.isEmpty())
                 taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
 
             try {
@@ -988,7 +991,7 @@
                     discoverAndRunProcs(context, annotationsPresent, topLevelClasses, packageInfoFiles);
                 }
             } finally {
-                if (taskListener != null)
+                if (!taskListener.isEmpty())
                     taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
             }
 
@@ -1009,7 +1012,7 @@
             if (printRounds || verbose) {
                 List<ClassSymbol> tlc = lastRound ? List.<ClassSymbol>nil() : topLevelClasses;
                 Set<TypeElement> ap = lastRound ? Collections.<TypeElement>emptySet() : annotationsPresent;
-                log.printNoteLines("x.print.rounds",
+                log.printLines("x.print.rounds",
                         number,
                         "{" + tlc.toString(", ") + "}",
                         ap,
@@ -1028,12 +1031,10 @@
             Assert.checkNonNull(options);
             next.put(Options.optionsKey, options);
 
-            PrintWriter out = context.get(Log.outKey);
-            Assert.checkNonNull(out);
-            next.put(Log.outKey, out);
             Locale locale = context.get(Locale.class);
             if (locale != null)
                 next.put(Locale.class, locale);
+
             Assert.checkNonNull(messages);
             next.put(JavacMessages.messagesKey, messages);
 
@@ -1048,9 +1049,9 @@
             if (dl != null)
                 next.put(DiagnosticListener.class, dl);
 
-            TaskListener tl = context.get(TaskListener.class);
-            if (tl != null)
-                next.put(TaskListener.class, tl);
+            MultiTaskListener mtl = context.get(MultiTaskListener.taskListenerKey);
+            if (mtl != null)
+                next.put(MultiTaskListener.taskListenerKey, mtl);
 
             FSInfo fsInfo = context.get(FSInfo.class);
             if (fsInfo != null)
@@ -1067,9 +1068,12 @@
             Assert.checkNonNull(names);
             next.put(Names.namesKey, names);
 
-            Keywords keywords = Keywords.instance(context);
-            Assert.checkNonNull(keywords);
-            next.put(Keywords.keywordsKey, keywords);
+            Tokens tokens = Tokens.instance(context);
+            Assert.checkNonNull(tokens);
+            next.put(Tokens.tokensKey, tokens);
+
+            // propogate the log's writers directly, instead of going through context
+            Log.instance(next).setWriters(log);
 
             JavaCompiler oldCompiler = JavaCompiler.instance(context);
             JavaCompiler nextCompiler = JavaCompiler.instance(next);
@@ -1080,9 +1084,9 @@
             elementUtils.setContext(next);
             typeUtils.setContext(next);
 
-            JavacTaskImpl task = context.get(JavacTaskImpl.class);
+            JavacTaskImpl task = (JavacTaskImpl) context.get(JavacTask.class);
             if (task != null) {
-                next.put(JavacTaskImpl.class, task);
+                next.put(JavacTask.class, task);
                 task.updateContext(next);
             }
 
@@ -1104,8 +1108,6 @@
                                      List<JCCompilationUnit> roots,
                                      List<ClassSymbol> classSymbols,
                                      Iterable<? extends PackageSymbol> pckSymbols) {
-
-        TaskListener taskListener = context.get(TaskListener.class);
         log = Log.instance(context);
 
         Set<PackageSymbol> specifiedPackages = new LinkedHashSet<PackageSymbol>();
@@ -1176,7 +1178,7 @@
         // Free resources
         this.close();
 
-        if (taskListener != null)
+        if (!taskListener.isEmpty())
             taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING));
 
         if (errorStatus) {
@@ -1211,21 +1213,13 @@
         if (discoveredProcs != null) // Make calling close idempotent
             discoveredProcs.close();
         discoveredProcs = null;
-        if (processorClassLoader != null && processorClassLoader instanceof Closeable) {
-            try {
-                ((Closeable) processorClassLoader).close();
-            } catch (IOException e) {
-                JCDiagnostic msg = diags.fragment("fatal.err.cant.close.loader");
-                throw new FatalError(msg, e);
-            }
-        }
     }
 
     private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) {
         List<ClassSymbol> classes = List.nil();
         for (JCCompilationUnit unit : units) {
             for (JCTree node : unit.defs) {
-                if (node.getTag() == JCTree.CLASSDEF) {
+                if (node.hasTag(JCTree.Tag.CLASSDEF)) {
                     ClassSymbol sym = ((JCClassDecl) node).sym;
                     Assert.checkNonNull(sym);
                     classes = classes.prepend(sym);
@@ -1475,14 +1469,6 @@
         return context;
     }
 
-    /**
-     * Internal use method to return the writer being used by the
-     * processing environment.
-     */
-    public PrintWriter getWriter() {
-        return context.get(Log.outKey);
-    }
-
     public String toString() {
         return "javac ProcessingEnvironment";
     }
--- a/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@
         else
             throw new AssertionError("Bad implementation type for " + tm);
 
-        ElementScanner7<Set<Element>, DeclaredType> scanner =
+        ElementScanner8<Set<Element>, DeclaredType> scanner =
             new AnnotationSetScanner(result, typeUtil);
 
         for (Element element : rootElements)
@@ -136,7 +136,7 @@
 
     // Could be written as a local class inside getElementsAnnotatedWith
     private class AnnotationSetScanner extends
-        ElementScanner7<Set<Element>, DeclaredType> {
+        ElementScanner8<Set<Element>, DeclaredType> {
         // Insertion-order preserving set
         Set<Element> annotatedElements = new LinkedHashSet<Element>();
         Types typeUtil;
--- a/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Tue May 29 00:27:58 2012 +0100
@@ -82,7 +82,7 @@
      * Used for the -Xprint option and called by Elements.printElements
      */
     public static class PrintingElementVisitor
-        extends SimpleElementVisitor7<PrintingElementVisitor, Boolean> {
+        extends SimpleElementVisitor8<PrintingElementVisitor, Boolean> {
         int indentation; // Indentation level;
         final PrintWriter writer;
         final Elements elementUtils;
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -68,9 +68,13 @@
 compiler.err.already.annotated=\
     {0} {1} has already been annotated
 
-# 0: symbol, 1: symbol
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol
 compiler.err.already.defined=\
-    {0} is already defined in {1}
+    {0} {1} is already defined in {2} {3}
+
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol kind, 4: symbol
+compiler.err.already.defined.in.clinit=\
+    {0} {1} is already defined in {2} of {3} {4}
 
 # 0: string
 compiler.err.already.defined.single.import=\
@@ -130,15 +134,13 @@
 compiler.err.array.req.but.found=\
     array required, but {0} found
 
-compiler.err.assignment.from.super-bound=\
-    assigning from wildcard {0}
-
-compiler.err.assignment.to.extends-bound=\
-    assigning to wildcard {0}
-
 compiler.err.attribute.value.must.be.constant=\
     attribute value must be constant
 
+# 0: statement type
+compiler.err.bad.initializer=\
+    bad initializer for {0}
+
 compiler.err.break.outside.switch.loop=\
     break outside switch or loop
 
@@ -198,6 +200,9 @@
 compiler.err.clash.with.pkg.of.same.name=\
     {0} {1} clashes with package of same name
 
+compiler.err.class.not.allowed=\
+    class, interface or enum declaration not allowed here
+
 compiler.err.const.expr.req=\
     constant expression required
 
@@ -219,9 +224,6 @@
 compiler.err.no.superclass=\
     {0} has no superclass
 
-compiler.err.wrong.target.for.polymorphic.signature.definition=\
-    MethodHandle API building requires -target 7 runtimes or better; current is -target {0}
-
 # 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
 compiler.err.concrete.inheritance.conflict=\
     methods {0} from {1} and {2} from {3} are inherited with the same signature
@@ -380,6 +382,9 @@
 compiler.err.illegal.underscore=\
     illegal underscore
 
+compiler.err.illegal.dot=\
+    illegal ''.''
+
 # 0: symbol
 compiler.err.illegal.qual.not.icls=\
     illegal qualifier; {0} is not an inner class
@@ -387,6 +392,9 @@
 compiler.err.illegal.start.of.expr=\
     illegal start of expression
 
+compiler.err.illegal.start.of.stmt=\
+    illegal start of statement
+
 compiler.err.illegal.start.of.type=\
     illegal start of type
 
@@ -448,6 +456,9 @@
 compiler.err.varargs.and.old.array.syntax=\
     legacy array notation not allowed on variable-arity parameter
 
+compiler.err.variable.not.allowed=\
+    variable declaration not allowed here
+
 # 0: name
 compiler.err.label.already.in.use=\
     label {0} already in use
@@ -462,6 +473,9 @@
 compiler.err.cannot.create.array.with.type.arguments=\
     cannot create array with type arguments
 
+compiler.err.cannot.create.array.with.diamond=\
+    cannot create array with ''<>''
+
 #
 # limits.  We don't give the limits in the diagnostic because we expect
 # them to change, yet we want to use the same diagnostic.  These are all
@@ -769,25 +783,23 @@
 compiler.err.undef.label=\
     undefined label: {0}
 
-compiler.err.undetermined.type=\
-    cannot infer type arguments for {0}
-
-# 0: type, 1: message segment
-compiler.err.undetermined.type.1=\
-    cannot infer type arguments for {0};\n\
+# 0: list of type, 1: message segment
+compiler.misc.invalid.inferred.types=\
+    invalid inferred types for {0}\n\
     reason: {1}
 
-# 0: list of type, 1: message segment
-compiler.err.invalid.inferred.types=\
-    invalid inferred types for {0}; {1}
-
 # 0: message segment, 1: unused
 compiler.err.cant.apply.diamond=\
     cannot infer type arguments for {0}
 
-# 0: message segment, 1: message segment
+# 0: message segment or type, 1: message segment
 compiler.err.cant.apply.diamond.1=\
-    cannot infer type arguments for {0};\n\
+    cannot infer type arguments for {0}\n\
+    reason: {1}
+
+# 0: message segment or type, 1: message segment
+compiler.misc.cant.apply.diamond.1=\
+    cannot infer type arguments for {0}\n\
     reason: {1}
 
 compiler.err.unreachable.stmt=\
@@ -847,7 +859,7 @@
 compiler.misc.varargs.trustme.on.virtual.varargs=\
     Instance method {0} is not final.
 
-# 0: type, 1: kind, 2: symbol
+# 0: type, 1: symbol kind, 2: symbol
 compiler.misc.inaccessible.varargs.type=\
     formal varargs element type {0} is not accessible from {1} {2}
 
@@ -888,8 +900,8 @@
 compiler.misc.fatal.err.cant.locate.ctor=\
     Fatal Error: Unable to find constructor for {0}
 
-compiler.misc.fatal.err.cant.close.loader=\
-    Fatal Error: Cannot close class loader for annotation processors
+compiler.misc.fatal.err.cant.close=\
+    Fatal Error: Cannot close compiler resources
 
 #####
 
@@ -1493,11 +1505,15 @@
 
 #####
 
-# 0: message segment, 1: type, 2: type
+# 0: type, 1: type
 compiler.err.prob.found.req=\
-    {0}\n\
-    required: {2}\n\
-    found:    {1}
+    incompatible types\n\
+    required: {1}\n\
+    found: {0}
+
+# 0: message segment
+compiler.err.prob.found.req.1=\
+    incompatible types: {0}
 
 # 0: message segment, 1: type, 2: type
 compiler.warn.prob.found.req=\
@@ -1505,22 +1521,9 @@
     required: {2}\n\
     found:    {1}
 
-compiler.err.prob.found.req.1=\
-    {0} {3}\n\
-    required: {2}\n\
-    found:    {1}
-
-## The following are all possible strings for the first argument ({0}) of the
-## above strings.
-compiler.misc.incompatible.types=\
-    incompatible types
-
-# 0: message segment
-compiler.misc.incompatible.types.1=\
-    incompatible types; {0}
-
+# 0: type, 1: type
 compiler.misc.inconvertible.types=\
-    inconvertible types
+    {0} cannot be converted to {1}
 
 compiler.misc.possible.loss.of.precision=\
     possible loss of precision
@@ -1535,19 +1538,15 @@
 compiler.misc.unchecked.cast.to.type=\
     unchecked cast
 
-compiler.misc.assignment.from.super-bound=\
-    assignment from super-bound type {0}
-
-compiler.misc.assignment.to.extends-bound=\
-    assignment to extends-bound type {0}
-
 # compiler.err.star.expected=\
 #     ''*'' expected
 # compiler.err.no.elem.type=\
 #     \[\*\] cannot have a type
 
+# 0: type
 compiler.misc.try.not.applicable.to.type=\
-    try-with-resources not applicable to variable type
+    try-with-resources not applicable to variable type {0}\n\
+    (expected a variable of type java.lang.AutoCloseable)
 
 #####
 
@@ -1582,11 +1581,11 @@
 
 ## The following are all possible strings for the last argument of all those
 ## diagnostics whose key ends in ".1"
+
+# 0: type, 1: message segment
 compiler.misc.undetermined.type=\
-    undetermined type
-
-compiler.misc.type.variable.has.undetermined.type=\
-    type variable {0} has undetermined type
+    cannot infer type arguments for {0}\n\
+    reason: {1}
 
 # 0: type, 1: list of type
 compiler.misc.no.unique.maximal.instance.exists=\
@@ -1595,6 +1594,10 @@
 compiler.misc.no.unique.minimal.instance.exists=\
     no unique minimal instance exists for type variable {0} with lower bounds {1}
 
+# 0: type, 1: list of type
+compiler.misc.incompatible.upper.bounds=\
+    inference variable {0} has incompatible upper bounds {1}
+
 # 0: list of type, 1: type, 2: type
 compiler.misc.infer.no.conforming.instance.exists=\
     no instance(s) of type variable(s) {0} exist so that {1} conforms to {2}
@@ -1606,11 +1609,27 @@
 compiler.misc.infer.arg.length.mismatch=\
     cannot instantiate from arguments because actual and formal argument lists differ in length
 
+# 0: list of type, 1: type, 2: type
+compiler.misc.infer.varargs.argument.mismatch=\
+    no instance(s) of type variable(s) {0} exist so that argument type {1} conforms to vararg element type {2}
+
 # 0: type, 1: list of type
-compiler.misc.inferred.do.not.conform.to.bounds=\
-    inferred type does not conform to declared bound(s)\n\
+compiler.misc.inferred.do.not.conform.to.upper.bounds=\
+    inferred type does not conform to upper bound(s)\n\
     inferred: {0}\n\
-    bound(s): {1}
+    upper bound(s): {1}
+
+# 0: type, 1: list of type
+compiler.misc.inferred.do.not.conform.to.lower.bounds=\
+    inferred type does not conform to lower bound(s)\n\
+    inferred: {0}\n\
+    lower bound(s): {1}
+
+# 0: type, 1: list of type
+compiler.misc.inferred.do.not.conform.to.eq.bounds=\
+    inferred type does not conform to equality constraint(s)\n\
+    inferred: {0}\n\
+    equality constraints(s): {1}
 
 # 0: symbol
 compiler.misc.diamond=\
@@ -1620,6 +1639,7 @@
 compiler.misc.diamond.non.generic=\
     cannot use ''<>'' with non-generic class {0}
 
+# 0: unused
 compiler.misc.diamond.and.explicit.params=\
     cannot use ''<>'' with explicit type parameters for constructor
 
@@ -1701,7 +1721,7 @@
 ## The second argument {1} is the location name
 ## The third argument {2} is the location type (only when {1} is a variable name)
 
-# 0: symbol kind, 1: symbol, 2: unused
+# 0: symbol kind, 1: type or symbol, 2: unused
 compiler.misc.location=\
     {0} {1}
 
@@ -1750,6 +1770,12 @@
 compiler.misc.kindname.package=\
     package
 
+compiler.misc.kindname.static.init=\
+    static initializer
+
+compiler.misc.kindname.instance.init=\
+    instance initializer
+
 #####
 
 compiler.misc.no.args=\
@@ -1830,6 +1856,7 @@
 compiler.misc.varargs.clash.with=\
     {0} in {1} overrides {2} in {3}
 
+# 0: unused
 compiler.misc.diamond.and.anon.class=\
     cannot use ''<>'' with anonymous inner classes
 
@@ -1926,6 +1953,65 @@
     strings in switch are not supported in -source {0}\n\
     (use -source 7 or higher to enable strings in switch)
 
+# 0: string
+compiler.err.lambda.not.supported.in.source=\
+    lambda expressions are not supported in -source {0}\n\
+    (use -source 8 or higher to enable lambda expressions)
+
+# 0: string
+compiler.err.method.references.not.supported.in.source=\
+    method references are not supported in -source {0}\n\
+    (use -source 8 or higher to enable method references)
+
+########################################
+# Diagnostics for verbose resolution
+# used by Resolve (debug only)
+########################################
+
+# 0: number, 1: symbol, 2: unused
+compiler.misc.applicable.method.found=\
+    #{0} applicable method found: {1}
+
+# 0: number, 1: symbol, 2: message segment
+compiler.misc.applicable.method.found.1=\
+    #{0} applicable method found: {1}\n\
+    ({2})
+
+# 0: number, 1: symbol, 2: message segment
+compiler.misc.not.applicable.method.found=\
+    #{0} not applicable method found: {1}\n\
+    ({2})
+
+# 0: type
+compiler.misc.full.inst.sig=\
+    fully instantiated to: {0}
+
+# 0: type
+compiler.misc.partial.inst.sig=\
+    partially instantiated to: {0}
+
+# 0: name, 1: symbol, 2: number, 3: MethodResolutionPhase, 4: list of type or message segment, 5: list of type or message segment
+compiler.note.verbose.resolve.multi=\
+    resolving method {0} in type {1} to candidate {2}\n\
+    phase: {3}\n\
+    with actuals: {4}\n\
+    with type-args: {5}\n\
+    candidates:
+
+# 0: name, 1: symbol, 2: unused, 3: MethodResolutionPhase, 4: list of type or message segment, 5: list of type or message segment
+compiler.note.verbose.resolve.multi.1=\
+    erroneous resolution for method {0} in type {1}\n\
+    phase: {3}\n\
+    with actuals: {4}\n\
+    with type-args: {5}\n\
+    candidates:
+
+# 0: symbol, 1: type, 2: type
+compiler.note.deferred.method.inst=\
+    Deferred instantiation of method {0}\n\
+    instantiated signature: {1}\n\
+    target-type: {2}
+
 ########################################
 # Diagnostics for where clause implementation
 # used by the RichDiagnosticFormatter.
@@ -1969,9 +2055,16 @@
 
 # compact where clause for type variable: contains the kindname ({2}) and location ({3})
 # in which the typevar has been declared
+# 0: type, 1: list of type, 2: symbol kind, 3: symbol
 compiler.misc.where.typevar.1=\
     {0} declared in {2} {3}
 
+# where clause for fresh type variable: contains upper bound(s) ('extends {1}').
+# Since a fresh type-variable is synthetic - there's no location/kindname here.
+# 0: type, 1: list of type
+compiler.misc.where.fresh.typevar=\
+    {0} extends {1}
+
 # where clause for type variable: contains all the upper bound(s) ('extends {1}')
 # of this intersection type
 # 0: type, 1: list of type
--- a/src/share/classes/com/sun/tools/javac/resources/javac.properties	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -61,6 +61,8 @@
     Specify where to place generated class files
 javac.opt.sourceDest=\
     Specify where to place generated source files
+javac.opt.headerDest=\
+    Specify where to place generated native header files
 javac.opt.J=\
     Pass <flag> directly to the runtime system
 javac.opt.encoding=\
--- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Tue May 29 00:27:58 2012 +0100
@@ -39,9 +39,13 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Scope.*;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.source.tree.*;
+import com.sun.source.tree.LambdaExpressionTree.BodyKind;
+import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
 
 import static com.sun.tools.javac.code.BoundKind.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /**
  * Root class for abstract syntax tree nodes. It provides definitions
@@ -79,253 +83,297 @@
 public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
 
     /* Tree tag values, identifying kinds of trees */
+    public enum Tag{
+        /** For methods that return an invalid tag if a given condition is not met
+         */
+        NO_TAG,
 
-    /** Toplevel nodes, of type TopLevel, representing entire source files.
-     */
-    public static final int  TOPLEVEL = 1;
+        /** Toplevel nodes, of type TopLevel, representing entire source files.
+        */
+        TOPLEVEL,
 
-    /** Import clauses, of type Import.
-     */
-    public static final int IMPORT = TOPLEVEL + 1;
+        /** Import clauses, of type Import.
+         */
+        IMPORT,
 
-    /** Class definitions, of type ClassDef.
-     */
-    public static final int CLASSDEF = IMPORT + 1;
+        /** Class definitions, of type ClassDef.
+         */
+        CLASSDEF,
 
-    /** Method definitions, of type MethodDef.
-     */
-    public static final int METHODDEF = CLASSDEF + 1;
+        /** Method definitions, of type MethodDef.
+         */
+        METHODDEF,
 
-    /** Variable definitions, of type VarDef.
-     */
-    public static final int VARDEF = METHODDEF + 1;
+        /** Variable definitions, of type VarDef.
+         */
+        VARDEF,
 
-    /** The no-op statement ";", of type Skip
-     */
-    public static final int SKIP = VARDEF + 1;
+        /** The no-op statement ";", of type Skip
+         */
+        SKIP,
+
+        /** Blocks, of type Block.
+         */
+        BLOCK,
 
-    /** Blocks, of type Block.
-     */
-    public static final int BLOCK = SKIP + 1;
+        /** Do-while loops, of type DoLoop.
+         */
+        DOLOOP,
 
-    /** Do-while loops, of type DoLoop.
-     */
-    public static final int DOLOOP = BLOCK + 1;
+        /** While-loops, of type WhileLoop.
+         */
+        WHILELOOP,
 
-    /** While-loops, of type WhileLoop.
-     */
-    public static final int WHILELOOP = DOLOOP + 1;
+        /** For-loops, of type ForLoop.
+         */
+        FORLOOP,
 
-    /** For-loops, of type ForLoop.
-     */
-    public static final int FORLOOP = WHILELOOP + 1;
+        /** Foreach-loops, of type ForeachLoop.
+         */
+        FOREACHLOOP,
 
-    /** Foreach-loops, of type ForeachLoop.
-     */
-    public static final int FOREACHLOOP = FORLOOP + 1;
+        /** Labelled statements, of type Labelled.
+         */
+        LABELLED,
 
-    /** Labelled statements, of type Labelled.
-     */
-    public static final int LABELLED = FOREACHLOOP + 1;
+        /** Switch statements, of type Switch.
+         */
+        SWITCH,
 
-    /** Switch statements, of type Switch.
-     */
-    public static final int SWITCH = LABELLED + 1;
+        /** Case parts in switch statements, of type Case.
+         */
+        CASE,
 
-    /** Case parts in switch statements, of type Case.
-     */
-    public static final int CASE = SWITCH + 1;
+        /** Synchronized statements, of type Synchonized.
+         */
+        SYNCHRONIZED,
+
+        /** Try statements, of type Try.
+         */
+        TRY,
 
-    /** Synchronized statements, of type Synchonized.
-     */
-    public static final int SYNCHRONIZED = CASE + 1;
+        /** Catch clauses in try statements, of type Catch.
+         */
+        CATCH,
 
-    /** Try statements, of type Try.
-     */
-    public static final int TRY = SYNCHRONIZED + 1;
+        /** Conditional expressions, of type Conditional.
+         */
+        CONDEXPR,
 
-    /** Catch clauses in try statements, of type Catch.
-     */
-    public static final int CATCH = TRY + 1;
+        /** Conditional statements, of type If.
+         */
+        IF,
 
-    /** Conditional expressions, of type Conditional.
-     */
-    public static final int CONDEXPR = CATCH + 1;
+        /** Expression statements, of type Exec.
+         */
+        EXEC,
 
-    /** Conditional statements, of type If.
-     */
-    public static final int IF = CONDEXPR + 1;
+        /** Break statements, of type Break.
+         */
+        BREAK,
 
-    /** Expression statements, of type Exec.
-     */
-    public static final int EXEC = IF + 1;
+        /** Continue statements, of type Continue.
+         */
+        CONTINUE,
 
-    /** Break statements, of type Break.
-     */
-    public static final int BREAK = EXEC + 1;
+        /** Return statements, of type Return.
+         */
+        RETURN,
 
-    /** Continue statements, of type Continue.
-     */
-    public static final int CONTINUE = BREAK + 1;
+        /** Throw statements, of type Throw.
+         */
+        THROW,
+
+        /** Assert statements, of type Assert.
+         */
+        ASSERT,
 
-    /** Return statements, of type Return.
-     */
-    public static final int RETURN = CONTINUE + 1;
+        /** Method invocation expressions, of type Apply.
+         */
+        APPLY,
 
-    /** Throw statements, of type Throw.
-     */
-    public static final int THROW = RETURN + 1;
+        /** Class instance creation expressions, of type NewClass.
+         */
+        NEWCLASS,
 
-    /** Assert statements, of type Assert.
-     */
-    public static final int ASSERT = THROW + 1;
+        /** Array creation expressions, of type NewArray.
+         */
+        NEWARRAY,
 
-    /** Method invocation expressions, of type Apply.
-     */
-    public static final int APPLY = ASSERT + 1;
+        /** Lambda expression, of type Lambda.
+         */
+        LAMBDA,
+
+        /** Parenthesized subexpressions, of type Parens.
+         */
+        PARENS,
 
-    /** Class instance creation expressions, of type NewClass.
-     */
-    public static final int NEWCLASS = APPLY + 1;
+        /** Assignment expressions, of type Assign.
+         */
+        ASSIGN,
 
-    /** Array creation expressions, of type NewArray.
-     */
-    public static final int NEWARRAY = NEWCLASS + 1;
+        /** Type cast expressions, of type TypeCast.
+         */
+        TYPECAST,
 
-    /** Parenthesized subexpressions, of type Parens.
-     */
-    public static final int PARENS = NEWARRAY + 1;
+        /** Type test expressions, of type TypeTest.
+         */
+        TYPETEST,
 
-    /** Assignment expressions, of type Assign.
-     */
-    public static final int ASSIGN = PARENS + 1;
+        /** Indexed array expressions, of type Indexed.
+         */
+        INDEXED,
+
+        /** Selections, of type Select.
+         */
+        SELECT,
 
-    /** Type cast expressions, of type TypeCast.
-     */
-    public static final int TYPECAST = ASSIGN + 1;
+        /** Member references, of type Reference.
+         */
+        REFERENCE,
+
+        /** Simple identifiers, of type Ident.
+         */
+        IDENT,
 
-    /** Type test expressions, of type TypeTest.
-     */
-    public static final int TYPETEST = TYPECAST + 1;
+        /** Literals, of type Literal.
+         */
+        LITERAL,
 
-    /** Indexed array expressions, of type Indexed.
-     */
-    public static final int INDEXED = TYPETEST + 1;
+        /** Basic type identifiers, of type TypeIdent.
+         */
+        TYPEIDENT,
 
-    /** Selections, of type Select.
-     */
-    public static final int SELECT = INDEXED + 1;
+        /** Array types, of type TypeArray.
+         */
+        TYPEARRAY,
 
-    /** Simple identifiers, of type Ident.
-     */
-    public static final int IDENT = SELECT + 1;
+        /** Parameterized types, of type TypeApply.
+         */
+        TYPEAPPLY,
 
-    /** Literals, of type Literal.
-     */
-    public static final int LITERAL = IDENT + 1;
+        /** Union types, of type TypeUnion
+         */
+        TYPEUNION,
 
-    /** Basic type identifiers, of type TypeIdent.
-     */
-    public static final int TYPEIDENT = LITERAL + 1;
+        /** Formal type parameters, of type TypeParameter.
+         */
+        TYPEPARAMETER,
 
-    /** Array types, of type TypeArray.
-     */
-    public static final int TYPEARRAY = TYPEIDENT + 1;
+        /** Type argument.
+         */
+        WILDCARD,
 
-    /** Parameterized types, of type TypeApply.
-     */
-    public static final int TYPEAPPLY = TYPEARRAY + 1;
+        /** Bound kind: extends, super, exact, or unbound
+         */
+        TYPEBOUNDKIND,
 
-    /** Union types, of type TypeUnion
-     */
-    public static final int TYPEUNION = TYPEAPPLY + 1;
+        /** metadata: Annotation.
+         */
+        ANNOTATION,
 
-    /** Formal type parameters, of type TypeParameter.
-     */
-    public static final int TYPEPARAMETER = TYPEUNION + 1;
+        /** metadata: Modifiers
+         */
+        MODIFIERS,
+
+        ANNOTATED_TYPE,
 
-    /** Type argument.
-     */
-    public static final int WILDCARD = TYPEPARAMETER + 1;
-
-    /** Bound kind: extends, super, exact, or unbound
-     */
-    public static final int TYPEBOUNDKIND = WILDCARD + 1;
+        /** Error trees, of type Erroneous.
+         */
+        ERRONEOUS,
 
-    /** metadata: Annotation.
-     */
-    public static final int ANNOTATION = TYPEBOUNDKIND + 1;
+        /** Unary operators, of type Unary.
+         */
+        POS,                             // +
+        NEG,                             // -
+        NOT,                             // !
+        COMPL,                           // ~
+        PREINC,                          // ++ _
+        PREDEC,                          // -- _
+        POSTINC,                         // _ ++
+        POSTDEC,                         // _ --
 
-    /** metadata: Modifiers
-     */
-    public static final int MODIFIERS = ANNOTATION + 1;
-
-    public static final int ANNOTATED_TYPE = MODIFIERS + 1;
+        /** unary operator for null reference checks, only used internally.
+         */
+        NULLCHK,
 
-    /** Error trees, of type Erroneous.
-     */
-    public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
+        /** Binary operators, of type Binary.
+         */
+        OR,                              // ||
+        AND,                             // &&
+        BITOR,                           // |
+        BITXOR,                          // ^
+        BITAND,                          // &
+        EQ,                              // ==
+        NE,                              // !=
+        LT,                              // <
+        GT,                              // >
+        LE,                              // <=
+        GE,                              // >=
+        SL,                              // <<
+        SR,                              // >>
+        USR,                             // >>>
+        PLUS,                            // +
+        MINUS,                           // -
+        MUL,                             // *
+        DIV,                             // /
+        MOD,                             // %
 
-    /** Unary operators, of type Unary.
-     */
-    public static final int POS = ERRONEOUS + 1;             // +
-    public static final int NEG = POS + 1;                   // -
-    public static final int NOT = NEG + 1;                   // !
-    public static final int COMPL = NOT + 1;                 // ~
-    public static final int PREINC = COMPL + 1;              // ++ _
-    public static final int PREDEC = PREINC + 1;             // -- _
-    public static final int POSTINC = PREDEC + 1;            // _ ++
-    public static final int POSTDEC = POSTINC + 1;           // _ --
+        /** Assignment operators, of type Assignop.
+         */
+        BITOR_ASG(BITOR),                // |=
+        BITXOR_ASG(BITXOR),              // ^=
+        BITAND_ASG(BITAND),              // &=
 
-    /** unary operator for null reference checks, only used internally.
-     */
-    public static final int NULLCHK = POSTDEC + 1;
+        SL_ASG(SL),                      // <<=
+        SR_ASG(SR),                      // >>=
+        USR_ASG(USR),                    // >>>=
+        PLUS_ASG(PLUS),                  // +=
+        MINUS_ASG(MINUS),                // -=
+        MUL_ASG(MUL),                    // *=
+        DIV_ASG(DIV),                    // /=
+        MOD_ASG(MOD),                    // %=
 
-    /** Binary operators, of type Binary.
-     */
-    public static final int OR = NULLCHK + 1;                // ||
-    public static final int AND = OR + 1;                    // &&
-    public static final int BITOR = AND + 1;                 // |
-    public static final int BITXOR = BITOR + 1;              // ^
-    public static final int BITAND = BITXOR + 1;             // &
-    public static final int EQ = BITAND + 1;                 // ==
-    public static final int NE = EQ + 1;                     // !=
-    public static final int LT = NE + 1;                     // <
-    public static final int GT = LT + 1;                     // >
-    public static final int LE = GT + 1;                     // <=
-    public static final int GE = LE + 1;                     // >=
-    public static final int SL = GE + 1;                     // <<
-    public static final int SR = SL + 1;                     // >>
-    public static final int USR = SR + 1;                    // >>>
-    public static final int PLUS = USR + 1;                  // +
-    public static final int MINUS = PLUS + 1;                // -
-    public static final int MUL = MINUS + 1;                 // *
-    public static final int DIV = MUL + 1;                   // /
-    public static final int MOD = DIV + 1;                   // %
+        /** A synthetic let expression, of type LetExpr.
+         */
+        LETEXPR;                         // ala scheme
+
+        private Tag noAssignTag;
+
+        private static int numberOfOperators = MOD.ordinal() - POS.ordinal() + 1;
+
+        private Tag(Tag noAssignTag) {
+            this.noAssignTag = noAssignTag;
+        }
+
+        private Tag() { }
+
+        public static int getNumberOfOperators() {
+            return numberOfOperators;
+        }
 
-    /** Assignment operators, of type Assignop.
-     */
-    public static final int BITOR_ASG = MOD + 1;             // |=
-    public static final int BITXOR_ASG = BITOR_ASG + 1;      // ^=
-    public static final int BITAND_ASG = BITXOR_ASG + 1;     // &=
+        public Tag noAssignOp() {
+            if (noAssignTag != null)
+                return noAssignTag;
+            throw new AssertionError("noAssignOp() method is not available for non assignment tags");
+        }
+
+        public boolean isPostUnaryOp() {
+            return (this == POSTINC || this == POSTDEC);
+        }
 
-    public static final int SL_ASG = SL + BITOR_ASG - BITOR; // <<=
-    public static final int SR_ASG = SL_ASG + 1;             // >>=
-    public static final int USR_ASG = SR_ASG + 1;            // >>>=
-    public static final int PLUS_ASG = USR_ASG + 1;          // +=
-    public static final int MINUS_ASG = PLUS_ASG + 1;        // -=
-    public static final int MUL_ASG = MINUS_ASG + 1;         // *=
-    public static final int DIV_ASG = MUL_ASG + 1;           // /=
-    public static final int MOD_ASG = DIV_ASG + 1;           // %=
+        public boolean isIncOrDecUnaryOp() {
+            return (this == PREINC || this == PREDEC || this == POSTINC || this == POSTDEC);
+        }
 
-    /** A synthetic let expression, of type LetExpr.
-     */
-    public static final int LETEXPR = MOD_ASG + 1;           // ala scheme
+        public boolean isAssignop() {
+            return noAssignTag != null;
+        }
 
-
-    /** The offset between assignment operators and normal operators.
-     */
-    public static final int ASGOffset = BITOR_ASG - BITOR;
+        public int operatorIndex() {
+            return (this.ordinal() - POS.ordinal());
+        }
+    }
 
     /* The (encoded) position in the source file. @see util.Position.
      */
@@ -337,7 +385,13 @@
 
     /* The tag of this node -- one of the constants declared above.
      */
-    public abstract int getTag();
+    public abstract Tag getTag();
+
+    /* Returns true if the tag of this node is equals to tag.
+     */
+    public boolean hasTag(Tag tag) {
+        return tag == getTag();
+    }
 
     /** Convert a tree to a pretty-printed string. */
     @Override
@@ -407,7 +461,7 @@
     }
 
     // for default DiagnosticPosition
-    public int getEndPosition(Map<JCTree, Integer> endPosTable) {
+    public int getEndPosition(EndPosTable endPosTable) {
         return TreeInfo.getEndPos(this, endPosTable);
     }
 
@@ -424,7 +478,7 @@
      * @param docComments      A hashtable that stores all documentation comments
      *                         indexed by the tree nodes they refer to.
      *                         defined only if option -s is set.
-     * @param endPositions     A hashtable that stores ending positions of source
+     * @param endPositions     An object encapsulating ending positions of source
      *                         ranges indexed by the tree nodes they belong to.
      *                         Defined only if option -Xjcov is set.
      */
@@ -436,10 +490,9 @@
         public PackageSymbol packge;
         public ImportScope namedImportScope;
         public StarImportScope starImportScope;
-        public long flags;
         public Position.LineMap lineMap = null;
         public Map<JCTree, String> docComments = null;
-        public Map<JCTree, Integer> endPositions = null;
+        public EndPosTable endPositions = null;
         protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
                         JCExpression pid,
                         List<JCTree> defs,
@@ -465,10 +518,9 @@
         public List<JCImport> getImports() {
             ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
             for (JCTree tree : defs) {
-                int tag = tree.getTag();
-                if (tag == IMPORT)
+                if (tree.hasTag(IMPORT))
                     imports.append((JCImport)tree);
-                else if (tag != SKIP)
+                else if (!tree.hasTag(SKIP))
                     break;
             }
             return imports.toList();
@@ -483,7 +535,7 @@
         public List<JCTree> getTypeDecls() {
             List<JCTree> typeDefs;
             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
-                if (typeDefs.head.getTag() != IMPORT)
+                if (!typeDefs.head.hasTag(IMPORT))
                     break;
             return typeDefs;
         }
@@ -493,7 +545,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TOPLEVEL;
         }
     }
@@ -522,7 +574,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return IMPORT;
         }
     }
@@ -619,7 +671,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return CLASSDEF;
         }
     }
@@ -691,7 +743,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return METHODDEF;
         }
   }
@@ -737,7 +789,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return VARDEF;
         }
     }
@@ -758,7 +810,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return SKIP;
         }
     }
@@ -791,7 +843,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return BLOCK;
         }
     }
@@ -818,7 +870,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return DOLOOP;
         }
     }
@@ -845,7 +897,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return WHILELOOP;
         }
     }
@@ -886,7 +938,7 @@
         }
 
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return FORLOOP;
         }
     }
@@ -915,7 +967,7 @@
             return v.visitEnhancedForLoop(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return FOREACHLOOP;
         }
     }
@@ -940,7 +992,7 @@
             return v.visitLabeledStatement(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return LABELLED;
         }
     }
@@ -966,7 +1018,7 @@
             return v.visitSwitch(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return SWITCH;
         }
     }
@@ -992,7 +1044,7 @@
             return v.visitCase(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return CASE;
         }
     }
@@ -1018,7 +1070,7 @@
             return v.visitSynchronized(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return SYNCHRONIZED;
         }
     }
@@ -1031,6 +1083,7 @@
         public List<JCCatch> catchers;
         public JCBlock finalizer;
         public List<JCTree> resources;
+        public boolean finallyCanCompleteNormally;
         protected JCTry(List<JCTree> resources,
                         JCBlock body,
                         List<JCCatch> catchers,
@@ -1058,7 +1111,7 @@
             return resources;
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TRY;
         }
     }
@@ -1084,7 +1137,7 @@
             return v.visitCatch(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return CATCH;
         }
     }
@@ -1116,7 +1169,7 @@
             return v.visitConditionalExpression(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return CONDEXPR;
         }
     }
@@ -1148,7 +1201,7 @@
             return v.visitIf(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return IF;
         }
     }
@@ -1173,9 +1226,24 @@
             return v.visitExpressionStatement(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return EXEC;
         }
+
+        /** Convert a expression-statement tree to a pretty-printed string. */
+        @Override
+        public String toString() {
+            StringWriter s = new StringWriter();
+            try {
+                new Pretty(s, false).printStat(this);
+            }
+            catch (IOException e) {
+                // should never happen, because StringWriter is defined
+                // never to throw any IOExceptions
+                throw new AssertionError(e);
+            }
+            return s.toString();
+        }
     }
 
     /**
@@ -1198,7 +1266,7 @@
             return v.visitBreak(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return BREAK;
         }
     }
@@ -1223,7 +1291,7 @@
             return v.visitContinue(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return CONTINUE;
         }
     }
@@ -1246,7 +1314,7 @@
             return v.visitReturn(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return RETURN;
         }
     }
@@ -1269,7 +1337,7 @@
             return v.visitThrow(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return THROW;
         }
     }
@@ -1295,7 +1363,7 @@
             return v.visitAssert(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return ASSERT;
         }
     }
@@ -1338,7 +1406,7 @@
             return this;
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return(APPLY);
         }
     }
@@ -1388,7 +1456,7 @@
             return v.visitNewClass(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return NEWCLASS;
         }
     }
@@ -1424,12 +1492,62 @@
             return v.visitNewArray(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return NEWARRAY;
         }
     }
 
     /**
+     * A lambda expression.
+     */
+    public static class JCLambda extends JCExpression implements LambdaExpressionTree {
+
+        public List<JCVariableDecl> params;
+        public JCTree body;
+        public Type targetType;
+        public boolean canCompleteNormally = true;
+        public List<Type> inferredThrownTypes;
+
+        public JCLambda(List<JCVariableDecl> params,
+                        JCTree body) {
+            this.params = params;
+            this.body = body;
+        }
+        @Override
+        public Tag getTag() {
+            return LAMBDA;
+        }
+        @Override
+        public void accept(Visitor v) {
+            v.visitLambda(this);
+        }
+        @Override
+        public <R, D> R accept(TreeVisitor<R, D> v, D d) {
+            return v.visitLambdaExpression(this, d);
+        }
+        public Kind getKind() {
+            return Kind.LAMBDA_EXPRESSION;
+        }
+        public JCTree getBody() {
+            return body;
+        }
+        public java.util.List<? extends VariableTree> getParameters() {
+            return params;
+        }
+        @Override
+        public JCLambda setType(Type type) {
+            super.setType(type);
+            return this;
+        }
+        @Override
+        public BodyKind getBodyKind() {
+            return body.hasTag(BLOCK) ?
+                    BodyKind.STATEMENT :
+                    BodyKind.EXPRESSION;
+        }
+    }
+
+    /**
      * A parenthesized subexpression ( ... )
      */
     public static class JCParens extends JCExpression implements ParenthesizedTree {
@@ -1447,7 +1565,7 @@
             return v.visitParenthesized(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return PARENS;
         }
     }
@@ -1473,7 +1591,7 @@
             return v.visitAssignment(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return ASSIGN;
         }
     }
@@ -1482,11 +1600,11 @@
      * An assignment with "+=", "|=" ...
      */
     public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
-        private int opcode;
+        private Tag opcode;
         public JCExpression lhs;
         public JCExpression rhs;
         public Symbol operator;
-        protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
+        protected JCAssignOp(Tag opcode, JCTree lhs, JCTree rhs, Symbol operator) {
             this.opcode = opcode;
             this.lhs = (JCExpression)lhs;
             this.rhs = (JCExpression)rhs;
@@ -1506,7 +1624,7 @@
             return v.visitCompoundAssignment(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return opcode;
         }
     }
@@ -1515,10 +1633,10 @@
      * A unary operation.
      */
     public static class JCUnary extends JCExpression implements UnaryTree {
-        private int opcode;
+        private Tag opcode;
         public JCExpression arg;
         public Symbol operator;
-        protected JCUnary(int opcode, JCExpression arg) {
+        protected JCUnary(Tag opcode, JCExpression arg) {
             this.opcode = opcode;
             this.arg = arg;
         }
@@ -1535,11 +1653,11 @@
             return v.visitUnary(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return opcode;
         }
 
-        public void setTag(int tag) {
+        public void setTag(Tag tag) {
             opcode = tag;
         }
     }
@@ -1548,11 +1666,11 @@
      * A binary operation.
      */
     public static class JCBinary extends JCExpression implements BinaryTree {
-        private int opcode;
+        private Tag opcode;
         public JCExpression lhs;
         public JCExpression rhs;
         public Symbol operator;
-        protected JCBinary(int opcode,
+        protected JCBinary(Tag opcode,
                          JCExpression lhs,
                          JCExpression rhs,
                          Symbol operator) {
@@ -1575,7 +1693,7 @@
             return v.visitBinary(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return opcode;
         }
     }
@@ -1601,7 +1719,7 @@
             return v.visitTypeCast(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPECAST;
         }
     }
@@ -1627,7 +1745,7 @@
             return v.visitInstanceOf(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPETEST;
         }
     }
@@ -1653,7 +1771,7 @@
             return v.visitArrayAccess(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return INDEXED;
         }
     }
@@ -1684,12 +1802,52 @@
         }
         public Name getIdentifier() { return name; }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return SELECT;
         }
     }
 
     /**
+     * Selects a member expression.
+     */
+    public static class JCMemberReference extends JCExpression implements MemberReferenceTree {
+        public ReferenceMode mode;
+        public Name name;
+        public JCExpression expr;
+        public List<JCExpression> typeargs;
+        public Type targetType;
+        public Symbol sym;
+
+        protected JCMemberReference(ReferenceMode mode, Name name, JCExpression expr, List<JCExpression> typeargs) {
+            this.mode = mode;
+            this.name = name;
+            this.expr = expr;
+            this.typeargs = typeargs;
+        }
+        @Override
+        public void accept(Visitor v) { v.visitReference(this); }
+
+        public Kind getKind() { return Kind.MEMBER_REFERENCE; }
+        @Override
+        public ReferenceMode getMode() { return mode; }
+        @Override
+        public JCExpression getQualifierExpression() { return expr; }
+        @Override
+        public Name getName() { return name; }
+        @Override
+        public List<JCExpression> getTypeArguments() { return typeargs; }
+
+        @Override
+        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
+            return v.visitMemberReference(this, d);
+        }
+        @Override
+        public Tag getTag() {
+            return REFERENCE;
+        }
+    }
+
+    /**
      * An identifier
      * @param idname the name
      * @param sym the symbol
@@ -1710,7 +1868,8 @@
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitIdentifier(this, d);
         }
-        public int getTag() {
+        @Override
+        public Tag getTag() {
             return IDENT;
         }
     }
@@ -1776,7 +1935,7 @@
             return this;
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return LITERAL;
         }
     }
@@ -1824,7 +1983,7 @@
             return v.visitPrimitiveType(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPEIDENT;
         }
     }
@@ -1847,7 +2006,7 @@
             return v.visitArrayType(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPEARRAY;
         }
     }
@@ -1875,7 +2034,7 @@
             return v.visitParameterizedType(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPEAPPLY;
         }
     }
@@ -1903,7 +2062,7 @@
             return v.visitUnionType(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPEUNION;
         }
     }
@@ -1933,7 +2092,7 @@
             return v.visitTypeParameter(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPEPARAMETER;
         }
     }
@@ -1967,7 +2126,7 @@
             return v.visitWildcard(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return WILDCARD;
         }
     }
@@ -1988,7 +2147,7 @@
             throw new AssertionError("TypeBoundKind is not part of a public API");
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return TYPEBOUNDKIND;
         }
     }
@@ -2013,7 +2172,7 @@
             return v.visitAnnotation(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return ANNOTATION;
         }
     }
@@ -2040,7 +2199,7 @@
             return v.visitModifiers(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return MODIFIERS;
         }
     }
@@ -2065,7 +2224,7 @@
             return v.visitErroneous(this, d);
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return ERRONEOUS;
         }
     }
@@ -2089,7 +2248,7 @@
             throw new AssertionError("LetExpr is not part of a public API");
         }
         @Override
-        public int getTag() {
+        public Tag getTag() {
             return LETEXPR;
         }
     }
@@ -2161,9 +2320,9 @@
                           List<JCExpression> elems);
         JCParens Parens(JCExpression expr);
         JCAssign Assign(JCExpression lhs, JCExpression rhs);
-        JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
-        JCUnary Unary(int opcode, JCExpression arg);
-        JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
+        JCAssignOp Assignop(Tag opcode, JCTree lhs, JCTree rhs);
+        JCUnary Unary(Tag opcode, JCExpression arg);
+        JCBinary Binary(Tag opcode, JCExpression lhs, JCExpression rhs);
         JCTypeCast TypeCast(JCTree expr, JCExpression type);
         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
@@ -2213,6 +2372,7 @@
         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
         public void visitNewClass(JCNewClass that)           { visitTree(that); }
         public void visitNewArray(JCNewArray that)           { visitTree(that); }
+        public void visitLambda(JCLambda that)               { visitTree(that); }
         public void visitParens(JCParens that)               { visitTree(that); }
         public void visitAssign(JCAssign that)               { visitTree(that); }
         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
@@ -2222,6 +2382,7 @@
         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
+        public void visitReference(JCMemberReference that)   { visitTree(that); }
         public void visitIdent(JCIdent that)                 { visitTree(that); }
         public void visitLiteral(JCLiteral that)             { visitTree(that); }
         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
--- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Tue May 29 00:27:58 2012 +0100
@@ -28,6 +28,8 @@
 import java.io.*;
 import java.util.*;
 
+import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
+
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.code.*;
@@ -36,6 +38,8 @@
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.ANNOTATION;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /** Prints out a tree as an indented Java source program.
  *
@@ -310,7 +314,7 @@
 
     /** Is the given tree an enumerator definition? */
     boolean isEnumerator(JCTree t) {
-        return t.getTag() == JCTree.VARDEF && (((JCVariableDecl) t).mods.flags & ENUM) != 0;
+        return t.hasTag(VARDEF) && (((JCVariableDecl) t).mods.flags & ENUM) != 0;
     }
 
     /** Print unit consisting of package clause and import statements in toplevel,
@@ -331,9 +335,9 @@
         }
         boolean firstImport = true;
         for (List<JCTree> l = tree.defs;
-        l.nonEmpty() && (cdef == null || l.head.getTag() == JCTree.IMPORT);
+        l.nonEmpty() && (cdef == null || l.head.hasTag(IMPORT));
         l = l.tail) {
-            if (l.head.getTag() == JCTree.IMPORT) {
+            if (l.head.hasTag(IMPORT)) {
                 JCImport imp = (JCImport)l.head;
                 Name name = TreeInfo.name(imp.qualid);
                 if (name == name.table.names.asterisk ||
@@ -484,7 +488,7 @@
                 print("/*public static final*/ ");
                 print(tree.name);
                 if (tree.init != null) {
-                    if (sourceOutput && tree.init.getTag() == JCTree.NEWCLASS) {
+                    if (sourceOutput && tree.init.hasTag(NEWCLASS)) {
                         print(" /*enum*/ ");
                         JCNewClass init = (JCNewClass) tree.init;
                         if (init.args != null && init.args.nonEmpty()) {
@@ -545,7 +549,7 @@
             printStat(tree.body);
             align();
             print(" while ");
-            if (tree.cond.getTag() == JCTree.PARENS) {
+            if (tree.cond.hasTag(PARENS)) {
                 printExpr(tree.cond);
             } else {
                 print("(");
@@ -561,7 +565,7 @@
     public void visitWhileLoop(JCWhileLoop tree) {
         try {
             print("while ");
-            if (tree.cond.getTag() == JCTree.PARENS) {
+            if (tree.cond.hasTag(PARENS)) {
                 printExpr(tree.cond);
             } else {
                 print("(");
@@ -579,7 +583,7 @@
         try {
             print("for (");
             if (tree.init.nonEmpty()) {
-                if (tree.init.head.getTag() == JCTree.VARDEF) {
+                if (tree.init.head.hasTag(VARDEF)) {
                     printExpr(tree.init.head);
                     for (List<JCStatement> l = tree.init.tail; l.nonEmpty(); l = l.tail) {
                         JCVariableDecl vdef = (JCVariableDecl)l.head;
@@ -626,7 +630,7 @@
     public void visitSwitch(JCSwitch tree) {
         try {
             print("switch ");
-            if (tree.selector.getTag() == JCTree.PARENS) {
+            if (tree.selector.hasTag(PARENS)) {
                 printExpr(tree.selector);
             } else {
                 print("(");
@@ -665,7 +669,7 @@
     public void visitSynchronized(JCSynchronized tree) {
         try {
             print("synchronized ");
-            if (tree.lock.getTag() == JCTree.PARENS) {
+            if (tree.lock.hasTag(PARENS)) {
                 printExpr(tree.lock);
             } else {
                 print("(");
@@ -736,7 +740,7 @@
     public void visitIf(JCIf tree) {
         try {
             print("if ");
-            if (tree.cond.getTag() == JCTree.PARENS) {
+            if (tree.cond.hasTag(PARENS)) {
                 printExpr(tree.cond);
             } else {
                 print("(");
@@ -823,7 +827,7 @@
     public void visitApply(JCMethodInvocation tree) {
         try {
             if (!tree.typeargs.isEmpty()) {
-                if (tree.meth.getTag() == JCTree.SELECT) {
+                if (tree.meth.hasTag(SELECT)) {
                     JCFieldAccess left = (JCFieldAccess)tree.meth;
                     printExpr(left.selected);
                     print(".<");
@@ -882,7 +886,7 @@
             if (tree.elemtype != null) {
                 print("new ");
                 JCTree elem = tree.elemtype;
-                if (elem.getTag() == JCTree.TYPEARRAY)
+                if (elem.hasTag(TYPEARRAY))
                     printBaseElementType((JCArrayTypeTree) elem);
                 else
                     printExpr(elem);
@@ -905,6 +909,17 @@
         }
     }
 
+    public void visitLambda(JCLambda tree) {
+        try {
+            print("(");
+            printExprs(tree.params);
+            print(")->");
+            printExpr(tree.body);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
     public void visitParens(JCParens tree) {
         try {
             print("(");
@@ -927,36 +942,36 @@
         }
     }
 
-    public String operatorName(int tag) {
+    public String operatorName(JCTree.Tag tag) {
         switch(tag) {
-            case JCTree.POS:     return "+";
-            case JCTree.NEG:     return "-";
-            case JCTree.NOT:     return "!";
-            case JCTree.COMPL:   return "~";
-            case JCTree.PREINC:  return "++";
-            case JCTree.PREDEC:  return "--";
-            case JCTree.POSTINC: return "++";
-            case JCTree.POSTDEC: return "--";
-            case JCTree.NULLCHK: return "<*nullchk*>";
-            case JCTree.OR:      return "||";
-            case JCTree.AND:     return "&&";
-            case JCTree.EQ:      return "==";
-            case JCTree.NE:      return "!=";
-            case JCTree.LT:      return "<";
-            case JCTree.GT:      return ">";
-            case JCTree.LE:      return "<=";
-            case JCTree.GE:      return ">=";
-            case JCTree.BITOR:   return "|";
-            case JCTree.BITXOR:  return "^";
-            case JCTree.BITAND:  return "&";
-            case JCTree.SL:      return "<<";
-            case JCTree.SR:      return ">>";
-            case JCTree.USR:     return ">>>";
-            case JCTree.PLUS:    return "+";
-            case JCTree.MINUS:   return "-";
-            case JCTree.MUL:     return "*";
-            case JCTree.DIV:     return "/";
-            case JCTree.MOD:     return "%";
+            case POS:     return "+";
+            case NEG:     return "-";
+            case NOT:     return "!";
+            case COMPL:   return "~";
+            case PREINC:  return "++";
+            case PREDEC:  return "--";
+            case POSTINC: return "++";
+            case POSTDEC: return "--";
+            case NULLCHK: return "<*nullchk*>";
+            case OR:      return "||";
+            case AND:     return "&&";
+            case EQ:      return "==";
+            case NE:      return "!=";
+            case LT:      return "<";
+            case GT:      return ">";
+            case LE:      return "<=";
+            case GE:      return ">=";
+            case BITOR:   return "|";
+            case BITXOR:  return "^";
+            case BITAND:  return "&";
+            case SL:      return "<<";
+            case SR:      return ">>";
+            case USR:     return ">>>";
+            case PLUS:    return "+";
+            case MINUS:   return "-";
+            case MUL:     return "*";
+            case DIV:     return "/";
+            case MOD:     return "%";
             default: throw new Error();
         }
     }
@@ -965,7 +980,7 @@
         try {
             open(prec, TreeInfo.assignopPrec);
             printExpr(tree.lhs, TreeInfo.assignopPrec + 1);
-            print(" " + operatorName(tree.getTag() - JCTree.ASGOffset) + "= ");
+            print(" " + operatorName(tree.getTag().noAssignOp()) + "= ");
             printExpr(tree.rhs, TreeInfo.assignopPrec);
             close(prec, TreeInfo.assignopPrec);
         } catch (IOException e) {
@@ -978,7 +993,7 @@
             int ownprec = TreeInfo.opPrec(tree.getTag());
             String opname = operatorName(tree.getTag());
             open(prec, ownprec);
-            if (tree.getTag() <= JCTree.PREDEC) {
+            if (!tree.getTag().isPostUnaryOp()) {
                 print(opname);
                 printExpr(tree.arg, ownprec);
             } else {
@@ -1050,6 +1065,21 @@
         }
     }
 
+    public void visitReference(JCMemberReference tree) {
+        try {
+            printExpr(tree.expr);
+            print("#");
+            if (tree.typeargs != null) {
+                print("<");
+                printExprs(tree.typeargs);
+                print(">");
+            }
+            print(tree.getMode() == ReferenceMode.INVOKE ? tree.name : "new");
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
     public void visitIdent(JCIdent tree) {
         try {
             print(tree.name);
@@ -1153,7 +1183,7 @@
         while (true) {
             elem = tree.elemtype;
             print("[]");
-            if (elem.getTag() != JCTree.TYPEARRAY) break;
+            if (!elem.hasTag(TYPEARRAY)) break;
             tree = (JCArrayTypeTree) elem;
         }
     }
--- a/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Tue May 29 00:27:58 2012 +0100
@@ -271,6 +271,13 @@
         return M.at(t.pos).NewClass(encl, typeargs, clazz, args, def);
     }
 
+    public JCTree visitLambdaExpression(LambdaExpressionTree node, P p) {
+        JCLambda t = (JCLambda) node;
+        List<JCVariableDecl> params = copy(t.params, p);
+        JCTree body = copy(t.body, p);
+        return M.at(t.pos).Lambda(params, body);
+    }
+
     public JCTree visitParenthesized(ParenthesizedTree node, P p) {
         JCParens t = (JCParens) node;
         JCExpression expr = copy(t.expr, p);
@@ -289,6 +296,13 @@
         return M.at(t.pos).Select(selected, t.name);
     }
 
+    public JCTree visitMemberReference(MemberReferenceTree node, P p) {
+        JCMemberReference t = (JCMemberReference) node;
+        JCExpression expr = copy(t.expr, p);
+        List<JCExpression> typeargs = copy(t.typeargs, p);
+        return M.at(t.pos).Reference(t.mode, t.name, expr, typeargs);
+    }
+
     public JCTree visitEmptyStatement(EmptyStatementTree node, P p) {
         JCSkip t = (JCSkip) node;
         return M.at(t.pos).Skip();
@@ -406,7 +420,7 @@
     public JCTree visitOther(Tree node, P p) {
         JCTree tree = (JCTree) node;
         switch (tree.getTag()) {
-            case JCTree.LETEXPR: {
+            case LETEXPR: {
                 LetExpr t = (LetExpr) node;
                 List<JCVariableDecl> defs = copy(t.defs, p);
                 JCTree expr = copy(t.expr, p);
--- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,13 +28,16 @@
 import com.sun.source.tree.Tree;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
-import java.util.Map;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.BLOCK;
+import static com.sun.tools.javac.tree.JCTree.Tag.SYNCHRONIZED;
 
 /** Utility class containing inspector methods for trees.
  *
@@ -56,53 +59,70 @@
 
     /** The names of all operators.
      */
-    private Name[] opname = new Name[JCTree.MOD - JCTree.POS + 1];
+    private Name[] opname = new Name[Tag.getNumberOfOperators()];
+
+    private void setOpname(Tag tag, String name, Names names) {
+         setOpname(tag, names.fromString(name));
+     }
+     private void setOpname(Tag tag, Name name) {
+         opname[tag.operatorIndex()] = name;
+     }
 
     private TreeInfo(Context context) {
         context.put(treeInfoKey, this);
 
         Names names = Names.instance(context);
-        opname[JCTree.POS     - JCTree.POS] = names.fromString("+");
-        opname[JCTree.NEG     - JCTree.POS] = names.hyphen;
-        opname[JCTree.NOT     - JCTree.POS] = names.fromString("!");
-        opname[JCTree.COMPL   - JCTree.POS] = names.fromString("~");
-        opname[JCTree.PREINC  - JCTree.POS] = names.fromString("++");
-        opname[JCTree.PREDEC  - JCTree.POS] = names.fromString("--");
-        opname[JCTree.POSTINC - JCTree.POS] = names.fromString("++");
-        opname[JCTree.POSTDEC - JCTree.POS] = names.fromString("--");
-        opname[JCTree.NULLCHK - JCTree.POS] = names.fromString("<*nullchk*>");
-        opname[JCTree.OR      - JCTree.POS] = names.fromString("||");
-        opname[JCTree.AND     - JCTree.POS] = names.fromString("&&");
-        opname[JCTree.EQ      - JCTree.POS] = names.fromString("==");
-        opname[JCTree.NE      - JCTree.POS] = names.fromString("!=");
-        opname[JCTree.LT      - JCTree.POS] = names.fromString("<");
-        opname[JCTree.GT      - JCTree.POS] = names.fromString(">");
-        opname[JCTree.LE      - JCTree.POS] = names.fromString("<=");
-        opname[JCTree.GE      - JCTree.POS] = names.fromString(">=");
-        opname[JCTree.BITOR   - JCTree.POS] = names.fromString("|");
-        opname[JCTree.BITXOR  - JCTree.POS] = names.fromString("^");
-        opname[JCTree.BITAND  - JCTree.POS] = names.fromString("&");
-        opname[JCTree.SL      - JCTree.POS] = names.fromString("<<");
-        opname[JCTree.SR      - JCTree.POS] = names.fromString(">>");
-        opname[JCTree.USR     - JCTree.POS] = names.fromString(">>>");
-        opname[JCTree.PLUS    - JCTree.POS] = names.fromString("+");
-        opname[JCTree.MINUS   - JCTree.POS] = names.hyphen;
-        opname[JCTree.MUL     - JCTree.POS] = names.asterisk;
-        opname[JCTree.DIV     - JCTree.POS] = names.slash;
-        opname[JCTree.MOD     - JCTree.POS] = names.fromString("%");
+        setOpname(POS, "+", names);
+        setOpname(NEG, names.hyphen);
+        setOpname(NOT, "!", names);
+        setOpname(COMPL, "~", names);
+        setOpname(PREINC, "++", names);
+        setOpname(PREDEC, "--", names);
+        setOpname(POSTINC, "++", names);
+        setOpname(POSTDEC, "--", names);
+        setOpname(NULLCHK, "<*nullchk*>", names);
+        setOpname(OR, "||", names);
+        setOpname(AND, "&&", names);
+        setOpname(EQ, "==", names);
+        setOpname(NE, "!=", names);
+        setOpname(LT, "<", names);
+        setOpname(GT, ">", names);
+        setOpname(LE, "<=", names);
+        setOpname(GE, ">=", names);
+        setOpname(BITOR, "|", names);
+        setOpname(BITXOR, "^", names);
+        setOpname(BITAND, "&", names);
+        setOpname(SL, "<<", names);
+        setOpname(SR, ">>", names);
+        setOpname(USR, ">>>", names);
+        setOpname(PLUS, "+", names);
+        setOpname(MINUS, names.hyphen);
+        setOpname(MUL, names.asterisk);
+        setOpname(DIV, names.slash);
+        setOpname(MOD, "%", names);
     }
 
+    public static List<JCExpression> args(JCTree t) {
+        switch (t.getTag()) {
+            case APPLY:
+                return ((JCMethodInvocation)t).args;
+            case NEWCLASS:
+                return ((JCNewClass)t).args;
+            default:
+                return null;
+        }
+    }
 
     /** Return name of operator with given tree tag.
      */
-    public Name operatorName(int tag) {
-        return opname[tag - JCTree.POS];
+    public Name operatorName(JCTree.Tag tag) {
+        return opname[tag.operatorIndex()];
     }
 
     /** Is tree a constructor declaration?
      */
     public static boolean isConstructor(JCTree tree) {
-        if (tree.getTag() == JCTree.METHODDEF) {
+        if (tree.hasTag(METHODDEF)) {
             Name name = ((JCMethodDecl) tree).name;
             return name == name.table.names.init;
         } else {
@@ -119,17 +139,17 @@
     }
 
     public static boolean isMultiCatch(JCCatch catchClause) {
-        return catchClause.param.vartype.getTag() == JCTree.TYPEUNION;
+        return catchClause.param.vartype.hasTag(TYPEUNION);
     }
 
     /** Is statement an initializer for a synthetic field?
      */
     public static boolean isSyntheticInit(JCTree stat) {
-        if (stat.getTag() == JCTree.EXEC) {
+        if (stat.hasTag(EXEC)) {
             JCExpressionStatement exec = (JCExpressionStatement)stat;
-            if (exec.expr.getTag() == JCTree.ASSIGN) {
+            if (exec.expr.hasTag(ASSIGN)) {
                 JCAssign assign = (JCAssign)exec.expr;
-                if (assign.lhs.getTag() == JCTree.SELECT) {
+                if (assign.lhs.hasTag(SELECT)) {
                     JCFieldAccess select = (JCFieldAccess)assign.lhs;
                     if (select.sym != null &&
                         (select.sym.flags() & SYNTHETIC) != 0) {
@@ -146,9 +166,9 @@
     /** If the expression is a method call, return the method name, null
      *  otherwise. */
     public static Name calledMethodName(JCTree tree) {
-        if (tree.getTag() == JCTree.EXEC) {
+        if (tree.hasTag(EXEC)) {
             JCExpressionStatement exec = (JCExpressionStatement)tree;
-            if (exec.expr.getTag() == JCTree.APPLY) {
+            if (exec.expr.hasTag(APPLY)) {
                 Name mname = TreeInfo.name(((JCMethodInvocation) exec.expr).meth);
                 return mname;
             }
@@ -192,7 +212,7 @@
 
     /** Return the first call in a constructor definition. */
     public static JCMethodInvocation firstConstructorCall(JCTree tree) {
-        if (tree.getTag() != JCTree.METHODDEF) return null;
+        if (!tree.hasTag(METHODDEF)) return null;
         JCMethodDecl md = (JCMethodDecl) tree;
         Names names = md.name.table.names;
         if (md.name != names.init) return null;
@@ -202,24 +222,52 @@
         while (stats.nonEmpty() && isSyntheticInit(stats.head))
             stats = stats.tail;
         if (stats.isEmpty()) return null;
-        if (stats.head.getTag() != JCTree.EXEC) return null;
+        if (!stats.head.hasTag(EXEC)) return null;
         JCExpressionStatement exec = (JCExpressionStatement) stats.head;
-        if (exec.expr.getTag() != JCTree.APPLY) return null;
+        if (!exec.expr.hasTag(APPLY)) return null;
         return (JCMethodInvocation)exec.expr;
     }
 
     /** Return true if a tree represents a diamond new expr. */
     public static boolean isDiamond(JCTree tree) {
         switch(tree.getTag()) {
-            case JCTree.TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty();
-            case JCTree.NEWCLASS: return isDiamond(((JCNewClass)tree).clazz);
+            case TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty();
+            case NEWCLASS: return isDiamond(((JCNewClass)tree).clazz);
             default: return false;
         }
     }
 
+    /**
+     * Return true if the AST corresponds to a static select of the kind A.B
+     */
+    public static boolean isStaticSelector(JCTree base, Names names) {
+        if (base == null)
+            return false;
+        switch (base.getTag()) {
+            case IDENT:
+                JCIdent id = (JCIdent)base;
+                return id.name != names._this &&
+                        id.name != names._super &&
+                        isStaticSym(base);
+            case SELECT:
+                return isStaticSym(base) &&
+                    isStaticSelector(((JCFieldAccess)base).selected, names);
+            case TYPEAPPLY:
+                return true;
+            default:
+                return false;
+        }
+    }
+    //where
+        private static boolean isStaticSym(JCTree tree) {
+            Symbol sym = symbol(tree);
+            return (sym.kind == Kinds.TYP ||
+                    sym.kind == Kinds.PCK);
+        }
+
     /** Return true if a tree represents the null literal. */
     public static boolean isNull(JCTree tree) {
-        if (tree.getTag() != JCTree.LITERAL)
+        if (!tree.hasTag(LITERAL))
             return false;
         JCLiteral lit = (JCLiteral) tree;
         return (lit.typetag == TypeTags.BOT);
@@ -229,7 +277,7 @@
      *  the block itself if it is empty.
      */
     public static int firstStatPos(JCTree tree) {
-        if (tree.getTag() == JCTree.BLOCK && ((JCBlock) tree).stats.nonEmpty())
+        if (tree.hasTag(BLOCK) && ((JCBlock) tree).stats.nonEmpty())
             return ((JCBlock) tree).stats.head.pos;
         else
             return tree.pos;
@@ -239,11 +287,11 @@
      *  defined endpos.
      */
     public static int endPos(JCTree tree) {
-        if (tree.getTag() == JCTree.BLOCK && ((JCBlock) tree).endpos != Position.NOPOS)
+        if (tree.hasTag(BLOCK) && ((JCBlock) tree).endpos != Position.NOPOS)
             return ((JCBlock) tree).endpos;
-        else if (tree.getTag() == JCTree.SYNCHRONIZED)
+        else if (tree.hasTag(SYNCHRONIZED))
             return endPos(((JCSynchronized) tree).body);
-        else if (tree.getTag() == JCTree.TRY) {
+        else if (tree.hasTag(TRY)) {
             JCTry t = (JCTry) tree;
             return endPos((t.finalizer != null)
                           ? t.finalizer
@@ -263,162 +311,162 @@
             return Position.NOPOS;
 
         switch(tree.getTag()) {
-        case(JCTree.APPLY):
-            return getStartPos(((JCMethodInvocation) tree).meth);
-        case(JCTree.ASSIGN):
-            return getStartPos(((JCAssign) tree).lhs);
-        case(JCTree.BITOR_ASG): case(JCTree.BITXOR_ASG): case(JCTree.BITAND_ASG):
-        case(JCTree.SL_ASG): case(JCTree.SR_ASG): case(JCTree.USR_ASG):
-        case(JCTree.PLUS_ASG): case(JCTree.MINUS_ASG): case(JCTree.MUL_ASG):
-        case(JCTree.DIV_ASG): case(JCTree.MOD_ASG):
-            return getStartPos(((JCAssignOp) tree).lhs);
-        case(JCTree.OR): case(JCTree.AND): case(JCTree.BITOR):
-        case(JCTree.BITXOR): case(JCTree.BITAND): case(JCTree.EQ):
-        case(JCTree.NE): case(JCTree.LT): case(JCTree.GT):
-        case(JCTree.LE): case(JCTree.GE): case(JCTree.SL):
-        case(JCTree.SR): case(JCTree.USR): case(JCTree.PLUS):
-        case(JCTree.MINUS): case(JCTree.MUL): case(JCTree.DIV):
-        case(JCTree.MOD):
-            return getStartPos(((JCBinary) tree).lhs);
-        case(JCTree.CLASSDEF): {
-            JCClassDecl node = (JCClassDecl)tree;
-            if (node.mods.pos != Position.NOPOS)
-                return node.mods.pos;
-            break;
-        }
-        case(JCTree.CONDEXPR):
-            return getStartPos(((JCConditional) tree).cond);
-        case(JCTree.EXEC):
-            return getStartPos(((JCExpressionStatement) tree).expr);
-        case(JCTree.INDEXED):
-            return getStartPos(((JCArrayAccess) tree).indexed);
-        case(JCTree.METHODDEF): {
-            JCMethodDecl node = (JCMethodDecl)tree;
-            if (node.mods.pos != Position.NOPOS)
-                return node.mods.pos;
-            if (node.typarams.nonEmpty()) // List.nil() used for no typarams
-                return getStartPos(node.typarams.head);
-            return node.restype == null ? node.pos : getStartPos(node.restype);
-        }
-        case(JCTree.SELECT):
-            return getStartPos(((JCFieldAccess) tree).selected);
-        case(JCTree.TYPEAPPLY):
-            return getStartPos(((JCTypeApply) tree).clazz);
-        case(JCTree.TYPEARRAY):
-            return getStartPos(((JCArrayTypeTree) tree).elemtype);
-        case(JCTree.TYPETEST):
-            return getStartPos(((JCInstanceOf) tree).expr);
-        case(JCTree.POSTINC):
-        case(JCTree.POSTDEC):
-            return getStartPos(((JCUnary) tree).arg);
-        case(JCTree.NEWCLASS): {
-            JCNewClass node = (JCNewClass)tree;
-            if (node.encl != null)
-                return getStartPos(node.encl);
-            break;
-        }
-        case(JCTree.VARDEF): {
-            JCVariableDecl node = (JCVariableDecl)tree;
-            if (node.mods.pos != Position.NOPOS) {
-                return node.mods.pos;
-            } else {
-                return getStartPos(node.vartype);
+            case APPLY:
+                return getStartPos(((JCMethodInvocation) tree).meth);
+            case ASSIGN:
+                return getStartPos(((JCAssign) tree).lhs);
+            case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG:
+            case SL_ASG: case SR_ASG: case USR_ASG:
+            case PLUS_ASG: case MINUS_ASG: case MUL_ASG:
+            case DIV_ASG: case MOD_ASG:
+                return getStartPos(((JCAssignOp) tree).lhs);
+            case OR: case AND: case BITOR:
+            case BITXOR: case BITAND: case EQ:
+            case NE: case LT: case GT:
+            case LE: case GE: case SL:
+            case SR: case USR: case PLUS:
+            case MINUS: case MUL: case DIV:
+            case MOD:
+                return getStartPos(((JCBinary) tree).lhs);
+            case CLASSDEF: {
+                JCClassDecl node = (JCClassDecl)tree;
+                if (node.mods.pos != Position.NOPOS)
+                    return node.mods.pos;
+                break;
             }
-        }
-        case(JCTree.ERRONEOUS): {
-            JCErroneous node = (JCErroneous)tree;
-            if (node.errs != null && node.errs.nonEmpty())
-                return getStartPos(node.errs.head);
-        }
+            case CONDEXPR:
+                return getStartPos(((JCConditional) tree).cond);
+            case EXEC:
+                return getStartPos(((JCExpressionStatement) tree).expr);
+            case INDEXED:
+                return getStartPos(((JCArrayAccess) tree).indexed);
+            case METHODDEF: {
+                JCMethodDecl node = (JCMethodDecl)tree;
+                if (node.mods.pos != Position.NOPOS)
+                    return node.mods.pos;
+                if (node.typarams.nonEmpty()) // List.nil() used for no typarams
+                    return getStartPos(node.typarams.head);
+                return node.restype == null ? node.pos : getStartPos(node.restype);
+            }
+            case SELECT:
+                return getStartPos(((JCFieldAccess) tree).selected);
+            case TYPEAPPLY:
+                return getStartPos(((JCTypeApply) tree).clazz);
+            case TYPEARRAY:
+                return getStartPos(((JCArrayTypeTree) tree).elemtype);
+            case TYPETEST:
+                return getStartPos(((JCInstanceOf) tree).expr);
+            case POSTINC:
+            case POSTDEC:
+                return getStartPos(((JCUnary) tree).arg);
+            case NEWCLASS: {
+                JCNewClass node = (JCNewClass)tree;
+                if (node.encl != null)
+                    return getStartPos(node.encl);
+                break;
+            }
+            case VARDEF: {
+                JCVariableDecl node = (JCVariableDecl)tree;
+                if (node.mods.pos != Position.NOPOS) {
+                    return node.mods.pos;
+                } else {
+                    return getStartPos(node.vartype);
+                }
+            }
+            case ERRONEOUS: {
+                JCErroneous node = (JCErroneous)tree;
+                if (node.errs != null && node.errs.nonEmpty())
+                    return getStartPos(node.errs.head);
+            }
         }
         return tree.pos;
     }
 
     /** The end position of given tree, given  a table of end positions generated by the parser
      */
-    public static int getEndPos(JCTree tree, Map<JCTree, Integer> endPositions) {
+    public static int getEndPos(JCTree tree, EndPosTable endPosTable) {
         if (tree == null)
             return Position.NOPOS;
 
-        if (endPositions == null) {
+        if (endPosTable == null) {
             // fall back on limited info in the tree
             return endPos(tree);
         }
 
-        Integer mapPos = endPositions.get(tree);
-        if (mapPos != null)
+        int mapPos = endPosTable.getEndPos(tree);
+        if (mapPos != Position.NOPOS)
             return mapPos;
 
         switch(tree.getTag()) {
-        case(JCTree.BITOR_ASG): case(JCTree.BITXOR_ASG): case(JCTree.BITAND_ASG):
-        case(JCTree.SL_ASG): case(JCTree.SR_ASG): case(JCTree.USR_ASG):
-        case(JCTree.PLUS_ASG): case(JCTree.MINUS_ASG): case(JCTree.MUL_ASG):
-        case(JCTree.DIV_ASG): case(JCTree.MOD_ASG):
-            return getEndPos(((JCAssignOp) tree).rhs, endPositions);
-        case(JCTree.OR): case(JCTree.AND): case(JCTree.BITOR):
-        case(JCTree.BITXOR): case(JCTree.BITAND): case(JCTree.EQ):
-        case(JCTree.NE): case(JCTree.LT): case(JCTree.GT):
-        case(JCTree.LE): case(JCTree.GE): case(JCTree.SL):
-        case(JCTree.SR): case(JCTree.USR): case(JCTree.PLUS):
-        case(JCTree.MINUS): case(JCTree.MUL): case(JCTree.DIV):
-        case(JCTree.MOD):
-            return getEndPos(((JCBinary) tree).rhs, endPositions);
-        case(JCTree.CASE):
-            return getEndPos(((JCCase) tree).stats.last(), endPositions);
-        case(JCTree.CATCH):
-            return getEndPos(((JCCatch) tree).body, endPositions);
-        case(JCTree.CONDEXPR):
-            return getEndPos(((JCConditional) tree).falsepart, endPositions);
-        case(JCTree.FORLOOP):
-            return getEndPos(((JCForLoop) tree).body, endPositions);
-        case(JCTree.FOREACHLOOP):
-            return getEndPos(((JCEnhancedForLoop) tree).body, endPositions);
-        case(JCTree.IF): {
-            JCIf node = (JCIf)tree;
-            if (node.elsepart == null) {
-                return getEndPos(node.thenpart, endPositions);
-            } else {
-                return getEndPos(node.elsepart, endPositions);
+            case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG:
+            case SL_ASG: case SR_ASG: case USR_ASG:
+            case PLUS_ASG: case MINUS_ASG: case MUL_ASG:
+            case DIV_ASG: case MOD_ASG:
+                return getEndPos(((JCAssignOp) tree).rhs, endPosTable);
+            case OR: case AND: case BITOR:
+            case BITXOR: case BITAND: case EQ:
+            case NE: case LT: case GT:
+            case LE: case GE: case SL:
+            case SR: case USR: case PLUS:
+            case MINUS: case MUL: case DIV:
+            case MOD:
+                return getEndPos(((JCBinary) tree).rhs, endPosTable);
+            case CASE:
+                return getEndPos(((JCCase) tree).stats.last(), endPosTable);
+            case CATCH:
+                return getEndPos(((JCCatch) tree).body, endPosTable);
+            case CONDEXPR:
+                return getEndPos(((JCConditional) tree).falsepart, endPosTable);
+            case FORLOOP:
+                return getEndPos(((JCForLoop) tree).body, endPosTable);
+            case FOREACHLOOP:
+                return getEndPos(((JCEnhancedForLoop) tree).body, endPosTable);
+            case IF: {
+                JCIf node = (JCIf)tree;
+                if (node.elsepart == null) {
+                    return getEndPos(node.thenpart, endPosTable);
+                } else {
+                    return getEndPos(node.elsepart, endPosTable);
+                }
             }
-        }
-        case(JCTree.LABELLED):
-            return getEndPos(((JCLabeledStatement) tree).body, endPositions);
-        case(JCTree.MODIFIERS):
-            return getEndPos(((JCModifiers) tree).annotations.last(), endPositions);
-        case(JCTree.SYNCHRONIZED):
-            return getEndPos(((JCSynchronized) tree).body, endPositions);
-        case(JCTree.TOPLEVEL):
-            return getEndPos(((JCCompilationUnit) tree).defs.last(), endPositions);
-        case(JCTree.TRY): {
-            JCTry node = (JCTry)tree;
-            if (node.finalizer != null) {
-                return getEndPos(node.finalizer, endPositions);
-            } else if (!node.catchers.isEmpty()) {
-                return getEndPos(node.catchers.last(), endPositions);
-            } else {
-                return getEndPos(node.body, endPositions);
+            case LABELLED:
+                return getEndPos(((JCLabeledStatement) tree).body, endPosTable);
+            case MODIFIERS:
+                return getEndPos(((JCModifiers) tree).annotations.last(), endPosTable);
+            case SYNCHRONIZED:
+                return getEndPos(((JCSynchronized) tree).body, endPosTable);
+            case TOPLEVEL:
+                return getEndPos(((JCCompilationUnit) tree).defs.last(), endPosTable);
+            case TRY: {
+                JCTry node = (JCTry)tree;
+                if (node.finalizer != null) {
+                    return getEndPos(node.finalizer, endPosTable);
+                } else if (!node.catchers.isEmpty()) {
+                    return getEndPos(node.catchers.last(), endPosTable);
+                } else {
+                    return getEndPos(node.body, endPosTable);
+                }
             }
-        }
-        case(JCTree.WILDCARD):
-            return getEndPos(((JCWildcard) tree).inner, endPositions);
-        case(JCTree.TYPECAST):
-            return getEndPos(((JCTypeCast) tree).expr, endPositions);
-        case(JCTree.TYPETEST):
-            return getEndPos(((JCInstanceOf) tree).clazz, endPositions);
-        case(JCTree.POS):
-        case(JCTree.NEG):
-        case(JCTree.NOT):
-        case(JCTree.COMPL):
-        case(JCTree.PREINC):
-        case(JCTree.PREDEC):
-            return getEndPos(((JCUnary) tree).arg, endPositions);
-        case(JCTree.WHILELOOP):
-            return getEndPos(((JCWhileLoop) tree).body, endPositions);
-        case(JCTree.ERRONEOUS): {
-            JCErroneous node = (JCErroneous)tree;
-            if (node.errs != null && node.errs.nonEmpty())
-                return getEndPos(node.errs.last(), endPositions);
-        }
+            case WILDCARD:
+                return getEndPos(((JCWildcard) tree).inner, endPosTable);
+            case TYPECAST:
+                return getEndPos(((JCTypeCast) tree).expr, endPosTable);
+            case TYPETEST:
+                return getEndPos(((JCInstanceOf) tree).clazz, endPosTable);
+            case POS:
+            case NEG:
+            case NOT:
+            case COMPL:
+            case PREINC:
+            case PREDEC:
+                return getEndPos(((JCUnary) tree).arg, endPosTable);
+            case WHILELOOP:
+                return getEndPos(((JCWhileLoop) tree).body, endPosTable);
+            case ERRONEOUS: {
+                JCErroneous node = (JCErroneous)tree;
+                if (node.errs != null && node.errs.nonEmpty())
+                    return getEndPos(node.errs.last(), endPosTable);
+            }
         }
         return Position.NOPOS;
     }
@@ -434,7 +482,7 @@
             public JCTree getTree() { return tree; }
             public int getStartPosition() { return TreeInfo.getStartPos(tree); }
             public int getPreferredPosition() { return endPos; }
-            public int getEndPosition(Map<JCTree, Integer> endPosTable) {
+            public int getEndPosition(EndPosTable endPosTable) {
                 return TreeInfo.getEndPos(tree, endPosTable);
             }
         };
@@ -443,11 +491,11 @@
     /** The position of the finalizer of given try/synchronized statement.
      */
     public static int finalizerPos(JCTree tree) {
-        if (tree.getTag() == JCTree.TRY) {
+        if (tree.hasTag(TRY)) {
             JCTry t = (JCTry) tree;
             Assert.checkNonNull(t.finalizer);
             return firstStatPos(t.finalizer);
-        } else if (tree.getTag() == JCTree.SYNCHRONIZED) {
+        } else if (tree.hasTag(SYNCHRONIZED)) {
             return endPos(((JCSynchronized) tree).body);
         } else {
             throw new AssertionError();
@@ -547,9 +595,9 @@
     public static JCTree referencedStatement(JCLabeledStatement tree) {
         JCTree t = tree;
         do t = ((JCLabeledStatement) t).body;
-        while (t.getTag() == JCTree.LABELLED);
+        while (t.hasTag(LABELLED));
         switch (t.getTag()) {
-        case JCTree.DOLOOP: case JCTree.WHILELOOP: case JCTree.FORLOOP: case JCTree.FOREACHLOOP: case JCTree.SWITCH:
+        case DOLOOP: case WHILELOOP: case FORLOOP: case FOREACHLOOP: case SWITCH:
             return t;
         default:
             return tree;
@@ -559,7 +607,7 @@
     /** Skip parens and return the enclosed expression
      */
     public static JCExpression skipParens(JCExpression tree) {
-        while (tree.getTag() == JCTree.PARENS) {
+        while (tree.hasTag(PARENS)) {
             tree = ((JCParens) tree).expr;
         }
         return tree;
@@ -568,7 +616,7 @@
     /** Skip parens and return the enclosed expression
      */
     public static JCTree skipParens(JCTree tree) {
-        if (tree.getTag() == JCTree.PARENS)
+        if (tree.hasTag(PARENS))
             return skipParens((JCParens)tree);
         else
             return tree;
@@ -588,11 +636,11 @@
      */
     public static Name name(JCTree tree) {
         switch (tree.getTag()) {
-        case JCTree.IDENT:
+        case IDENT:
             return ((JCIdent) tree).name;
-        case JCTree.SELECT:
+        case SELECT:
             return ((JCFieldAccess) tree).name;
-        case JCTree.TYPEAPPLY:
+        case TYPEAPPLY:
             return name(((JCTypeApply) tree).clazz);
         default:
             return null;
@@ -605,9 +653,9 @@
     public static Name fullName(JCTree tree) {
         tree = skipParens(tree);
         switch (tree.getTag()) {
-        case JCTree.IDENT:
+        case IDENT:
             return ((JCIdent) tree).name;
-        case JCTree.SELECT:
+        case SELECT:
             Name sname = fullName(((JCFieldAccess) tree).selected);
             return sname == null ? null : sname.append('.', name(tree));
         default:
@@ -618,11 +666,11 @@
     public static Symbol symbolFor(JCTree node) {
         node = skipParens(node);
         switch (node.getTag()) {
-        case JCTree.CLASSDEF:
+        case CLASSDEF:
             return ((JCClassDecl) node).sym;
-        case JCTree.METHODDEF:
+        case METHODDEF:
             return ((JCMethodDecl) node).sym;
-        case JCTree.VARDEF:
+        case VARDEF:
             return ((JCVariableDecl) node).sym;
         default:
             return null;
@@ -632,9 +680,9 @@
     public static boolean isDeclaration(JCTree node) {
         node = skipParens(node);
         switch (node.getTag()) {
-        case JCTree.CLASSDEF:
-        case JCTree.METHODDEF:
-        case JCTree.VARDEF:
+        case CLASSDEF:
+        case METHODDEF:
+        case VARDEF:
             return true;
         default:
             return false;
@@ -647,11 +695,11 @@
     public static Symbol symbol(JCTree tree) {
         tree = skipParens(tree);
         switch (tree.getTag()) {
-        case JCTree.IDENT:
+        case IDENT:
             return ((JCIdent) tree).sym;
-        case JCTree.SELECT:
+        case SELECT:
             return ((JCFieldAccess) tree).sym;
-        case JCTree.TYPEAPPLY:
+        case TYPEAPPLY:
             return symbol(((JCTypeApply) tree).clazz);
         default:
             return null;
@@ -661,7 +709,7 @@
     /** Return true if this is a nonstatic selection. */
     public static boolean nonstaticSelect(JCTree tree) {
         tree = skipParens(tree);
-        if (tree.getTag() != JCTree.SELECT) return false;
+        if (!tree.hasTag(SELECT)) return false;
         JCFieldAccess s = (JCFieldAccess) tree;
         Symbol e = symbol(s.selected);
         return e == null || (e.kind != Kinds.PCK && e.kind != Kinds.TYP);
@@ -672,9 +720,9 @@
     public static void setSymbol(JCTree tree, Symbol sym) {
         tree = skipParens(tree);
         switch (tree.getTag()) {
-        case JCTree.IDENT:
+        case IDENT:
             ((JCIdent) tree).sym = sym; break;
-        case JCTree.SELECT:
+        case SELECT:
             ((JCFieldAccess) tree).sym = sym; break;
         default:
         }
@@ -685,13 +733,13 @@
      */
     public static long flags(JCTree tree) {
         switch (tree.getTag()) {
-        case JCTree.VARDEF:
+        case VARDEF:
             return ((JCVariableDecl) tree).mods.flags;
-        case JCTree.METHODDEF:
+        case METHODDEF:
             return ((JCMethodDecl) tree).mods.flags;
-        case JCTree.CLASSDEF:
+        case CLASSDEF:
             return ((JCClassDecl) tree).mods.flags;
-        case JCTree.BLOCK:
+        case BLOCK:
             return ((JCBlock) tree).flags;
         default:
             return 0;
@@ -739,155 +787,155 @@
 
     /** Map operators to their precedence levels.
      */
-    public static int opPrec(int op) {
+    public static int opPrec(JCTree.Tag op) {
         switch(op) {
-        case JCTree.POS:
-        case JCTree.NEG:
-        case JCTree.NOT:
-        case JCTree.COMPL:
-        case JCTree.PREINC:
-        case JCTree.PREDEC: return prefixPrec;
-        case JCTree.POSTINC:
-        case JCTree.POSTDEC:
-        case JCTree.NULLCHK: return postfixPrec;
-        case JCTree.ASSIGN: return assignPrec;
-        case JCTree.BITOR_ASG:
-        case JCTree.BITXOR_ASG:
-        case JCTree.BITAND_ASG:
-        case JCTree.SL_ASG:
-        case JCTree.SR_ASG:
-        case JCTree.USR_ASG:
-        case JCTree.PLUS_ASG:
-        case JCTree.MINUS_ASG:
-        case JCTree.MUL_ASG:
-        case JCTree.DIV_ASG:
-        case JCTree.MOD_ASG: return assignopPrec;
-        case JCTree.OR: return orPrec;
-        case JCTree.AND: return andPrec;
-        case JCTree.EQ:
-        case JCTree.NE: return eqPrec;
-        case JCTree.LT:
-        case JCTree.GT:
-        case JCTree.LE:
-        case JCTree.GE: return ordPrec;
-        case JCTree.BITOR: return bitorPrec;
-        case JCTree.BITXOR: return bitxorPrec;
-        case JCTree.BITAND: return bitandPrec;
-        case JCTree.SL:
-        case JCTree.SR:
-        case JCTree.USR: return shiftPrec;
-        case JCTree.PLUS:
-        case JCTree.MINUS: return addPrec;
-        case JCTree.MUL:
-        case JCTree.DIV:
-        case JCTree.MOD: return mulPrec;
-        case JCTree.TYPETEST: return ordPrec;
+        case POS:
+        case NEG:
+        case NOT:
+        case COMPL:
+        case PREINC:
+        case PREDEC: return prefixPrec;
+        case POSTINC:
+        case POSTDEC:
+        case NULLCHK: return postfixPrec;
+        case ASSIGN: return assignPrec;
+        case BITOR_ASG:
+        case BITXOR_ASG:
+        case BITAND_ASG:
+        case SL_ASG:
+        case SR_ASG:
+        case USR_ASG:
+        case PLUS_ASG:
+        case MINUS_ASG:
+        case MUL_ASG:
+        case DIV_ASG:
+        case MOD_ASG: return assignopPrec;
+        case OR: return orPrec;
+        case AND: return andPrec;
+        case EQ:
+        case NE: return eqPrec;
+        case LT:
+        case GT:
+        case LE:
+        case GE: return ordPrec;
+        case BITOR: return bitorPrec;
+        case BITXOR: return bitxorPrec;
+        case BITAND: return bitandPrec;
+        case SL:
+        case SR:
+        case USR: return shiftPrec;
+        case PLUS:
+        case MINUS: return addPrec;
+        case MUL:
+        case DIV:
+        case MOD: return mulPrec;
+        case TYPETEST: return ordPrec;
         default: throw new AssertionError();
         }
     }
 
-    static Tree.Kind tagToKind(int tag) {
+    static Tree.Kind tagToKind(JCTree.Tag tag) {
         switch (tag) {
         // Postfix expressions
-        case JCTree.POSTINC:           // _ ++
+        case POSTINC:           // _ ++
             return Tree.Kind.POSTFIX_INCREMENT;
-        case JCTree.POSTDEC:           // _ --
+        case POSTDEC:           // _ --
             return Tree.Kind.POSTFIX_DECREMENT;
 
         // Unary operators
-        case JCTree.PREINC:            // ++ _
+        case PREINC:            // ++ _
             return Tree.Kind.PREFIX_INCREMENT;
-        case JCTree.PREDEC:            // -- _
+        case PREDEC:            // -- _
             return Tree.Kind.PREFIX_DECREMENT;
-        case JCTree.POS:               // +
+        case POS:               // +
             return Tree.Kind.UNARY_PLUS;
-        case JCTree.NEG:               // -
+        case NEG:               // -
             return Tree.Kind.UNARY_MINUS;
-        case JCTree.COMPL:             // ~
+        case COMPL:             // ~
             return Tree.Kind.BITWISE_COMPLEMENT;
-        case JCTree.NOT:               // !
+        case NOT:               // !
             return Tree.Kind.LOGICAL_COMPLEMENT;
 
         // Binary operators
 
         // Multiplicative operators
-        case JCTree.MUL:               // *
+        case MUL:               // *
             return Tree.Kind.MULTIPLY;
-        case JCTree.DIV:               // /
+        case DIV:               // /
             return Tree.Kind.DIVIDE;
-        case JCTree.MOD:               // %
+        case MOD:               // %
             return Tree.Kind.REMAINDER;
 
         // Additive operators
-        case JCTree.PLUS:              // +
+        case PLUS:              // +
             return Tree.Kind.PLUS;
-        case JCTree.MINUS:             // -
+        case MINUS:             // -
             return Tree.Kind.MINUS;
 
         // Shift operators
-        case JCTree.SL:                // <<
+        case SL:                // <<
             return Tree.Kind.LEFT_SHIFT;
-        case JCTree.SR:                // >>
+        case SR:                // >>
             return Tree.Kind.RIGHT_SHIFT;
-        case JCTree.USR:               // >>>
+        case USR:               // >>>
             return Tree.Kind.UNSIGNED_RIGHT_SHIFT;
 
         // Relational operators
-        case JCTree.LT:                // <
+        case LT:                // <
             return Tree.Kind.LESS_THAN;
-        case JCTree.GT:                // >
+        case GT:                // >
             return Tree.Kind.GREATER_THAN;
-        case JCTree.LE:                // <=
+        case LE:                // <=
             return Tree.Kind.LESS_THAN_EQUAL;
-        case JCTree.GE:                // >=
+        case GE:                // >=
             return Tree.Kind.GREATER_THAN_EQUAL;
 
         // Equality operators
-        case JCTree.EQ:                // ==
+        case EQ:                // ==
             return Tree.Kind.EQUAL_TO;
-        case JCTree.NE:                // !=
+        case NE:                // !=
             return Tree.Kind.NOT_EQUAL_TO;
 
         // Bitwise and logical operators
-        case JCTree.BITAND:            // &
+        case BITAND:            // &
             return Tree.Kind.AND;
-        case JCTree.BITXOR:            // ^
+        case BITXOR:            // ^
             return Tree.Kind.XOR;
-        case JCTree.BITOR:             // |
+        case BITOR:             // |
             return Tree.Kind.OR;
 
         // Conditional operators
-        case JCTree.AND:               // &&
+        case AND:               // &&
             return Tree.Kind.CONDITIONAL_AND;
-        case JCTree.OR:                // ||
+        case OR:                // ||
             return Tree.Kind.CONDITIONAL_OR;
 
         // Assignment operators
-        case JCTree.MUL_ASG:           // *=
+        case MUL_ASG:           // *=
             return Tree.Kind.MULTIPLY_ASSIGNMENT;
-        case JCTree.DIV_ASG:           // /=
+        case DIV_ASG:           // /=
             return Tree.Kind.DIVIDE_ASSIGNMENT;
-        case JCTree.MOD_ASG:           // %=
+        case MOD_ASG:           // %=
             return Tree.Kind.REMAINDER_ASSIGNMENT;
-        case JCTree.PLUS_ASG:          // +=
+        case PLUS_ASG:          // +=
             return Tree.Kind.PLUS_ASSIGNMENT;
-        case JCTree.MINUS_ASG:         // -=
+        case MINUS_ASG:         // -=
             return Tree.Kind.MINUS_ASSIGNMENT;
-        case JCTree.SL_ASG:            // <<=
+        case SL_ASG:            // <<=
             return Tree.Kind.LEFT_SHIFT_ASSIGNMENT;
-        case JCTree.SR_ASG:            // >>=
+        case SR_ASG:            // >>=
             return Tree.Kind.RIGHT_SHIFT_ASSIGNMENT;
-        case JCTree.USR_ASG:           // >>>=
+        case USR_ASG:           // >>>=
             return Tree.Kind.UNSIGNED_RIGHT_SHIFT_ASSIGNMENT;
-        case JCTree.BITAND_ASG:        // &=
+        case BITAND_ASG:        // &=
             return Tree.Kind.AND_ASSIGNMENT;
-        case JCTree.BITXOR_ASG:        // ^=
+        case BITXOR_ASG:        // ^=
             return Tree.Kind.XOR_ASSIGNMENT;
-        case JCTree.BITOR_ASG:         // |=
+        case BITOR_ASG:         // |=
             return Tree.Kind.OR_ASSIGNMENT;
 
         // Null check (implementation detail), for example, __.getClass()
-        case JCTree.NULLCHK:
+        case NULLCHK:
             return Tree.Kind.OTHER;
 
         default:
@@ -901,13 +949,13 @@
      */
     public static JCExpression typeIn(JCExpression tree) {
         switch (tree.getTag()) {
-        case JCTree.IDENT: /* simple names */
-        case JCTree.TYPEIDENT: /* primitive name */
-        case JCTree.SELECT: /* qualified name */
-        case JCTree.TYPEARRAY: /* array types */
-        case JCTree.WILDCARD: /* wild cards */
-        case JCTree.TYPEPARAMETER: /* type parameters */
-        case JCTree.TYPEAPPLY: /* parameterized types */
+        case IDENT: /* simple names */
+        case TYPEIDENT: /* primitive name */
+        case SELECT: /* qualified name */
+        case TYPEARRAY: /* array types */
+        case WILDCARD: /* wild cards */
+        case TYPEPARAMETER: /* type parameters */
+        case TYPEAPPLY: /* parameterized types */
             return tree;
         default:
             throw new AssertionError("Unexpected type tree: " + tree);
@@ -916,9 +964,9 @@
 
     public static JCTree innermostType(JCTree type) {
         switch (type.getTag()) {
-        case JCTree.TYPEARRAY:
+        case TYPEARRAY:
             return innermostType(((JCArrayTypeTree)type).elemtype);
-        case JCTree.WILDCARD:
+        case WILDCARD:
             return innermostType(((JCWildcard)type).inner);
         default:
             return type;
--- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Tue May 29 00:27:58 2012 +0100
@@ -351,6 +351,14 @@
         return tree;
     }
 
+    public JCLambda Lambda(List<JCVariableDecl> params,
+                           JCTree body)
+    {
+        JCLambda tree = new JCLambda(params, body);
+        tree.pos = pos;
+        return tree;
+    }
+
     public JCParens Parens(JCExpression expr) {
         JCParens tree = new JCParens(expr);
         tree.pos = pos;
@@ -363,19 +371,19 @@
         return tree;
     }
 
-    public JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs) {
+    public JCAssignOp Assignop(JCTree.Tag opcode, JCTree lhs, JCTree rhs) {
         JCAssignOp tree = new JCAssignOp(opcode, lhs, rhs, null);
         tree.pos = pos;
         return tree;
     }
 
-    public JCUnary Unary(int opcode, JCExpression arg) {
+    public JCUnary Unary(JCTree.Tag opcode, JCExpression arg) {
         JCUnary tree = new JCUnary(opcode, arg);
         tree.pos = pos;
         return tree;
     }
 
-    public JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs) {
+    public JCBinary Binary(JCTree.Tag opcode, JCExpression lhs, JCExpression rhs) {
         JCBinary tree = new JCBinary(opcode, lhs, rhs, null);
         tree.pos = pos;
         return tree;
@@ -405,6 +413,13 @@
         return tree;
     }
 
+    public JCMemberReference Reference(JCMemberReference.ReferenceMode mode, Name name,
+            JCExpression expr, List<JCExpression> typeargs) {
+        JCMemberReference tree = new JCMemberReference(mode, name, expr, typeargs);
+        tree.pos = pos;
+        return tree;
+    }
+
     public JCIdent Ident(Name name) {
         JCIdent tree = new JCIdent(name, null);
         tree.pos = pos;
--- a/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Tue May 29 00:27:58 2012 +0100
@@ -212,6 +212,11 @@
         scan(tree.elems);
     }
 
+    public void visitLambda(JCLambda tree) {
+        scan(tree.body);
+        scan(tree.params);
+    }
+
     public void visitParens(JCParens tree) {
         scan(tree.expr);
     }
@@ -254,6 +259,11 @@
         scan(tree.selected);
     }
 
+    public void visitReference(JCMemberReference tree) {
+        scan(tree.expr);
+        scan(tree.typeargs);
+    }
+
     public void visitIdent(JCIdent tree) {
     }
 
--- a/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Tue May 29 00:27:58 2012 +0100
@@ -282,6 +282,12 @@
         result = tree;
     }
 
+    public void visitLambda(JCLambda tree) {
+        tree.params = translate(tree.params);
+        tree.body = translate(tree.body);
+        result = tree;
+    }
+
     public void visitNewArray(JCNewArray tree) {
         tree.elemtype = translate(tree.elemtype);
         tree.dims = translate(tree.dims);
@@ -340,6 +346,11 @@
         result = tree;
     }
 
+    public void visitReference(JCMemberReference tree) {
+        tree.expr = translate(tree.expr);
+        result = tree;
+    }
+
     public void visitIdent(JCIdent tree) {
         result = tree;
     }
--- a/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,19 @@
 
     /** Report an error, unless another error was already reported at same
      *  source position.
+     *  @param flag   A flag to set on the diagnostic
+     *  @param pos    The source position at which to report the error.
+     *  @param key    The key for the localized error message.
+     *  @param args   Fields of the error message.
+     */
+    public void error(DiagnosticFlag flag, DiagnosticPosition pos, String key, Object ... args) {
+        JCDiagnostic d = diags.error(source, pos, key, args);
+        d.setFlag(flag);
+        report(d);
+    }
+
+    /** Report an error, unless another error was already reported at same
+     *  source position.
      *  @param pos    The source position at which to report the error.
      *  @param key    The key for the localized error message.
      *  @param args   Fields of the error message.
--- a/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,6 @@
 
 package com.sun.tools.javac.util;
 
-import com.sun.tools.javac.code.Source;
-import com.sun.tools.javac.main.JavacOption;
-import com.sun.tools.javac.main.OptionName;
-import com.sun.tools.javac.main.RecognizedOptions;
-import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
 import java.io.ByteArrayOutputStream;
 import java.io.Closeable;
 import java.io.IOException;
@@ -51,9 +46,19 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 import javax.tools.JavaFileObject;
 import javax.tools.JavaFileObject.Kind;
 
+import com.sun.tools.javac.code.Lint;
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.file.FSInfo;
+import com.sun.tools.javac.file.Locations;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.main.OptionHelper;
+import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
+import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
+
 /**
  * Utility methods for building a filemanager.
  * There are no references here to file-system specific objects such as
@@ -63,15 +68,21 @@
     protected BaseFileManager(Charset charset) {
         this.charset = charset;
         byteBufferCache = new ByteBufferCache();
+        locations = createLocations();
     }
 
     /**
      * Set the context for JavacPathFileManager.
      */
-    protected void setContext(Context context) {
+    public void setContext(Context context) {
         log = Log.instance(context);
         options = Options.instance(context);
         classLoaderClass = options.get("procloader");
+        locations.update(log, options, Lint.instance(context), FSInfo.instance(context));
+    }
+
+    protected Locations createLocations() {
+        return new Locations();
     }
 
     /**
@@ -88,8 +99,10 @@
 
     protected String classLoaderClass;
 
+    protected Locations locations;
+
     protected Source getSource() {
-        String sourceName = options.get(OptionName.SOURCE);
+        String sourceName = options.get(Option.SOURCE);
         Source source = null;
         if (sourceName != null)
             source = Source.lookup(sourceName);
@@ -133,15 +146,31 @@
 
     // <editor-fold defaultstate="collapsed" desc="Option handling">
     public boolean handleOption(String current, Iterator<String> remaining) {
-        for (JavacOption o: javacFileManagerOptions) {
+        OptionHelper helper = new GrumpyHelper(log) {
+            @Override
+            public String get(Option option) {
+                return options.get(option.getText());
+            }
+
+            @Override
+            public void put(String name, String value) {
+                options.put(name, value);
+            }
+
+            @Override
+            public void remove(String name) {
+                options.remove(name);
+            }
+        };
+        for (Option o: javacFileManagerOptions) {
             if (o.matches(current))  {
                 if (o.hasArg()) {
                     if (remaining.hasNext()) {
-                        if (!o.process(options, current, remaining.next()))
+                        if (!o.process(helper, current, remaining.next()))
                             return true;
                     }
                 } else {
-                    if (!o.process(options, current))
+                    if (!o.process(helper, current))
                         return true;
                 }
                 // operand missing, or process returned false
@@ -152,12 +181,11 @@
         return false;
     }
     // where
-        private static JavacOption[] javacFileManagerOptions =
-            RecognizedOptions.getJavacFileManagerOptions(
-            new RecognizedOptions.GrumpyHelper());
+        private static Set<Option> javacFileManagerOptions =
+            Option.getJavacFileManagerOptions();
 
     public int isSupportedOption(String option) {
-        for (JavacOption o : javacFileManagerOptions) {
+        for (Option o : javacFileManagerOptions) {
             if (o.matches(option))
                 return o.hasArg() ? 1 : 0;
         }
@@ -179,7 +207,7 @@
     }
 
     public String getEncodingName() {
-        String encName = options.get(OptionName.ENCODING);
+        String encName = options.get(Option.ENCODING);
         if (encName == null)
             return getDefaultEncodingName();
         else
@@ -322,16 +350,46 @@
 
     // <editor-fold defaultstate="collapsed" desc="Content cache">
     public CharBuffer getCachedContent(JavaFileObject file) {
-        SoftReference<CharBuffer> r = contentCache.get(file);
-        return (r == null ? null : r.get());
+        ContentCacheEntry e = contentCache.get(file);
+        if (e == null)
+            return null;
+
+        if (!e.isValid(file)) {
+            contentCache.remove(file);
+            return null;
+        }
+
+        return e.getValue();
     }
 
     public void cache(JavaFileObject file, CharBuffer cb) {
-        contentCache.put(file, new SoftReference<CharBuffer>(cb));
+        contentCache.put(file, new ContentCacheEntry(file, cb));
+    }
+
+    public void flushCache(JavaFileObject file) {
+        contentCache.remove(file);
     }
 
-    protected final Map<JavaFileObject, SoftReference<CharBuffer>> contentCache
-            = new HashMap<JavaFileObject, SoftReference<CharBuffer>>();
+    protected final Map<JavaFileObject, ContentCacheEntry> contentCache
+            = new HashMap<JavaFileObject, ContentCacheEntry>();
+
+    protected static class ContentCacheEntry {
+        final long timestamp;
+        final SoftReference<CharBuffer> ref;
+
+        ContentCacheEntry(JavaFileObject file, CharBuffer cb) {
+            this.timestamp = file.getLastModified();
+            this.ref = new SoftReference<CharBuffer>(cb);
+        }
+
+        boolean isValid(JavaFileObject file) {
+            return timestamp == file.getLastModified();
+        }
+
+        CharBuffer getValue() {
+            return ref.get();
+        }
+    }
     // </editor-fold>
 
     public static Kind getKind(String name) {
--- a/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.tree.JCTree;
 
 import static com.sun.tools.javac.util.LayoutCharacters.*;
@@ -128,11 +129,11 @@
         }
     }
 
-    public Map<JCTree, Integer> getEndPosTable() {
+    public EndPosTable getEndPosTable() {
         return endPosTable;
     }
 
-    public void setEndPosTable(Map<JCTree, Integer> t) {
+    public void setEndPosTable(EndPosTable t) {
         if (endPosTable != null && endPosTable != t)
             throw new IllegalStateException("endPosTable already set");
         endPosTable = t;
@@ -199,7 +200,7 @@
     /** The underlying file object. */
     protected JavaFileObject fileObject;
 
-    protected Map<JCTree, Integer> endPosTable;
+    protected EndPosTable endPosTable;
 
     /** A soft reference to the content of the file object. */
     protected SoftReference<char[]> refBuf;
--- a/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 
 import com.sun.tools.javac.api.DiagnosticFormatter;
 import com.sun.tools.javac.code.Lint.LintCategory;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.tree.JCTree;
 
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
@@ -70,7 +71,16 @@
             this(JavacMessages.instance(context), "compiler");
             context.put(diagnosticFactoryKey, this);
 
-            Options options = Options.instance(context);
+            final Options options = Options.instance(context);
+            initOptions(options);
+            options.addListener(new Runnable() {
+               public void run() {
+                   initOptions(options);
+               }
+            });
+        }
+
+        private void initOptions(Options options) {
             if (options.isSet("onlySyntaxErrorsUnrecoverable"))
                 defaultErrorFlags.add(DiagnosticFlag.RECOVERABLE);
         }
@@ -304,7 +314,7 @@
         /** If there is a tree node, and if endPositions are available, get
          *  the end position of the tree node. Otherwise, just returns the
          *  same as getPreferredPosition(). */
-        int getEndPosition(Map<JCTree, Integer> endPosTable);
+        int getEndPosition(EndPosTable endPosTable);
     }
 
     /**
@@ -328,7 +338,7 @@
             return pos;
         }
 
-        public int getEndPosition(Map<JCTree, Integer> endPosTable) {
+        public int getEndPosition(EndPosTable endPosTable) {
             return pos;
         }
 
--- a/src/share/classes/com/sun/tools/javac/util/JavacMessages.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/JavacMessages.java	Tue May 29 00:27:58 2012 +0100
@@ -82,14 +82,14 @@
     }
 
     /** Creates a JavacMessages object.
-     * @param bundleName the name to identify the resource buundle of localized messages.
+     * @param bundleName the name to identify the resource bundle of localized messages.
      */
     public JavacMessages(String bundleName) throws MissingResourceException {
         this(bundleName, null);
     }
 
     /** Creates a JavacMessages object.
-     * @param bundleName the name to identify the resource buundle of localized messages.
+     * @param bundleName the name to identify the resource bundle of localized messages.
      */
     public JavacMessages(String bundleName, Locale locale) throws MissingResourceException {
         bundleNames = List.nil();
--- a/src/share/classes/com/sun/tools/javac/util/Log.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Tue May 29 00:27:58 2012 +0100
@@ -29,19 +29,19 @@
 import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Queue;
 import java.util.Set;
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.api.DiagnosticFormatter;
-import com.sun.tools.javac.main.OptionName;
-import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.main.Main;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
 
 /** A class for error logs. Reports errors and warnings, and
  *  keeps track of error numbers and positions.
@@ -60,19 +60,31 @@
     public static final Context.Key<PrintWriter> outKey =
         new Context.Key<PrintWriter>();
 
-    //@Deprecated
-    public final PrintWriter errWriter;
+    /* TODO: Should unify this with prefix handling in JCDiagnostic.Factory. */
+    public enum PrefixKind {
+        JAVAC("javac."),
+        COMPILER_MISC("compiler.misc.");
+        PrefixKind(String v) {
+            value = v;
+        }
+        public String key(String k) {
+            return value + k;
+        }
+        final String value;
+    }
 
-    //@Deprecated
-    public final PrintWriter warnWriter;
+    public enum WriterKind { NOTICE, WARNING, ERROR };
+
+    protected PrintWriter errWriter;
 
-    //@Deprecated
-    public final PrintWriter noticeWriter;
+    protected PrintWriter warnWriter;
+
+    protected PrintWriter noticeWriter;
 
     /** The maximum number of errors/warnings that are reported.
      */
-    public final int MaxErrors;
-    public final int MaxWarnings;
+    protected int MaxErrors;
+    protected int MaxWarnings;
 
     /** Switch: prompt user on each error.
      */
@@ -123,7 +135,6 @@
 
     /** Construct a log with given I/O redirections.
      */
-    @Deprecated
     protected Log(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
         super(JCDiagnostic.Factory.instance(context));
         context.put(logKey, this);
@@ -131,30 +142,42 @@
         this.warnWriter = warnWriter;
         this.noticeWriter = noticeWriter;
 
-        Options options = Options.instance(context);
-        this.dumpOnError = options.isSet(DOE);
-        this.promptOnError = options.isSet(PROMPT);
-        this.emitWarnings = options.isUnset(XLINT_CUSTOM, "none");
-        this.suppressNotes = options.isSet("suppressNotes");
-        this.MaxErrors = getIntOption(options, XMAXERRS, getDefaultMaxErrors());
-        this.MaxWarnings = getIntOption(options, XMAXWARNS, getDefaultMaxWarnings());
-
-        boolean rawDiagnostics = options.isSet("rawDiagnostics");
-        messages = JavacMessages.instance(context);
-        this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) :
-                                              new BasicDiagnosticFormatter(options, messages);
         @SuppressWarnings("unchecked") // FIXME
         DiagnosticListener<? super JavaFileObject> dl =
             context.get(DiagnosticListener.class);
         this.diagListener = dl;
 
-        String ek = options.get("expectKeys");
-        if (ek != null)
-            expectDiagKeys = new HashSet<String>(Arrays.asList(ek.split(", *")));
+        messages = JavacMessages.instance(context);
+        messages.add(Main.javacBundleName);
+
+        final Options options = Options.instance(context);
+        initOptions(options);
+        options.addListener(new Runnable() {
+            public void run() {
+                initOptions(options);
+            }
+        });
     }
     // where
-        private int getIntOption(Options options, OptionName optionName, int defaultValue) {
-            String s = options.get(optionName);
+        private void initOptions(Options options) {
+            this.dumpOnError = options.isSet(DOE);
+            this.promptOnError = options.isSet(PROMPT);
+            this.emitWarnings = options.isUnset(XLINT_CUSTOM, "none");
+            this.suppressNotes = options.isSet("suppressNotes");
+            this.MaxErrors = getIntOption(options, XMAXERRS, getDefaultMaxErrors());
+            this.MaxWarnings = getIntOption(options, XMAXWARNS, getDefaultMaxWarnings());
+
+            boolean rawDiagnostics = options.isSet("rawDiagnostics");
+            this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) :
+                                                  new BasicDiagnosticFormatter(options, messages);
+
+            String ek = options.get("expectKeys");
+            if (ek != null)
+                expectDiagKeys = new HashSet<String>(Arrays.asList(ek.split(", *")));
+        }
+
+        private int getIntOption(Options options, Option option, int defaultValue) {
+            String s = options.get(option);
             try {
                 if (s != null) {
                     int n = Integer.parseInt(s);
@@ -180,7 +203,7 @@
 
     /** The default writer for diagnostics
      */
-    static final PrintWriter defaultWriter(Context context) {
+    static PrintWriter defaultWriter(Context context) {
         PrintWriter result = context.get(outKey);
         if (result == null)
             context.put(outKey, result = new PrintWriter(System.err));
@@ -225,9 +248,9 @@
         return diagListener != null;
     }
 
-    public void setEndPosTable(JavaFileObject name, Map<JCTree, Integer> table) {
+    public void setEndPosTable(JavaFileObject name, EndPosTable endPosTable) {
         name.getClass(); // null check
-        getSource(name).setEndPosTable(table);
+        getSource(name).setEndPosTable(endPosTable);
     }
 
     /** Return current sourcefile.
@@ -248,6 +271,36 @@
         this.diagFormatter = diagFormatter;
     }
 
+    public PrintWriter getWriter(WriterKind kind) {
+        switch (kind) {
+            case NOTICE:    return noticeWriter;
+            case WARNING:   return warnWriter;
+            case ERROR:     return errWriter;
+            default:        throw new IllegalArgumentException();
+        }
+    }
+
+    public void setWriter(WriterKind kind, PrintWriter pw) {
+        pw.getClass();
+        switch (kind) {
+            case NOTICE:    noticeWriter = pw;  break;
+            case WARNING:   warnWriter = pw;    break;
+            case ERROR:     errWriter = pw;     break;
+            default:        throw new IllegalArgumentException();
+        }
+    }
+
+    public void setWriters(PrintWriter pw) {
+        pw.getClass();
+        noticeWriter = warnWriter = errWriter = pw;
+    }
+
+    public void setWriters(Log other) {
+        this.noticeWriter = other.noticeWriter;
+        this.warnWriter = other.warnWriter;
+        this.errWriter = other.errWriter;
+    }
+
     /** Flush the logs
      */
     public void flush() {
@@ -256,6 +309,10 @@
         noticeWriter.flush();
     }
 
+    public void flush(WriterKind kind) {
+        getWriter(kind).flush();
+    }
+
     /** Returns true if an error needs to be reported for a given
      * source name and pos.
      */
@@ -275,7 +332,6 @@
     public void prompt() {
         if (promptOnError) {
             System.err.println(localize("resume.abort"));
-            char ch;
             try {
                 while (true) {
                     switch (System.in.read()) {
@@ -302,7 +358,7 @@
             return;
         int col = source.getColumnNumber(pos, false);
 
-        printLines(writer, line);
+        printRawLines(writer, line);
         for (int i = 0; i < col - 1; i++) {
             writer.print((line.charAt(i) == '\t') ? "\t" : " ");
         }
@@ -310,10 +366,48 @@
         writer.flush();
     }
 
+    public void printNewline() {
+        noticeWriter.println();
+    }
+
+    public void printNewline(WriterKind wk) {
+        getWriter(wk).println();
+    }
+
+    public void printLines(String key, Object... args) {
+        printRawLines(noticeWriter, localize(key, args));
+    }
+
+    public void printLines(PrefixKind pk, String key, Object... args) {
+        printRawLines(noticeWriter, localize(pk, key, args));
+    }
+
+    public void printLines(WriterKind wk, String key, Object... args) {
+        printRawLines(getWriter(wk), localize(key, args));
+    }
+
+    public void printLines(WriterKind wk, PrefixKind pk, String key, Object... args) {
+        printRawLines(getWriter(wk), localize(pk, key, args));
+    }
+
     /** Print the text of a message, translating newlines appropriately
      *  for the platform.
      */
-    public static void printLines(PrintWriter writer, String msg) {
+    public void printRawLines(String msg) {
+        printRawLines(noticeWriter, msg);
+    }
+
+    /** Print the text of a message, translating newlines appropriately
+     *  for the platform.
+     */
+    public void printRawLines(WriterKind kind, String msg) {
+        printRawLines(getWriter(kind), msg);
+    }
+
+    /** Print the text of a message, translating newlines appropriately
+     *  for the platform.
+     */
+    public static void printRawLines(PrintWriter writer, String msg) {
         int nl;
         while ((nl = msg.indexOf('\n')) != -1) {
             writer.println(msg.substring(0, nl));
@@ -322,30 +416,16 @@
         if (msg.length() != 0) writer.println(msg);
     }
 
-    /** Print the text of a message to the errWriter stream,
-     *  translating newlines appropriately for the platform.
-     */
-    public void printErrLines(String key, Object... args) {
-        printLines(errWriter, localize(key, args));
-    }
-
-    /** Print the text of a message to the noticeWriter stream,
-     *  translating newlines appropriately for the platform.
-     */
-    public void printNoteLines(String key, Object... args) {
-        printLines(noticeWriter, localize(key, args));
-    }
-
     /**
      * Print the localized text of a "verbose" message to the
      * noticeWriter stream.
      */
     public void printVerbose(String key, Object... args) {
-        printLines(noticeWriter, localize("verbose." + key, args));
+        printRawLines(noticeWriter, localize("verbose." + key, args));
     }
 
     protected void directError(String key, Object... args) {
-        printErrLines(key, args);
+        printRawLines(errWriter, localize(key, args));
         errWriter.flush();
     }
 
@@ -431,7 +511,7 @@
 
         PrintWriter writer = getWriterForDiagnosticType(diag.getType());
 
-        printLines(writer, diagFormatter.format(diag, messages.getCurrentLocale()));
+        printRawLines(writer, diagFormatter.format(diag, messages.getCurrentLocale()));
 
         if (promptOnError) {
             switch (diag.getType()) {
@@ -474,7 +554,7 @@
      *  @param args   Fields to substitute into the string.
      */
     public static String getLocalizedString(String key, Object ... args) {
-        return JavacMessages.getDefaultLocalizedString("compiler.misc." + key, args);
+        return JavacMessages.getDefaultLocalizedString(PrefixKind.COMPILER_MISC.key(key), args);
     }
 
     /** Find a localized string in the resource bundle.
@@ -482,9 +562,23 @@
      *  @param args   Fields to substitute into the string.
      */
     public String localize(String key, Object... args) {
-        return messages.getLocalizedString("compiler.misc." + key, args);
+        return localize(PrefixKind.COMPILER_MISC, key, args);
     }
 
+    /** Find a localized string in the resource bundle.
+     *  @param key    The key for the localized string.
+     *  @param args   Fields to substitute into the string.
+     */
+    public String localize(PrefixKind pk, String key, Object... args) {
+        if (useRawMessages)
+            return pk.key(key);
+        else
+            return messages.getLocalizedString(pk.key(key), args);
+    }
+    // where
+        // backdoor hook for testing, should transition to use -XDrawDiagnostics
+        private static boolean useRawMessages = false;
+
 /***************************************************************************
  * raw error messages without internationalization; used for experimentation
  * and quick prototyping
@@ -494,12 +588,12 @@
      */
     private void printRawError(int pos, String msg) {
         if (source == null || pos == Position.NOPOS) {
-            printLines(errWriter, "error: " + msg);
+            printRawLines(errWriter, "error: " + msg);
         } else {
             int line = source.getLineNumber(pos);
             JavaFileObject file = source.getFile();
             if (file != null)
-                printLines(errWriter,
+                printRawLines(errWriter,
                            file.getName() + ":" +
                            line + ": " + msg);
             printErrLine(pos, errWriter);
--- a/src/share/classes/com/sun/tools/javac/util/Names.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,108 +47,127 @@
         return instance;
     }
 
-    public final Name slash;
+    // operators and punctuation
+    public final Name asterisk;
+    public final Name comma;
+    public final Name empty;
     public final Name hyphen;
-    public final Name T;
-    public final Name slashequals;
-    public final Name deprecated;
-    public final Name init;
-    public final Name clinit;
-    public final Name error;
-    public final Name any;
-    public final Name empty;
     public final Name one;
     public final Name period;
-    public final Name comma;
     public final Name semicolon;
-    public final Name asterisk;
-    public final Name _this;
+    public final Name slash;
+    public final Name slashequals;
+
+    // keywords
+    public final Name _class;
+    public final Name _default;
     public final Name _super;
-    public final Name _default;
-    public final Name _class;
-    public final Name java_lang;
-    public final Name java_lang_Object;
+    public final Name _this;
+
+    // field and method names
+    public final Name _name;
+    public final Name addSuppressed;
+    public final Name any;
+    public final Name append;
+    public final Name clinit;
+    public final Name clone;
+    public final Name close;
+    public final Name compareTo;
+    public final Name desiredAssertionStatus;
+    public final Name equals;
+    public final Name error;
+    public final Name family;
+    public final Name finalize;
+    public final Name forName;
+    public final Name getClass;
+    public final Name getClassLoader;
+    public final Name getComponentType;
+    public final Name getDeclaringClass;
+    public final Name getMessage;
+    public final Name hasNext;
+    public final Name hashCode;
+    public final Name init;
+    public final Name initCause;
+    public final Name iterator;
+    public final Name length;
+    public final Name next;
+    public final Name ordinal;
+    public final Name serialVersionUID;
+    public final Name toString;
+    public final Name value;
+    public final Name valueOf;
+    public final Name values;
+
+    // class names
+    public final Name java_io_Serializable;
+    public final Name java_lang_AutoCloseable;
     public final Name java_lang_Class;
     public final Name java_lang_Cloneable;
-    public final Name java_io_Serializable;
-    public final Name serialVersionUID;
     public final Name java_lang_Enum;
+    public final Name java_lang_Object;
     public final Name java_lang_invoke_MethodHandle;
-    public final Name package_info;
+
+    // names of builtin classes
+    public final Name Array;
+    public final Name Bound;
+    public final Name Method;
+
+    // package names
+    public final Name java_lang;
+
+    // attribute names
+    public final Name Annotation;
+    public final Name AnnotationDefault;
+    public final Name Bridge;
+    public final Name CharacterRangeTable;
+    public final Name Code;
+    public final Name CompilationID;
     public final Name ConstantValue;
+    public final Name Deprecated;
+    public final Name EnclosingMethod;
+    public final Name Enum;
+    public final Name Exceptions;
+    public final Name InnerClasses;
     public final Name LineNumberTable;
     public final Name LocalVariableTable;
     public final Name LocalVariableTypeTable;
-    public final Name CharacterRangeTable;
+    public final Name RuntimeInvisibleAnnotations;
+    public final Name RuntimeInvisibleParameterAnnotations;
+    public final Name RuntimeInvisibleTypeAnnotations;
+    public final Name RuntimeVisibleAnnotations;
+    public final Name RuntimeVisibleParameterAnnotations;
+    public final Name RuntimeVisibleTypeAnnotations;
+    public final Name Signature;
+    public final Name SourceFile;
+    public final Name SourceID;
     public final Name StackMap;
     public final Name StackMapTable;
-    public final Name SourceID;
-    public final Name CompilationID;
-    public final Name Code;
-    public final Name Exceptions;
-    public final Name SourceFile;
-    public final Name InnerClasses;
     public final Name Synthetic;
-    public final Name Bridge;
-    public final Name Deprecated;
-    public final Name Enum;
-    public final Name _name;
-    public final Name Signature;
-    public final Name Varargs;
-    public final Name Annotation;
-    public final Name RuntimeVisibleAnnotations;
-    public final Name RuntimeInvisibleAnnotations;
-    public final Name RuntimeVisibleTypeAnnotations;
-    public final Name RuntimeInvisibleTypeAnnotations;
-    public final Name RuntimeVisibleParameterAnnotations;
-    public final Name RuntimeInvisibleParameterAnnotations;
     public final Name Value;
-    public final Name EnclosingMethod;
-    public final Name desiredAssertionStatus;
-    public final Name append;
-    public final Name family;
-    public final Name forName;
-    public final Name toString;
-    public final Name length;
-    public final Name valueOf;
-    public final Name value;
-    public final Name getMessage;
-    public final Name getClass;
+    public final Name Varargs;
+
+    // members of java.lang.annotation.ElementType
+    public final Name ANNOTATION_TYPE;
+    public final Name CONSTRUCTOR;
+    public final Name FIELD;
+    public final Name LOCAL_VARIABLE;
+    public final Name METHOD;
+    public final Name PACKAGE;
+    public final Name PARAMETER;
     public final Name TYPE;
+    public final Name TYPE_PARAMETER;
     public final Name TYPE_USE;
-    public final Name TYPE_PARAMETER;
-    public final Name FIELD;
-    public final Name METHOD;
-    public final Name PARAMETER;
-    public final Name CONSTRUCTOR;
-    public final Name LOCAL_VARIABLE;
-    public final Name ANNOTATION_TYPE;
-    public final Name PACKAGE;
-    public final Name SOURCE;
+
+    // members of java.lang.annotation.RetentionPolicy
     public final Name CLASS;
     public final Name RUNTIME;
-    public final Name Array;
-    public final Name Method;
-    public final Name Bound;
-    public final Name clone;
-    public final Name getComponentType;
-    public final Name getClassLoader;
-    public final Name initCause;
-    public final Name values;
-    public final Name iterator;
-    public final Name hasNext;
-    public final Name next;
-    public final Name AnnotationDefault;
-    public final Name ordinal;
-    public final Name equals;
-    public final Name hashCode;
-    public final Name compareTo;
-    public final Name getDeclaringClass;
+    public final Name SOURCE;
+
+    // other identifiers
+    public final Name T;
+    public final Name deprecated;
     public final Name ex;
-    public final Name finalize;
-    public final Name java_lang_AutoCloseable;
-    public final Name close;
-    public final Name addSuppressed;
+    public final Name package_info;
 
     public final Name.Table table;
 
@@ -156,116 +175,127 @@
         Options options = Options.instance(context);
         table = createTable(options);
 
-        slash = fromString("/");
+        // operators and punctuation
+        asterisk = fromString("*");
+        comma = fromString(",");
+        empty = fromString("");
         hyphen = fromString("-");
-        T = fromString("T");
-        slashequals = fromString("/=");
-        deprecated = fromString("deprecated");
-
-        init = fromString("<init>");
-        clinit = fromString("<clinit>");
-        error = fromString("<error>");
-        any = fromString("<any>");
-        empty = fromString("");
         one = fromString("1");
         period = fromString(".");
-        comma = fromString(",");
         semicolon = fromString(";");
-        asterisk = fromString("*");
-        _this = fromString("this");
+        slash = fromString("/");
+        slashequals = fromString("/=");
+
+        // keywords
+        _class = fromString("class");
+        _default = fromString("default");
         _super = fromString("super");
-        _default = fromString("default");
+        _this = fromString("this");
 
-        _class = fromString("class");
-        java_lang = fromString("java.lang");
-        java_lang_Object = fromString("java.lang.Object");
+        // field and method names
+        _name = fromString("name");
+        addSuppressed = fromString("addSuppressed");
+        any = fromString("<any>");
+        append = fromString("append");
+        clinit = fromString("<clinit>");
+        clone = fromString("clone");
+        close = fromString("close");
+        compareTo = fromString("compareTo");
+        desiredAssertionStatus = fromString("desiredAssertionStatus");
+        equals = fromString("equals");
+        error = fromString("<error>");
+        family = fromString("family");
+        finalize = fromString("finalize");
+        forName = fromString("forName");
+        getClass = fromString("getClass");
+        getClassLoader = fromString("getClassLoader");
+        getComponentType = fromString("getComponentType");
+        getDeclaringClass = fromString("getDeclaringClass");
+        getMessage = fromString("getMessage");
+        hasNext = fromString("hasNext");
+        hashCode = fromString("hashCode");
+        init = fromString("<init>");
+        initCause = fromString("initCause");
+        iterator = fromString("iterator");
+        length = fromString("length");
+        next = fromString("next");
+        ordinal = fromString("ordinal");
+        serialVersionUID = fromString("serialVersionUID");
+        toString = fromString("toString");
+        value = fromString("value");
+        valueOf = fromString("valueOf");
+        values = fromString("values");
+
+        // class names
+        java_io_Serializable = fromString("java.io.Serializable");
+        java_lang_AutoCloseable = fromString("java.lang.AutoCloseable");
         java_lang_Class = fromString("java.lang.Class");
         java_lang_Cloneable = fromString("java.lang.Cloneable");
-        java_io_Serializable = fromString("java.io.Serializable");
         java_lang_Enum = fromString("java.lang.Enum");
+        java_lang_Object = fromString("java.lang.Object");
         java_lang_invoke_MethodHandle = fromString("java.lang.invoke.MethodHandle");
-        package_info = fromString("package-info");
-        serialVersionUID = fromString("serialVersionUID");
+
+        // names of builtin classes
+        Array = fromString("Array");
+        Bound = fromString("Bound");
+        Method = fromString("Method");
+
+        // package names
+        java_lang = fromString("java.lang");
+
+        // attribute names
+        Annotation = fromString("Annotation");
+        AnnotationDefault = fromString("AnnotationDefault");
+        Bridge = fromString("Bridge");
+        CharacterRangeTable = fromString("CharacterRangeTable");
+        Code = fromString("Code");
+        CompilationID = fromString("CompilationID");
         ConstantValue = fromString("ConstantValue");
+        Deprecated = fromString("Deprecated");
+        EnclosingMethod = fromString("EnclosingMethod");
+        Enum = fromString("Enum");
+        Exceptions = fromString("Exceptions");
+        InnerClasses = fromString("InnerClasses");
         LineNumberTable = fromString("LineNumberTable");
         LocalVariableTable = fromString("LocalVariableTable");
         LocalVariableTypeTable = fromString("LocalVariableTypeTable");
-        CharacterRangeTable = fromString("CharacterRangeTable");
+        RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
+        RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
+        RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
+        RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations");
+        RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
+        RuntimeVisibleTypeAnnotations = fromString("RuntimeVisibleTypeAnnotations");
+        Signature = fromString("Signature");
+        SourceFile = fromString("SourceFile");
+        SourceID = fromString("SourceID");
         StackMap = fromString("StackMap");
         StackMapTable = fromString("StackMapTable");
-        SourceID = fromString("SourceID");
-        CompilationID = fromString("CompilationID");
-        Code = fromString("Code");
-        Exceptions = fromString("Exceptions");
-        SourceFile = fromString("SourceFile");
-        InnerClasses = fromString("InnerClasses");
         Synthetic = fromString("Synthetic");
-        Bridge = fromString("Bridge");
-        Deprecated = fromString("Deprecated");
-        Enum = fromString("Enum");
-        _name = fromString("name");
-        Signature = fromString("Signature");
+        Value = fromString("Value");
         Varargs = fromString("Varargs");
-        Annotation = fromString("Annotation");
-        RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations");
-        RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
-        RuntimeVisibleTypeAnnotations = fromString("RuntimeVisibleTypeAnnotations");
-        RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
-        RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
-        RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
-        Value = fromString("Value");
-        EnclosingMethod = fromString("EnclosingMethod");
 
-        desiredAssertionStatus = fromString("desiredAssertionStatus");
-
-        append = fromString("append");
-        family = fromString("family");
-        forName = fromString("forName");
-        toString = fromString("toString");
-        length = fromString("length");
-        valueOf = fromString("valueOf");
-        value = fromString("value");
-        getMessage = fromString("getMessage");
-        getClass = fromString("getClass");
+        // members of java.lang.annotation.ElementType
+        ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
+        CONSTRUCTOR = fromString("CONSTRUCTOR");
+        FIELD = fromString("FIELD");
+        LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
+        METHOD = fromString("METHOD");
+        PACKAGE = fromString("PACKAGE");
+        PARAMETER = fromString("PARAMETER");
+        TYPE = fromString("TYPE");
+        TYPE_PARAMETER = fromString("TYPE_PARAMETER");
+        TYPE_USE = fromString("TYPE_USE");
 
-        TYPE = fromString("TYPE");
-        TYPE_USE = fromString("TYPE_USE");
-        TYPE_PARAMETER = fromString("TYPE_PARAMETER");
-        FIELD = fromString("FIELD");
-        METHOD = fromString("METHOD");
-        PARAMETER = fromString("PARAMETER");
-        CONSTRUCTOR = fromString("CONSTRUCTOR");
-        LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
-        ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
-        PACKAGE = fromString("PACKAGE");
-
-        SOURCE = fromString("SOURCE");
+        // members of java.lang.annotation.RetentionPolicy
         CLASS = fromString("CLASS");
         RUNTIME = fromString("RUNTIME");
+        SOURCE = fromString("SOURCE");
 
-        Array = fromString("Array");
-        Method = fromString("Method");
-        Bound = fromString("Bound");
-        clone = fromString("clone");
-        getComponentType = fromString("getComponentType");
-        getClassLoader = fromString("getClassLoader");
-        initCause = fromString("initCause");
-        values = fromString("values");
-        iterator = fromString("iterator");
-        hasNext = fromString("hasNext");
-        next = fromString("next");
-        AnnotationDefault = fromString("AnnotationDefault");
-        ordinal = fromString("ordinal");
-        equals = fromString("equals");
-        hashCode = fromString("hashCode");
-        compareTo = fromString("compareTo");
-        getDeclaringClass = fromString("getDeclaringClass");
+        // other identifiers
+        T = fromString("T");
+        deprecated = fromString("deprecated");
         ex = fromString("ex");
-        finalize = fromString("finalize");
-
-        java_lang_AutoCloseable = fromString("java.lang.AutoCloseable");
-        close = fromString("close");
-        addSuppressed = fromString("addSuppressed");
+        package_info = fromString("package-info");
     }
 
     protected Name.Table createTable(Options options) {
--- a/src/share/classes/com/sun/tools/javac/util/Options.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/Options.java	Tue May 29 00:27:58 2012 +0100
@@ -26,8 +26,8 @@
 package com.sun.tools.javac.util;
 
 import java.util.*;
-import com.sun.tools.javac.main.OptionName;
-import static com.sun.tools.javac.main.OptionName.*;
+import com.sun.tools.javac.main.Option;
+import static com.sun.tools.javac.main.Option.*;
 
 /** A table of all command-line options.
  *  If an option has an argument, the option name is mapped to the argument.
@@ -71,8 +71,8 @@
     /**
      * Get the value for an option.
      */
-    public String get(OptionName name) {
-        return values.get(name.optionName);
+    public String get(Option option) {
+        return values.get(option.text);
     }
 
     /**
@@ -101,15 +101,15 @@
     /**
      * Check if the value for an option has been set.
      */
-    public boolean isSet(OptionName name) {
-        return (values.get(name.optionName) != null);
+    public boolean isSet(Option option) {
+        return (values.get(option.text) != null);
     }
 
     /**
      * Check if the value for a choice option has been set to a specific value.
      */
-    public boolean isSet(OptionName name, String value) {
-        return (values.get(name.optionName + value) != null);
+    public boolean isSet(Option option, String value) {
+        return (values.get(option.text + value) != null);
     }
 
     /**
@@ -122,23 +122,23 @@
     /**
      * Check if the value for an option has not been set.
      */
-    public boolean isUnset(OptionName name) {
-        return (values.get(name.optionName) == null);
+    public boolean isUnset(Option option) {
+        return (values.get(option.text) == null);
     }
 
     /**
      * Check if the value for a choice option has not been set to a specific value.
      */
-    public boolean isUnset(OptionName name, String value) {
-        return (values.get(name.optionName + value) == null);
+    public boolean isUnset(Option option, String value) {
+        return (values.get(option.text + value) == null);
     }
 
     public void put(String name, String value) {
         values.put(name, value);
     }
 
-    public void put(OptionName name, String value) {
-        values.put(name.optionName, value);
+    public void put(Option option, String value) {
+        values.put(option.text, value);
     }
 
     public void putAll(Options options) {
@@ -157,6 +157,19 @@
         return values.size();
     }
 
+    // light-weight notification mechanism
+
+    private List<Runnable> listeners = List.nil();
+
+    public void addListener(Runnable listener) {
+        listeners = listeners.prepend(listener);
+    }
+
+    public void notifyListeners() {
+        for (Runnable r: listeners)
+            r.run();
+    }
+
     /** Check for a lint suboption. */
     public boolean lint(String s) {
         // return true if either the specific option is enabled, or
--- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Tue May 29 00:27:58 2012 +0100
@@ -412,7 +412,7 @@
         @Override
         public String visitMethodSymbol(MethodSymbol s, Locale locale) {
             String ownerName = visit(s.owner, locale);
-            if ((s.flags() & BLOCK) != 0) {
+            if (s.isStaticOrInstanceInit()) {
                return ownerName;
             } else {
                 String ms = (s.name == s.name.table.names.init)
@@ -540,13 +540,22 @@
                                          bounds.head.tag == NONE ||
                                          bounds.head.tag == ERROR;
 
-
-                JCDiagnostic d = diags.fragment("where.typevar" +
+                if ((t.tsym.flags() & SYNTHETIC) == 0) {
+                    //this is a true typevar
+                    JCDiagnostic d = diags.fragment("where.typevar" +
                         (boundErroneous ? ".1" : ""), t, bounds,
                         Kinds.kindName(t.tsym.location()), t.tsym.location());
-                whereClauses.get(WhereClauseKind.TYPEVAR).put(t, d);
-                symbolPreprocessor.visit(t.tsym.location(), null);
-                visit(bounds);
+                    whereClauses.get(WhereClauseKind.TYPEVAR).put(t, d);
+                    symbolPreprocessor.visit(t.tsym.location(), null);
+                    visit(bounds);
+                } else {
+                    Assert.check(!boundErroneous);
+                    //this is a fresh (synthetic) tvar
+                    JCDiagnostic d = diags.fragment("where.fresh.typevar", t, bounds);
+                    whereClauses.get(WhereClauseKind.TYPEVAR).put(t, d);
+                    visit(bounds);
+                }
+
             }
             return null;
         }
--- a/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,11 +46,11 @@
 public class AnnotationTypeDocImpl
         extends ClassDocImpl implements AnnotationTypeDoc {
 
-    AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) {
+    public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) {
         this(env, sym, null, null, null);
     }
 
-    AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym,
+    public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym,
                           String doc, JCClassDecl tree, Position.LineMap lineMap) {
         super(env, sym, doc, tree, lineMap);
     }
--- a/src/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,11 +45,11 @@
 public class AnnotationTypeElementDocImpl
         extends MethodDocImpl implements AnnotationTypeElementDoc {
 
-    AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) {
+    public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) {
         super(env, sym);
     }
 
-    AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym,
+    public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym,
                                  String doc, JCMethodDecl tree, Position.LineMap lineMap) {
         super(env, sym, doc, tree, lineMap);
     }
--- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -65,6 +65,7 @@
 import com.sun.tools.javac.util.Position;
 
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /**
  * Represents a java class and provides access to information
@@ -744,17 +745,16 @@
         // search inner classes
         //### Add private entry point to avoid creating array?
         //### Replicate code in innerClasses here to avoid consing?
-        ClassDoc innerClasses[] = innerClasses();
-        for (int i = 0; i < innerClasses.length; i++) {
-            if (innerClasses[i].name().equals(className) ||
-                //### This is from original javadoc but it looks suspicious to me...
-                //### I believe it is attempting to compensate for the confused
-                //### convention of including the nested class qualifiers in the
-                //### 'name' of the inner class, rather than the true simple name.
-                innerClasses[i].name().endsWith(className)) {
-                return innerClasses[i];
+        for (ClassDoc icd : innerClasses()) {
+            if (icd.name().equals(className) ||
+                    //### This is from original javadoc but it looks suspicious to me...
+                    //### I believe it is attempting to compensate for the confused
+                    //### convention of including the nested class qualifiers in the
+                    //### 'name' of the inner class, rather than the true simple name.
+                    icd.name().endsWith("." + className)) {
+                return icd;
             } else {
-                ClassDoc innercd = ((ClassDocImpl) innerClasses[i]).searchClass(className);
+                ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className);
                 if (innercd != null) {
                     return innercd;
                 }
@@ -1084,7 +1084,7 @@
 
         Name asterisk = tsym.name.table.names.asterisk;
         for (JCTree t : compenv.toplevel.defs) {
-            if (t.getTag() == JCTree.IMPORT) {
+            if (t.hasTag(IMPORT)) {
                 JCTree imp = ((JCImport) t).qualid;
                 if ((TreeInfo.name(imp) != asterisk) &&
                         (imp.type.tsym.kind & Kinds.TYP) != 0) {
@@ -1125,7 +1125,7 @@
         if (compenv == null) return new PackageDocImpl[0];
 
         for (JCTree t : compenv.toplevel.defs) {
-            if (t.getTag() == JCTree.IMPORT) {
+            if (t.hasTag(IMPORT)) {
                 JCTree imp = ((JCImport) t).qualid;
                 if (TreeInfo.name(imp) == names.asterisk) {
                     JCFieldAccess sel = (JCFieldAccess)imp;
--- a/src/share/classes/com/sun/tools/javadoc/Comment.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/Comment.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,7 @@
 
 package com.sun.tools.javadoc;
 
-import java.util.Locale;
-
 import com.sun.javadoc.*;
-
 import com.sun.tools.javac.util.ListBuffer;
 
 /**
@@ -115,7 +112,7 @@
                                 state = TAG_NAME;
                             }
                             break;
-                    };
+                    }
                     if (ch == '\n') {
                         newLine = true;
                     } else if (!isWhite) {
@@ -134,7 +131,7 @@
                     case IN_TEXT:
                         parseCommentComponent(tagName, textStart, lastNonWhite+1);
                         break;
-                };
+                }
             }
 
             /**
@@ -396,16 +393,15 @@
      * else
      *    return -1.
      */
-    private static int inlineTagFound(DocImpl holder,  String inlinetext, int start) {
+    private static int inlineTagFound(DocImpl holder, String inlinetext, int start) {
         DocEnv docenv = holder.env;
-        int linkstart;
-        if (start == inlinetext.length() ||
-              (linkstart = inlinetext.indexOf("{@", start)) == -1) {
+        int linkstart = inlinetext.indexOf("{@", start);
+        if (start == inlinetext.length() || linkstart == -1) {
             return -1;
-        } else if(inlinetext.indexOf('}', start) == -1) {
+        } else if (inlinetext.indexOf('}', linkstart) == -1) {
             //Missing '}'.
             docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
-                          inlinetext.substring(linkstart, inlinetext.length()));
+                    inlinetext.substring(linkstart, inlinetext.length()));
             return -1;
         } else {
             return linkstart;
@@ -425,6 +421,7 @@
     /**
      * Return text for this Doc comment.
      */
+    @Override
     public String toString() {
         return text;
     }
--- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,7 @@
     final Symbol externalizableSym;
 
     /** Access filter (public, protected, ...).  */
-    ModifierFilter showAccess;
+    protected ModifierFilter showAccess;
 
     /** True if we are using a sentence BreakIterator. */
     boolean breakiterator;
@@ -102,7 +102,7 @@
     boolean docClasses = false;
 
     /** Does the doclet only expect pre-1.5 doclet API? */
-    boolean legacyDoclet = true;
+    protected boolean legacyDoclet = true;
 
     /**
      * Set this to true if you would like to not emit any errors, warnings and
@@ -115,7 +115,7 @@
      *
      * @param context      Context for this javadoc instance.
      */
-    private DocEnv(Context context) {
+    protected DocEnv(Context context) {
         context.put(docEnvKey, this);
 
         messager = Messager.instance0(context);
@@ -517,7 +517,7 @@
         messager.exit();
     }
 
-    private Map<PackageSymbol, PackageDocImpl> packageMap =
+    protected Map<PackageSymbol, PackageDocImpl> packageMap =
             new HashMap<PackageSymbol, PackageDocImpl>();
     /**
      * Return the PackageDoc of this package symbol.
@@ -545,12 +545,12 @@
     }
 
 
-    private Map<ClassSymbol, ClassDocImpl> classMap =
+    protected Map<ClassSymbol, ClassDocImpl> classMap =
             new HashMap<ClassSymbol, ClassDocImpl>();
     /**
      * Return the ClassDoc (or a subtype) of this class symbol.
      */
-    ClassDocImpl getClassDoc(ClassSymbol clazz) {
+    public ClassDocImpl getClassDoc(ClassSymbol clazz) {
         ClassDocImpl result = classMap.get(clazz);
         if (result != null) return result;
         if (isAnnotationType(clazz)) {
@@ -565,7 +565,7 @@
     /**
      * Create the ClassDoc (or a subtype) for a class symbol.
      */
-    void makeClassDoc(ClassSymbol clazz, String docComment, JCClassDecl tree, Position.LineMap lineMap) {
+    protected void makeClassDoc(ClassSymbol clazz, String docComment, JCClassDecl tree, Position.LineMap lineMap) {
         ClassDocImpl result = classMap.get(clazz);
         if (result != null) {
             if (docComment != null) result.setRawCommentText(docComment);
@@ -580,20 +580,20 @@
         classMap.put(clazz, result);
     }
 
-    private static boolean isAnnotationType(ClassSymbol clazz) {
+    protected static boolean isAnnotationType(ClassSymbol clazz) {
         return ClassDocImpl.isAnnotationType(clazz);
     }
 
-    private static boolean isAnnotationType(JCClassDecl tree) {
+    protected static boolean isAnnotationType(JCClassDecl tree) {
         return (tree.mods.flags & Flags.ANNOTATION) != 0;
     }
 
-    private Map<VarSymbol, FieldDocImpl> fieldMap =
+    protected Map<VarSymbol, FieldDocImpl> fieldMap =
             new HashMap<VarSymbol, FieldDocImpl>();
     /**
      * Return the FieldDoc of this var symbol.
      */
-    FieldDocImpl getFieldDoc(VarSymbol var) {
+    public FieldDocImpl getFieldDoc(VarSymbol var) {
         FieldDocImpl result = fieldMap.get(var);
         if (result != null) return result;
         result = new FieldDocImpl(this, var);
@@ -603,7 +603,7 @@
     /**
      * Create a FieldDoc for a var symbol.
      */
-    void makeFieldDoc(VarSymbol var, String docComment, JCVariableDecl tree, Position.LineMap lineMap) {
+    protected void makeFieldDoc(VarSymbol var, String docComment, JCVariableDecl tree, Position.LineMap lineMap) {
         FieldDocImpl result = fieldMap.get(var);
         if (result != null) {
             if (docComment != null) result.setRawCommentText(docComment);
@@ -614,13 +614,13 @@
         }
     }
 
-    private Map<MethodSymbol, ExecutableMemberDocImpl> methodMap =
+    protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap =
             new HashMap<MethodSymbol, ExecutableMemberDocImpl>();
     /**
      * Create a MethodDoc for this MethodSymbol.
      * Should be called only on symbols representing methods.
      */
-    void makeMethodDoc(MethodSymbol meth, String docComment,
+    protected void makeMethodDoc(MethodSymbol meth, String docComment,
                        JCMethodDecl tree, Position.LineMap lineMap) {
         MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
         if (result != null) {
@@ -649,7 +649,7 @@
      * Create the ConstructorDoc for a MethodSymbol.
      * Should be called only on symbols representing constructors.
      */
-    void makeConstructorDoc(MethodSymbol meth, String docComment,
+    protected void makeConstructorDoc(MethodSymbol meth, String docComment,
                             JCMethodDecl tree, Position.LineMap lineMap) {
         ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
         if (result != null) {
@@ -678,7 +678,7 @@
      * Create the AnnotationTypeElementDoc for a MethodSymbol.
      * Should be called only on symbols representing annotation type elements.
      */
-    void makeAnnotationTypeElementDoc(MethodSymbol meth,
+    protected void makeAnnotationTypeElementDoc(MethodSymbol meth,
                                       String docComment, JCMethodDecl tree, Position.LineMap lineMap) {
         AnnotationTypeElementDocImpl result =
             (AnnotationTypeElementDocImpl)methodMap.get(meth);
--- a/src/share/classes/com/sun/tools/javadoc/DocImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/DocImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -92,7 +92,7 @@
      * So subclasses have the option to do lazy initialization of
      * "documentation" string.
      */
-    String documentation() {
+    protected String documentation() {
         if (documentation == null) documentation = "";
         return documentation;
     }
--- a/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Tue May 29 00:27:58 2012 +0100
@@ -80,7 +80,7 @@
         cpString = appendPath(System.getProperty("env.class.path"), cpString);
         cpString = appendPath(System.getProperty("java.class.path"), cpString);
         cpString = appendPath(docletPath, cpString);
-        URL[] urls = com.sun.tools.javac.file.Paths.pathToURLs(cpString);
+        URL[] urls = com.sun.tools.javac.file.Locations.pathToURLs(cpString);
         if (docletParentClassLoader == null)
             appClassLoader = new URLClassLoader(urls, getDelegationClassLoader(docletClassName));
         else
--- a/src/share/classes/com/sun/tools/javadoc/JavadocClassReader.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/JavadocClassReader.java	Tue May 29 00:27:58 2012 +0100
@@ -35,7 +35,7 @@
 /** Javadoc uses an extended class reader that records package.html entries
  *  @author Neal Gafter
  */
-class JavadocClassReader extends ClassReader {
+public class JavadocClassReader extends ClassReader {
 
     public static JavadocClassReader instance0(Context context) {
         ClassReader instance = context.get(classReaderKey);
@@ -59,7 +59,7 @@
     private EnumSet<JavaFileObject.Kind> noSource = EnumSet.of(JavaFileObject.Kind.CLASS,
                                                                JavaFileObject.Kind.HTML);
 
-    private JavadocClassReader(Context context) {
+    public JavadocClassReader(Context context) {
         super(context, true);
         docenv = DocEnv.instance(context);
         preferSource = true;
--- a/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java	Tue May 29 00:27:58 2012 +0100
@@ -31,7 +31,6 @@
 import com.sun.tools.javac.code.Kinds;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
 import javax.tools.JavaFileObject;
 
@@ -65,6 +64,7 @@
     final Messager messager;
     final DocEnv docenv;
 
+    @Override
     public void main(List<JCCompilationUnit> trees) {
         // count all Enter errors as warnings.
         int nerrors = messager.nerrors;
@@ -73,6 +73,7 @@
         messager.nerrors = nerrors;
     }
 
+    @Override
     public void visitTopLevel(JCCompilationUnit tree) {
         super.visitTopLevel(tree);
         if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
@@ -81,10 +82,11 @@
         }
     }
 
+    @Override
     public void visitClassDef(JCClassDecl tree) {
         super.visitClassDef(tree);
-        if (tree.sym != null && tree.sym.kind == Kinds.TYP) {
-            if (tree.sym == null) return;
+        if (tree.sym == null) return;
+        if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) {
             String comment = env.toplevel.docComments.get(tree);
             ClassSymbol c = tree.sym;
             docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap);
@@ -92,6 +94,7 @@
     }
 
     /** Don't complain about a duplicate class. */
+    @Override
     protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {}
 
 }
--- a/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java	Tue May 29 00:27:58 2012 +0100
@@ -38,7 +38,7 @@
  *  done by javac.
  *  @author Neal Gafter
  */
-class JavadocMemberEnter extends MemberEnter {
+public class JavadocMemberEnter extends MemberEnter {
     public static JavadocMemberEnter instance0(Context context) {
         MemberEnter instance = context.get(memberEnterKey);
         if (instance == null)
--- a/src/share/classes/com/sun/tools/javadoc/JavadocTool.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/JavadocTool.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,6 @@
 
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.comp.Annotate;
-import com.sun.tools.javac.parser.DocCommentScanner;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
@@ -257,24 +256,15 @@
         for (String p: excludedPackages)
             includedPackages.put(p, false);
 
-        if (docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)) {
-            searchSubPackages(subPackages,
-                    includedPackages,
-                    packages, packageFiles,
-                    StandardLocation.SOURCE_PATH,
-                    EnumSet.of(JavaFileObject.Kind.SOURCE));
-            searchSubPackages(subPackages,
-                    includedPackages,
-                    packages, packageFiles,
-                    StandardLocation.CLASS_PATH,
-                    EnumSet.of(JavaFileObject.Kind.CLASS));
-        } else {
-            searchSubPackages(subPackages,
-                    includedPackages,
-                    packages, packageFiles,
-                    StandardLocation.CLASS_PATH,
-                    EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS));
-        }
+        StandardLocation path = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
+                ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
+
+        searchSubPackages(subPackages,
+                includedPackages,
+                packages, packageFiles,
+                path,
+                EnumSet.of(JavaFileObject.Kind.SOURCE));
+
         return packageFiles;
     }
 
@@ -429,7 +419,7 @@
         ListBuffer<JCClassDecl> result = new ListBuffer<JCClassDecl>();
         for (JCCompilationUnit t : trees) {
             for (JCTree def : t.defs) {
-                if (def.getTag() == JCTree.CLASSDEF)
+                if (def.hasTag(JCTree.Tag.CLASSDEF))
                     result.append((JCClassDecl)def);
             }
         }
--- a/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@
     /**
      * Do lazy initialization of "documentation" string.
      */
-    String documentation() {
+    protected String documentation() {
         if (documentation != null)
             return documentation;
         if (docPath != null) {
--- a/src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,11 @@
     private final String parameterComment;
     private final boolean isTypeParameter;
 
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
     ParamTagImpl(DocImpl holder, String name, String text) {
         super(holder, name, text);
         String[] sa = divideAtWhite();
@@ -71,6 +76,7 @@
     /**
      * Return the kind of this tag.
      */
+    @Override
     public String kind() {
         return "@param";
     }
@@ -85,6 +91,7 @@
     /**
      * convert this object to a string.
      */
+    @Override
     public String toString() {
         return name + ":" + text;
     }
@@ -97,7 +104,11 @@
      * @see TagImpl#inlineTagImpls()
      * @see ThrowsTagImpl#inlineTagImpls()
      */
+    @Override
     public Tag[] inlineTags() {
-        return Comment.getInlineTags(holder, parameterComment);
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(holder, parameterComment);
+        }
+        return inlineTags;
     }
 }
--- a/src/share/classes/com/sun/tools/javadoc/SerialFieldTagImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/SerialFieldTagImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,6 +80,9 @@
      */
     private void parseSerialFieldString() {
         int len = text.length();
+        if (len == 0) {
+            return;
+        }
 
         // if no white space found
         /* Skip white space. */
--- a/src/share/classes/com/sun/tools/javadoc/Start.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/Start.java	Tue May 29 00:27:58 2012 +0100
@@ -31,6 +31,7 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Options;
 
 import java.io.IOException;
@@ -76,9 +77,6 @@
 
     private DocletInvoker docletInvoker;
 
-    private static final int F_VERBOSE = 1 << 0;
-    private static final int F_WARNINGS = 1 << 2;
-
     /* Treat warnings as errors. */
     private boolean rejectWarnings = false;
 
@@ -171,11 +169,11 @@
             messager.error(null, "main.out.of.memory");
             failed = true;
         } catch (Error ee) {
-            ee.printStackTrace();
+            ee.printStackTrace(System.err);
             messager.error(null, "main.fatal.error");
             failed = true;
         } catch (Exception ee) {
-            ee.printStackTrace();
+            ee.printStackTrace(System.err);
             messager.error(null, "main.fatal.exception");
             failed = true;
         } finally {
@@ -211,7 +209,7 @@
             messager.error(null, "main.cant.read", e.getMessage());
             exit();
         } catch (IOException e) {
-            e.printStackTrace();
+            e.printStackTrace(System.err);
             exit();
         }
 
@@ -225,7 +223,9 @@
         // options that may be set up below.
         Messager.preRegister(context,
                 messager.programName,
-                messager.errWriter, messager.warnWriter, messager.noticeWriter);
+                messager.getWriter(Log.WriterKind.ERROR),
+                messager.getWriter(Log.WriterKind.WARNING),
+                messager.getWriter(Log.WriterKind.NOTICE));
 
         Options compOpts = Options.instance(context);
         boolean docClasses = false;
--- a/src/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,11 @@
     private final String exceptionName;
     private final String exceptionComment;
 
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
     ThrowsTagImpl(DocImpl holder, String name, String text) {
         super(holder, name, text);
         String[] sa = divideAtWhite();
@@ -93,6 +98,7 @@
      * Return the kind of this tag.  Always "@throws" for instances
      * of ThrowsTagImpl.
      */
+    @Override
     public String kind() {
         return "@throws";
     }
@@ -105,7 +111,11 @@
      * @see TagImpl#inlineTagImpls()
      * @see ParamTagImpl#inlineTagImpls()
      */
+    @Override
     public Tag[] inlineTags() {
-        return Comment.getInlineTags(holder, exceptionComment());
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(holder, exceptionComment());
+        }
+        return inlineTags;
     }
 }
--- a/src/share/classes/com/sun/tools/javah/JavahTask.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javah/JavahTask.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.type.TypeVisitor;
 import javax.lang.model.util.ElementFilter;
-import javax.lang.model.util.SimpleTypeVisitor7;
+import javax.lang.model.util.SimpleTypeVisitor8;
 import javax.lang.model.util.Types;
 
 import javax.tools.Diagnostic;
@@ -753,7 +753,7 @@
         }
 
         private TypeVisitor<Void,Types> checkMethodParametersVisitor =
-                new SimpleTypeVisitor7<Void,Types>() {
+                new SimpleTypeVisitor8<Void,Types>() {
             @Override
             public Void visitArray(ArrayType t, Types types) {
                 visit(t.getComponentType(), types);
--- a/src/share/classes/com/sun/tools/javah/LLNI.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javah/LLNI.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.type.TypeVisitor;
 import javax.lang.model.util.ElementFilter;
-import javax.lang.model.util.SimpleTypeVisitor7;
+import javax.lang.model.util.SimpleTypeVisitor8;
 
 /*
  * <p><b>This is NOT part of any supported API.
@@ -628,7 +628,7 @@
     }
 
     protected final boolean isLongOrDouble(TypeMirror t) {
-        TypeVisitor<Boolean,Void> v = new SimpleTypeVisitor7<Boolean,Void>() {
+        TypeVisitor<Boolean,Void> v = new SimpleTypeVisitor8<Boolean,Void>() {
             public Boolean defaultAction(TypeMirror t, Void p){
                 return false;
             }
--- a/src/share/classes/com/sun/tools/javah/TypeSignature.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/com/sun/tools/javah/TypeSignature.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 import javax.lang.model.type.TypeVariable;
 import javax.lang.model.type.TypeVisitor;
 import javax.lang.model.util.Elements;
-import javax.lang.model.util.SimpleTypeVisitor7;
+import javax.lang.model.util.SimpleTypeVisitor8;
 
 /**
  * Returns internal type signature.
@@ -245,7 +245,7 @@
 
 
     String qualifiedTypeName(TypeMirror type) {
-        TypeVisitor<Name, Void> v = new SimpleTypeVisitor7<Name, Void>() {
+        TypeVisitor<Name, Void> v = new SimpleTypeVisitor8<Name, Void>() {
             @Override
             public Name visitArray(ArrayType t, Void p) {
                 return t.getComponentType().accept(this, p);
--- a/src/share/classes/javax/lang/model/element/Element.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/element/Element.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -214,14 +214,13 @@
      * Returns the elements that are, loosely speaking, directly
      * enclosed by this element.
      *
-     * A class or interface is considered to enclose the fields,
-     * methods, constructors, and member types that it directly
-     * declares.  This includes any (implicit) default constructor and
-     * the implicit {@code values} and {@code valueOf} methods of an
-     * enum type.
+     * A {@linkplain TypeElement#getEnclosedElements class or
+     * interface} is considered to enclose the fields, methods,
+     * constructors, and member types that it directly declares.
      *
-     * A package encloses the top-level classes and interfaces within
-     * it, but is not considered to enclose subpackages.
+     * A {@linkplain PackageElement#getEnclosedElements package}
+     * encloses the top-level classes and interfaces within it, but is
+     * not considered to enclose subpackages.
      *
      * Other kinds of elements are not currently considered to enclose
      * any elements; however, that may change as this API or the
@@ -231,6 +230,8 @@
      * methods in {@link ElementFilter}.
      *
      * @return the enclosed elements, or an empty list if none
+     * @see PackageElement#getEnclosedElements
+     * @see TypeElement#getEnclosedElements
      * @see Elements#getAllMembers
      * @jls 8.8.9 Default Constructor
      * @jls 8.9 Enums
--- a/src/share/classes/javax/lang/model/element/PackageElement.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/element/PackageElement.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package javax.lang.model.element;
 
+import java.util.List;
+
 /**
  * Represents a package program element.  Provides access to information
  * about the package and its members.
@@ -49,7 +51,7 @@
 
     /**
      * Returns the simple name of this package.  For an unnamed
-     * package, an empty name is returned
+     * package, an empty name is returned.
      *
      * @return the simple name of this package or an empty name if
      * this is an unnamed package
@@ -58,6 +60,18 @@
     Name getSimpleName();
 
     /**
+     * Returns the {@linkplain NestingKind#TOP_LEVEL top-level}
+     * classes and interfaces within this package.  Note that
+     * subpackages are <em>not</em> considered to be enclosed by a
+     * package.
+     *
+     * @return the top-level classes and interfaces within this
+     * package
+     */
+    @Override
+    List<? extends Element> getEnclosedElements();
+
+    /**
      * Returns {@code true} is this is an unnamed package and {@code
      * false} otherwise.
      *
--- a/src/share/classes/javax/lang/model/element/TypeElement.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/element/TypeElement.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,12 @@
  */
 public interface TypeElement extends Element, Parameterizable, QualifiedNameable {
     /**
-     * {@inheritDoc}
+     * Returns the fields, methods, constructors, and member types
+     * that are directly declared in this class or interface.
+     *
+     * This includes any (implicit) default constructor and
+     * the implicit {@code values} and {@code valueOf} methods of an
+     * enum type.
      *
      * <p> Note that as a particular instance of the {@linkplain
      * javax.lang.model.element general accuracy requirements} and the
@@ -75,6 +80,7 @@
      *
      * @return the enclosed elements in proper order, or an empty list if none
      */
+    @Override
     List<? extends Element> getEnclosedElements();
 
     /**
--- a/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,6 +64,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see AbstractAnnotationValueVisitor7
+ * @see AbstractAnnotationValueVisitor8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,6 +59,7 @@
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
  * @see AbstractAnnotationValueVisitor6
+ * @see AbstractAnnotationValueVisitor8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import java.util.List;
+import javax.lang.model.element.*;
+
+import javax.lang.model.type.TypeMirror;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.SourceVersion;
+import javax.annotation.processing.SupportedSourceVersion;
+
+/**
+ * A skeletal visitor for annotation values with default behavior
+ * appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
+ * source version.
+ *
+ * <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
+ * implemented by this class may have methods added to it in the
+ * future to accommodate new, currently unknown, language structures
+ * added to future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new abstract annotation
+ * value visitor class will also be introduced to correspond to the
+ * new language level; this visitor will have different default
+ * behavior for the visit method in question.  When the new visitor is
+ * introduced, all or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods
+ * @param <P> the type of the additional parameter to this visitor's methods.
+ *
+ * @see AbstractAnnotationValueVisitor6
+ * @see AbstractAnnotationValueVisitor7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public abstract class AbstractAnnotationValueVisitor8<R, P> extends AbstractAnnotationValueVisitor7<R, P> {
+
+    /**
+     * Constructor for concrete subclasses to call.
+     */
+    protected AbstractAnnotationValueVisitor8() {
+        super();
+    }
+}
--- a/src/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,6 +67,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see AbstractElementVisitor7
+ * @see AbstractElementVisitor8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/AbstractElementVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractElementVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,6 +62,7 @@
  *            additional parameter.
  *
  * @see AbstractElementVisitor6
+ * @see AbstractElementVisitor8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/AbstractElementVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import javax.lang.model.element.*;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.element.*;
+import static javax.lang.model.element.ElementKind.*;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.SourceVersion;
+
+
+/**
+ * A skeletal visitor of program elements with default behavior
+ * appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
+ * source version.
+ *
+ * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
+ * implemented by this class may have methods added to it in the
+ * future to accommodate new, currently unknown, language structures
+ * added to future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new abstract element visitor
+ * class will also be introduced to correspond to the new language
+ * level; this visitor will have different default behavior for the
+ * visit method in question.  When the new visitor is introduced, all
+ * or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@link
+ *            Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ *            methods.  Use {@code Void} for visitors that do not need an
+ *            additional parameter.
+ *
+ * @see AbstractElementVisitor6
+ * @see AbstractElementVisitor7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public abstract class AbstractElementVisitor8<R, P> extends AbstractElementVisitor7<R, P> {
+    /**
+     * Constructor for concrete subclasses to call.
+     */
+    protected AbstractElementVisitor8(){
+        super();
+    }
+}
--- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -60,6 +60,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see AbstractTypeVisitor7
+ * @see AbstractTypeVisitor8
  * @since 1.6
  */
 public abstract class AbstractTypeVisitor6<R, P> implements TypeVisitor<R, P> {
--- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -56,6 +56,7 @@
  *            additional parameter.
  *
  * @see AbstractTypeVisitor6
+ * @see AbstractTypeVisitor8
  * @since 1.7
  */
 public abstract class AbstractTypeVisitor7<R, P> extends AbstractTypeVisitor6<R, P> {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import javax.lang.model.type.*;
+
+/**
+ * A skeletal visitor of types with default behavior appropriate for
+ * the {@link javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8}
+ * source version.
+ *
+ * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
+ * by this class may have methods added to it in the future to
+ * accommodate new, currently unknown, language structures added to
+ * future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new abstract type visitor
+ * class will also be introduced to correspond to the new language
+ * level; this visitor will have different default behavior for the
+ * visit method in question.  When the new visitor is introduced, all
+ * or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@link
+ *            Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ *            methods.  Use {@code Void} for visitors that do not need an
+ *            additional parameter.
+ *
+ * @see AbstractTypeVisitor6
+ * @see AbstractTypeVisitor7
+ * @since 1.8
+ */
+public abstract class AbstractTypeVisitor8<R, P> extends AbstractTypeVisitor7<R, P> {
+    /**
+     * Constructor for concrete subclasses to call.
+     */
+    protected AbstractTypeVisitor8() {
+        super();
+    }
+}
--- a/src/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -78,6 +78,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see ElementKindVisitor7
+ * @see ElementKindVisitor8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -73,6 +73,7 @@
  *            additional parameter.
  *
  * @see ElementKindVisitor6
+ * @see ElementKindVisitor8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import javax.lang.model.element.*;
+import static javax.lang.model.element.ElementKind.*;
+import javax.annotation.processing.SupportedSourceVersion;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.SourceVersion;
+
+/**
+ * A visitor of program elements based on their {@linkplain
+ * ElementKind kind} with default behavior appropriate for the {@link
+ * SourceVersion#RELEASE_8 RELEASE_8} source version.  For {@linkplain
+ * Element elements} <tt><i>XYZ</i></tt> that may have more than one
+ * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
+ * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
+ * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * call {@link #defaultAction defaultAction}, passing their arguments
+ * to {@code defaultAction}'s corresponding parameters.
+ *
+ * <p> Methods in this class may be overridden subject to their
+ * general contract.  Note that annotating methods in concrete
+ * subclasses with {@link java.lang.Override @Override} will help
+ * ensure that methods are overridden as intended.
+ *
+ * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
+ * implemented by this class may have methods added to it or the
+ * {@code ElementKind} {@code enum} used in this case may have
+ * constants added to it in the future to accommodate new, currently
+ * unknown, language structures added to future versions of the
+ * Java&trade; programming language.  Therefore, methods whose names
+ * begin with {@code "visit"} may be added to this class in the
+ * future; to avoid incompatibilities, classes which extend this class
+ * should not declare any instance methods with names beginning with
+ * {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new abstract element kind
+ * visitor class will also be introduced to correspond to the new
+ * language level; this visitor will have different default behavior
+ * for the visit method in question.  When the new visitor is
+ * introduced, all or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@link
+ *            Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ *            methods.  Use {@code Void} for visitors that do not need an
+ *            additional parameter.
+ *
+ * @see ElementKindVisitor6
+ * @see ElementKindVisitor7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public class ElementKindVisitor8<R, P> extends ElementKindVisitor7<R, P> {
+    /**
+     * Constructor for concrete subclasses; uses {@code null} for the
+     * default value.
+     */
+    protected ElementKindVisitor8() {
+        super(null);
+    }
+
+    /**
+     * Constructor for concrete subclasses; uses the argument for the
+     * default value.
+     *
+     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+     */
+    protected ElementKindVisitor8(R defaultValue) {
+        super(defaultValue);
+    }
+}
--- a/src/share/classes/javax/lang/model/util/ElementScanner6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/ElementScanner6.java	Tue May 29 00:27:58 2012 +0100
@@ -90,6 +90,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see ElementScanner7
+ * @see ElementScanner8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/ElementScanner7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/ElementScanner7.java	Tue May 29 00:27:58 2012 +0100
@@ -86,6 +86,7 @@
  *            additional parameter.
  *
  * @see ElementScanner6
+ * @see ElementScanner8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/ElementScanner8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import javax.lang.model.element.*;
+import javax.annotation.processing.SupportedSourceVersion;
+import static javax.lang.model.element.ElementKind.*;
+import javax.lang.model.SourceVersion;
+import static javax.lang.model.SourceVersion.*;
+
+
+/**
+ * A scanning visitor of program elements with default behavior
+ * appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
+ * source version.  The <tt>visit<i>XYZ</i></tt> methods in this
+ * class scan their component elements by calling {@code scan} on
+ * their {@linkplain Element#getEnclosedElements enclosed elements},
+ * {@linkplain ExecutableElement#getParameters parameters}, etc., as
+ * indicated in the individual method specifications.  A subclass can
+ * control the order elements are visited by overriding the
+ * <tt>visit<i>XYZ</i></tt> methods.  Note that clients of a scanner
+ * may get the desired behavior be invoking {@code v.scan(e, p)} rather
+ * than {@code v.visit(e, p)} on the root objects of interest.
+ *
+ * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * new method can cause the enclosed elements to be scanned in the
+ * default way by calling <tt>super.visit<i>XYZ</i></tt>.  In this
+ * fashion, the concrete visitor can control the ordering of traversal
+ * over the component elements with respect to the additional
+ * processing; for example, consistently calling
+ * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * methods will yield a preorder traversal, etc.  If the component
+ * elements should be traversed in some other order, instead of
+ * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * should call {@code scan} with the elements in the desired order.
+ *
+ * <p> Methods in this class may be overridden subject to their
+ * general contract.  Note that annotating methods in concrete
+ * subclasses with {@link java.lang.Override @Override} will help
+ * ensure that methods are overridden as intended.
+ *
+ * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
+ * implemented by this class may have methods added to it in the
+ * future to accommodate new, currently unknown, language structures
+ * added to future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new element scanner visitor
+ * class will also be introduced to correspond to the new language
+ * level; this visitor will have different default behavior for the
+ * visit method in question.  When the new visitor is introduced, all
+ * or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@link
+ *            Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ *            methods.  Use {@code Void} for visitors that do not need an
+ *            additional parameter.
+ *
+ * @see ElementScanner6
+ * @see ElementScanner7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public class ElementScanner8<R, P> extends ElementScanner7<R, P> {
+    /**
+     * Constructor for concrete subclasses; uses {@code null} for the
+     * default value.
+     */
+    protected ElementScanner8(){
+        super(null);
+    }
+
+    /**
+     * Constructor for concrete subclasses; uses the argument for the
+     * default value.
+     */
+    protected ElementScanner8(R defaultValue){
+        super(defaultValue);
+    }
+}
--- a/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,6 +71,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see SimpleAnnotationValueVisitor7
+ * @see SimpleAnnotationValueVisitor8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -66,6 +66,7 @@
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
  * @see SimpleAnnotationValueVisitor6
+ * @see SimpleAnnotationValueVisitor8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import java.util.List;
+import javax.lang.model.element.*;
+
+import javax.lang.model.type.TypeMirror;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.SourceVersion;
+import javax.annotation.processing.SupportedSourceVersion;
+
+/**
+ * A simple visitor for annotation values with default behavior
+ * appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
+ * source version.  Visit methods call {@link #defaultAction
+ * defaultAction} passing their arguments to {@code defaultAction}'s
+ * corresponding parameters.
+ *
+ * <p> Methods in this class may be overridden subject to their
+ * general contract.  Note that annotating methods in concrete
+ * subclasses with {@link java.lang.Override @Override} will help
+ * ensure that methods are overridden as intended.
+ *
+ * <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
+ * implemented by this class may have methods added to it in the
+ * future to accommodate new, currently unknown, language structures
+ * added to future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new simple annotation
+ * value visitor class will also be introduced to correspond to the
+ * new language level; this visitor will have different default
+ * behavior for the visit method in question.  When the new visitor is
+ * introduced, all or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods
+ * @param <P> the type of the additional parameter to this visitor's methods.
+ *
+ * @see SimpleAnnotationValueVisitor6
+ * @see SimpleAnnotationValueVisitor7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public class SimpleAnnotationValueVisitor8<R, P> extends SimpleAnnotationValueVisitor7<R, P> {
+    /**
+     * Constructor for concrete subclasses; uses {@code null} for the
+     * default value.
+     */
+    protected SimpleAnnotationValueVisitor8() {
+        super(null);
+    }
+
+    /**
+     * Constructor for concrete subclasses; uses the argument for the
+     * default value.
+     *
+     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+     */
+    protected SimpleAnnotationValueVisitor8(R defaultValue) {
+        super(defaultValue);
+    }
+}
--- a/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -76,6 +76,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see SimpleElementVisitor7
+ * @see SimpleElementVisitor8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -69,6 +69,7 @@
  *              for visitors that do not need an additional parameter.
  *
  * @see SimpleElementVisitor6
+ * @see SimpleElementVisitor8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import javax.lang.model.element.*;
+import javax.annotation.processing.SupportedSourceVersion;
+import static javax.lang.model.element.ElementKind.*;
+import javax.lang.model.SourceVersion;
+import static javax.lang.model.SourceVersion.*;
+
+/**
+ * A simple visitor of program elements with default behavior
+ * appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
+ * source version.
+ *
+ * Visit methods corresponding to {@code RELEASE_7} and earlier
+ * language constructs call {@link #defaultAction defaultAction},
+ * passing their arguments to {@code defaultAction}'s corresponding
+ * parameters.
+ *
+ * <p> Methods in this class may be overridden subject to their
+ * general contract.  Note that annotating methods in concrete
+ * subclasses with {@link java.lang.Override @Override} will help
+ * ensure that methods are overridden as intended.
+ *
+ * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
+ * implemented by this class may have methods added to it in the
+ * future to accommodate new, currently unknown, language structures
+ * added to future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new simple element visitor
+ * class will also be introduced to correspond to the new language
+ * level; this visitor will have different default behavior for the
+ * visit method in question.  When the new visitor is introduced, all
+ * or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@code Void}
+ *             for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's methods.  Use {@code Void}
+ *              for visitors that do not need an additional parameter.
+ *
+ * @see SimpleElementVisitor6
+ * @see SimpleElementVisitor7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public class SimpleElementVisitor8<R, P> extends SimpleElementVisitor7<R, P> {
+    /**
+     * Constructor for concrete subclasses; uses {@code null} for the
+     * default value.
+     */
+    protected SimpleElementVisitor8(){
+        super(null);
+    }
+
+    /**
+     * Constructor for concrete subclasses; uses the argument for the
+     * default value.
+     *
+     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+     */
+    protected SimpleElementVisitor8(R defaultValue){
+        super(defaultValue);
+    }
+}
--- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -75,6 +75,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see SimpleTypeVisitor7
+ * @see SimpleTypeVisitor8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -68,6 +68,7 @@
  *            additional parameter.
  *
  * @see SimpleTypeVisitor6
+ * @see SimpleTypeVisitor8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import javax.lang.model.type.*;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import static javax.lang.model.SourceVersion.*;
+
+/**
+ * A simple visitor of types with default behavior appropriate for the
+ * {@link SourceVersion#RELEASE_7 RELEASE_7} source version.
+ *
+ * Visit methods corresponding to {@code RELEASE_8} and earlier
+ * language constructs call {@link #defaultAction defaultAction},
+ * passing their arguments to {@code defaultAction}'s corresponding
+ * parameters.
+ *
+ * <p> Methods in this class may be overridden subject to their
+ * general contract.  Note that annotating methods in concrete
+ * subclasses with {@link java.lang.Override @Override} will help
+ * ensure that methods are overridden as intended.
+ *
+ * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
+ * by this class may have methods added to it in the future to
+ * accommodate new, currently unknown, language structures added to
+ * future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new simple type visitor
+ * class will also be introduced to correspond to the new language
+ * level; this visitor will have different default behavior for the
+ * visit method in question.  When the new visitor is introduced, all
+ * or portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@link
+ *            Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ *            methods.  Use {@code Void} for visitors that do not need an
+ *            additional parameter.
+ *
+ * @see SimpleTypeVisitor6
+ * @see SimpleTypeVisitor7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public class SimpleTypeVisitor8<R, P> extends SimpleTypeVisitor7<R, P> {
+    /**
+     * Constructor for concrete subclasses; uses {@code null} for the
+     * default value.
+     */
+    protected SimpleTypeVisitor8(){
+        super(null);
+    }
+
+    /**
+     * Constructor for concrete subclasses; uses the argument for the
+     * default value.
+     *
+     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+     */
+    protected SimpleTypeVisitor8(R defaultValue){
+        super(defaultValue);
+    }
+}
--- a/src/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,7 @@
  * @author Peter von der Ah&eacute;
  *
  * @see TypeKindVisitor7
+ * @see TypeKindVisitor8
  * @since 1.6
  */
 @SupportedSourceVersion(RELEASE_6)
--- a/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Tue May 29 00:27:58 2012 +0100
@@ -71,6 +71,7 @@
  *            additional parameter.
  *
  * @see TypeKindVisitor6
+ * @see TypeKindVisitor8
  * @since 1.7
  */
 @SupportedSourceVersion(RELEASE_7)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor8.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.util;
+
+import javax.lang.model.type.*;
+import javax.annotation.processing.SupportedSourceVersion;
+import static javax.lang.model.element.ElementKind.*;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.SourceVersion;
+
+/**
+ * A visitor of types based on their {@linkplain TypeKind kind} with
+ * default behavior appropriate for the {@link SourceVersion#RELEASE_8
+ * RELEASE_8} source version.  For {@linkplain
+ * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
+ * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
+ * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
+ * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
+ * call {@link #defaultAction defaultAction}, passing their arguments
+ * to {@code defaultAction}'s corresponding parameters.
+ *
+ * <p> Methods in this class may be overridden subject to their
+ * general contract.  Note that annotating methods in concrete
+ * subclasses with {@link java.lang.Override @Override} will help
+ * ensure that methods are overridden as intended.
+ *
+ * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
+ * by this class may have methods added to it in the future to
+ * accommodate new, currently unknown, language structures added to
+ * future versions of the Java&trade; programming language.
+ * Therefore, methods whose names begin with {@code "visit"} may be
+ * added to this class in the future; to avoid incompatibilities,
+ * classes which extend this class should not declare any instance
+ * methods with names beginning with {@code "visit"}.
+ *
+ * <p>When such a new visit method is added, the default
+ * implementation in this class will be to call the {@link
+ * #visitUnknown visitUnknown} method.  A new type kind visitor class
+ * will also be introduced to correspond to the new language level;
+ * this visitor will have different default behavior for the visit
+ * method in question.  When the new visitor is introduced, all or
+ * portions of this visitor may be deprecated.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@link
+ *            Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ *            methods.  Use {@code Void} for visitors that do not need an
+ *            additional parameter.
+ *
+ * @see TypeKindVisitor6
+ * @see TypeKindVisitor7
+ * @since 1.8
+ */
+@SupportedSourceVersion(RELEASE_8)
+public class TypeKindVisitor8<R, P> extends TypeKindVisitor7<R, P> {
+    /**
+     * Constructor for concrete subclasses to call; uses {@code null}
+     * for the default value.
+     */
+    protected TypeKindVisitor8() {
+        super(null);
+    }
+
+    /**
+     * Constructor for concrete subclasses to call; uses the argument
+     * for the default value.
+     *
+     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+     */
+    protected TypeKindVisitor8(R defaultValue) {
+        super(defaultValue);
+    }
+}
--- a/src/share/classes/javax/tools/JavaCompiler.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/tools/JavaCompiler.java	Tue May 29 00:27:58 2012 +0100
@@ -26,10 +26,8 @@
 package javax.tools;
 
 import java.io.File;
-import java.io.InputStream;
 import java.io.Writer;
 import java.nio.charset.Charset;
-import java.util.List;
 import java.util.Locale;
 import java.util.concurrent.Callable;
 import javax.annotation.processing.Processor;
--- a/src/share/classes/javax/tools/StandardLocation.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/classes/javax/tools/StandardLocation.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,13 @@
      * Location to search for platform classes.  Sometimes called
      * the boot class path.
      */
-    PLATFORM_CLASS_PATH;
+    PLATFORM_CLASS_PATH,
+
+    /**
+     * Location of new native header files.
+     * @since 1.8
+     */
+    NATIVE_HEADER_OUTPUT;
 
     /**
      * Gets a location object with the given name.  The following
@@ -97,6 +103,13 @@
     public String getName() { return name(); }
 
     public boolean isOutputLocation() {
-        return this == CLASS_OUTPUT || this == SOURCE_OUTPUT;
+        switch (this) {
+            case CLASS_OUTPUT:
+            case SOURCE_OUTPUT:
+            case NATIVE_HEADER_OUTPUT:
+                return true;
+            default:
+                return false;
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/tools/annotation/GenerateNativeHeader.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.tools.annotation;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+/**
+ * An annotation used to indicate that a native header file
+ * should be generated for this class.
+ *
+ * Normally, the presence of native methods is a sufficient
+ * indication of the need for a native header file.  However,
+ * in some cases, a class may contain constants of interest to
+ * native code, without containing any native methods.
+ *
+ * @since 1.8
+ */
+@Documented
+@Target(TYPE)
+@Retention(SOURCE)
+public @interface GenerateNativeHeader {
+}
--- a/src/share/sample/javac/processing/src/CheckNamesProcessor.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/src/share/sample/javac/processing/src/CheckNamesProcessor.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -138,7 +138,7 @@
     public SourceVersion getSupportedSourceVersion() {
         /*
          * Return latest source version instead of a fixed version
-         * like RELEASE_7.  To return a fixed version, this class
+         * like RELEASE_8.  To return a fixed version, this class
          * could be annotated with a SupportedSourceVersion
          * annotation.
          *
@@ -192,7 +192,7 @@
         /**
          * Visitor to implement name checks.
          */
-        private class NameCheckScanner extends ElementScanner7<Void, Void> {
+        private class NameCheckScanner extends ElementScanner8<Void, Void> {
             // The visitor could be enhanced to return true/false if
             // there were warnings reported or a count of the number
             // of warnings.  This could be facilitated by using
--- a/test/Makefile	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/Makefile	Tue May 29 00:27:58 2012 +0100
@@ -19,6 +19,7 @@
 # Get OS/ARCH specifics
 OSNAME = $(shell uname -s)
 ifeq ($(OSNAME), SunOS)
+  SLASH_JAVA = /java
   PLATFORM = solaris
   JT_PLATFORM = solaris
   ARCH = $(shell uname -p)
@@ -27,6 +28,7 @@
   endif
 endif
 ifeq ($(OSNAME), Linux)
+  SLASH_JAVA = /java
   PLATFORM = linux
   JT_PLATFORM = linux
   ARCH = $(shell uname -m)
@@ -34,8 +36,25 @@
     ARCH=i586
   endif
 endif
+ifeq ($(OSNAME), Darwin)
+  PLATFORM = bsd
+  JT_PLATFORM = linux
+  ARCH = $(shell uname -m)
+  ifeq ($(ARCH), i386)
+    ARCH=i586
+  endif
+endif
 ifeq ($(OSNAME), Windows_NT)
+  # MKS
+  PLATFORM=windows
+endif
+ifeq ($(PLATFORM),)
   PLATFORM = windows
+  CYGPATH = | cygpath -m -s -f -
+endif
+
+ifeq ($(PLATFORM), windows)
+  SLASH_JAVA = J:
   JT_PLATFORM = win32
   ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
     ARCH=ia64
@@ -54,7 +73,7 @@
 endif
 
 # Root of this test area (important to use full paths in some places)
-TEST_ROOT := $(shell pwd)
+TEST_ROOT := $(shell pwd $(CYGPATH) )
 
 # Default bundle of all test results (passed or not) (JPRT only)
 ifdef JPRT_JOB_ID
@@ -72,7 +91,7 @@
 ifdef JPRT_JTREG_HOME
   JTREG_HOME = $(JPRT_JTREG_HOME)
 else
-  JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
+  JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
 endif
 JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
 JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff
@@ -81,7 +100,7 @@
 ifdef JPRT_JCK_HOME
   JCK_HOME = $(JPRT_JCK_HOME)
 else
-  JCK_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
+  JCK_HOME = $(SLASH_JAVA)/re/jck/8/promoted/latest/binaries
 endif
 
 # Default JDK for JTREG and JCK
@@ -93,7 +112,7 @@
 ifdef JPRT_JAVA_HOME
   JT_JAVA = $(JPRT_JAVA_HOME)
 else
-  JT_JAVA = $(SLASH_JAVA)/re/jdk/1.6.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
+  JT_JAVA = $(SLASH_JAVA)/re/jdk/1.7.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 endif
 
 # Default JDK to test
@@ -195,7 +214,7 @@
 ABS_TEST_OUTPUT_DIR := \
 	$(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
 		cd  $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
-		pwd )
+		pwd $(CYGPATH))
 # Subdirectories for different test runs
 JTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg
 JCK_COMPILER_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-compiler
@@ -240,6 +259,7 @@
 # JTREG_REFERENCE
 #	(Optional) reference results (e.g. work, report or summary.txt)
 #
+jtreg_tests: jtreg-tests
 jtreg-tests: check-jtreg FRC
 	@rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \
 	    $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt
@@ -272,15 +292,17 @@
 	fi
 
 # Check to make sure these directories exist
-check-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
+check-jtreg: $(PRODUCT_HOME) $(JTREG)
 
 
 # Run JCK-compiler tests
 #
 # JCK_HOME
 #	Installed location of JCK: should include JCK-compiler, and JCK-extras
+#       Default is JCK 8.
 # JT_JAVA
 #	Version of java used to run JCK.  Should normally be the same as TESTJAVA
+#       Default is JDK 7
 # TESTJAVA
 # 	Version of java to be tested.  
 # JCK_COMPILER_OPTIONS
@@ -297,7 +319,7 @@
 	    $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt
 	@mkdir -p $(JCK_COMPILER_OUTPUT_DIR)
 	$(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
-	    -jar $(JCK_HOME)/JCK-compiler-7/lib/jtjck.jar \
+	    -jar $(JCK_HOME)/JCK-compiler-8/lib/jtjck.jar \
 	    -v:non-pass \
             -r:$(JCK_COMPILER_OUTPUT_DIR)/report \
             -w:$(JCK_COMPILER_OUTPUT_DIR)/work \
@@ -346,7 +368,7 @@
 	    $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt
 	@mkdir -p $(JCK_RUNTIME_OUTPUT_DIR)
 	$(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
-	    -jar $(JCK_HOME)/JCK-runtime-7/lib/jtjck.jar \
+	    -jar $(JCK_HOME)/JCK-runtime-8/lib/jtjck.jar \
 	    -v:non-pass \
             -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \
             -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \
@@ -373,7 +395,7 @@
 	fi
 
 # Check to make sure these directories exist
-check-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME)
+check-jck: $(JCK_HOME) $(PRODUCT_HOME)
 
 all-summary: FRC
 	if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/T6735320/SerialFieldTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ObjectStreamField;
+import java.io.Serializable;
+
+public class SerialFieldTest implements Serializable {
+    /**
+     * @serialField
+     */
+    private static final ObjectStreamField[] serialPersistentFields = {
+        new ObjectStreamField("i", int.class),
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/T6735320/T6735320.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6735320
+ * @summary javadoc throws exception if serialField value is missing
+ * @library  ../lib/
+ * @build    JavadocTester T6735320
+ * @run main T6735320
+ */
+public class T6735320 extends JavadocTester {
+
+    private static final String BUG_ID = "6735320";
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID + ".out",
+        SRC_DIR + FS + "SerialFieldTest.java"
+    };
+
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    public String getBugName() {
+        return getClass().getName();
+    }
+
+    public static void main(String... args) {
+        T6735320 tester = new T6735320();
+        if (tester.runJavadoc(ARGS) != 0) {
+            throw new AssertionError("non-zero return code from javadoc");
+        }
+        if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
+            throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
+        }
+    }
+}
--- a/test/com/sun/javadoc/lib/JavadocTester.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/com/sun/javadoc/lib/JavadocTester.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -197,8 +197,13 @@
         initOutputBuffers();
 
         ByteArrayOutputStream stdout = new ByteArrayOutputStream();
-        PrintStream prev = System.out;
+        PrintStream prevOut = System.out;
         System.setOut(new PrintStream(stdout));
+
+        ByteArrayOutputStream stderr = new ByteArrayOutputStream();
+        PrintStream prevErr = System.err;
+        System.setErr(new PrintStream(stderr));
+
         int returnCode = com.sun.tools.javadoc.Main.execute(
                 getBugName(),
                 new PrintWriter(errors, true),
@@ -207,8 +212,11 @@
                 docletClass,
                 getClass().getClassLoader(),
                 args);
-        System.setOut(prev);
+        System.setOut(prevOut);
         standardOut = new StringBuffer(stdout.toString());
+        System.setErr(prevErr);
+        errors.write(NL + stderr.toString());
+
         printJavadocOutput();
         return returnCode;
     }
--- a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug      4732864 6280605
+ * @bug      4732864 6280605 7064544
  * @summary  Make sure that you can link from one member to another using
- *           non-qualified name.
+ *           non-qualified name, furthermore, ensure the right one is linked.
  * @author   jamieh
  * @library  ../lib/
  * @build    JavadocTester
@@ -36,7 +36,7 @@
 public class TestLinkTaglet extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4732864-6280605";
+    private static final String BUG_ID = "4732864-6280605-7064544";
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
--- a/test/com/sun/javadoc/testLinkTaglet/pkg/C.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/com/sun/javadoc/testLinkTaglet/pkg/C.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,11 @@
 public class C {
 
     public InnerC MEMBER = new InnerC();
+    /**
+     *  A red herring inner class to confuse the matching, thus to
+     *  ensure the right one is linked.
+     */
+    public class RedHerringInnerC {}
 
     /**
      * Link to member in outer class: {@link #MEMBER} <br/>
--- a/test/jprt.config	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-#!echo "This is not a shell script"
-#############################################################################
-# Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#############################################################################
-#
-# JPRT shell configuration for testing.
-#
-# Input environment variables:
-#    Windows Only:
-#      PATH
-#      ROOTDIR
-#
-# Output variable settings:
-#    make    Full path to GNU make
-#
-# Output environment variables:
-#    PATH
-#
-#############################################################################
-
-#############################################################################
-# Error
-error() # message
-{
-  echo "ERROR: $1"
-  exit 6
-}
-# Directory must exist
-dirMustExist() # dir name
-{
-  if [ ! -d "$1" ] ; then
-    error "Directory for $2 does not exist: $1"
-  fi
-}
-# File must exist
-fileMustExist() # dir name
-{
-  if [ ! -f "$1" ] ; then
-    error "File for $2 does not exist: $1"
-  fi
-}
-#############################################################################
-
-# Should be set by JPRT as the 3 basic inputs
-slashjava="${ALT_SLASH_JAVA}"
-if [ "${slashjava}" = "" ] ; then
-  slashjava=/java
-fi
-
-# Check input
-dirMustExist "${slashjava}"  ALT_SLASH_JAVA
-
-# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
-osname=`uname -s`
-if [ "${osname}" = SunOS ] ; then
-   
-    # SOLARIS: Sparc or X86
-    osarch=`uname -p`
-    if [ "${osarch}" = sparc ] ; then
-	solaris_arch=sparc
-    else
-	solaris_arch=i386
-    fi
-
-    # Add basic solaris system paths
-    path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
-
-    # Find GNU make
-    make=/usr/sfw/bin/gmake
-    if [ ! -f ${make} ] ; then
-	make=/opt/sfw/bin/gmake
-	if [ ! -f ${make} ] ; then
-	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
-        fi 
-    fi
-    fileMustExist "${make}" make
-
-    # File creation mask
-    umask 002
-
-elif [ "${osname}" = Linux ] ; then
-   
-    # Add basic paths
-    path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
-
-    # Find GNU make
-    make=/usr/bin/make
-    fileMustExist "${make}" make
-
-    umask 002
-
-else
-
-    # Windows: Differs on CYGWIN vs. MKS.
-   
-    # We need to determine if we are running a CYGWIN shell or an MKS shell
-    #    (if uname isn't available, then it will be unix_toolset=unknown)
-    unix_toolset=unknown
-    if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
-        # We kind of assume ROOTDIR is where MKS is and it's ok
-        unix_toolset=MKS
-        mkshome=`dosname -s "${ROOTDIR}"`
-        # Most unix utilities are in the mksnt directory of ROOTDIR
-        unixcommand_path="${mkshome}/mksnt"
-        path4sdk="${unixcommand_path}"
-	devtools_path="${slashjava}/devtools/win32/bin"
-	path4sdk="${devtools_path};${path4sdk}"
-        # Find GNU make
-        make="${devtools_path}/gnumake.exe"
-        fileMustExist "${make}" make
-    elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
-        # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
-        unix_toolset=CYGWIN
-        # Most unix utilities are in the /usr/bin
-        unixcommand_path="/usr/bin"
-        path4sdk="${unixcommand_path}"
-        # Find GNU make
-        make="${unixcommand_path}/make.exe"
-        fileMustExist "${make}" make
-    else
-      echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
-    fi
-
-    
-    # For windows, it's hard to know where the system is, so we just add this
-    #    to PATH.
-    slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
-    path4sdk="${slash_path};${PATH}"
-    
-    # Convert path4sdk to cygwin style
-    if [ "${unix_toolset}" = CYGWIN ] ; then
-	path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
-    fi
-
-fi
-
-# Export PATH setting
-PATH="${path4sdk}"
-export PATH
-
--- a/test/tools/apt/Basics/Aggregate.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public class Aggregate {
-    static {
-        System.out.println("xxyzzy");
-    }
-
-    private Aggregate() {}
-
-    private static double hypot(double Berkeley, double SantaCruz) {
-        return 0.0;
-    }
-
-    public int hashcode() {return 42;}
-    public boolean equals(Aggregate a) {return this == a;}
-
-    public static void main(String[] argv) {
-        System.out.println("Hello World.");
-    }
-}
--- a/test/tools/apt/Basics/ClassAnnotations.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import annot.*;
-import annot.annot2.*;
-
-@MySimple("value") @MyMarker
-@AnnotMarker @AnnotSimple("foo")
-@AnnotMarker2 @AnnotSimple2("bar")
-public class ClassAnnotations {
-    static double d;
-
-    public void foo() {
-        return;
-    }
-
-    private double bar(int baz) {
-        @AnnotShangri_la
-        int local = 0;
-        return (double) baz;
-    }
-
-    static class NestedClass {
-        protected int field;
-    }
-}
--- a/test/tools/apt/Basics/FreshnessApf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Indirect test of whether source or class files are used to provide
- * declaration information.
- */
-public class FreshnessApf implements AnnotationProcessorFactory {
-    // Process any set of annotations
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("*"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new FreshnessAp(env);
-    }
-
-    private static class FreshnessAp implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        FreshnessAp(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        public void process() {
-            System.out.println("Testing for freshness.");
-            boolean empty = true;
-            for (TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations()) {
-                for (FieldDeclaration fieldDecl: typeDecl.getFields() ) {
-                    empty = false;
-                    System.out.println(typeDecl.getQualifiedName() +
-                                       "." + fieldDecl.getSimpleName());
-
-                    // Verify the declaration for the type of the
-                    // field is a class with an annotation.
-                    System.out.println(((DeclaredType) fieldDecl.getType()).getDeclaration().getAnnotationMirrors());
-                    if (((DeclaredType) fieldDecl.getType()).getDeclaration().getAnnotationMirrors().size() == 0)
-                        env.getMessager().printError("Expected an annotation.");
-                }
-            }
-
-            if (empty)
-                env.getMessager().printError("No fields encountered.");
-        }
-    }
-}
--- a/test/tools/apt/Basics/GenClass.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * A trivial generic class to test the fix for 5018369.
- */
-
-class GenClass<T> {
-}
--- a/test/tools/apt/Basics/Indirect.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * Class that is used to provide a pointer to another class
- * declaration.
- */
-public class Indirect {
-    Milk skim = null;
-}
--- a/test/tools/apt/Basics/Lacuna.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-class Lacuna extends Missing {}
--- a/test/tools/apt/Basics/MethodAnnotations.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import annot.*;
-import annot.annot2.*;
-
-public class MethodAnnotations {
-    static double d;
-
-    @MySimple("value") @MyMarker
-    @AnnotMarker @AnnotSimple("foo")
-    @AnnotMarker2 @AnnotSimple2("bar")
-    public void foo() {
-        return;
-    }
-
-    private double bar(int baz) {
-        @AnnotShangri_la
-        int local = 0;
-        return (double) baz;
-    }
-
-    static class NestedClass {
-        protected int field;
-    }
-}
--- a/test/tools/apt/Basics/Milk.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import java.lang.annotation.*;
-
-@Fresh
-public class Milk {
-    // Moo.
-}
-
-@Retention(RetentionPolicy.SOURCE)
-@interface Fresh {
-}
--- a/test/tools/apt/Basics/MisMatch.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-/**
- * Class that uses constructs whose language and vm interpretation
- * differ.
- */
-public class MisMatch {
-    static final int constant = 3;
-    static int notConstant = 4;
-    private static strictfp class NestedClass {
-    }
-
-    protected abstract class AbstractNestedClass {
-        /**
-         * Another doc comment.
-         *
-         * This one has multiple lines.
-         */
-        void myMethod() throws RuntimeException , Error {}
-
-        abstract void myAbstractMethod();
-    }
-
-    void VarArgsMethod1(Number... num) {
-        ;
-    }
-
-    void VarArgsMethod2(float f, double d, Number... num) {
-        ;
-    }
-}
-
-@interface Colors {
-}
-
-interface Inter {
-    void interfaceMethod();
-}
-
-enum MyEnum {
-    RED,
-    GREEN,
-    BLUE;
-}
--- a/test/tools/apt/Basics/Misc.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * Class with miscellaneous structures to exercise printing.
- */
-
-import java.util.Collection;
-
-public final class  Misc<T> implements Marker2, Marker3 {
-    private static final long longConstant = Long.MAX_VALUE;
-
-    private static final String asciispecials = "\t\n\u0007";
-
-    public void covar(Collection<? extends T> s) {return;}
-
-    public void contravar(Collection<? super T> s) {return;}
-
-    public <S> S varUse(int i) {return null;}
-
-    Object o = (new Object() {});       // verify fix for 5019108
-}
-
-interface Marker1 {}
-
-interface Marker2 extends Marker1 {}
-
-interface Marker3 {}
--- a/test/tools/apt/Basics/MyMarker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-public @interface MyMarker {
-}
--- a/test/tools/apt/Basics/MySimple.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-public @interface MySimple {
-    String value() default "default";
-}
--- a/test/tools/apt/Basics/NestedClassAnnotations.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import annot.*;
-import annot.annot2.*;
-
-public class NestedClassAnnotations {
-    static double d;
-
-    public void foo() {
-        return;
-    }
-
-    public static void baz() {
-    }
-
-    private double bar(int baz) {
-        @AnnotShangri_la
-        int local = 0;
-        return (double) baz;
-    }
-
-    @MySimple("value") @MyMarker
-    @AnnotMarker @AnnotSimple("foo")
-    @AnnotMarker2 @AnnotSimple2("bar")
-    static class NestedClass {
-        protected int field;
-    }
-}
--- a/test/tools/apt/Basics/ParameterAnnotations.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import annot.*;
-import annot.annot2.*;
-
-public class ParameterAnnotations {
-    static double d;
-
-    public void foo() {
-        return;
-    }
-
-    private double bar(@MySimple("value") @MyMarker
-                       @AnnotMarker @AnnotSimple("foo")
-                       @AnnotMarker2 @AnnotSimple2("bar")
-                       int baz) {
-        @AnnotShangri_la
-        int local = 0;
-        return (double) baz;
-    }
-
-    static class NestedClass {
-        protected int field;
-    }
-}
--- a/test/tools/apt/Basics/StaticFieldAnnotations.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import annot.*;
-import annot.annot2.*;
-
-public class StaticFieldAnnotations {
-    @MySimple("value") @MyMarker
-    @AnnotMarker @AnnotSimple("foo")
-    @AnnotMarker2 @AnnotSimple2("bar")
-    static double d;
-
-    public void foo() {
-        return;
-    }
-
-    private double bar(int baz) {
-        @AnnotShangri_la
-        int local = 0;
-        return (double) baz;
-    }
-
-    static class NestedClass {
-        protected int field;
-    }
-}
--- a/test/tools/apt/Basics/StaticMethodAnnotations.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import annot.*;
-import annot.annot2.*;
-
-public class StaticMethodAnnotations {
-    static double d;
-
-    public void foo() {
-        return;
-    }
-
-    @MySimple("value") @MyMarker
-    @AnnotMarker @AnnotSimple("foo")
-    @AnnotMarker2 @AnnotSimple2("bar")
-    public static void baz() {
-    }
-
-    private double bar(int baz) {
-        @AnnotShangri_la
-        int local = 0;
-        return (double) baz;
-    }
-
-    static class NestedClass {
-        protected int field;
-    }
-}
--- a/test/tools/apt/Basics/TestGetPackageApf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * This class is used to test getPackage on classes that are
- * not already loaded.
- */
-public class TestGetPackageApf implements AnnotationProcessorFactory {
-    // Process any set of annotations
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("*"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new TestGetPackageAp(env);
-    }
-
-    private static class TestGetPackageAp implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        TestGetPackageAp(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        public void process() {
-            boolean failed = false;
-            String packageNames[] = {
-                "", // unnamed package
-                "java.lang.annotation",
-                "java.lang",
-                "java.util",
-                "java.awt.image.renderable",
-                "foo.bar",
-                "foo",
-                "p1",
-                // "p1.p2", // class p1.p2 obscures package p1.p2
-            };
-
-            for(String packageName: packageNames) {
-                PackageDeclaration p = env.getPackage(packageName);
-                if (p == null) {
-                    failed = true;
-                    System.err.println("ERROR: No declaration found for ``" + packageName + "''.");
-                }
-                else if (!packageName.equals(p.getQualifiedName())) {
-                    failed = true;
-                    System.err.println("ERROR: Unexpected package name; expected " + packageName +
-                                       "got " + p.getQualifiedName());
-                }
-            }
-
-            String notPackageNames[] = {
-                "XXYZZY",
-                "java.lang.String",
-                "1",
-                "1.2",
-                "3.14159",
-                "To be or not to be is a tautology",
-                "1+2=3",
-            };
-
-            for(String notPackageName: notPackageNames) {
-                PackageDeclaration p = env.getPackage(notPackageName);
-                if (p != null) {
-                    failed = true;
-                    System.err.println("ERROR: Unexpected declaration: ``" + p + "''.");
-                }
-            }
-
-            if (failed)
-                throw new RuntimeException("Errors found testing getPackage.");
-        }
-    }
-}
--- a/test/tools/apt/Basics/TestGetTypeDeclarationApf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * This class is used to test getTypeDeclaration on classes that are
- * not already loaded.
- */
-public class TestGetTypeDeclarationApf implements AnnotationProcessorFactory {
-    // Process any set of annotations
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("*"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new TestGetTypeDeclarationAp(env);
-    }
-
-    private static class TestGetTypeDeclarationAp implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        TestGetTypeDeclarationAp(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        public void process() {
-            String classNames[] = {
-                "java.lang.String",             // should be already available
-                "java.lang.Thread.State",       // should be already available
-                "java.util.Collection",
-                "java.util.Map.Entry",
-                "foo.bar.Baz.Xxyzzy.Wombat",
-                "foo.bar.Baz.Xxyzzy",
-                "foo.bar.Baz",
-                "foo.bar.Quux",
-                "foo.bar.Quux.Xxyzzy",
-                "foo.bar.Quux.Xxyzzy.Wombat",
-                "NestedClassAnnotations",
-                "NestedClassAnnotations.NestedClass",
-            };
-
-            for(String className: classNames) {
-                TypeDeclaration t = env.getTypeDeclaration(className);
-                if (t == null)
-                    throw new RuntimeException("No declaration found for " + className);
-                if (! t.getQualifiedName().equals(className))
-                    throw new RuntimeException("Class with wrong name found for " + className);
-            }
-
-            // Test obscuring behavior; i.e. nested class C1 in class
-            // p1 where p1 is member of package p2 should be favored
-            // over class C1 in package p1.p2.
-            String nonuniqueCanonicalNames[] = {
-                "p1.p2.C1",
-            };
-            for(String className: nonuniqueCanonicalNames) {
-                ClassDeclaration c1 = (ClassDeclaration) env.getTypeDeclaration(className);
-                ClassDeclaration c2 = (ClassDeclaration) c1.getDeclaringType();
-                PackageDeclaration p     = env.getPackage("p1");
-
-                if (!p.equals(c1.getPackage())  ||
-                    c2 == null ||
-                    !"C1".equals(c1.getSimpleName())) {
-                    throw new RuntimeException("Bad class declaration");
-                }
-            }
-
-            String notClassNames[] = {
-                "",
-                "XXYZZY",
-                "java",
-                "java.lang",
-                "java.lang.Bogogogous",
-                "1",
-                "1.2",
-                "3.14159",
-                "To be or not to be is a tautology",
-                "1+2=3",
-                "foo+.x",
-                "foo+x",
-                "+",
-                "?",
-                "***",
-                "java.*",
-            };
-
-            for(String notClassName: notClassNames) {
-                Declaration t = env.getTypeDeclaration(notClassName);
-                if (t != null) {
-                    System.err.println("Unexpected declaration:" + t);
-                    throw new RuntimeException("Declaration found for ``" + notClassName + "''.");
-                }
-            }
-
-        }
-    }
-}
--- a/test/tools/apt/Basics/annot/AnnotMarker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package annot;
-
-public @interface AnnotMarker {
-}
--- a/test/tools/apt/Basics/annot/AnnotShangri_la.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package annot;
-
-/*
- * This annotation is used by the tests only to annotate local
- * variables; therefore, this annotation should not affect the
- * discovery process and should not appear in the list printed by
- * -XListAnnotationTypes.
- */
-public @interface AnnotShangri_la {
-}
--- a/test/tools/apt/Basics/annot/AnnotSimple.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package annot;
-
-public @interface AnnotSimple {
-    String value() default "default";
-}
--- a/test/tools/apt/Basics/annot/annot2/AnnotMarker2.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package annot.annot2;
-
-public @interface AnnotMarker2 {
-}
--- a/test/tools/apt/Basics/annot/annot2/AnnotSimple2.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package annot.annot2;
-
-public @interface AnnotSimple2 {
-    String value() default "default";
-}
--- a/test/tools/apt/Basics/apt.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/apt/Basics/apt.sh	Tue May 29 00:27:58 2012 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,10 @@
 #
 
 # @test
-# @bug 4908512 5024825 4957203 4993280 4996963 6174696 6177059
+# @bug 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249
 # @run shell ../verifyVariables.sh
-# @build Milk MethodAnnotations NestedClassAnnotations StaticFieldAnnotations StaticMethodAnnotations ParameterAnnotations 
 # @run shell apt.sh
-# @summary test consistency of annotation discovery
+# @summary Make sure apt is removed and doesn't come back
 # @author Joseph D. Darcy
 
 OS=`uname -s`;
@@ -41,136 +40,24 @@
 	;;
 esac
 
-# Construct path to apt executable
-APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -XDsuppress-tool-api-removal-message "
-
-printf "%s\n" "-classpath ${TESTCLASSES}"                    > options
-printf "%s\n" "-factorypath ./nullap.jar"                   >> options
-printf "%s\n" "-sourcepath ${TESTSRC} "                     >> options
-printf "%s\n" "-nocompile"                                  >> options
-printf "%s\n" "-XListAnnotationTypes"                       >> options
-
-printf "%s\n" "-classpath ${TESTCLASSES}"                    > options1
-printf "%s\n" "-factorypath ./nullap.jar"                   >> options1
-printf "%s\n" "-sourcepath ${TESTSRC} "                     >> options1
-printf "%s\n" "-nocompile"                                  >> options1
-printf "%s\n" "-XListAnnotationTypes"                       >> options1
-printf "%s\n" "-XclassesAsDecls"                            >> options1
-
+# Verify apt executable does not exist
+if [ -f "${TESTJAVA}/bin/apt" -o -f "${TESTJAVA}/bin/apt.exe" ];then
+    echo "apt executable should not exist."
+    exit 1
+fi
 
 # Construct path to javac executable
 JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
-JAR="${TESTJAVA}/bin/jar "
 
-$JAVAC ${TESTSRC}/NullAPF.java \
-${TESTSRC}/FreshnessApf.java  \
-${TESTSRC}/TestGetTypeDeclarationApf.java \
-${TESTSRC}/TestGetPackageApf.java
+$JAVAC ${TESTSRC}/NullAPF.java
 RESULT=$?
 
 case "${RESULT}" in
         0  )
-        ;;
+        echo "Compilation of apt-using source passed improperly."
+        exit 1
+	;;
 
         * )
-        echo "Compilation failed."
-        exit 1
+	;;
 esac
-
-echo "Making services directory and copying services information."
-mkdir -p META-INF/services
-cp ${TESTSRC}/com.sun.mirror.apt.AnnotationProcessorFactory ./META-INF/services
-$JAR cvf0 nullap.jar NullAPF*.class META-INF
-
-ANNOTATION_FILES="${TESTSRC}/ClassAnnotations.java \
-${TESTSRC}/MethodAnnotations.java \
-${TESTSRC}/NestedClassAnnotations.java \
-${TESTSRC}/StaticFieldAnnotations.java \
-${TESTSRC}/StaticMethodAnnotations.java \
-${TESTSRC}/ParameterAnnotations.java"
-
-for i in ${ANNOTATION_FILES}
-do
-	printf "%s\n" "Testing annotations on source file ${i}"
-	${APT} @options ${i} 2> result.txt
-	diff ${DIFFOPTS} ${TESTSRC}/golden.txt result.txt
-
-	RESULT=$?
-	case "$RESULT" in
-	        0  )
-	        ;;
-
-	        * )
-	        echo "Unexpected set of annotations on source files found."
-	        exit 1
-	esac
-
-	CLASS=`basename ${i} .java`
-	printf "%s\n" "Testing annotations on class file ${CLASS}"
-	${APT} @options1 ${CLASS} 2> result2.txt
-	diff ${DIFFOPTS} ${TESTSRC}/golden.txt result2.txt
-
-	RESULT=$?
-	case "$RESULT" in
-	        0  )
-	        ;;
-
-	        * )
-	        echo "Unexpected set of annotations on class files found."
-	        exit 1
-	esac
-done
-
-# Verify source files are favored over class files
-
-printf "%s\n" "-factorypath ."			 > options2
-printf "%s\n" "-factory FreshnessApf"		>> options2
-printf "%s\n" "-sourcepath ${TESTSRC}"		>> options2
-printf "%s\n" "-classpath  ${TESTCLASSES}"	>> options2
-printf "%s\n" "-nocompile"			>> options2
-
-${APT} @options2 ${TESTSRC}/Indirect.java
-
-RESULT=$?
-case "$RESULT" in
-        0  )
-        ;;
-
-        * )
-        exit 1
-esac
-
-# Verify new classes can be loaded by getTypeDeclaration
-
-printf "%s\n" "-factorypath ."			 	> options3
-printf "%s\n" "-factory TestGetTypeDeclarationApf"	>> options3
-printf "%s\n" "-sourcepath ${TESTSRC}"			>> options3
-
-# ${APT} @options3
-
-RESULT=$?
-case "$RESULT" in
-        0  )
-        ;;
-
-        * )
-        exit 1
-esac
-
-# Verify packages can be loaded by getPackage
-
-printf "%s\n" "-factorypath ."			 	> options4
-printf "%s\n" "-factory TestGetPackageApf"		>> options4
-printf "%s\n" "-sourcepath ${TESTSRC}"			>> options4
-
-${APT} @options4
-
-RESULT=$?
-case "$RESULT" in
-        0  )
-        ;;
-
-        * )
-        exit 1
-esac
-exit 0
--- a/test/tools/apt/Basics/com.sun.mirror.apt.AnnotationProcessorFactory	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-NullAPF
--- a/test/tools/apt/Basics/foo/bar/Baz.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package foo.bar;
-
-public class Baz {
-    public class Xxyzzy {
-        public class Wombat {
-        }
-    }
-
-}
--- a/test/tools/apt/Basics/foo/bar/Quux.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package foo.bar;
-
-public class Quux {
-    public class Xxyzzy {
-        public class Wombat {
-        }
-    }
-
-}
--- a/test/tools/apt/Basics/golden.txt	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Set of annotations found:[MyMarker, MySimple, annot.AnnotMarker, annot.AnnotSimple, annot.annot2.AnnotMarker2, annot.annot2.AnnotSimple2]
--- a/test/tools/apt/Basics/goldenAggregate.txt	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-public class Aggregate {
-
-  private Aggregate();
-
-  private static double hypot(double arg0,
-    double arg1);
-
-  public static void main(java.lang.String[] arg0);
-
-  public boolean equals(Aggregate arg0);
-
-  public int hashcode();
-}
--- a/test/tools/apt/Basics/p1/p2.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package p1;
-
-public class p2 {
-    public static class C1 {}
-}
--- a/test/tools/apt/Basics/p1/p2/C1.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package p1.p2;
-
-public class C1 {
-}
--- a/test/tools/apt/Basics/print.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 5008759 4998341 5018369 5032476 5060121 5096932 5096931
-# @run shell ../verifyVariables.sh
-# @run shell print.sh
-# @summary test availabilty of print option
-# @author Joseph D. Darcy
-
-OS=`uname -s`;
-case "${OS}" in
-        CYGWIN* )
-                DIFFOPTS="--strip-trailing-cr"
-        ;;
-
-	* )
-	;;
-esac
-
-# Compile file directly, without TESTJAVACOPTS
-# Don't use @build or @compile as these implicitly use jtreg -javacoption values
-# and it is important that this file be compiled as expected, for later comparison
-# against a golden file.
-"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -d ${TESTCLASSES} ${TESTSRC}/Aggregate.java
-
-# Construct path to apt executable
-APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} \
--print "
-
-printf "%s\n" "APT = ${APT}"
-
-PRINT_FILES="${TESTSRC}/MisMatch.java \
-${TESTSRC}/GenClass.java \
-${TESTSRC}/Misc.java \
-${TESTSRC}/Lacuna.java"
-
-for i in ${PRINT_FILES}
-do
-	# Delete any existing class file
-        FILENAME=`basename $i .java`
-	rm -f ${FILENAME}.class
-
-        printf "%s\n" "Printing ${i}"
-        ${APT} ${i}
-
-        RESULT=$?
-        case "$RESULT" in
-                0  )
-                ;;
-
-                * )
-                echo "Problem printing file ${i}."
-                exit 1
-        esac
-
-        # Verify compilation did not occur
-	if [ -f ${FILENAME}.class ]; then
-		printf "Improper compilation occured for %s.\n" ${i}
-		exit 1
-	fi
-	
-done
-
-# check for mutliple methods and no static initializer
-
-${APT} -XclassesAsDecls -cp ${TESTCLASSES} -print Aggregate > aggregate.txt
-diff ${DIFFOPTS} aggregate.txt ${TESTSRC}/goldenAggregate.txt
-
-RESULT=$?
-case "$RESULT" in
-        0  )
-        ;;
-
-        * )
-        echo "Expected output not received"
-        exit 1
-esac
-
-exit 0
--- a/test/tools/apt/Compile/ClassDeclApf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import java.io.*;
-
-import static java.util.Collections.*;
-
-/*
- * This class is used to test the ability to store static state across
- * apt rounds.
- */
-public class ClassDeclApf implements AnnotationProcessorFactory {
-    static int round = -1;
-
-    // Process any set of annotations
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("*"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment env) {
-        return new ClassDeclAp(env);
-    }
-
-    private static class ClassDeclAp implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        ClassDeclAp(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        // Simple inefficient drain
-        void drain(InputStream is, OutputStream os) {
-            try {
-            while (is.available() > 0 )
-                os.write(is.read());
-            } catch (java.io.IOException ioe) {
-                throw new RuntimeException(ioe);
-            }
-
-        }
-
-        public void process() {
-            int size = env.getSpecifiedTypeDeclarations().size();
-
-            try {
-                round++;
-                switch (size) {
-                case 0:
-                    if (round == 0) {
-                        drain(new FileInputStream("./tmp/classes/Round1Class.class"),
-                              env.getFiler().createClassFile("Round1Class"));
-                    } else
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    break;
-
-                case 1:
-                    if (round == 1) {
-                        drain(new FileInputStream("./tmp/classes/AhOneClass.class"),
-                              env.getFiler().createClassFile("AhOneClass"));
-
-                        drain(new FileInputStream("./tmp/classes/AndAhTwoClass.class"),
-                              env.getFiler().createClassFile("AndAhTwoClass"));
-                    } else
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    break;
-                case 2:
-                    if (round != 2) {
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    }
-                    break;
-                }
-
-            } catch (java.io.IOException ioe) {
-                    throw new RuntimeException();
-                }
-
-            }
-
-    }
-}
--- a/test/tools/apt/Compile/ClassDeclApf2.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import java.io.*;
-
-import static java.util.Collections.*;
-
-/*
- * This class is used to test the the interaction of -XclassesAsDecls
- * with command line options handling.
- */
-public class ClassDeclApf2 implements AnnotationProcessorFactory {
-    static int round = -1;
-
-    // Process any set of annotations
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("*"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment env) {
-        return new ClassDeclAp(env);
-    }
-
-    private static class ClassDeclAp implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        ClassDeclAp(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        // Simple inefficient drain
-        void drain(InputStream is, OutputStream os) {
-            try {
-            while (is.available() > 0 )
-                os.write(is.read());
-            } catch (java.io.IOException ioe) {
-                throw new RuntimeException(ioe);
-            }
-        }
-
-        public void process() {
-            int size = env.getSpecifiedTypeDeclarations().size();
-            Filer f = env.getFiler();
-
-            try {
-                round++;
-                switch (size) {
-                case 3:
-                    if (round == 0) {
-                        drain(new FileInputStream("./tmp/classes/Round1Class.class"),
-                              f.createClassFile("Round1Class"));
-                    } else
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    break;
-
-                case 1:
-                    if (round == 1) {
-                        f.createSourceFile("AhOne").println("public class AhOne {}");
-                        System.out.println("Before writing AndAhTwoClass");
-                        drain(new FileInputStream("./tmp/classes/AndAhTwoClass.class"),
-                              f.createClassFile("AndAhTwoClass"));
-                        System.out.println("After writing AndAhTwoClass");
-                    } else
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    break;
-
-                case 2:
-                    if (round != 2) {
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    }
-                    break;
-                default:
-                    throw new RuntimeException("Unexpected number of declarations:" + size +
-                                               "\n Specified:" + env.getSpecifiedTypeDeclarations() +
-                                               "\n Included:" + env.getTypeDeclarations() );
-                }
-
-            } catch (java.io.IOException ioe) {
-                throw new RuntimeException(ioe);
-            }
-        }
-    }
-}
--- a/test/tools/apt/Compile/Dummy1.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-@Round1 class Dummy1{}
--- a/test/tools/apt/Compile/ErrorAPF.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Construct a processor that does nothing but report an error.
- */
-public class ErrorAPF implements AnnotationProcessorFactory {
-    static class ErrorAP implements AnnotationProcessor {
-        AnnotationProcessorEnvironment env;
-        ErrorAP(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        public void process() {
-            Messager messager = env.getMessager();
-            messager.printError("It's a mad, mad, mad, mad world");
-            messager.printError("Something wicked this way comes");
-
-            for(TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations())
-                messager.printError(typeDecl.getPosition(), "Boring class name");
-        }
-    }
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"*"};
-        supportedTypes = unmodifiableCollection(Arrays.asList(types));
-    }
-
-    static Collection<String> supportedOptions;
-    static {
-        String options[] = {""};
-        supportedOptions = unmodifiableCollection(Arrays.asList(options));
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment env) {
-        return new ErrorAP(env);
-    }
-}
--- a/test/tools/apt/Compile/HelloAnnotation.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-/* /nodynamiccopyright/ */
-import java.lang.annotation.*;
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-@HelloAnnotation
-@interface HelloAnnotation {
-    Target value() default @Target(ElementType.METHOD);
-}
--- a/test/tools/apt/Compile/HelloWorld.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-/* /nodynamiccopyright/ */
-public class HelloWorld {
-    public static void main(String argv[]) {
-        System.out.println("Hello World.");
-    }
-}
--- a/test/tools/apt/Compile/Round1Apf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import java.io.File;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Factory to help test updated discovery policy.
- */
-public class Round1Apf implements AnnotationProcessorFactory {
-    // Process @Round1
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("Round1"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    private static int round = 0;
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new Round1Ap(env, atds.size() == 0);
-    }
-
-    private static class Round1Ap implements AnnotationProcessor, RoundCompleteListener {
-        private final AnnotationProcessorEnvironment env;
-        private final boolean empty;
-
-        Round1Ap(AnnotationProcessorEnvironment env, boolean empty) {
-            this.env = env;
-            this.empty = empty;
-        }
-
-        public void process() {
-            Round1Apf.round++;
-            try {
-                if (!empty) {
-                    Filer f = env.getFiler();
-                    f.createSourceFile("Dummy2").println("@Round2 class Dummy2{}");
-                    f.createTextFile(Filer.Location.SOURCE_TREE,
-                                     "",
-                                     new File("foo.txt"),
-                                     null).println("xxyzzy");
-                    f.createClassFile("Vacant");
-                    f.createBinaryFile(Filer.Location.CLASS_TREE,
-                                       "",
-                                       new File("onezero"));
-                }
-            } catch (java.io.IOException ioe) {
-                throw new RuntimeException(ioe);
-            }
-
-            System.out.println("Round1Apf: " + round);
-            env.addListener(this);
-        }
-
-        public void roundComplete(RoundCompleteEvent event) {
-            RoundState rs = event.getRoundState();
-
-            if (event.getSource() != this.env)
-                throw new RuntimeException("Wrong source!");
-
-            Filer f = env.getFiler();
-            try {
-                f.createSourceFile("AfterTheBell").println("@Round2 class AfterTheBell{}");
-                throw new RuntimeException("Inappropriate source file creation.");
-            } catch (java.io.IOException ioe) {}
-
-
-            System.out.printf("\t[final round: %b, error raised: %b, "+
-                              "source files created: %b, class files created: %b]%n",
-                              rs.finalRound(),
-                              rs.errorRaised(),
-                              rs.sourceFilesCreated(),
-                              rs.classFilesCreated());
-
-            System.out.println("Round1Apf: " + round + " complete");
-        }
-    }
-}
--- a/test/tools/apt/Compile/Round2Apf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import java.io.IOException;
-import java.io.File;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Factory to help test updated discovery policy.
- */
-public class Round2Apf implements AnnotationProcessorFactory {
-    // Process @Round2
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("Round2"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    private static int round = 0;
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new Round2Ap(env, atds.size() == 0);
-    }
-
-    private static class Round2Ap implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        private final boolean empty;
-
-        Round2Ap(AnnotationProcessorEnvironment env, boolean empty) {
-            this.env = env;
-            this.empty = empty;
-        }
-
-        public void process() {
-            Round2Apf.round++;
-            Filer f = env.getFiler();
-            try {
-                f.createSourceFile("Dummy2").println("@Round2 class Dummy2{}");
-                throw new RuntimeException("Duplicate file creation allowed");
-            } catch (IOException io) {}
-
-            try {
-                f.createTextFile(Filer.Location.SOURCE_TREE,
-                                 "",
-                                 new File("foo.txt"),
-                                 null).println("xxyzzy");
-                throw new RuntimeException("Duplicate file creation allowed");
-            } catch (IOException io) {}
-
-            try {
-                f.createClassFile("Vacant");
-                throw new RuntimeException("Duplicate file creation allowed");
-            } catch (IOException io) {}
-
-            try {
-                f.createBinaryFile(Filer.Location.CLASS_TREE,
-                                   "",
-                                   new File("onezero"));
-                throw new RuntimeException("Duplicate file creation allowed");
-            } catch (IOException io) {}
-
-
-
-            try {
-                if (!empty) {
-                    // Create corresponding files of opposite kind to
-                    // the files created by Round1Apf; these should
-                    // only generate warnings
-                    f.createClassFile("Dummy2");
-                    f.createSourceFile("Vacant").println("class Vacant{}");
-
-                    f.createSourceFile("Dummy3").println("@Round3 class Dummy3{}");
-
-                    // This should generated a warning too
-                    f.createClassFile("Dummy3");
-                }
-            } catch (java.io.IOException ioe) {
-                throw new RuntimeException(ioe);
-            }
-
-            System.out.println("Round2Apf: " + round);
-        }
-    }
-}
--- a/test/tools/apt/Compile/Round3Apf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Factory to help test updated discovery policy.
- */
-public class Round3Apf implements AnnotationProcessorFactory {
-    // Process @Round3
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("Round3"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    private static int round = 0;
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new Round3Ap(env, atds.size() == 0);
-    }
-
-    private static class Round3Ap implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        private final boolean empty;
-
-        Round3Ap(AnnotationProcessorEnvironment env, boolean empty) {
-            this.env = env;
-            this.empty = empty;
-        }
-
-        public void process() {
-            Round3Apf.round++;
-            try {
-                if (!empty)
-                    env.getFiler().createSourceFile("Dummy4").println("@Round4 class Dummy4{}");
-            } catch (java.io.IOException ioe) {
-                throw new RuntimeException(ioe);
-            }
-
-            System.out.println("Round3Apf: " + round);
-        }
-    }
-}
--- a/test/tools/apt/Compile/Round4Apf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Factory to help test updated discovery policy.
- */
-public class Round4Apf implements AnnotationProcessorFactory {
-    // Process @Round4
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("Round4"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    private static int round = 0;
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new Round4Ap(env, atds.size() == 0);
-    }
-
-    private static class Round4Ap implements AnnotationProcessor, RoundCompleteListener {
-        private final AnnotationProcessorEnvironment env;
-        private final boolean empty;
-
-        Round4Ap(AnnotationProcessorEnvironment env, boolean empty) {
-            this.env = env;
-            this.empty = empty;
-        }
-
-        public void process() {
-            Round4Apf.round++;
-            try {
-                if (!empty)
-                    env.getFiler().createSourceFile("Dummy5").println("@Round5 class Dummy5{}");
-            } catch (java.io.IOException ioe) {
-                throw new RuntimeException(ioe);
-            }
-
-            System.out.println("Round4Apf: " + round);
-            env.addListener(this);
-        }
-
-        public void roundComplete(RoundCompleteEvent event) {
-            RoundState rs = event.getRoundState();
-
-            System.out.println("\t" + rs.toString());
-
-            System.out.println("Round4Apf: " + round + " complete");
-
-            if (rs.finalRound()) {
-                System.out.println("Valediction");
-            }
-        }
-    }
-}
--- a/test/tools/apt/Compile/Rounds.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-@interface Round1{}
-
-@interface Round2{}
-
-@interface Round3{}
-
-@interface Round4{}
-
-@interface Round5{}
--- a/test/tools/apt/Compile/StaticApf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-
-/*
- * This class is used to test the ability to store static state across
- * apt rounds.
- */
-public class StaticApf implements AnnotationProcessorFactory {
-    static int round = -1;
-
-    // Process any set of annotations
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("*"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment env) {
-        return new StaticAp(env);
-    }
-
-    private static class StaticAp implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        StaticAp(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        public void process() {
-            int size = env.getSpecifiedTypeDeclarations().size();
-
-            try {
-                round++;
-                switch (size) {
-                case 0:
-                    if (round == 0) {
-                        env.getFiler().createSourceFile("Round1").print("class Round1 {}");
-                    } else
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    break;
-
-                case 1:
-                    if (round == 1) {
-                        env.getFiler().createSourceFile("AhOne").print("class AhOne {}");
-                        env.getFiler().createSourceFile("AndAhTwo").print("class AndAhTwo {}");
-                        env.getFiler().createClassFile("Foo");
-                    } else
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    break;
-                case 2:
-                    if (round != 2) {
-                        throw new RuntimeException("Got " + size + " decl's in round " + round);
-                    }
-                    break;
-                }
-
-            } catch (java.io.IOException ioe) {
-                    throw new RuntimeException();
-                }
-
-            }
-
-    }
-}
--- a/test/tools/apt/Compile/WarnAPF.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Map;
-import java.util.Arrays;
-
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Construct a processor that does nothing but report a warning.
- */
-public class WarnAPF implements AnnotationProcessorFactory {
-    static class WarnAP implements AnnotationProcessor {
-        AnnotationProcessorEnvironment env;
-        WarnAP(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        public void process() {
-            Messager messager = env.getMessager();
-            messager.printWarning("Beware the ides of March!");
-
-            for(TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations()) {
-                messager.printNotice(typeDecl.getPosition(),  "You are about to be warned");
-                messager.printWarning(typeDecl.getPosition(), "Strange class name");
-
-                for(AnnotationMirror annotMirror : typeDecl.getAnnotationMirrors()) {
-                    messager.printNotice("MIRROR " + annotMirror.getPosition().toString());
-
-                     Map<AnnotationTypeElementDeclaration,AnnotationValue> map =
-                         annotMirror.getElementValues();
-                     if (map.keySet().size() > 0)
-                         for(AnnotationTypeElementDeclaration key : map.keySet() ) {
-                             AnnotationValue annotValue = map.get(key);
-                             Object o = annotValue.getValue();
-                             // asserting getPosition is non-null
-                             messager.printNotice("VALUE " + annotValue.getPosition().toString());
-                         }
-                     else {
-                         Collection<AnnotationTypeElementDeclaration> ateds =
-                         annotMirror.getAnnotationType().getDeclaration().getMethods();
-                         for(AnnotationTypeElementDeclaration ated : ateds ) {
-                             AnnotationValue annotValue = ated.getDefaultValue();
-                             Object o = annotValue.getValue();
-                             messager.printNotice("VALUE " + "HelloAnnotation.java:5");
-                         }
-                     }
-                }
-            }
-        }
-    }
-
-    static final Collection<String> supportedTypes;
-    static {
-        String types[] = {"*"};
-        supportedTypes = unmodifiableCollection(Arrays.asList(types));
-    }
-    public Collection<String> supportedAnnotationTypes() {return supportedTypes;}
-
-    static final Collection<String> supportedOptions;
-    static {
-        String options[] = {""};
-        supportedOptions = unmodifiableCollection(Arrays.asList(options));
-    }
-    public Collection<String> supportedOptions() {return supportedOptions;}
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment env) {
-        return new WarnAP(env);
-    }
-}
--- a/test/tools/apt/Compile/WrappedStaticApf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-
-/*
- * Pass an instantiated StaticApf object to the
- * com.sun.tools.apt.Main.process entry point.
- */
-public class WrappedStaticApf {
-    public static void main(String argv[]) {
-        AnnotationProcessorFactory factory = new StaticApf();
-        System.exit(com.sun.tools.apt.Main.process(factory, argv));
-    }
-}
--- a/test/tools/apt/Compile/compile.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,533 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 5033855 4990902 5023880 5043516 5048534 5048535 5041279 5048539 5067261 5068145 5023881 4996963 5095716 6191667 6433634
-# @run shell ../verifyVariables.sh
-# @build ErrorAPF
-# @build WarnAPF
-# @build StaticApf
-# @build ClassDeclApf
-# @build ClassDeclApf2
-# @build Rounds
-# @build Round1Apf Round2Apf Round3Apf Round4Apf
-# @build WrappedStaticApf
-# @run shell compile.sh
-# @summary Test simple usages of apt, including delegating to javac
-# @author Joseph D. Darcy
-
-# If the file *does* exist, exit with an error
-TestNoFile() {
-        if [ -f ${1} ]; then
-                printf "%s\n" "File ${1} found."
-                exit 1
-        fi
-}
-
-# If the file does not exist, exit with an error
-TestFile() {
-        if [ ! -f ${1} ]; then
-                printf "%s\n" "File ${1} not found."
-                exit 1
-        fi
-}
-
-
-OS=`uname -s`;
-case "${OS}" in
-        Windows* )
-                SEP=";"
-        ;;
-
-        CYGWIN* )
-		DIFFOPTS="--strip-trailing-cr"
-                SEP=";"
-        ;;
-
-        * )
-        SEP=":"
-        ;;
-esac
-
-
-APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -XDsuppress-tool-api-removal-message "
-JAVA="${TESTJAVA}/bin/java ${TESTVMOPTS} "
-JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} "
-
-unset CLASSPATH
-
-
-# ---------------------------------------------------------------
-echo "Verify that source 1.6 is not supported
-rm -f HelloWorld.class
-
-printf "%s\n" "-source 1.6"     > options0
-printf "%s\n" "${TESTSRC}/HelloWorld.java"  >> options0
-${APT} @options0
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        echo "FAILED: accepted source 1.6"
-	exit 1
-        ;;
-esac
-
-TestNoFile "HelloWorld.class"
-
-# ---------------------------------------------------------------
-
-echo "Verify that target 1.6 is not supported
-rm -f HelloWorld.class
-
-printf "%s\n" "-target 1.6"     > options00
-printf "%s\n" "${TESTSRC}/HelloWorld.java"  >> options00
-${APT} @options00
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        echo "FAILED: accepted target 1.6"
-	exit 1
-        ;;
-esac
-
-TestNoFile "HelloWorld.class"
-
-# ---------------------------------------------------------------
-
-echo "Testing javac pass-through with -A in options file"
-rm -f HelloWorld.class
-
-printf "%s\n" "-A"     > options1
-printf "%s\n" "-d ."     >> options1
-printf "%s\n" "${TESTSRC}/HelloWorld.java"  >> options1
-${APT} @options1
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: javac with -A in options file did not compile"
-        exit 1
-esac
-TestFile "HelloWorld.class"
-
-
-# ---------------------------------------------------------------
-
-echo "Verifying reporting an error will prevent compilation"
-rm -f HelloWorld.class
-if [ ! -f HelloWorld.java ]; then
-	cp ${TESTSRC}/HelloWorld.java .
-fi
-
-
-printf "%s\n" "-factory ErrorAPF"            > options2
-printf "%s\n" "-d ."                        >> options2
-printf "%s\n" "-cp ${TESTCLASSES}"          >> options2
-printf "%s\n" "HelloWorld.java"             >> options2
-${APT} @options2 2> output
-
-TestNoFile "HelloWorld.class"
-
-diff ${DIFFOPTS} output ${TESTSRC}/golden.txt
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: did not record expected error messages"
-        exit 1
-esac
-
-
-
-# ---------------------------------------------------------------
-
-echo "Verifying reporting a warning *won't* prevent compilation"
-
-rm -f HelloAnnotation.class
-if [ ! -f HelloAnnotation.java ]; then
-	cp ${TESTSRC}/HelloAnnotation.java .
-fi
-
-
-printf "%s\n" "-factory WarnAPF"             > options3
-printf "%s\n" "-d ."                        >> options3
-printf "%s\n" "-cp ${TESTCLASSES}"          >> options3
-printf "%s\n" "HelloAnnotation.java"        >> options3
-${APT} @options3 2> output
-
-diff ${DIFFOPTS} output ${TESTSRC}/goldenWarn.txt
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: did not record expected warning messages"
-        exit 1
-esac
-
-TestFile "HelloAnnotation.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying static state is available across apt rounds; -factory, -cp"
-
-mkdir -p ./src
-mkdir -p ./class
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-
-printf "%s\n" "-factory StaticApf"           > options4
-printf "%s\n" "-s ./src"                    >> options4
-printf "%s\n" "-d ./class"                  >> options4
-printf "%s\n" "-cp ${TESTCLASSES}"          >> options4
-# printf "%s\n" "-XPrintAptRounds"            >> options4
-${APT} @options4
-
-TestFile "./class/AndAhTwo.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying static state is available across apt rounds; -factory, -factorypath"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-
-printf "%s\n" "-factory StaticApf"           > options5
-printf "%s\n" "-s ./src"                    >> options5
-printf "%s\n" "-d ./class"                  >> options5
-printf "%s\n" "-factorypath ${TESTCLASSES}" >> options5
-# printf "%s\n" "-XPrintAptRounds"          >> options5
-${APT} @options5
-
-TestFile "./class/AndAhTwo.class"
-
-# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-# Create jar file for StaticApf
-JAR="${TESTJAVA}/bin/jar "
-mkdir -p META-INF/services
-cp ${TESTSRC}/servicesStaticApf META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTCLASSES}/StaticApf*.class .
-${JAR} cf0 staticApf.jar StaticApf*.class META-INF
-
-# ---------------------------------------------------------------
-
-echo "Verifying static state is available across apt rounds; -cp"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-
-printf "%s\n" "-cp staticApf.jar"           > options6
-printf "%s\n" "-s ./src"                    >> options6
-printf "%s\n" "-d ./class"                  >> options6
-printf "%s\n" "-XPrintAptRounds"          >> options6
-${APT} @options6
-
-TestFile "./class/AndAhTwo.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying static state is available across apt rounds; -factorypath"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-
-printf "%s\n" "-factorypath staticApf.jar"   > options7
-printf "%s\n" "-s ./src"                    >> options7
-printf "%s\n" "-d ./class"                  >> options7
-printf "%s\n" "-XPrintAptRounds"            >> options7
-${APT} @options7
-
-TestFile "./class/AndAhTwo.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying -XclassesAsDecls handles class files properly"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-
-mkdir -p ./tmp/classes
-
-${JAVAC} -d ./tmp/classes ${TESTSRC}/src/Round1Class.java ${TESTSRC}/src/AhOneClass.java ${TESTSRC}/src/AndAhTwoClass.java
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: javac failed to succesfully compile."
-        exit 1
-esac
-
-printf "%s\n" "-factorypath ${TESTCLASSES}"  > options7a
-printf "%s\n" "-factory ClassDeclApf"       >> options7a
-printf "%s\n" "-s ./src"                    >> options7a
-printf "%s\n" "-d ./class"                  >> options7a
-printf "%s\n" "-XPrintAptRounds"            >> options7a
-printf "%s\n" "-XclassesAsDecls"            >> options7a
-${APT} @options7a
-
-TestFile "./class/AndAhTwoClass.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying -XclassesAsDecls works with command-line arguments"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-rm -Rf ./tmp/classes
-
-mkdir -p ./tmp/classes
-
-${JAVAC} -d ./tmp/classes ${TESTSRC}/src/Round1Class.java ${TESTSRC}/src/AndAhTwoClass.java
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: javac failed to succesfully compile."
-        exit 1
-esac
-
-printf "%s\n" "-factorypath ${TESTCLASSES}"  > options7b
-printf "%s\n" "-factory ClassDeclApf2"       >> options7b
-printf "%s\n" "-XPrintAptRounds"            >> options7b
-printf "%s\n" "-XclassesAsDecls"            >> options7b
-printf "%s\n" "-cp ${TESTCLASSES}"          >> options7b
-printf "%s\n" "ErrorAPF"                    >> options7b
-printf "%s\n" "WarnAPF"                     >> options7b
-printf "%s\n" "-s ./src"                    >> options7b
-printf "%s\n" "-d ./class"                  >> options7b
-printf "%s\n" "ClassDeclApf"                >> options7b
-${APT} @options7b
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: apt exited with an error code."
-        exit 1
-esac
-
-TestFile "./class/AndAhTwoClass.class"
-TestFile "./class/AhOne.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying -XclassesAsDecls works with all source files"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-rm -Rf ./tmp/classes
-
-mkdir -p ./tmp/classes
-
-${JAVAC} -d ./tmp/classes ${TESTSRC}/src/Round1Class.java ${TESTSRC}/src/AndAhTwoClass.java
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: javac failed to succesfully compile."
-        exit 1
-esac
-
-printf "%s\n" "-factorypath ${TESTCLASSES}"      > options7c
-printf "%s\n" "-factory ClassDeclApf2"          >> options7c
-printf "%s\n" "-s ./src"                        >> options7c
-printf "%s\n" "-d ./class"                      >> options7c
-printf "%s\n" "-sourcepath ${TESTSRC}"          >> options7c
-printf "%s\n" "${TESTSRC}/HelloAnnotation.java" >> options7c
-printf "%s\n" "${TESTSRC}/HelloWorld.java"      >> options7c
-printf "%s\n" "${TESTSRC}/Dummy1.java"          >> options7c
-printf "%s\n" "-XPrintAptRounds"                >> options7c
-printf "%s\n" "-XclassesAsDecls"                >> options7c
-printf "%s\n" "-cp ${TESTCLASSES}"              >> options7c
-${APT} @options7c
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: apt exited with an error code."
-        exit 1
-esac
-
-TestFile "./class/AndAhTwoClass.class"
-TestFile "./class/AhOne.class"
-TestFile "./class/HelloWorld.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying -XclassesAsDecls works with mixed class and source files"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-rm -Rf ./tmp/classes
-
-mkdir -p ./tmp/classes
-
-${JAVAC} -d ./tmp/classes ${TESTSRC}/src/Round1Class.java ${TESTSRC}/src/AndAhTwoClass.java
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: javac failed to succesfully compile."
-        exit 1
-esac
-
-printf "%s\n" "-factorypath ${TESTCLASSES}"  > options7d
-printf "%s\n" "-factory ClassDeclApf2"      >> options7d
-printf "%s\n" "-s ./src"                    >> options7d
-printf "%s\n" "-XclassesAsDecls"            >> options7d
-printf "%s\n" "ClassDeclApf"                >> options7d
-printf "%s\n" "-d ./class"                  >> options7d
-printf "%s\n" "ErrorAPF"                    >> options7d
-printf "%s\n" "-XPrintAptRounds"            >> options7d
-printf "%s\n" "${TESTSRC}/HelloWorld.java"  >> options7d
-printf "%s\n" "-cp ${TESTCLASSES}"          >> options7d
-${APT} @options7d
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: apt exited with an error code."
-        exit 1
-esac
-
-TestFile "./class/AndAhTwoClass.class"
-TestFile "./class/AhOne.class"
-TestFile "./class/HelloWorld.class"
-
-# ---------------------------------------------------------------
-
-echo "Testing productive factories are called on subsequent rounds"
-
-rm -Rf ./src/*
-rm -Rf ./class/*
-
-rm -Rf META-INF/services/*
-cp ${TESTSRC}/servicesRound1 META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTCLASSES}/Round1Apf*.class .
-${JAR} cf0 round1Apf.jar Round1Apf*.class META-INF
-
-rm -Rf META-INF/services/*
-cp ${TESTSRC}/servicesRound2 META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTCLASSES}/Round2Apf*.class .
-${JAR} cf0 round2Apf.jar Round2Apf*.class META-INF
-
-rm -Rf META-INF/services/*
-cp ${TESTSRC}/servicesRound3 META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTCLASSES}/Round3Apf*.class .
-${JAR} cf0 round3Apf.jar Round3Apf*.class META-INF
-
-rm -Rf META-INF/services/*
-cp ${TESTSRC}/servicesRound4 META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTCLASSES}/Round4Apf*.class .
-${JAR} cf0 round4Apf.jar Round4Apf*.class META-INF
-
-cp ${TESTCLASSES}/Round?.class .
-${JAR} cf0 rounds.jar Round?.class
-
-# cleanup file to prevent accidental discovery in current directory
-rm -Rf META-INF/services/*
-
-printf "%s\n" "-factorypath round1Apf.jar${SEP}round2Apf.jar${SEP}round3Apf.jar${SEP}round4Apf.jar"   > options8
-printf "%s\n" "-classpath rounds.jar"  >> options8
-printf "%s\n" "-s ./src"               >> options8
-printf "%s\n" "-d ./class"             >> options8
-#printf "%s\n" "-XPrintFactoryInfo"     >> options8
-#printf "%s\n" "-XPrintAptRounds"       >> options8
-printf "%s\n" "${TESTSRC}/Dummy1.java" >> options8
-${APT} @options8 > multiRoundOutput 2> multiRoundError
-
-diff ${DIFFOPTS} multiRoundOutput  ${TESTSRC}/goldenFactory.txt
-
-RESULT=$?
-case "$RESULT" in
-	0  )
-        ;;
-
-        * )
-        echo "FAILED: unexpected factory state"
-        exit 1
-esac
-
-TestFile "./class/Dummy5.class"
-
-# ---------------------------------------------------------------
-
-echo "Verifying static state with programmatic apt entry; no factory options"
-rm -Rf ./src/*
-rm -Rf ./class/*
-${JAVA} -cp ${TESTJAVA}/lib/tools.jar${SEP}${TESTCLASSES} WrappedStaticApf -s ./src -d ./class -XPrintAptRounds
-TestFile "./class/AndAhTwo.class"
-
-echo "Verifying static state with programmatic apt entry; -factory"
-rm -Rf ./src/*
-rm -Rf ./class/*
-${JAVA} -cp ${TESTJAVA}/lib/tools.jar${SEP}${TESTCLASSES} WrappedStaticApf -factory ErrorAPF -s ./src -d ./class -XPrintAptRounds
-TestFile "./class/AndAhTwo.class"
-
-echo "Verifying static state with programmatic apt entry; -factorypath"
-rm -Rf ./src/*
-rm -Rf ./class/*
-${JAVA} -cp ${TESTJAVA}/lib/tools.jar${SEP}${TESTCLASSES} WrappedStaticApf -factorypath round1Apf.jar -s ./src -d ./class -XPrintAptRounds
-TestFile "./class/AndAhTwo.class"
-
-echo "Verifying static state with programmatic apt entry; -factory and -factorypath"
-rm -Rf ./src/*
-rm -Rf ./class/*
-${JAVA} -cp ${TESTJAVA}/lib/tools.jar${SEP}${TESTCLASSES} WrappedStaticApf -factorypath round1Apf.jar -factory Round1Apf -s ./src -d ./class -XPrintAptRounds
-TestFile "./class/AndAhTwo.class"
-
-exit 0
--- a/test/tools/apt/Compile/golden.txt	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-error: It's a mad, mad, mad, mad world
-error: Something wicked this way comes
-HelloWorld.java:2: error: Boring class name
-public class HelloWorld {
-       ^
-3 errors
--- a/test/tools/apt/Compile/goldenFactory.txt	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-Round1Apf: 1
-	[final round: false, error raised: false, source files created: true, class files created: true]
-Round1Apf: 1 complete
-Round1Apf: 2
-Round2Apf: 1
-	[final round: false, error raised: false, source files created: true, class files created: true]
-Round1Apf: 2 complete
-Round1Apf: 3
-Round2Apf: 2
-Round3Apf: 1
-	[final round: false, error raised: false, source files created: true, class files created: false]
-Round1Apf: 3 complete
-Round1Apf: 4
-Round2Apf: 3
-Round3Apf: 2
-Round4Apf: 1
-	[final round: false, error raised: false, source files created: true, class files created: false]
-Round1Apf: 4 complete
-	[final round: false, error raised: false, source files created: true, class files created: false]
-Round4Apf: 1 complete
-Round1Apf: 5
-Round2Apf: 4
-Round3Apf: 3
-Round4Apf: 2
-	[final round: true, error raised: false, source files created: false, class files created: false]
-Round1Apf: 5 complete
-	[final round: true, error raised: false, source files created: false, class files created: false]
-Round4Apf: 2 complete
-Valediction
--- a/test/tools/apt/Compile/goldenWarn.txt	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-warning: Beware the ides of March!
-HelloAnnotation.java:6: Note: You are about to be warned
-@interface HelloAnnotation {
- ^
-HelloAnnotation.java:6: warning: Strange class name
-@interface HelloAnnotation {
- ^
-Note: MIRROR HelloAnnotation.java:6
-Note: VALUE HelloAnnotation.java:6
-Note: MIRROR HelloAnnotation.java:6
-Note: VALUE HelloAnnotation.java:6
-Note: MIRROR HelloAnnotation.java:6
-Note: VALUE HelloAnnotation.java:5
-2 warnings
--- a/test/tools/apt/Compile/servicesRound1	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Round1Apf
--- a/test/tools/apt/Compile/servicesRound2	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Round2Apf
--- a/test/tools/apt/Compile/servicesRound3	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Round3Apf
--- a/test/tools/apt/Compile/servicesRound4	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Round4Apf
--- a/test/tools/apt/Compile/servicesStaticApf	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-StaticApf
--- a/test/tools/apt/Compile/src/AhOneClass.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public class AhOneClass {}
--- a/test/tools/apt/Compile/src/AndAhTwoClass.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public class AndAhTwoClass {}
--- a/test/tools/apt/Compile/src/Round1Class.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public class Round1Class {}
--- a/test/tools/apt/Discovery/Dee.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.Collections;
-
-public class Dee implements AnnotationProcessorFactory {
-    static class DeeProc implements AnnotationProcessor {
-        DeeProc(AnnotationProcessorEnvironment ape) {}
-
-        public void process() {
-            return;
-        }
-    }
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"dum"};
-        supportedTypes = Collections.unmodifiableCollection(Arrays.asList(types));
-    }
-
-    static Collection<String> supportedOptions;
-    static {
-        String options[] = {""};
-        supportedOptions = Collections.unmodifiableCollection(Arrays.asList(options));
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    /*
-     * Return the same processor independent of what annotations are
-     * present, if any.
-     */
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                        AnnotationProcessorEnvironment env) {
-        return new DeeProc(env);
-    }
-}
--- a/test/tools/apt/Discovery/Dum.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.Collections;
-
-public class Dum implements AnnotationProcessorFactory {
-    static class DumProc implements AnnotationProcessor {
-        DumProc(AnnotationProcessorEnvironment ape) {}
-
-        public void process() {
-            return;
-        }
-    }
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"dee"};
-        supportedTypes = Collections.unmodifiableCollection(Arrays.asList(types));
-    }
-
-    static Collection<String> supportedOptions;
-    static {
-        String options[] = {""};
-        supportedOptions = Collections.unmodifiableCollection(Arrays.asList(options));
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    /*
-     * Return the same processor independent of what annotations are
-     * present, if any.
-     */
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                        AnnotationProcessorEnvironment env) {
-        return new DumProc(env);
-    }
-}
--- a/test/tools/apt/Discovery/Empty.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public class Empty {
-}
--- a/test/tools/apt/Discovery/PhantomTouch.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.Collections;
-import java.io.*;
-
-public class PhantomTouch implements AnnotationProcessorFactory {
-    static class PhantomTouchProc implements AnnotationProcessor {
-        AnnotationProcessorEnvironment ape;
-        PhantomTouchProc(AnnotationProcessorEnvironment ape) {
-            this.ape = ape;
-        }
-
-        public void process() {
-            // Only run the processor on the initial apt invocation
-            if (ape.getSpecifiedTypeDeclarations().size() == 0) {
-                boolean result;
-                try {
-                    // Create temporary file
-                    java.io.File f = new java.io.File("touched");
-                    result = f.createNewFile();
-
-                    if (result) {
-                        // Create new source file
-                        PrintWriter pw = ape.getFiler().createSourceFile("HelloWorld");
-                        pw.println("public class HelloWorld {");
-                        pw.println("  // Phantom hello world");
-                        pw.println("  public static void main(String argv[]) {");
-                        pw.println("    System.out.println(\"Hello World\");");
-                        pw.println("  }");
-                        pw.println("}");
-                    } else
-                        throw new RuntimeException("touched file already exists!");
-                } catch (java.io.IOException e) {
-                    result = false;
-                }
-            }
-        }
-    }
-
-    static final Collection<String> supportedOptions;
-    static final Collection<String> supportedTypes;
-
-    static {
-        String options[] = {""};
-        supportedOptions = Collections.unmodifiableCollection(Arrays.asList(options));
-
-        String types[] = {"*"};
-        supportedTypes = Collections.unmodifiableCollection(Arrays.asList(types));
-    }
-
-    public Collection<String> supportedAnnotationTypes() {return supportedTypes;}
-    public Collection<String> supportedOptions() {return supportedOptions;}
-
-
-    /*
-     * Return the same processor independent of what annotations are
-     * present, if any.
-     */
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                        AnnotationProcessorEnvironment env) {
-        return new PhantomTouchProc(env);
-    }
-}
--- a/test/tools/apt/Discovery/PhantomUpdate.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * JSR 269 annotation processor to test combined apt + JSR 269
- * annotation processor file generation and option passing.
- */
-
-import javax.annotation.processing.*;
-import static  javax.lang.model.SourceVersion.*;
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-import javax.lang.model.util.*;
-import java.util.*;
-import java.io.*;
-
-@SupportedAnnotationTypes("*")  // Process all annotations
-@SupportedSourceVersion(RELEASE_6)
-public class PhantomUpdate extends AbstractProcessor {
-    boolean firstRound = true;
-
-    public boolean process(Set<? extends TypeElement> annotations,
-                           RoundEnvironment roundEnv) {
-        if (firstRound) {
-            verifyOptions();
-            printGoodbyeWorld();
-            firstRound = false;
-        }
-        return true; // Claim all annotations
-    }
-
-    /*
-     * Expected options are "foo" and "bar=baz".
-     */
-    private void verifyOptions() {
-        Map<String, String> actualOptions = processingEnv.getOptions();
-        Map<String, String> expectedOptions = new LinkedHashMap<String, String>();
-        expectedOptions.put("foo", null);
-        expectedOptions.put("bar", "baz");
-
-        if (!actualOptions.equals(expectedOptions) ) {
-            System.err.println("Expected options " + expectedOptions +
-                               "\n but got " + actualOptions);
-            throw new RuntimeException("Options mismatch");
-        }
-    }
-
-    private void printGoodbyeWorld() {
-        try {
-            // Create new source file
-            PrintWriter pw = new PrintWriter(processingEnv.getFiler().createSourceFile("GoodbyeWorld").openWriter());
-            pw.println("public class GoodbyeWorld {");
-            pw.println("  // PhantomUpdate Goodbye world");
-            pw.println("  public static void main(String argv[]) {");
-            pw.println("    System.out.println(\"Goodbye World\");");
-            pw.println("  }");
-            pw.println("}");
-            pw.close();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
--- a/test/tools/apt/Discovery/Touch.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.Collections;
-import java.io.*;
-
-public class Touch implements AnnotationProcessorFactory {
-    static class TouchProc implements AnnotationProcessor {
-        AnnotationProcessorEnvironment ape;
-        TouchProc(AnnotationProcessorEnvironment ape) {
-            this.ape = ape;
-        }
-
-        public void process() {
-            boolean result;
-            // Only run the processor on the initial apt invocation
-            Collection<TypeDeclaration> tdecls = ape.getSpecifiedTypeDeclarations();
-
-            if (tdecls.size() == 1) {
-                for(TypeDeclaration decl: tdecls) {
-                    if (! decl.getSimpleName().equals("Touch") )
-                        return;
-                }
-
-                try {
-                    // Create temporary file
-                    java.io.File f = new java.io.File("touched");
-                    result = f.createNewFile();
-
-
-                    Filer filer = ape.getFiler();
-
-                    // Create new source file
-                    PrintWriter pw = filer.createSourceFile("HelloWorld");
-                    pw.println("public class HelloWorld {");
-                    pw.println("  public static void main(String argv[]) {");
-                    pw.println("    System.out.println(\"Hello World\");");
-                    pw.println("  }");
-                    pw.println("}");
-
-                    // Create new class file and copy Empty.class
-                    OutputStream os = filer.createClassFile("Empty");
-                    FileInputStream fis = new FileInputStream("Empty.clazz");
-                    int datum;
-                    while((datum = fis.read()) != -1)
-                        os.write(datum);
-
-                } catch (java.io.IOException e) {
-                    result = false;
-                }
-                if (!result)
-                    throw new RuntimeException("touched file already exists or other error");
-            }
-
-        }
-
-    }
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"*"};
-        supportedTypes = Collections.unmodifiableCollection(Arrays.asList(types));
-    }
-
-    static Collection<String> supportedOptions;
-    static {
-        String options[] = {""};
-        supportedOptions = Collections.unmodifiableCollection(Arrays.asList(options));
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    /*
-     * Return the same processor independent of what annotations are
-     * present, if any.
-     */
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                        AnnotationProcessorEnvironment env) {
-        return new TouchProc(env);
-    }
-}
--- a/test/tools/apt/Discovery/discovery.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,410 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4984412 4985113 4908512 4990905 4998007 4998218 5002340 5023882 6370261 6363481
-# @run shell ../verifyVariables.sh
-# @compile PhantomUpdate.java
-# @run shell discovery.sh
-# @summary Test consistency of annotation discovery
-# @author Joseph D. Darcy
-
-
-# If the file does not exist, exit with an error
-TestFile() {
-	if [ ! -f ${1} ]; then
-		printf "%s\n" "File ${1} not found."
-		exit 1
-	fi
-}
-
-OS=`uname -s`;
-case "${OS}" in
-        Windows* | CYGWIN* )
-                SEP=";"
-        ;;
-
-	* )
-	SEP=":"
-	;;
-esac
-
-TOOLSJAR=${TESTJAVA}/lib/tools.jar
-
-OLDCP=${CLASSPATH}
-
-JARCP=tweedle.jar${SEP}touch.jar${SEP}${TOOLSJAR}
-SOURCEP=${TESTSRC}
-FULLCP=${JARCP}${SEP}${SOURCEP}
-BADCP=tweedle.jar${SEP}badTouch.jar${SEP}${TOOLSJAR}
-
-# Construct path to apt executable
-APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} "
-
-
-# Construct path to apt executable, no compilation
-APTNC="${APT} -nocompile "
-
-
-printf "%s\n" "APT = ${APT}"
-
-# Construct path to javac executable
-JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TOOLSJAR} -d . "
-JAR="${TESTJAVA}/bin/jar "
-
-$JAVAC ${TESTSRC}/Dee.java ${TESTSRC}/Dum.java ${TESTSRC}/Touch.java ${TESTSRC}/PhantomTouch.java ${TESTSRC}/Empty.java
-RESULT=$?
-
-case "${RESULT}" in
-        0  )
-        ;;
-
-        * )
-        echo "Compilation failed."
-        exit 1
-esac
-
-mv Empty.class Empty.clazz
-
-echo "Making services directory and copying services information."
-mkdir -p META-INF/services
-mkdir -p phantom
-
-rm -f touch.jar
-rm -f badTouch.jar
-
-cp ${TESTSRC}/servicesTweedle META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-${JAR} cf0 tweedle.jar Dee*.class Dum*.class META-INF
-
-rm -f META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTSRC}/servicesTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-${JAR} cf0 touch.jar Touch*.class META-INF
-
-rm -f META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTSRC}/servicesPhantomTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-${JAR} cf0 phantom/phantom.jar PhantomTouch*.class META-INF
-
-# cleanup file to prevent accidental discovery in current directory
-rm -f META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-# Jar files created; verify right output file is touched
-
-#---------------------------------------------------------
-
-# Test different combinations of classpath, sourcepath, and
-# destination directories
-
-
-#
-# Classpath on commandline; no output directories
-#
-
-rm -f touched 
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-printf "%s\n" "-classpath ${JARCP}"     > options1
-printf "%s\n" "-sourcepath ${SOURCEP}" >> options1
-printf "%s\n" "${TESTSRC}/Touch.java"  >> options1
-
-${APTNC} @options1
-
-echo "Testing case 1"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "Empty.class"
-
-#
-# Class path set through environment variable
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-CLASSPATH=${JARCP}
-export CLASSPATH
-printf "%s\n" "-sourcepath ${SOURCEP}" > options2
-printf "%s\n" "${TESTSRC}/Touch.java" >> options2
-
-${APTNC} @options2
-
-echo "Testing case 2"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "Empty.class"
-
-#
-# No explicit source path
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-CLASSPATH=${FULLCP}
-export CLASSPATH
-printf "%s\n" "${TESTSRC}/Touch.java"  > options3
-
-${APTNC} @options3
-
-echo "Testing case 3"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "Empty.class"
-
-
-#
-# Classpath on commandline; class output directory
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -Rf classes/Empty.class
-
-unset CLASSPATH
-printf "%s\n" "-classpath ${JARCP}"     > options4
-printf "%s\n" "-sourcepath ${SOURCEP}" >> options4
-printf "%s\n" "-d classes"             >> options4
-printf "%s\n" "${TESTSRC}/Touch.java"  >> options4
-
-${APTNC} @options4
-
-echo "Testing case 4"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "classes/Empty.class"
-
-#
-# Classpath on commandline; source output directory
-#
-
-rm -f touched
-rm -Rf src
-rm -f Empty.class
-
-unset CLASSPATH
-printf "%s\n" "-classpath ${JARCP}"     > options5
-printf "%s\n" "-sourcepath ${SOURCEP}" >> options5
-printf "%s\n" "-s src"                 >> options5
-printf "%s\n" "${TESTSRC}/Touch.java"  >> options5
-
-${APTNC} @options5
-
-echo "Testing case 5"
-TestFile "touched"
-TestFile "src/HelloWorld.java"
-TestFile "Empty.class"
-
-
-#
-# Classpath on commandline; class and source output directory
-#
-
-rm -f touched
-rm -Rf src
-rm -Rf classes
-
-unset CLASSPATH
-printf "%s\n" "-classpath ${JARCP}"     > options6
-printf "%s\n" "-sourcepath ${SOURCEP}" >> options6
-printf "%s\n" "-d classes"             >> options6
-printf "%s\n" "-s src"                 >> options6
-printf "%s\n" "${TESTSRC}/Touch.java"  >> options6
-
-${APTNC} @options6
-
-echo "Testing case 6"
-TestFile "touched"
-TestFile "src/HelloWorld.java"
-TestFile "classes/Empty.class"
-
-#
-# Classpath appended to bootclasspath; no output directories
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-printf "%s\n" "-Xbootclasspath/a:${JARCP}" > options7
-printf "%s\n" "-classpath /dev/null"      >> options7
-printf "%s\n" "${TESTSRC}/Touch.java"     >> options7
-
-${APTNC} @options7
-
-echo "Testing case 7"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "Empty.class"
-
-#
-# Classpath in extdirs; no output directories
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-printf "%s\n" "-extdirs ."              > options8
-printf "%s\n" "-classpath ${TOOLSJAR}" >> options8
-printf "%s\n" "${TESTSRC}/Touch.java"  >> options8
-
-${APTNC} @options8
-
-echo "Testing case 8"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "Empty.class"
-
-#
-# Classpath in extdirs, take 2; no output directories
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-printf "%s\n" "-Djava.ext.dirs=."        > options9
-printf "%s\n" "-classpath ${TOOLSJAR}"  >> options9
-printf "%s\n" "${TESTSRC}/Touch.java"   >> options9
-
-${APTNC} @options9
-
-echo "Testing case 9"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "Empty.class"
-
-#
-# Classpath in -endorseddirs; no output directories
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-printf "%s\n" "-endorseddirs ."          > options10
-printf "%s\n" "-classpath ${TOOLSJAR}"  >> options10
-printf "%s\n" "${TESTSRC}/Touch.java"   >> options10
-
-${APTNC} @options10
-
-echo "Testing case 10"
-TestFile "touched"
-TestFile "HelloWorld.java"
-TestFile "Empty.class"
-
-#
-# Testing apt invocation with no command line options
-#
-
-rm -f touched
-rm -f HelloWorld.java
-rm -f Empty.class
-
-unset CLASSPATH
-CLASSPATH=./phantom/phantom.jar
-export CLASSPATH
-
-${APT}
-
-echo "Testing empty command line"
-TestFile "touched"
-TestFile "HelloWorld.java"
-
-
-#
-# Verify apt and JSR 269 annotation processors can be run from same
-# invocation and both use the output directories
-#
-
-rm -f touched
-rm -f src/HelloWorld.java
-rm -f src/GoodbyeWorld.java
-rm -f classes/HelloWorld.class
-rm -f classes/GoodbyeWorld.class
-
-unset CLASSPATH
-
-
-printf "%s\n" "-classpath ./phantom/phantom.jar" > options11
-printf "%s\n" "-sourcepath ${SOURCEP}"          >> options11
-printf "%s\n" "-factory PhantomTouch "          >> options11
-printf "%s\n" "-s src"                          >> options11
-printf "%s\n" "-d classes"                      >> options11
-printf "%s\n" "-A"             	                >> options11
-printf "%s\n" "-Afoo"          	                >> options11
-printf "%s\n" "-Abar=baz"      	                >> options11
-printf "%s\n" "-processorpath $TESTCLASSES"     >> options11
-printf "%s\n" "-processor PhantomUpdate"        >> options11
-
-${APT} @options11
-
-echo "Testing combined apt and JSR 269 processing"
-TestFile touched
-TestFile "src/HelloWorld.java"
-TestFile "src/GoodbyeWorld.java"
-TestFile "classes/HelloWorld.class"
-TestFile "classes/GoodbyeWorld.class"
-
-#
-# Verify running with badTouch doesn't exit successfully
-#
-
-rm -f ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-cp ${TESTSRC}/servicesBadTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-${JAR} cf0 badTouch.jar Touch*.class META-INF
-
-
-unset CLASSPATH
-printf "%s\n" "-classpath ${BADCP}"     > optionsBad
-printf "%s\n" "-sourcepath ${SOURCEP}" >> optionsBad
-printf "%s\n" "${TESTSRC}/Touch.java"  >> optionsBad
-
-${APTNC} @optionsBad 2> /dev/null
-
-RESULT=$?
-
-case "${RESULT}" in
-        0  )
-	echo "Improper exit zero with bad services information."
-	exit 1
-        ;;
-esac
-
-
-exit 0;
--- a/test/tools/apt/Discovery/servicesBadTouch	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Touche
--- a/test/tools/apt/Discovery/servicesPhantomTouch	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-PhantomTouch
--- a/test/tools/apt/Discovery/servicesTouch	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Touch
--- a/test/tools/apt/Discovery/servicesTweedle	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Dee
-Dum
--- a/test/tools/apt/Misc/Marked.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-class Marked {
-
-    @Marker
-        class marked1 {};
-
-
-    class Unmarked1 {};
-
-    @Marker
-        class marked2 {};
-
-
-    class Unmarked2 {};
-
-    @Marker
-        class marked3 {};
-
-
-    class Unmarked3 {};
-
-    @Marker
-        class marked4 {};
-
-
-    class Unmarked4 {};
-
-}
--- a/test/tools/apt/Misc/Marker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public @interface Marker {}
--- a/test/tools/apt/Misc/Misc.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Arrays;
-import java.util.Collections;
-
-public class Misc implements AnnotationProcessorFactory {
-    static class MiscCheck implements AnnotationProcessor {
-        AnnotationProcessorEnvironment ape;
-        MiscCheck(AnnotationProcessorEnvironment ape) {
-            this.ape = ape;
-        }
-
-        public void process() {
-            Collection<Declaration> decls = ape.
-                getDeclarationsAnnotatedWith((AnnotationTypeDeclaration)
-                                             ape.getTypeDeclaration("Marker"));
-
-            // Should write more robust test that examines the
-            // annotation mirrors for the declaration in question.
-            for(Declaration decl: decls) {
-                if (!decl.getSimpleName().startsWith("marked") )
-                    throw new RuntimeException();
-            }
-        }
-    }
-
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"*"};
-        supportedTypes = Collections.unmodifiableCollection(Arrays.asList(types));
-    }
-
-    Collection<String> supportedOptions =
-        Collections.unmodifiableCollection(new HashSet<String>());
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    /*
-     * Return the same processor independent of what annotations are
-     * present, if any.
-     */
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment ape) {
-        return new MiscCheck(ape);
-    }
-}
--- a/test/tools/apt/Misc/misc.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 5007250
-# @run shell ../verifyVariables.sh
-# @run shell misc.sh
-# @summary Miscelleneous tests
-# @author Joseph D. Darcy
-
-OS=`uname -s`;
-case "${OS}" in
-        Windows* | CYGWIN* )
-                SEP=";"
-        ;;
-
-	* )
-	SEP=":"
-	;;
-esac
-
-JARCP=misc.jar
-SOURCEP=${TESTSRC}
-
-# Construct path to apt executable
-APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile "
-
-printf "%s\n" "APT = ${APT}"
-
-# Construct path to javac executable
-JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
-JAR="${TESTJAVA}/bin/jar "
-
-${JAVAC} ${TESTSRC}/Misc.java ${TESTSRC}/Marked.java 
-RESULT=$?
-
-case "${RESULT}" in
-        0  )
-        ;;
-
-        * )
-        echo "Compilation failed."
-        exit 1
-esac
-
-
-echo "Making services directory and copying services information."
-mkdir -p META-INF/services
-
-cp ${TESTSRC}/servicesMisc META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-${JAR} cf0 misc.jar Misc*.class META-INF
-
-# Jar files created; verify options properly present on both initial
-# and recursive apt runs
-
-#---------------------------------------------------------
-
-unset CLASSPATH
-
-printf "%s\n" "-classpath ${JARCP}"     > options
-printf "%s\n" "-sourcepath ${SOURCEP}" >> options
-printf "%s\n" "${TESTSRC}/Marked.java" >> options
-
-${APT} @options
-
-RESULT=$?
-case "${RESULT}" in
-        0  )
-	;;	
-	
-	* )
-	echo "Problem with result"
-	exit 1
-        ;;
-esac
-
-exit 0;
--- a/test/tools/apt/Misc/servicesMisc	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Misc
-
--- a/test/tools/apt/Options/Marked.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-@Marker
-class Marked {
-}
--- a/test/tools/apt/Options/Marker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public @interface Marker {}
--- a/test/tools/apt/Options/OptionChecker.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Map;
-import java.util.Arrays;
-import java.util.Collections;
-
-public class OptionChecker implements AnnotationProcessorFactory {
-    static class OptionCheck implements AnnotationProcessor {
-        AnnotationProcessorEnvironment ape;
-        OptionCheck(AnnotationProcessorEnvironment ape) {
-            this.ape = ape;
-        }
-
-        public void process() {
-            Map<String, String> options = ape.getOptions();
-            if (options.containsKey("-Afoo") &&
-                options.containsKey("-Abar") &&
-                options.containsKey("-classpath") ) {
-                System.out.println("Expected options found.");
-                return;  // All is well
-            } else {
-                System.err.println("Unexpected options values: " + options);
-                throw new RuntimeException();
-            }
-        }
-    }
-
-    static class HelloWorld implements AnnotationProcessor {
-        AnnotationProcessorEnvironment ape;
-        HelloWorld(AnnotationProcessorEnvironment ape) {
-            this.ape = ape;
-        }
-
-        public void process() {
-            java.io.PrintWriter pw;
-            try {
-                pw = ape.getFiler().createSourceFile("HelloWorld");
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-
-            pw.println("public class HelloWorld {");
-            pw.println("  public static void main (String argv[]) {");
-            pw.println("    System.out.println(\"Hello apt world.\");");
-            pw.println("  }");
-            pw.println("}");
-        }
-    }
-
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"*"};
-        supportedTypes = Collections.unmodifiableCollection(Arrays.asList(types));
-    }
-
-    static Collection<String> supportedOptions;
-    static {
-        String options[] = {"-Afoo", "-Abar"};
-        supportedOptions = Collections.unmodifiableCollection(Arrays.asList(options));
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    /*
-     * Return the same processor independent of what annotations are
-     * present, if any.
-     */
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment ape) {
-
-        if (atds.contains(ape.getTypeDeclaration("Marker"))) {
-            System.out.println("Returning composite processor.");
-            return AnnotationProcessors.getCompositeAnnotationProcessor(new OptionCheck(ape),
-                                                                        new HelloWorld(ape));
-        }
-        else {
-            System.out.println("Returning single processor.");
-            return new OptionCheck(ape);
-        }
-    }
-}
--- a/test/tools/apt/Options/options.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4993950 4993277
-# @run shell ../verifyVariables.sh
-# @run shell options.sh
-# @summary Test availabilty of command line options in processors
-# @author Joseph D. Darcy
-
-OS=`uname -s`;
-case "${OS}" in
-        Windows* | CYGWIN* )
-                SEP=";"
-        ;;
-
-	* )
-	SEP=":"
-	;;
-esac
-
-JARCP=option.jar
-SOURCEP=${TESTSRC}
-
-
-# Construct path to apt executable
-APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile "
-
-printf "%s\n" "APT = ${APT}"
-
-# Construct path to javac executable
-JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
-JAR="${TESTJAVA}/bin/jar "
-
-${JAVAC} ${TESTSRC}/OptionChecker.java
-RESULT=$?
-
-case "${RESULT}" in
-        0  )
-        ;;
-
-        * )
-        echo "Compilation failed."
-        exit 1
-esac
-
-
-echo "Making services directory and copying services information."
-mkdir -p META-INF/services
-
-cp ${TESTSRC}/servicesOptions META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-${JAR} cf0 option.jar OptionChecker*.class META-INF
-
-# Jar files created; verify options properly present on both initial
-# and recursive apt runs
-
-#---------------------------------------------------------
-
-unset CLASSPATH
-
-printf "%s\n" "-classpath ${JARCP}"     > options
-printf "%s\n" "-sourcepath ${SOURCEP}" >> options
-printf "%s\n" "${TESTSRC}/Marked.java" >> options
-
-${APT} @options
-
-RESULT=$?
-case "${RESULT}" in
-        0  )
-	echo "Failed to indentify missing options"
-	exit 1
-	;;	
-	
-	* )
-        ;;
-esac
-
-printf "%s\n" "-Afoo -Abar" >> options
-
-${APT} @options
-
-RESULT=$?
-case "${RESULT}" in
-        0  )
-	;;	
-	
-	* )
-	echo "Options not found properly."
-	exit 1
-        ;;
-esac
-
-exit 0;
--- a/test/tools/apt/Options/servicesOptions	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-OptionChecker
--- a/test/tools/apt/Scanners/Counter.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * Used to verify counts from different kinds of declaration scanners.
- */
-public class Counter implements AnnotationProcessorFactory {
-    static class CounterProc implements AnnotationProcessor {
-        static class CountingVisitor extends SimpleDeclarationVisitor {
-            int count;
-            int count() {
-                return count;
-            }
-
-            CountingVisitor() {
-                count = 0;
-            }
-
-            public void visitDeclaration(Declaration d) {
-                count++;
-                System.out.println(d.getSimpleName());
-            }
-        }
-
-        AnnotationProcessorEnvironment env;
-        CounterProc(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        public void process() {
-            for(TypeDeclaration td: env.getSpecifiedTypeDeclarations() ) {
-                CountingVisitor sourceOrder = new CountingVisitor();
-                CountingVisitor someOrder = new CountingVisitor();
-
-                System.out.println("Source Order Scanner");
-                td.accept(getSourceOrderDeclarationScanner(sourceOrder,
-                                                           NO_OP));
-
-                System.out.println("\nSome Order Scanner");
-                td.accept(getDeclarationScanner(someOrder,
-                                                NO_OP));
-
-                if (sourceOrder.count() != someOrder.count() )
-                    throw new RuntimeException("Counts from different scanners don't agree");
-            }
-
-        }
-    }
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"*"};
-        supportedTypes = unmodifiableCollection(Arrays.asList(types));
-    }
-
-    static Collection<String> supportedOptions;
-    static {
-        String options[] = {""};
-        supportedOptions = unmodifiableCollection(Arrays.asList(options));
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                               AnnotationProcessorEnvironment env) {
-        return new CounterProc(env);
-    }
-
-}
--- a/test/tools/apt/Scanners/MemberOrderApf.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Arrays;
-
-import static java.util.Collections.*;
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-/*
- * The processor of this factory verifies class members are returned
- * in source-code order.
- */
-public class MemberOrderApf implements AnnotationProcessorFactory {
-    // Process any set of annotations
-    private static final Collection<String> supportedAnnotations
-        = unmodifiableCollection(Arrays.asList("*"));
-
-    // No supported options
-    private static final Collection<String> supportedOptions = emptySet();
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedAnnotations;
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public AnnotationProcessor getProcessorFor(
-            Set<AnnotationTypeDeclaration> atds,
-            AnnotationProcessorEnvironment env) {
-        return new MemberOrderAp(env);
-    }
-
-    private static class MemberOrderAp implements AnnotationProcessor {
-        private final AnnotationProcessorEnvironment env;
-        MemberOrderAp(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        private void verifyOrder(Collection<? extends Declaration> decls) {
-            int count = 0;
-            for(Declaration decl: decls) {
-                VisitOrder order = decl.getAnnotation(VisitOrder.class);
-                if (order.value() <= count)
-                    throw new RuntimeException("Out of order declarations");
-                count = order.value();
-            }
-        }
-
-        public void process() {
-            for(TypeDeclaration td: env.getSpecifiedTypeDeclarations()) {
-                verifyOrder(td.getFields());
-                verifyOrder(td.getMethods());
-            }
-        }
-    }
-}
--- a/test/tools/apt/Scanners/Order.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-@VisitOrder(1)
-public class Order {
-    @VisitOrder(2)
-    static double d;
-
-    @VisitOrder(3)
-    private Order() {}
-
-    @VisitOrder(4)
-    int i;
-
-    @VisitOrder(5)
-    static class InnerOrder {
-        @VisitOrder(6)
-        InnerOrder(){}
-
-        @VisitOrder(7)
-        String toString() {return "";}
-    }
-
-    @VisitOrder(8)
-    String toString() {return "";}
-
-    @VisitOrder(9)
-    InnerOrder io;
-
-    @VisitOrder(10)
-    String foo() {return toString();}
-}
--- a/test/tools/apt/Scanners/Scanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Map;
-import java.util.Arrays;
-import java.util.Collections;
-
-
-public class Scanner implements AnnotationProcessorFactory {
-    static class ScannerProc implements AnnotationProcessor {
-        AnnotationProcessorEnvironment env;
-        ScannerProc(AnnotationProcessorEnvironment env) {
-            this.env = env;
-        }
-
-        static class CountingVisitor extends SimpleDeclarationVisitor {
-            int count;
-            CountingVisitor() {
-                count = 0;
-            }
-
-            public void visitDeclaration(Declaration d) {
-                count++;
-
-                Collection<AnnotationMirror> ams = d.getAnnotationMirrors();
-                if (ams == null)
-                    throw new RuntimeException("Declaration " + d +
-                                               " not annotated with visit order.");
-                else {
-                    if (ams.size() != 1)
-                        throw new RuntimeException("Declaration " + d +
-                                                   " has wrong number of declarations.");
-                    else {
-                        for(AnnotationMirror am: ams) {
-                            Map<AnnotationTypeElementDeclaration,AnnotationValue> elementValues = am.getElementValues();
-                            for(AnnotationTypeElementDeclaration atmd: elementValues.keySet()) {
-                                if (!atmd.getDeclaringType().toString().equals("VisitOrder"))
-                                    throw new RuntimeException("Annotation " + atmd +
-                                                               " is the wrong type.");
-                                else {
-                                    AnnotationValue av =
-                                        elementValues.get(atmd);
-                                    Integer value = (Integer) av.getValue();
-                                    if (value.intValue() != count)
-                                        throw new RuntimeException("Expected declaration " + d +
-                                                                   " to be in position " + count +
-                                                                   " instead of " + value.intValue());
-
-                                    System.out.println("Declaration " + d +
-                                                       ": visit order " + value.intValue());
-                                }
-                            }
-
-                        }
-                    }
-                }
-
-            }
-        }
-
-        public void process() {
-            for(TypeDeclaration td: env.getSpecifiedTypeDeclarations() ) {
-                td.accept(DeclarationVisitors.getSourceOrderDeclarationScanner(new CountingVisitor(),
-                                                                               DeclarationVisitors.NO_OP));
-            }
-        }
-    }
-
-
-    static Collection<String> supportedTypes;
-    static {
-        String types[] = {"*"};
-        supportedTypes = Collections.unmodifiableCollection(Arrays.asList(types));
-    }
-
-    static Collection<String> supportedOptions;
-    static {
-        String options[] = {""};
-        supportedOptions = Collections.unmodifiableCollection(Arrays.asList(options));
-    }
-
-    public Collection<String> supportedOptions() {
-        return supportedOptions;
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                        AnnotationProcessorEnvironment env) {
-        return new ScannerProc(env);
-    }
-
-}
--- a/test/tools/apt/Scanners/TestEnum.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-public enum TestEnum {
-    QUIZ,
-    EXAM,
-    MIDTERM,
-    FINAL,
-    QUALIFIER;
-}
--- a/test/tools/apt/Scanners/VisitOrder.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * Integer to indicate what order a declaration is expected to be
- * visited in by a DeclarationScanner.
- */
-
-@interface VisitOrder {
-    int value();
-}
--- a/test/tools/apt/Scanners/scanner.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4989093 5009164 5023880 5029482 6206786
-# @run shell ../verifyVariables.sh
-# @run shell scanner.sh
-# @summary Test source order scanner
-# @author Joseph D. Darcy
-
-OS=`uname -s`;
-case "${OS}" in
-        Windows* | CYGWIN* )
-                SEP=";"
-        ;;
-
-	* )
-	SEP=":"
-	;;
-esac
-
-JARCP=scanner.jar
-
-# Construct path to apt executable
-APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile "
-
-printf "%s\n" "APT = ${APT}"
-
-# Construct path to javac executable
-JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
-JAR="${TESTJAVA}/bin/jar "
-
-${JAVAC} ${TESTSRC}/Scanner.java ${TESTSRC}/VisitOrder.java ${TESTSRC}/Counter.java ${TESTSRC}/MemberOrderApf.java
-RESULT=$?
-
-case "${RESULT}" in
-        0  )
-        ;;
-
-        * )
-        echo "Compilation failed."
-        exit 1
-esac
-
-
-echo "Making services directory and copying services information."
-mkdir -p META-INF/services
-
-cp ${TESTSRC}/servicesScanner META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
-
-${JAR} cf0 scanner.jar Scanner*.class META-INF
-
-# Jar files created; verify options properly present on both initial
-# and recursive apt runs
-
-#---------------------------------------------------------
-
-unset CLASSPATH
-
-printf "%s\n" "-classpath ${JARCP}"     > options
-printf "%s\n" "-sourcepath ${TESTSRC}" >> options
-printf "%s\n" "${TESTSRC}/Order.java"  >> options
-
-${APT} @options
-
-RESULT=$?
-case "${RESULT}" in
-        0  )
-	;;	
-	
-	* )
-	echo "Program elements visited in wrong order"
-	exit 1
-        ;;
-esac
-
-#---------------------------------------------------------
-
-# Verify that plain decl' scanner and source order decl' scanner
-# record the same number of elements for an enum
-
-printf "%s\n" "-factorypath ."            > options2
-printf "%s\n" "-factory Counter"         >> options2
-printf "%s\n" "-sourcepath ${TESTSRC}"   >> options2
-printf "%s\n" "${TESTSRC}/TestEnum.java" >> options2
-
-
-$APT @options2
-
-RESULT=$?
-case "${RESULT}" in
-        0  )
-	;;	
-	
-	* )
-	echo "Improper counts"
-	exit 1
-        ;;
-esac
-
-#---------------------------------------------------------
-
-# Verify that members happen to be returned in source order
-
-printf "%s\n" "-factorypath ."            > options3
-printf "%s\n" "-factory MemberOrderApf"  >> options3
-printf "%s\n" "-sourcepath ${TESTSRC}"   >> options3
-printf "%s\n" "${TESTSRC}/Order.java"    >> options3
-
-$APT @options3
-
-RESULT=$?
-case "${RESULT}" in
-        0  )
-	;;	
-	
-	* )
-	echo "Improper counts"
-	exit 1
-        ;;
-esac
-
-
-exit 0;
--- a/test/tools/apt/Scanners/servicesScanner	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Scanner
--- a/test/tools/apt/lib/Ignore.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import java.lang.annotation.*;
-
-/**
- * An annotation used to indicate that a test -- a method annotated
- * with @Test -- should not be executed.
- *
- * @author Scott Seligman
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Ignore {
-
-    /**
-     * Reason for ignoring this test.
-     */
-    String value() default "";
-}
--- a/test/tools/apt/lib/Test.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import java.lang.annotation.*;
-
-/**
- * An annotation used to indicate that a method constitutes a test,
- * and which provides the expected result.  The method must take no parameters.
- *
- * @author Scott Seligman
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Test {
-
-    /**
-     * An array containing the method's expected result (or
-     * elements of the result if the return type is a Collection).
-     * Value is ignored if return type is void.
-     * Entries are converted to strings via {@link String#valueOf(Object)}.
-     */
-    String[] result() default {};
-
-    /**
-     * True if the order of the elements in result() is significant.
-     */
-    boolean ordered() default false;
-}
--- a/test/tools/apt/lib/TestProcessor.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import java.lang.reflect.Method;
-import java.util.*;
-import com.sun.mirror.apt.*;
-
-
-/**
- * Annotation processor for the @Test annotation.
- * Invokes each method so annotated, and verifies the result.
- * Throws an Error on failure.
- *
- * @author Scott Seligman
- */
-public class TestProcessor implements AnnotationProcessor {
-
-    AnnotationProcessorEnvironment env;
-
-    // The tester that's running.
-    Tester tester = Tester.activeTester;
-
-    TestProcessor(AnnotationProcessorEnvironment env,
-                  Tester tester) {
-        this.env = env;
-        this.tester = tester;
-    }
-
-
-    /**
-     * Reflectively invoke the @Test-annotated methods of the live
-     * tester.  Those methods perform the actual exercising of the
-     * mirror API.  Then back here to verify the results by
-     * reading the live annotations.  Convoluted, you say?
-     */
-    public void process() {
-        System.out.printf("\n> Processing %s\n", tester.getClass());
-
-        boolean failed = false;         // true if a test returns wrong result
-
-        for (Method m : tester.getClass().getDeclaredMethods()) {
-            Test anno = m.getAnnotation(Test.class);
-            Ignore ignore = m.getAnnotation(Ignore.class);
-            if (anno != null) {
-                if (ignore == null) {
-                    System.out.println(">> Invoking test " + m.getName());
-                    Object result;
-                    try {
-                        result = m.invoke(tester);
-                    } catch (Exception e) {
-                        throw new Error("Test invocation failed", e);
-                    }
-                    boolean ok = true;  // result of this test
-                    if (Collection.class.isAssignableFrom(m.getReturnType())) {
-                        ok = verifyResults((Collection) result,
-                                           anno.result(), anno.ordered());
-                    } else if (m.getReturnType() != void.class) {
-                        ok = verifyResult(result, anno.result());
-                    }
-                    if (!ok) {
-                        System.out.println(">>> Expected: " + anno);
-                        System.out.println(">>> Got: " + result);
-                        failed = true;
-                    }
-                } else {
-                    System.out.println(">> Ignoring test " + m.getName());
-                    if (ignore.value().length() > 0) {
-                        System.out.println(">>> Reason: " + ignore.value());
-                    }
-                }
-            }
-        }
-        if (failed) {
-            throw new Error("Test(s) returned unexpected result");
-        }
-    }
-
-    /**
-     * Verify that a single-valued (non-Collection) result matches
-     * its expected value.
-     */
-    private boolean verifyResult(Object result, String[] expected) {
-        assert expected.length == 1 :
-            "Single-valued test expecting " + expected.length + " results";
-        return expected[0].equals(String.valueOf(result));
-    }
-
-    /**
-     * Verify that a multi-valued result (a Collection) matches
-     * its expected values.
-     */
-    private boolean verifyResults(Collection result,
-                                  String[] expected, boolean ordered) {
-        if (result.size() != expected.length) {
-            return false;
-        }
-
-        // Convert result to an array of strings.
-        String[] res = new String[result.size()];
-        int i = 0;
-        for (Object e : result) {
-            res[i++] = String.valueOf(e);
-        }
-
-        if (!ordered) {
-            Arrays.sort(res);
-            Arrays.sort(expected);
-        }
-        return Arrays.equals(res, expected);
-    }
-}
--- a/test/tools/apt/lib/TestProcessorFactory.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import java.util.*;
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.util.*;
-
-
-/**
- * A factory for generating the TestProcessor annotation processor, which
- * processes the @Test annotation.
- *
- * @author Scott Seligman
- */
-public class TestProcessorFactory implements AnnotationProcessorFactory {
-
-    public Collection<String> supportedOptions() {
-        return new ArrayList<String>();
-    }
-
-    public Collection<String> supportedAnnotationTypes() {
-        ArrayList<String> res = new ArrayList<String>();
-        res.add("Test");
-        res.add("Ignore");
-        return res;
-    }
-
-    public AnnotationProcessor getProcessorFor(
-                                        Set<AnnotationTypeDeclaration> as,
-                                        AnnotationProcessorEnvironment env) {
-        // The tester that's running.
-        Tester tester = Tester.activeTester;
-
-        try {
-            // Find the tester's class declaration.
-            ClassDeclaration testerDecl = null;
-            for (TypeDeclaration decl : env.getSpecifiedTypeDeclarations()) {
-                if (decl.getQualifiedName().equals(
-                                               tester.getClass().getName())) {
-                    testerDecl = (ClassDeclaration) decl;
-                    break;
-                }
-            }
-
-            // Give the tester access to its own declaration and to the env.
-            tester.thisClassDecl = testerDecl;
-            tester.env = env;
-
-            // Initializer the tester.
-            tester.init();
-
-            return new TestProcessor(env, tester);
-
-        } catch (Exception e) {
-            throw new Error("Couldn't create test annotation processor", e);
-        }
-    }
-}
--- a/test/tools/apt/lib/Tester.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * A utility used to invoke and test the apt tool.
- * Tests should subclass Tester, and invoke run().
- *
- * @author Scott Seligman
- */
-
-import java.io.*;
-import java.util.*;
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-
-
-public abstract class Tester {
-
-    /**
-     * The declaration corresponding to this tester's class.  Set by
-     * TestProcessorFactory after the constructor completes, and
-     * before init() is invoked.
-     */
-    ClassDeclaration thisClassDecl;
-
-    /**
-     * The environment for this apt run.  Set by TestProcessorFactory
-     * after the constructor completes, and before init() is invoked.
-     */
-    AnnotationProcessorEnvironment env;
-
-
-    // TestProcessorFactory looks here to find the tester that's running
-    // when it's invoked.
-    static Tester activeTester;
-
-    private static final String[] DEFAULT_ARGS = {
-        "-nocompile",
-        "-XPrintAptRounds",
-        "-XListDeclarations",
-    };
-    private static final String[] NO_STRINGS = {};
-
-    // Force processor and factory to be compiled
-    private static Class dummy = TestProcessorFactory.class;
-
-    private final String testSrc =     System.getProperty("test.src",     ".");
-    private final String testClasses = System.getProperty("test.classes", ".");
-
-    // apt command-line args
-    private String[] args;
-
-
-    static {
-        // Enable assertions in the unnamed package.
-        ClassLoader loader = Tester.class.getClassLoader();
-        if (loader != null) {
-            loader.setPackageAssertionStatus(null, true);
-        }
-    }
-
-
-    protected Tester(String... additionalArgs) {
-        String sourceFile = testSrc + File.separator +
-                            getClass().getName() + ".java";
-
-        ArrayList<String> as = new ArrayList<String>();
-        Collections.addAll(as, DEFAULT_ARGS);
-        as.add("-sourcepath");  as.add(testSrc);
-        as.add("-factory");     as.add(TestProcessorFactory.class.getName());
-        Collections.addAll(as, additionalArgs);
-        as.add(sourceFile);
-        args = as.toArray(NO_STRINGS);
-    }
-
-    /**
-     * Run apt.
-     */
-    protected void run() {
-        activeTester = this;
-        if (com.sun.tools.apt.Main.process(args) != 0) {
-            throw new Error("apt errors encountered.");
-        }
-    }
-
-    /**
-     * Called after thisClassDecl and env have been set, but before any
-     * tests are run, to allow the tester subclass to perform any
-     * needed initialization.
-     */
-    protected void init() {
-    }
-
-    /**
-     * Returns the declaration of a named method in this class.  If this
-     * method name is overloaded, one method is chosen arbitrarily.
-     * Returns null if no method is found.
-     */
-    protected MethodDeclaration getMethod(String methodName) {
-        for (MethodDeclaration m : thisClassDecl.getMethods()) {
-            if (methodName.equals(m.getSimpleName())) {
-                return m;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the declaration of a named field in this class.
-     * Returns null if no field is found.
-     */
-    protected FieldDeclaration getField(String fieldName) {
-        for (FieldDeclaration f : thisClassDecl.getFields()) {
-            if (fieldName.equals(f.getSimpleName())) {
-                return f;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the annotation mirror of a given type on a named method
-     * in this class.  If this method name is overloaded, one method is
-     * chosen arbitrarily.  Returns null if no appropriate annotation
-     * is found.
-     */
-    protected AnnotationMirror getAnno(String methodName, String annoType) {
-        MethodDeclaration m = getMethod(methodName);
-        if (m != null) {
-            TypeDeclaration at = env.getTypeDeclaration(annoType);
-            for (AnnotationMirror a : m.getAnnotationMirrors()) {
-                if (at == a.getAnnotationType().getDeclaration()) {
-                    return a;
-                }
-            }
-        }
-        return null;
-    }
-}
--- a/test/tools/apt/mirror/declaration/AnnoMirror.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5014539
- * @summary Tests AnnotationMirror and AnnotationValue methods.
- * @library ../../lib
- * @compile -source 1.5 AnnoMirror.java
- * @run main/othervm AnnoMirror
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-
-
-public class AnnoMirror extends Tester {
-
-    public static void main(String[] args) {
-        (new AnnoMirror()).run();
-    }
-
-
-    @Test(result={"AT1"})
-    @AT1
-    AnnotationType getAnnotationType() {
-        AnnotationMirror anno = getAnno("getAnnotationType", "AT1");
-        return anno.getAnnotationType();
-    }
-
-    @Test(result={})
-    @AT1
-    Set getElementValuesNone() {
-        AnnotationMirror anno = getAnno("getElementValuesNone", "AT1");
-        return anno.getElementValues().entrySet();
-    }
-
-
-    // The seemingly out-of-place parens in the following "result"
-    // entry are needed due to the shortcut of having the test return
-    // the entry set directly.
-    @Test(result={"i()=2",
-                  "b()=true",
-                  "k()=java.lang.Boolean.class",
-                  "a()=@AT1"})
-    @AT2(i = 1+1,
-         b = true,
-         k = Boolean.class,
-         a = @AT1)
-    Set getElementValues() {
-        AnnotationMirror anno = getAnno("getElementValues", "AT2");
-        return anno.getElementValues().entrySet();
-    }
-
-    @Test(result={"@AT1(\"zax\")",
-                  "@AT2(i=2, b=true, k=java.lang.Boolean.class, a=@AT1)",
-                  "@AT3(arr={1})",
-                  "@AT4({2, 3, 4})"})
-    Collection<AnnotationMirror> toStringTests() {
-        for (MethodDeclaration m : thisClassDecl.getMethods()) {
-            if (m.getSimpleName().equals("toStringTestsHelper")) {
-                return m.getAnnotationMirrors();
-            }
-        }
-        throw new AssertionError();
-    }
-
-    @AT1("zax")
-    @AT2(i = 1+1,
-         b = true,
-         k = Boolean.class,
-         a = @AT1)
-    @AT3(arr={1})
-    @AT4({2,3,4})
-    private void toStringTestsHelper() {
-    }
-}
-
-
-/*
- * Annotations used for testing.
- */
-
-@interface AT1 {
-    String value() default "";
-}
-
-@interface AT2 {
-    int i();
-    boolean b();
-    Class k();
-    AT1 a();
-}
-
-@interface AT3 {
-    int[] arr();
-}
-
-@interface AT4 {
-    int[] value();
-}
--- a/test/tools/apt/mirror/declaration/AnnoTypeDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5014539
- * @summary AnnotationTypeDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 AnnoTypeDecl.java
- * @run main/othervm AnnoTypeDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class AnnoTypeDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new AnnoTypeDecl()).run();
-    }
-
-
-    private AnnotationTypeDeclaration at;
-
-    protected void init() {
-        at = (AnnotationTypeDeclaration) env.getTypeDeclaration("AT");
-    }
-
-
-    // Declaration methods
-
-    @Test(result="annotation type")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        at.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitClassDeclaration(ClassDeclaration c) {
-                res.add("class");
-            }
-            public void visitInterfaceDeclaration(InterfaceDeclaration i) {
-                res.add("interface");
-            }
-            public void visitAnnotationTypeDeclaration(
-                                                AnnotationTypeDeclaration a) {
-                res.add("annotation type");
-            }
-        });
-        return res;
-    }
-
-
-    // AnnotationTypeDeclaration methods
-
-    @Test(result={"s()"})
-    Collection<AnnotationTypeElementDeclaration> getMethods() {
-        return at.getMethods();
-    }
-}
-
-
-// An annotation type to use for testing.
-
-@interface AT {
-    String s();
-}
--- a/test/tools/apt/mirror/declaration/AnnoTypeElemDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 4993299 5010385 5014539
- * @summary AnnotationTypeElementDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 AnnoTypeElemDecl.java
- * @run main/othervm AnnoTypeElemDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class AnnoTypeElemDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new AnnoTypeElemDecl()).run();
-    }
-
-
-    // Some annotation type elements to use.
-    private AnnotationTypeElementDeclaration elem1 = null;      // s()
-    private AnnotationTypeElementDeclaration elem2 = null;      // i()
-    private AnnotationTypeElementDeclaration elem3 = null;      // b()
-
-    protected void init() {
-        for (TypeDeclaration at : thisClassDecl.getNestedTypes()) {
-            for (MethodDeclaration meth : at.getMethods()) {
-                AnnotationTypeElementDeclaration elem =
-                    (AnnotationTypeElementDeclaration) meth;
-                if (elem.getSimpleName().equals("s")) {
-                    elem1 = elem;       // s()
-                } else if (elem.getSimpleName().equals("i")) {
-                    elem2 = elem;       // i()
-                } else {
-                    elem3 = elem;       // b()
-                }
-            }
-        }
-    }
-
-
-    // Declaration methods
-
-    @Test(result="anno type element")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        elem1.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitExecutableDeclaration(ExecutableDeclaration e) {
-                res.add("executable");
-            }
-            public void visitMethodDeclaration(MethodDeclaration m) {
-                res.add("method");
-            }
-            public void visitAnnotationTypeElementDeclaration(
-                                        AnnotationTypeElementDeclaration a) {
-                res.add("anno type element");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={"@AnnoTypeElemDecl.AT2"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return elem1.getAnnotationMirrors();
-    }
-
-    @Test(result=" Sed Quis custodiet ipsos custodes?\n")
-    String getDocComment() {
-        return elem1.getDocComment();
-    }
-
-    @Test(result={"public", "abstract"})
-    Collection<Modifier> getModifiers() {
-        return elem1.getModifiers();
-    }
-
-    @Test(result="AnnoTypeElemDecl.java")
-    String getPosition() {
-        return elem1.getPosition().file().getName();
-    }
-
-    @Test(result="s")
-    String getSimpleName() {
-        return elem1.getSimpleName();
-    }
-
-
-    // MemberDeclaration method
-
-    @Test(result="AnnoTypeElemDecl.AT1")
-    TypeDeclaration getDeclaringType() {
-        return elem1.getDeclaringType();
-    }
-
-
-    // ExecutableDeclaration methods
-
-    @Test(result={})
-    Collection<TypeParameterDeclaration> getFormalTypeParameters() {
-        return elem1.getFormalTypeParameters();
-    }
-
-    @Test(result={})
-    Collection<ParameterDeclaration> getParameters() {
-        return elem1.getParameters();
-    }
-
-    @Test(result={})
-    Collection<ReferenceType> getThrownTypes() {
-        return elem1.getThrownTypes();
-    }
-
-    @Test(result="false")
-    Boolean isVarArgs() {
-        return elem1.isVarArgs();
-    }
-
-
-    // AnnotationTypeElementDeclaration method
-
-    @Test(result="\"default\"")
-    AnnotationValue getDefaultValue1() {
-        return elem1.getDefaultValue();
-    }
-
-    @Test(result="null")
-    AnnotationValue getDefaultValue2() {
-        return elem2.getDefaultValue();
-    }
-
-    // 5010385: getValue() returns null for boolean type elements
-    @Test(result="false")
-    Boolean getDefaultValue3() {
-        return (Boolean) elem3.getDefaultValue().getValue();
-    }
-
-
-    // toString
-
-    @Test(result="s()")
-    String toStringTest() {
-        return elem1.toString();
-    }
-
-
-    // Declarations used by tests.
-
-    @interface AT1 {
-        /**
-         * Sed Quis custodiet ipsos custodes?
-         */
-        @AT2
-        String s() default "default";
-
-        int i();
-
-        boolean b() default false;
-    }
-
-    @interface AT2 {
-    }
-}
--- a/test/tools/apt/mirror/declaration/AnnoVal.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5014539 5034991
- * @summary Tests AnnotationValue methods.
- * @library ../../lib
- * @compile -source 1.5 AnnoVal.java
- * @run main/othervm AnnoVal
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-
-
-public class AnnoVal extends Tester {
-
-    public static void main(String[] args) {
-        (new AnnoVal()).run();
-    }
-
-    @Test(result={
-        "i Integer 2",
-        "l Long 4294967296",
-        "d Double 3.14",
-        "b Boolean true",
-        "c Character @",
-        "s String sigh",
-        // The following results reflect some implementation details.
-        "k ClassTypeImpl java.lang.Boolean",
-        "kb PrimitiveTypeImpl boolean",
-        "ka ArrayTypeImpl java.lang.Boolean[]",
-        "kab ArrayTypeImpl int[][]",
-        "w ClassTypeImpl java.lang.Long",
-        "e EnumConstantDeclarationImpl TYPE",
-        "sa ArrayList [\"up\", \"down\"]",
-        "a AnnotationMirrorImpl @AT1"})
-    @AT2(i = 1 + 1,
-         l = 1024 * 1024 * 1024 * 4L,
-         d = 3.14,
-         b = true,
-         c = '@',
-         s = "sigh",
-         k = Boolean.class,
-         kb = boolean.class,
-         ka = Boolean[].class,          // bugid 5020899
-         kab = int[][].class,           //      "
-         w = Long.class,
-         e = java.lang.annotation.ElementType.TYPE,
-         sa = {"up", "down"},
-         a = @AT1)
-    Collection<String> getValue() {
-        Collection<String> res = new ArrayList<String>();
-        AnnotationMirror anno = getAnno("getValue", "AT2");
-
-        for (Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> e :
-                 anno.getElementValues().entrySet()) {
-            Object val = e.getValue().getValue();
-            res.add(String.format("%s %s %s",
-                                  e.getKey().getSimpleName(),
-                                  simpleClassName(val),
-                                  val));
-        }
-        return res;
-    }
-
-    @Test(result={
-        "int i 2",
-        "long l 4294967296L",
-        "double d 3.14",
-        "boolean b true",
-        "char c '@'",
-        "java.lang.String s \"sigh\"",
-        "java.lang.Class k java.lang.Boolean.class",
-        "java.lang.Class kb boolean.class",
-        "java.lang.Class ka java.lang.Boolean[].class",
-        "java.lang.Class kab int[][].class",
-        "java.lang.Class<? extends java.lang.Number> w java.lang.Long.class",
-        "java.lang.annotation.ElementType e java.lang.annotation.ElementType.TYPE",
-        "java.lang.String[] sa {\"up\", \"down\"}",
-        "AT1 a @AT1"})
-    Collection<String> toStringTests() {
-        Collection<String> res = new ArrayList<String>();
-        AnnotationMirror anno = getAnno("getValue", "AT2");
-
-        for (Map.Entry<AnnotationTypeElementDeclaration,AnnotationValue> e :
-                 anno.getElementValues().entrySet()) {
-            res.add(String.format("%s %s %s",
-                                  e.getKey().getReturnType(),
-                                  e.getKey().getSimpleName(),
-                                  e.getValue().toString()));
-        }
-        return res;
-    }
-
-    @Test(result={
-        "byte b 0x0b",
-        "float f 3.0f",
-        "double nan 0.0/0.0",
-        "double hi 1.0/0.0",
-        "float lo -1.0f/0.0f",
-        "char newline '\\n'",
-        "char ff '\\u00ff'",
-        "java.lang.String s \"\\\"high\\tlow\\\"\"",
-        "java.lang.String smiley \"\\u263a\""})
-    @AT3(b = 11,
-         f = 3,
-         nan = 0.0/0.0,
-         hi = 1.0/0.0,
-         lo = -1.0f/0.0f,
-         newline = '\n',
-         ff = '\u00FF',
-         s = "\"high\tlow\"",
-         smiley = "\u263A")
-    Collection<String> toStringFancy() {
-        Collection<String> res = new ArrayList<String>();
-        AnnotationMirror anno = getAnno("toStringFancy", "AT3");
-
-        for (Map.Entry<AnnotationTypeElementDeclaration,AnnotationValue> e :
-                 anno.getElementValues().entrySet()) {
-            res.add(String.format("%s %s %s",
-                                  e.getKey().getReturnType(),
-                                  e.getKey().getSimpleName(),
-                                  e.getValue().toString()));
-        }
-        return res;
-    }
-
-
-    /**
-     * Returns the simple name of an object's class.
-     */
-    private String simpleClassName(Object o) {
-        return (o == null)
-            ? "null"
-            : o.getClass().getName().replaceFirst(".*\\.", "");
-    }
-}
-
-
-/*
- * Annotations used for testing.
- */
-
-@interface AT1 {
-    String value() default "";
-}
-
-@interface AT2 {
-    int i();
-    long l();
-    double d();
-    boolean b();
-    char c();
-    String s();
-    Class k();
-    Class kb();
-    Class ka();
-    Class kab();
-    Class<? extends Number> w();
-    java.lang.annotation.ElementType e();
-    String[] sa();
-    AT1 a();
-}
-
-@interface AT3 {
-    byte b();
-    float f();
-    double nan();
-    double hi();
-    float lo();
-    char newline();
-    char ff();
-    String s();
-    String smiley();
-}
--- a/test/tools/apt/mirror/declaration/ClassDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 4997614
- * @summary ClassDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 ClassDecl.java
- * @run main/othervm ClassDecl
- */
-
-
-import java.io.Serializable;
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-/**
- * Sed Quis custodiet ipsos custodes?
- */
-@AT1
-@AT2
-public class ClassDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new ClassDecl()).run();
-    }
-
-
-    private ClassDeclaration nested = null;     // a nested type
-    private ClassDeclaration object = null;     // java.lang.object
-
-    // A constructor to be found
-    private ClassDecl() {
-    }
-
-    // Another constructor to be found
-    private ClassDecl(int i) {
-        this();
-    }
-
-    // An extra field to be found
-    static int i;
-
-    // Static initializer isn't among this class's methods.
-    static {
-        i = 7;
-    }
-
-    // A nested class with some accoutrements
-    private static strictfp class NestedClass<T> implements Serializable {
-        void m1() {}
-        void m2() {}
-        void m2(int i) {}
-    }
-
-    protected void init() {
-        nested = (ClassDeclaration)
-            thisClassDecl.getNestedTypes().iterator().next();
-        object = (ClassDeclaration)
-            env.getTypeDeclaration("java.lang.Object");
-    }
-
-
-    // Declaration methods
-
-    @Test(result="class")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        thisClassDecl.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitClassDeclaration(ClassDeclaration c) {
-                res.add("class");
-            }
-            public void visitEnumDeclaration(EnumDeclaration e) {
-                res.add("enum");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={"@AT1", "@AT2"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return thisClassDecl.getAnnotationMirrors();
-    }
-
-    @Test(result=" Sed Quis custodiet ipsos custodes?\n")
-    String getDocComment() {
-        return thisClassDecl.getDocComment();
-    }
-
-    @Test(result={"public"})
-    Collection<Modifier> getModifiers1() {
-        return thisClassDecl.getModifiers();
-    }
-
-    // Check that static nested class has "static" modifier, even though
-    // the VM doesn't set that bit.
-    @Test(result={"private", "static", "strictfp"})
-    Collection<Modifier> getModifiers2() {
-        return nested.getModifiers();
-    }
-
-    @Test(result="ClassDecl.java")
-    String getPosition() {
-        return thisClassDecl.getPosition().file().getName();
-    }
-
-    @Test(result="ClassDecl")
-    String getSimpleName1() {
-        return thisClassDecl.getSimpleName();
-    }
-
-    @Test(result="NestedClass")
-    String getSimpleName2() {
-        return nested.getSimpleName();
-    }
-
-
-    // MemberDeclaration method
-
-    @Test(result="null")
-    TypeDeclaration getDeclaringType1() {
-        return thisClassDecl.getDeclaringType();
-    }
-
-    @Test(result="ClassDecl")
-    TypeDeclaration getDeclaringType2() {
-        return nested.getDeclaringType();
-    }
-
-
-    // TypeDeclaration methods
-
-    @Test(result={"nested", "object", "i"})
-    Collection<FieldDeclaration> getFields() {
-        return thisClassDecl.getFields();
-    }
-
-    @Test(result={})
-    Collection<TypeParameterDeclaration> getFormalTypeParameters1() {
-        return thisClassDecl.getFormalTypeParameters();
-    }
-
-    @Test(result="T")
-    Collection<TypeParameterDeclaration> getFormalTypeParameters2() {
-        return nested.getFormalTypeParameters();
-    }
-
-    @Test(result="ClassDecl.NestedClass<T>")
-    Collection<TypeDeclaration> getNestedTypes() {
-        return thisClassDecl.getNestedTypes();
-    }
-
-    @Test(result="")
-    PackageDeclaration getPackage1() {
-        return thisClassDecl.getPackage();
-    }
-
-    @Test(result="java.lang")
-    PackageDeclaration getPackage2() {
-        return object.getPackage();
-    }
-
-    @Test(result="ClassDecl")
-    String getQualifiedName1() {
-        return thisClassDecl.getQualifiedName();
-    }
-
-    @Test(result="ClassDecl.NestedClass")
-    String getQualifiedName2() {
-        return nested.getQualifiedName();
-    }
-
-    @Test(result="java.lang.Object")
-    String getQualifiedName3() {
-        return object.getQualifiedName();
-    }
-
-    @Test(result="java.io.Serializable")
-    Collection<InterfaceType> getSuperinterfaces() {
-        return nested.getSuperinterfaces();
-    }
-
-
-    // ClassDeclaration methods
-
-    @Test(result={"ClassDecl()", "ClassDecl(int)"})
-    Collection<ConstructorDeclaration> getConstructors1() {
-        return thisClassDecl.getConstructors();
-    }
-
-    // Check for default constructor.
-    // 4997614: visitConstructionDeclaration reports info when there is no ctor
-    @Test(result={"NestedClass()"})
-    Collection<ConstructorDeclaration> getConstructors2() {
-        return nested.getConstructors();
-    }
-
-    @Test(result={"m1()", "m2()", "m2(int)"})
-    Collection<MethodDeclaration> getMethods() {
-        return nested.getMethods();
-    }
-
-    @Test(result={"Tester"})
-    ClassType getSuperclass() {
-        return thisClassDecl.getSuperclass();
-    }
-
-    @Test(result={"null"})
-    ClassType objectHasNoSuperclass() {
-        return object.getSuperclass();
-    }
-}
-
-
-// Annotations used for testing.
-
-@interface AT1 {
-}
-
-@interface AT2 {
-}
--- a/test/tools/apt/mirror/declaration/ConstExpr.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 5027675 5048535
- * @summary Tests FieldDeclaration.getConstantExpression method
- * @library ../../lib
- * @compile -source 1.5 ConstExpr.java
- * @run main/othervm ConstExpr
- */
-
-
-import java.math.RoundingMode;
-import java.util.*;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import static java.math.RoundingMode.UP;
-
-import static com.sun.mirror.util.DeclarationVisitors.*;
-
-
-public class ConstExpr extends Tester {
-
-    public static void main(String[] args) {
-        (new ConstExpr()).run();
-    }
-
-
-    // Declarations used by tests
-
-    public static final byte B = (byte) 0xBE;
-    public static final short S = (short) 32767;
-    public static final int I = -4;
-    public static final long l = 4294967296L;
-    public static final float f = 3.5f;
-    public static final double PI = Math.PI;
-    public static final char C = 'C';
-    public static final String STR = "cheese";
-
-    public static final char SMILEY = '\u263A';
-    public static final String TWOLINES = "ab\ncd";
-
-    public static final double D1 = Double.POSITIVE_INFINITY;
-    public static final double D2 = Double.NEGATIVE_INFINITY;
-    public static final double D3 = Double.NaN;
-    public static final float  F1 = Float.POSITIVE_INFINITY;
-    public static final float  F2 = Float.NEGATIVE_INFINITY;
-    public static final float  F3 = Float.NaN;
-
-    public static final String NOSTR = null;    // not a compile-time constant
-    public static final RoundingMode R = UP;    // not a compile-time constant
-
-
-    @Test(result={
-              "0xbe",
-              "32767",
-              "-4",
-              "4294967296L",
-              "3.5f",
-              "3.141592653589793",
-              "'C'",
-              "\"cheese\"",
-
-              "'\\u263a'",
-              "\"ab\\ncd\"",
-
-              "1.0/0.0",
-              "-1.0/0.0",
-              "0.0/0.0",
-              "1.0f/0.0f",
-              "-1.0f/0.0f",
-              "0.0f/0.0f",
-
-              "null",
-              "null"
-          },
-          ordered=true)
-    Collection<String> getConstantExpression() {
-        final Collection<String> res = new ArrayList<String>();
-
-        thisClassDecl.accept(
-            DeclarationVisitors.getSourceOrderDeclarationScanner(
-                NO_OP,
-                new SimpleDeclarationVisitor() {
-                    public void visitFieldDeclaration(FieldDeclaration f) {
-                        res.add(f.getConstantExpression());
-                    }
-                }));
-        return res;
-    }
-}
--- a/test/tools/apt/mirror/declaration/ConstructorDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 4993299
- * @summary ConstructorDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 ConstructorDecl.java
- * @run main/othervm ConstructorDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class ConstructorDecl extends Tester {
-
-    /**
-     * Sed Quis custodiet ipsos custodes?
-     */
-    @AT1
-    public ConstructorDecl() {
-    }
-
-
-    public static void main(String[] args) {
-        (new ConstructorDecl()).run();
-    }
-
-
-    private ConstructorDeclaration ctor = null;         // a constructor
-    private ConstructorDeclaration ctorDef = null;      // a default c'tor
-    private ConstructorDeclaration ctorInner = null;    // an inner class c'tor
-
-    protected void init() {
-        ctor = getAConstructor(thisClassDecl);
-        ctorDef = getAConstructor((ClassDeclaration)
-                                  env.getTypeDeclaration("C1"));
-        ctorInner = getAConstructor((ClassDeclaration)
-                                    env.getTypeDeclaration("C1.C2"));
-    }
-
-    // Return a constructor of a class.
-    private ConstructorDeclaration getAConstructor(ClassDeclaration c) {
-        return c.getConstructors().iterator().next();
-    }
-
-
-    // Declaration methods
-
-    @Test(result="constructor")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        ctor.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitExecutableDeclaration(ExecutableDeclaration e) {
-                res.add("executable");
-            }
-            public void visitConstructorDeclaration(ConstructorDeclaration c) {
-                res.add("constructor");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={"@AT1"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return ctor.getAnnotationMirrors();
-    }
-
-    @Test(result=" Sed Quis custodiet ipsos custodes?\n")
-    String getDocComment() {
-        return ctor.getDocComment();
-    }
-
-    @Test(result={"public"})
-    Collection<Modifier> getModifiers() {
-        return ctor.getModifiers();
-    }
-
-    @Test(result="ConstructorDecl.java")
-    String getPosition() {
-        return ctor.getPosition().file().getName();
-    }
-
-    @Test(result="ConstructorDecl.java")
-    String getPositionDefault() {
-        return ctorDef.getPosition().file().getName();
-    }
-
-    @Test(result="ConstructorDecl")
-    String getSimpleName() {
-        return ctor.getSimpleName();
-    }
-
-    @Test(result="C2")
-    String getSimpleNameInner() {
-        return ctorInner.getSimpleName();
-    }
-
-
-    // MemberDeclaration method
-
-    @Test(result="ConstructorDecl")
-    TypeDeclaration getDeclaringType() {
-        return ctor.getDeclaringType();
-    }
-
-
-    // ExecutableDeclaration methods
-
-    @Test(result={})
-    Collection<TypeParameterDeclaration> getFormalTypeParameters1() {
-        return ctor.getFormalTypeParameters();
-    }
-
-    @Test(result={"N extends java.lang.Number"})
-    Collection<TypeParameterDeclaration> getFormalTypeParameters2() {
-        return ctorInner.getFormalTypeParameters();
-    }
-
-    @Test(result={})
-    Collection<ParameterDeclaration> getParameters1() {
-        return ctor.getParameters();
-    }
-
-    // 4993299: verify synthetic parameters to inner class constructors
-    //          aren't visible
-    @Test(result={"N n1", "N n2", "java.lang.String[] ss"},
-          ordered=true)
-    Collection<ParameterDeclaration> getParameters2() {
-        return ctorInner.getParameters();
-    }
-
-    @Test(result={"java.lang.Throwable"})
-    Collection<ReferenceType> getThrownTypes() {
-        return ctorInner.getThrownTypes();
-    }
-
-    @Test(result="false")
-    Boolean isVarArgs1() {
-        return ctor.isVarArgs();
-    }
-
-    @Test(result="true")
-    Boolean isVarArgs2() {
-        return ctorInner.isVarArgs();
-    }
-
-
-    // toString
-
-    @Test(result="<N extends java.lang.Number> C2(N, N, String...)")
-    @Ignore("This is what it would be nice to see.")
-    String toStringTest() {
-        return ctorInner.toString();
-    }
-}
-
-
-// Classes and interfaces used for testing.
-
-class C1 {
-    class C2 {
-        <N extends Number> C2(N n1, N n2, String... ss) throws Throwable {
-        }
-    }
-}
-
-@interface AT1 {
-}
--- a/test/tools/apt/mirror/declaration/EnumDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 4989987 5010050
- * @summary EnumDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 EnumDecl.java
- * @run main/othervm EnumDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class EnumDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new EnumDecl()).run();
-    }
-
-
-    private EnumDeclaration eDecl;
-
-    protected void init() {
-        eDecl = (EnumDeclaration) env.getTypeDeclaration("E");
-    }
-
-
-    // Declaration methods
-
-    @Test(result="enum")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        eDecl.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitClassDeclaration(ClassDeclaration c) {
-                res.add("class");
-            }
-            public void visitEnumDeclaration(EnumDeclaration e) {
-                res.add("enum");
-            }
-        });
-        return res;
-    }
-
-
-    // ClassDeclaration methods
-
-    // 4989987: Verify synthetic enum constructor parameters are not visible
-    @Test(result={"E(java.lang.String)"})
-    Collection<ConstructorDeclaration> getConstructors() {
-        return eDecl.getConstructors();
-    }
-
-    // 4989987: Verify synthetic enum constructor parameters are not visible
-    @Test(result={"java.lang.String color"})
-    Collection<ParameterDeclaration> getConstructorParams() {
-        return eDecl.getConstructors().iterator().next().getParameters();
-    }
-
-    @Test(result={"values()", "valueOf(java.lang.String)"})
-    Collection<MethodDeclaration> getMethods() {
-        return eDecl.getMethods();
-    }
-
-    // 5010050: Cannot find parameter names for valueOf(String name) method...
-    @Test(result={"java.lang.String name"})
-    Collection<ParameterDeclaration> getMethodParams() {
-        for (MethodDeclaration m : eDecl.getMethods()) {
-            if (m.getSimpleName().equals("valueOf")) {
-                return m.getParameters();
-            }
-        }
-        throw new AssertionError();
-    }
-
-
-    // EnumDeclaration methods
-
-    @Test(result={"stop", "slow", "go"})
-    Collection<EnumConstantDeclaration> getEnumConstants() {
-        return eDecl.getEnumConstants();
-    }
-}
-
-
-// An enum to use for testing.
-
-enum E {
-    stop("red"),
-    slow("amber"),
-    go("green");
-
-    private String color;
-    E(String color) {
-        this.color = color;
-    }
-}
--- a/test/tools/apt/mirror/declaration/FieldDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5008309
- * @summary FieldDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 FieldDecl.java
- * @run main/othervm FieldDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class FieldDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new FieldDecl()).run();
-    }
-
-
-    private FieldDeclaration f1 = null;         // a field
-    private FieldDeclaration f2 = null;         // a static field
-    private FieldDeclaration f3 = null;         // a constant field
-
-    protected void init() {
-        f1 = getField("aField");
-        f2 = getField("aStaticField");
-        f3 = getField("aConstantField");
-    }
-
-
-    // Declaration methods
-
-    @Test(result="field")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        f1.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitFieldDeclaration(FieldDeclaration f) {
-                res.add("field");
-            }
-            public void visitEnumConstantDeclaration(
-                                                EnumConstantDeclaration e) {
-                res.add("enum const");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={"@FieldDecl.AT1"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return f1.getAnnotationMirrors();
-    }
-
-    @Test(result=" Sed Quis custodiet ipsos custodes?\n")
-    String getDocComment() {
-        return f1.getDocComment();
-    }
-
-    @Test(result={"public"})
-    Collection<Modifier> getModifiers() {
-        return f1.getModifiers();
-    }
-
-    @Test(result="FieldDecl.java")
-    String getPosition() {
-        return f1.getPosition().file().getName();
-    }
-
-    @Test(result="aField")
-    String getSimpleName() {
-        return f1.getSimpleName();
-    }
-
-
-    // MemberDeclaration method
-
-    @Test(result="FieldDecl")
-    TypeDeclaration getDeclaringType() {
-        return f1.getDeclaringType();
-    }
-
-
-    // FieldDeclaration methods
-
-    @Test(result="java.util.List<java.lang.String>")
-    TypeMirror getType1() {
-        return f1.getType();
-    }
-
-    @Test(result="int")
-    TypeMirror getType2() {
-        return f2.getType();
-    }
-
-    @Test(result="null")
-    Object getConstantValue1() {
-        return f1.getConstantValue();
-    }
-
-    // 5008309: FieldDeclaration.getConstantValue() doesn't return anything
-    @Test(result="true")
-    Object getConstantValue2() {
-        return f3.getConstantValue();
-    }
-
-
-    // toString
-
-    @Test(result="aField")
-    String toStringTest() {
-        return f1.toString();
-    }
-
-
-    // Declarations used by tests.
-
-    /**
-     * Sed Quis custodiet ipsos custodes?
-     */
-    @AT1
-    public List<String> aField = new ArrayList<String>();
-
-    static int aStaticField;
-
-    public static final boolean aConstantField = true;
-
-
-    @interface AT1 {
-    }
-}
--- a/test/tools/apt/mirror/declaration/GetAnno.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4989091 5050782 5051962
- * @summary Tests Declaration.getAnnotation method
- * @library ../../lib
- * @compile -source 1.5 GetAnno.java
- * @run main/othervm GetAnno
- */
-
-
-import java.lang.annotation.*;
-import java.util.*;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-
-import static java.lang.annotation.RetentionPolicy.*;
-
-
-public class GetAnno extends Tester {
-
-    public static void main(String[] args) {
-        (new GetAnno()).run();
-    }
-
-
-    // Annotations used by tests
-
-    @Retention(RUNTIME)
-    @interface AT1 {
-        long l();
-        String s();
-        RetentionPolicy e();
-        String[] sa();
-        AT2 a();
-    }
-
-    @Inherited
-    @interface AT2 {
-    }
-
-    @interface AT3 {
-        Class value() default String.class;
-    }
-
-    // Array-valued elements of various kinds.
-    @interface AT4 {
-        boolean[] bs();
-        long[] ls();
-        String[] ss();
-        RetentionPolicy[] es();
-        AT2[] as();
-    }
-
-
-    @Test(result="@GetAnno$AT1(l=7, s=sigh, e=CLASS, sa=[in, out], " +
-                              "a=@GetAnno$AT2())")
-    @AT1(l=7, s="sigh", e=CLASS, sa={"in", "out"}, a=@AT2)
-    public Annotation getAnnotation() {
-        MethodDeclaration m = getMethod("getAnnotation");
-        AT1 a = m.getAnnotation(AT1.class);
-        if (a.l() != 7 || !a.s().equals("sigh") || a.e() != CLASS)
-            throw new AssertionError();
-        return a;
-    }
-
-    @Test(result="null")
-    public Annotation getAnnotationNotThere() {
-        return thisClassDecl.getAnnotation(Deprecated.class);
-    }
-
-    @Test(result="@GetAnno$AT4(bs=[true, false], " +
-                              "ls=[9, 8], " +
-                              "ss=[black, white], " +
-                              "es=[CLASS, SOURCE], " +
-                              "as=[@GetAnno$AT2(), @GetAnno$AT2()])")
-    @AT4(bs={true, false},
-         ls={9, 8},
-         ss={"black", "white"},
-         es={CLASS, SOURCE},
-         as={@AT2, @AT2})
-    public AT4 getAnnotationArrayValues() {
-        MethodDeclaration m = getMethod("getAnnotationArrayValues");
-        return m.getAnnotation(AT4.class);
-    }
-
-    @Test(result="@GetAnno$AT3(value=java.lang.String)")
-    @AT3(String.class)
-    public AT3 getAnnotationWithClass1() {
-        MethodDeclaration m = getMethod("getAnnotationWithClass1");
-        return m.getAnnotation(AT3.class);
-    }
-
-    @Test(result="java.lang.String")
-    public TypeMirror getAnnotationWithClass2() {
-        AT3 a = getAnnotationWithClass1();
-        try {
-            Class c = a.value();
-            throw new AssertionError();
-        } catch (MirroredTypeException e) {
-            return e.getTypeMirror();
-        }
-    }
-
-    @Test(result="boolean")
-    @AT3(boolean.class)
-    public TypeMirror getAnnotationWithPrim() {
-        MethodDeclaration m = getMethod("getAnnotationWithPrim");
-        AT3 a = m.getAnnotation(AT3.class);
-        try {
-            Class c = a.value();
-            throw new AssertionError();
-        } catch (MirroredTypeException e) {
-            return e.getTypeMirror();
-        }
-    }
-
-    // 5050782
-    @Test(result="null")
-    public AT2 getInheritedAnnotation() {
-        return thisClassDecl.getAnnotation(AT2.class);
-    }
-
-    /**
-     * Verify that an annotation created by Declaration.getAnnotation()
-     * has the same hash code as a like annotation created by core
-     * reflection.
-     */
-    @Test(result="true")
-    @AT1(l=7, s="sigh", e=CLASS, sa={"in", "out"}, a=@AT2)
-    public boolean getAnnotationHashCode() {
-        MethodDeclaration m1 = getMethod("getAnnotationHashCode");
-        AT1 a1 = m1.getAnnotation(AT1.class);
-        java.lang.reflect.Method m2 = null;
-        try {
-            m2 = this.getClass().getMethod("getAnnotationHashCode");
-        } catch (NoSuchMethodException e) {
-            assert false;
-        }
-        AT1 a2 = m2.getAnnotation(AT1.class);
-        return a1.hashCode() == a2.hashCode();
-    }
-}
--- a/test/tools/apt/mirror/declaration/InterfaceDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 4993303 5004618 5010746
- * @summary InterfaceDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 InterfaceDecl.java
- * @run main/othervm InterfaceDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-/**
- * Sed Quis custodiet ipsos custodes?
- */
-@AT1
-@AT2
-public class InterfaceDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new InterfaceDecl()).run();
-    }
-
-
-    private InterfaceDeclaration iDecl = null;          // an interface
-    private InterfaceDeclaration nested = null;         // a nested interface
-
-    protected void init() {
-        iDecl = (InterfaceDeclaration) env.getTypeDeclaration("I");
-        nested = (InterfaceDeclaration)
-            iDecl.getNestedTypes().iterator().next();
-    }
-
-
-    // Declaration methods
-
-    @Test(result="interface")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        iDecl.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitClassDeclaration(ClassDeclaration c) {
-                res.add("class");
-            }
-            public void visitInterfaceDeclaration(InterfaceDeclaration e) {
-                res.add("interface");
-            }
-            public void visitAnnotationTypeDeclaration(
-                                        AnnotationTypeDeclaration e) {
-                res.add("annotation type");
-            }
-        });
-        return res;
-    }
-
-    @Test(result="true")
-    boolean equals1() {
-        return iDecl.equals(iDecl);
-    }
-
-    @Test(result="false")
-    boolean equals2() {
-        return iDecl.equals(nested);
-    }
-
-    @Test(result="true")
-    boolean equals3() {
-        return iDecl.equals(env.getTypeDeclaration("I"));
-    }
-
-
-    @Test(result={"@AT1", "@AT2"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return iDecl.getAnnotationMirrors();
-    }
-
-    @Test(result=" Sed Quis custodiet ipsos custodes?\n")
-    String getDocComment() {
-        return iDecl.getDocComment();
-    }
-
-    // Check that interface has "abstract" modifier, even though it's implict
-    // in the source code.
-    @Test(result={"abstract"})
-    Collection<Modifier> getModifiers1() {
-        return iDecl.getModifiers();
-    }
-
-    // Check that nested interface has "static" modifier, even though
-    // it's implicit in the source code and the VM doesn't set that bit.
-    @Test(result={"public", "abstract", "static"})
-    Collection<Modifier> getModifiers2() {
-        return nested.getModifiers();
-    }
-
-    @Test(result="InterfaceDecl.java")
-    String getPosition() {
-        return iDecl.getPosition().file().getName();
-    }
-
-    @Test(result="I")
-    String getSimpleName1() {
-        return iDecl.getSimpleName();
-    }
-
-    @Test(result="Nested")
-    String getSimpleName2() {
-        return nested.getSimpleName();
-    }
-
-
-    // MemberDeclaration method
-
-    @Test(result="null")
-    TypeDeclaration getDeclaringType1() {
-        return iDecl.getDeclaringType();
-    }
-
-    @Test(result="I<T extends java.lang.Number>")
-    TypeDeclaration getDeclaringType2() {
-        return nested.getDeclaringType();
-    }
-
-
-    // TypeDeclaration methods
-
-    @Test(result={"i"})
-    Collection<FieldDeclaration> getFields() {
-        return iDecl.getFields();
-    }
-
-    @Test(result={"T extends java.lang.Number"})
-    Collection<TypeParameterDeclaration> getFormalTypeParameters1() {
-        return iDecl.getFormalTypeParameters();
-    }
-
-    @Test(result={})
-    Collection<TypeParameterDeclaration> getFormalTypeParameters2() {
-        return nested.getFormalTypeParameters();
-    }
-
-    // 4993303: verify policy on Object methods being visible
-    @Test(result={"m()", "toString()"})
-    Collection<? extends MethodDeclaration> getMethods() {
-        return nested.getMethods();
-    }
-
-    @Test(result="I.Nested")
-    Collection<TypeDeclaration> getNestedTypes() {
-        return iDecl.getNestedTypes();
-    }
-
-    @Test(result="")
-    PackageDeclaration getPackage1() {
-        return iDecl.getPackage();
-    }
-
-    @Test(result="java.util")
-    PackageDeclaration getPackage2() {
-        InterfaceDeclaration set =
-            (InterfaceDeclaration) env.getTypeDeclaration("java.util.Set");
-        return set.getPackage();
-    }
-
-    @Test(result="I")
-    String getQualifiedName1() {
-        return iDecl.getQualifiedName();
-    }
-
-    @Test(result="I.Nested")
-    String getQualifiedName2() {
-        return nested.getQualifiedName();
-    }
-
-    @Test(result="java.util.Set")
-    String getQualifiedName3() {
-        InterfaceDeclaration set =
-            (InterfaceDeclaration) env.getTypeDeclaration("java.util.Set");
-        return set.getQualifiedName();
-    }
-
-    @Test(result="java.lang.Runnable")
-    Collection<InterfaceType> getSuperinterfaces() {
-        return iDecl.getSuperinterfaces();
-    }
-}
-
-
-// Interfaces used for testing.
-
-/**
- * Sed Quis custodiet ipsos custodes?
- */
-@AT1
-@AT2
-interface I<T extends Number> extends Runnable {
-    int i = 6;
-    void m1();
-    void m2();
-    void m2(int j);
-
-    interface Nested {
-        void m();
-        String toString();
-    }
-}
-
-@interface AT1 {
-}
-
-@interface AT2 {
-}
--- a/test/tools/apt/mirror/declaration/MethodDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5010746
- * @summary MethodDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 MethodDecl.java
- * @run main/othervm MethodDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class MethodDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new MethodDecl()).run();
-    }
-
-
-    private MethodDeclaration meth1 = null;             // a method
-    private MethodDeclaration meth2 = null;             // another method
-
-    protected void init() {
-        meth1 = getMethod("m1");
-        meth2 = getMethod("m2");
-    }
-
-
-    // Declaration methods
-
-    @Test(result="method")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        meth1.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitExecutableDeclaration(ExecutableDeclaration e) {
-                res.add("executable");
-            }
-            public void visitMethodDeclaration(MethodDeclaration m) {
-                res.add("method");
-            }
-            public void visitAnnotationTypeElementDeclaration(
-                                        AnnotationTypeElementDeclaration a) {
-                res.add("anno type element");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={"@AT1"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return meth1.getAnnotationMirrors();
-    }
-
-    @Test(result=" Sed Quis custodiet ipsos custodes?\n")
-    String getDocComment() {
-        return meth1.getDocComment();
-    }
-
-    @Test(result={"private", "static", "strictfp"})
-    Collection<Modifier> getModifiers() {
-        return meth1.getModifiers();
-    }
-
-    // Interface methods are implicitly public and abstract.
-    @Test(result={"public", "abstract"})
-    Collection<Modifier> getModifiersInterface() {
-        for (TypeDeclaration t : thisClassDecl.getNestedTypes()) {
-            for (MethodDeclaration m : t.getMethods()) {
-                return m.getModifiers();
-            }
-        }
-        throw new AssertionError();
-    }
-
-    @Test(result="MethodDecl.java")
-    String getPosition() {
-        return meth1.getPosition().file().getName();
-    }
-
-    @Test(result="m2")
-    String getSimpleName() {
-        return meth2.getSimpleName();
-    }
-
-
-    // MemberDeclaration method
-
-    @Test(result="MethodDecl")
-    TypeDeclaration getDeclaringType() {
-        return meth1.getDeclaringType();
-    }
-
-
-    // ExecutableDeclaration methods
-
-    @Test(result={})
-    Collection<TypeParameterDeclaration> getFormalTypeParameters1() {
-        return meth1.getFormalTypeParameters();
-    }
-
-    @Test(result={"T", "N extends java.lang.Number"},
-          ordered=true)
-    Collection<TypeParameterDeclaration> getFormalTypeParameters2() {
-        return meth2.getFormalTypeParameters();
-    }
-
-    @Test(result={})
-    Collection<ParameterDeclaration> getParameters1() {
-        return meth1.getParameters();
-    }
-
-    @Test(result={"N n", "java.lang.String[] ss"},
-          ordered=true)
-    Collection<ParameterDeclaration> getParameters2() {
-        return meth2.getParameters();
-    }
-
-    @Test(result="true")
-    boolean parameterEquals1() {
-        ParameterDeclaration p1 =
-            getMethod("m3").getParameters().iterator().next();
-        ParameterDeclaration p2 =
-            getMethod("m3").getParameters().iterator().next();
-        return p1.equals(p2);
-    }
-
-    @Test(result="false")
-    boolean parameterEquals2() {
-        ParameterDeclaration p1 =
-            getMethod("m3").getParameters().iterator().next();
-        ParameterDeclaration p2 =
-            getMethod("m4").getParameters().iterator().next();
-        return p1.equals(p2);
-    }
-
-    @Test(result="true")
-    boolean parameterHashCode() {
-        ParameterDeclaration p1 =
-            getMethod("m3").getParameters().iterator().next();
-        ParameterDeclaration p2 =
-            getMethod("m3").getParameters().iterator().next();
-        return p1.hashCode() == p2.hashCode();
-    }
-
-    @Test(result={"java.lang.Throwable"})
-    Collection<ReferenceType> getThrownTypes() {
-        return meth2.getThrownTypes();
-    }
-
-    @Test(result="false")
-    Boolean isVarArgs1() {
-        return meth1.isVarArgs();
-    }
-
-    @Test(result="true")
-    Boolean isVarArgs2() {
-        return meth2.isVarArgs();
-    }
-
-
-    // MethodDeclaration methods
-
-    @Test(result="void")
-    TypeMirror getReturnType1() {
-        return meth1.getReturnType();
-    }
-
-    @Test(result="N")
-    TypeMirror getReturnType2() {
-        return meth2.getReturnType();
-    }
-
-
-    // toString
-
-    @Test(result="<T, N extends java.lang.Number> m2(N, java.lang.String...)")
-    @Ignore("This is what it would be nice to see.")
-    String toStringTest() {
-        return meth2.toString();
-    }
-
-
-    // Declarations used by tests.
-
-    /**
-     * Sed Quis custodiet ipsos custodes?
-     */
-    @AT1
-    private static strictfp void m1() {
-    }
-
-    private <T, N extends Number> N m2(N n, String... ss) throws Throwable {
-        return null;
-    }
-
-    private void m3(String s) {
-    }
-
-    private void m4(String s) {
-    }
-
-    // A nested interface
-    interface I {
-        void m();
-    }
-}
-
-
-// Annotation type used by tests.
-
-@interface AT1 {
-}
--- a/test/tools/apt/mirror/declaration/PackageDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5031168
- * @summary PackageDeclaration tests
- * @library ../../lib
- * @compile -source 1.5 PackageDecl.java
- * @run main/othervm PackageDecl
- */
-
-
-import java.io.File;
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import pkg1.pkg2.*;
-
-
-/**
- * Sed Quis custodiet ipsos custodes?
- */
-public class PackageDecl extends Tester {
-
-    public PackageDecl() {
-        super(System.getProperty("test.src", ".") + File.separator +
-              "pkg1" + File.separator + "package-info.java");
-    }
-
-    public static void main(String[] args) {
-        (new PackageDecl()).run();
-    }
-
-
-    private PackageDeclaration pkg1 = null;             // a package
-    private PackageDeclaration pkg2 = null;             // a subpackage
-
-    protected void init() {
-        pkg1 = env.getPackage("pkg1");
-        pkg2 = env.getPackage("pkg1.pkg2");
-    }
-
-
-    // Declaration methods
-
-    @Test(result="package")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        pkg1.accept(new SimpleDeclarationVisitor() {
-            public void visitTypeDeclaration(TypeDeclaration t) {
-                res.add("type");
-            }
-            public void visitPackageDeclaration(PackageDeclaration p) {
-                res.add("package");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={"@pkg1.AnAnnoType"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return pkg1.getAnnotationMirrors();
-    }
-
-    @Test(result=" Herein lieth the package comment.\n" +
-                 " A doc comment it be, and wonderous to behold.\n")
-    String getDocCommentFromPackageInfoFile() {
-        return pkg1.getDocComment();
-    }
-
-    @Test(result="\nHerein lieth the package comment.\n" +
-                 "An HTML file it be, and wonderous to behold.\n\n")
-    @Ignore("Not yet supported")
-    String getDocCommentFromHtmlFile() {
-        return pkg2.getDocComment();
-    }
-
-    @Test(result={})
-    Collection<Modifier> getModifiers() {
-        return pkg1.getModifiers();
-    }
-
-    @Test(result="null")
-    SourcePosition getPosition() {
-        return thisClassDecl.getPackage().getPosition();
-    }
-
-    @Test(result="package-info.java")
-    String getPositionFromPackageInfoFile() {
-        return pkg1.getPosition().file().getName();
-    }
-
-    @Test(result="pkg1/pkg2/package.html")
-    @Ignore("Not yet supported")
-    String getPositionFromHtmlFile() {
-        return pkg2.getPosition().file().getName()
-                                            .replace(File.separatorChar, '/');
-    }
-
-    @Test(result="pkg1")
-    String getSimpleName1() {
-        return pkg1.getSimpleName();
-    }
-
-    @Test(result="pkg2")
-    String getSimpleName2() {
-        return pkg2.getSimpleName();
-    }
-
-
-    // PackageDeclaration methods
-
-    @Test(result="pkg1.AnAnnoType")
-    Collection<AnnotationTypeDeclaration> getAnnotationTypes() {
-        return pkg1.getAnnotationTypes();
-    }
-
-    @Test(result={"pkg1.AClass", "pkg1.AnEnum"})
-    Collection<ClassDeclaration> getClasses() {
-        return pkg1.getClasses();
-    }
-
-    @Test(result="pkg1.AnEnum")
-    Collection<EnumDeclaration> getEnums() {
-        return pkg1.getEnums();
-    }
-
-    @Test(result={"pkg1.AnInterface", "pkg1.AnAnnoType"})
-    Collection<InterfaceDeclaration> getInterfaces() {
-        return pkg1.getInterfaces();
-    }
-
-    @Test(result="pkg1")
-    String getQualifiedName1() {
-        return pkg1.getQualifiedName();
-    }
-
-    @Test(result="pkg1.pkg2")
-    String getQualifiedName2() {
-        return pkg2.getQualifiedName();
-    }
-}
--- a/test/tools/apt/mirror/declaration/ParameterDecl.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5031171
- * @summary ParameterDeclaration tests
- * @library ../../lib
- * @run main/othervm ParameterDecl
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class ParameterDecl extends Tester {
-
-    public static void main(String[] args) {
-        (new ParameterDecl()).run();
-    }
-
-
-    // Declarations used by tests
-
-    @interface AT1 {
-    }
-
-    @interface AT2 {
-        boolean value();
-    }
-
-    private void m1(@AT1 @AT2(true) final int p1) {
-    }
-
-    private void m2(int p1) {
-    }
-
-
-    private ParameterDeclaration p1 = null;     // a parameter
-
-    protected void init() {
-        p1 = getMethod("m1").getParameters().iterator().next();
-    }
-
-
-    // Declaration methods
-
-    @Test(result="param")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        p1.accept(new SimpleDeclarationVisitor() {
-            public void visitFieldDeclaration(FieldDeclaration f) {
-                res.add("field");
-            }
-            public void visitParameterDeclaration(ParameterDeclaration p) {
-                res.add("param");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={"@ParameterDecl.AT1", "@ParameterDecl.AT2(true)"})
-    Collection<AnnotationMirror> getAnnotationMirrors() {
-        return p1.getAnnotationMirrors();
-    }
-
-    @Test(result={"final"})
-    Collection<Modifier> getModifiers() {
-        return p1.getModifiers();
-    }
-
-    @Test(result="ParameterDecl.java")
-    String getPosition() {
-        return p1.getPosition().file().getName();
-    }
-
-    @Test(result="p1")
-    String getSimpleName() {
-        return p1.getSimpleName();
-    }
-
-
-    // ParameterDeclaration methods
-
-    @Test(result="int")
-    TypeMirror getType() {
-        return p1.getType();
-    }
-
-
-    // toString, equals
-
-    @Test(result="int p1")
-    String toStringTest() {
-        return p1.toString();
-    }
-
-    @Test(result="true")
-    boolean equalsTest1() {
-        ParameterDeclaration p =
-            getMethod("m1").getParameters().iterator().next();
-        return p1.equals(p);
-    }
-
-    // Not all p1's are equal.
-    @Test(result="false")
-    boolean equalsTest2() {
-        ParameterDeclaration p2 =
-            getMethod("m2").getParameters().iterator().next();
-        return p1.equals(p2);
-    }
-}
--- a/test/tools/apt/mirror/declaration/pkg1/AClass.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package pkg1;
-
-public class AClass {
-}
--- a/test/tools/apt/mirror/declaration/pkg1/AnAnnoType.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-package pkg1;
-
-public @interface AnAnnoType {
-}
--- a/test/tools/apt/mirror/declaration/pkg1/AnEnum.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package pkg1;
-
-enum AnEnum {
-}
--- a/test/tools/apt/mirror/declaration/pkg1/AnInterface.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-package pkg1;
-
-public interface AnInterface {
-}
--- a/test/tools/apt/mirror/declaration/pkg1/package-info.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/**
- * Herein lieth the package comment.
- * A doc comment it be, and wonderous to behold.
- */
-@AnAnnoType
-package pkg1;
--- a/test/tools/apt/mirror/declaration/pkg1/pkg2/AnInterface.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1.pkg2;
-
-public interface AnInterface {
-}
--- a/test/tools/apt/mirror/declaration/pkg1/pkg2/package.html	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body bgcolor="white">
-
-Herein lieth the package comment.
-An HTML file it be, and wonderous to behold.
-
-</body>
-</html>
--- a/test/tools/apt/mirror/type/AnnoTyp.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450
- * @summary AnnotationType tests
- * @library ../../lib
- * @compile -source 1.5 AnnoTyp.java
- * @run main/othervm AnnoTyp
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class AnnoTyp extends Tester {
-
-    public static void main(String[] args) {
-        (new AnnoTyp()).run();
-    }
-
-
-    // Declaration used by tests
-
-    @interface AT {
-    }
-
-
-    private AnnotationType at;  // an annotation type
-
-    @AT
-    protected void init() {
-        at = getAnno("init", "AnnoTyp.AT").getAnnotationType();
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="anno type")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        at.accept(new SimpleTypeVisitor() {
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-            public void visitClassType(ClassType t) {
-                res.add("class");
-            }
-            public void visitInterfaceType(InterfaceType t) {
-                res.add("interface");
-            }
-            public void visitAnnotationType(AnnotationType t) {
-                res.add("anno type");
-            }
-        });
-        return res;
-    }
-
-
-    // AnnotationType method
-
-    @Test(result="AnnoTyp.AT")
-    AnnotationTypeDeclaration getDeclaration() {
-        return at.getDeclaration();
-    }
-}
--- a/test/tools/apt/mirror/type/ArrayTyp.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5009357
- * @summary ArrayType tests
- * @library ../../lib
- * @compile -source 1.5 ArrayTyp.java
- * @run main/othervm ArrayTyp
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class ArrayTyp extends Tester {
-
-    public static void main(String[] args) {
-        (new ArrayTyp()).run();
-    }
-
-
-    // Declaration used by tests
-
-    private boolean[] bs;
-    private String[][] bss;
-
-
-    private ArrayType arr;              // an array type
-    private ArrayType arrarr;           // a multi-dimensional array type
-
-    protected void init() {
-        arr = (ArrayType) getField("bs").getType();
-        arrarr = (ArrayType) getField("bss").getType();
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="array")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        arr.accept(new SimpleTypeVisitor() {
-            public void visitTypeMirror(TypeMirror t) {
-                res.add("type");
-            }
-            public void visitArrayType(ArrayType t) {
-                res.add("array");
-            }
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-        });
-        return res;
-    }
-
-    @Test(result="boolean[]")
-    String toStringTest() {
-        return arr.toString();
-    }
-
-    @Test(result="java.lang.String[][]")
-    String toStringTestMulti() {
-        return arrarr.toString();
-    }
-
-
-    // ArrayType method
-
-    @Test(result="boolean")
-    TypeMirror getComponentType() {
-        return (PrimitiveType) arr.getComponentType();
-    }
-
-    @Test(result="java.lang.String[]")
-    TypeMirror getComponentTypeMulti() {
-        return (ArrayType) arrarr.getComponentType();
-    }
-}
--- a/test/tools/apt/mirror/type/ClassTyp.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5009360 5055963
- * @summary ClassType tests
- * @library ../../lib
- * @run main/othervm ClassTyp
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class ClassTyp<T1,T2> extends Tester {
-
-    public static void main(String[] args) {
-        (new ClassTyp()).run();
-    }
-
-
-    // Declarations used by tests
-
-    static class C1<S> extends AbstractSet<S> implements Set<S> {
-        class C2<R> {
-        }
-
-        static class C3<R> {
-            class C4<Q> {
-            }
-        }
-
-        public Iterator<S> iterator() {
-            return null;
-        }
-
-        public int size() {
-            return 0;
-        }
-    }
-
-
-    // Generate some class types to test.
-    private C1<T1> f0;
-    private C1<String> f1;
-    private C1 f2;
-    private C1.C3<T2> f3;
-    private C1<T1>.C2<T2> f4;
-    private C1.C2 f5;
-    private C1<T1> f6;
-    private C1.C3<T2>.C4<T1> f7;
-    private static final int NUMTYPES = 8;
-
-    // Type mirrors corresponding to the types of the above fields
-    private ClassType[] t = new ClassType[NUMTYPES];
-
-    // One more type:  our own.
-    private ClassTyp<T1,T2> me = this;
-
-
-    protected void init() {
-        for (int i = 0; i < t.length; i++) {
-            t[i] = (ClassType) getField("f"+i).getType();
-        }
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="class")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        t[0].accept(new SimpleTypeVisitor() {
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-            public void visitClassType(ClassType t) {
-                res.add("class");
-            }
-            public void visitInterfaceType(InterfaceType t) {
-                res.add("interface");
-            }
-        });
-        return res;
-    }
-
-    @Test(result="true")
-    boolean equals1() {
-        return t[0].equals(t[0]);
-    }
-
-    @Test(result="false")
-    boolean equals2() {
-        return t[0].equals(t[1]);
-    }
-
-    // Raw type is not same as type instantiated with unbounded type var.
-    @Test(result="false")
-    boolean equals3() {
-        return t[0].equals(t[2]);
-    }
-
-    // C1<T1> is same type as C1<T1>
-    @Test(result="true")
-    boolean equals4() {
-        return t[0].equals(t[6]);
-    }
-
-    @Test(result={
-              "ClassTyp.C1<T1>",
-              "ClassTyp.C1<java.lang.String>",
-              "ClassTyp.C1",
-              "ClassTyp.C1.C3<T2>",
-              "ClassTyp.C1<T1>.C2<T2>",
-              "ClassTyp.C1.C2",
-              "ClassTyp.C1<T1>",
-              "ClassTyp.C1.C3<T2>.C4<T1>"
-          },
-          ordered=true)
-    Collection<String> toStringTests() {
-        Collection<String> res = new ArrayList<String>();
-        for (ClassType c : t) {
-            res.add(c.toString());
-        }
-        return res;
-    }
-
-
-    // DeclaredType methods
-
-    @Test(result={"T1"})
-    Collection<TypeMirror> getActualTypeArguments1() {
-        return t[0].getActualTypeArguments();
-    }
-
-    @Test(result={})
-    Collection<TypeMirror> getActualTypeArguments2() {
-        return t[2].getActualTypeArguments();
-    }
-
-    @Test(result={"T2"})
-    Collection<TypeMirror> getActualTypeArguments3() {
-        return t[3].getActualTypeArguments();
-    }
-
-    @Test(result="null")
-    DeclaredType getContainingType1() {
-        ClassType thisType = (ClassType) getField("me").getType();
-        return thisType.getContainingType();
-    }
-
-    @Test(result="ClassTyp")
-    DeclaredType getContainingType2() {
-        return t[0].getContainingType();
-    }
-
-    @Test(result="ClassTyp.C1")
-    DeclaredType getContainingType3() {
-        return t[3].getContainingType();
-    }
-
-    @Test(result="ClassTyp.C1<T1>")
-    DeclaredType getContainingType4() {
-        return t[4].getContainingType();
-    }
-
-    @Test(result={"java.util.Set<T1>"})
-    Collection<InterfaceType> getSuperinterfaces() {
-        return t[0].getSuperinterfaces();
-    }
-
-
-    // ClassType methods
-
-    @Test(result="ClassTyp.C1<S>")
-    ClassDeclaration getDeclaration1() {
-        return t[0].getDeclaration();
-    }
-
-    @Test(result="ClassTyp.C1.C3<R>")
-    ClassDeclaration getDeclaration2() {
-        return t[3].getDeclaration();
-    }
-
-    @Test(result="ClassTyp.C1<S>.C2<R>")
-    ClassDeclaration getDeclaration3a() {
-        return t[4].getDeclaration();
-    }
-
-    @Test(result="ClassTyp.C1<S>.C2<R>")
-    ClassDeclaration getDeclaration3b() {
-        return t[5].getDeclaration();
-    }
-
-    @Test(result="true")
-    boolean getDeclarationEq() {
-        return t[0].getDeclaration() == t[6].getDeclaration();
-    }
-
-    @Test(result="java.util.AbstractSet<T1>")
-    ClassType getSuperclass1() {
-        return t[0].getSuperclass();
-    }
-
-    @Test(result="java.lang.Object")
-    ClassType getSuperclass2() {
-        return t[4].getSuperclass();
-    }
-
-    @Test(result="null")
-    ClassType getSuperclassOfObject() {
-        return t[4].getSuperclass().getSuperclass();
-    }
-}
--- a/test/tools/apt/mirror/type/EnumTyp.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450
- * @summary EnumType tests
- * @library ../../lib
- * @compile -source 1.5 EnumTyp.java
- * @run main/othervm EnumTyp
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class EnumTyp extends Tester {
-
-    public static void main(String[] args) {
-        (new EnumTyp()).run();
-    }
-
-
-    // Declarations used by tests
-
-    enum Suit {
-        CIVIL,
-        CRIMINAL
-    }
-
-    private Suit s;
-
-
-    private EnumType e;         // an enum type
-
-    protected void init() {
-        e = (EnumType) getField("s").getType();
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="enum")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        e.accept(new SimpleTypeVisitor() {
-            public void visitTypeMirror(TypeMirror t) {
-                res.add("type");
-            }
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-            public void visitClassType(ClassType t) {
-                res.add("class");
-            }
-            public void visitEnumType(EnumType t) {
-                res.add("enum");
-            }
-            public void visitInterfaceType(InterfaceType t) {
-                res.add("interface");
-            }
-        });
-        return res;
-    }
-
-
-    // EnumType method
-
-    @Test(result="EnumTyp.Suit")
-    EnumDeclaration getDeclaration() {
-        return e.getDeclaration();
-    }
-}
--- a/test/tools/apt/mirror/type/InterfaceTyp.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5055963
- * @summary InterfaceType tests
- * @library ../../lib
- * @run main/othervm InterfaceTyp
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class InterfaceTyp<T1,T2> extends Tester {
-
-    public static void main(String[] args) {
-        (new InterfaceTyp()).run();
-    }
-
-
-    // Declarations used by tests
-
-    interface I1<S> extends Set<String> {
-        interface I2<R> {
-        }
-    }
-
-
-    // Generate some interface types to test
-    private I1<T1> f0;
-    private I1<String> f1;
-    private I1 f2;
-    private I1.I2<String> f3;
-    private I1.I2 f4;
-    private I1<T1> f5;
-    private I3<T1> f6;
-    private static final int NUMTYPES = 7;
-
-    // Type mirrors corresponding to the types of the above fields
-    private InterfaceType[] t = new InterfaceType[NUMTYPES];
-
-    protected void init() {
-        for (int i = 0; i < t.length; i++) {
-            t[i] = (InterfaceType) getField("f"+i).getType();
-        }
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="interface")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        t[0].accept(new SimpleTypeVisitor() {
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-            public void visitClassType(ClassType t) {
-                res.add("class");
-            }
-            public void visitInterfaceType(InterfaceType t) {
-                res.add("interface");
-            }
-        });
-        return res;
-    }
-
-    @Test(result="true")
-    boolean equals1() {
-        return t[0].equals(t[0]);
-    }
-
-    @Test(result="false")
-    boolean equals2() {
-        return t[0].equals(t[1]);
-    }
-
-    // Raw type is not same as type instantiated with unbounded type var.
-    @Test(result="false")
-    boolean equals3() {
-        return t[0].equals(t[2]);
-    }
-
-    // I1<T1> is same type as I1<T1>
-    @Test(result="true")
-    boolean equals4() {
-        return t[0].equals(t[5]);
-    }
-
-    @Test(result={
-              "InterfaceTyp.I1<T1>",
-              "InterfaceTyp.I1<java.lang.String>",
-              "InterfaceTyp.I1",
-              "InterfaceTyp.I1.I2<java.lang.String>",
-              "InterfaceTyp.I1.I2",
-              "InterfaceTyp.I1<T1>",
-              "I3<T1>"
-          },
-          ordered=true)
-    Collection<String> toStringTests() {
-        Collection<String> res = new ArrayList<String>();
-        for (InterfaceType i : t) {
-            res.add(i.toString());
-        }
-        return res;
-    }
-
-
-    // DeclaredType methods
-
-    @Test(result={"T1"})
-    Collection<TypeMirror> getActualTypeArguments1() {
-        return t[0].getActualTypeArguments();
-    }
-
-    @Test(result={})
-    Collection<TypeMirror> getActualTypeArguments2() {
-        return t[2].getActualTypeArguments();
-    }
-
-    @Test(result={"java.lang.String"})
-    Collection<TypeMirror> getActualTypeArguments3() {
-        return t[3].getActualTypeArguments();
-    }
-
-    @Test(result="InterfaceTyp")
-    DeclaredType getContainingType1() {
-        return t[0].getContainingType();
-    }
-
-    @Test(result="InterfaceTyp.I1")
-    DeclaredType getContainingType2() {
-        return t[3].getContainingType();
-    }
-
-    @Test(result="null")
-    DeclaredType getContainingTypeTopLevel() {
-        return t[6].getContainingType();
-    }
-
-    @Test(result={"java.util.Set<java.lang.String>"})
-    Collection<InterfaceType> getSuperinterfaces() {
-        return t[0].getSuperinterfaces();
-    }
-
-
-
-    // InterfaceType method
-
-    @Test(result="InterfaceTyp.I1<S>")
-    InterfaceDeclaration getDeclaration1() {
-        return t[0].getDeclaration();
-    }
-
-    @Test(result="InterfaceTyp.I1.I2<R>")
-    InterfaceDeclaration getDeclaration2a() {
-        return t[3].getDeclaration();
-    }
-
-    @Test(result="InterfaceTyp.I1.I2<R>")
-    InterfaceDeclaration getDeclaration2b() {
-        return t[4].getDeclaration();
-    }
-
-    @Test(result="true")
-    boolean getDeclarationCaching() {
-        return t[0].getDeclaration() == t[5].getDeclaration();
-    }
-}
-
-
-// A top-level interface used by tests.
-
-interface I3<T> {
-}
--- a/test/tools/apt/mirror/type/PrimitiveTyp.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450
- * @summary PrimitiveType tests
- * @library ../../lib
- * @compile -source 1.5 PrimitiveTyp.java
- * @run main/othervm PrimitiveTyp
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class PrimitiveTyp extends Tester {
-
-    public static void main(String[] args) {
-        (new PrimitiveTyp()).run();
-    }
-
-
-    // Declaration used by tests
-
-    private boolean b;
-
-
-    private PrimitiveType prim;         // a primitive type
-
-    protected void init() {
-        prim = (PrimitiveType) getField("b").getType();
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="primitive")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        prim.accept(new SimpleTypeVisitor() {
-            public void visitTypeMirror(TypeMirror t) {
-                res.add("type");
-            }
-            public void visitPrimitiveType(PrimitiveType t) {
-                res.add("primitive");
-            }
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-        });
-        return res;
-    }
-
-    @Test(result="boolean")
-    String toStringTest() {
-        return prim.toString();
-    }
-
-
-    // PrimitiveType method
-
-    @Test(result="BOOLEAN")
-    PrimitiveType.Kind getKind() {
-        return prim.getKind();
-    }
-}
--- a/test/tools/apt/mirror/type/TypeVar.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450
- * @summary TypeVariable tests
- * @library ../../lib
- * @compile -source 1.5 TypeVar.java
- * @run main/othervm TypeVar
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class TypeVar<T, S extends Number & Runnable> extends Tester {
-
-    public static void main(String[] args) {
-        (new TypeVar()).run();
-    }
-
-
-    // Declarations used by tests
-
-    private T t;
-    private S s;
-
-
-    private TypeVariable tvT;   // type variable T
-    private TypeVariable tvS;   // type variable S
-
-    protected void init() {
-        tvT = (TypeVariable) getField("t").getType();
-        tvS = (TypeVariable) getField("s").getType();
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="type var")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        tvT.accept(new SimpleTypeVisitor() {
-            public void visitTypeMirror(TypeMirror t) {
-                res.add("type");
-            }
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-            public void visitTypeVariable(TypeVariable t) {
-                res.add("type var");
-            }
-        });
-        return res;
-    }
-
-    @Test(result="T")
-    String toStringTest1() {
-        return tvT.toString();
-    }
-
-    @Test(result="S")
-    String toStringTest2() {
-        return tvS.toString();
-    }
-
-
-    // TypeVariable method
-
-    @Test(result="S extends java.lang.Number & java.lang.Runnable")
-    TypeParameterDeclaration getDeclaration() {
-        return tvS.getDeclaration();
-    }
-}
--- a/test/tools/apt/mirror/type/WildcardTyp.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 4853450 5009396 5010636 5031156
- * @summary WildcardType tests
- * @library ../../lib
- * @compile -source 1.5 WildcardTyp.java
- * @run main/othervm WildcardTyp
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class WildcardTyp extends Tester {
-
-    public static void main(String[] args) {
-        (new WildcardTyp()).run();
-    }
-
-
-    // Declarations to use for testing
-
-    interface G<T> {
-    }
-
-    interface G1<N extends Number & Runnable> {
-    }
-
-    interface G2<T extends G2<T>> {
-    }
-
-    // Some wildcard types to test.
-    private G<?> f0;                    // unbound
-    private G<? extends Number> f1;     // covariant
-    private G<? super Number> f2;       // contravariant
-    private G<? extends Object> f3;     // <sigh>
-    private G1<?> f4;   // "true" upper bound is an intersection type
-    private G2<?> f5;   // 'true" upper bound is a recursive F-bound and
-                        // not expressible
-    private static final int NUMTYPES = 6;
-
-    // Type mirrors corresponding to the wildcard types of the above fields
-    private WildcardType[] t = new WildcardType[NUMTYPES];
-
-
-    protected void init() {
-        for (int i = 0; i < t.length; i++) {
-            DeclaredType type = (DeclaredType) getField("f"+i).getType();
-            t[i] = (WildcardType)
-                type.getActualTypeArguments().iterator().next();
-        }
-    }
-
-    private WildcardType wildcardFor(String field) {
-        DeclaredType d = (DeclaredType) getField(field).getType();
-        return (WildcardType) d.getActualTypeArguments().iterator().next();
-    }
-
-
-    // TypeMirror methods
-
-    @Test(result="wild thing")
-    Collection<String> accept() {
-        final Collection<String> res = new ArrayList<String>();
-
-        t[0].accept(new SimpleTypeVisitor() {
-            public void visitTypeMirror(TypeMirror t) {
-                res.add("type");
-            }
-            public void visitReferenceType(ReferenceType t) {
-                res.add("ref type");
-            }
-            public void visitWildcardType(WildcardType t) {
-                res.add("wild thing");
-            }
-        });
-        return res;
-    }
-
-    @Test(result={
-                "?",
-                "? extends java.lang.Number",
-                "? super java.lang.Number",
-                "? extends java.lang.Object",
-                "?",
-                "?"
-          },
-          ordered=true)
-    Collection<String> toStringTests() {
-        Collection<String> res = new ArrayList<String>();
-        for (WildcardType w : t) {
-            res.add(w.toString());
-        }
-        return res;
-    }
-
-
-    // WildcardType methods
-
-    @Test(result={
-                "null",
-                "null",
-                "java.lang.Number",
-                "null",
-                "null",
-                "null"
-          },
-          ordered=true)
-    Collection<ReferenceType> getLowerBounds() {
-        Collection<ReferenceType> res = new ArrayList<ReferenceType>();
-        for (WildcardType w : t) {
-            Collection<ReferenceType> bounds = w.getLowerBounds();
-            int num = bounds.size();
-            if (num > 1) {
-                throw new AssertionError("Bounds abound");
-            }
-            res.add((num > 0) ? bounds.iterator().next() : null);
-        }
-        return res;
-    }
-
-    @Test(result={
-                "null",
-                "java.lang.Number",
-                "null",
-                "java.lang.Object",
-                "null",
-                "null"
-          },
-          ordered=true)
-    Collection<ReferenceType> getUpperBounds() {
-        Collection<ReferenceType> res = new ArrayList<ReferenceType>();
-        for (WildcardType w : t) {
-            Collection<ReferenceType> bounds = w.getUpperBounds();
-            int num = bounds.size();
-            if (num > 1) {
-                throw new AssertionError("Bounds abound");
-            }
-            res.add((num > 0) ? bounds.iterator().next() : null);
-        }
-        return res;
-    }
-}
--- a/test/tools/apt/mirror/util/Overrides.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 5037165
- * @summary Test the Declarations.overrides method
- * @library ../../lib
- * @run main/othervm Overrides
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-
-public class Overrides extends Tester {
-
-    public static void main(String[] args) {
-        (new Overrides()).run();
-    }
-
-
-    // Declarations used by tests
-
-    static class A {
-        void m1(int i) {};              // does not override itself
-        void m2(int i) {};
-        static void m3(int i) {};
-    }
-
-        static class B extends A {
-            void m1(int j) {};          // overrides A.m1
-            void m1(String i) {};       // does not override A.m1
-            void m4(int i) {};          // does not override A.m1
-        }
-
-            static class C extends B {
-                void m1(int i) {};      // overrides A.m1 and B.m1
-                void m2(int i) {};      // overrides A.m2
-            }
-
-        static class D extends A {
-            static void m3(int i) {};   // does not override A.m3
-        }
-
-    static class E {
-        void m1(int i) {};              // does not override A.m1
-    }
-
-
-
-    private Declarations decls;
-
-    private TypeDeclaration A;
-    private TypeDeclaration B;
-    private TypeDeclaration C;
-    private TypeDeclaration D;
-    private TypeDeclaration E;
-    private MethodDeclaration Am1;
-    private MethodDeclaration Am2;
-    private MethodDeclaration Am3;
-    private MethodDeclaration Bm1;
-    private MethodDeclaration Bm1b;
-    private MethodDeclaration Bm4;
-    private MethodDeclaration Cm1;
-    private MethodDeclaration Cm2;
-    private MethodDeclaration Dm3;
-    private MethodDeclaration Em1;
-
-    protected void init() {
-        decls = env.getDeclarationUtils();
-
-        A = env.getTypeDeclaration("Overrides.A");
-        B = env.getTypeDeclaration("Overrides.B");
-        C = env.getTypeDeclaration("Overrides.C");
-        D = env.getTypeDeclaration("Overrides.D");
-        E = env.getTypeDeclaration("Overrides.E");
-
-        Am1  = getMethod(A, "m1", "i");
-        Am2  = getMethod(A, "m2", "i");
-        Am3  = getMethod(A, "m3", "i");
-        Bm1  = getMethod(B, "m1", "j");
-        Bm1b = getMethod(B, "m1", "i");
-        Bm4  = getMethod(B, "m4", "i");
-        Cm1  = getMethod(C, "m1", "i");
-        Cm2  = getMethod(C, "m2", "i");
-        Dm3  = getMethod(D, "m3", "i");
-        Em1  = getMethod(E, "m1", "i");
-    }
-
-    private MethodDeclaration getMethod(TypeDeclaration t,
-                                        String methodName, String paramName) {
-        for (MethodDeclaration m : t.getMethods()) {
-            if (methodName.equals(m.getSimpleName()) &&
-                    paramName.equals(m.getParameters().iterator().next()
-                                                        .getSimpleName())) {
-                return m;
-            }
-        }
-        throw new AssertionError();
-    }
-
-
-    // Declarations methods
-
-    @Test(result={"false",
-                  "true",
-                  "false",
-                  "false",
-                  "true",
-                  "true",
-                  "true",
-                  "false",
-                  "false"},
-          ordered=true)
-    List<Boolean> overrides() {
-        return Arrays.asList(
-                decls.overrides(Am1, Am1),
-                decls.overrides(Bm1, Am1),
-                decls.overrides(Bm1b,Am1),
-                decls.overrides(Bm4, Am1),
-                decls.overrides(Cm1, Am1),
-                decls.overrides(Cm1, Bm1),
-                decls.overrides(Cm2, Am2),
-                decls.overrides(Dm3, Am3),
-                decls.overrides(Em1, Am1));
-    }
-}
--- a/test/tools/apt/mirror/util/TypeCreation.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @bug 5033381
- * @summary Test the type creation methods in Types.
- * @library ../../lib
- * @run main/othervm TypeCreation
- */
-
-
-import java.util.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import static com.sun.mirror.type.PrimitiveType.Kind.*;
-
-
-public class TypeCreation extends Tester {
-
-    public static void main(String[] args) {
-        (new TypeCreation()).run();
-    }
-
-
-    // Declarations used by tests
-
-    class A {
-    }
-
-    class O<T> {
-        class I<S> {
-        }
-    }
-
-
-    private Types types;
-
-    private TypeDeclaration A;
-    private TypeDeclaration O;
-    private TypeDeclaration I;
-
-    private DeclaredType AType;
-
-    protected void init() {
-        types = env.getTypeUtils();
-        A = env.getTypeDeclaration("TypeCreation.A");
-        O = env.getTypeDeclaration("TypeCreation.O");
-        I = env.getTypeDeclaration("TypeCreation.O.I");
-
-        AType = types.getDeclaredType(A);
-    }
-
-
-    @Test(result="boolean")
-    PrimitiveType getPrimitiveType() {
-        return types.getPrimitiveType(BOOLEAN);
-    }
-
-    @Test(result="void")
-    VoidType getVoidType() {
-        return types.getVoidType();
-    }
-
-    @Test(result="boolean[]")
-    ArrayType getArrayType1() {
-        return types.getArrayType(
-                types.getPrimitiveType(BOOLEAN));
-    }
-
-    @Test(result="TypeCreation.A[]")
-    ArrayType getArrayType2() {
-        return types.getArrayType(AType);
-    }
-
-    @Test(result="? extends TypeCreation.A")
-    WildcardType getWildcardType() {
-        Collection<ReferenceType> uppers = new ArrayList<ReferenceType>();
-        Collection<ReferenceType> downers = new ArrayList<ReferenceType>();
-        uppers.add(AType);
-        return types.getWildcardType(uppers, downers);
-    }
-
-    @Test(result="TypeCreation.O<java.lang.String>")
-    DeclaredType getDeclaredType1() {
-        TypeDeclaration stringDecl = env.getTypeDeclaration("java.lang.String");
-        DeclaredType stringType = types.getDeclaredType(stringDecl);
-        return types.getDeclaredType(O, stringType);
-    }
-
-    @Test(result="TypeCreation.O<java.lang.String>.I<java.lang.Number>")
-    DeclaredType getDeclaredType2() {
-        TypeDeclaration numDecl = env.getTypeDeclaration("java.lang.Number");
-        DeclaredType numType = types.getDeclaredType(numDecl);
-        DeclaredType OType = getDeclaredType1();
-        return types.getDeclaredType(OType, I, numType);
-    }
-}
--- a/test/tools/javac/4846262/Test.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/4846262/Test.sh	Tue May 29 00:27:58 2012 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh -f
 
 #
-# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     FS="/"
     ;;
   CYGWIN* )
@@ -71,7 +71,7 @@
 diff ${DIFFOPTS} -c "${TESTSRC}${FS}Test.out" Test.out
 result=$?
 
-if [ $result -eq o ]
+if [ $result -eq 0 ]
 then
   echo "Passed"
 else
--- a/test/tools/javac/6302184/T6302184.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6302184/T6302184.sh	Tue May 29 00:27:58 2012 +0100
@@ -41,7 +41,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     FS="/"
     ;;
   CYGWIN* )
--- a/test/tools/javac/6304921/TestLog.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6304921/TestLog.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.parser.Parser;
 import com.sun.tools.javac.parser.ParserFactory;
 import com.sun.tools.javac.tree.JCTree;
@@ -97,9 +98,9 @@
     }
 
     private static class LogTester extends TreeScanner {
-        LogTester(Log log, java.util.Map<JCTree, Integer> endPositions) {
+        LogTester(Log log, EndPosTable endPosTable) {
             this.log = log;
-            this.endPositions = endPositions;
+            this.endPosTable = endPosTable;
         }
 
         public void visitIf(JCTree.JCIf tree) {
@@ -117,7 +118,7 @@
         }
 
         private Log log;
-        private java.util.Map<JCTree, Integer> endPositions;
+        private EndPosTable endPosTable;
     }
 
     private static class StringJavaFileObject extends SimpleJavaFileObject {
--- a/test/tools/javac/6402516/CheckLocalElements.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6402516/CheckLocalElements.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
         return encl == null ? "" : encl.accept(qualNameVisitor, null);
     }
 
-    private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor7<String,Void>() {
+    private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor8<String,Void>() {
         protected String defaultAction(Element e, Void ignore) {
             return "";
         }
--- a/test/tools/javac/6410653/T6410653.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6410653/T6410653.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
  * @author  Peter von der Ah\u00e9
  */
 
-import java.lang.reflect.Method;
+import java.lang.reflect.Field;
 import java.io.File;
 import java.io.ByteArrayOutputStream;
 import javax.tools.*;
@@ -39,12 +39,13 @@
         String source = new File(testSrc, "T6410653.java").getPath();
         ClassLoader cl = ToolProvider.getSystemToolClassLoader();
         Tool compiler = ToolProvider.getSystemJavaCompiler();
-        Class<?> main = Class.forName("com.sun.tools.javac.main.Main", true, cl);
-        Method useRawMessages = main.getMethod("useRawMessages", boolean.class);
-        useRawMessages.invoke(null, true);
+        Class<?> log = Class.forName("com.sun.tools.javac.util.Log", true, cl);
+        Field useRawMessages = log.getDeclaredField("useRawMessages");
+        useRawMessages.setAccessible(true);
+        useRawMessages.setBoolean(null, true);
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         compiler.run(null, null, out, "-d", source, source);
-        useRawMessages.invoke(null, false);
+        useRawMessages.setBoolean(null, false);
         if (!out.toString().equals(String.format("%s%n%s%n",
                                                  "javac: javac.err.file.not.directory",
                                                  "javac.msg.usage"))) {
--- a/test/tools/javac/6979683/TestCast6979683_BAD34.java.errlog	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6979683/TestCast6979683_BAD34.java.errlog	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-TestCast6979683_BAD34.java:34:49: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Number, boolean
+TestCast6979683_BAD34.java:34:49: compiler.err.prob.found.req: java.lang.Number, boolean
 1 error
--- a/test/tools/javac/6979683/TestCast6979683_BAD35.java.errlog	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6979683/TestCast6979683_BAD35.java.errlog	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-TestCast6979683_BAD35.java:35:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Number, int
+TestCast6979683_BAD35.java:35:45: compiler.err.prob.found.req: java.lang.Number, int
 1 error
--- a/test/tools/javac/6979683/TestCast6979683_BAD36.java.errlog	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6979683/TestCast6979683_BAD36.java.errlog	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-TestCast6979683_BAD36.java:36:58: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Comparable<java.lang.Integer>, int
+TestCast6979683_BAD36.java:36:58: compiler.err.prob.found.req: java.lang.Comparable<java.lang.Integer>, int
 1 error
--- a/test/tools/javac/6979683/TestCast6979683_BAD37.java.errlog	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6979683/TestCast6979683_BAD37.java.errlog	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-TestCast6979683_BAD37.java:37:61: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Comparable<java.lang.Short>, int
+TestCast6979683_BAD37.java:37:61: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Comparable<java.lang.Short>, int)
 1 error
--- a/test/tools/javac/6979683/TestCast6979683_BAD38.java.errlog	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6979683/TestCast6979683_BAD38.java.errlog	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-TestCast6979683_BAD38.java:38:62: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Comparable<java.lang.Character>, float
+TestCast6979683_BAD38.java:38:62: compiler.err.prob.found.req: java.lang.Comparable<java.lang.Character>, float
 1 error
--- a/test/tools/javac/6979683/TestCast6979683_BAD39.java.errlog	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/6979683/TestCast6979683_BAD39.java.errlog	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-TestCast6979683_BAD39.java:39:53: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Number, char
+TestCast6979683_BAD39.java:39:53: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Number, char)
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7003595/T7003595.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7003595
+ * @summary IncompatibleClassChangeError with unreferenced local class with subclass
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.InnerClasses_attribute;
+import com.sun.tools.classfile.ConstantPool.*;
+import com.sun.tools.javac.api.JavacTool;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.ArrayList;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class T7003595 {
+
+    /** global decls ***/
+
+    // Create a single file manager and reuse it for each compile to save time.
+    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
+    //statistics
+    static int checkCount = 0;
+
+    enum ClassKind {
+        NESTED("static class #N { #B }", "$", true),
+        INNER("class #N { #B }", "$", false),
+        LOCAL_REF("void test() { class #N { #B }; new #N(); }", "$1", false),
+        LOCAL_NOREF("void test() { class #N { #B }; }", "$1", false),
+        ANON("void test() { new Object() { #B }; }", "$1", false),
+        NONE("", "", false);
+
+        String memberInnerStr;
+        String sep;
+        boolean staticAllowed;
+
+        private ClassKind(String memberInnerStr, String sep, boolean staticAllowed) {
+            this.memberInnerStr = memberInnerStr;
+            this.sep = sep;
+            this.staticAllowed = staticAllowed;
+        }
+
+        String getSource(String className, String outerName, String nested) {
+            return memberInnerStr.replaceAll("#O", outerName).
+                    replaceAll("#N", className).replaceAll("#B", nested);
+        }
+
+        static String getClassfileName(String[] names, ClassKind[] outerKinds, int pos) {
+            System.out.println(" pos = " + pos + " kind = " + outerKinds[pos] + " sep = " + outerKinds[pos].sep);
+            String name = outerKinds[pos] != ANON ?
+                    names[pos] : "";
+            if (pos == 0) {
+                return "Test" + outerKinds[pos].sep + name;
+            } else {
+                String outerStr = getClassfileName(names, outerKinds, pos - 1);
+                return outerStr + outerKinds[pos].sep + name;
+            }
+        }
+
+        boolean isAllowed(ClassKind nestedKind) {
+            return nestedKind != NESTED ||
+                    staticAllowed;
+        }
+    }
+
+    enum LocalInnerClass {
+        LOCAL_REF("class L {}; new L();", "Test$1L"),
+        LOCAL_NOREF("class L {};", "Test$1L"),
+        ANON("new Object() {};", "Test$1"),
+        NONE("", "");
+
+        String localInnerStr;
+        String canonicalInnerStr;
+
+        private LocalInnerClass(String localInnerStr, String canonicalInnerStr) {
+            this.localInnerStr = localInnerStr;
+            this.canonicalInnerStr = canonicalInnerStr;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        for (ClassKind ck1 : ClassKind.values()) {
+            String cname1 = "C1";
+            for (ClassKind ck2 : ClassKind.values()) {
+                if (!ck1.isAllowed(ck2)) continue;
+                String cname2 = "C2";
+                for (ClassKind ck3 : ClassKind.values()) {
+                    if (!ck2.isAllowed(ck3)) continue;
+                    String cname3 = "C3";
+                    new T7003595(new ClassKind[] {ck1, ck2, ck3}, new String[] { cname1, cname2, cname3 }).compileAndCheck();
+                }
+            }
+        }
+
+        System.out.println("Total checks made: " + checkCount);
+    }
+
+    /** instance decls **/
+
+    ClassKind[] cks;
+    String[] cnames;
+
+    T7003595(ClassKind[] cks, String[] cnames) {
+        this.cks = cks;
+        this.cnames = cnames;
+    }
+
+    void compileAndCheck() throws Exception {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        JavaSource source = new JavaSource();
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, null,
+                null, null, Arrays.asList(source));
+        ct.call();
+        verifyBytecode(source);
+    }
+
+    void verifyBytecode(JavaSource source) {
+        for (int i = 0; i < 3 ; i ++) {
+            if (cks[i] == ClassKind.NONE) break;
+            checkCount++;
+            String filename = cks[i].getClassfileName(cnames, cks, i);
+            File compiledTest = new File(filename + ".class");
+            try {
+                ClassFile cf = ClassFile.read(compiledTest);
+                if (cf == null) {
+                    throw new Error("Classfile not found: " + filename);
+                }
+
+                InnerClasses_attribute innerClasses = (InnerClasses_attribute)cf.getAttribute(Attribute.InnerClasses);
+
+                ArrayList<String> foundInnerSig = new ArrayList<>();
+                if (innerClasses != null) {
+                    for (InnerClasses_attribute.Info info : innerClasses.classes) {
+                        String foundSig = info.getInnerClassInfo(cf.constant_pool).getName();
+                        foundInnerSig.add(foundSig);
+                    }
+                }
+
+                ArrayList<String> expectedInnerSig = new ArrayList<>();
+                //add inner class (if any)
+                if (i < 2 && cks[i + 1] != ClassKind.NONE) {
+                    expectedInnerSig.add(cks[i + 1].getClassfileName(cnames, cks, i + 1));
+                }
+                //add inner classes
+                for (int j = 0 ; j != i + 1 && j < 3; j++) {
+                    expectedInnerSig.add(cks[j].getClassfileName(cnames, cks, j));
+                }
+
+                if (expectedInnerSig.size() != foundInnerSig.size()) {
+                    throw new Error("InnerClasses attribute for " + cnames[i] + " has wrong size\n" +
+                                    "expected " + expectedInnerSig.size() + "\n" +
+                                    "found " + innerClasses.number_of_classes + "\n" +
+                                    source);
+                }
+
+                for (String foundSig : foundInnerSig) {
+                    if (!expectedInnerSig.contains(foundSig)) {
+                        throw new Error("InnerClasses attribute for " + cnames[i] + " has unexpected signature: " +
+                                foundSig + "\n" + source + "\n" + expectedInnerSig);
+                    }
+                }
+
+                for (String expectedSig : expectedInnerSig) {
+                    if (!foundInnerSig.contains(expectedSig)) {
+                        throw new Error("InnerClasses attribute for " + cnames[i] + " does not contain expected signature: " +
+                                    expectedSig + "\n" + source);
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new Error("error reading " + compiledTest +": " + e);
+            }
+        }
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        static final String source_template = "class Test { #C }";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            String c3 = cks[2].getSource(cnames[2], cnames[1], "");
+            String c2 = cks[1].getSource(cnames[1], cnames[0], c3);
+            String c1 = cks[0].getSource(cnames[0], "Test", c2);
+            source = source_template.replace("#C", c1);
+        }
+
+        @Override
+        public String toString() {
+            return source;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7003595/T7003595b.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7003595
+ * @summary IncompatibleClassChangeError with unreferenced local class with subclass
+ */
+
+public class T7003595b {
+    public static void main(String... args) throws Exception {
+        class A {}
+        class B extends A {}
+        B.class.getSuperclass().getDeclaringClass();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7079713/TestCircularClassfile.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7079713
+ * @summary javac hangs when compiling a class that references a cyclically inherited class
+ * @run main TestCircularClassfile
+ */
+
+import java.io.*;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
+
+public class TestCircularClassfile {
+
+    enum SourceKind {
+        A_EXTENDS_B("class B {} class A extends B { void m() {} }"),
+        B_EXTENDS_A("class A { void m() {} } class B extends A {}");
+
+        String sourceStr;
+
+        private SourceKind(String sourceStr) {
+            this.sourceStr = sourceStr;
+        }
+
+        SimpleJavaFileObject getSource() {
+            return new SimpleJavaFileObject(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE) {
+                @Override
+                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                    return sourceStr;
+                }
+            };
+        }
+    }
+
+    enum TestKind {
+        REPLACE_A("A.class"),
+        REPLACE_B("B.class");
+
+        String targetClass;
+
+        private TestKind(String targetClass) {
+            this.targetClass = targetClass;
+        }
+    }
+
+    enum ClientKind {
+        METHOD_CALL1("A a = null; a.m();"),
+        METHOD_CALL2("B b = null; b.m();"),
+        CONSTR_CALL1("new A();"),
+        CONSTR_CALL2("new B();"),
+        ASSIGN1("A a = null; B b = a;"),
+        ASSIGN2("B b = null; A a = b;");
+
+        String mainMethod;
+
+        private ClientKind(String mainMethod) {
+            this.mainMethod = mainMethod;
+        }
+
+        SimpleJavaFileObject getSource() {
+            return new SimpleJavaFileObject(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE) {
+                @Override
+                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                    return "class Test { public static void main(String[] args) { #M } }"
+                            .replace("#M", mainMethod);
+                }
+            };
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+        int count = 0;
+        for (SourceKind sk1 : SourceKind.values()) {
+            for (SourceKind sk2 : SourceKind.values()) {
+                for (TestKind tk : TestKind.values()) {
+                    for (ClientKind ck : ClientKind.values()) {
+                        new TestCircularClassfile("sub_"+count++, sk1, sk2, tk, ck).check(comp, fm);
+                    }
+                }
+            }
+        }
+    }
+
+    static String workDir = System.getProperty("user.dir");
+
+    String destPath;
+    SourceKind sk1;
+    SourceKind sk2;
+    TestKind tk;
+    ClientKind ck;
+
+    TestCircularClassfile(String destPath, SourceKind sk1, SourceKind sk2, TestKind tk, ClientKind ck) {
+        this.destPath = destPath;
+        this.sk1 = sk1;
+        this.sk2 = sk2;
+        this.tk = tk;
+        this.ck = ck;
+    }
+
+    void check(JavaCompiler comp, StandardJavaFileManager fm) throws Exception {
+        //step 1: compile first source code in the test subfolder
+        File destDir = new File(workDir, destPath); destDir.mkdir();
+        //output dir must be set explicitly as we are sharing the fm (see bug 7026941)
+        fm.setLocation(javax.tools.StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir));
+        JavacTask ct = (JavacTask)comp.getTask(null, fm, null,
+                null, null, Arrays.asList(sk1.getSource()));
+        ct.generate();
+
+        //step 2: compile second source code in a temp folder
+        File tmpDir = new File(destDir, "tmp"); tmpDir.mkdir();
+        //output dir must be set explicitly as we are sharing the fm (see bug 7026941)
+        fm.setLocation(javax.tools.StandardLocation.CLASS_OUTPUT, Arrays.asList(tmpDir));
+        ct = (JavacTask)comp.getTask(null, fm, null,
+                null, null, Arrays.asList(sk2.getSource()));
+        ct.generate();
+
+        //step 3: move a classfile from the temp folder to the test subfolder
+        File fileToMove = new File(tmpDir, tk.targetClass);
+        File target = new File(destDir, tk.targetClass);
+        target.delete();
+        boolean success = fileToMove.renameTo(target);
+
+        if (!success) {
+            throw new AssertionError("error when moving file " + tk.targetClass);
+        }
+
+        //step 4: compile the client class against the classes in the test subfolder
+        //input/output dir must be set explicitly as we are sharing the fm (see bug 7026941)
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir));
+        fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(destDir));
+        ct = (JavacTask)comp.getTask(null, fm, null,
+                null, null, Arrays.asList(ck.getSource()));
+
+        ct.generate();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7085024/T7085024.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7085024
+ * @summary internal error; cannot instantiate Foo
+ * @compile/fail/ref=T7085024.out -XDrawDiagnostics T7085024.java
+ */
+
+class T7085024 {
+    T7085024 (boolean ret) { } //internal error goes away if constructor accepts a reference type
+
+    T7085024 f = new T7085024((NonExistentClass) null );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7085024/T7085024.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,2 @@
+T7085024.java:11:32: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T7085024, null)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7086595/T7086595.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,32 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7086595
+ * @summary Error message bug: name of initializer is 'null'
+ * @compile/fail/ref=T7086595.out -XDrawDiagnostics T7086595.java
+ */
+
+class T7086595 {
+
+    String s = "x";
+    String s = nonExistent;
+
+    int foo() {
+        String s = "x";
+        String s = nonExistent;
+    }
+
+    static int bar() {
+        String s = "x";
+        String s = nonExistent;
+    }
+
+    {
+        String s = "x";
+        String s = nonExistent;
+    }
+
+    static {
+        String s = "x";
+        String s = nonExistent;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7086595/T7086595.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,11 @@
+T7086595.java:11:12: compiler.err.already.defined: kindname.variable, s, kindname.class, T7086595
+T7086595.java:11:16: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:15:16: compiler.err.already.defined: kindname.variable, s, kindname.method, foo()
+T7086595.java:15:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:20:16: compiler.err.already.defined: kindname.variable, s, kindname.method, bar()
+T7086595.java:20:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:25:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.instance.init, kindname.class, T7086595
+T7086595.java:25:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:30:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.static.init, kindname.class, T7086595
+T7086595.java:30:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+10 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7102515/T7102515.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7102515
+ * @summary javac running very very long and not returning
+ * @compile/fail/ref=T7102515.out -XDrawDiagnostics T7102515.java
+ */
+
+class T7102515 {
+    T7102515 badBinary = new T7102515() + new T7102515();
+    Object badUnary = badBinary++;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7102515/T7102515.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,3 @@
+T7102515.java:9:41: compiler.err.operator.cant.be.applied.1: +, T7102515, T7102515
+T7102515.java:10:32: compiler.err.operator.cant.be.applied: ++, T7102515, null
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7129225/Anno.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+public @interface Anno {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7129225/AnnoProcessor.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+
+@SupportedAnnotationTypes("Anno")
+public class AnnoProcessor extends JavacTestingAbstractProcessor {
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> set, RoundEnvironment re) {
+        messager.printMessage(Kind.NOTE, "RUNNING - lastRound = " + re.processingOver());
+        return true;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7129225/NegTest.ref	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,2 @@
+TestImportStar.java:39:1: compiler.err.doesnt.exist: xxx
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7129225/TestImportStar.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 7129225
+ * @summary import xxx.* isn't handled correctly by annotation processing
+ * @library ../lib
+ * @build JavacTestingAbstractProcessor
+ * @compile/fail/ref=NegTest.ref -XDrawDiagnostics TestImportStar.java
+ * @compile Anno.java AnnoProcessor.java
+ * @compile/ref=TestImportStar.ref -XDrawDiagnostics -processor AnnoProcessor -proc:only TestImportStar.java
+ */
+
+ //The @compile/fail... verifies that the fix doesn't break the normal compilation of import xxx.*
+ //The @comple/ref... verifies the fix fixes the bug
+
+import xxx.*;
+
+@Anno
+public class TestImportStar {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7129225/TestImportStar.ref	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,3 @@
+- compiler.note.proc.messager: RUNNING - lastRound = false
+TestImportStar.java:39:1: compiler.err.doesnt.exist: xxx
+- compiler.note.proc.messager: RUNNING - lastRound = true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7132880/T7132880.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,60 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7132880
+ * @summary Resolve should support nested resolution contexts
+ * @compile/fail/ref=T7132880.out -XDrawDiagnostics T7132880.java
+ */
+class Outer {
+    void m1(String s) { }
+    void m2(int i1, int i2) { }
+
+    class Inner {
+        void test() {
+           //ok - no method named 'm' in Inner - hence, class to search is Outer
+           m1("");
+        }
+    }
+
+    class Inner1 {
+        void m1(Integer i) { }
+
+        void test() {
+           //error - Inner1 defines an incompatible method - hence, class to search is Inner1
+           m1("");
+        }
+    }
+
+    class Inner2 {
+        private void m1(Integer i) { }
+        private void m1(Double d) { }
+
+        void test() {
+           //error - Inner2 defines multiple incompatible methods - hence, class to search is Inner2
+           m1("");
+        }
+    }
+
+    class Inner3 {
+        private void m2(Object o, int i) { }
+        private void m2(int i, Object o) { }
+
+        void test() {
+           //error - Inner3 defines multiple ambiguous methods - hence, class to search is Inner3
+           m2(1, 1);
+        }
+    }
+
+    class Inner4 extends Inner2 {
+        void test() {
+           //ok - Inner2 defines multiple incompatible inaccessible methods - hence, class to search is Outer
+           m1("");
+        }
+    }
+
+    class Inner5 extends Inner3 {
+        void test() {
+           //ok - Inner3 defines multiple inaccessible ambiguous methods - hence, class to search is Outer
+           m2(1, 1);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7132880/T7132880.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,4 @@
+T7132880.java:23:12: compiler.err.cant.apply.symbol.1: kindname.method, m1, java.lang.Integer, java.lang.String, kindname.class, Outer.Inner1, (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Integer)
+T7132880.java:33:12: compiler.err.cant.apply.symbols: kindname.method, m1, java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, Outer.Inner2, m1(java.lang.Double), (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Double)),(compiler.misc.inapplicable.method: kindname.method, Outer.Inner2, m1(java.lang.Integer), (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Integer))}
+T7132880.java:43:12: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Object,int), Outer.Inner3, kindname.method, m2(int,java.lang.Object), Outer.Inner3
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7142086/T7142086.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7142086
+ * @summary performance problem in Check.checkOverrideClashes(...)
+ * @run main/timeout=10 T7142086
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Locale;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class T7142086 {
+
+    final static int N_METHODS = 1000;
+
+    static class TestClass extends SimpleJavaFileObject {
+
+        String methTemplate = "abstract void m(A#N p);";
+        String classTemplate = "abstract class Test { #M }";
+
+        String source;
+
+        public TestClass() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            StringBuilder buf = new StringBuilder();
+            for (int i = 0 ; i < N_METHODS ; i++) {
+                buf.append(methTemplate.replace("#N", String.valueOf(i)));
+                buf.append("\n");
+            }
+            source = classTemplate.replace("#M", buf.toString());
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    static class AnSource extends SimpleJavaFileObject {
+
+        String classTemplate = "abstract class A#N { }";
+
+        String source;
+
+        public AnSource(int n) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = classTemplate.replace("#N", String.valueOf(n));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        ArrayList<JavaFileObject> sources = new ArrayList<>();
+        for (int i = 0 ; i < N_METHODS ; i++) {
+            sources.add(new AnSource(i));
+        }
+        sources.add(new TestClass());
+        new T7142086().run(sources);
+    }
+
+    void run(List<JavaFileObject> sources) throws Exception {
+        DiagnosticChecker dc = new DiagnosticChecker();
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+        JavacTask ct = (JavacTask)comp.getTask(null, fm, dc,
+                null, null, sources);
+        ct.analyze();
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                throw new AssertionError("unexpected diagnostic: " + diagnostic.getMessage(Locale.getDefault()));
+            }
+        }
+    }
+}
--- a/test/tools/javac/ClassPathTest/ClassPathTest.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/ClassPathTest/ClassPathTest.sh	Tue May 29 00:27:58 2012 +0100
@@ -56,7 +56,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows* )
--- a/test/tools/javac/Diagnostics/6722234/T6722234b_1.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/Diagnostics/6722234/T6722234b_1.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List<T>,List<T>, List<compiler.misc.type.captureof: 1, ? extends T6722234b>,List<compiler.misc.type.captureof: 2, ? extends T6722234b>, kindname.class, T6722234b, (compiler.misc.infer.no.conforming.assignment.exists: T, List<compiler.misc.type.captureof: 2, ? extends T6722234b>, List<T>)
+T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List<T>,List<T>, List<compiler.misc.type.captureof: 1, ? extends T6722234b>,List<compiler.misc.type.captureof: 2, ? extends T6722234b>, kindname.class, T6722234b, (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ? extends T6722234b, compiler.misc.type.captureof: 2, ? extends T6722234b,compiler.misc.type.captureof: 1, ? extends T6722234b)
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234b_2.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/Diagnostics/6722234/T6722234b_2.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,4 @@
-T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List<T>,List<T>, List<compiler.misc.captured.type: 1>,List<compiler.misc.captured.type: 2>, kindname.class, T6722234b, (compiler.misc.infer.no.conforming.assignment.exists: T, List<compiler.misc.captured.type: 2>, List<T>)
+T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List<T>,List<T>, List<compiler.misc.captured.type: 1>,List<compiler.misc.captured.type: 2>, kindname.class, T6722234b, (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.captured.type: 2, compiler.misc.captured.type: 2,compiler.misc.captured.type: 1)
 - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, Object, kindname.method, <T>m(List<T>,List<T>))}
 - compiler.misc.where.description.captured.1: compiler.misc.captured.type: 1,compiler.misc.captured.type: 2,{(compiler.misc.where.captured.1: compiler.misc.captured.type: 1, T6722234b, compiler.misc.type.null, ? extends T6722234b),(compiler.misc.where.captured.1: compiler.misc.captured.type: 2, T6722234b, compiler.misc.type.null, ? extends T6722234b)}
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234d_1.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/Diagnostics/6722234/T6722234d_1.out	Tue May 29 00:27:58 2012 +0100
@@ -1,3 +1,3 @@
-T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.intersection.type: 1, T6722234d.A
+T6722234d.java:18:20: compiler.err.prob.found.req: compiler.misc.intersection.type: 1, T6722234d.A
 - compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, java.lang.Object,T6722234d.I1,T6722234d.I2)}
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234d_2.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/Diagnostics/6722234/T6722234d_2.out	Tue May 29 00:27:58 2012 +0100
@@ -1,3 +1,3 @@
-T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.intersection.type: 1, T6722234d.A
+T6722234d.java:18:20: compiler.err.prob.found.req: compiler.misc.intersection.type: 1, T6722234d.A
 - compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, Object,I1,I2)}
 1 error
--- a/test/tools/javac/Diagnostics/6799605/T6799605.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/Diagnostics/6799605/T6799605.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,4 @@
-T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.inferred.do.not.conform.to.bounds: compiler.misc.type.captureof: 1, ?, T6799605<compiler.misc.type.captureof: 1, ?>))}
-T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.no.conforming.assignment.exists: T, T6799605<compiler.misc.type.captureof: 2, ?>, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch))}
-T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.no.conforming.assignment.exists: T, T6799605<compiler.misc.type.captureof: 2, ?>, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch))}
+T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.type.captureof: 1, ?, T6799605<compiler.misc.type.captureof: 1, ?>))}
+T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch))}
+T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch))}
 3 errors
--- a/test/tools/javac/Diagnostics/6860795/T6860795.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/Diagnostics/6860795/T6860795.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6860795.java:10:27: compiler.err.already.defined: x, foo
+T6860795.java:10:27: compiler.err.already.defined: kindname.variable, x, kindname.method, foo
 1 error
--- a/test/tools/javac/Diagnostics/6862608/T6862608a.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out	Tue May 29 00:27:58 2012 +0100
@@ -1,3 +1,3 @@
-T6862608a.java:19:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
+T6862608a.java:19:33: compiler.err.cant.apply.symbol.1: kindname.method, compound, java.lang.Iterable<? extends java.util.Comparator<? super T>>, java.util.List<java.util.Comparator<?>>, kindname.class, T6862608a, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List<java.util.Comparator<?>>, java.lang.Iterable<? extends java.util.Comparator<? super T>>)
 - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, <T>compound(java.lang.Iterable<? extends java.util.Comparator<? super T>>))}
 1 error
--- a/test/tools/javac/ExtDirs/ExtDirs.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/ExtDirs/ExtDirs.sh	Tue May 29 00:27:58 2012 +0100
@@ -54,7 +54,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/tools/javac/LocalClasses_2.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/LocalClasses_2.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-LocalClasses_2.java:15:13: compiler.err.already.defined: Local, foo()
+LocalClasses_2.java:15:13: compiler.err.already.defined: kindname.class, Local, kindname.method, foo()
 1 error
--- a/test/tools/javac/MissingInclude.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/MissingInclude.sh	Tue May 29 00:27:58 2012 +0100
@@ -47,7 +47,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows* )
--- a/test/tools/javac/NestedInnerClassNames.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/NestedInnerClassNames.out	Tue May 29 00:27:58 2012 +0100
@@ -1,18 +1,18 @@
-NestedInnerClassNames.java:16:5: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:23:9: compiler.err.already.defined: NestedInnerClassNames.foo, NestedInnerClassNames
-NestedInnerClassNames.java:34:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:45:9: compiler.err.already.defined: NestedInnerClassNames.baz, NestedInnerClassNames
-NestedInnerClassNames.java:46:13: compiler.err.already.defined: NestedInnerClassNames.baz.baz, NestedInnerClassNames.baz
-NestedInnerClassNames.java:59:9: compiler.err.already.defined: NestedInnerClassNames.foo$bar, NestedInnerClassNames
-NestedInnerClassNames.java:76:13: compiler.err.already.defined: NestedInnerClassNames.$bar, NestedInnerClassNames
-NestedInnerClassNames.java:90:13: compiler.err.already.defined: NestedInnerClassNames.bar$bar.bar, NestedInnerClassNames.bar$bar
+NestedInnerClassNames.java:16:5: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:23:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:34:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:45:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:46:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz.baz, kindname.class, NestedInnerClassNames.baz
+NestedInnerClassNames.java:59:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo$bar, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:76:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.$bar, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:90:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.bar$bar.bar, kindname.class, NestedInnerClassNames.bar$bar
 NestedInnerClassNames.java:109:5: compiler.err.duplicate.class: NestedInnerClassNames.foo.foo
-NestedInnerClassNames.java:19:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:28:13: compiler.err.already.defined: foo, m2()
-NestedInnerClassNames.java:40:13: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:52:13: compiler.err.already.defined: baz, m4()
-NestedInnerClassNames.java:53:17: compiler.err.already.defined: baz.baz, baz
-NestedInnerClassNames.java:67:13: compiler.err.already.defined: foo$bar, m5()
-NestedInnerClassNames.java:83:17: compiler.err.already.defined: $bar, m6()
-NestedInnerClassNames.java:97:17: compiler.err.already.defined: bar$bar.bar, bar$bar
+NestedInnerClassNames.java:19:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:28:13: compiler.err.already.defined: kindname.class, foo, kindname.method, m2()
+NestedInnerClassNames.java:40:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:52:13: compiler.err.already.defined: kindname.class, baz, kindname.method, m4()
+NestedInnerClassNames.java:53:17: compiler.err.already.defined: kindname.class, baz.baz, kindname.class, baz
+NestedInnerClassNames.java:67:13: compiler.err.already.defined: kindname.class, foo$bar, kindname.method, m5()
+NestedInnerClassNames.java:83:17: compiler.err.already.defined: kindname.class, $bar, kindname.method, m6()
+NestedInnerClassNames.java:97:17: compiler.err.already.defined: kindname.class, bar$bar.bar, kindname.class, bar$bar
 17 errors
--- a/test/tools/javac/OverrideChecks/6400189/T6400189a.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/OverrideChecks/6400189/T6400189a.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,4 @@
 T6400189a.java:14:35: compiler.warn.unchecked.call.mbr.of.raw.type: <T>getAnnotation(java.lang.Class<T>), java.lang.reflect.Constructor
-T6400189a.java:14:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.annotation.Annotation, java.lang.annotation.Documented
+T6400189a.java:14:35: compiler.err.prob.found.req: java.lang.annotation.Annotation, java.lang.annotation.Documented
 1 error
 1 warning
--- a/test/tools/javac/OverrideChecks/6400189/T6400189b.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/OverrideChecks/6400189/T6400189b.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,4 @@
 T6400189b.java:24:24: compiler.warn.unchecked.call.mbr.of.raw.type: <T>m(T6400189b<T>), T6400189b.B
-T6400189b.java:24:24: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Object, java.lang.Integer
+T6400189b.java:24:24: compiler.err.prob.found.req: java.lang.Object, java.lang.Integer
 1 error
 1 warning
--- a/test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh	Tue May 29 00:27:58 2012 +0100
@@ -52,7 +52,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/tools/javac/StringsInSwitch/BadlyTypedLabel1.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/StringsInSwitch/BadlyTypedLabel1.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: (compiler.misc.incompatible.types), int, java.lang.String
+BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: int, java.lang.String
 1 error
--- a/test/tools/javac/StringsInSwitch/BadlyTypedLabel2.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/StringsInSwitch/BadlyTypedLabel2.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.math.RoundingMode, java.lang.String
+BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: java.math.RoundingMode, java.lang.String
 1 error
--- a/test/tools/javac/StringsInSwitch/StringSwitches.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/StringsInSwitch/StringSwitches.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6827009
+ * @bug 6827009 7071246
  * @summary Positive tests for strings in switch.
  * @author  Joseph D. Darcy
  */
@@ -36,6 +36,7 @@
         failures += testPileup();
         failures += testSwitchingTwoWays();
         failures += testNamedBreak();
+        failures += testExtraParens();
 
         if (failures > 0) {
             throw new RuntimeException();
@@ -260,4 +261,19 @@
         result |= (1<<5);
         return result;
     }
+
+    private static int testExtraParens() {
+        int failures = 1;
+        String s = "first";
+
+        switch(s) {
+        case (("first")):
+            failures = 0;
+            break;
+        case ("second"):
+            throw new RuntimeException("Should not be reached.");
+        }
+
+        return failures;
+    }
 }
--- a/test/tools/javac/T5090006/compiler.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/T5090006/compiler.sh	Tue May 29 00:27:58 2012 +0100
@@ -47,7 +47,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows* )
--- a/test/tools/javac/T6326754.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/T6326754.out	Tue May 29 00:27:58 2012 +0100
@@ -1,6 +1,6 @@
 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:64:18: compiler.err.prob.found.req: T, T
 T6326754.java:70:11: compiler.err.cant.apply.symbol.1: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC<T>, (compiler.misc.arg.length.mismatch)
 - compiler.note.unchecked.filename: T6326754.java
 - compiler.note.unchecked.recompile
--- a/test/tools/javac/T6358166.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/T6358166.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
 
         Main compilerMain = new Main("javac", new PrintWriter(System.err, true));
         compilerMain.setOptions(Options.instance(context));
-        compilerMain.filenames = new ListBuffer<File>();
+        compilerMain.filenames = new LinkedHashSet<File>();
         compilerMain.processArgs(args);
 
         JavaCompiler c = JavaCompiler.instance(context);
--- a/test/tools/javac/T6358168.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/T6358168.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
 
         Main compilerMain = new Main("javac", new PrintWriter(System.err, true));
         compilerMain.setOptions(Options.instance(context));
-        compilerMain.filenames = new ListBuffer<File>();
+        compilerMain.filenames = new LinkedHashSet<File>();
         compilerMain.processArgs(new String[] { "-d", "." });
 
         JavaCompiler compiler = JavaCompiler.instance(context);
@@ -91,7 +91,7 @@
 
         Main compilerMain = new Main("javac", new PrintWriter(System.err, true));
         compilerMain.setOptions(Options.instance(context));
-        compilerMain.filenames = new ListBuffer<File>();
+        compilerMain.filenames = new LinkedHashSet<File>();
         compilerMain.processArgs(new String[] {
                                      "-XprintRounds",
                                      "-processorpath", testClasses,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T7093325.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7093325
+ * @summary Redundant entry in bytecode exception table
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool.*;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.javac.api.JavacTool;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class T7093325 {
+
+    /** global decls ***/
+
+    // Create a single file manager and reuse it for each compile to save time.
+    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
+    //statistics
+    static int checkCount = 0;
+
+    enum StatementKind {
+        THROW("throw new RuntimeException();", false, false),
+        RETURN_NONEMPTY("System.out.println(); return;", true, false),
+        RETURN_EMPTY("return;", true, true),
+        APPLY("System.out.println();", true, false);
+
+        String stmt;
+        boolean canInline;
+        boolean empty;
+
+        private StatementKind(String stmt, boolean canInline, boolean empty) {
+            this.stmt = stmt;
+            this.canInline = canInline;
+            this.empty = empty;
+        }
+    }
+
+    enum CatchArity {
+        NONE(""),
+        ONE("catch (A a) { #S1 }"),
+        TWO("catch (B b) { #S2 }"),
+        THREE("catch (C c) { #S3 }"),
+        FOUR("catch (D d) { #S4 }");
+
+        String catchStr;
+
+        private CatchArity(String catchStr) {
+            this.catchStr = catchStr;
+        }
+
+        String catchers() {
+            if (this.ordinal() == 0) {
+                return catchStr;
+            } else {
+                return CatchArity.values()[this.ordinal() - 1].catchers() + catchStr;
+            }
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        for (CatchArity ca : CatchArity.values()) {
+            for (StatementKind stmt0 : StatementKind.values()) {
+                if (ca.ordinal() == 0) {
+                    new T7093325(ca, stmt0).compileAndCheck();
+                    continue;
+                }
+                for (StatementKind stmt1 : StatementKind.values()) {
+                    if (ca.ordinal() == 1) {
+                        new T7093325(ca, stmt0, stmt1).compileAndCheck();
+                        continue;
+                    }
+                    for (StatementKind stmt2 : StatementKind.values()) {
+                        if (ca.ordinal() == 2) {
+                            new T7093325(ca, stmt0, stmt1, stmt2).compileAndCheck();
+                            continue;
+                        }
+                        for (StatementKind stmt3 : StatementKind.values()) {
+                            if (ca.ordinal() == 3) {
+                                new T7093325(ca, stmt0, stmt1, stmt2, stmt3).compileAndCheck();
+                                continue;
+                            }
+                            for (StatementKind stmt4 : StatementKind.values()) {
+                                if (ca.ordinal() == 4) {
+                                    new T7093325(ca, stmt0, stmt1, stmt2, stmt3, stmt4).compileAndCheck();
+                                    continue;
+                                }
+                                for (StatementKind stmt5 : StatementKind.values()) {
+                                    new T7093325(ca, stmt0, stmt1, stmt2, stmt3, stmt4, stmt5).compileAndCheck();
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        System.out.println("Total checks made: " + checkCount);
+    }
+
+    /** instance decls **/
+
+    CatchArity ca;
+    StatementKind[] stmts;
+
+    public T7093325(CatchArity ca, StatementKind... stmts) {
+        this.ca = ca;
+        this.stmts = stmts;
+    }
+
+    void compileAndCheck() throws Exception {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        JavaSource source = new JavaSource();
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, null,
+                null, null, Arrays.asList(source));
+        ct.call();
+        verifyBytecode(source);
+    }
+
+    void verifyBytecode(JavaSource source) {
+        checkCount++;
+        boolean lastInlined = false;
+        boolean hasCode = false;
+        int gapsCount = 0;
+        for (int i = 0; i < stmts.length ; i++) {
+            lastInlined = stmts[i].canInline;
+            hasCode = hasCode || !stmts[i].empty;
+            if (lastInlined && hasCode) {
+                hasCode = false;
+                gapsCount++;
+            }
+        }
+        if (!lastInlined) {
+            gapsCount++;
+        }
+
+        //System.out.printf("gaps %d \n %s \n", gapsCount, source.toString());
+
+        File compiledTest = new File("Test.class");
+        try {
+            ClassFile cf = ClassFile.read(compiledTest);
+            if (cf == null) {
+                throw new Error("Classfile not found: " + compiledTest.getName());
+            }
+
+            Method test_method = null;
+            for (Method m : cf.methods) {
+                if (m.getName(cf.constant_pool).equals("test")) {
+                    test_method = m;
+                    break;
+                }
+            }
+
+            if (test_method == null) {
+                throw new Error("Method test() not found in class Test");
+            }
+
+            Code_attribute code = null;
+            for (Attribute a : test_method.attributes) {
+                if (a.getName(cf.constant_pool).equals(Attribute.Code)) {
+                    code = (Code_attribute)a;
+                    break;
+                }
+            }
+
+            if (code == null) {
+                throw new Error("Code attribute not found in method test()");
+            }
+
+            int actualGapsCount = 0;
+            for (int i = 0; i < code.exception_table_langth ; i++) {
+                int catchType = code.exception_table[i].catch_type;
+                if (catchType == 0) { //any
+                    actualGapsCount++;
+                }
+            }
+
+            if (actualGapsCount != gapsCount) {
+                throw new Error("Bad exception table for test()\n" +
+                            "expected gaps: " + gapsCount + "\n" +
+                            "found gaps: " + actualGapsCount + "\n" +
+                            source);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new Error("error reading " + compiledTest +": " + e);
+        }
+
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        static final String source_template =
+                "class A extends RuntimeException {} \n" +
+                "class B extends RuntimeException {} \n" +
+                "class C extends RuntimeException {} \n" +
+                "class D extends RuntimeException {} \n" +
+                "class E extends RuntimeException {} \n" +
+                "class Test {\n" +
+                "   void test() {\n" +
+                "   try { #S0 } #C finally { System.out.println(); }\n" +
+                "   }\n" +
+                "}";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = source_template.replace("#C", ca.catchers());
+            source = source.replace("#S0", stmts[0].stmt);
+            for (int i = 1; i < ca.ordinal() + 1; i++) {
+                source = source.replace("#S" + i, stmts[i].stmt);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return source;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T7120266.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7120266
+ * @summary javac fails to compile hotspot code
+ * @compile T7120266.java
+ */
+
+class T7120266 {
+   void test(int i, int len) { that(i < len, "oopmap"); }
+   void that(boolean b, String s) { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T7142672/AnnoProcessor.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("Anno")
+public class AnnoProcessor extends AbstractProcessor {
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> set, RoundEnvironment re) {
+        System.out.println("RUNNING...");
+        if(set.isEmpty()) {
+            return false;
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T7142672/Bug.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7142672
+ * @summary Problems with the value passed to the 'classes' param of JavaCompiler.CompilationTask.getTask(...)
+ * @author holmlund
+ * @compile AnnoProcessor.java Bug.java Test3.java
+ * @run main Bug Test2.java
+ * @run main Bug Test2.foo
+ * @run main Bug Test3.java
+ */
+import java.io.*;
+import java.util.*;
+import javax.tools.*;
+
+// Each run should output the 'could not find class file' message, and not throw an AssertError.
+public class Bug {
+    public static void main(String... arg) throws Throwable {
+        String name = arg[0];
+        final String expectedMsg = "error: Could not find class file for '" + name + "'.";
+        JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
+        JavaCompiler.CompilationTask task2;
+        StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+
+
+        DiagnosticListener<? super javax.tools.JavaFileObject> dl =
+            new DiagnosticListener<javax.tools.JavaFileObject>() {
+            public void report(Diagnostic message) {
+                pw.print("Diagnostic:\n"+ message.toString()+"\n");
+                if (!message.toString().equals(expectedMsg)){
+                    System.err.println("Diagnostic:\n"+ message.toString()+"\n");
+                    System.err.println("--Failed: Unexpected diagnostic");
+                    System.exit(1);
+                }
+            }
+        };
+
+        StandardJavaFileManager sjfm = javac.getStandardFileManager(dl,null,null);
+
+        List<String> opts = new ArrayList<String>();
+        opts.add("-proc:only");
+        opts.add("-processor");
+        opts.add("AnnoProcessor");
+
+        boolean xxx;
+
+        System.err.println("\n-- " + name);
+        task2 = javac.getTask(pw, sjfm, dl, opts, Arrays.asList(name), null);
+        xxx = task2.call();
+
+        String out = sw.toString();
+        System.err.println(out);
+        if (out.contains("Assert")) {
+            System.err.println("--Failed: Assertion failure");
+            System.exit(1);
+        }
+        if (!out.contains(expectedMsg)) {
+            System.err.println("--Failed: Expected diagnostic not found");
+            System.exit(1);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T7142672/Test2.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+class Test2 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T7142672/Test3.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+class Test3 {
+}
--- a/test/tools/javac/TryWithResources/BadTwr.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/TryWithResources/BadTwr.out	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
-BadTwr.java:13:39: compiler.err.already.defined: r1, main(java.lang.String...)
-BadTwr.java:18:13: compiler.err.already.defined: args, main(java.lang.String...)
+BadTwr.java:13:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, main(java.lang.String...)
+BadTwr.java:18:20: compiler.err.already.defined: kindname.variable, args, kindname.method, main(java.lang.String...)
 BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt
-BadTwr.java:26:17: compiler.err.already.defined: name, main(java.lang.String...)
+BadTwr.java:26:24: compiler.err.already.defined: kindname.variable, name, kindname.method, main(java.lang.String...)
 4 errors
--- a/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-DuplicateResourceDecl.java:12:45: compiler.err.already.defined: c, main(java.lang.String[])
+DuplicateResourceDecl.java:12:56: compiler.err.already.defined: kindname.variable, c, kindname.method, main(java.lang.String[])
 1 error
--- a/test/tools/javac/TryWithResources/ResourceInterface.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/TryWithResources/ResourceInterface.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-ResourceInterface.java:38:13: compiler.err.unreported.exception.implicit.close: ResourceInterface.E1, r2
+ResourceInterface.java:38:23: compiler.err.unreported.exception.implicit.close: ResourceInterface.E1, r2
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/TryWithResources/T7164542.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7164542
+ * @summary try-with-resources: problem with intersection types
+ * @compile T7164542.java
+ */
+
+public class T7164542 {
+    public static <S extends Readable & AutoCloseable,
+                       T extends Appendable & AutoCloseable>
+    void copy(S s, T t, int size) throws Exception {
+        /*
+         * compiler used to fail here with:
+         *     symbol:   method close()
+         *     location: interface Readable
+         *     Fatal Error: Unable to find method close
+         */
+        try (S src = s; T trg = t) {
+        }
+    }
+}
--- a/test/tools/javac/TryWithResources/TwrFlow.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/TryWithResources/TwrFlow.out	Tue May 29 00:27:58 2012 +0100
@@ -1,3 +1,3 @@
 TwrFlow.java:14:11: compiler.err.except.never.thrown.in.try: java.io.IOException
-TwrFlow.java:12:13: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow
+TwrFlow.java:12:21: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow
 2 errors
--- a/test/tools/javac/TryWithResources/TwrLint.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/TryWithResources/TwrLint.out	Tue May 29 00:27:58 2012 +0100
@@ -1,3 +1,3 @@
 TwrLint.java:14:15: compiler.warn.try.explicit.close.call
-TwrLint.java:13:13: compiler.warn.try.resource.not.referenced: r3
+TwrLint.java:13:21: compiler.warn.try.resource.not.referenced: r3
 2 warnings
--- a/test/tools/javac/TryWithResources/TwrOnNonResource.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/TryWithResources/TwrOnNonResource.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,4 @@
-TwrOnNonResource.java:12:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:15:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:18:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:12:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource)
+TwrOnNonResource.java:15:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource)
+TwrOnNonResource.java:18:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource)
 3 errors
--- a/test/tools/javac/TryWithResources/UnusedResourcesTest.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/TryWithResources/UnusedResourcesTest.java	Tue May 29 00:27:58 2012 +0100
@@ -28,6 +28,7 @@
  */
 
 import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.ClientCodeWrapper;
 import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.util.JCDiagnostic;
 import java.net.URI;
@@ -236,7 +237,7 @@
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.WARNING &&
                     diagnostic.getCode().contains("try.resource.not.referenced")) {
-                String varName = ((JCDiagnostic)diagnostic).getArgs()[0].toString();
+                String varName = unwrap(diagnostic).getArgs()[0].toString();
                 if (varName.equals(TwrStmt.TWR1.resourceName)) {
                     unused_r1 = true;
                 } else if (varName.equals(TwrStmt.TWR2.resourceName)) {
@@ -246,5 +247,13 @@
                 }
             }
         }
+
+        private JCDiagnostic unwrap(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic instanceof JCDiagnostic)
+                return (JCDiagnostic) diagnostic;
+            if (diagnostic instanceof ClientCodeWrapper.DiagnosticSourceUnwrapper)
+                return ((ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic).d;
+            throw new IllegalArgumentException();
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/T7043371.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7043371
+ * @summary javac7 fails with NPE during compilation
+ * @compile T7043371.java
+ */
+
+@interface Anno {
+    String value();
+}
+
+class B {
+    @Anno(value=A.a)
+    public static final int b = 0;
+}
+
+class A {
+    @Deprecated
+    public static final String a = "a";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/T7073477.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7073477
+ * @summary NPE in com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue
+ * @compile T7073477.java
+ */
+
+@SuppressWarnings(T7073477A.S)
+class T7073477 {
+}
+
+class T7073477A {
+  @SuppressWarnings("")
+  static final String S = "";
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/api/7086261/T7086261.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7086261
+ * @summary javac doesn't report error as expected, it only reports ClientCodeWrapper$DiagnosticSourceUnwrapper
+ */
+
+import javax.tools.*;
+
+import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper;
+import com.sun.tools.javac.util.JCDiagnostic;
+
+import java.net.URI;
+import java.util.Arrays;
+
+import static javax.tools.StandardLocation.*;
+import static javax.tools.JavaFileObject.Kind.*;
+
+
+public class T7086261 {
+
+    static class ErroneousSource extends SimpleJavaFileObject {
+        public ErroneousSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return "class Test { NonexistentClass c = null; }";
+        }
+    }
+
+    static class DiagnosticChecker implements DiagnosticListener<javax.tools.JavaFileObject> {
+        public void report(Diagnostic message) {
+            if (!(message instanceof DiagnosticSourceUnwrapper)) {
+                throw new AssertionError("Wrapped diagnostic expected!");
+            }
+            String actual = message.toString();
+            JCDiagnostic jd = (JCDiagnostic)((DiagnosticSourceUnwrapper)message).d;
+            String expected = jd.toString();
+            if (!actual.equals(expected)) {
+                throw new AssertionError("expected = " + expected + "\nfound = " + actual);
+            }
+        }
+    };
+
+    void test() throws Throwable {
+        JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
+        JavaFileManager jfm = javac.getStandardFileManager(null, null, null);
+        JavaCompiler.CompilationTask task =
+                javac.getTask(null, jfm, new DiagnosticChecker(), null, null, Arrays.asList(new ErroneousSource()));
+        task.call();
+    }
+
+    public static void main(String[] args) throws Throwable {
+        new T7086261().test();
+    }
+}
--- a/test/tools/javac/api/T6397104.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/api/T6397104.java	Tue May 29 00:27:58 2012 +0100
@@ -26,10 +26,10 @@
  * @bug     6397104
  * @summary JSR 199: JavaFileManager.getFileForOutput should have sibling argument
  * @author  Peter von der Ah\u00e9
- * @ignore  this test should be rewritten when fixing 6473901
  */
 
 import java.io.File;
+import java.net.URI;
 import java.util.Arrays;
 import javax.tools.*;
 import javax.tools.JavaFileManager.Location;
@@ -52,10 +52,14 @@
             : fm.getJavaFileObjectsFromFiles(Arrays.asList(siblingFile)).iterator().next();
         FileObject fileObject =
             fm.getFileForOutput(location, "java.lang", relName, sibling);
-        if (!fileObject.toUri().getPath().equals(expectedPath))
-            throw new AssertionError("Expected " + expectedPath +
-                                     ", got " + fileObject.toUri().getPath());
-        System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObject.toUri());
+
+        File expectedFile = new File(expectedPath).getCanonicalFile();
+        File fileObjectFile = new File(fileObject.toUri()).getCanonicalFile();
+
+        if (!fileObjectFile.equals(expectedFile))
+            throw new AssertionError("Expected " + expectedFile +
+                                     ", got " + fileObjectFile);
+        System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObjectFile);
     }
 
     void test(boolean hasLocation, File siblingFile, String relName, String expectedPath)
--- a/test/tools/javac/api/T6838467.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/api/T6838467.java	Tue May 29 00:27:58 2012 +0100
@@ -32,7 +32,6 @@
 import java.util.zip.*;
 import javax.tools.*;
 import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.main.OptionName;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Options;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/api/TestGetScope.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7090249
+ * @summary IllegalStateException from Trees.getScope when called from JSR 199
+ */
+
+import com.sun.source.tree.IdentifierTree;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import com.sun.source.util.Trees;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+
+@SupportedAnnotationTypes("*")
+public class TestGetScope extends AbstractProcessor {
+    public static void main(String... args) {
+        new TestGetScope().run();
+    }
+
+    public void run() {
+        File srcDir = new File(System.getProperty("test.src"));
+        File thisFile = new File(srcDir, getClass().getName() + ".java");
+
+        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
+
+        List<String> opts = Arrays.asList("-proc:only", "-doe");
+        Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(thisFile);
+        JavacTask t = (JavacTask) c.getTask(null, fm, null, opts, null, files);
+        t.setProcessors(Collections.singleton(this));
+        boolean ok = t.call();
+        if (!ok)
+            throw new Error("compilation failed");
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        Trees trees = Trees.instance(processingEnv);
+        if (round++ == 0) {
+            for (Element e: roundEnv.getRootElements()) {
+                TreePath p = trees.getPath(e);
+                new Scanner().scan(p, trees);
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round;
+
+    static class Scanner extends TreePathScanner<Void,Trees> {
+        @Override
+        public Void visitIdentifier(IdentifierTree t, Trees trees) {
+            System.err.println("visitIdentifier: " + t);
+            trees.getScope(getCurrentPath());
+            return null;
+        }
+    }
+}
--- a/test/tools/javac/api/TestJavacTaskScanner.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/api/TestJavacTaskScanner.java	Tue May 29 00:27:58 2012 +0100
@@ -32,6 +32,7 @@
 
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.parser.*;
+import com.sun.tools.javac.parser.Tokens.Token;
 import com.sun.tools.javac.util.*;
 import java.io.*;
 import java.net.*;
@@ -93,7 +94,7 @@
 
         check(numTokens, "#Tokens", 1222);
         check(numParseTypeElements, "#parseTypeElements", 136);
-        check(numAllMembers, "#allMembers", 67);
+        check(numAllMembers, "#allMembers", 52);
     }
 
     void check(int value, String name, int expected) {
@@ -206,7 +207,8 @@
 
     public void nextToken() {
         super.nextToken();
-        System.err.format("Saw token %s (%s)%n", token(), name());
+        Token tk = token();
+        System.err.format("Saw token %s %n", tk.kind);
         test.numTokens++;
     }
 
--- a/test/tools/javac/api/TestOperators.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/api/TestOperators.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
  * @bug     6338064 6346249 6340951 6392177
  * @summary Tree API: can't determine kind of operator
  * @author  Peter von der Ah\u00e9
- * @compile TestOperators.java
+ * @library ../lib
+ * @build JavacTestingAbstractProcessor TestOperators
  * @compile -processor TestOperators -proc:only TestOperators.java
  */
 
@@ -46,7 +47,7 @@
 }
 
 @SupportedAnnotationTypes("TestMe")
-public class TestOperators extends AbstractProcessor {
+public class TestOperators extends JavacTestingAbstractProcessor {
 
     @TestMe(POSTFIX_INCREMENT)
     public int test_POSTFIX_INCREMENT(int i) {
@@ -299,7 +300,7 @@
         final Trees trees = Trees.instance(processingEnv);
         final Messager log = processingEnv.getMessager();
         final Elements elements = processingEnv.getElementUtils();
-        class Scan extends ElementScanner7<Void,Void> {
+        class Scan extends ElementScanner<Void,Void> {
             @Override
             public Void visitExecutable(ExecutableElement e, Void p) {
                 Object debug = e; // info for exception handler
@@ -343,5 +344,4 @@
         }
         return true;
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/api/taskListeners/TestSimpleAddRemove.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7093891
+ * @summary support multiple task listeners
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.TypeElement;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.api.JavacTool;
+
+public class TestSimpleAddRemove {
+    enum AddKind {
+        SET_IN_TASK,
+        ADD_IN_TASK,
+        ADD_IN_PROCESSOR,
+        ADD_IN_LISTENER;
+    }
+
+    enum RemoveKind {
+        REMOVE_IN_TASK,
+        REMOVE_IN_PROCESSOR,
+        REMOVE_IN_LISTENER,
+    }
+
+    enum CompileKind {
+        CALL {
+            void run(JavacTask t) {
+                if (!t.call()) throw new Error("compilation failed");
+            }
+        },
+        GENERATE {
+            void run(JavacTask t) throws IOException {
+                t.generate();
+            }
+        };
+        abstract void run(JavacTask t) throws IOException;
+    }
+
+    static class EventKindCounter extends EnumMap<TaskEvent.Kind, EventKindCounter.Count> {
+        static class Count {
+            int started;
+            int finished;
+
+            @Override
+            public String toString() {
+                return started + ":" + finished;
+            }
+        }
+
+        EventKindCounter() {
+            super(TaskEvent.Kind.class);
+        }
+
+        void inc(TaskEvent.Kind k, boolean started) {
+            Count c = get(k);
+            if (c == null)
+                put(k, c = new Count());
+
+            if (started)
+                c.started++;
+            else
+                c.finished++;
+        }
+    }
+
+    static class TestListener implements TaskListener {
+        EventKindCounter counter;
+
+        TestListener(EventKindCounter c) {
+            counter = c;
+        }
+
+        public void started(TaskEvent e) {
+            counter.inc(e.getKind(), true);
+        }
+
+        public void finished(TaskEvent e) {
+            counter.inc(e.getKind(), false);
+        }
+    }
+
+    static void addInListener(final JavacTask task, final TaskEvent.Kind kind, final TaskListener listener) {
+        task.addTaskListener(new TaskListener() {
+            public void started(TaskEvent e) {
+                if (e.getKind() == kind) {
+                    task.addTaskListener(listener);
+                    task.removeTaskListener(this);
+                }
+            }
+
+            public void finished(TaskEvent e) { }
+        });
+    }
+
+    static void removeInListener(final JavacTask task, final TaskEvent.Kind kind, final TaskListener listener) {
+        task.addTaskListener(new TaskListener() {
+            public void started(TaskEvent e) {
+                if (e.getKind() == kind) {
+                    task.removeTaskListener(listener);
+                    task.removeTaskListener(this);
+                }
+            }
+
+            public void finished(TaskEvent e) { }
+        });
+    }
+
+    @SupportedAnnotationTypes("*")
+    class TestProcessor extends AbstractProcessor {
+        AddKind ak;
+        RemoveKind rk;
+        TaskListener listener;
+
+        TestProcessor(AddKind ak, RemoveKind rk, TaskListener listener) {
+            this.ak = ak;
+            this.rk = rk;
+            this.listener = listener;
+        }
+
+        int round = 0;
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+//            System.err.println("TestProcessor.process " + roundEnv);
+            JavacTask task = JavacTask.instance(processingEnv);
+            if (++round == 1) {
+                switch (ak) {
+                    case ADD_IN_PROCESSOR:
+                        task.addTaskListener(listener);
+                        break;
+                    case ADD_IN_LISTENER:
+                        addInListener(task, TaskEvent.Kind.ANALYZE, listener);
+                        break;
+                }
+            } else if (roundEnv.processingOver()) {
+                switch (rk) {
+                    case REMOVE_IN_PROCESSOR:
+                        task.removeTaskListener(listener);
+                        break;
+                    case REMOVE_IN_LISTENER:
+                        removeInListener(task, TaskEvent.Kind.GENERATE, listener);
+                        break;
+                }
+            }
+            return true;
+        }
+    }
+
+    static class TestSource extends SimpleJavaFileObject {
+        public TestSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return "class Test { }";
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        new TestSimpleAddRemove().run();
+    }
+
+    JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
+    StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+    void run() throws Exception {
+        for (CompileKind ck: CompileKind.values()) {
+            for (AddKind ak: AddKind.values()) {
+                for (RemoveKind rk: RemoveKind.values()) {
+                    test(ck, ak, rk);
+                }
+            }
+        }
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void test(CompileKind ck, AddKind ak, RemoveKind rk) throws IOException {
+        System.err.println("Test: " + ck + " " + ak + " " + rk);
+
+        File tmpDir = new File(ck + "-" + ak + "-" + rk);
+        tmpDir.mkdirs();
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(tmpDir));
+
+        List<String> options = new ArrayList<String>();
+        Iterable<? extends JavaFileObject> files = Arrays.asList(new TestSource());
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        JavacTask task = tool.getTask(pw, fm, null, options, null, files);
+
+        EventKindCounter ec = new EventKindCounter();
+        TaskListener listener = new TestListener(ec);
+        boolean needProcessor = false;
+
+        switch (ak) {
+            case SET_IN_TASK:
+                task.setTaskListener(listener);
+                break;
+            case ADD_IN_TASK:
+                task.addTaskListener(listener);
+                break;
+            case ADD_IN_PROCESSOR:
+            case ADD_IN_LISTENER:
+                needProcessor = true;
+        }
+
+        switch (rk) {
+            case REMOVE_IN_TASK:
+                task.removeTaskListener(listener);
+                break;
+            case REMOVE_IN_PROCESSOR:
+            case REMOVE_IN_LISTENER:
+                needProcessor = true;
+        }
+
+        if (needProcessor)
+            task.setProcessors(Arrays.asList(new TestProcessor(ak, rk, listener)));
+
+        ck.run(task);
+        System.err.println(ec);
+
+        check(ck, ak, rk, ec);
+
+        System.err.println();
+    }
+
+    void check(CompileKind ck, AddKind ak, RemoveKind rk, EventKindCounter ec) {
+        // All results should be independent of ck, so we can ignore that
+
+        // Quick way to compare expected values of ec, by comparing ec.toString()
+        String expect = ec.toString();
+        String found;
+
+        switch (ak) {
+            // Add/set in task should record all events until the listener is removed
+            case SET_IN_TASK:
+            case ADD_IN_TASK:
+                switch (rk) {
+                    case REMOVE_IN_TASK:
+                        // Remove will succeed, meaning no events will be recorded
+                        found = "{}";
+                        break;
+                    case REMOVE_IN_PROCESSOR:
+                        found = "{PARSE=1:1, ENTER=2:2, ANNOTATION_PROCESSING=1:0, ANNOTATION_PROCESSING_ROUND=2:1}";
+                        break;
+                    case REMOVE_IN_LISTENER:
+                        found = "{PARSE=1:1, ENTER=3:3, ANALYZE=1:1, GENERATE=1:0, ANNOTATION_PROCESSING=1:1, ANNOTATION_PROCESSING_ROUND=2:2}";
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+                break;
+
+            // "Add in processor" should skip initial PARSE/ENTER events
+            case ADD_IN_PROCESSOR:
+                switch (rk) {
+                    // Remove will fail (too early), so events to end will be recorded
+                    case REMOVE_IN_TASK:
+                        found = "{ENTER=2:2, ANALYZE=1:1, GENERATE=1:1, ANNOTATION_PROCESSING=0:1, ANNOTATION_PROCESSING_ROUND=1:2}";
+                        break;
+                    case REMOVE_IN_PROCESSOR:
+                        found = "{ENTER=1:1, ANNOTATION_PROCESSING_ROUND=1:1}";
+                        break;
+                    case REMOVE_IN_LISTENER:
+                        found = "{ENTER=2:2, ANALYZE=1:1, GENERATE=1:0, ANNOTATION_PROCESSING=0:1, ANNOTATION_PROCESSING_ROUND=1:2}";
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+                break;
+
+            // "Add in listener" will occur during "ANALYSE.started" event
+            case ADD_IN_LISTENER:
+                switch (rk) {
+                    // Remove will fail (too early, so events to end will be recorded
+                    case REMOVE_IN_TASK:
+                    case REMOVE_IN_PROCESSOR:
+                        found = "{ANALYZE=0:1, GENERATE=1:1}";
+                        break;
+                    // Remove will succeed during "GENERATE.finished" event
+                    case REMOVE_IN_LISTENER:
+                        found = "{ANALYZE=0:1, GENERATE=1:0}";
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+                break;
+            default:
+                throw new IllegalStateException();
+        }
+
+        if (!found.equals(expect)) {
+            System.err.println("Expected: " + expect);
+            System.err.println("   Found: " + found);
+            error("unexpected value found");
+        }
+    }
+
+    int errors;
+
+    void error(String message) {
+        System.err.println("Error: " + message);
+        errors++;
+    }
+}
--- a/test/tools/javac/apt.sh	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-#! /bin/sh -f
-
-#
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# 
-# Usage:
-#  @run apt.sh <apt-args>
-#
-# This script is to run apt for a regression test
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux )
-    NULL=/dev/null
-    PS=":"
-    FS="/"
-    ;;
-  Windows* )
-    NULL=NUL
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-CLASSPATH="${TESTCLASSES}${PS}${TESTJAVA}${FS}lib${FS}tools.jar" "${TESTJAVA}${FS}bin${FS}apt" ${TESTTOOLVMOPTS} $*
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
-
-
--- a/test/tools/javac/cast/6270087/T6270087neg.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/cast/6270087/T6270087neg.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6270087neg.java:36:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6270087neg.Foo<V>, T6270087neg.Foo<U>
+T6270087neg.java:36:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6270087neg.Foo<V>, T6270087neg.Foo<U>)
 1 error
--- a/test/tools/javac/cast/6557182/T6557182.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/cast/6557182/T6557182.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,4 @@
-T6557182.java:12:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer>
+T6557182.java:12:56: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T, java.lang.Comparable<java.lang.Integer>)
 T6557182.java:16:56: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer>
 1 error
 1 warning
--- a/test/tools/javac/cast/6665356/T6665356.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/cast/6665356/T6665356.out	Tue May 29 00:27:58 2012 +0100
@@ -1,8 +1,8 @@
-T6665356.java:31:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long>
-T6665356.java:35:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number>
-T6665356.java:39:65: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>
-T6665356.java:43:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long>
-T6665356.java:47:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String>
-T6665356.java:51:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long>
-T6665356.java:55:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String>
+T6665356.java:31:55: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long>)
+T6665356.java:35:58: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number>)
+T6665356.java:39:65: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>)
+T6665356.java:43:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long>)
+T6665356.java:47:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String>)
+T6665356.java:51:55: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long>)
+T6665356.java:55:58: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String>)
 7 errors
--- a/test/tools/javac/cast/6795580/T6795580.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/cast/6795580/T6795580.out	Tue May 29 00:27:58 2012 +0100
@@ -1,8 +1,8 @@
-T6795580.java:31:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[]
-T6795580.java:35:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[]
-T6795580.java:39:67: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[]
-T6795580.java:43:59: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[]
-T6795580.java:47:62: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[]
-T6795580.java:51:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[]
-T6795580.java:55:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[]
+T6795580.java:31:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[])
+T6795580.java:35:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[])
+T6795580.java:39:67: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[])
+T6795580.java:43:59: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[])
+T6795580.java:47:62: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[])
+T6795580.java:51:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[])
+T6795580.java:55:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[])
 7 errors
--- a/test/tools/javac/cast/6932571/T6932571neg.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/cast/6932571/T6932571neg.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6932571neg.java:39:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6932571neg.S, G
+T6932571neg.java:39:19: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6932571neg.S, G)
 1 error
--- a/test/tools/javac/cast/7005095/T7005095neg.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/cast/7005095/T7005095neg.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T7005095neg.java:13:25: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T7005095pos.FooImpl, T7005095pos.Foo<T>
+T7005095neg.java:13:25: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T7005095pos.FooImpl, T7005095pos.Foo<T>)
 1 error
--- a/test/tools/javac/cast/7005671/T7005671.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/cast/7005671/T7005671.out	Tue May 29 00:27:58 2012 +0100
@@ -1,17 +1,17 @@
-T7005671.java:12:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), byte[], X[]
-T7005671.java:13:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), short[], X[]
-T7005671.java:14:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), int[], X[]
-T7005671.java:15:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), long[], X[]
-T7005671.java:16:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), float[], X[]
-T7005671.java:17:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), double[], X[]
-T7005671.java:18:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), char[], X[]
-T7005671.java:19:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), boolean[], X[]
-T7005671.java:23:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], byte[]
-T7005671.java:24:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], short[]
-T7005671.java:25:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], int[]
-T7005671.java:26:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], long[]
-T7005671.java:27:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], float[]
-T7005671.java:28:31: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], double[]
-T7005671.java:29:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], char[]
-T7005671.java:30:32: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], boolean[]
+T7005671.java:12:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: byte[], X[])
+T7005671.java:13:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: short[], X[])
+T7005671.java:14:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: int[], X[])
+T7005671.java:15:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: long[], X[])
+T7005671.java:16:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: float[], X[])
+T7005671.java:17:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: double[], X[])
+T7005671.java:18:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: char[], X[])
+T7005671.java:19:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: boolean[], X[])
+T7005671.java:23:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], byte[])
+T7005671.java:24:30: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], short[])
+T7005671.java:25:28: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], int[])
+T7005671.java:26:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], long[])
+T7005671.java:27:30: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], float[])
+T7005671.java:28:31: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], double[])
+T7005671.java:29:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], char[])
+T7005671.java:30:32: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], boolean[])
 16 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100a.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100a.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100a.java
+ */
+
+class T7123100a {
+    <E extends Enum<E>> E m() {
+        return null;
+    }
+
+    <Z> void test() {
+        Z z = (Z)m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100a.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,4 @@
+T7123100a.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), E, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100b.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100b.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100b.java
+ */
+
+class T7123100b {
+    <Z> void test(Enum<?> e) {
+        Z z = (Z)e;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100b.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,4 @@
+T7123100b.java:10:18: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum<compiler.misc.type.captureof: 1, ?>, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100c.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100c.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100c.java
+ */
+
+class T7123100c {
+    <E> E m(E e) {
+        return null;
+    }
+
+    <Z> void test(Enum<?> e) {
+        Z z = (Z)m(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100c.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,4 @@
+T7123100c.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum<compiler.misc.type.captureof: 1, ?>, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100d.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100d.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100d.java
+ */
+
+class T7123100d {
+    <E extends Enum<E>> E m(Enum<E> e) {
+        return null;
+    }
+
+    <Z> void test(Enum<?> e) {
+        Z z = (Z)m(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7123100/T7123100d.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,4 @@
+T7123100d.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), compiler.misc.type.captureof: 1, ?, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7126754/T7126754.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @author mcimadamore
+ * @bug     7005671
+ * @summary Generics compilation failure casting List<? extends Set...> to List<Set...>
+ * @compile/fail/ref=T7126754.out -Xlint:unchecked -Werror -XDrawDiagnostics T7126754.java
+ */
+
+import java.util.List;
+
+class T7126754 {
+    List<? extends List<? extends String>> c = null;
+    List<List<? extends String>> d = (List<List<? extends String>>)c;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/7126754/T7126754.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,4 @@
+T7126754.java:13:68: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.util.List<compiler.misc.type.captureof: 1, ? extends java.util.List<? extends java.lang.String>>, java.util.List<java.util.List<? extends java.lang.String>>
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/classfiles/ClassVersionChecker.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7157626
+ * @summary Test major version for all legal combinations for -source and -target
+ * @author sgoel
+ *
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.util.*;
+import java.util.regex.*;
+
+public class ClassVersionChecker {
+
+    int errors;
+    String[] jdk = {"","1.2","1.3","1.4","1.5","1.6","1.7","1.8"};
+    File javaFile = null;
+
+    public static void main(String[] args) throws Throwable {
+        new ClassVersionChecker().run();
+    }
+
+    void run() throws Exception {
+        writeTestFile();
+        /* Rules applicable for -source and -target combinations
+         * 1. If both empty, version num is for 1.7
+         * 2. If source is not empty and target is empty, version is based on source
+         * 3. If both non-empty, version is based on target
+         */
+
+        /* -source (0=>empty,1=>1.2,...) X -target (0=>empty,1=>1.2,...)
+         * ver[0][0] => no -source or -target was given
+         * -1 => invalid combinations
+         */
+        int[][] ver =
+                {{51, -1, -1, -1, -1, -1, -1, -1},
+                 {48, 46, 47, 48, 49, 50, 51, 51},
+                 {48, 46, 47, 48, 49, 50, 51, 51},
+                 {48, -1, -1, 48, 49, 50, 51, 51},
+                 {51, -1, -1, -1, 49, 50, 51, 51},
+                 {51, -1, -1, -1, -1, 50, 51, 51},
+                 {51, -1, -1, -1, -1, -1, 51, 51},
+                 {51, -1, -1, -1, -1, -1, -1, 51}};
+
+        // Loop to run all possible combinations of source/target values
+        for (int i = 0; i< ver.length; i++) {
+            for (int j = 0 ; j< ver[i].length; j++) {
+                if(ver[i][j] != -1) {
+                    logMsg("Index values for i = " + i + " j = " + j);
+                    logMsg("Running for src = " + jdk[i] + " target = "+jdk[j] +" expected = " + ver[i][j]);
+                    test(i,j, ver[i][j]);
+                }
+            }
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    void test (int i, int j, int expected) {
+        File classFile = compileTestFile(i, j, javaFile);
+        short majorVer = getMajorVersion(classFile);
+        checkVersion(majorVer, expected);
+    }
+
+    void writeTestFile() throws IOException {
+        javaFile = new File("Test.java");
+        try(PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(javaFile)));) {
+            out.println("class Test { ");
+            out.println("  public void foo() { }");
+            out.println("}");
+        } catch (IOException ioe) {
+            error("IOException while creating Test.java" + ioe);
+        }
+    }
+
+    File compileTestFile(int i , int j, File f) {
+        int rc = -1;
+        // Src and target are empty
+        if (i == 0 && j == 0 ) {
+            rc = compile("-g", f.getPath());
+        } else if( j == 0 ) {  // target is empty
+            rc = compile("-source", jdk[i], "-g", f.getPath());
+        } else {
+            rc = compile("-source", jdk[i], "-target", jdk[j], "-g", f.getPath());
+        }
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    int compile(String... args) {
+        return com.sun.tools.javac.Main.compile(args);
+    }
+
+    void logMsg (String str) {
+        System.out.println(str);
+    }
+
+    short getMajorVersion(File f) {
+        List<String> args = new ArrayList<String>();
+        short majorVer = 0;
+        try(DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(f)));) {
+            in.readInt();
+            in.readShort();
+            majorVer = in.readShort();
+            System.out.println("major version:" +  majorVer);
+        } catch (IOException e) {
+            error("IOException while reading Test.class" + e);
+        }
+        return majorVer;
+    }
+
+    void checkVersion(short majorVer, int expected) {
+        if (majorVer != expected ) {
+            error("versions did not match, Expected: " + expected + "Got: " + majorVer);
+        }
+    }
+
+    void error(String msg) {
+       System.out.println("error: " + msg);
+       errors++;
+    }
+}
--- a/test/tools/javac/constDebug/ConstDebug.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/constDebug/ConstDebug.sh	Tue May 29 00:27:58 2012 +0100
@@ -47,7 +47,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/depDocComment/DeprecatedDocComment3.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 7096014
+ * @summary Javac tokens should retain state
+ * @compile -Xlint -Werror DeprecatedDocComment3.java
+ */
+
+class DeprecatedDocComment3 {
+    static class Foo { }
+
+    ; /** @deprecated */ ;
+
+    static class A {}
+
+    static class B {
+       A a; //not deprecated!
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/depDocComment/DeprecatedDocComment4.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,20 @@
+/**
+ * @test  /nodynamiccopyright/
+ * @bug 7104201
+ * @summary Refactor DocCommentScanner
+ * @compile/fail/ref=DeprecatedDocComment4.out -XDrawDiagnostics -Werror -Xlint:dep-ann DeprecatedDocComment4.java
+ */
+
+class DeprecatedDocComment4 {
+    /** @deprecated **/
+    /* block */
+    void test1() {};
+
+    /** @deprecated **/
+    /** double javadoc */
+    void test2() {};
+
+    /** @deprecated **/
+    //line comment
+    void test3() {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/depDocComment/DeprecatedDocComment4.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,6 @@
+DeprecatedDocComment4.java:11:10: compiler.warn.missing.deprecated.annotation
+DeprecatedDocComment4.java:15:10: compiler.warn.missing.deprecated.annotation
+DeprecatedDocComment4.java:19:10: compiler.warn.missing.deprecated.annotation
+- compiler.err.warnings.and.werror
+1 error
+3 warnings
--- a/test/tools/javac/diags/ArgTypeCompilerFactory.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/ArgTypeCompilerFactory.java	Tue May 29 00:27:58 2012 +0100
@@ -35,7 +35,7 @@
 import com.sun.tools.javac.file.*;
 import com.sun.tools.javac.main.Main;
 import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.parser.Token;
+import com.sun.tools.javac.parser.Tokens.TokenKind;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
 import javax.lang.model.SourceVersion;
@@ -105,13 +105,11 @@
 
             Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
 
-            JavacTaskImpl t = (JavacTaskImpl) tool.getTask(out, fm, null, opts, null, fos);
-            Context c = t.getContext();
+            Context c = new Context();
             ArgTypeMessages.preRegister(c);
             ArgTypeJavaCompiler.preRegister(c);
-            Boolean ok = t.call();
-
-            return ok;
+            JavacTaskImpl t = (JavacTaskImpl) tool.getTask(out, fm, null, opts, null, fos, c);
+            return t.call();
         }
     }
 
@@ -146,9 +144,9 @@
             JavacFileManager.preRegister(c); // can't create it until Log has been set up
             ArgTypeJavaCompiler.preRegister(c);
             ArgTypeMessages.preRegister(c);
-            int result = main.compile(args.toArray(new String[args.size()]), c);
+            Main.Result result = main.compile(args.toArray(new String[args.size()]), c);
 
-            return (result == 0);
+            return result.isOK();
         }
     }
 
@@ -172,10 +170,10 @@
             JavacFileManager.preRegister(c); // can't create it until Log has been set up
             ArgTypeJavaCompiler.preRegister(c);
             ArgTypeMessages.preRegister(c);
-            com.sun.tools.javac.main.Main m = new com.sun.tools.javac.main.Main("javac", out);
-            int rc = m.compile(args.toArray(new String[args.size()]), c);
+            Main m = new Main("javac", out);
+            Main.Result result = m.compile(args.toArray(new String[args.size()]), c);
 
-            return (rc == 0);
+            return result.isOK();
         }
 
     }
@@ -319,7 +317,7 @@
             return "modifier";
         if (o instanceof KindName)
             return "symbol kind";
-        if (o instanceof Token)
+        if (o instanceof TokenKind)
             return "token";
         if (o instanceof Symbol)
             return "symbol";
--- a/test/tools/javac/diags/CheckExamples.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/CheckExamples.java	Tue May 29 00:27:58 2012 +0100
@@ -23,10 +23,13 @@
 
 /*
  * @test
- * @bug 6968063
+ * @bug 6968063 7127924
  * @summary provide examples of code that generate diagnostics
  * @build Example CheckExamples
- * @run main CheckExamples
+ * @run main/othervm CheckExamples
+ */
+/*
+ *      See CR 7127924 for info on why othervm is used.
  */
 
 import java.io.*;
--- a/test/tools/javac/diags/CheckResourceKeys.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/CheckResourceKeys.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -259,6 +259,7 @@
             "application.home", // in Paths.java
             "env.class.path",
             "line.separator",
+            "os.name",
             "user.dir",
             // file names
             "ct.sym",
--- a/test/tools/javac/diags/Example.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/Example.java	Tue May 29 00:27:58 2012 +0100
@@ -21,10 +21,12 @@
  * questions.
  */
 
-import com.sun.tools.javac.file.JavacFileManager;
 import java.io.*;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.*;
 import java.util.regex.*;
+import javax.annotation.processing.Processor;
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticCollector;
 import javax.tools.JavaCompiler;
@@ -37,12 +39,12 @@
 // import com.sun.tools.javac.Main
 // import com.sun.tools.javac.main.Main
 
+import com.sun.tools.javac.api.ClientCodeWrapper;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.main.Main;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.JCDiagnostic;
-import java.net.URL;
-import java.net.URLClassLoader;
-import javax.annotation.processing.Processor;
 
 /**
  * Class to handle example code designed to illustrate javac diagnostic messages.
@@ -397,7 +399,7 @@
 
             if (keys != null) {
                 for (Diagnostic<? extends JavaFileObject> d: dc.getDiagnostics()) {
-                    scanForKeys((JCDiagnostic) d, keys);
+                    scanForKeys(unwrap(d), keys);
                 }
             }
 
@@ -418,6 +420,14 @@
             for (JCDiagnostic sd: d.getSubdiagnostics())
                 scanForKeys(sd, keys);
         }
+
+        private JCDiagnostic unwrap(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic instanceof JCDiagnostic)
+                return (JCDiagnostic) diagnostic;
+            if (diagnostic instanceof ClientCodeWrapper.DiagnosticSourceUnwrapper)
+                return ((ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic).d;
+            throw new IllegalArgumentException();
+        }
     }
 
     /**
@@ -506,14 +516,14 @@
             Context c = new Context();
             JavacFileManager.preRegister(c); // can't create it until Log has been set up
             MessageTracker.preRegister(c, keys);
-            com.sun.tools.javac.main.Main m = new com.sun.tools.javac.main.Main("javac", pw);
-            int rc = m.compile(args.toArray(new String[args.size()]), c);
+            Main m = new Main("javac", pw);
+            Main.Result rc = m.compile(args.toArray(new String[args.size()]), c);
 
             if (keys != null) {
                 pw.close();
             }
 
-            return (rc == 0);
+            return rc.isOK();
         }
 
         static class MessageTracker extends JavacMessages {
--- a/test/tools/javac/diags/MessageInfo.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/MessageInfo.java	Tue May 29 00:27:58 2012 +0100
@@ -23,10 +23,13 @@
 
 /**
  * @test
- * @bug 7013272
+ * @bug 7013272 7127924
  * @summary Automatically generate info about how compiler resource keys are used
  * @build Example ArgTypeCompilerFactory MessageFile MessageInfo
- * @run main MessageInfo
+ * @run main/othervm MessageInfo
+ */
+/*
+ *      See CR 7127924 for info on why othervm is used.
  */
 
 import java.io.*;
--- a/test/tools/javac/diags/RunExamples.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/RunExamples.java	Tue May 29 00:27:58 2012 +0100
@@ -23,10 +23,13 @@
 
 /**
  * @test
- * @bug 6968063
+ * @bug 6968063 7127924
  * @summary provide examples of code that generate diagnostics
  * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples
- * @run main RunExamples
+ * @run main/othervm RunExamples
+ */
+/*
+ *      See CR 7127924 for info on why othervm is used.
  */
 
 import java.io.*;
--- a/test/tools/javac/diags/examples.not-yet.txt	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples.not-yet.txt	Tue May 29 00:27:58 2012 +0100
@@ -1,8 +1,6 @@
 compiler.err.already.annotated                          # internal compiler error?
 compiler.err.already.defined.this.unit                  # seems to be masked by compiler.err.duplicate.class
 compiler.err.annotation.value.not.allowable.type        # cannot happen: precluded by complete type-specific tests
-compiler.err.assignment.from.super-bound                # DEAD
-compiler.err.assignment.to.extends-bound                # DEAD
 compiler.err.cant.apply.symbol
 compiler.err.cant.read.file                             # (apt.JavaCompiler?)
 compiler.err.cant.select.static.class.from.param.type
@@ -24,7 +22,6 @@
 compiler.err.no.encl.instance.of.type.in.scope          # cannot occur; always followed by assert false;
 compiler.err.no.match.entry                             # UNUSED?
 compiler.err.not.annotation.type                        # cannot occur given preceding checkType
-compiler.err.prob.found.req.1                           # Check: DEAD, in unused method
 compiler.err.proc.bad.config.file                       # JavacProcessingEnvironment
 compiler.err.proc.cant.access                           # completion failure
 compiler.err.proc.cant.access.1                         # completion failure, no stack trace
@@ -38,12 +35,8 @@
 compiler.err.stack.sim.error
 compiler.err.type.var.more.than.once                    # UNUSED
 compiler.err.type.var.more.than.once.in.result          # UNUSED
-compiler.err.undetermined.type
 compiler.err.unexpected.type
 compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
-compiler.err.wrong.target.for.polymorphic.signature.definition     # Transitional 292
-compiler.misc.assignment.from.super-bound
-compiler.misc.assignment.to.extends-bound
 compiler.misc.bad.class.file.header                     # bad class file
 compiler.misc.bad.class.signature                       # bad class file
 compiler.misc.bad.const.pool.tag                        # bad class file
@@ -60,7 +53,7 @@
 compiler.misc.fatal.err.cant.locate.ctor                # Resolve, from Lower
 compiler.misc.fatal.err.cant.locate.field               # Resolve, from Lower
 compiler.misc.fatal.err.cant.locate.meth                # Resolve, from Lower
-compiler.misc.fatal.err.cant.close.loader               # JavacProcessingEnvironment
+compiler.misc.fatal.err.cant.close	                # JavaCompiler
 compiler.misc.file.does.not.contain.package
 compiler.misc.illegal.start.of.class.file
 compiler.misc.kindname.annotation
@@ -85,10 +78,8 @@
 compiler.misc.type.captureof.1
 compiler.misc.type.none
 compiler.misc.type.req.exact
-compiler.misc.type.variable.has.undetermined.type
 compiler.misc.unable.to.access.file                     # ClassFile
 compiler.misc.undecl.type.var                           # ClassReader
-compiler.misc.undetermined.type
 compiler.misc.unicode.str.not.supported                 # ClassReader
 compiler.misc.verbose.retro                             # UNUSED
 compiler.misc.verbose.retro.with                        # UNUSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/AlreadyDefinedClinit.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.already.defined.in.clinit
+
+class AlreadyDefinedClinit {
+    static {
+        int i;
+        int i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/ApplicableMethodFound.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.applicable.method.found
+// key: compiler.note.verbose.resolve.multi
+// options: -XDverboseResolution=applicable,success
+
+class ApplicableMethodFound {
+
+    void m() {}
+
+    { m(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/ApplicableMethodFound1.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.applicable.method.found.1
+// key: compiler.note.verbose.resolve.multi
+// key: compiler.misc.full.inst.sig
+// options: -XDverboseResolution=applicable,success
+
+class ApplicableMethodFound1 {
+
+    <X> void m(X x) {}
+
+    { m(1); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/CannotCreateArrayWithDiamond.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cannot.create.array.with.diamond
+
+class CannotCreateArrayWithDiamond {
+    Object[] array = new Object<>[3];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/CantApplyDiamond1.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.prob.found.req.1
+// key: compiler.misc.cant.apply.diamond.1
+// key: compiler.misc.no.conforming.assignment.exists
+// key: compiler.misc.diamond
+
+class CantApplyDiamond1<X> {
+
+    CantApplyDiamond1(CantApplyDiamond1<? super X> lz) { }
+
+    void test(CantApplyDiamond1<Integer> li) {
+       CantApplyDiamond1<String> ls = new CantApplyDiamond1<>(li);
+    }
+}
--- a/test/tools/javac/diags/examples/CatchWithoutTry.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/CatchWithoutTry.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
 
 // key: compiler.err.catch.without.try
 // key: compiler.err.expected
-// key: compiler.err.not.stmt
 
 class CatchWithoutTry {
     void m() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/DeferredMethodInst.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.applicable.method.found.1
+// key: compiler.note.verbose.resolve.multi
+// key: compiler.note.deferred.method.inst
+// key: compiler.misc.partial.inst.sig
+// options: -XDverboseResolution=applicable,success,deferred-inference
+
+class DeferredMethodInst {
+
+    <X> X m() { return null; }
+
+    { Integer i = m(); }
+}
--- a/test/tools/javac/diags/examples/EmptyCharLiteral.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/EmptyCharLiteral.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
 
 // key: compiler.err.empty.char.lit
 // key: compiler.err.unclosed.char.lit
-// key: compiler.err.expected
 // key: compiler.err.premature.eof
 
 class X {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/ForeachBadInitialization.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.bad.initializer
+import java.util.List;
+class ForeachBadInitialization {
+    void m() {
+        List<String> s = null;
+        for (a : s) {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/FullInstSig.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.applicable.method.found.1
+// key: compiler.note.verbose.resolve.multi
+// key: compiler.misc.full.inst.sig
+// options: -XDverboseResolution=applicable,success
+
+class FullInstSig {
+
+    <X> void m(X x) {}
+
+    { m(1); }
+}
--- a/test/tools/javac/diags/examples/IllegalChar.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/IllegalChar.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,5 +24,5 @@
 // key: compiler.err.illegal.char
 
 class IllegalChar {
-    int i = #;
+    int i = `;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IllegalDot.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.dot
+// key: compiler.err.expected
+// key: compiler.err.illegal.start.of.type
+
+class X {
+    void m(Object.. args) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IllegalStartOfStmt.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.start.of.stmt
+// key: compiler.err.expected3
+
+class IllegalStartOfStmt {
+    void m() {
+        if (true) }
+    }
+}
--- a/test/tools/javac/diags/examples/IncompatibleTypes1.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/IncompatibleTypes1.java	Tue May 29 00:27:58 2012 +0100
@@ -21,14 +21,13 @@
  * questions.
  */
 
-// key: compiler.misc.incompatible.types.1
 // key: compiler.misc.infer.no.conforming.instance.exists
-// key: compiler.err.prob.found.req
+// key: compiler.err.prob.found.req.1
 
 class IncompatibleTypes1<V> {
-    <T extends Integer & Runnable> IncompatibleTypes1<T> m() {
+    <T> IncompatibleTypes1<Integer> m() {
         return null;
     }
 
-    IncompatibleTypes1<? super String> o = m();
+    IncompatibleTypes1<? extends String> o = m();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IncompatibleUpperBounds.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//key: compiler.err.cant.apply.symbols
+//key: compiler.misc.inapplicable.method
+//key: compiler.misc.arg.length.mismatch
+//key: compiler.misc.incompatible.upper.bounds
+
+import java.util.List;
+
+class IncompatibleUpperBounds {
+    <S> void m(List<? super S> s1, List<? super S> s2) { }
+    void m(Object o) {}
+
+    void test(List<Integer> li, List<String> ls) {
+        m(li, ls);
+    }
+}
--- a/test/tools/javac/diags/examples/InconvertibleTypes.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/InconvertibleTypes.java	Tue May 29 00:27:58 2012 +0100
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.misc.inconvertible.types
-// key: compiler.err.prob.found.req
+// key: compiler.err.prob.found.req.1
 
 class InconvertibleTypes {
     class Outer<S> {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/InferNoConformingAssignment.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.infer.no.conforming.assignment.exists
+
+import java.util.*;
+
+class InferNoConformingAssignment {
+    <X extends Number> List<X> m(String s) { return null; }
+    { this.m(1); }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/InferVarargsArgumentMismatch.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.infer.varargs.argument.mismatch
+
+class InferVarargsArgumentMismatch {
+    <X> void m(X x1, String... xs) {}
+    { this.m("", 1); }
+}
--- a/test/tools/javac/diags/examples/InferredDoNotConformToBounds.java	Mon Jul 11 22:31:52 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.misc.inferred.do.not.conform.to.bounds
-// key: compiler.err.cant.apply.diamond.1
-// key: compiler.misc.diamond
-
-class InferredDoNotConformToBounds {
-   static class SuperFoo<X> {}
-   static class Foo<X extends Number> extends SuperFoo<X> {
-       Foo(X x) {}
-   }
-
-   SuperFoo<String> sf1 = new Foo<>("");
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/InferredDoNotConformToEq.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.inferred.do.not.conform.to.eq.bounds
+
+import java.util.*;
+
+class InferredDoNotConformToEq {
+    <X> void m(List<X> lx1, List<X> lx2) {}
+    { this.m(Arrays.asList(""), Arrays.asList(1)); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/InferredDoNotConformToLower.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.invalid.inferred.types
+// key: compiler.err.prob.found.req.1
+// key: compiler.misc.inferred.do.not.conform.to.lower.bounds
+
+import java.util.*;
+
+class InferredDoNotConformToLower {
+    <X extends Number> List<X> m() { return null; }
+    { List<? super String> lss = this.m(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/InferredDoNotConformToUpper.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+
+import java.util.*;
+
+class InferredDoNotConformToUpper {
+    <X> void m(X x, List<? super X> lx) {}
+    { this.m("", Arrays.asList(1)); }
+}
--- a/test/tools/javac/diags/examples/InvalidInferredTypes.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/InvalidInferredTypes.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,18 +21,17 @@
  * questions.
  */
 
-// key: compiler.err.invalid.inferred.types
-// key: compiler.misc.inferred.do.not.conform.to.bounds
+// key: compiler.err.prob.found.req.1
+// key: compiler.misc.invalid.inferred.types
+// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
 
 import java.util.*;
 
 class InvalidInferredTypes {
 
-    <T extends List<? super T>> T makeList() {
-        return null;
-    }
+    <S extends String> List<S> m() { return null; }
 
-    public void test() {
-        List<? super String> l = makeList();
+    void test() {
+        List<Integer> li = m();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/KindnameInstanceInit.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.already.defined.in.clinit
+// key: compiler.misc.kindname.instance.init
+// key: compiler.misc.kindname.class
+// key: compiler.misc.kindname.variable
+// key: compiler.misc.count.error
+// key: compiler.err.error
+// run: backdoor
+
+class KindnameInstanceInit {
+    {
+        int i;
+        int i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/KindnameStaticInit.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.already.defined.in.clinit
+// key: compiler.misc.kindname.static.init
+// key: compiler.misc.kindname.class
+// key: compiler.misc.kindname.variable
+// key: compiler.misc.count.error
+// key: compiler.err.error
+// run: backdoor
+
+class KindnameStaticInit {
+    static {
+        int i;
+        int i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/LambdaNotSupported.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.lambda.not.supported.in.source
+// options: -source 7 -Xlint:-options
+
+class LambdaNotSupported {
+    S s = ()->{};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/MethodReferencesNotSupported.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.method.references.not.supported.in.source
+// options: -source 7 -Xlint:-options
+
+class MethodReferencesNotSupported {
+    S s = A#foo;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotAStatement.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.stmt
+
+class NotAStatement {
+    void m() {
+        x + 1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotAllowedClass.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.class.not.allowed
+
+class NotAllowedClass {
+    void t1() {
+        if (true)
+            class X {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotAllowedVariable.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.variable.not.allowed
+
+class NotAllowedVariable {
+    void t1() {
+        if (true)
+            int x = 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotApplicableMethodFound.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.not.applicable.method.found
+// key: compiler.note.verbose.resolve.multi.1
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.no.conforming.assignment.exists
+// options: -XDverboseResolution=inapplicable,failure
+
+class NotApplicableMethodFound {
+
+    void m(int i) {}
+
+    { m(""); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/PartialInstSig.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.applicable.method.found.1
+// key: compiler.note.verbose.resolve.multi
+// key: compiler.misc.partial.inst.sig
+// options: -XDverboseResolution=applicable,success
+
+class PartialInstSig {
+
+    <X> X m() { return null; }
+
+    { m(); }
+}
--- a/test/tools/javac/diags/examples/PossibleLossPrecision.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/PossibleLossPrecision.java	Tue May 29 00:27:58 2012 +0100
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.misc.possible.loss.of.precision
-// key: compiler.err.prob.found.req
+// key: compiler.err.prob.found.req.1
 
 class PossibleLossPrecision {
     long l;
--- a/test/tools/javac/diags/examples/ResourceNotApplicableToType.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/ResourceNotApplicableToType.java	Tue May 29 00:27:58 2012 +0100
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.misc.try.not.applicable.to.type
-// key: compiler.err.prob.found.req
+// key: compiler.err.prob.found.req.1
 
 class ResourceNotApplicableToType {
     void m() {
--- a/test/tools/javac/diags/examples/UndeterminedType1.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/UndeterminedType1.java	Tue May 29 00:27:58 2012 +0100
@@ -21,7 +21,8 @@
  * questions.
  */
 
-// key: compiler.err.undetermined.type.1
+// key: compiler.err.prob.found.req.1
+// key: compiler.misc.undetermined.type
 // key: compiler.misc.no.unique.maximal.instance.exists
 
 class UndeterminedType1<V> {
--- a/test/tools/javac/diags/examples/UnsupportedEncoding.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/UnsupportedEncoding.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,5 +23,6 @@
 
 // key: compiler.err.unsupported.encoding
 // options: -encoding UNSUPPORTED -doe
+// run: simple
 
 class UnsupportedEncoding { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/VerboseResolveMulti.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.applicable.method.found
+// key: compiler.note.verbose.resolve.multi
+// options: -XDverboseResolution=applicable,success
+
+class VerboseResolveMulti {
+
+    void m() {}
+
+    { m(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/VerboseResolveMulti1.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.not.applicable.method.found
+// key: compiler.note.verbose.resolve.multi.1
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.no.conforming.assignment.exists
+// options: -XDverboseResolution=inapplicable,failure
+
+class VerboseResolveMulti1 {
+
+    void m(int i) {}
+
+    { m(""); }
+}
--- a/test/tools/javac/diags/examples/WhereCaptured.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/WhereCaptured.java	Tue May 29 00:27:58 2012 +0100
@@ -26,7 +26,7 @@
 // key: compiler.misc.where.description.typevar
 // key: compiler.misc.where.typevar
 // key: compiler.err.cant.apply.symbol.1
-// key: compiler.misc.infer.no.conforming.assignment.exists
+// key: compiler.misc.inferred.do.not.conform.to.eq.bounds
 // key: compiler.misc.captured.type
 // options: -XDdiags=where,simpleNames
 // run: simple
--- a/test/tools/javac/diags/examples/WhereCaptured1.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/WhereCaptured1.java	Tue May 29 00:27:58 2012 +0100
@@ -26,7 +26,7 @@
 // key: compiler.misc.where.description.typevar
 // key: compiler.misc.where.typevar
 // key: compiler.err.cant.apply.symbol.1
-// key: compiler.misc.infer.no.conforming.assignment.exists
+// key: compiler.misc.inferred.do.not.conform.to.eq.bounds
 // key: compiler.misc.captured.type
 // key: compiler.misc.type.null
 // options: -XDdiags=where,simpleNames
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/WhereFreshTvar.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.where.fresh.typevar
+// key: compiler.misc.where.description.typevar.1
+// key: compiler.misc.where.typevar
+// key: compiler.misc.invalid.inferred.types
+// key: compiler.err.prob.found.req.1
+// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+// options: -XDdiags=where,simpleNames
+// run: simple
+
+import java.util.*;
+
+class WhereFreshTvar {
+    <T extends List<T>> T m() {}
+
+    { List<String> ls = m(); }
+}
--- a/test/tools/javac/diags/examples/WhereIntersection.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/diags/examples/WhereIntersection.java	Tue May 29 00:27:58 2012 +0100
@@ -24,7 +24,6 @@
 // key: compiler.misc.where.intersection
 // key: compiler.misc.where.description.intersection
 // key: compiler.misc.intersection.type
-// key: compiler.misc.incompatible.types
 // key: compiler.err.prob.found.req
 // options: -XDdiags=where
 // run: simple
--- a/test/tools/javac/enum/6350057/T6350057.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/enum/6350057/T6350057.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug 6350057
+ * @bug 6350057 7025809
  * @summary Test that parameters on implicit enum methods have the right kind
  * @author  Joseph D. Darcy
- * @compile T6350057.java
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor T6350057
  * @compile -processor T6350057 -proc:only TestEnum.java
  */
 
@@ -38,9 +39,8 @@
 import javax.lang.model.util.*;
 import static javax.tools.Diagnostic.Kind.*;
 
-@SupportedAnnotationTypes("*")
-public class T6350057 extends AbstractProcessor {
-    static class LocalVarAllergy extends ElementKindVisitor6<Boolean, Void> {
+public class T6350057 extends JavacTestingAbstractProcessor {
+    static class LocalVarAllergy extends ElementKindVisitor<Boolean, Void> {
         @Override
         public Boolean visitTypeAsEnum(TypeElement e, Void v) {
             System.out.println("visitTypeAsEnum: " + e.getSimpleName().toString());
--- a/test/tools/javac/enum/6424358/T6424358.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/enum/6424358/T6424358.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug     6424358
+ * @bug     6424358 7025809
  * @summary Synthesized static enum method values() is final
  * @author  Peter von der Ah\u00e9
- * @compile T6424358.java
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor T6424358
  * @compile -processor T6424358 -proc:only T6424358.java
  */
 
@@ -39,8 +40,7 @@
 
 @interface TestMe {}
 
-@SupportedAnnotationTypes("*")
-public class T6424358 extends AbstractProcessor {
+public class T6424358 extends JavacTestingAbstractProcessor {
     @TestMe enum Test { FOO; }
 
     public boolean process(Set<? extends TypeElement> annotations,
@@ -48,7 +48,7 @@
         final Messager log = processingEnv.getMessager();
         final Elements elements = processingEnv.getElementUtils();
         final TypeElement testMe = elements.getTypeElement("TestMe");
-        class Scan extends ElementScanner7<Void,Void> {
+        class Scan extends ElementScanner<Void,Void> {
             @Override
             public Void visitExecutable(ExecutableElement e, Void p) {
                 System.err.println("Looking at " + e);
@@ -65,9 +65,4 @@
             scan.scan(e);
         return true;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/test/tools/javac/failover/CheckAttributedTree.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/failover/CheckAttributedTree.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,12 +55,8 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileObject;
@@ -72,8 +68,8 @@
 import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.tree.JCTree.JCImport;
 import com.sun.tools.javac.tree.TreeInfo;
@@ -85,6 +81,8 @@
 import java.util.Set;
 import javax.lang.model.element.Element;
 
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+
 /**
  * Utility and test program to check validity of tree positions for tree nodes.
  * The program can be run standalone, or as a jtreg test.  In standalone mode,
@@ -289,7 +287,7 @@
             for (CompilationUnitTree t : trees) {
                JCCompilationUnit cu = (JCCompilationUnit)t;
                for (JCTree def : cu.defs) {
-                   if (def.getTag() == JCTree.CLASSDEF &&
+                   if (def.hasTag(CLASSDEF) &&
                            analyzedElems.contains(((JCTree.JCClassDecl)def).sym)) {
                        //System.out.println("Adding pair...");
                        res.add(new Pair<>(cu, def));
@@ -373,9 +371,9 @@
 
         private boolean mandatoryType(JCTree that) {
             return that instanceof JCTree.JCExpression ||
-                    that.getTag() == JCTree.VARDEF ||
-                    that.getTag() == JCTree.METHODDEF ||
-                    that.getTag() == JCTree.CLASSDEF;
+                    that.hasTag(VARDEF) ||
+                    that.hasTag(METHODDEF) ||
+                    that.hasTag(CLASSDEF);
         }
 
         private final List<String> excludedFields = Arrays.asList("varargsElement");
@@ -419,7 +417,7 @@
         }
 
         JavaFileObject sourcefile;
-        Map<JCTree, Integer> endPosTable;
+        EndPosTable endPosTable;
         Info encl;
     }
 
@@ -429,13 +427,13 @@
     private class Info {
         Info() {
             tree = null;
-            tag = JCTree.ERRONEOUS;
+            tag = ERRONEOUS;
             start = 0;
             pos = 0;
             end = Integer.MAX_VALUE;
         }
 
-        Info(JCTree tree, Map<JCTree, Integer> endPosTable) {
+        Info(JCTree tree, EndPosTable endPosTable) {
             this.tree = tree;
             tag = tree.getTag();
             start = TreeInfo.getStartPos(tree);
@@ -449,7 +447,7 @@
         }
 
         final JCTree tree;
-        final int tag;
+        final JCTree.Tag tag;
         final int start;
         final int pos;
         final int end;
@@ -457,27 +455,10 @@
 
     /**
      * Names for tree tags.
-     * javac does not provide an API to convert tag values to strings, so this class uses
-     * reflection to determine names of public static final int values in JCTree.
      */
     private static class TreeUtil {
-        String nameFromTag(int tag) {
-            if (names == null) {
-                names = new HashMap<Integer, String>();
-                Class c = JCTree.class;
-                for (Field f : c.getDeclaredFields()) {
-                    if (f.getType().equals(int.class)) {
-                        int mods = f.getModifiers();
-                        if (Modifier.isPublic(mods) && Modifier.isStatic(mods) && Modifier.isFinal(mods)) {
-                            try {
-                                names.put(f.getInt(null), f.getName());
-                            } catch (IllegalAccessException e) {
-                            }
-                        }
-                    }
-                }
-            }
-            String name = names.get(tag);
+        String nameFromTag(JCTree.Tag tag) {
+            String name = tag.name();
             return (name == null) ? "??" : name;
         }
 
@@ -496,8 +477,6 @@
             }
             return buf;
         }
-
-        private Map<Integer, String> names;
     }
 
     /**
--- a/test/tools/javac/failover/FailOver15.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/failover/FailOver15.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,3 @@
 FailOver15.java:17:10: compiler.err.expected: ';'
 FailOver15.java:11:13: compiler.err.cant.resolve.location: kindname.class, UnknownClass, , , (compiler.misc.location: kindname.class, Test, null)
 2 errors
-
--- a/test/tools/javac/fatalErrors/NoJavaLang.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/fatalErrors/NoJavaLang.sh	Tue May 29 00:27:58 2012 +0100
@@ -48,7 +48,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     FS="/"
     ;;
   CYGWIN* )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/file/T7068437.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7068437
+ * @summary Filer.getResource(SOURCE_OUTPUT, ...) no longer works in JDK 7 w/o -s
+ */
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedOptions;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+public class T7068437 {
+    public static void main(String[] args) throws Exception {
+        new T7068437().run();
+    }
+
+    void run() throws Exception {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        System.err.println("using " + compiler.getClass()
+                + " from " + compiler.getClass().getProtectionDomain().getCodeSource());
+
+        CompilationTask task = compiler.getTask(null, null, null,
+                Collections.singleton("-proc:only"),
+                Collections.singleton("java.lang.Object"),
+                null);
+        task.setProcessors(Collections.singleton(new Proc()));
+        check("compilation", task.call());
+
+        task = compiler.getTask(null, null, null,
+                Arrays.asList("-proc:only", "-AexpectFile"),
+                Collections.singleton("java.lang.Object"),
+                null);
+        task.setProcessors(Collections.singleton(new Proc()));
+        check("compilation", task.call());
+    }
+
+    void check(String msg, boolean ok) {
+        System.err.println(msg + ": " + (ok ? "ok" : "failed"));
+        if (!ok)
+            throw new AssertionError(msg);
+    }
+
+    @SupportedAnnotationTypes("*")
+    @SupportedOptions("expectFile")
+    private static class Proc extends AbstractProcessor {
+        int count;
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (roundEnv.processingOver() || count++ > 0) {
+                return false;
+            }
+
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+            Map<String, String> options = processingEnv.getOptions();
+                System.err.println(options);
+            boolean expectFile = options.containsKey("expectFile");
+
+            System.err.println("running Proc: expectFile=" + expectFile);
+
+            boolean found;
+            try {
+                messager.printMessage(Kind.NOTE, "found previous content of length " +
+                        filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length());
+                found = true;
+            } catch (FileNotFoundException x) {
+                messager.printMessage(Kind.NOTE, "not previously there");
+                found = false;
+            } catch (IOException x) {
+                messager.printMessage(Kind.ERROR, "while reading: " + x);
+                found = false;
+            }
+
+            if (expectFile && !found) {
+                messager.printMessage(Kind.ERROR, "expected file but file not found");
+            }
+
+            try {
+                Writer w = filer.createSourceFile("p.C").openWriter();
+                w.write("/* hello! */ package p; class C {}");
+                w.close();
+                messager.printMessage(Kind.NOTE, "wrote new content");
+            } catch (IOException x) {
+                messager.printMessage(Kind.ERROR, "while writing: " + x);
+            }
+
+            return true;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/file/T7068451.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7068451
+ * @summary Regression: javac compiles fixed sources against previous,
+ *              not current, version of generated sources
+ */
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+public class T7068451 {
+    public static void main(String[] args) throws Exception {
+        new T7068451().run();
+    }
+
+    void run() throws Exception {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource());
+
+        File tmp = new File("tmp");
+        tmp.mkdir();
+        for (File f: tmp.listFiles())
+            f.delete();
+
+        File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }");
+
+        List<String> opts = Arrays.asList(
+                "-s", tmp.getPath(),
+                "-d", tmp.getPath(),
+                "-XprintRounds");
+
+        System.err.println();
+        System.err.println("FIRST compilation");
+        System.err.println();
+
+        CompilationTask task = compiler.getTask(null, null, null, opts, null,
+                compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
+        task.setProcessors(Collections.singleton(new Proc("first")));
+        check("compilation", task.call());
+
+        writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }");
+
+        //Thread.sleep(2000);
+
+        System.err.println();
+        System.err.println("SECOND compilation");
+        System.err.println();
+
+        task = compiler.getTask(null, null, null, opts, null,
+                compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
+        task.setProcessors(Collections.singleton(new Proc("second")));
+        check("compilation", task.call());
+
+        //Thread.sleep(2000);
+
+        System.err.println();
+        System.err.println("SECOND compilation, REPEATED");
+        System.err.println();
+
+        task = compiler.getTask(null, null, null, opts, null,
+                compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
+        task.setProcessors(Collections.singleton(new Proc("second")));
+        check("compilation", task.call());
+    }
+
+    void check(String msg, boolean ok) {
+        System.err.println(msg + ": " + (ok ? "ok" : "failed"));
+        if (!ok)
+            throw new AssertionError(msg);
+    }
+
+    static File writeFile(File base, String path, String body) throws IOException {
+        File f = new File(base, path);
+        FileWriter out = new FileWriter(f);
+        out.write(body);
+        out.close();
+        System.err.println("wrote " + path + ": " + body);
+        return f;
+    }
+
+    @SupportedAnnotationTypes("*")
+    private static class Proc extends AbstractProcessor {
+        final String m;
+        Proc(String m) {
+            this.m = m;
+        }
+
+        int count;
+        @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (roundEnv.processingOver() || count++ > 0) {
+                return false;
+            }
+
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+
+            System.err.println("running Proc");
+            try {
+                int len = filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length();
+                messager.printMessage(Kind.NOTE, "C.java: found previous content of length " + len);
+            } catch (FileNotFoundException x) {
+                messager.printMessage(Kind.NOTE, "C.java: not previously there");
+            } catch (IOException x) {
+                messager.printMessage(Kind.ERROR, "while reading: " + x);
+            }
+
+            try {
+                String body = "package p; public class C { public static void " + m + "() {} }";
+                Writer w = filer.createSourceFile("p.C").openWriter();
+                w.write(body);
+                w.close();
+                messager.printMessage(Kind.NOTE, "C.java: wrote new content: " + body);
+            } catch (IOException x) {
+                messager.printMessage(Kind.ERROR, "while writing: " + x);
+            }
+
+            return true;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+    }
+}
+
--- a/test/tools/javac/generics/6207386/T6207386.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/6207386/T6207386.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6207386.java:13:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), X, T6207386.F<? super X>
+T6207386.java:13:30: compiler.err.prob.found.req: X, T6207386.F<? super X>
 1 error
--- a/test/tools/javac/generics/6723444/T6723444.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/6723444/T6723444.out	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
-T6723444.java:42:9: compiler.err.unreported.exception.need.to.catch.or.throw: X2
-T6723444.java:43:9: compiler.err.unreported.exception.need.to.catch.or.throw: X2
+T6723444.java:42:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
+T6723444.java:43:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
 T6723444.java:45:32: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
 T6723444.java:46:17: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
 T6723444.java:48:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
--- a/test/tools/javac/generics/6910550/T6910550d.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/6910550/T6910550d.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6910550d.java:12:14: compiler.err.already.defined: <X>m(X), T6910550d
+T6910550d.java:12:14: compiler.err.already.defined: kindname.method, <X>m(X), kindname.class, T6910550d
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/7151070/T7151070.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,25 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7151070
+ * @summary NullPointerException in Resolve.isAccessible
+ * @compile/fail/ref=T7151070.out -XDrawDiagnostics T7151070.java
+ */
+
+class T7151070a {
+    private static class PrivateCls { }
+    public static class PublicCls extends PrivateCls { }
+
+    public void m(PrivateCls p) { }
+}
+
+class T7151070b {
+    public void test(Test<T7151070a.PublicCls> obj, T7151070a outer) {
+        outer.m(obj.get());
+    }
+
+    public static class Test<T> {
+        public T get() {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/7151070/T7151070.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,2 @@
+T7151070.java:17:24: compiler.err.report.access: T7151070a.PrivateCls, private, T7151070a
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/7151802/T7151802.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,43 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7151802
+ * @summary compiler update caused sqe test failed
+ * @compile/fail/ref=T7151802.out -Werror -Xlint:unchecked -XDrawDiagnostics T7151802.java
+ */
+class T7151802 {
+    static class Foo<X> { }
+
+    static class SubFoo<X> extends Foo<X> { }
+
+    //generic - bound - arg - non-slilent
+    <Z extends Foo<String>> void get1(Z fz) { }
+    void test1(Foo foo) { get1(foo); }
+
+    //generic - bound - arg - silent
+    <Z extends Foo<?>> void get2(Z fz) { }
+    void test2(Foo foo) { get2(foo); }
+
+    //generic - nobound - arg - non-slilent
+    <Z> void get3(Foo<Z> fz) { }
+    void test(Foo foo) { get3(foo); }
+
+    //generic - nobound - arg - slilent
+    <Z> void get4(Foo<?> fz) { }
+    void test4(Foo foo) { get4(foo); }
+
+    //generic - bound - ret - non-slilent
+    <Z extends Foo<String>> Z get5() { return null; }
+    void test5() { SubFoo sf = get5(); }
+
+    //generic - bound - ret - slilent
+    static <Z extends Foo<?>> Z get6() { return null; }
+    void test6() { SubFoo sf = get6(); }
+
+    //nogeneric - nobound - arg - non-slilent
+    void get7(Foo<String> fz) { }
+    void test7(Foo foo) { get7(foo); }
+
+    //nogeneric - nobound - arg - slilent
+    static void get8(Foo<?> fz) { }
+    void test8(Foo foo) { get8(foo); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/7151802/T7151802.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,9 @@
+T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
+T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<Z>
+T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
+T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
+T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>
+T7151802.java:38:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get7, T7151802.Foo<java.lang.String>, T7151802.Foo, kindname.class, T7151802
+- compiler.err.warnings.and.werror
+1 error
+6 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7046778/DiamondAndInnerClassTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7046778
+ * @summary Project Coin: problem with diamond and member inner classes
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class DiamondAndInnerClassTest {
+
+    static int checkCount = 0;
+
+    enum TypeArgumentKind {
+        NONE(""),
+        STRING("<String>"),
+        INTEGER("<Integer>"),
+        DIAMOND("<>");
+
+        String typeargStr;
+
+        private TypeArgumentKind(String typeargStr) {
+            this.typeargStr = typeargStr;
+        }
+
+        boolean compatible(TypeArgumentKind that) {
+            switch (this) {
+                case NONE: return true;
+                case STRING: return that != INTEGER;
+                case INTEGER: return that != STRING;
+                default: throw new AssertionError("Unexpected decl kind: " + this);
+            }
+        }
+
+        boolean compatible(ArgumentKind that) {
+            switch (this) {
+                case NONE: return true;
+                case STRING: return that == ArgumentKind.STRING;
+                case INTEGER: return that == ArgumentKind.INTEGER;
+                default: throw new AssertionError("Unexpected decl kind: " + this);
+            }
+        }
+    }
+
+    enum ArgumentKind {
+        OBJECT("(Object)null"),
+        STRING("(String)null"),
+        INTEGER("(Integer)null");
+
+        String argStr;
+
+        private ArgumentKind(String argStr) {
+            this.argStr = argStr;
+        }
+    }
+
+    enum TypeQualifierArity {
+        ONE(1, "A1#TA1"),
+        TWO(2, "A1#TA1.A2#TA2"),
+        THREE(3, "A1#TA1.A2#TA2.A3#TA3");
+
+        int n;
+        String qualifierStr;
+
+        private TypeQualifierArity(int n, String qualifierStr) {
+            this.n = n;
+            this.qualifierStr = qualifierStr;
+        }
+
+        String getType(TypeArgumentKind... typeArgumentKinds) {
+            String res = qualifierStr;
+            for (int i = 1 ; i <= typeArgumentKinds.length ; i++) {
+                res = res.replace("#TA" + i, typeArgumentKinds[i-1].typeargStr);
+            }
+            return res;
+        }
+
+        boolean matches(InnerClassDeclArity innerClassDeclArity) {
+            return n ==innerClassDeclArity.n;
+        }
+    }
+
+    enum InnerClassDeclArity {
+        ONE(1, "class A1<X> { A1(X x1) { } #B }"),
+        TWO(2, "class A1<X1> { class A2<X2> { A2(X1 x1, X2 x2) { }  #B } }"),
+        THREE(3, "class A1<X1> { class A2<X2> { class A3<X3> { A3(X1 x1, X2 x2, X3 x3) { } #B } } }");
+
+        int n;
+        String classDeclStr;
+
+        private InnerClassDeclArity(int n, String classDeclStr) {
+            this.n = n;
+            this.classDeclStr = classDeclStr;
+        }
+    }
+
+    enum ArgumentListArity {
+        ONE(1, "(#A1)"),
+        TWO(2, "(#A1,#A2)"),
+        THREE(3, "(#A1,#A2,#A3)");
+
+        int n;
+        String argListStr;
+
+        private ArgumentListArity(int n, String argListStr) {
+            this.n = n;
+            this.argListStr = argListStr;
+        }
+
+        String getArgs(ArgumentKind... argumentKinds) {
+            String res = argListStr;
+            for (int i = 1 ; i <= argumentKinds.length ; i++) {
+                res = res.replace("#A" + i, argumentKinds[i-1].argStr);
+            }
+            return res;
+        }
+
+        boolean matches(InnerClassDeclArity innerClassDeclArity) {
+            return n ==innerClassDeclArity.n;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (InnerClassDeclArity innerClassDeclArity : InnerClassDeclArity.values()) {
+            for (TypeQualifierArity declType : TypeQualifierArity.values()) {
+                if (!declType.matches(innerClassDeclArity)) continue;
+                for (TypeQualifierArity newClassType : TypeQualifierArity.values()) {
+                    if (!newClassType.matches(innerClassDeclArity)) continue;
+                    for (ArgumentListArity argList : ArgumentListArity.values()) {
+                        if (!argList.matches(innerClassDeclArity)) continue;
+                        for (TypeArgumentKind taDecl1 : TypeArgumentKind.values()) {
+                            boolean isDeclRaw = taDecl1 == TypeArgumentKind.NONE;
+                            //no diamond on decl site
+                            if (taDecl1 == TypeArgumentKind.DIAMOND) continue;
+                            for (TypeArgumentKind taSite1 : TypeArgumentKind.values()) {
+                                boolean isSiteRaw = taSite1 == TypeArgumentKind.NONE;
+                                //diamond only allowed on the last type qualifier
+                                if (taSite1 == TypeArgumentKind.DIAMOND &&
+                                        innerClassDeclArity != InnerClassDeclArity.ONE) continue;
+                                for (ArgumentKind arg1 : ArgumentKind.values()) {
+                                    if (innerClassDeclArity == innerClassDeclArity.ONE) {
+                                        new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
+                                                argList, new TypeArgumentKind[] {taDecl1},
+                                                new TypeArgumentKind[] {taSite1}, new ArgumentKind[] {arg1}).run(comp, fm);
+                                        continue;
+                                    }
+                                    for (TypeArgumentKind taDecl2 : TypeArgumentKind.values()) {
+                                        //no rare types
+                                        if (isDeclRaw != (taDecl2 == TypeArgumentKind.NONE)) continue;
+                                        //no diamond on decl site
+                                        if (taDecl2 == TypeArgumentKind.DIAMOND) continue;
+                                        for (TypeArgumentKind taSite2 : TypeArgumentKind.values()) {
+                                            //no rare types
+                                            if (isSiteRaw != (taSite2 == TypeArgumentKind.NONE)) continue;
+                                            //diamond only allowed on the last type qualifier
+                                            if (taSite2 == TypeArgumentKind.DIAMOND &&
+                                                    innerClassDeclArity != InnerClassDeclArity.TWO) continue;
+                                            for (ArgumentKind arg2 : ArgumentKind.values()) {
+                                                if (innerClassDeclArity == innerClassDeclArity.TWO) {
+                                                    new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
+                                                            argList, new TypeArgumentKind[] {taDecl1, taDecl2},
+                                                            new TypeArgumentKind[] {taSite1, taSite2},
+                                                            new ArgumentKind[] {arg1, arg2}).run(comp, fm);
+                                                    continue;
+                                                }
+                                                for (TypeArgumentKind taDecl3 : TypeArgumentKind.values()) {
+                                                    //no rare types
+                                                    if (isDeclRaw != (taDecl3 == TypeArgumentKind.NONE)) continue;
+                                                    //no diamond on decl site
+                                                    if (taDecl3 == TypeArgumentKind.DIAMOND) continue;
+                                                    for (TypeArgumentKind taSite3 : TypeArgumentKind.values()) {
+                                                        //no rare types
+                                                        if (isSiteRaw != (taSite3 == TypeArgumentKind.NONE)) continue;
+                                                        //diamond only allowed on the last type qualifier
+                                                        if (taSite3 == TypeArgumentKind.DIAMOND &&
+                                                                innerClassDeclArity != InnerClassDeclArity.THREE) continue;
+                                                        for (ArgumentKind arg3 : ArgumentKind.values()) {
+                                                            if (innerClassDeclArity == innerClassDeclArity.THREE) {
+                                                                new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
+                                                                        argList, new TypeArgumentKind[] {taDecl1, taDecl2, taDecl3},
+                                                                        new TypeArgumentKind[] {taSite1, taSite2, taSite3},
+                                                                        new ArgumentKind[] {arg1, arg2, arg3}).run(comp, fm);
+                                                                continue;
+                                                            }
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    InnerClassDeclArity innerClassDeclArity;
+    TypeQualifierArity declType;
+    TypeQualifierArity siteType;
+    ArgumentListArity argList;
+    TypeArgumentKind[] declTypeArgumentKinds;
+    TypeArgumentKind[] siteTypeArgumentKinds;
+    ArgumentKind[] argumentKinds;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    DiamondAndInnerClassTest(InnerClassDeclArity innerClassDeclArity,
+            TypeQualifierArity declType, TypeQualifierArity siteType, ArgumentListArity argList,
+            TypeArgumentKind[] declTypeArgumentKinds, TypeArgumentKind[] siteTypeArgumentKinds,
+            ArgumentKind[] argumentKinds) {
+        this.innerClassDeclArity = innerClassDeclArity;
+        this.declType = declType;
+        this.siteType = siteType;
+        this.argList = argList;
+        this.declTypeArgumentKinds = declTypeArgumentKinds;
+        this.siteTypeArgumentKinds = siteTypeArgumentKinds;
+        this.argumentKinds = argumentKinds;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String bodyTemplate = "#D res = new #S#AL;";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = innerClassDeclArity.classDeclStr.replace("#B", bodyTemplate)
+                             .replace("#D", declType.getType(declTypeArgumentKinds))
+                             .replace("#S", siteType.getType(siteTypeArgumentKinds))
+                             .replace("#AL", argList.getArgs(argumentKinds));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        boolean errorExpected = false;
+
+        TypeArgumentKind[] expectedArgKinds = new TypeArgumentKind[innerClassDeclArity.n];
+
+        for (int i = 0 ; i < innerClassDeclArity.n ; i++) {
+            if (!declTypeArgumentKinds[i].compatible(siteTypeArgumentKinds[i])) {
+                errorExpected = true;
+                break;
+            }
+            expectedArgKinds[i] = siteTypeArgumentKinds[i] == TypeArgumentKind.DIAMOND ?
+                declTypeArgumentKinds[i] : siteTypeArgumentKinds[i];
+        }
+
+        if (!errorExpected) {
+            for (int i = 0 ; i < innerClassDeclArity.n ; i++) {
+                //System.out.println("check " + expectedArgKinds[i] + " against " + argumentKinds[i]);
+                if (!expectedArgKinds[i].compatible(argumentKinds[i])) {
+                    errorExpected = true;
+                    break;
+                }
+            }
+        }
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7057297/T7057297.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7057297
+ *
+ * @summary Project Coin: diamond erroneously accepts in array initializer expressions
+ * @compile/fail/ref=T7057297.out T7057297.java -XDrawDiagnostics
+ *
+ */
+
+class T7205797<X> {
+
+    class Inner<Y> {}
+
+    T7205797<String>[] o1 = new T7205797<>[1]; //error
+    T7205797<String>[] o2 = new T7205797<>[1][1]; //error
+    T7205797<String>[] o3 = new T7205797<>[1][1][1]; //error
+
+    T7205797<String>[] o4 = new T7205797<>[] { }; //error
+    T7205797<String>[] o5 = new T7205797<>[][] { }; //error
+    T7205797<String>[] o6 = new T7205797<>[][][] { }; //error
+
+    T7205797<String>.Inner<String>[] o1 = new T7205797<String>.Inner<>[1]; //error
+    T7205797<String>.Inner<String>[] o2 = new T7205797<String>.Inner<>[1][1]; //error
+    T7205797<String>.Inner<String>[] o3 = new T7205797<String>.Inner<>[1][1][1]; //error
+
+    T7205797<String>.Inner<String>[] o4 = new T7205797<String>.Inner<>[] { }; //error
+    T7205797<String>.Inner<String>[] o5 = new T7205797<String>.Inner<>[][] { }; //error
+    T7205797<String>.Inner<String>[] o6 = new T7205797<String>.Inner<>[][][] { }; //error
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7057297/T7057297.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,13 @@
+T7057297.java:14:41: compiler.err.cannot.create.array.with.diamond
+T7057297.java:15:41: compiler.err.cannot.create.array.with.diamond
+T7057297.java:16:41: compiler.err.cannot.create.array.with.diamond
+T7057297.java:18:41: compiler.err.cannot.create.array.with.diamond
+T7057297.java:19:41: compiler.err.cannot.create.array.with.diamond
+T7057297.java:20:41: compiler.err.cannot.create.array.with.diamond
+T7057297.java:22:69: compiler.err.cannot.create.array.with.diamond
+T7057297.java:23:69: compiler.err.cannot.create.array.with.diamond
+T7057297.java:24:69: compiler.err.cannot.create.array.with.diamond
+T7057297.java:26:69: compiler.err.cannot.create.array.with.diamond
+T7057297.java:27:69: compiler.err.cannot.create.array.with.diamond
+T7057297.java:28:69: compiler.err.cannot.create.array.with.diamond
+12 errors
--- a/test/tools/javac/generics/diamond/neg/Neg05.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg05.out	Tue May 29 00:27:58 2012 +0100
@@ -1,19 +1,19 @@
 Neg05.java:19:48: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:19:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
+Neg05.java:19:35: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
 Neg05.java:20:58: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:20:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
+Neg05.java:20:45: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
 Neg05.java:21:43: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:21:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
+Neg05.java:21:30: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
 Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:22:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
+Neg05.java:22:43: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
 Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:24:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
+Neg05.java:24:35: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
 Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:25:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
+Neg05.java:25:45: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
 Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:26:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
+Neg05.java:26:30: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
 Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:27:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
+Neg05.java:27:43: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
 Neg05.java:31:37: compiler.err.improperly.formed.type.inner.raw.param
 Neg05.java:32:47: compiler.err.improperly.formed.type.inner.raw.param
 Neg05.java:33:32: compiler.err.improperly.formed.type.inner.raw.param
--- a/test/tools/javac/generics/diamond/neg/Neg06.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg06.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-Neg06.java:16:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.infer.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
+Neg06.java:16:37: compiler.err.prob.found.req.1: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))
 1 error
--- a/test/tools/javac/generics/diamond/neg/Neg07.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg07.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-Neg07.java:17:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.String, java.lang.Number)
+Neg07.java:17:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number)
 1 error
--- a/test/tools/javac/generics/diamond/neg/Neg09.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg09.out	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
-Neg09.java:17:34: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member)
-Neg09.java:18:34: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested)
-Neg09.java:22:39: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member)
-Neg09.java:23:40: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested)
+Neg09.java:17:34: compiler.err.cant.apply.diamond.1: Neg09.Member<X>, (compiler.misc.diamond.and.anon.class: Neg09.Member<X>)
+Neg09.java:18:34: compiler.err.cant.apply.diamond.1: Neg09.Nested<X>, (compiler.misc.diamond.and.anon.class: Neg09.Nested<X>)
+Neg09.java:22:39: compiler.err.cant.apply.diamond.1: Neg09.Member<X>, (compiler.misc.diamond.and.anon.class: Neg09.Member<X>)
+Neg09.java:23:40: compiler.err.cant.apply.diamond.1: Neg09.Nested<X>, (compiler.misc.diamond.and.anon.class: Neg09.Nested<X>)
 4 errors
--- a/test/tools/javac/generics/diamond/neg/Neg10.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg10.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-Neg10.java:16:22: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg10.Foo<java.lang.Integer>, Neg10.Foo<java.lang.Number>
+Neg10.java:16:22: compiler.err.prob.found.req: Neg10.Foo<java.lang.Integer>, Neg10.Foo<java.lang.Number>
 1 error
--- a/test/tools/javac/generics/inference/6315770/T6315770.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/inference/6315770/T6315770.out	Tue May 29 00:27:58 2012 +0100
@@ -1,3 +1,3 @@
-T6315770.java:16:42: compiler.err.undetermined.type.1: <T>T6315770<T>, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
-T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String>
+T6315770.java:16:42: compiler.err.prob.found.req.1: (compiler.misc.undetermined.type: <T>T6315770<T>, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable))
+T6315770.java:17:40: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: T, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer&java.lang.Runnable, java.lang.String))
 2 errors
--- a/test/tools/javac/generics/inference/6611449/T6611449.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/inference/6611449/T6611449.out	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
-T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S))}
-T6611449.java:19:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.infer.arg.length.mismatch))}
-T6611449.java:20:9: compiler.err.cant.apply.symbol.1: kindname.method, m1, T, int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S)
-T6611449.java:21:9: compiler.err.cant.apply.symbol.1: kindname.method, m2, T,T, int,int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S)
+T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S))}
+T6611449.java:19:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.infer.arg.length.mismatch))}
+T6611449.java:20:9: compiler.err.cant.apply.symbol.1: kindname.method, m1, T, int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)
+T6611449.java:21:9: compiler.err.cant.apply.symbol.1: kindname.method, m2, T,T, int,int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)
 4 errors
--- a/test/tools/javac/generics/inference/6638712/T6638712a.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/inference/6638712/T6638712a.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6638712a.java:16:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
+T6638712a.java:16:33: compiler.err.cant.apply.symbol.1: kindname.method, compound, java.lang.Iterable<? extends java.util.Comparator<? super T>>, java.util.List<java.util.Comparator<?>>, kindname.class, T6638712a, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List<java.util.Comparator<?>>, java.lang.Iterable<? extends java.util.Comparator<? super T>>)
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712b.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/inference/6638712/T6638712b.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6638712b.java:14:21: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, T, java.lang.String)), <T>T, java.lang.String
+T6638712b.java:14:21: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: T, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.String,java.lang.Object))
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712d.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/inference/6638712/T6638712d.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6638712d.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.no.conforming.assignment.exists: int, java.lang.String)
+T6638712d.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.String, java.lang.Integer)
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712e.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/inference/6638712/T6638712e.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: X, T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>)), <X>T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>
+T6638712e.java:17:27: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: X, (compiler.misc.no.conforming.assignment.exists: T6638712e.Foo<java.lang.Boolean,java.lang.Boolean>, T6638712e.Foo<? super java.lang.Object,? extends java.lang.Boolean>))
 1 error
--- a/test/tools/javac/generics/inference/6650759/T6650759m.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/inference/6650759/T6650759m.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.util.List<? super java.lang.Integer>, java.util.List<? super java.lang.String>
+T6650759m.java:43:36: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: Z, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer, java.lang.String))
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086586/T7086586.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,19 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 7086586
+ * @summary Inference producing null type argument
+ * @compile/fail/ref=T7086586.out -XDrawDiagnostics T7086586.java
+ */
+import java.util.List;
+
+class T7086586 {
+
+    <T> List<T> m(List<? super T> dummy) { return null; }
+
+    void test(List<?> l) {
+        String s = m(l).get(0);
+        Number n = m(l).get(0);
+        Exception e = m(l).get(0);
+        m(l).nonExistentMethod();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086586/T7086586.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,5 @@
+T7086586.java:14:20: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)
+T7086586.java:15:20: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)
+T7086586.java:16:23: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)
+T7086586.java:17:9: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086586/T7086586b.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7086586
+ *
+ * @summary Inference producing null type argument
+ */
+import java.util.List;
+
+public class T7086586b {
+
+    int assertionCount = 0;
+
+    void assertTrue(boolean cond) {
+        if (!cond) {
+            throw new AssertionError();
+        }
+        assertionCount++;
+    }
+
+    <T> void m(List<? super T> dummy) { assertTrue(false); }
+    <T> void m(Object dummy) { assertTrue(true); }
+
+    void test(List<?> l) {
+        m(l);
+        assertTrue(assertionCount == 1);
+    }
+
+    public static void main(String[] args) {
+        new T7086586b().test(null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086601/T7086601a.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,34 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 7086601
+ * @summary Error message bug: cause for method mismatch is 'null'
+ * @compile/fail/ref=T7086601a.out -XDrawDiagnostics T7086601a.java
+ */
+
+class T7086601 {
+    static <S> void m1(Iterable<? super S> s1, Iterable<? super S> s2) { }
+    static void m1(Object o) {}
+
+    static <S> void m2(Iterable<? super S> s1, Iterable<? super S> s2, Iterable<? super S> s3) { }
+    static void m2(Object o) {}
+
+    @SafeVarargs
+    static <S> void m3(Iterable<? super S>... ss) { }
+    static void m3(Object o) {}
+
+    static void test1(Iterable<String> is, Iterable<Integer> ii) {
+        m1(is, ii);
+    }
+
+    static void test2(Iterable<String> is, Iterable<Integer> ii, Iterable<Double> id) {
+        m2(is, ii, id);
+    }
+
+    static void test3(Iterable<String> is, Iterable<Integer> ii) {
+        m3(is, ii);
+    }
+
+    static void test4(Iterable<String> is, Iterable<Integer> ii, Iterable<Double> id) {
+        m3(is, ii, id);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086601/T7086601a.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,5 @@
+T7086601a.java:20:9: compiler.err.cant.apply.symbols: kindname.method, m1, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m1(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m1(java.lang.Iterable<? super S>,java.lang.Iterable<? super S>), (compiler.misc.incompatible.upper.bounds: S, java.lang.Integer,java.lang.String,java.lang.Object))}
+T7086601a.java:24:9: compiler.err.cant.apply.symbols: kindname.method, m2, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,java.lang.Iterable<java.lang.Double>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m2(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m2(java.lang.Iterable<? super S>,java.lang.Iterable<? super S>,java.lang.Iterable<? super S>), (compiler.misc.incompatible.upper.bounds: S, java.lang.Double,java.lang.Integer,java.lang.String,java.lang.Object))}
+T7086601a.java:28:9: compiler.err.cant.apply.symbols: kindname.method, m3, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m3(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m3(java.lang.Iterable<? super S>...), (compiler.misc.incompatible.upper.bounds: S, java.lang.Integer,java.lang.String,java.lang.Object))}
+T7086601a.java:32:9: compiler.err.cant.apply.symbols: kindname.method, m3, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,java.lang.Iterable<java.lang.Double>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m3(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m3(java.lang.Iterable<? super S>...), (compiler.misc.incompatible.upper.bounds: S, java.lang.Double,java.lang.Integer,java.lang.String,java.lang.Object))}
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086601/T7086601b.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7086601
+ * @summary Error message bug: cause for method mismatch is 'null'
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.ArrayList;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class T7086601b {
+
+    static int checkCount = 0;
+
+    enum TypeKind {
+        STRING("String", false),
+        INTEGER("Integer", false),
+        NUMBER("Number", false),
+        SERIALIZABLE("java.io.Serializable", true),
+        CLONEABLE("Cloneable", true),
+        X("X", false),
+        Y("Y", false),
+        Z("Z", false);
+
+        String typeStr;
+        boolean isInterface;
+
+        private TypeKind(String typeStr, boolean isInterface) {
+            this.typeStr = typeStr;
+            this.isInterface = isInterface;
+        }
+
+        boolean isSubtypeof(TypeKind other) {
+            return (this == INTEGER && other == NUMBER ||
+                    this == Z && other == Y ||
+                    this == other);
+        }
+    }
+
+    enum MethodCallKind {
+        ARITY_ONE("m(a1);", 1),
+        ARITY_TWO("m(a1, a2);", 2),
+        ARITY_THREE("m(a1, a2, a3);", 3);
+
+        String invokeString;
+        int arity;
+
+        private MethodCallKind(String invokeString, int arity) {
+            this.invokeString = invokeString;
+            this.arity = arity;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (TypeKind a1 : TypeKind.values()) {
+            for (TypeKind a2 : TypeKind.values()) {
+                for (TypeKind a3 : TypeKind.values()) {
+                    for (MethodCallKind mck : MethodCallKind.values()) {
+                        new T7086601b(a1, a2, a3, mck).run(comp, fm);
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    TypeKind a1;
+    TypeKind a2;
+    TypeKind a3;
+    MethodCallKind mck;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    T7086601b(TypeKind a1, TypeKind a2, TypeKind a3, MethodCallKind mck) {
+        this.a1 = a1;
+        this.a2 = a2;
+        this.a3 = a3;
+        this.mck = mck;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        final String bodyTemplate = "import java.util.List;\n"+
+                              "class Test {\n" +
+                              "   <Z> void m(List<? super Z> l1) { }\n" +
+                              "   <Z> void m(List<? super Z> l1, List<? super Z> l2) { }\n" +
+                              "   <Z> void m(List<? super Z> l1, List<? super Z> l2, List<? super Z> l3) { }\n" +
+                              "   <X,Y,Z extends Y> void test(List<#A1> a1, List<#A2> a2, List<#A3> a3) { #MC } }";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = bodyTemplate.replace("#A1", a1.typeStr)
+                             .replace("#A2", a2.typeStr).replace("#A3", a3.typeStr)
+                             .replace("#MC", mck.invokeString);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        boolean errorExpected = false;
+
+        if (mck.arity > 1) {
+            TypeKind[] argtypes = { a1, a2, a3 };
+            ArrayList<TypeKind> classes = new ArrayList<>();
+            for (int i = 0 ; i < mck.arity ; i ++ ) {
+                if (!argtypes[i].isInterface) {
+                    classes.add(argtypes[i]);
+                }
+            }
+            boolean glb_exists = true;
+            for (TypeKind arg_i : classes) {
+                glb_exists = true;
+                for (TypeKind arg_j : classes) {
+                    if (!arg_i.isSubtypeof(arg_j)) {
+                        glb_exists = false;
+                        break;
+                    }
+                }
+                if (glb_exists) break;
+            }
+            errorExpected = !glb_exists;
+        }
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7154127/T7154127.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,21 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 7154127
+ * @summary Inference cleanup: remove bound check analysis from visitors in Types.java
+ * @compile/fail/ref=T7154127.out -XDrawDiagnostics T7154127.java
+ */
+class T7154127 {
+
+    static class B<V> {}
+
+    static class D extends B<E> {}
+    static class E extends B<D> {}
+
+    static class Triple<U,V,W> { }
+
+    static <T, Y extends B<U>, U extends B<Y>> Triple<T, Y, U> m() { return null; }
+
+    void test() {
+       Triple<B, ? extends D, ? extends E> t = m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7154127/T7154127.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,2 @@
+T7154127.java:19:49: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: T,Y,U, (compiler.misc.inferred.do.not.conform.to.upper.bounds: Y, T7154127.D,T7154127.B<U>))
+1 error
--- a/test/tools/javac/generics/rare/6665356/T6665356.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/rare/6665356/T6665356.out	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 T6665356.java:17:37: compiler.err.improperly.formed.type.param.missing
 T6665356.java:18:40: compiler.err.improperly.formed.type.inner.raw.param
-T6665356.java:26:23: compiler.err.improperly.formed.type.param.missing
+T6665356.java:26:22: compiler.err.improperly.formed.type.param.missing
 T6665356.java:27:25: compiler.err.improperly.formed.type.inner.raw.param
 4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7062745
+ * @summary  Regression: difference in overload resolution when two methods are maximally specific
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class GenericOverrideTest {
+
+    static int checkCount = 0;
+
+    enum SignatureKind {
+        NON_GENERIC(""),
+        GENERIC("<X>");
+
+        String paramStr;
+
+        private SignatureKind(String paramStr) {
+            this.paramStr = paramStr;
+        }
+    }
+
+    enum ReturnTypeKind {
+        LIST("List"),
+        ARRAYLIST("ArrayList");
+
+        String retStr;
+
+        private ReturnTypeKind(String retStr) {
+            this.retStr = retStr;
+        }
+
+        boolean moreSpecificThan(ReturnTypeKind that) {
+            switch (this) {
+                case LIST:
+                    return that == this;
+                case ARRAYLIST:
+                    return that == LIST || that == ARRAYLIST;
+                default: throw new AssertionError("Unexpected ret kind: " + this);
+            }
+        }
+    }
+
+    enum TypeArgumentKind {
+        NONE(""),
+        UNBOUND("<?>"),
+        INTEGER("<Number>"),
+        NUMBER("<Integer>"),
+        TYPEVAR("<X>");
+
+        String typeargStr;
+
+        private TypeArgumentKind(String typeargStr) {
+            this.typeargStr = typeargStr;
+        }
+
+        boolean compatibleWith(SignatureKind sig) {
+            switch (this) {
+                case TYPEVAR: return sig != SignatureKind.NON_GENERIC;
+                default: return true;
+            }
+        }
+
+        boolean moreSpecificThan(TypeArgumentKind that, boolean strict) {
+            switch (this) {
+                case NONE:
+                    return that == this || !strict;
+                case UNBOUND:
+                    return that == this || that == NONE;
+                case INTEGER:
+                case NUMBER:
+                case TYPEVAR:
+                    return that == this || that == NONE || that == UNBOUND;
+                default: throw new AssertionError("Unexpected typearg kind: " + this);
+            }
+        }
+
+        boolean assignableTo(TypeArgumentKind that, SignatureKind sig) {
+            switch (this) {
+                case NONE:
+                    //this case needs to workaround to javac's impl of 15.12.2.8 being too strict
+                    //ideally should be just 'return true' (see 7067746)
+                    return sig == SignatureKind.NON_GENERIC || that == NONE;
+                case UNBOUND:
+                    return that == this || that == NONE;
+                case INTEGER:
+                case NUMBER:
+                    return that == this || that == NONE || that == UNBOUND;
+                case TYPEVAR:
+                    return true;
+                default: throw new AssertionError("Unexpected typearg kind: " + this);
+            }
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (SignatureKind sig1 : SignatureKind.values()) {
+            for (ReturnTypeKind rt1 : ReturnTypeKind.values()) {
+                for (TypeArgumentKind ta1 : TypeArgumentKind.values()) {
+                    if (!ta1.compatibleWith(sig1)) continue;
+                    for (SignatureKind sig2 : SignatureKind.values()) {
+                        for (ReturnTypeKind rt2 : ReturnTypeKind.values()) {
+                            for (TypeArgumentKind ta2 : TypeArgumentKind.values()) {
+                                if (!ta2.compatibleWith(sig2)) continue;
+                                for (ReturnTypeKind rt3 : ReturnTypeKind.values()) {
+                                    for (TypeArgumentKind ta3 : TypeArgumentKind.values()) {
+                                        if (!ta3.compatibleWith(SignatureKind.NON_GENERIC)) continue;
+                                        new GenericOverrideTest(sig1, rt1, ta1, sig2, rt2, ta2, rt3, ta3).run(comp, fm);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    SignatureKind sig1, sig2;
+    ReturnTypeKind rt1, rt2, rt3;
+    TypeArgumentKind ta1, ta2, ta3;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    GenericOverrideTest(SignatureKind sig1, ReturnTypeKind rt1, TypeArgumentKind ta1,
+            SignatureKind sig2, ReturnTypeKind rt2, TypeArgumentKind ta2, ReturnTypeKind rt3, TypeArgumentKind ta3) {
+        this.sig1 = sig1;
+        this.sig2 = sig2;
+        this.rt1 = rt1;
+        this.rt2 = rt2;
+        this.rt3 = rt3;
+        this.ta1 = ta1;
+        this.ta2 = ta2;
+        this.ta3 = ta3;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "import java.util.*;\n" +
+                          "interface A { #S1 #R1#TA1 m(); }\n" +
+                          "interface B { #S2 #R2#TA2 m(); }\n" +
+                          "interface AB extends A, B {}\n" +
+                          "class Test {\n" +
+                          "  void test(AB ab) { #R3#TA3 n = ab.m(); }\n" +
+                          "}";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replace("#S1", sig1.paramStr).
+                    replace("#S2", sig2.paramStr).
+                    replace("#R1", rt1.retStr).
+                    replace("#R2", rt2.retStr).
+                    replace("#R3", rt3.retStr).
+                    replace("#TA1", ta1.typeargStr).
+                    replace("#TA2", ta2.typeargStr).
+                    replace("#TA3", ta3.typeargStr);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        boolean errorExpected = false;
+        int mostSpecific = 0;
+
+        //first check that either |R1| <: |R2| or |R2| <: |R1|
+        if (rt1 != rt2) {
+            if (!rt1.moreSpecificThan(rt2) &&
+                    !rt2.moreSpecificThan(rt1)) {
+                errorExpected = true;
+            } else {
+                mostSpecific = rt1.moreSpecificThan(rt2) ? 1 : 2;
+            }
+        }
+
+        //check that either TA1 <= TA2 or TA2 <= TA1 (unless most specific return found above is raw)
+        if (!errorExpected) {
+            if (ta1 != ta2) {
+                boolean useStrictCheck = ta1.moreSpecificThan(ta2, true) || ta2.moreSpecificThan(ta1, true);
+                if (!ta1.moreSpecificThan(ta2, useStrictCheck) &&
+                        !ta2.moreSpecificThan(ta1, useStrictCheck)) {
+                    errorExpected = true;
+                } else {
+                    int mostSpecific2 = ta1.moreSpecificThan(ta2, useStrictCheck) ? 1 : 2;
+                    if (mostSpecific != 0 && mostSpecific2 != mostSpecific) {
+                        errorExpected = mostSpecific == 1 ? ta1 != TypeArgumentKind.NONE : ta2 != TypeArgumentKind.NONE;
+                    } else {
+                        mostSpecific = mostSpecific2;
+                    }
+                }
+            } else if (mostSpecific == 0) {
+                //when no signature is better than the other, an arbitrary choice
+                //must be made - javac always picks the second signature
+                mostSpecific = 2;
+            }
+        }
+
+        //finally, check that most specific return type is compatible with expected type
+        if (!errorExpected) {
+            ReturnTypeKind msrt = mostSpecific == 1 ? rt1 : rt2;
+            TypeArgumentKind msta = mostSpecific == 1 ? ta1 : ta2;
+            SignatureKind mssig = mostSpecific == 1 ? sig1 : sig2;
+
+            if (!msrt.moreSpecificThan(rt3) ||
+                    !msta.assignableTo(ta3, mssig)) {
+                errorExpected = true;
+            }
+        }
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/rawOverride/7062745/T7062745neg.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,18 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7062745
+ * @summary  Regression: difference in overload resolution when two methods are maximally specific
+ * @compile/fail/ref=T7062745neg.out -XDrawDiagnostics T7062745neg.java
+ */
+
+import java.util.*;
+
+class T7062745neg {
+    interface A { List<Number> getList(); }
+    interface B { ArrayList getList(); }
+    interface AB extends A, B {}
+
+    void test(AB ab) {
+        Number n = ab.getList().get(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/rawOverride/7062745/T7062745neg.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,2 @@
+T7062745neg.java:16:36: compiler.err.prob.found.req: java.lang.Object, java.lang.Number
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/rawOverride/7062745/T7062745pos.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7062745
+ * @summary  Regression: difference in overload resolution when two methods are maximally specific
+ *
+ * @compile T7062745pos.java
+ */
+
+import java.util.*;
+
+class T7062745pos {
+    interface A { List<Number> getList(); }
+    interface B { List getList(); }
+    interface AB extends A, B {}
+
+    void test(AB ab) {
+        Number n = ab.getList().get(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/rawOverride/T7148556.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7148556
+ * @summary Implementing a generic interface causes a public clone() to become inaccessible
+ * @compile T7148556.java
+ */
+
+class T7148556 {
+
+    interface A extends Cloneable {
+       public Object clone();
+    }
+
+    interface B extends A, java.util.List { }
+
+    void test(B b) {
+        b.clone();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/typevars/T7148242.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7148242
+ * @summary Regression: valid code rejected during generic type well-formedness check
+ * @compile T7148242.java
+ */
+class T7148242 {
+   static abstract class A<K, V, I extends Pair<K, V>, I2 extends Pair<V, K>> {
+      abstract A<V, K, I2, I> test();
+   }
+   static class Pair<K, V> { }
+}
--- a/test/tools/javac/generics/wildcards/6886247/T6886247_2.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/generics/wildcards/6886247/T6886247_2.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-T6886247_2.java:35:28: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.type.captureof: 1, ?, E
+T6886247_2.java:35:28: compiler.err.prob.found.req: compiler.misc.type.captureof: 1, ?, E
 1 error
--- a/test/tools/javac/innerClassFile/Driver.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/innerClassFile/Driver.sh	Tue May 29 00:27:58 2012 +0100
@@ -53,7 +53,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows* )
--- a/test/tools/javac/javazip/Test.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/javazip/Test.sh	Tue May 29 00:27:58 2012 +0100
@@ -41,13 +41,13 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     FS="/"
     SCR=`pwd`
     ;;
   CYGWIN* )
     FS="/"
-    SCR=`pwd | cygpath -d`
+    SCR=`pwd | cygpath -d -f -`
     ;;
   Windows* )
     FS="\\"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/jvm/T7024096.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7024096
+ * @summary Stack trace has invalid line numbers
+ * @author Bruce Chapman
+ * @compile T7024096.java
+ * @run main T7024096
+ */
+
+public class T7024096 {
+    private static final int START = 14; // starting line number for the test
+    public static void main(String[] args) {
+        T7024096 m = new T7024096();
+        m.nest(START);
+        m.nest(START + 1, m.nest(START + 1), m.nest(START + 1),
+            m.nest(START + 2),
+            m.nest(START + 3, m.nest(START + 3)));
+    }
+
+    public T7024096 nest(int expectedline, T7024096... args) {
+        Exception e = new Exception("expected line#: " + expectedline);
+        int myline = e.getStackTrace()[1].getLineNumber();
+        if( myline != expectedline) {
+            throw new RuntimeException("Incorrect line number " +
+                    "expected: " + expectedline +
+                    ", got: " + myline, e);
+        }
+        System.out.format("Got expected line number %d correct %n", myline);
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaParserTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7115050
+ * @summary Add parser support for lambda expressions
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class LambdaParserTest {
+
+    static int checkCount = 0;
+
+    enum LambdaKind {
+        NILARY_EXPR("()->x"),
+        NILARY_STMT("()->{ return x; }"),
+        ONEARY_SHORT_EXPR("x->x"),
+        ONEARY_SHORT_STMT("x->{ return x; }"),
+        ONEARY_EXPR("(#M1 #T1 x)->x"),
+        ONEARY_STMT("(#M1 #T1 x)->{ return x; }"),
+        TWOARY_EXPR("(#M1 #T1 x, #M2 #T2 y)->x"),
+        TWOARY_STMT("(#M1 #T1 x, #M2 #T2 y)->{ return x; }");
+
+        String lambdaTemplate;
+
+        LambdaKind(String lambdaTemplate) {
+            this.lambdaTemplate = lambdaTemplate;
+        }
+
+        String getLambdaString(LambdaParameterKind pk1, LambdaParameterKind pk2,
+                ModifierKind mk1, ModifierKind mk2) {
+            return lambdaTemplate.replaceAll("#M1", mk1.modifier)
+                    .replaceAll("#M2", mk2.modifier)
+                    .replaceAll("#T1", pk1.parameterType)
+                    .replaceAll("#T2", pk2.parameterType);
+        }
+
+        int arity() {
+            switch (this) {
+                case NILARY_EXPR:
+                case NILARY_STMT: return 0;
+                case ONEARY_SHORT_EXPR:
+                case ONEARY_SHORT_STMT:
+                case ONEARY_EXPR:
+                case ONEARY_STMT: return 1;
+                case TWOARY_EXPR:
+                case TWOARY_STMT: return 2;
+                default: throw new AssertionError("Invalid lambda kind " + this);
+            }
+        }
+
+        boolean isShort() {
+            return this == ONEARY_SHORT_EXPR ||
+                    this == ONEARY_SHORT_STMT;
+        }
+    }
+
+    enum LambdaParameterKind {
+        IMPLICIT(""),
+        EXPLIICT_SIMPLE("A"),
+        EXPLICIT_VARARGS("A..."),
+        EXPLICIT_GENERIC1("A<X>"),
+        EXPLICIT_GENERIC3("A<? extends X, ? super Y>");
+
+        String parameterType;
+
+        LambdaParameterKind(String parameterType) {
+            this.parameterType = parameterType;
+        }
+
+        boolean explicit() {
+            return this != IMPLICIT;
+        }
+    }
+
+    enum ModifierKind {
+        NONE(""),
+        FINAL("final"),
+        PUBLIC("public");
+
+        String modifier;
+
+        ModifierKind(String modifier) {
+            this.modifier = modifier;
+        }
+
+        boolean compatibleWith(LambdaParameterKind pk) {
+            switch (this) {
+                case PUBLIC: return false;
+                case FINAL: return pk != LambdaParameterKind.IMPLICIT;
+                case NONE: return true;
+                default: throw new AssertionError("Invalid modifier kind " + this);
+            }
+        }
+    }
+
+    enum ExprKind {
+        NONE("#L#S"),
+        SINGLE_PAREN1("(#L#S)"),
+        SINGLE_PAREN2("(#L)#S"),
+        DOUBLE_PAREN1("((#L#S))"),
+        DOUBLE_PAREN2("((#L)#S)"),
+        DOUBLE_PAREN3("((#L))#S");
+
+        String expressionTemplate;
+
+        ExprKind(String expressionTemplate) {
+            this.expressionTemplate = expressionTemplate;
+        }
+
+        String expressionString(LambdaParameterKind pk1, LambdaParameterKind pk2,
+                ModifierKind mk1, ModifierKind mk2, LambdaKind lk, SubExprKind sk) {
+            return expressionTemplate.replaceAll("#L", lk.getLambdaString(pk1, pk2, mk1, mk2))
+                    .replaceAll("#S", sk.subExpression);
+        }
+    }
+
+    enum SubExprKind {
+        NONE(""),
+        SELECT_FIELD(".f"),
+        SELECT_METHOD(".f()"),
+        SELECT_NEW(".new Foo()"),
+        POSTINC("++"),
+        POSTDEC("--");
+
+        String subExpression;
+
+        SubExprKind(String subExpression) {
+            this.subExpression = subExpression;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (LambdaKind lk : LambdaKind.values()) {
+            for (LambdaParameterKind pk1 : LambdaParameterKind.values()) {
+                if (lk.arity() < 1 && pk1 != LambdaParameterKind.IMPLICIT) continue;
+                for (LambdaParameterKind pk2 : LambdaParameterKind.values()) {
+                    if (lk.arity() < 2 && pk2 != LambdaParameterKind.IMPLICIT) continue;
+                    for (ModifierKind mk1 : ModifierKind.values()) {
+                        if (mk1 != ModifierKind.NONE && lk.isShort()) continue;
+                        if (lk.arity() < 1 && mk1 != ModifierKind.NONE) continue;
+                        for (ModifierKind mk2 : ModifierKind.values()) {
+                            if (lk.arity() < 2 && mk2 != ModifierKind.NONE) continue;
+                            for (SubExprKind sk : SubExprKind.values()) {
+                                for (ExprKind ek : ExprKind.values()) {
+                                    new LambdaParserTest(pk1, pk2, mk1, mk2, lk, sk, ek)
+                                            .run(comp, fm);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    LambdaParameterKind pk1;
+    LambdaParameterKind pk2;
+    ModifierKind mk1;
+    ModifierKind mk2;
+    LambdaKind lk;
+    SubExprKind sk;
+    ExprKind ek;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    LambdaParserTest(LambdaParameterKind pk1, LambdaParameterKind pk2, ModifierKind mk1,
+            ModifierKind mk2, LambdaKind lk, SubExprKind sk, ExprKind ek) {
+        this.pk1 = pk1;
+        this.pk2 = pk2;
+        this.mk1 = mk1;
+        this.mk2 = mk2;
+        this.lk = lk;
+        this.sk = sk;
+        this.ek = ek;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "class Test {\n" +
+                          "   SAM s = #E;\n" +
+                          "}";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replaceAll("#E", ek.expressionString(pk1, pk2, mk1, mk2, lk, sk));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                Arrays.asList("-XDallowLambda"), null, Arrays.asList(source));
+        try {
+            ct.parse();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when parsing the following source:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        boolean errorExpected = (lk.arity() > 0 && !mk1.compatibleWith(pk1)) ||
+                (lk.arity() > 1 && !mk2.compatibleWith(pk2));
+
+        if (lk.arity() == 2 &&
+                (pk1.explicit() != pk2.explicit() ||
+                pk1 == LambdaParameterKind.EXPLICIT_VARARGS)) {
+            errorExpected = true;
+        }
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReferenceParserTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7115052
+ * @summary Add parser support for method references
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class MethodReferenceParserTest {
+
+    static int checkCount = 0;
+
+    enum ReferenceKind {
+        METHOD_REF("#Q##Gm"),
+        CONSTRUCTOR_REF("#Q##Gnew"),
+        FALSE_REF("min < max"),
+        ERR_SUPER("#Q##Gsuper"),
+        ERR_METH0("#Q##Gm()"),
+        ERR_METH1("#Q##Gm(X)"),
+        ERR_CONSTR0("#Q##Gnew()"),
+        ERR_CONSTR1("#Q##Gnew(X)");
+
+        String referenceTemplate;
+
+        ReferenceKind(String referenceTemplate) {
+            this.referenceTemplate = referenceTemplate;
+        }
+
+        String getReferenceString(QualifierKind qk, GenericKind gk) {
+            return referenceTemplate
+                    .replaceAll("#Q", qk.qualifier)
+                    .replaceAll("#G", gk.typeParameters);
+        }
+
+        boolean erroneous() {
+            switch (this) {
+                case ERR_SUPER:
+                case ERR_METH0:
+                case ERR_METH1:
+                case ERR_CONSTR0:
+                case ERR_CONSTR1:
+                    return true;
+                default: return false;
+            }
+        }
+    }
+
+    enum ContextKind {
+        ASSIGN("SAM s = #E;"),
+        METHOD("m(#E, i);");
+
+        String contextTemplate;
+
+        ContextKind(String contextTemplate) {
+            this.contextTemplate = contextTemplate;
+        }
+
+        String contextString(ExprKind ek, ReferenceKind rk, QualifierKind qk, GenericKind gk, SubExprKind sk) {
+            return contextTemplate.replaceAll("#E", ek.expressionString(rk, qk, gk, sk));
+        }
+    }
+
+    enum GenericKind {
+        NONE(""),
+        ONE("<X>"),
+        TWO("<X,Y>");
+
+        String typeParameters;
+
+        GenericKind(String typeParameters) {
+            this.typeParameters = typeParameters;
+        }
+    }
+
+    enum QualifierKind {
+        THIS("this"),
+        SUPER("super"),
+        NEW("new Foo()"),
+        METHOD("m()"),
+        FIELD("a.f"),
+        UBOUND_SIMPLE("A"),
+        UNBOUND_GENERIC1("A<X>"),
+        UNBOUND_GENERIC2("A<X, Y>"),
+        UNBOUND_GENERIC3("A<? extends X, ? super Y>"),
+        UNBOUND_GENERIC4("A<int[], short[][]>"),
+        NESTED_GENERIC1("A<A<X,Y>, A<X,Y>>"),
+        NESTED_GENERIC2("A<A<A<X,Y>,A<X,Y>>, A<A<X,Y>,A<X,Y>>>");
+
+        String qualifier;
+
+        QualifierKind(String qualifier) {
+            this.qualifier = qualifier;
+        }
+    }
+
+    enum ExprKind {
+        NONE("#R#S"),
+        SINGLE_PAREN1("(#R#S)"),
+        SINGLE_PAREN2("(#R)#S"),
+        DOUBLE_PAREN1("((#R#S))"),
+        DOUBLE_PAREN2("((#R)#S)"),
+        DOUBLE_PAREN3("((#R))#S");
+
+        String expressionTemplate;
+
+        ExprKind(String expressionTemplate) {
+            this.expressionTemplate = expressionTemplate;
+        }
+
+        String expressionString(ReferenceKind rk, QualifierKind qk, GenericKind gk, SubExprKind sk) {
+            return expressionTemplate
+                    .replaceAll("#R", rk.getReferenceString(qk, gk))
+                    .replaceAll("#S", sk.subExpression);
+        }
+    }
+
+    enum SubExprKind {
+        NONE(""),
+        SELECT_FIELD(".f"),
+        SELECT_METHOD(".f()"),
+        SELECT_NEW(".new Foo()"),
+        POSTINC("++"),
+        POSTDEC("--");
+
+        String subExpression;
+
+        SubExprKind(String subExpression) {
+            this.subExpression = subExpression;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (ReferenceKind rk : ReferenceKind.values()) {
+            for (QualifierKind qk : QualifierKind.values()) {
+                for (GenericKind gk : GenericKind.values()) {
+                    for (SubExprKind sk : SubExprKind.values()) {
+                        for (ExprKind ek : ExprKind.values()) {
+                            for (ContextKind ck : ContextKind.values()) {
+                                new MethodReferenceParserTest(rk, qk, gk, sk, ek, ck).run(comp, fm);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    ReferenceKind rk;
+    QualifierKind qk;
+    GenericKind gk;
+    SubExprKind sk;
+    ExprKind ek;
+    ContextKind ck;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    MethodReferenceParserTest(ReferenceKind rk, QualifierKind qk, GenericKind gk, SubExprKind sk, ExprKind ek, ContextKind ck) {
+        this.rk = rk;
+        this.qk = qk;
+        this.gk = gk;
+        this.sk = sk;
+        this.ek = ek;
+        this.ck = ck;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "class Test {\n" +
+                          "   void test() {\n" +
+                          "      #C\n" +
+                          "   }" +
+                          "}";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replaceAll("#C", ck.contextString(ek, rk, qk, gk, sk));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                Arrays.asList("-XDallowMethodReferences"), null, Arrays.asList(source));
+        try {
+            ct.parse();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when parsing the following source:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        if (diagChecker.errorFound != rk.erroneous()) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + rk.erroneous());
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lib/CompileFail.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import com.sun.tools.javac.main.Main;
+
+/*
+ * Utility class to emulate jtreg @compile/fail, but also checking the specific
+ * exit code, given as the first arg.
+ */
+public class CompileFail {
+    public static void main(String... args) {
+        if (args.length < 2)
+            throw new IllegalArgumentException("insufficient args");
+        int expected_rc = getReturnCode(args[0]);
+
+        List<String> javacArgs = new ArrayList<>();
+        javacArgs.addAll(Arrays.asList(
+            "-bootclasspath", System.getProperty("sun.boot.class.path"),
+            "-d", "."
+        ));
+
+        File testSrc = new File(System.getProperty("test.src"));
+        for (int i = 1; i < args.length; i++) { // skip first arg
+            String arg = args[i];
+            if (arg.endsWith(".java"))
+                javacArgs.add(new File(testSrc, arg).getPath());
+            else
+                javacArgs.add(arg);
+        }
+
+        int rc = com.sun.tools.javac.Main.compile(
+            javacArgs.toArray(new String[javacArgs.size()]));
+
+        if (rc != expected_rc)
+            throw new Error("unexpected exit code: " + rc
+                        + ", expected: " + expected_rc);
+    }
+
+    static int getReturnCode(String name) {
+        return Main.Result.valueOf(name).exitCode;
+    }
+
+}
--- a/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Tue May 29 00:27:58 2012 +0100
@@ -25,6 +25,7 @@
 import javax.annotation.processing.*;
 import javax.lang.model.SourceVersion;
 import javax.lang.model.util.*;
+import static javax.lang.model.SourceVersion.*;
 
 /**
  * An abstract annotation processor tailored to javac regression testing.
@@ -95,4 +96,164 @@
         messager  = processingEnv.getMessager();
         options   = processingEnv.getOptions();
     }
+
+    /*
+     * The set of visitors below will directly extend the most recent
+     * corresponding platform visitor type.
+     */
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
+
+        /**
+         * Constructor for concrete subclasses to call.
+         */
+        protected AbstractAnnotationValueVisitor() {
+            super();
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor8<R, P> {
+        /**
+         * Constructor for concrete subclasses to call.
+         */
+        protected AbstractElementVisitor(){
+            super();
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor8<R, P> {
+        /**
+         * Constructor for concrete subclasses to call.
+         */
+        protected AbstractTypeVisitor() {
+            super();
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static class ElementKindVisitor<R, P> extends ElementKindVisitor8<R, P> {
+        /**
+         * Constructor for concrete subclasses; uses {@code null} for the
+         * default value.
+         */
+        protected ElementKindVisitor() {
+            super(null);
+        }
+
+        /**
+         * Constructor for concrete subclasses; uses the argument for the
+         * default value.
+         *
+         * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+         */
+        protected ElementKindVisitor(R defaultValue) {
+            super(defaultValue);
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static class ElementScanner<R, P> extends ElementScanner8<R, P> {
+        /**
+         * Constructor for concrete subclasses; uses {@code null} for the
+         * default value.
+         */
+        protected ElementScanner(){
+            super(null);
+        }
+
+        /**
+         * Constructor for concrete subclasses; uses the argument for the
+         * default value.
+         */
+        protected ElementScanner(R defaultValue){
+            super(defaultValue);
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
+        /**
+         * Constructor for concrete subclasses; uses {@code null} for the
+         * default value.
+         */
+        protected SimpleAnnotationValueVisitor() {
+            super(null);
+        }
+
+        /**
+         * Constructor for concrete subclasses; uses the argument for the
+         * default value.
+         *
+         * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+         */
+        protected SimpleAnnotationValueVisitor(R defaultValue) {
+            super(defaultValue);
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor8<R, P> {
+        /**
+         * Constructor for concrete subclasses; uses {@code null} for the
+         * default value.
+         */
+        protected SimpleElementVisitor(){
+            super(null);
+        }
+
+        /**
+         * Constructor for concrete subclasses; uses the argument for the
+         * default value.
+         *
+         * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+         */
+        protected SimpleElementVisitor(R defaultValue){
+            super(defaultValue);
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor8<R, P> {
+        /**
+         * Constructor for concrete subclasses; uses {@code null} for the
+         * default value.
+         */
+        protected SimpleTypeVisitor(){
+            super(null);
+        }
+
+        /**
+         * Constructor for concrete subclasses; uses the argument for the
+         * default value.
+         *
+         * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+         */
+        protected SimpleTypeVisitor(R defaultValue){
+            super(defaultValue);
+        }
+    }
+
+    @SupportedSourceVersion(RELEASE_8)
+    public static class TypeKindVisitor<R, P> extends TypeKindVisitor8<R, P> {
+        /**
+         * Constructor for concrete subclasses to call; uses {@code null}
+         * for the default value.
+         */
+        protected TypeKindVisitor() {
+            super(null);
+        }
+
+        /**
+         * Constructor for concrete subclasses to call; uses the argument
+         * for the default value.
+         *
+         * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
+         */
+        protected TypeKindVisitor(R defaultValue) {
+            super(defaultValue);
+        }
+    }
 }
--- a/test/tools/javac/links/links.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/links/links.sh	Tue May 29 00:27:58 2012 +0100
@@ -53,7 +53,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
--- a/test/tools/javac/multicatch/Neg06.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/multicatch/Neg06.out	Tue May 29 00:27:58 2012 +0100
@@ -1,3 +1,3 @@
-Neg06.java:14:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.String, java.lang.Throwable
-Neg06.java:14:25: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Integer, java.lang.Throwable
+Neg06.java:14:16: compiler.err.prob.found.req: java.lang.String, java.lang.Throwable
+Neg06.java:14:25: compiler.err.prob.found.req: java.lang.Integer, java.lang.Throwable
 2 errors
--- a/test/tools/javac/multicatch/Neg07.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/multicatch/Neg07.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-Neg07.java:14:56: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Class<compiler.misc.type.captureof: 1, ? extends Neg07.ParentException>, java.lang.Class<? extends Neg07.HasFoo>
+Neg07.java:14:56: compiler.err.prob.found.req: java.lang.Class<compiler.misc.type.captureof: 1, ? extends Neg07.ParentException>, java.lang.Class<? extends Neg07.HasFoo>
 1 error
--- a/test/tools/javac/multicatch/model/ModelChecker.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/multicatch/model/ModelChecker.java	Tue May 29 00:27:58 2012 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6993963
+ * @bug 6993963 7025809
  * @summary Project Coin: Use precise exception analysis for effectively final catch parameters
  * @library ../../lib
  * @build JavacTestingAbstractProcessor ModelChecker
@@ -107,7 +107,7 @@
             ; // Expected
         }
 
-        UnionType unionType = new SimpleTypeVisitor7<UnionType, Void>(){
+        UnionType unionType = new SimpleTypeVisitor<UnionType, Void>(){
             @Override
             protected UnionType defaultAction(TypeMirror e, Void p) {return null;}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/nativeHeaders/NativeHeaderTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7150368
+ * @summary javac should include basic ability to generate native headers
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+
+public class NativeHeaderTest {
+    public static void main(String... args) throws Exception {
+        new NativeHeaderTest().run();
+    }
+
+    /** How to invoke javac. */
+    enum RunKind {
+        /** Use the command line entry point. */
+        CMD,
+        /** Use the JavaCompiler API. */
+        API
+    };
+
+    /** Which classes for which to generate headers. */
+    enum GenKind {
+        /** Just classes with native methods or the marker annotation. */
+        SIMPLE,
+        /** All appropriate classes within the top level class. */
+        FULL
+    };
+
+    // ---------- Test cases, invoked reflectively via run. ----------
+
+    @Test
+    void simpleTest(RunKind rk, GenKind gk) throws Exception {
+        List<File> files = new ArrayList<File>();
+        files.add(createFile("p/C.java",
+                "class C { native void m(); }"));
+
+        Set<String> expect = createSet("C.h");
+
+        test(rk, gk, files, expect);
+    }
+
+    @Test
+    void nestedClassTest(RunKind rk, GenKind gk) throws Exception {
+        List<File> files = new ArrayList<File>();
+        files.add(createFile("p/C.java",
+                "class C { static class Inner { native void m(); } }"));
+
+        Set<String> expect = createSet("C_Inner.h");
+        if (gk == GenKind.FULL) expect.add("C.h");
+
+        test(rk, gk, files, expect);
+    }
+
+    @Test
+    void localClassTest(RunKind rk, GenKind gk) throws Exception {
+        List<File> files = new ArrayList<File>();
+        files.add(createFile("p/C.java",
+                "class C { native void m(); void m2() { class Local { } } }"));
+
+        Set<String> expect = createSet("C.h");
+
+        test(rk, gk, files, expect);
+    }
+
+    @Test
+    void syntheticClassTest(RunKind rk, GenKind gk) throws Exception {
+        List<File> files = new ArrayList<File>();
+        files.add(createFile("p/C.java",
+                "class C {\n"
+                + "    private C() { }\n"
+                + "    class Inner extends C { native void m(); }\n"
+                + "}"));
+
+        Set<String> expect = createSet("C_Inner.h");
+        if (gk == GenKind.FULL) expect.add("C.h");
+
+        test(rk, gk, files, expect);
+
+        // double check the synthetic class was generated
+        checkEqual("generatedClasses",
+                createSet("C.class", "C$1.class", "C$Inner.class"),
+                createSet(classesDir.list()));
+    }
+
+    @Test
+    void annoTest(RunKind rk, GenKind gk) throws Exception {
+        List<File> files = new ArrayList<File>();
+        files.add(createFile("p/C.java",
+                "@javax.tools.annotation.GenerateNativeHeader class C { }"));
+
+        Set<String> expect = createSet("C.h");
+
+        test(rk, gk, files, expect);
+    }
+
+    @Test
+    void annoNestedClassTest(RunKind rk, GenKind gk) throws Exception {
+        List<File> files = new ArrayList<File>();
+        files.add(createFile("p/C.java",
+                "class C { @javax.tools.annotation.GenerateNativeHeader class Inner { } }"));
+
+        Set<String> expect = createSet("C_Inner.h");
+        if (gk == GenKind.FULL) expect.add("C.h");
+
+        test(rk, gk, files, expect);
+    }
+
+    /**
+     * The worker method for each test case.
+     * Compile the files and verify that exactly the expected set of header files
+     * is generated.
+     */
+    void test(RunKind rk, GenKind gk, List<File> files, Set<String> expect) throws Exception {
+        List<String> args = new ArrayList<String>();
+        if (gk == GenKind.FULL)
+            args.add("-XDjavah:full");
+
+        switch (rk) {
+            case CMD:
+                args.add("-d");
+                args.add(classesDir.getPath());
+                args.add("-h");
+                args.add(headersDir.getPath());
+                for (File f: files)
+                    args.add(f.getPath());
+                int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]));
+                if (rc != 0)
+                    throw new Exception("compilation failed, rc=" + rc);
+                break;
+
+            case API:
+                fm.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(srcDir));
+                fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(classesDir));
+                fm.setLocation(StandardLocation.NATIVE_HEADER_OUTPUT, Arrays.asList(headersDir));
+                JavacTask task = javac.getTask(null, fm, null, args, null,
+                        fm.getJavaFileObjectsFromFiles(files));
+                if (!task.call())
+                    throw new Exception("compilation failed");
+                break;
+        }
+
+        Set<String> found = createSet(headersDir.list());
+        checkEqual("header files", expect, found);
+    }
+
+    /** Marker annotation for test cases. */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Test { }
+
+    /** Combo test to run all test cases in all modes. */
+    void run() throws Exception {
+        javac = JavacTool.create();
+        fm = javac.getStandardFileManager(null, null, null);
+
+        for (RunKind rk: RunKind.values()) {
+            for (GenKind gk: GenKind.values()) {
+                for (Method m: getClass().getDeclaredMethods()) {
+                    Annotation a = m.getAnnotation(Test.class);
+                    if (a != null) {
+                        init(rk, gk, m.getName());
+                        try {
+                            m.invoke(this, new Object[] { rk, gk });
+                        } catch (InvocationTargetException e) {
+                            Throwable cause = e.getCause();
+                            throw (cause instanceof Exception) ? ((Exception) cause) : e;
+                        }
+                        System.err.println();
+                    }
+                }
+            }
+        }
+        System.err.println(testCount + " tests" + ((errorCount == 0) ? "" : ", " + errorCount + " errors"));
+        if (errorCount > 0)
+            throw new Exception(errorCount + " errors found");
+    }
+
+    /**
+     * Init directories for a test case.
+     */
+    void init(RunKind rk, GenKind gk, String name) throws IOException {
+        System.err.println("Test " + rk + " " + gk + " " + name);
+        testCount++;
+
+        testDir = new File(rk.toString().toLowerCase() + "_" + gk.toString().toLowerCase() + "-" + name);
+        srcDir = new File(testDir, "src");
+        srcDir.mkdirs();
+        classesDir = new File(testDir, "classes");
+        classesDir.mkdirs();
+        headersDir = new File(testDir, "headers");
+        headersDir.mkdirs();
+    }
+
+    /** Create a source file with given body text. */
+    File createFile(String path, final String body) throws IOException {
+        File f = new File(srcDir, path);
+        f.getParentFile().mkdirs();
+        try (FileWriter out = new FileWriter(f)) {
+            out.write(body);
+        }
+        return f;
+    }
+
+    /** Convenience method to create a set of items. */
+    <T> Set<T> createSet(T... items) {
+        return new HashSet<T>(Arrays.asList(items));
+    }
+
+    /** Convenience method to check two values are equal, and report an error if not. */
+    <T> void checkEqual(String label, T expect, T found) {
+        if ((found == null) ? (expect == null) : found.equals(expect))
+            return;
+        System.err.println("Error: mismatch");
+        System.err.println("  expected: " + expect);
+        System.err.println("     found: " + found);
+        errorCount++;
+    }
+
+    // Shared across API test cases
+    JavacTool javac;
+    StandardJavaFileManager fm;
+
+    // Directories set up by init
+    File testDir;
+    File srcDir;
+    File classesDir;
+    File headersDir;
+
+    // Statistics
+    int testCount;
+    int errorCount;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/nativeHeaders/javahComparison/CompareTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2007,2012 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7150368
+ * @summary javac should include basic ability to generate native headers
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class CompareTest {
+    public static void main(String... args) throws Exception {
+        new CompareTest().run();
+    }
+
+    void run() throws Exception {
+        File srcDir = new File(System.getProperty("test.src"));
+        File classesDir = new File("classes");
+        classesDir.mkdirs();
+        File javacHeaders = new File("headers.javac");
+        javacHeaders.mkdirs();
+        File javahHeaders = new File("headers.javah");
+        javahHeaders.mkdirs();
+
+        List<String> javacArgs = new ArrayList<String>();
+        javacArgs.add("-d");
+        javacArgs.add(classesDir.getPath());
+        javacArgs.add("-h");
+        javacArgs.add(javacHeaders.getPath());
+        javacArgs.add("-XDjavah:full");
+
+        for (File f: srcDir.listFiles()) {
+            if (f.getName().matches("TestClass[0-9]+\\.java")) {
+                sourceFileCount++;
+                javacArgs.add(f.getPath());
+            }
+        }
+
+        int rc = com.sun.tools.javac.Main.compile(javacArgs.toArray(new String[javacArgs.size()]));
+        if (rc != 0)
+            throw new Exception("javac failed; rc=" + rc);
+
+        List<String> javahArgs = new ArrayList<String>();
+        javahArgs.add("-d");
+        javahArgs.add(javahHeaders.getPath());
+
+        for (File f: classesDir.listFiles()) {
+            if (f.getName().endsWith(".class")) {
+                javahArgs.add(inferBinaryName(f));
+            }
+        }
+
+        PrintWriter pw = new PrintWriter(System.out, true);
+        rc = com.sun.tools.javah.Main.run(javahArgs.toArray(new String[javahArgs.size()]), pw);
+        if (rc != 0)
+            throw new Exception("javah failed; rc=" + rc);
+
+        compare(javahHeaders, javacHeaders);
+
+        int javahHeaderCount = javahHeaders.list().length;
+        int javacHeaderCount = javacHeaders.list().length;
+
+        System.out.println(sourceFileCount + " .java files found");
+        System.out.println(javacHeaderCount + " .h files generated by javac");
+        System.out.println(javahHeaderCount + " .h files generated by javah");
+        System.out.println(compareCount + " header files compared");
+
+        if (javacHeaderCount != javahHeaderCount || javacHeaderCount != compareCount)
+            error("inconsistent counts");
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    String inferBinaryName(File file) {
+        String name = file.getName();
+        return name.substring(0, name.length() - ".class".length()).replace("$", ".");
+    }
+
+    /** Compare two directories.
+     *  @param f1 The golden directory
+     *  @param f2 The directory to be compared
+     */
+    void compare(File f1, File f2) {
+        compare(f1, f2, null);
+    }
+
+    /** Compare two files or directories
+     *  @param f1 The golden directory
+     *  @param f2 The directory to be compared
+     *  @param p An optional path identifying a file within the two directories
+     */
+    void compare(File f1, File f2, String p) {
+        File f1p = (p == null ? f1 : new File(f1, p));
+        File f2p = (p == null ? f2 : new File(f2, p));
+        if (f1p.isDirectory() && f2p.isDirectory()) {
+            Set<String> children = new HashSet<String>();
+            children.addAll(Arrays.asList(f1p.list()));
+            children.addAll(Arrays.asList(f2p.list()));
+            for (String c: children) {
+                compare(f1, f2, new File(p, c).getPath()); // null-safe for p
+            }
+        }
+        else if (f1p.isFile() && f2p.isFile()) {
+            System.out.println("checking " + p);
+            compareCount++;
+            String s1 = read(f1p);
+            String s2 = read(f2p);
+            if (!s1.equals(s2)) {
+                System.out.println("File: " + f1p + "\n" + s1);
+                System.out.println("File: " + f2p + "\n" + s2);
+                error("Files differ: " + f1p + " " + f2p);
+            }
+        }
+        else if (f1p.exists() && !f2p.exists())
+            error("Only in " + f1 + ": " + p);
+        else if (f2p.exists() && !f1p.exists())
+            error("Only in " + f2 + ": " + p);
+        else
+            error("Files differ: " + f1p + " " + f2p);
+    }
+
+    private String read(File f) {
+        try {
+            return new String(Files.readAllBytes(f.toPath()));
+        } catch (IOException e) {
+            error("error reading " + f + ": " + e);
+            return "";
+        }
+    }
+
+    private void error(String msg) {
+        System.out.println(msg);
+        errors++;
+    }
+
+    private int errors;
+    private int compareCount;
+    private int sourceFileCount;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/nativeHeaders/javahComparison/TestClass1.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,475 @@
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.List;
+
+public class TestClass1 {
+    // simple types
+    byte b;
+    short s;
+    int i;
+    long l;
+    float f;
+    double d;
+    Object o;
+    String t;
+    List<String> g;
+
+    // constants
+    static final byte bc = 0;
+    static final short sc = 0;
+    static final int ic = 0;
+    static final long lc = 0;
+    static final float fc = 0;
+    static final double dc = 0;
+    static final Object oc = null;
+    static final String tc = "";
+    static final List<String> gc = null;
+
+    // simple arrays
+    byte[] ba;
+    short[] sa; // not handled corrected by javah v6
+    int[] ia;
+    long[] la;
+    float[] fa;
+    double[] da;
+    Object[] oa;
+    String[] ta;
+    List<String>[] ga;
+
+    // multidimensional arrays
+    byte[][] baa;
+    short[][] saa;
+    int[][] iaa;
+    long[][] laa;
+    float[][] faa;
+    double[][] daa;
+    Object[][] oaa;
+    String[][] taa;
+    List<String>[] gaa;
+
+    // simple Java methods
+    byte bm() { return 0; }
+    short sm() { return 0; }
+    int im() { return 0; }
+    long lm() { return 0; }
+    float fm() { return 0; }
+    double dm() { return 0; }
+    Object om() { return null; }
+    String tm() { return ""; }
+    List<String> gm() { return null; }
+    void vm() { }
+    byte[] bam() { return null; }
+    short[] sam() { return null; }
+    int[] iam() { return null; }
+    long[] lam() { return null; }
+    float[] fam() { return null; }
+    double[] dam() { return null; }
+    Object[] oam() { return null; }
+    String[] tam() { return null; }
+    List<String>[] gam() { return null; }
+    byte[][] baam() { return null; }
+    short[][] saam() { return null; }
+    int[][] iaam() { return null; }
+    long[][] laam() { return null; }
+    float[][] faam() { return null; }
+    double[][] daam() { return null; }
+    Object[][] oaam() { return null; }
+    String[][] taam() { return null; }
+    List<String>[] gaam() { return null; }
+
+    // simple native methods
+    native byte bmn();
+    native short smn();
+    native int imn();
+    native long lmn();
+    native float fmn();
+    native double dmn();
+    native Object omn();
+    native String tmn();
+    native List<String> gmn();
+    native void vmn();
+    native byte[] bamn();
+    native short[] samn();
+    native int[] iamn();
+    native long[] lamn();
+    native float[] famn();
+    native double[] damn();
+    native Object[] oamn();
+    native String[] tamn();
+    native List<String>[] gamn();
+    native byte[][] baamn();
+    native short[][] saamn();
+    native int[][] iaamn();
+    native long[][] laamn();
+    native float[][] faamn();
+    native double[][] daamn();
+    native Object[][] oaamn();
+    native String[][] taamn();
+    native List<String>[] gaamn();
+
+    // overloaded Java methods
+    byte bm1() { return 0; }
+    short sm1() { return 0; }
+    int im1() { return 0; }
+    long lm1() { return 0; }
+    float fm1() { return 0; }
+    double dm1() { return 0; }
+    Object om1() { return null; }
+    String tm1() { return ""; }
+    List<String> gm1() { return null; }
+    void vm1() { }
+
+    byte bm2(int i) { return 0; }
+    short sm2(int i) { return 0; }
+    int im2(int i) { return 0; }
+    long lm2(int i) { return 0; }
+    float fm2(int i) { return 0; }
+    double dm2(int i) { return 0; }
+    Object om2(int i) { return null; }
+    String tm2(int i) { return ""; }
+    List<String> gm2(int i) { return null; }
+    void vm2(int i) { }
+
+    // overloaded native methods
+    native byte bmn1();
+    native short smn1();
+    native int imn1();
+    native long lmn1();
+    native float fmn1();
+    native double dmn1();
+    native Object omn1();
+    native String tmn1();
+    native List<String> gmn1();
+    native void vmn1();
+
+    native byte bmn2(int i);
+    native short smn2(int i);
+    native int imn2(int i);
+    native long lmn2(int i);
+    native float fmn2(int i);
+    native double dmn2(int i);
+    native Object omn2(int i);
+    native String tmn2(int i);
+    native List<String> gmn2(int i);
+    native void vmn2(int i);
+
+    // arg types for Java methods
+    void mb(byte b) { }
+    void ms(short s) { }
+    void mi(int i) { }
+    void ml(long l) { }
+    void mf(float f) { }
+    void md(double d) { }
+    void mo(Object o) { }
+    void mt(String t) { }
+    void mg(List<String> g) { }
+
+    // arg types for native methods
+    native void mbn(byte b);
+    native void msn(short s);
+    native void min(int i);
+    native void mln(long l);
+    native void mfn(float f);
+    native void mdn(double d);
+    native void mon(Object o);
+    native void mtn(String t);
+    native void mgn(List<String> g);
+
+    static class Inner1 {
+        // simple types
+        byte b;
+        short s;
+        int i;
+        long l;
+        float f;
+        double d;
+        Object o;
+        String t;
+        List<String> g;
+
+        // constants
+        static final byte bc = 0;
+        static final short sc = 0;
+        static final int ic = 0;
+        static final long lc = 0;
+        static final float fc = 0;
+        static final double dc = 0;
+        static final Object oc = null;
+        static final String tc = "";
+        static final List<String> gc = null;
+
+        // simple arrays
+        byte[] ba;
+        // short[] sa; // not handled corrected by javah v6
+        int[] ia;
+        long[] la;
+        float[] fa;
+        double[] da;
+        Object[] oa;
+        String[] ta;
+        List<String>[] ga;
+
+        // multidimensional arrays
+        byte[][] baa;
+        short[][] saa;
+        int[][] iaa;
+        long[][] laa;
+        float[][] faa;
+        double[][] daa;
+        Object[][] oaa;
+        String[][] taa;
+        List<String>[] gaa;
+
+        // simple Java methods
+        byte bm() { return 0; }
+        short sm() { return 0; }
+        int im() { return 0; }
+        long lm() { return 0; }
+        float fm() { return 0; }
+        double dm() { return 0; }
+        Object om() { return null; }
+        String tm() { return ""; }
+        List<String> gm() { return null; }
+        void vm() { }
+
+        // simple native methods
+        native byte bmn();
+        native short smn();
+        native int imn();
+        native long lmn();
+        native float fmn();
+        native double dmn();
+        native Object omn();
+        native String tmn();
+        native List<String> gmn();
+        native void vmn();
+
+        // overloaded Java methods
+        byte bm1() { return 0; }
+        short sm1() { return 0; }
+        int im1() { return 0; }
+        long lm1() { return 0; }
+        float fm1() { return 0; }
+        double dm1() { return 0; }
+        Object om1() { return null; }
+        String tm1() { return ""; }
+        List<String> gm1() { return null; }
+        void vm1() { }
+
+        byte bm2(int i) { return 0; }
+        short sm2(int i) { return 0; }
+        int im2(int i) { return 0; }
+        long lm2(int i) { return 0; }
+        float fm2(int i) { return 0; }
+        double dm2(int i) { return 0; }
+        Object om2(int i) { return null; }
+        String tm2(int i) { return ""; }
+        List<String> gm2(int i) { return null; }
+        void vm2(int i) { }
+
+        // overloaded native methods
+        native byte bmn1();
+        native short smn1();
+        native int imn1();
+        native long lmn1();
+        native float fmn1();
+        native double dmn1();
+        native Object omn1();
+        native String tmn1();
+        native List<String> gmn1();
+        native void vmn1();
+
+        native byte bmn2(int i);
+        native short smn2(int i);
+        native int imn2(int i);
+        native long lmn2(int i);
+        native float fmn2(int i);
+        native double dmn2(int i);
+        native Object omn2(int i);
+        native String tmn2(int i);
+        native List<String> gmn2(int i);
+        native void vmn2(int i);
+
+        // arg types for Java methods
+        void mb(byte b) { }
+        void ms(short s) { }
+        void mi(int i) { }
+        void ml(long l) { }
+        void mf(float f) { }
+        void md(double d) { }
+        void mo(Object o) { }
+        void mt(String t) { }
+        void mg(List<String> g) { }
+
+        // arg types for native methods
+        native void mbn(byte b);
+        native void msn(short s);
+        native void min(int i);
+        native void mln(long l);
+        native void mfn(float f);
+        native void mdn(double d);
+        native void mon(Object o);
+        native void mtn(String t);
+        native void mgn(List<String> g);
+    }
+
+    class Inner2 {
+        // simple types
+        byte b;
+        short s;
+        int i;
+        long l;
+        float f;
+        double d;
+        Object o;
+        String t;
+        List<String> g;
+
+        // constants
+        static final byte bc = 0;
+        static final short sc = 0;
+        static final int ic = 0;
+        static final long lc = 0;
+        static final float fc = 0;
+        static final double dc = 0;
+        //static final Object oc = null;
+        static final String tc = "";
+        //static final List<String> gc = null;
+
+        // simple arrays
+        byte[] ba;
+        // short[] sa; // not handled corrected by javah v6
+        int[] ia;
+        long[] la;
+        float[] fa;
+        double[] da;
+        Object[] oa;
+        String[] ta;
+        List<String>[] ga;
+
+        // multidimensional arrays
+        byte[][] baa;
+        short[][] saa;
+        int[][] iaa;
+        long[][] laa;
+        float[][] faa;
+        double[][] daa;
+        Object[][] oaa;
+        String[][] taa;
+        List<String>[] gaa;
+
+        // simple Java methods
+        byte bm() { return 0; }
+        short sm() { return 0; }
+        int im() { return 0; }
+        long lm() { return 0; }
+        float fm() { return 0; }
+        double dm() { return 0; }
+        Object om() { return null; }
+        String tm() { return ""; }
+        List<String> gm() { return null; }
+        void vm() { }
+
+        // simple native methods
+        native byte bmn();
+        native short smn();
+        native int imn();
+        native long lmn();
+        native float fmn();
+        native double dmn();
+        native Object omn();
+        native String tmn();
+        native List<String> gmn();
+        native void vmn();
+
+        // overloaded Java methods
+        byte bm1() { return 0; }
+        short sm1() { return 0; }
+        int im1() { return 0; }
+        long lm1() { return 0; }
+        float fm1() { return 0; }
+        double dm1() { return 0; }
+        Object om1() { return null; }
+        String tm1() { return ""; }
+        List<String> gm1() { return null; }
+        void vm1() { }
+
+        byte bm2(int i) { return 0; }
+        short sm2(int i) { return 0; }
+        int im2(int i) { return 0; }
+        long lm2(int i) { return 0; }
+        float fm2(int i) { return 0; }
+        double dm2(int i) { return 0; }
+        Object om2(int i) { return null; }
+        String tm2(int i) { return ""; }
+        List<String> gm2(int i) { return null; }
+        void vm2(int i) { }
+
+        // overloaded native methods
+        native byte bmn1();
+        native short smn1();
+        native int imn1();
+        native long lmn1();
+        native float fmn1();
+        native double dmn1();
+        native Object omn1();
+        native String tmn1();
+        native List<String> gmn1();
+        native void vmn1();
+
+        native byte bmn2(int i);
+        native short smn2(int i);
+        native int imn2(int i);
+        native long lmn2(int i);
+        native float fmn2(int i);
+        native double dmn2(int i);
+        native Object omn2(int i);
+        native String tmn2(int i);
+        native List<String> gmn2(int i);
+        native void vmn2(int i);
+
+        // arg types for Java methods
+        void mb(byte b) { }
+        void ms(short s) { }
+        void mi(int i) { }
+        void ml(long l) { }
+        void mf(float f) { }
+        void md(double d) { }
+        void mo(Object o) { }
+        void mt(String t) { }
+        void mg(List<String> g) { }
+
+        // arg types for native methods
+        native void mbn(byte b);
+        native void msn(short s);
+        native void min(int i);
+        native void mln(long l);
+        native void mfn(float f);
+        native void mdn(double d);
+        native void mon(Object o);
+        native void mtn(String t);
+        native void mgn(List<String> g);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/nativeHeaders/javahComparison/TestClass2.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.tools.annotation.GenerateNativeHeader;
+
+@GenerateNativeHeader
+public class TestClass2 {
+    byte b;
+    short s;
+    int i;
+    long l;
+    float f;
+    double d;
+    Object o;
+    String t;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/nativeHeaders/javahComparison/TestClass3.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.tools.annotation.GenerateNativeHeader;
+
+@GenerateNativeHeader
+public class TestClass3 {
+    public int tc3;
+
+    public class Inner1 {
+        public int tc3i1;
+
+        public class Inner1A {
+            public int tc3i1i1a;
+        }
+
+        public class Inner1B {
+            public int tc3i1i1b;
+        }
+    }
+
+    public class Inner2 {
+        public int tc321;
+
+        public class Inner2A {
+            public int tc3i2i2a;
+        }
+
+        public class Inner2B {
+            public int tc3i2i2b;
+        }
+    }
+}
+
--- a/test/tools/javac/newlines/Newlines.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/newlines/Newlines.sh	Tue May 29 00:27:58 2012 +0100
@@ -50,7 +50,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows* )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/parser/7157165/T7157165.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7157165
+ *
+ * @summary Regression: code with disjunctive type crashes javac
+ * @compile/fail/ref=T7157165.out -XDrawDiagnostics T7157165.java
+ *
+ */
+
+class T7157165 {
+    Foo<? extends A|B> foo1 = null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/parser/7157165/T7157165.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,4 @@
+T7157165.java:11:20: compiler.err.expected: >
+T7157165.java:11:21: compiler.err.expected: ';'
+T7157165.java:11:22: compiler.err.illegal.start.of.type
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/parser/JavacParserTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,932 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7073631 7159445
+ * @summary tests error and diagnostics positions
+ * @author  Jan Lahoda
+ */
+
+import com.sun.source.tree.BinaryTree;
+import com.sun.source.tree.BlockTree;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ErroneousTree;
+import com.sun.source.tree.ExpressionStatementTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MethodInvocationTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.ModifiersTree;
+import com.sun.source.tree.StatementTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.tree.Tree.Kind;
+import com.sun.source.tree.VariableTree;
+import com.sun.source.tree.WhileLoopTree;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TreeScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.tree.JCTree;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class JavacParserTest extends TestCase {
+    final JavaCompiler tool;
+    public JavacParserTest(String testName) {
+        tool = ToolProvider.getSystemJavaCompiler();
+        System.out.println("java.home=" + System.getProperty("java.home"));
+    }
+
+    static class MyFileObject extends SimpleJavaFileObject {
+
+        private String text;
+
+        public MyFileObject(String text) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+    }
+    /*
+     * converts Windows to Unix style LFs for comparing strings
+     */
+    private String normalize(String in) {
+        return in.replace(System.getProperty("line.separator"), "\n");
+    }
+
+    public CompilationUnitTree getCompilationUnitTree(String code) throws IOException {
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        return cut;
+    }
+
+    public List<String> getErroneousTreeValues(ErroneousTree node) {
+
+        List<String> values = new ArrayList<>();
+        if (node.getErrorTrees() != null) {
+            for (Tree t : node.getErrorTrees()) {
+                values.add(t.toString());
+            }
+        } else {
+            throw new RuntimeException("ERROR: No Erroneous tree "
+                    + "has been created.");
+        }
+        return values;
+    }
+
+    public void testPositionForSuperConstructorCalls() throws IOException {
+        assert tool != null;
+
+        String code = "package test; public class Test {public Test() {super();}}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        SourcePositions pos = Trees.instance(ct).getSourcePositions();
+
+        MethodTree method =
+                (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
+        ExpressionStatementTree es =
+                (ExpressionStatementTree) method.getBody().getStatements().get(0);
+
+        final int esStartPos = code.indexOf(es.toString());
+        final int esEndPos = esStartPos + es.toString().length();
+        assertEquals("testPositionForSuperConstructorCalls",
+                esStartPos, pos.getStartPosition(cut, es));
+        assertEquals("testPositionForSuperConstructorCalls",
+                esEndPos, pos.getEndPosition(cut, es));
+
+        MethodInvocationTree mit = (MethodInvocationTree) es.getExpression();
+
+        final int mitStartPos = code.indexOf(mit.toString());
+        final int mitEndPos = mitStartPos + mit.toString().length();
+        assertEquals("testPositionForSuperConstructorCalls",
+                mitStartPos, pos.getStartPosition(cut, mit));
+        assertEquals("testPositionForSuperConstructorCalls",
+                mitEndPos, pos.getEndPosition(cut, mit));
+
+        final int methodStartPos = mitStartPos;
+        final int methodEndPos = methodStartPos + mit.getMethodSelect().toString().length();
+        assertEquals("testPositionForSuperConstructorCalls",
+                methodStartPos, pos.getStartPosition(cut, mit.getMethodSelect()));
+        assertEquals("testPositionForSuperConstructorCalls",
+                methodEndPos, pos.getEndPosition(cut, mit.getMethodSelect()));
+
+    }
+
+    public void testPositionForEnumModifiers() throws IOException {
+
+        String code = "package test; public enum Test {A;}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        SourcePositions pos = Trees.instance(ct).getSourcePositions();
+
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        ModifiersTree mt = clazz.getModifiers();
+
+        assertEquals("testPositionForEnumModifiers",
+                38 - 24, pos.getStartPosition(cut, mt));
+        assertEquals("testPositionForEnumModifiers",
+                44 - 24, pos.getEndPosition(cut, mt));
+    }
+
+    public void testNewClassWithEnclosing() throws IOException {
+
+
+        String code = "package test; class Test { " +
+                "class d {} private void method() { " +
+                "Object o = Test.this.new d(); } }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        SourcePositions pos = Trees.instance(ct).getSourcePositions();
+
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        ExpressionTree est =
+                ((VariableTree) ((MethodTree) clazz.getMembers().get(1)).getBody().getStatements().get(0)).getInitializer();
+
+        assertEquals("testNewClassWithEnclosing",
+                97 - 24, pos.getStartPosition(cut, est));
+        assertEquals("testNewClassWithEnclosing",
+                114 - 24, pos.getEndPosition(cut, est));
+    }
+
+    public void testPreferredPositionForBinaryOp() throws IOException {
+
+        String code = "package test; public class Test {"
+                + "private void test() {"
+                + "Object o = null; boolean b = o != null && o instanceof String;"
+                + "} private Test() {}}";
+
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        MethodTree method = (MethodTree) clazz.getMembers().get(0);
+        VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1);
+        BinaryTree cond = (BinaryTree) condSt.getInitializer();
+
+        JCTree condJC = (JCTree) cond;
+        int condStartPos = code.indexOf("&&");
+        assertEquals("testPreferredPositionForBinaryOp",
+                condStartPos, condJC.pos);
+    }
+
+    public void testPositionBrokenSource126732a() throws IOException {
+        String[] commands = new String[]{
+            "return Runnable()",
+            "do { } while (true)",
+            "throw UnsupportedOperationException()",
+            "assert true",
+            "1 + 1",};
+
+        for (String command : commands) {
+
+            String code = "package test;\n"
+                    + "public class Test {\n"
+                    + "    public static void test() {\n"
+                    + "        " + command + " {\n"
+                    + "                new Runnable() {\n"
+                    + "        };\n"
+                    + "    }\n"
+                    + "}";
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
+                    null, null, Arrays.asList(new MyFileObject(code)));
+            CompilationUnitTree cut = ct.parse().iterator().next();
+
+            ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+            MethodTree method = (MethodTree) clazz.getMembers().get(0);
+            List<? extends StatementTree> statements =
+                    method.getBody().getStatements();
+
+            StatementTree ret = statements.get(0);
+            StatementTree block = statements.get(1);
+
+            Trees t = Trees.instance(ct);
+            int len = code.indexOf(command + " {") + (command + " ").length();
+            assertEquals(command, len,
+                    t.getSourcePositions().getEndPosition(cut, ret));
+            assertEquals(command, len,
+                    t.getSourcePositions().getStartPosition(cut, block));
+        }
+    }
+
+    public void testPositionBrokenSource126732b() throws IOException {
+        String[] commands = new String[]{
+            "break",
+            "break A",
+            "continue ",
+            "continue A",};
+
+        for (String command : commands) {
+
+            String code = "package test;\n"
+                    + "public class Test {\n"
+                    + "    public static void test() {\n"
+                    + "        while (true) {\n"
+                    + "            " + command + " {\n"
+                    + "                new Runnable() {\n"
+                    + "        };\n"
+                    + "        }\n"
+                    + "    }\n"
+                    + "}";
+
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
+                    null, null, Arrays.asList(new MyFileObject(code)));
+            CompilationUnitTree cut = ct.parse().iterator().next();
+
+            ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+            MethodTree method = (MethodTree) clazz.getMembers().get(0);
+            List<? extends StatementTree> statements =
+                    ((BlockTree) ((WhileLoopTree) method.getBody().getStatements().get(0)).getStatement()).getStatements();
+
+            StatementTree ret = statements.get(0);
+            StatementTree block = statements.get(1);
+
+            Trees t = Trees.instance(ct);
+            int len = code.indexOf(command + " {") + (command + " ").length();
+            assertEquals(command, len,
+                    t.getSourcePositions().getEndPosition(cut, ret));
+            assertEquals(command, len,
+                    t.getSourcePositions().getStartPosition(cut, block));
+        }
+    }
+
+    public void testErrorRecoveryForEnhancedForLoop142381() throws IOException {
+
+        String code = "package test; class Test { " +
+                "private void method() { " +
+                "java.util.Set<String> s = null; for (a : s) {} } }";
+
+        final List<Diagnostic<? extends JavaFileObject>> errors =
+                new LinkedList<Diagnostic<? extends JavaFileObject>>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+                new DiagnosticListener<JavaFileObject>() {
+            public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+                errors.add(diagnostic);
+            }
+        }, null, null, Arrays.asList(new MyFileObject(code)));
+
+        CompilationUnitTree cut = ct.parse().iterator().next();
+
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        StatementTree forStatement =
+                ((MethodTree) clazz.getMembers().get(0)).getBody().getStatements().get(1);
+
+        assertEquals("testErrorRecoveryForEnhancedForLoop142381",
+                Kind.ENHANCED_FOR_LOOP, forStatement.getKind());
+        assertFalse("testErrorRecoveryForEnhancedForLoop142381", errors.isEmpty());
+    }
+
+    public void testPositionAnnotationNoPackage187551() throws IOException {
+
+        String code = "\n@interface Test {}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        Trees t = Trees.instance(ct);
+
+        assertEquals("testPositionAnnotationNoPackage187551",
+                1, t.getSourcePositions().getStartPosition(cut, clazz));
+    }
+
+    public void testPositionsSane() throws IOException {
+        performPositionsSanityTest("package test; class Test { " +
+                "private void method() { " +
+                "java.util.List<? extends java.util.List<? extends String>> l; " +
+                "} }");
+        performPositionsSanityTest("package test; class Test { " +
+                "private void method() { " +
+                "java.util.List<? super java.util.List<? super String>> l; " +
+                "} }");
+        performPositionsSanityTest("package test; class Test { " +
+                "private void method() { " +
+                "java.util.List<? super java.util.List<?>> l; } }");
+    }
+
+    private void performPositionsSanityTest(String code) throws IOException {
+
+        final List<Diagnostic<? extends JavaFileObject>> errors =
+                new LinkedList<Diagnostic<? extends JavaFileObject>>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+                new DiagnosticListener<JavaFileObject>() {
+
+            public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+                errors.add(diagnostic);
+            }
+        }, null, null, Arrays.asList(new MyFileObject(code)));
+
+        final CompilationUnitTree cut = ct.parse().iterator().next();
+        final Trees trees = Trees.instance(ct);
+
+        new TreeScanner<Void, Void>() {
+
+            private long parentStart = 0;
+            private long parentEnd = Integer.MAX_VALUE;
+
+            @Override
+            public Void scan(Tree node, Void p) {
+                if (node == null) {
+                    return null;
+                }
+
+                long start = trees.getSourcePositions().getStartPosition(cut, node);
+
+                if (start == (-1)) {
+                    return null; //synthetic tree
+                }
+                assertTrue(node.toString() + ":" + start + "/" + parentStart,
+                        parentStart <= start);
+
+                long prevParentStart = parentStart;
+
+                parentStart = start;
+
+                long end = trees.getSourcePositions().getEndPosition(cut, node);
+
+                assertTrue(node.toString() + ":" + end + "/" + parentEnd,
+                        end <= parentEnd);
+
+                long prevParentEnd = parentEnd;
+
+                parentEnd = end;
+
+                super.scan(node, p);
+
+                parentStart = prevParentStart;
+                parentEnd = prevParentEnd;
+
+                return null;
+            }
+
+            private void assertTrue(String message, boolean b) {
+                if (!b) fail(message);
+            }
+        }.scan(cut, null);
+    }
+
+    public void testCorrectWilcardPositions() throws IOException {
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { List<? extends List<? extends String>> l; } }",
+
+                Arrays.asList("List<? extends List<? extends String>> l;",
+                "List<? extends List<? extends String>>",
+                "List",
+                "? extends List<? extends String>",
+                "List<? extends String>",
+                "List",
+                "? extends String",
+                "String"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { List<? super List<? super String>> l; } }",
+
+                Arrays.asList("List<? super List<? super String>> l;",
+                "List<? super List<? super String>>",
+                "List",
+                "? super List<? super String>",
+                "List<? super String>",
+                "List",
+                "? super String",
+                "String"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { List<? super List<?>> l; } }",
+
+                Arrays.asList("List<? super List<?>> l;",
+                "List<? super List<?>>",
+                "List",
+                "? super List<?>",
+                "List<?>",
+                "List",
+                "?"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { " +
+                "List<? extends List<? extends List<? extends String>>> l; } }",
+
+                Arrays.asList("List<? extends List<? extends List<? extends String>>> l;",
+                "List<? extends List<? extends List<? extends String>>>",
+                "List",
+                "? extends List<? extends List<? extends String>>",
+                "List<? extends List<? extends String>>",
+                "List",
+                "? extends List<? extends String>",
+                "List<? extends String>",
+                "List",
+                "? extends String",
+                "String"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { " +
+                "List<? extends List<? extends List<? extends String   >>> l; } }",
+                Arrays.asList("List<? extends List<? extends List<? extends String   >>> l;",
+                "List<? extends List<? extends List<? extends String   >>>",
+                "List",
+                "? extends List<? extends List<? extends String   >>",
+                "List<? extends List<? extends String   >>",
+                "List",
+                "? extends List<? extends String   >",
+                "List<? extends String   >",
+                "List",
+                "? extends String",
+                "String"));
+    }
+
+    public void performWildcardPositionsTest(final String code,
+            List<String> golden) throws IOException {
+
+        final List<Diagnostic<? extends JavaFileObject>> errors =
+                new LinkedList<Diagnostic<? extends JavaFileObject>>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+                new DiagnosticListener<JavaFileObject>() {
+                    public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+                        errors.add(diagnostic);
+                    }
+                }, null, null, Arrays.asList(new MyFileObject(code)));
+
+        final CompilationUnitTree cut = ct.parse().iterator().next();
+        final List<String> content = new LinkedList<String>();
+        final Trees trees = Trees.instance(ct);
+
+        new TreeScanner<Void, Void>() {
+            @Override
+            public Void scan(Tree node, Void p) {
+                if (node == null) {
+                    return null;
+                }
+                long start = trees.getSourcePositions().getStartPosition(cut, node);
+
+                if (start == (-1)) {
+                    return null; //synthetic tree
+                }
+                long end = trees.getSourcePositions().getEndPosition(cut, node);
+                String s = code.substring((int) start, (int) end);
+                content.add(s);
+
+                return super.scan(node, p);
+            }
+        }.scan(((MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0)).getBody().getStatements().get(0), null);
+
+        assertEquals("performWildcardPositionsTest",golden.toString(),
+                content.toString());
+    }
+
+    public void testStartPositionForMethodWithoutModifiers() throws IOException {
+
+        String code = "package t; class Test { <T> void t() {} }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        MethodTree mt = (MethodTree) clazz.getMembers().get(0);
+        Trees t = Trees.instance(ct);
+        int start = (int) t.getSourcePositions().getStartPosition(cut, mt);
+        int end = (int) t.getSourcePositions().getEndPosition(cut, mt);
+
+        assertEquals("testStartPositionForMethodWithoutModifiers",
+                "<T> void t() {}", code.substring(start, end));
+    }
+
+    public void testStartPositionEnumConstantInit() throws IOException {
+
+        String code = "package t; enum Test { AAA; }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        VariableTree enumAAA = (VariableTree) clazz.getMembers().get(0);
+        Trees t = Trees.instance(ct);
+        int start = (int) t.getSourcePositions().getStartPosition(cut,
+                enumAAA.getInitializer());
+
+        assertEquals("testStartPositionEnumConstantInit", -1, start);
+    }
+
+    public void testVariableInIfThen1() throws IOException {
+
+        String code = "package t; class Test { " +
+                "private static void t(String name) { " +
+                "if (name != null) String nn = name.trim(); } }";
+
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen1",
+                Arrays.<String>asList("compiler.err.variable.not.allowed"),
+                codes);
+    }
+
+    public void testVariableInIfThen2() throws IOException {
+
+        String code = "package t; class Test { " +
+                "private static void t(String name) { " +
+                "if (name != null) class X {} } }";
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen2",
+                Arrays.<String>asList("compiler.err.class.not.allowed"), codes);
+    }
+
+    public void testVariableInIfThen3() throws IOException {
+
+        String code = "package t; class Test { "+
+                "private static void t() { " +
+                "if (true) abstract class F {} }}";
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen3",
+                Arrays.<String>asList("compiler.err.class.not.allowed"), codes);
+    }
+
+    public void testVariableInIfThen4() throws IOException {
+
+        String code = "package t; class Test { "+
+                "private static void t(String name) { " +
+                "if (name != null) interface X {} } }";
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen4",
+                Arrays.<String>asList("compiler.err.class.not.allowed"), codes);
+    }
+
+    public void testVariableInIfThen5() throws IOException {
+
+        String code = "package t; class Test { "+
+                "private static void t() { " +
+                "if (true) } }";
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen5",
+                Arrays.<String>asList("compiler.err.illegal.start.of.stmt"),
+                codes);
+    }
+
+    //see javac bug #6882235, NB bug #98234:
+    public void testMissingExponent() throws IOException {
+
+        String code = "\nclass Test { { System.err.println(0e); } }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        assertNotNull(ct.parse().iterator().next());
+    }
+
+    public void testTryResourcePos() throws IOException {
+
+        final String code = "package t; class Test { " +
+                "{ try (java.io.InputStream in = null) { } } }";
+
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+
+        new TreeScanner<Void, Void>() {
+            @Override
+            public Void visitVariable(VariableTree node, Void p) {
+                if ("in".contentEquals(node.getName())) {
+                    JCTree.JCVariableDecl var = (JCTree.JCVariableDecl) node;
+                    System.out.println(node.getName() + "," + var.pos);
+                    assertEquals("testTryResourcePos", "in = null) { } } }",
+                            code.substring(var.pos));
+                }
+                return super.visitVariable(node, p);
+            }
+        }.scan(cut, null);
+    }
+
+    public void testVarPos() throws IOException {
+
+        final String code = "package t; class Test { " +
+                "{ java.io.InputStream in = null; } }";
+
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+
+        new TreeScanner<Void, Void>() {
+
+            @Override
+            public Void visitVariable(VariableTree node, Void p) {
+                if ("in".contentEquals(node.getName())) {
+                    JCTree.JCVariableDecl var = (JCTree.JCVariableDecl) node;
+                    assertEquals("testVarPos","in = null; } }",
+                            code.substring(var.pos));
+                }
+                return super.visitVariable(node, p);
+            }
+        }.scan(cut, null);
+    }
+
+    // expected erroneous tree: int x = y;(ERROR);
+    public void testOperatorMissingError() throws IOException {
+
+        String code = "package test; public class ErrorTest { "
+                + "void method() { int x = y  z } }";
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+        final List<String> values = new ArrayList<>();
+        final List<String> expectedValues =
+                new ArrayList<>(Arrays.asList("[z]"));
+
+        new TreeScanner<Void, Void>() {
+
+            @Override
+            public Void visitErroneous(ErroneousTree node, Void p) {
+
+                values.add(getErroneousTreeValues(node).toString());
+                return null;
+
+            }
+        }.scan(cut, null);
+
+        assertEquals("testSwitchError: The Erroneous tree "
+                + "error values: " + values
+                + " do not match expected error values: "
+                + expectedValues, values, expectedValues);
+    }
+
+    //expected erroneous tree:  String s = (ERROR);
+    public void testMissingParenthesisError() throws IOException {
+
+        String code = "package test; public class ErrorTest { "
+                + "void f() {String s = new String; } }";
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+        final List<String> values = new ArrayList<>();
+        final List<String> expectedValues =
+                new ArrayList<>(Arrays.asList("[new String()]"));
+
+        new TreeScanner<Void, Void>() {
+
+            @Override
+            public Void visitErroneous(ErroneousTree node, Void p) {
+
+                values.add(getErroneousTreeValues(node).toString());
+                return null;
+            }
+        }.scan(cut, null);
+
+        assertEquals("testSwitchError: The Erroneous tree "
+                + "error values: " + values
+                + " do not match expected error values: "
+                + expectedValues, values, expectedValues);
+    }
+
+    //expected erroneous tree: package test; (ERROR)(ERROR)
+    public void testMissingClassError() throws IOException {
+
+        String code = "package Test; clas ErrorTest {  "
+                + "void f() {String s = new String(); } }";
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+        final List<String> values = new ArrayList<>();
+        final List<String> expectedValues =
+                new ArrayList<>(Arrays.asList("[, clas]", "[]"));
+
+        new TreeScanner<Void, Void>() {
+
+            @Override
+            public Void visitErroneous(ErroneousTree node, Void p) {
+
+                values.add(getErroneousTreeValues(node).toString());
+                return null;
+            }
+        }.scan(cut, null);
+
+        assertEquals("testSwitchError: The Erroneous tree "
+                + "error values: " + values
+                + " do not match expected error values: "
+                + expectedValues, values, expectedValues);
+    }
+
+    //expected erroneous tree: void m1(int i) {(ERROR);{(ERROR);}
+    public void testSwitchError() throws IOException {
+
+        String code = "package test; public class ErrorTest { "
+                + "int numDays; void m1(int i) { switchh {i} { case 1: "
+                + "numDays = 31; break; } } }";
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+        final List<String> values = new ArrayList<>();
+        final List<String> expectedValues =
+                new ArrayList<>(Arrays.asList("[switchh]", "[i]"));
+
+        new TreeScanner<Void, Void>() {
+
+            @Override
+            public Void visitErroneous(ErroneousTree node, Void p) {
+
+                values.add(getErroneousTreeValues(node).toString());
+                return null;
+            }
+        }.scan(cut, null);
+
+        assertEquals("testSwitchError: The Erroneous tree "
+                + "error values: " + values
+                + " do not match expected error values: "
+                + expectedValues, values, expectedValues);
+    }
+
+    //expected erroneous tree: class ErrorTest {(ERROR)
+    public void testMethodError() throws IOException {
+
+        String code = "package Test; class ErrorTest {  "
+                + "static final void f) {String s = new String(); } }";
+        CompilationUnitTree cut = getCompilationUnitTree(code);
+        final List<String> values = new ArrayList<>();
+        final List<String> expectedValues =
+                new ArrayList<>(Arrays.asList("[\nstatic final void f();]"));
+
+        new TreeScanner<Void, Void>() {
+
+            @Override
+            public Void visitErroneous(ErroneousTree node, Void p) {
+
+                values.add(normalize(getErroneousTreeValues(node).toString()));
+                return null;
+            }
+        }.scan(cut, null);
+
+        assertEquals("testMethodError: The Erroneous tree "
+                + "error value: " + values
+                + " does not match expected error values: "
+                + expectedValues, values, expectedValues);
+    }
+
+    void testsNotWorking() throws IOException {
+
+        // Fails with nb-javac, needs further investigation
+        testPositionBrokenSource126732a();
+        testPositionBrokenSource126732b();
+
+        // Fails, these tests yet to be addressed
+        testPositionForEnumModifiers();
+        testStartPositionEnumConstantInit();
+    }
+    void testPositions() throws IOException {
+        testPositionsSane();
+        testCorrectWilcardPositions();
+        testPositionAnnotationNoPackage187551();
+        testPositionForSuperConstructorCalls();
+        testPreferredPositionForBinaryOp();
+        testStartPositionForMethodWithoutModifiers();
+        testVarPos();
+        testVariableInIfThen1();
+        testVariableInIfThen2();
+        testVariableInIfThen3();
+        testVariableInIfThen4();
+        testVariableInIfThen5();
+        testMissingExponent();
+        testTryResourcePos();
+        testOperatorMissingError();
+        testMissingParenthesisError();
+        testMissingClassError();
+        testSwitchError();
+        testMethodError();
+        testErrorRecoveryForEnhancedForLoop142381();
+    }
+
+    public static void main(String... args) throws IOException {
+        JavacParserTest jpt = new JavacParserTest("JavacParserTest");
+        jpt.testPositions();
+        System.out.println("PASS");
+    }
+}
+
+abstract class TestCase {
+
+    void assertEquals(String message, int i, int pos) {
+        if (i != pos) {
+            fail(message);
+        }
+    }
+
+    void assertFalse(String message, boolean bvalue) {
+        if (bvalue == true) {
+            fail(message);
+        }
+    }
+
+    void assertEquals(String message, int i, long l) {
+        if (i != l) {
+            fail(message + ":" + i + ":" + l);
+        }
+    }
+
+    void assertEquals(String message, Object o1, Object o2) {
+        System.out.println(o1);
+        System.out.println(o2);
+        if (o1 != null && o2 != null && !o1.equals(o2)) {
+            fail(message);
+        }
+        if (o1 == null && o2 != null) {
+            fail(message);
+        }
+    }
+
+    void assertNotNull(Object o) {
+        if (o == null) {
+            fail();
+        }
+    }
+
+    void fail() {
+        fail("test failed");
+    }
+
+    void fail(String message) {
+        throw new RuntimeException(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/parser/StringFoldingTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7068902
+ * @summary verify that string folding can be enabled or disabled
+ */
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class StringFoldingTest {
+    final JavaCompiler tool;
+    final JavaSource source;
+
+    public StringFoldingTest() {
+        tool = ToolProvider.getSystemJavaCompiler();
+        source = new JavaSource();
+    }
+
+    static class JavaSource extends SimpleJavaFileObject {
+
+        final static String source =
+                "class C {String X=\"F\" + \"O\" + \"L\" + \"D\" + \"E\" + \"D\";}";
+
+        JavaSource() {
+            super(URI.create("myfo:/C.java"), JavaFileObject.Kind.SOURCE);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    public static void main(String... args) throws IOException {
+        StringFoldingTest t = new StringFoldingTest();
+        t.run(false);
+        t.run(true);
+    }
+
+    void run(boolean disableStringFolding) throws IOException {
+        List<String> argsList = new ArrayList<String>();
+        if (disableStringFolding) {
+            argsList.add("-XDallowStringFolding=false");
+        }
+        JavacTask ct = (JavacTask)tool.getTask(null, null, null,
+                argsList,
+                null,
+                Arrays.asList(source));
+        Iterable<? extends CompilationUnitTree> trees = ct.parse();
+        String text = trees.toString();
+        System.out.println(text);
+
+        if (disableStringFolding) {
+            if (text.contains("FOLDED")) {
+                throw new AssertionError("Expected string folding");
+            }
+        } else {
+            if (!text.contains("FOLDED")) {
+                throw new AssertionError("Expected no string folding");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/parser/T4881269.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4881269
+ * @summary improve diagnostic for ill-formed tokens
+ * @compile/fail/ref=T4881269.out -XDrawDiagnostics T4881269.java
+ */
+
+public class T4881269 {
+    java.io..PrintStream s;
+    void m() { System.err..println(); }
+    void m(Object.. o) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/parser/T4881269.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,9 @@
+T4881269.java:32:13: compiler.err.illegal.dot
+T4881269.java:33:27: compiler.err.illegal.dot
+T4881269.java:33:22: compiler.err.not.stmt
+T4881269.java:34:19: compiler.err.illegal.dot
+T4881269.java:34:20: compiler.err.expected: ';'
+T4881269.java:34:22: compiler.err.illegal.start.of.type
+T4881269.java:34:23: compiler.err.expected: token.identifier
+T4881269.java:34:25: compiler.err.expected: ';'
+8 errors
--- a/test/tools/javac/processing/TestWarnErrorCount.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/TestWarnErrorCount.java	Tue May 29 00:27:58 2012 +0100
@@ -327,7 +327,7 @@
             Writer out = fo.openWriter();
             try {
                 out.write("class " + name + " {\n"
-                        + (warn ? "    int i = (int) 0;\n" : "")
+                        + (warn ? "    void m() throws Exception { try (AutoCloseable ac = null) { } }" : "")
                         + (error ? "   ERROR\n" : "")
                         + "}\n");
             } finally {
--- a/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,14 @@
  * @summary Test that annotation processor options with illegal syntax are rejected
  * @author  Joseph D. Darcy
  * @library ../../lib
- * @build JavacTestingAbstractProcessor
+ * @build JavacTestingAbstractProcessor CompileFail
  * @compile TestOptionSyntaxErrors.java
- * @compile/fail -A TestOptionSyntaxErrors.java
- * @compile/fail -A8adOption TestOptionSyntaxErrors.java
- * @compile/fail -A8adOption=1worseOption TestOptionSyntaxErrors.java
- * @compile/fail -processor TestOptionSyntaxErrors -proc:only -A TestOptionSyntaxErrors.java
- * @compile/fail -processor TestOptionSyntaxErrors -proc:only -A8adOption TestOptionSyntaxErrors.java
- * @compile/fail -processor TestOptionSyntaxErrors -proc:only -A8adOption=1worseOption TestOptionSyntaxErrors.java
+ * @run main CompileFail CMDERR -A TestOptionSyntaxErrors.java
+ * @run main CompileFail CMDERR -A8adOption TestOptionSyntaxErrors.java
+ * @run main CompileFail CMDERR -A8adOption=1worseOption TestOptionSyntaxErrors.java
+ * @run main CompileFail CMDERR -processor TestOptionSyntaxErrors -proc:only -A TestOptionSyntaxErrors.java
+ * @run main CompileFail CMDERR -processor TestOptionSyntaxErrors -proc:only -A8adOption TestOptionSyntaxErrors.java
+ * @run main CompileFail CMDERR -processor TestOptionSyntaxErrors -proc:only -A8adOption=1worseOption TestOptionSyntaxErrors.java
  */
 
 import java.util.Set;
--- a/test/tools/javac/processing/errors/TestReturnCode.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/errors/TestReturnCode.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,25 +27,25 @@
  * @summary Test that an erroneous return code results from raising an error.
  * @author  Joseph D. Darcy
  * @library ../../lib
- * @build JavacTestingAbstractProcessor
+ * @build JavacTestingAbstractProcessor CompileFail
  * @compile TestReturnCode.java
  *
- * @compile      -processor TestReturnCode -proc:only                                                                   Foo.java
- * @compile/fail -processor TestReturnCode -proc:only                                                    -AErrorOnFirst Foo.java
- * @compile/fail -processor TestReturnCode -proc:only                                      -AErrorOnLast                Foo.java
- * @compile/fail -processor TestReturnCode -proc:only                                      -AErrorOnLast -AErrorOnFirst Foo.java
- * @compile/fail -processor TestReturnCode -proc:only                   -AExceptionOnFirst                              Foo.java
- * @compile/fail -processor TestReturnCode -proc:only                   -AExceptionOnFirst               -AErrorOnFirst Foo.java
- * @compile/fail -processor TestReturnCode -proc:only                   -AExceptionOnFirst -AErrorOnLast                Foo.java
- * @compile/fail -processor TestReturnCode -proc:only                   -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast                                                 Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast                                  -AErrorOnFirst Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast                    -AErrorOnLast                Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast                    -AErrorOnLast -AErrorOnFirst Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst                              Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst               -AErrorOnFirst Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast                Foo.java
- * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java
+ * @compile                     -processor TestReturnCode -proc:only                                                                   Foo.java
+ * @run main CompileFail ERROR  -processor TestReturnCode -proc:only                                                    -AErrorOnFirst Foo.java
+ * @run main CompileFail ERROR  -processor TestReturnCode -proc:only                                      -AErrorOnLast                Foo.java
+ * @run main CompileFail ERROR  -processor TestReturnCode -proc:only                                      -AErrorOnLast -AErrorOnFirst Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only                   -AExceptionOnFirst                              Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only                   -AExceptionOnFirst               -AErrorOnFirst Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only                   -AExceptionOnFirst -AErrorOnLast                Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only                   -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast                                                 Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast                                  -AErrorOnFirst Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast                    -AErrorOnLast                Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast                    -AErrorOnLast -AErrorOnFirst Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst                              Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst               -AErrorOnFirst Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast                Foo.java
+ * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java
  */
 
 import java.util.Set;
--- a/test/tools/javac/processing/errors/TestSuppression.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/errors/TestSuppression.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 import javax.tools.*;
 
 import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.ClientCodeWrapper;
 import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.util.JCDiagnostic;
 
@@ -171,7 +172,7 @@
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             System.err.println((++total) + ": "
-                    + "resolveError:" + isResolveError((JCDiagnostic) diagnostic) + "\n"
+                    + "resolveError:" + isResolveError(unwrap(diagnostic)) + "\n"
                     + diagnostic);
             Diagnostic.Kind dk = diagnostic.getKind();
             Integer c = counts.get(dk);
@@ -181,6 +182,14 @@
         private static boolean isResolveError(JCDiagnostic d) {
             return d.isFlagSet(RESOLVE_ERROR);
         }
+
+        private JCDiagnostic unwrap(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic instanceof JCDiagnostic)
+                return (JCDiagnostic) diagnostic;
+            if (diagnostic instanceof ClientCodeWrapper.DiagnosticSourceUnwrapper)
+                return ((ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic).d;
+            throw new IllegalArgumentException();
+        }
     }
 
     @SupportedAnnotationTypes("*")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/loader/testClose/TestClose.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7092965
+ * @summary javac should not close processorClassLoader before end of compilation
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.api.ClientCodeWrapper.Trusted;
+import com.sun.tools.javac.api.BasicJavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.util.Context;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+/*
+ * The test compiles an annotation processor and a helper class into a
+ * custom classes directory.
+ *
+ * It then uses them while compiling a dummy file, with the custom classes
+ * directory on the processor path, thus guaranteeing that references to
+ * these class are satisfied by the processor class loader.
+ *
+ * The annotation processor uses the javac TaskListener to run code
+ * after annotation processing has completed, to verify that the classloader
+ * is not closed until the end of the compilation.
+ */
+
+@Trusted // avoids use of ClientCodeWrapper
+public class TestClose implements TaskListener {
+    public static final String annoProc =
+        "import java.util.*;\n" +
+        "import javax.annotation.processing.*;\n" +
+        "import javax.lang.model.*;\n" +
+        "import javax.lang.model.element.*;\n" +
+        "import com.sun.source.util.*;\n" +
+        "import com.sun.tools.javac.processing.*;\n" +
+        "import com.sun.tools.javac.util.*;\n" +
+        "@SupportedAnnotationTypes(\"*\")\n" +
+        "public class AnnoProc extends AbstractProcessor {\n" +
+        "    @Override\n" +
+        "    public SourceVersion getSupportedSourceVersion() {\n" +
+        "        return SourceVersion.latest();\n" +
+        "    }\n" +
+        "    @Override\n" +
+        "    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {\n" +
+        "        System.out.println(\"in AnnoProc.process\");\n" +
+        "        final ClassLoader cl = getClass().getClassLoader();\n" +
+        "        if (roundEnv.processingOver()) {\n" +
+        "            TestClose.add(processingEnv, new Runnable() {\n" +
+        "                public void run() {\n" +
+        "                    System.out.println(getClass().getName() + \": run()\");\n" +
+        "                    try {\n" +
+        "                        cl.loadClass(\"Callback\")\n" +
+        "                            .asSubclass(Runnable.class)\n" +
+        "                            .newInstance()\n" +
+        "                            .run();\n" +
+        "                    } catch (ReflectiveOperationException e) {\n" +
+        "                        throw new Error(e);\n" +
+        "                    }\n" +
+        "                }\n" +
+        "            });\n" +
+        "        }\n" +
+        "        return true;\n" +
+        "    }\n" +
+        "}\n";
+
+    public static final String callback =
+        "public class Callback implements Runnable {\n" +
+        "    public void run() {\n" +
+        "        System.out.println(getClass().getName() + \": run()\");\n" +
+        "    }\n" +
+        "}";
+
+    public static void main(String... args) throws Exception {
+        new TestClose().run();
+    }
+
+    void run() throws IOException {
+        JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+        File classes = new File("classes");
+        classes.mkdirs();
+        File extraClasses = new File("extraClasses");
+        extraClasses.mkdirs();
+
+        System.out.println("compiling classes to extraClasses");
+        {   // setup class in extraClasses
+            fm.setLocation(StandardLocation.CLASS_OUTPUT,
+                    Collections.singleton(extraClasses));
+            List<? extends JavaFileObject> files = Arrays.asList(
+                    new MemFile("AnnoProc.java", annoProc),
+                    new MemFile("Callback.java", callback));
+            JavacTask task = tool.getTask(null, fm, null, null, null, files);
+            check(task.call());
+        }
+
+        System.out.println("compiling dummy to classes with anno processor");
+        {   // use that class in a TaskListener after processing has completed
+            PrintStream prev = System.out;
+            String out;
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            try (PrintStream ps = new PrintStream(baos)) {
+                System.setOut(ps);
+                File testClasses = new File(System.getProperty("test.classes"));
+                fm.setLocation(StandardLocation.CLASS_OUTPUT,
+                        Collections.singleton(classes));
+                fm.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH,
+                        Arrays.asList(extraClasses, testClasses));
+                List<? extends JavaFileObject> files = Arrays.asList(
+                        new MemFile("my://dummy", "class Dummy { }"));
+                List<String> options = Arrays.asList("-processor", "AnnoProc");
+                JavacTask task = tool.getTask(null, fm, null, options, null, files);
+                task.setTaskListener(this);
+                check(task.call());
+            } finally {
+                System.setOut(prev);
+                out = baos.toString();
+                if (!out.isEmpty())
+                    System.out.println(out);
+            }
+            check(out.contains("AnnoProc$1: run()"));
+            check(out.contains("Callback: run()"));
+        }
+    }
+
+    @Override
+    public void started(TaskEvent e) {
+        System.out.println("Started: " + e);
+    }
+
+    @Override
+    public void finished(TaskEvent e) {
+        System.out.println("Finished: " + e);
+        if (e.getKind() == TaskEvent.Kind.ANALYZE) {
+            for (Runnable r: runnables) {
+                System.out.println("running " + r);
+                r.run();
+            }
+        }
+    }
+
+    void check(boolean b) {
+        if (!b)
+            throw new AssertionError();
+    }
+
+    public static void add(ProcessingEnvironment env, Runnable r) {
+        try {
+            JavacTask task = JavacTask.instance(env);
+            TaskListener l = ((BasicJavacTask) task).getTaskListeners().iterator().next();
+            // The TaskListener is an instanceof TestClose, but when using the
+            // default class loaders. the taskListener uses a different
+            // instance of Class<TestClose> than the anno processor.
+            // If you try to evaluate
+            //      TestClose tc = (TestClose) (l).
+            // you get the following somewhat confusing error:
+            //   java.lang.ClassCastException: TestClose cannot be cast to TestClose
+            // The workaround is to access the fields of TestClose with reflection.
+            Field f = l.getClass().getField("runnables");
+            @SuppressWarnings("unchecked")
+            List<Runnable> runnables = (List<Runnable>) f.get(l);
+            runnables.add(r);
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+    }
+
+    public List<Runnable> runnables = new ArrayList<>();
+
+    class MemFile extends SimpleJavaFileObject {
+        public final String text;
+
+        MemFile(String name, String text) {
+            super(URI.create(name), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+
+        @Override
+        public String getName() {
+            return uri.toString();
+        }
+
+        @Override
+        public String getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/loader/testClose/TestClose2.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7092965
+ * @summary javac should not close processorClassLoader before end of compilation
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Context;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+@SupportedAnnotationTypes("*")
+public class TestClose2 extends AbstractProcessor implements TaskListener {
+
+    public static void main(String... args) throws Exception {
+        new TestClose2().run();
+    }
+
+    void run() throws IOException {
+        File testSrc = new File(System.getProperty("test.src"));
+        File testClasses = new File(System.getProperty("test.classes"));
+
+        JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
+        final ClassLoader cl = getClass().getClassLoader();
+        Context c = new Context();
+        StandardJavaFileManager fm = new JavacFileManager(c, true, null) {
+            @Override
+            protected ClassLoader getClassLoader(URL[] urls) {
+                return new URLClassLoader(urls, cl) {
+                    @Override
+                    public void close() throws IOException {
+                        System.err.println(getClass().getName() + " closing");
+                        TestClose2.this.closedCount++;
+                        TestClose2.this.closedIsLast = true;
+                        super.close();
+                    }
+                };
+            }
+        };
+
+        fm.setLocation(StandardLocation.CLASS_OUTPUT,
+                Collections.singleton(new File(".")));
+        fm.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH,
+                Collections.singleton(testClasses));
+        Iterable<? extends JavaFileObject> files =
+                fm.getJavaFileObjects(new File(testSrc, TestClose2.class.getName() + ".java"));
+        List<String> options = Arrays.asList(
+                "-processor", TestClose2.class.getName());
+
+        JavacTask task = tool.getTask(null, fm, null, options, null, files);
+        task.setTaskListener(this);
+
+        if (!task.call())
+            throw new Error("compilation failed");
+
+        if (closedCount == 0)
+            throw new Error("no closing message");
+        else if (closedCount > 1)
+            throw new Error(closedCount + " closed messages");
+
+        if (!closedIsLast)
+            throw new Error("closing message not last");
+    }
+
+    // AbstractProcessor methods
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        Messager messager = processingEnv.getMessager();
+        messager.printMessage(Diagnostic.Kind.NOTE, "processing");
+        return true;
+    }
+
+    // TaskListener methods
+
+    @Override
+    public void started(TaskEvent e) {
+        System.err.println("Started: " + e);
+        closedIsLast = false;
+    }
+
+    @Override
+    public void finished(TaskEvent e) {
+        System.err.println("Finished: " + e);
+        closedIsLast = false;
+    }
+
+    //
+
+    int closedCount = 0;
+    boolean closedIsLast = false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/messager/MessagerDiags.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7166010
+ * @summary  warnings printed by annotation processors uses incorrect source
+ */
+import com.sun.source.util.JavacTask;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+import static javax.tools.Diagnostic.Kind.*;
+import static javax.tools.JavaFileObject.Kind.*;
+
+@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedAnnotationTypes("*")
+public class MessagerDiags extends AbstractProcessor {
+    static final String CNAME = "Test";
+    static final String TEST_JAVA = CNAME + ".java";
+    static final String TEST_JAVA_URI_NAME = "myfo:/" + TEST_JAVA;
+    static final String WRN_NO_SOURCE   = "warning without source";
+    static final String WRN_WITH_SOURCE = "warning with source";
+    static final String NONE = "<none>";
+    static final String[] EXPECTED = { NONE + ":-1--1:" + WRN_NO_SOURCE,
+                                       TEST_JAVA + ":0-13:" + WRN_WITH_SOURCE,
+                                       NONE + ":-1--1:" + WRN_NO_SOURCE
+    };
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        Messager messager = processingEnv.getMessager();
+        for (Element e : roundEnv.getRootElements()) {
+            messager.printMessage(WARNING, WRN_NO_SOURCE);
+            messager.printMessage(WARNING, WRN_WITH_SOURCE, e);
+            messager.printMessage(WARNING, WRN_NO_SOURCE);
+        }
+        return false;
+    }
+
+    public static void main(String... args) throws IOException {
+        final String bootPath = System.getProperty("sun.boot.class.path");
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        assert tool != null;
+
+        DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<>();
+        List<String> options = new LinkedList<>();
+        options.addAll(Arrays.asList("-bootclasspath",  bootPath,
+                        "-source", "1.6", "-classpath",
+                        System.getProperty("java.class.path")));
+        options.addAll(Arrays.asList("-processor",
+                       MessagerDiags.class.getName()));
+        JavacTask ct = (JavacTask)tool.getTask(null, null, dc, options, null,
+                        Arrays.asList(new MyFileObject("class " + CNAME + " {}")));
+        ct.analyze();
+
+        List<String> obtainedErrors = new ArrayList<>();
+
+        for (Diagnostic<? extends JavaFileObject> d : dc.getDiagnostics()) {
+            String dSource;
+            if (d.getSource() != null) {
+                dSource = d.getSource().toUri().getPath();
+                dSource = dSource.substring(dSource.lastIndexOf('/') + 1);
+            } else {
+                dSource = NONE;
+            }
+            obtainedErrors.add(dSource + ":" + d.getStartPosition() + "-" +
+                    d.getEndPosition() + ":" + d.getMessage(null));
+        }
+        List<String> expectedErrors = Arrays.asList(EXPECTED);
+        if (!expectedErrors.equals(obtainedErrors)) {
+            System.err.println("Expected: " + expectedErrors);
+            System.err.println("Obtained: " + obtainedErrors);
+            throw new AssertionError("Messages don't match");
+        }
+    }
+
+    static class MyFileObject extends SimpleJavaFileObject {
+        private String text;
+        public MyFileObject(String text) {
+            super(URI.create(TEST_JAVA_URI_NAME), SOURCE);
+            this.text = text;
+        }
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+    }
+}
--- a/test/tools/javac/processing/model/6194785/T6194785.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/model/6194785/T6194785.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug     6194785
  * @summary ParameterDeclaration.getSimpleName does not return actual name from class files
@@ -40,9 +40,8 @@
 
 public class T6194785 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
-                           RoundEnvironment roundEnvironment)
-    {
-        class Scan extends ElementScanner7<Void,Void> {
+                           RoundEnvironment roundEnvironment) {
+        class Scan extends ElementScanner<Void,Void> {
             @Override
             public Void visitExecutable(ExecutableElement e, Void ignored) {
                 for (VariableElement p : e.getParameters())
--- a/test/tools/javac/processing/model/TestSymtabItems.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/model/TestSymtabItems.java	Tue May 29 00:27:58 2012 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7021183
+ * @bug 7021183 7025809
  * @summary 269: assertion failure getting enclosing element of an undefined name
  */
 
@@ -37,9 +37,7 @@
 import javax.lang.model.element.VariableElement;
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.type.UnknownTypeException;
-import javax.lang.model.util.ElementScanner7;
-import javax.lang.model.util.SimpleTypeVisitor7;
-import javax.lang.model.util.Types;
+import javax.lang.model.util.*;
 
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symtab;
@@ -112,7 +110,7 @@
 
     int errors;
 
-    class ElemPrinter extends ElementScanner7<Void, Void> {
+    class ElemPrinter extends ElementScanner8<Void, Void> {
         @Override
         public Void visitPackage(PackageElement e, Void p) {
             show("package", e);
--- a/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Tue May 29 00:27:58 2012 +0100
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @bug 6639645 7026414
+ * @bug 6639645 7026414 7025809
  * @summary Modeling type implementing missing interfaces
  * @library ../../../../lib
  * @build JavacTestingAbstractProcessor TestMissingElement
@@ -104,7 +104,7 @@
     private String asString(TypeMirror t) {
         if (t == null)
             return "[typ:null]";
-        return t.accept(new SimpleTypeVisitor7<String, Void>() {
+        return t.accept(new SimpleTypeVisitor<String, Void>() {
             @Override
             public String defaultAction(TypeMirror t, Void ignore) {
                 return "[typ:" + t.toString() + "]";
@@ -135,7 +135,7 @@
     private String asString(Element e) {
         if (e == null)
             return "[elt:null]";
-        return e.accept(new SimpleElementVisitor7<String, Void>() {
+        return e.accept(new SimpleElementVisitor<String, Void>() {
             @Override
             public String defaultAction(Element e, Void ignore) {
                 return "[elt:" + e.getKind() + " " + e.toString() + "]";
--- a/test/tools/javac/processing/model/element/TestResourceVariable.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/model/element/TestResourceVariable.java	Tue May 29 00:27:58 2012 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug  6911256 6964740 6967842 6961571
+ * @bug  6911256 6964740 6967842 6961571 7025809
  * @summary Test that the resource variable kind is appropriately set
  * @author  Joseph D. Darcy
  * @library ../../../lib
@@ -44,8 +44,8 @@
 
 /**
  * Using the tree API, retrieve element representations of the
- * resource of an ARM block and verify their kind tags are set
- * appropriately.
+ * resource of a try-with-resources statement and verify their kind
+ * tags are set appropriately.
  */
 public class TestResourceVariable extends JavacTestingAbstractProcessor implements AutoCloseable {
     int resourceVariableCount = 0;
@@ -82,7 +82,7 @@
 
     /**
      * Verify that a resource variable modeled as an element behaves
-     * as expected under 6 and 7 specific visitors.
+     * as expected under 6 and latest specific visitors.
      */
     private static void testResourceVariable(Element element) {
         ElementVisitor visitor6 = new ElementKindVisitor6<Void, Void>() {};
@@ -94,7 +94,8 @@
             ; // Expected.
         }
 
-        ElementKindVisitor7 visitor7 = new ElementKindVisitor7<Object, Void>() {
+        ElementKindVisitor visitorLatest =
+            new ElementKindVisitor<Object, Void>() {
             @Override
             public Object visitVariableAsResourceVariable(VariableElement e,
                                                           Void p) {
@@ -102,7 +103,7 @@
             }
         };
 
-        if (visitor7.visit(element) == null) {
+        if (visitorLatest.visit(element) == null) {
             throw new RuntimeException("Null result of resource variable visitation.");
         }
     }
--- a/test/tools/javac/processing/model/type/NoTypes.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/model/type/NoTypes.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     6418666 6423973 6453386
+ * @bug     6418666 6423973 6453386 7025809
  * @summary Test the NoTypes: VOID, PACKAGE, NONE
  * @author  Scott Seligman
  * @library ../../../lib
@@ -75,7 +75,7 @@
         verifyKind(NONE, types.getNoType(NONE));
 
         // The return type of a constructor or void method is VOID.
-        class Scanner extends ElementScanner7<Void, Void> {
+        class Scanner extends ElementScanner<Void, Void> {
             @Override
             public Void visitExecutable(ExecutableElement e, Void p) {
                 verifyKind(VOID, e.getReturnType());
@@ -89,11 +89,11 @@
     }
 
     /**
-     * Verify that a NoType instance is of a particular kind,
-     * and that TypeKindVisitor7 properly dispatches on it.
+     * Verify that a NoType instance is of a particular kind, and that
+     * the latest TypeKindVisitor properly dispatches on it.
      */
     private void verifyKind(TypeKind kind, TypeMirror type) {
-        class Vis extends TypeKindVisitor7<TypeKind, Void> {
+        class Vis extends TypeKindVisitor<TypeKind, Void> {
             @Override
             public TypeKind visitNoTypeAsVoid(NoType t, Void p) {
                 return VOID;
@@ -111,9 +111,7 @@
             throw new AssertionError();
     }
 
-
     // Fodder for the tests
-
     interface I {
     }
 
--- a/test/tools/javac/processing/model/type/TestUnionType.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/model/type/TestUnionType.java	Tue May 29 00:27:58 2012 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     7029150
+ * @bug     7029150 7025809
  * @summary Test support for union types
  * @library ../../../lib
  */
@@ -39,7 +39,6 @@
 import com.sun.source.tree.*;
 import com.sun.source.util.*;
 
-
 public class TestUnionType extends JavacTestingAbstractProcessor {
     enum TestKind {
         SingleType("E1", "E1",
@@ -194,7 +193,7 @@
         }
     }
 
-    class TypePrinter extends SimpleTypeVisitor7<String, Void> {
+    class TypePrinter extends SimpleTypeVisitor<String, Void> {
         @Override
         protected String defaultAction(TypeMirror tm, Void ignore) {
             return String.valueOf(tm.getKind());
--- a/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
         return true;
     }
 
-    private class DeprecationChecker extends ElementScanner7<Boolean,Void> {
+    private class DeprecationChecker extends ElementScanner<Boolean,Void> {
         private Elements elementUtils;
         private boolean failure;
         DeprecationChecker() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6987384
+ * @summary -XprintProcessorRoundsInfo message printed with different timing than previous
+ * @library ../../../lib
+ * @build JavacTestingAbstractProcessor Test TestWithXstdout
+ * @run main TestWithXstdout
+ */
+
+import java.io.*;
+import java.nio.charset.*;
+import java.nio.file.*;
+import java.util.*;
+
+public class TestWithXstdout {
+    public static void main(String... args) throws Exception {
+        File testSrc = new File(System.getProperty("test.src"));
+        File testClasses = new File(System.getProperty("test.classes"));
+        File stdout = new File("stdout.out");
+        run_javac("-XDrawDiagnostics",
+                "-XprintProcessorInfo",
+                "-Werror",
+                "-proc:only",
+                "-processor",  "Test",
+                "-Xstdout", stdout.getPath(),
+                "-classpath", testClasses.getPath(),
+                new File(testSrc, "Test.java").getPath());
+        boolean ok = compare(stdout, new File(testSrc, "Test.out"));
+        if (!ok)
+            throw new Exception("differences found");
+    }
+
+    static void run_javac(String... args) throws IOException, InterruptedException {
+        File javaHome = new File(System.getProperty("java.home"));
+        if (javaHome.getName().equals("jre"))
+            javaHome = javaHome.getParentFile();
+        File javac = new File(new File(javaHome, "bin"), "javac");
+
+        List<String> opts = new ArrayList<>();
+        opts.add(javac.getPath());
+
+        String toolOpts = System.getProperty("test.tool.vm.opts");
+        if (toolOpts != null && !"".equals(toolOpts.trim())) {
+            opts.addAll(Arrays.asList(toolOpts.trim().split("[\\s]+")));
+        }
+        opts.addAll(Arrays.asList(args));
+        System.out.println("exec: " + opts);
+        ProcessBuilder pb = new ProcessBuilder(opts);
+        pb.redirectErrorStream();
+        Process p = pb.start();
+        try (BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
+            String line;
+            while ((line = r.readLine()) != null)
+                System.out.println();
+        }
+        int rc = p.waitFor();
+        if (rc != 0)
+            System.out.println("javac exited, rc=" + rc);
+    }
+
+    static boolean compare(File a, File b) throws IOException {
+        List<String> aLines = Files.readAllLines(a.toPath(), Charset.defaultCharset());
+        List<String> bLines = Files.readAllLines(b.toPath(), Charset.defaultCharset());
+        System.out.println(a + ": " + aLines.size() + " lines");
+        System.out.println(b + ": " + bLines.size() + " lines");
+        return aLines.equals(bLines);
+    }
+}
--- a/test/tools/javac/quid/T6999438.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/quid/T6999438.out	Tue May 29 00:27:58 2012 +0100
@@ -1,4 +1,4 @@
-T6999438.java:8:9: compiler.err.illegal.char: 35
+T6999438.java:8:8: compiler.err.expected: token.identifier
 T6999438.java:8:10: compiler.err.illegal.start.of.type
 T6999438.java:8:25: compiler.err.expected: token.identifier
 T6999438.java:8:26: compiler.err.expected: ';'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/Candidate.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@interface Candidate {
+    /**
+     * the candidate position (line/col of the method call for which this candidate
+     * is a potential overload candidate)
+     */
+    Pos pos() default @Pos(userDefined=false);
+    /**
+     * resolution phases for which this candidate is applicable
+     */
+    Phase[] applicable() default { };
+    /**
+     * is this candidate the most specific (in the resolution phases for which it
+     * is also applicable)
+     */
+    boolean mostSpecific() default false;
+    /**
+     * this candidate inferred signature (in the resolution phases for which it
+     * is also applicable, in case it corresponds to a generic method)
+     */
+    String sig() default "";
+}
+
+enum Phase {
+    BASIC("BASIC"),
+    BOX("BOX"),
+    VARARGS("VARARITY");
+
+    final String javacString;
+
+    private Phase(String javacString) {
+        this.javacString = javacString;
+    }
+
+    static Phase fromString(String s) {
+        for (Phase phase : Phase.values()) {
+            if (phase.javacString.equals(s)) {
+                return phase;
+            }
+        }
+        throw new AssertionError("Invalid resolution phase string " + s);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/Pos.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.ANNOTATION_TYPE)
+@interface Pos {
+    long line() default -1;
+    long col() default -1;
+    boolean userDefined() default true;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/ResolveHarness.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,475 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7098660
+ * @summary Write better overload resolution/inference tests
+ * @library ../lib
+ * @build JavacTestingAbstractProcessor ResolveHarness
+ * @run main ResolveHarness
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper;
+import com.sun.tools.javac.code.Type.MethodType;
+import com.sun.tools.javac.util.JCDiagnostic;
+
+import java.io.File;
+import java.util.Set;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+import static javax.tools.StandardLocation.*;
+
+public class ResolveHarness implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+    static int nerrors = 0;
+
+    static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+    static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+    public static void main(String[] args) throws Exception {
+        fm.setLocation(SOURCE_PATH,
+                Arrays.asList(new File(System.getProperty("test.src"), "tests")));
+        for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(JavaFileObject.Kind.SOURCE), true)) {
+            new ResolveHarness(jfo).check();
+        }
+        if (nerrors > 0) {
+            throw new AssertionError("Errors were found");
+        }
+    }
+
+
+    JavaFileObject jfo;
+    DiagnosticProcessor[] diagProcessors;
+    Map<ElementKey, Candidate> candidatesMap = new HashMap<ElementKey, Candidate>();
+    Set<String> declaredKeys = new HashSet<>();
+    List<Diagnostic<? extends JavaFileObject>> diags = new ArrayList<>();
+    List<ElementKey> seenCandidates = new ArrayList<>();
+
+    protected ResolveHarness(JavaFileObject jfo) {
+        this.jfo = jfo;
+        this.diagProcessors = new DiagnosticProcessor[] {
+            new VerboseResolutionNoteProcessor(),
+            new VerboseDeferredInferenceNoteProcessor(),
+            new ErrorProcessor()
+        };
+    }
+
+    protected void check() throws Exception {
+        String[] options = {
+            "-XDshouldStopPolicy=ATTR",
+            "-XDverboseResolution=success,failure,applicable,inapplicable,deferred-inference"
+        };
+
+        AbstractProcessor[] processors = { new ResolveCandidateFinder(), null };
+
+        @SuppressWarnings("unchecked")
+        DiagnosticListener<? super JavaFileObject>[] diagListeners =
+                new DiagnosticListener[] { new DiagnosticHandler(false), new DiagnosticHandler(true) };
+
+        for (int i = 0 ; i < options.length ; i ++) {
+            JavacTask ct = (JavacTask)comp.getTask(null, fm, diagListeners[i],
+                    Arrays.asList(options[i]), null, Arrays.asList(jfo));
+            if (processors[i] != null) {
+                ct.setProcessors(Collections.singleton(processors[i]));
+            }
+            ct.analyze();
+        }
+
+        //check diags
+        for (Diagnostic<? extends JavaFileObject> diag : diags) {
+            for (DiagnosticProcessor proc : diagProcessors) {
+                if (proc.matches(diag)) {
+                    proc.process(diag);
+                    break;
+                }
+            }
+        }
+        //check all candidates have been used up
+        for (Map.Entry<ElementKey, Candidate> entry : candidatesMap.entrySet()) {
+            if (!seenCandidates.contains(entry.getKey())) {
+                error("Redundant @Candidate annotation on method " + entry.getKey().elem);
+            }
+        }
+    }
+
+    public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+        diags.add(diagnostic);
+    }
+
+    Candidate getCandidateAtPos(Element methodSym, long line, long col) {
+        Candidate c = candidatesMap.get(new ElementKey(methodSym));
+        if (c != null) {
+            Pos pos = c.pos();
+            if (!pos.userDefined() ||
+                    (pos.line() == line && pos.col() == col)) {
+                seenCandidates.add(new ElementKey(methodSym));
+                return c;
+            }
+        } else {
+            error("Missing @Candidate annotation on method " + methodSym);
+        }
+        return null;
+    }
+
+    void checkSig(Candidate c, Element methodSym, MethodType mtype) {
+        if (c.sig().length() > 0 && !c.sig().equals(mtype.toString())) {
+            error("Inferred type mismatch for method: " + methodSym);
+        }
+    }
+
+    protected void error(String msg) {
+        nerrors++;
+        System.err.printf("Error occurred while checking file: %s\nreason: %s\n", jfo.getName(), msg);
+    }
+
+    /**
+     * Base class for diagnostic processor. It provides methods for matching and
+     * processing a given diagnostic object (overridden by subclasses).
+     */
+    abstract class DiagnosticProcessor {
+
+        List<String> codes;
+        Diagnostic.Kind kind;
+
+        public DiagnosticProcessor(Kind kind, String... codes) {
+            this.codes = Arrays.asList(codes);
+            this.kind = kind;
+        }
+
+        abstract void process(Diagnostic<? extends JavaFileObject> diagnostic);
+
+        boolean matches(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return (codes.isEmpty() || codes.contains(diagnostic.getCode())) &&
+                    diagnostic.getKind() == kind;
+        }
+
+        JCDiagnostic asJCDiagnostic(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic instanceof JCDiagnostic) {
+                return (JCDiagnostic)diagnostic;
+            } else if (diagnostic instanceof DiagnosticSourceUnwrapper) {
+                return ((DiagnosticSourceUnwrapper)diagnostic).d;
+            } else {
+                throw new AssertionError("Cannot convert diagnostic to JCDiagnostic: " + diagnostic.getClass().getName());
+            }
+        }
+
+        List<JCDiagnostic> subDiagnostics(Diagnostic<? extends JavaFileObject> diagnostic) {
+            JCDiagnostic diag = asJCDiagnostic(diagnostic);
+            if (diag instanceof JCDiagnostic.MultilineDiagnostic) {
+                return ((JCDiagnostic.MultilineDiagnostic)diag).getSubdiagnostics();
+            } else {
+                throw new AssertionError("Cannot extract subdiagnostics: " + diag.getClass().getName());
+            }
+        }
+    }
+
+    /**
+     * Processor for verbose resolution notes generated by javac. The processor
+     * checks that the diagnostic is associated with a method declared by
+     * a class annotated with the special @TraceResolve marker annotation. If
+     * that's the case, all subdiagnostics (one for each resolution candidate)
+     * are checked against the corresponding @Candidate annotations, using
+     * a VerboseCandidateSubdiagProcessor.
+     */
+    class VerboseResolutionNoteProcessor extends DiagnosticProcessor {
+
+        VerboseResolutionNoteProcessor() {
+            super(Kind.NOTE,
+                    "compiler.note.verbose.resolve.multi",
+                    "compiler.note.verbose.resolve.multi.1");
+        }
+
+        @Override
+        void process(Diagnostic<? extends JavaFileObject> diagnostic) {
+            Element siteSym = getSiteSym(diagnostic);
+            if (siteSym.getAnnotation(TraceResolve.class) == null) {
+                return;
+            }
+            int candidateIdx = 0;
+            for (JCDiagnostic d : subDiagnostics(diagnostic)) {
+                boolean isMostSpecific = candidateIdx++ == mostSpecific(diagnostic);
+                VerboseCandidateSubdiagProcessor subProc =
+                        new VerboseCandidateSubdiagProcessor(isMostSpecific, phase(diagnostic), success(diagnostic));
+                if (subProc.matches(d)) {
+                    subProc.process(d);
+                } else {
+                    throw new AssertionError("Bad subdiagnostic: " + d.getCode());
+                }
+            }
+        }
+
+        Element getSiteSym(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return (Element)asJCDiagnostic(diagnostic).getArgs()[1];
+        }
+
+        int mostSpecific(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return success(diagnostic) ?
+                    (Integer)asJCDiagnostic(diagnostic).getArgs()[2] : -1;
+        }
+
+        boolean success(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return diagnostic.getCode().equals("compiler.note.verbose.resolve.multi");
+        }
+
+        Phase phase(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return Phase.fromString(asJCDiagnostic(diagnostic).getArgs()[3].toString());
+        }
+    }
+
+    /**
+     * Processor for verbose resolution subdiagnostic notes generated by javac.
+     * The processor checks that the details of the overload candidate
+     * match against the info contained in the corresponding @Candidate
+     * annotation (if any).
+     */
+    class VerboseCandidateSubdiagProcessor extends DiagnosticProcessor {
+
+        boolean mostSpecific;
+        Phase phase;
+        boolean success;
+
+        public VerboseCandidateSubdiagProcessor(boolean mostSpecific, Phase phase, boolean success) {
+            super(Kind.OTHER,
+                    "compiler.misc.applicable.method.found",
+                    "compiler.misc.applicable.method.found.1",
+                    "compiler.misc.not.applicable.method.found");
+            this.mostSpecific = mostSpecific;
+            this.phase = phase;
+            this.success = success;
+        }
+
+        @Override
+        void process(Diagnostic<? extends JavaFileObject> diagnostic) {
+            Element methodSym = methodSym(diagnostic);
+            Candidate c = getCandidateAtPos(methodSym,
+                    asJCDiagnostic(diagnostic).getLineNumber(),
+                    asJCDiagnostic(diagnostic).getColumnNumber());
+            if (c == null) {
+                return; //nothing to check
+            }
+
+            if (c.applicable().length == 0 && c.mostSpecific()) {
+                error("Inapplicable method cannot be most specific " + methodSym);
+            }
+
+            if (isApplicable(diagnostic) != Arrays.asList(c.applicable()).contains(phase)) {
+                error("Invalid candidate's applicability " + methodSym);
+            }
+
+            if (success) {
+                for (Phase p : c.applicable()) {
+                    if (phase.ordinal() < p.ordinal()) {
+                        error("Invalid phase " + p + " on method " + methodSym);
+                    }
+                }
+            }
+
+            if (Arrays.asList(c.applicable()).contains(phase)) { //applicable
+                if (c.mostSpecific() != mostSpecific) {
+                    error("Invalid most specific value for method " + methodSym);
+                }
+                MethodType mtype = getSig(diagnostic);
+                if (mtype != null) {
+                    checkSig(c, methodSym, mtype);
+                }
+            }
+        }
+
+        boolean isApplicable(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return !diagnostic.getCode().equals("compiler.misc.not.applicable.method.found");
+        }
+
+        Element methodSym(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return (Element)asJCDiagnostic(diagnostic).getArgs()[1];
+        }
+
+        MethodType getSig(Diagnostic<? extends JavaFileObject> diagnostic) {
+            JCDiagnostic details = (JCDiagnostic)asJCDiagnostic(diagnostic).getArgs()[2];
+            if (details == null) {
+                return null;
+            } else if (details instanceof JCDiagnostic) {
+                return details.getCode().equals("compiler.misc.full.inst.sig") ?
+                        (MethodType)details.getArgs()[0] : null;
+            } else {
+                throw new AssertionError("Bad diagnostic arg: " + details);
+            }
+        }
+    }
+
+    /**
+     * Processor for verbose deferred inference notes generated by javac. The
+     * processor checks that the inferred signature for a given generic method
+     * call corresponds to the one (if any) declared in the @Candidate annotation.
+     */
+    class VerboseDeferredInferenceNoteProcessor extends DiagnosticProcessor {
+
+        public VerboseDeferredInferenceNoteProcessor() {
+            super(Kind.NOTE, "compiler.note.deferred.method.inst");
+        }
+
+        @Override
+        void process(Diagnostic<? extends JavaFileObject> diagnostic) {
+            Element methodSym = methodSym(diagnostic);
+            Candidate c = getCandidateAtPos(methodSym,
+                    asJCDiagnostic(diagnostic).getLineNumber(),
+                    asJCDiagnostic(diagnostic).getColumnNumber());
+            MethodType sig = sig(diagnostic);
+            if (c != null && sig != null) {
+                checkSig(c, methodSym, sig);
+            }
+        }
+
+        Element methodSym(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return (Element)asJCDiagnostic(diagnostic).getArgs()[0];
+        }
+
+        MethodType sig(Diagnostic<? extends JavaFileObject> diagnostic) {
+            return (MethodType)asJCDiagnostic(diagnostic).getArgs()[1];
+        }
+    }
+
+    /**
+     * Processor for all error diagnostics; if the error key is not declared in
+     * the test file header, the processor reports an error.
+     */
+    class ErrorProcessor extends DiagnosticProcessor {
+
+        public ErrorProcessor() {
+            super(Diagnostic.Kind.ERROR);
+        }
+
+        @Override
+        void process(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (!declaredKeys.contains(diagnostic.getCode())) {
+                error("Unexpected compilation error key '" + diagnostic.getCode() + "'");
+            }
+        }
+    }
+
+    @SupportedAnnotationTypes({"Candidate","TraceResolve"})
+    class ResolveCandidateFinder extends JavacTestingAbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (roundEnv.processingOver())
+                return true;
+
+            TypeElement traceResolveAnno = elements.getTypeElement("TraceResolve");
+            TypeElement candidateAnno = elements.getTypeElement("Candidate");
+
+            if (!annotations.contains(traceResolveAnno)) {
+                error("no @TraceResolve annotation found in test class");
+            }
+
+            if (!annotations.contains(candidateAnno)) {
+                error("no @candidate annotation found in test class");
+            }
+
+            for (Element elem: roundEnv.getElementsAnnotatedWith(traceResolveAnno)) {
+                TraceResolve traceResolve = elem.getAnnotation(TraceResolve.class);
+                declaredKeys.addAll(Arrays.asList(traceResolve.keys()));
+            }
+
+            for (Element elem: roundEnv.getElementsAnnotatedWith(candidateAnno)) {
+                candidatesMap.put(new ElementKey(elem), elem.getAnnotation(Candidate.class));
+            }
+            return true;
+        }
+    }
+
+    class ElementKey {
+
+        String key;
+        Element elem;
+
+        public ElementKey(Element elem) {
+            this.elem = elem;
+            this.key = computeKey(elem);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof ElementKey) {
+                ElementKey other = (ElementKey)obj;
+                return other.key.equals(key);
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            return key.hashCode();
+        }
+
+        String computeKey(Element e) {
+            StringBuilder buf = new StringBuilder();
+            while (e != null) {
+                buf.append(e.toString());
+                e = e.getEnclosingElement();
+            }
+            buf.append(jfo.getName());
+            return buf.toString();
+        }
+
+        @Override
+        public String toString() {
+            return "Key{"+key+"}";
+        }
+    }
+
+    class DiagnosticHandler implements DiagnosticListener<JavaFileObject> {
+
+        boolean shouldRecordDiags;
+
+        DiagnosticHandler(boolean shouldRecordDiags) {
+            this.shouldRecordDiags = shouldRecordDiags;
+        }
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (shouldRecordDiags)
+                diags.add(diagnostic);
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/TraceResolve.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@interface TraceResolve {
+    String[] keys() default {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/BoxedReturnTypeInference.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class BoxedReturnTypeInference {
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Byte", mostSpecific=true)
+    static <B> B m_byte() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Short", mostSpecific=true)
+    static <S> S m_short() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Integer", mostSpecific=true)
+    static <I> I m_int() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Long", mostSpecific=true)
+    static <L> L m_long() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Float", mostSpecific=true)
+    static <F> F m_float() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Double", mostSpecific=true)
+    static <D> D m_double() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Character", mostSpecific=true)
+    static <C> C m_char() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Boolean", mostSpecific=true)
+    static <Z> Z m_bool() { return null; }
+
+    {
+        Byte b = m_byte();
+        Short s = m_short();
+        Integer i = m_int();
+        Long l = m_long();
+        Float f = m_float();
+        Double d = m_double();
+        Character c= m_char();
+        Boolean z = m_bool();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/PrimitiveOverReferenceOverInferred.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class PrimitiveOverReference {
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_byte(byte b) {}
+    @Candidate
+    static void m_byte(Byte b) {}
+    @Candidate
+    static <B> void m_byte(B b) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_short(short s) {}
+    @Candidate
+    static void m_short(Short s) {}
+    @Candidate
+    static <S> void m_short(S s) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_int(int i) {}
+    @Candidate
+    static void m_int(Integer i) {}
+    @Candidate
+    static <I> void m_int(I i) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_long(long l) {}
+    @Candidate
+    static void m_long(Long l) {}
+    @Candidate
+    static <L> void m_long(L l) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_float(float f) {}
+    @Candidate
+    static void m_float(Float f) {}
+    @Candidate
+    static <F> void m_float(F f) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_double(double d) {}
+    @Candidate
+    static void m_double(Double d) {}
+    @Candidate
+    static <D> void m_double(D d) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_char(char c) {}
+    @Candidate
+    static void m_char(Character c) {}
+    @Candidate
+    static <C> void m_char(C c) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_bool(boolean z) {}
+    @Candidate
+    static void m_bool(Boolean z) {}
+    @Candidate
+    static <Z> void m_bool(Z z) {}
+
+    {
+        m_byte((byte)0);
+        m_short((short)0);
+        m_int(0);
+        m_long(0L);
+        m_float(0.0f);
+        m_double(0.0);
+        m_char('?');
+        m_bool(false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/PrimitiveOverReferenceOverVarargs.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class PrimitiveOverReference {
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_byte(byte b) {}
+    @Candidate
+    static void m_byte(Byte b) {}
+    @Candidate
+    static void m_byte(byte... b) {}
+    @Candidate
+    static void m_byte(Byte... b) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_short(short s) {}
+    @Candidate
+    static void m_short(Short s) {}
+    @Candidate
+    static void m_short(short... s) {}
+    @Candidate
+    static void m_short(Short... s) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_int(int i) {}
+    @Candidate
+    static void m_int(Integer i) {}
+    @Candidate
+    static void m_int(int... i) {}
+    @Candidate
+    static void m_int(Integer... i) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_long(long l) {}
+    @Candidate
+    static void m_long(Long l) {}
+    @Candidate
+    static void m_long(long... l) {}
+    @Candidate
+    static void m_long(Long... l) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_float(float f) {}
+    @Candidate
+    static void m_float(Float f) {}
+    @Candidate
+    static void m_float(float... f) {}
+    @Candidate
+    static void m_float(Float... f) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_double(double d) {}
+    @Candidate
+    static void m_double(Double d) {}
+    @Candidate
+    static void m_double(double... d) {}
+    @Candidate
+    static void m_double(Double... d) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_char(char c) {}
+    @Candidate
+    static void m_char(Character c) {}
+    @Candidate
+    static void m_char(char... c) {}
+    @Candidate
+    static void m_char(Character... c) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_bool(boolean z) {}
+    @Candidate
+    static void m_bool(Boolean z) {}
+    @Candidate
+    static void m_bool(boolean... z) {}
+    @Candidate
+    static void m_bool(Boolean... z) {}
+
+    {
+        m_byte((byte)0);
+        m_short((short)0);
+        m_int(0);
+        m_long(0L);
+        m_float(0.0f);
+        m_double(0.0);
+        m_char('?');
+        m_bool(false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/PrimitiveOverReferenceVarargsAmbiguous.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve(keys={"compiler.err.ref.ambiguous"})
+class PrimitiveOverReferenceVarargsAmbiguous {
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_byte(byte... b) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_byte(Byte... b) {}
+
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_short(short... s) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_short(Short... s) {}
+
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_int(int... i) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_int(Integer... i) {}
+
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_long(long... l) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_long(Long... l) {}
+
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_float(float... f) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_float(Float... f) {}
+
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_double(double... d) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_double(Double... d) {}
+
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_char(char... c) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_char(Character... c) {}
+
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_bool(boolean... z) {}
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    static void m_bool(Boolean... z) {}
+
+    {
+        m_byte((byte)0);
+        m_short((short)0);
+        m_int(0);
+        m_long(0L);
+        m_float(0.0f);
+        m_double(0.0);
+        m_char('?');
+        m_bool(false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/PrimitiveOverload.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class PrimitiveOverload {
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_byte(byte b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_byte(short b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_byte(int b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_byte(long b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_byte(float b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_byte(double b) {}
+
+    @Candidate
+    static void m_short(byte b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_short(short b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_short(int b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_short(long b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_short(float b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_short(double b) {}
+
+    @Candidate
+    static void m_int(byte b) {}
+    @Candidate
+    static void m_int(short b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_int(int b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_int(long b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_int(float b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_int(double b) {}
+
+    @Candidate
+    static void m_long(byte b) {}
+    @Candidate
+    static void m_long(short b) {}
+    @Candidate
+    static void m_long(int b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_long(long b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_long(float b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_long(double b) {}
+
+    @Candidate
+    static void m_float(byte b) {}
+    @Candidate
+    static void m_float(short b) {}
+    @Candidate
+    static void m_float(int b) {}
+    @Candidate
+    static void m_float(long b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_float(float b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_float(double b) {}
+
+    @Candidate
+    static void m_double(byte b) {}
+    @Candidate
+    static void m_double(short b) {}
+    @Candidate
+    static void m_double(int b) {}
+    @Candidate
+    static void m_double(long b) {}
+    @Candidate
+    static void m_double(float b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_double(double b) {}
+
+    {
+        m_byte((byte)0);
+        m_short((short)0);
+        m_int(0);
+        m_long(0L);
+        m_float(0.0f);
+        m_double(0.0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/PrimitiveReturnTypeInference.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class PrimitiveReturnTypeInference {
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Byte", mostSpecific=true)
+    static <B> B m_byte() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Short", mostSpecific=true)
+    static <S> S m_short() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Integer", mostSpecific=true)
+    static <I> I m_int() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Long", mostSpecific=true)
+    static <L> L m_long() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Float", mostSpecific=true)
+    static <F> F m_float() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Double", mostSpecific=true)
+    static <D> D m_double() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Character", mostSpecific=true)
+    static <C> C m_char() { return null; }
+
+    @Candidate(applicable=Phase.BASIC, sig="()java.lang.Boolean", mostSpecific=true)
+    static <Z> Z m_bool() { return null; }
+
+    {
+        byte b = m_byte();
+        short s = m_short();
+        int i = m_int();
+        long l = m_long();
+        float f = m_float();
+        double d = m_double();
+        char c= m_char();
+        boolean z = m_bool();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/ReferenceOverInferred.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class PrimitiveOverInferred {
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_byte(Byte b) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Byte)void")
+    static <B> void m_byte(B b) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_short(Short s) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Short)void")
+    static <S> void m_short(S s) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_int(Integer i) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Integer)void")
+    static <I> void m_int(I i) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_long(Long l) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Long)void")
+    static <L> void m_long(L l) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_float(Float f) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Float)void")
+    static <F> void m_float(F f) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_double(Double d) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Double)void")
+    static <D> void m_double(D d) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_char(Character c) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Character)void")
+    static <C> void m_char(C c) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_bool(Boolean z) {}
+    @Candidate(applicable=Phase.BOX, sig="(java.lang.Boolean)void")
+    static <Z> void m_bool(Z z) {}
+
+    {
+        m_byte((byte)0);
+        m_short((short)0);
+        m_int(0);
+        m_long(0L);
+        m_float(0.0f);
+        m_double(0.0);
+        m_char('?');
+        m_bool(false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/ReferenceOverVarargs.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class ReferenceOverVarargs {
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_byte(Byte b) {}
+    @Candidate
+    static void m_byte(byte... b) {}
+    @Candidate
+    static void m_byte(Byte... b) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_short(Short s) {}
+    @Candidate
+    static void m_short(short... s) {}
+    @Candidate
+    static void m_short(Short... s) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_int(Integer i) {}
+    @Candidate
+    static void m_int(int... i) {}
+    @Candidate
+    static void m_int(Integer... i) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_long(Long l) {}
+    @Candidate
+    static void m_long(long... l) {}
+    @Candidate
+    static void m_long(Long... l) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_float(Float f) {}
+    @Candidate
+    static void m_float(float... f) {}
+    @Candidate
+    static void m_float(Float... f) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_double(Double d) {}
+    @Candidate
+    static void m_double(double... d) {}
+    @Candidate
+    static void m_double(Double... d) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_char(Character c) {}
+    @Candidate
+    static void m_char(char... c) {}
+    @Candidate
+    static void m_char(Character... c) {}
+
+    @Candidate(applicable=Phase.BOX, mostSpecific=true)
+    static void m_bool(Boolean z) {}
+    @Candidate
+    static void m_bool(boolean... z) {}
+    @Candidate
+    static void m_bool(Boolean... z) {}
+
+    {
+        m_byte((byte)0);
+        m_short((short)0);
+        m_int(0);
+        m_long(0L);
+        m_float(0.0f);
+        m_double(0.0);
+        m_char('?');
+        m_bool(false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/ReferenceOverload.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve
+class ReferenceOverload {
+
+    static class A {}
+    static class B extends A {}
+    static class C extends B {}
+    static class D extends C {}
+    static class E extends D {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_A(A a) {}
+    @Candidate
+    static void m_A(B a) {}
+    @Candidate
+    static void m_A(C a) {}
+    @Candidate
+    static void m_A(D a) {}
+    @Candidate
+    static void m_A(E a) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_B(A b) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_B(B b) {}
+    @Candidate
+    static void m_B(C b) {}
+    @Candidate
+    static void m_B(D b) {}
+    @Candidate
+    static void m_B(E b) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_C(A c) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_C(B c) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_C(C c) {}
+    @Candidate
+    static void m_C(D c) {}
+    @Candidate
+    static void m_C(E c) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_D(A d) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_D(B d) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_D(C d) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_D(D d) {}
+    @Candidate
+    static void m_D(E d) {}
+
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_E(A e) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_E(B e) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_E(C e) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=false)
+    static void m_E(D e) {}
+    @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+    static void m_E(E e) {}
+
+    {
+        m_A((A)null);
+        m_B((B)null);
+        m_C((C)null);
+        m_D((D)null);
+        m_E((E)null);
+    }
+}
--- a/test/tools/javac/stackmap/T4955930.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/stackmap/T4955930.sh	Tue May 29 00:27:58 2012 +0100
@@ -41,7 +41,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows_95 | Windows_98 | Windows_NT )
--- a/test/tools/javac/tree/AbstractTreeScannerTest.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/tree/AbstractTreeScannerTest.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -274,7 +274,7 @@
         return fields;
     }
     // where
-    Map<Integer, Set<Field>> map = new HashMap<Integer,Set<Field>>();
+    Map<JCTree.Tag, Set<Field>> map = new HashMap<JCTree.Tag,Set<Field>>();
 
     /** Get the line number for the primary position for a tree.
      * The code is intended to be simple, although not necessarily efficient.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/tree/DocCommentToplevelTest.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7096014
+ * @summary Javac tokens should retain state
+ */
+
+import com.sun.source.tree.*;
+import com.sun.source.util.*;
+import com.sun.tools.javac.tree.JCTree;
+
+import java.net.URI;
+import java.util.*;
+import javax.tools.*;
+
+
+public class DocCommentToplevelTest {
+
+    enum PackageKind {
+        HAS_PKG("package pkg;"),
+        NO_PKG("");
+
+        String pkgStr;
+
+        PackageKind(String pkgStr) {
+            this.pkgStr = pkgStr;
+        }
+    }
+
+    enum ImportKind {
+        ZERO(""),
+        ONE("import java.lang.*;"),
+        TWO("import java.lang.*; import java.util.*;");
+
+        String importStr;
+
+        ImportKind(String importStr) {
+            this.importStr = importStr;
+        }
+    }
+
+    enum ModifierKind {
+        DEFAULT(""),
+        PUBLIC("public");
+
+        String modStr;
+
+        ModifierKind(String modStr) {
+            this.modStr = modStr;
+        }
+    }
+
+    enum ToplevelDocKind {
+        HAS_DOC("/** Toplevel! */"),
+        NO_DOC("");
+
+        String docStr;
+
+        ToplevelDocKind(String docStr) {
+            this.docStr = docStr;
+        }
+    }
+
+    static int errors;
+    static int checks;
+
+    public static void main(String... args) throws Exception {
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (PackageKind pk : PackageKind.values()) {
+            for (ImportKind ik : ImportKind.values()) {
+                for (ModifierKind mk1 : ModifierKind.values()) {
+                    for (ModifierKind mk2 : ModifierKind.values()) {
+                        for (ToplevelDocKind tdk : ToplevelDocKind.values()) {
+                            new DocCommentToplevelTest(pk, ik, mk1, mk2, tdk).run(comp, fm);
+                        }
+                    }
+                }
+            }
+        }
+
+        if (errors > 0)
+            throw new AssertionError(errors + " errors found");
+
+        System.out.println(checks + " checks were made");
+    }
+
+    PackageKind pk;
+    ImportKind ik;
+    ModifierKind mk1;
+    ModifierKind mk2;
+    ToplevelDocKind tdk;
+    JavaSource source;
+
+    DocCommentToplevelTest(PackageKind pk, ImportKind ik, ModifierKind mk1, ModifierKind mk2, ToplevelDocKind tdk) {
+        this.pk = pk;
+        this.ik = ik;
+        this.mk1 = mk1;
+        this.mk2 = mk2;
+        this.tdk = tdk;
+        source = new JavaSource();
+    }
+
+    void run(JavaCompiler comp, JavaFileManager fm) throws Exception {
+        JavacTask task = (JavacTask)comp.getTask(null, fm, null, Arrays.asList("-printsource"), null, Arrays.asList(source));
+        for (CompilationUnitTree cu: task.parse()) {
+            check(cu);
+        }
+    }
+
+    void check(CompilationUnitTree cu) {
+        checks++;
+
+        new TreeScanner<ClassTree,Void>() {
+
+            Map<JCTree, String> docComments;
+
+            @Override
+            public ClassTree visitCompilationUnit(CompilationUnitTree node, Void unused) {
+                docComments = ((JCTree.JCCompilationUnit)node).docComments;
+                boolean expectedComment = tdk == ToplevelDocKind.HAS_DOC &&
+                        (pk != PackageKind.NO_PKG || ik != ImportKind.ZERO);
+                boolean foundComment = docComments.get(node) != null;
+                if (expectedComment != foundComment) {
+                    error("Unexpected comment " + docComments.get(node) + " on toplevel");
+                }
+                return super.visitCompilationUnit(node, null);
+            }
+
+            @Override
+            public ClassTree visitClass(ClassTree node, Void unused) {
+                boolean expectedComment = tdk == ToplevelDocKind.HAS_DOC &&
+                        pk == PackageKind.NO_PKG && ik == ImportKind.ZERO &&
+                        node.getSimpleName().toString().equals("First");
+                boolean foundComment = docComments.get(node) != null;
+                if (expectedComment != foundComment) {
+                    error("Unexpected comment " + docComments.get(node) + " on class " + node.getSimpleName());
+                }
+                return super.visitClass(node, unused);
+            }
+        }.scan(cu, null);
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        System.err.println("Source: " + source.source);
+        errors++;
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "#D\n#P\n#I\n" +
+                          "#M1 class First { }\n" +
+                          "#M2 class Second { }\n";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replace("#P", pk.pkgStr)
+                             .replace("#I", ik.importStr)
+                             .replace("#M1", mk1.modStr)
+                             .replace("#M2", mk2.modStr)
+                             .replace("#D", tdk.docStr);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/tree/TestToString.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7080267
+ * @summary Call to toString() from an ExpressionStatementTree doesn't take in
+ *      consideration the ";" at the end
+ */
+
+import com.sun.source.tree.BlockTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.StatementTree;
+import com.sun.source.tree.Tree;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreeScanner;
+import com.sun.tools.javac.api.JavacTool;
+
+public class TestToString {
+    String[] statements = {
+        "i = i + 1;",
+        "i++;",
+        "m();",
+        ";",
+        "if (i == 0) return;",
+        "while (i > 0) i--;",
+        "{ }",
+        "{ i++; }",
+        "class C { }"
+    };
+
+    public static void main(String... args) throws Exception {
+        new TestToString().run();
+    }
+
+    void run() throws Exception {
+        for (String s: statements) {
+            test(s);
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    void test(String stmt) throws IOException {
+        System.err.println("Test: " + stmt);
+        List<String> options = Collections.<String>emptyList();
+        List<? extends JavaFileObject> files = Arrays.asList(new JavaSource(stmt));
+        JavacTask t = tool.getTask(null, fm, null, options, null, files);
+        checkEqual(scan(t.parse()), stmt);
+    }
+
+    String scan(Iterable<? extends CompilationUnitTree> trees) {
+        class Scanner extends TreeScanner<Void,StringBuilder> {
+            String scan(Iterable<? extends Tree> trees) {
+                StringBuilder sb = new StringBuilder();
+                scan(trees, sb);
+                return sb.toString();
+            }
+            @Override
+            public Void scan(Tree tree, StringBuilder sb) {
+                if (print && tree instanceof StatementTree) {
+                    sb.append(PREFIX);
+                    sb.append(tree);
+                    sb.append(SUFFIX);
+                    return null;
+                } else {
+                    return super.scan(tree, sb);
+                }
+            }
+            @Override
+            public Void visitBlock(BlockTree tree, StringBuilder sb) {
+                print = true;
+                try {
+                    return super.visitBlock(tree, sb);
+                } finally {
+                    print = false;
+                }
+            }
+            boolean print = false;
+        }
+        return new Scanner().scan(trees);
+    }
+
+    void checkEqual(String found, String expect) {
+        boolean match = (found == null) ? (expect == null) :
+            expect.equals(found
+                .replaceAll("^\\Q" + PREFIX + "\\E\\s*", "")
+                .replaceAll("\\s*\\Q" + SUFFIX + "\\E$", "")
+                .replaceAll("\\s+", " "));
+
+        if (!match)
+            error("Mismatch: expected: " + expect + " found: " + found);
+    }
+
+
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    static final String PREFIX = "#<";
+    static final String SUFFIX = "#>";
+
+    JavacTool tool = JavacTool.create();
+    StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+    int errors = 0;
+
+    static class JavaSource extends SimpleJavaFileObject {
+
+        String source =
+                "class Test {\n" +
+                "    int i;\n" +
+                "    void m() {\n" +
+                "        #S\n" +
+                "    }\n" +
+                "}";
+
+        public JavaSource(String stmt) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = source.replace("#S", stmt);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- a/test/tools/javac/tree/TreePosTest.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/tree/TreePosTest.java	Tue May 29 00:27:58 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,6 +73,7 @@
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.parser.EndPosTable;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.tree.JCTree.JCNewClass;
@@ -80,6 +81,7 @@
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.tree.TreeScanner;
 
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
 import static com.sun.tools.javac.util.Position.NOPOS;
 
 /**
@@ -291,6 +293,14 @@
         errors++;
     }
 
+    /**
+     * Names for tree tags.
+     */
+    private static String getTagName(JCTree.Tag tag) {
+        String name = tag.name();
+        return (name == null) ? "??" : name;
+    }
+
     /** Number of files that have been analyzed. */
     int fileCount;
     /** Number of errors reported. */
@@ -312,8 +322,6 @@
     Set<File> excludeFiles = new HashSet<File>();
     /** Set of tag names to be excluded from analysis. */
     Set<String> excludeTags = new HashSet<String>();
-    /** Table of printable names for tree tag values. */
-    TagNames tagNames = new TagNames();
 
     /**
      * Main class for testing assertions concerning tree positions for tree nodes.
@@ -337,7 +345,7 @@
                 // there is no corresponding source text.
                 // Redundant semicolons in a class definition can cause empty
                 // initializer blocks with no positions.
-                if ((self.tag == JCTree.MODIFIERS || self.tag == JCTree.BLOCK)
+                if ((self.tag == MODIFIERS || self.tag == BLOCK)
                         && self.pos == NOPOS) {
                     // If pos is NOPOS, so should be the start and end positions
                     check("start == NOPOS", encl, self, self.start == NOPOS);
@@ -359,15 +367,15 @@
                     //    e.g.    int[][] a = new int[2][];
                     check("encl.start <= start", encl, self, encl.start <= self.start);
                     check("start <= pos", encl, self, self.start <= self.pos);
-                    if (!(self.tag == JCTree.TYPEARRAY
-                            && (encl.tag == JCTree.VARDEF ||
-                                encl.tag == JCTree.METHODDEF ||
-                                encl.tag == JCTree.TYPEARRAY))) {
+                    if (!(self.tag == TYPEARRAY
+                            && (encl.tag == VARDEF ||
+                                encl.tag == METHODDEF ||
+                                encl.tag == TYPEARRAY))) {
                         check("encl.pos <= start || end <= encl.pos",
                                 encl, self, encl.pos <= self.start || self.end <= encl.pos);
                     }
                     check("pos <= end", encl, self, self.pos <= self.end);
-                    if (!(self.tag == JCTree.TYPEARRAY && encl.tag == JCTree.TYPEARRAY)) {
+                    if (!(self.tag == TYPEARRAY && encl.tag == TYPEARRAY)) {
                         check("end <= encl.end", encl, self, self.end <= encl.end);
                     }
                 }
@@ -388,7 +396,7 @@
             if ((tree.mods.flags & Flags.ENUM) != 0) {
                 scan(tree.mods);
                 if (tree.init != null) {
-                    if (tree.init.getTag() == JCTree.NEWCLASS) {
+                    if (tree.init.hasTag(NEWCLASS)) {
                         JCNewClass init = (JCNewClass) tree.init;
                         if (init.args != null && init.args.nonEmpty()) {
                             scan(init.args);
@@ -404,11 +412,11 @@
 
         boolean check(Info encl, Info self) {
             if (excludeTags.size() > 0) {
-                if (encl != null && excludeTags.contains(tagNames.get(encl.tag))
-                        || excludeTags.contains(tagNames.get(self.tag)))
+                if (encl != null && excludeTags.contains(getTagName(encl.tag))
+                        || excludeTags.contains(getTagName(self.tag)))
                     return false;
             }
-            return tags.size() == 0 || tags.contains(tagNames.get(self.tag));
+            return tags.size() == 0 || tags.contains(getTagName(self.tag));
         }
 
         void check(String label, Info encl, Info self, boolean ok) {
@@ -428,7 +436,7 @@
         }
 
         JavaFileObject sourcefile;
-        Map<JCTree, Integer> endPosTable;
+        EndPosTable endPosTable;
         Info encl;
 
     }
@@ -439,13 +447,13 @@
     private class Info {
         Info() {
             tree = null;
-            tag = JCTree.ERRONEOUS;
+            tag = ERRONEOUS;
             start = 0;
             pos = 0;
             end = Integer.MAX_VALUE;
         }
 
-        Info(JCTree tree, Map<JCTree, Integer> endPosTable) {
+        Info(JCTree tree, EndPosTable endPosTable) {
             this.tree = tree;
             tag = tree.getTag();
             start = TreeInfo.getStartPos(tree);
@@ -455,46 +463,17 @@
 
         @Override
         public String toString() {
-            return tagNames.get(tree.getTag()) + "[start:" + start + ",pos:" + pos + ",end:" + end + "]";
+            return getTagName(tree.getTag()) + "[start:" + start + ",pos:" + pos + ",end:" + end + "]";
         }
 
         final JCTree tree;
-        final int tag;
+        final JCTree.Tag tag;
         final int start;
         final int pos;
         final int end;
     }
 
     /**
-     * Names for tree tags.
-     * javac does not provide an API to convert tag values to strings, so this class uses
-     * reflection to determine names of public static final int values in JCTree.
-     */
-    private static class TagNames {
-        String get(int tag) {
-            if (map == null) {
-                map = new HashMap<Integer, String>();
-                Class c = JCTree.class;
-                for (Field f : c.getDeclaredFields()) {
-                    if (f.getType().equals(int.class)) {
-                        int mods = f.getModifiers();
-                        if (Modifier.isPublic(mods) && Modifier.isStatic(mods) && Modifier.isFinal(mods)) {
-                            try {
-                                map.put(f.getInt(null), f.getName());
-                            } catch (IllegalAccessException e) {
-                            }
-                        }
-                    }
-                }
-            }
-            String name = map.get(tag);
-            return (name == null) ? "??" : name;
-        }
-
-        private Map<Integer, String> map;
-    }
-
-    /**
      * Thrown when errors are found parsing a java file.
      */
     private static class ParseException extends Exception {
@@ -719,7 +698,7 @@
 
             void setInfo(Info info) {
                 this.info = info;
-                tagName.setText(tagNames.get(info.tag));
+                tagName.setText(getTagName(info.tag));
                 start.setText(String.valueOf(info.start));
                 pos.setText(String.valueOf(info.pos));
                 end.setText(String.valueOf(info.end));
--- a/test/tools/javac/types/CastObjectToPrimitiveTest.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/types/CastObjectToPrimitiveTest.out	Tue May 29 00:27:58 2012 +0100
@@ -1,2 +1,2 @@
-CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Object, int
+CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Object, int)
 1 error
--- a/test/tools/javac/unicode/SupplementaryJavaID6.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/unicode/SupplementaryJavaID6.sh	Tue May 29 00:27:58 2012 +0100
@@ -55,7 +55,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     if [ -d /usr/lib/locale/en_US.UTF-8 -o -d /usr/lib/locale/en_US.utf8 ]
     then
         ENV="env LANG=en_US.UTF-8"
--- a/test/tools/javac/util/T6597678.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/util/T6597678.java	Tue May 29 00:27:58 2012 +0100
@@ -41,6 +41,7 @@
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.JavacMessages;
+import com.sun.tools.javac.util.Log;
 
 @SupportedOptions("WriterString")
 public class T6597678 extends JavacTestingAbstractProcessor {
@@ -78,7 +79,10 @@
     @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
-        PrintWriter out = ((JavacProcessingEnvironment) processingEnv).getWriter();
+        Log log = Log.instance(context);
+        PrintWriter noteOut = log.getWriter(Log.WriterKind.NOTICE);
+        PrintWriter warnOut = log.getWriter(Log.WriterKind.WARNING);
+        PrintWriter errOut  = log.getWriter(Log.WriterKind.ERROR);
         Locale locale = context.get(Locale.class);
         JavacMessages messages = context.get(JavacMessages.messagesKey);
 
@@ -86,13 +90,20 @@
         if (round == 1) {
             initialLocale = locale;
             initialMessages = messages;
-            initialWriter = out;
+            initialNoteWriter = noteOut;
+            initialWarnWriter = warnOut;
+            initialErrWriter  = errOut;
 
-            checkEqual("writerString", out.toString().intern(), options.get("WriterString").intern());
+            String writerStringOpt = options.get("WriterString").intern();
+            checkEqual("noteWriterString", noteOut.toString().intern(), writerStringOpt);
+            checkEqual("warnWriterString", warnOut.toString().intern(), writerStringOpt);
+            checkEqual("errWriterString",  errOut.toString().intern(),  writerStringOpt);
         } else {
             checkEqual("locale", locale, initialLocale);
             checkEqual("messages", messages, initialMessages);
-            checkEqual("writer", out, initialWriter);
+            checkEqual("noteWriter", noteOut, initialNoteWriter);
+            checkEqual("warnWriter", warnOut, initialWarnWriter);
+            checkEqual("errWriter",  errOut,  initialErrWriter);
         }
 
         return true;
@@ -109,5 +120,7 @@
     int round = 0;
     Locale initialLocale;
     JavacMessages initialMessages;
-    PrintWriter initialWriter;
+    PrintWriter initialNoteWriter;
+    PrintWriter initialWarnWriter;
+    PrintWriter initialErrWriter;
 }
--- a/test/tools/javac/util/context/T7021650.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/util/context/T7021650.java	Tue May 29 00:27:58 2012 +0100
@@ -101,13 +101,13 @@
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
         Main m = new Main("javac", pw);
-        int rc = m.compile(args, context);
+        Main.Result res = m.compile(args, context);
         pw.close();
         String out = sw.toString();
         if (!out.isEmpty())
             System.err.println(out);
-        if (rc != 0)
-            throw new Exception("compilation failed unexpectedly: rc=" + rc);
+        if (!res.isOK())
+            throw new Exception("compilation failed unexpectedly: result=" + res);
     }
 
     void checkEqual(String label, int found, int expect) throws Exception {
--- a/test/tools/javac/varargs/6313164/T6313164.out	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/varargs/6313164/T6313164.out	Tue May 29 00:27:58 2012 +0100
@@ -1,6 +1,6 @@
 T6313164.java:12:8: compiler.err.cant.apply.symbol.1: kindname.method, foo1, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
-T6313164.java:14:13: compiler.err.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
-T6313164.java:15:13: compiler.err.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
+T6313164.java:14:13: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164))
+T6313164.java:15:13: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164))
 - compiler.note.unchecked.filename: B.java
 - compiler.note.unchecked.recompile
 3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/varargs/7097436/T7097436.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,18 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7097436
+ * @summary  ClassCastException occurs in assignment expressions without any heap pollutions
+ * @compile/fail/ref=T7097436.out -Xlint:varargs -Werror -XDrawDiagnostics T7097436.java
+ */
+
+import java.util.List;
+
+class T7097436 {
+    @SafeVarargs
+    static void m(List<String>... ls) {
+        Object o = ls; //warning
+        Object[] oArr = ls; //warning
+        String s = ls; // no warning
+        Integer[] iArr = ls; // no warning
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/varargs/7097436/T7097436.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,6 @@
+T7097436.java:13:20: compiler.warn.varargs.unsafe.use.varargs.param: ls
+T7097436.java:14:25: compiler.warn.varargs.unsafe.use.varargs.param: ls
+T7097436.java:15:20: compiler.err.prob.found.req: java.util.List<java.lang.String>[], java.lang.String
+T7097436.java:16:26: compiler.err.prob.found.req: java.util.List<java.lang.String>[], java.lang.Integer[]
+2 errors
+2 warnings
--- a/test/tools/javac/varargs/warning/Warn5.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/varargs/warning/Warn5.java	Tue May 29 00:27:58 2012 +0100
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug     6993978
+ * @bug     6993978 7097436
  * @summary Project Coin: Annotation to reduce varargs warnings
  * @author  mcimadamore
  * @run main Warn5
@@ -31,8 +31,8 @@
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.JavacTool;
 import java.net.URI;
-import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.EnumSet;
 import javax.tools.Diagnostic;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
@@ -95,7 +95,6 @@
         METHOD("void m"),
         CONSTRUCTOR("Test");
 
-
         String name;
 
         MethodKind(String name) {
@@ -155,7 +154,124 @@
         }
     }
 
-    static class JavaSource extends SimpleJavaFileObject {
+    enum WarningKind {
+        UNSAFE_BODY,
+        UNSAFE_DECL,
+        MALFORMED_SAFEVARARGS,
+        REDUNDANT_SAFEVARARGS;
+    }
+
+    // Create a single file manager and reuse it for each compile to save time.
+    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
+    public static void main(String... args) throws Exception {
+        for (SourceLevel sourceLevel : SourceLevel.values()) {
+            for (XlintOption xlint : XlintOption.values()) {
+                for (TrustMe trustMe : TrustMe.values()) {
+                    for (SuppressLevel suppressLevel : SuppressLevel.values()) {
+                        for (ModifierKind modKind : ModifierKind.values()) {
+                            for (MethodKind methKind : MethodKind.values()) {
+                                for (SignatureKind sig : SignatureKind.values()) {
+                                    for (BodyKind body : BodyKind.values()) {
+                                        new Warn5(sourceLevel,
+                                                xlint,
+                                                trustMe,
+                                                suppressLevel,
+                                                modKind,
+                                                methKind,
+                                                sig,
+                                                body).test();
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    final SourceLevel sourceLevel;
+    final XlintOption xlint;
+    final TrustMe trustMe;
+    final SuppressLevel suppressLevel;
+    final ModifierKind modKind;
+    final MethodKind methKind;
+    final SignatureKind sig;
+    final BodyKind body;
+    final JavaSource source;
+    final DiagnosticChecker dc;
+
+    public Warn5(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind, MethodKind methKind, SignatureKind sig, BodyKind body) {
+        this.sourceLevel = sourceLevel;
+        this.xlint = xlint;
+        this.trustMe = trustMe;
+        this.suppressLevel = suppressLevel;
+        this.modKind = modKind;
+        this.methKind = methKind;
+        this.sig = sig;
+        this.body = body;
+        this.source = new JavaSource();
+        this.dc = new DiagnosticChecker();
+    }
+
+    void test() throws Exception {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
+                Arrays.asList(xlint.getXlintOption(), "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
+        ct.analyze();
+        check();
+    }
+
+    void check() {
+
+        EnumSet<WarningKind> expectedWarnings = EnumSet.noneOf(WarningKind.class);
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.TRUST &&
+                suppressLevel != SuppressLevel.VARARGS &&
+                xlint != XlintOption.NONE &&
+                sig.isVarargs && !sig.isReifiableArg && body.hasAliasing &&
+                (methKind == MethodKind.CONSTRUCTOR || (methKind == MethodKind.METHOD && modKind != ModifierKind.NONE))) {
+            expectedWarnings.add(WarningKind.UNSAFE_BODY);
+        }
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.DONT_TRUST &&
+                sig.isVarargs &&
+                !sig.isReifiableArg &&
+                xlint == XlintOption.ALL) {
+            expectedWarnings.add(WarningKind.UNSAFE_DECL);
+        }
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.TRUST &&
+                (!sig.isVarargs ||
+                (modKind == ModifierKind.NONE && methKind == MethodKind.METHOD))) {
+            expectedWarnings.add(WarningKind.MALFORMED_SAFEVARARGS);
+        }
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.TRUST &&
+                xlint != XlintOption.NONE &&
+                suppressLevel != SuppressLevel.VARARGS &&
+                (modKind != ModifierKind.NONE || methKind == MethodKind.CONSTRUCTOR) &&
+                sig.isVarargs &&
+                sig.isReifiableArg) {
+            expectedWarnings.add(WarningKind.REDUNDANT_SAFEVARARGS);
+        }
+
+        if (!expectedWarnings.containsAll(dc.warnings) ||
+                !dc.warnings.containsAll(expectedWarnings)) {
+            throw new Error("invalid diagnostics for source:\n" +
+                    source.getCharContent(true) +
+                    "\nOptions: " + xlint.getXlintOption() +
+                    "\nExpected warnings: " + expectedWarnings +
+                    "\nFound warnings: " + dc.warnings);
+        }
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
 
         String template = "import com.sun.tools.javac.api.*;\n" +
                           "import java.util.List;\n" +
@@ -167,12 +283,11 @@
 
         String source;
 
-        public JavaSource(TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind,
-                MethodKind methKind, SignatureKind meth, BodyKind body) {
+        public JavaSource() {
             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
             source = template.replace("#T", trustMe.anno).
                     replace("#S", suppressLevel.getSuppressAnno()).
-                    replace("#M", meth.getSignature(modKind, methKind)).
+                    replace("#M", sig.getSignature(modKind, methKind)).
                     replace("#B", body.body);
         }
 
@@ -182,117 +297,34 @@
         }
     }
 
-    public static void main(String... args) throws Exception {
-        for (SourceLevel sourceLevel : SourceLevel.values()) {
-            for (XlintOption xlint : XlintOption.values()) {
-                for (TrustMe trustMe : TrustMe.values()) {
-                    for (SuppressLevel suppressLevel : SuppressLevel.values()) {
-                        for (ModifierKind modKind : ModifierKind.values()) {
-                            for (MethodKind methKind : MethodKind.values()) {
-                                for (SignatureKind sig : SignatureKind.values()) {
-                                    for (BodyKind body : BodyKind.values()) {
-                                        test(sourceLevel,
-                                                xlint,
-                                                trustMe,
-                                                suppressLevel,
-                                                modKind,
-                                                methKind,
-                                                sig,
-                                                body);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    // Create a single file manager and reuse it for each compile to save time.
-    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
-
-    static void test(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel,
-            ModifierKind modKind, MethodKind methKind, SignatureKind sig, BodyKind body) throws Exception {
-        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        JavaSource source = new JavaSource(trustMe, suppressLevel, modKind, methKind, sig, body);
-        DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
-                Arrays.asList(xlint.getXlintOption(), "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
-        ct.analyze();
-        check(sourceLevel, dc, source, xlint, trustMe,
-                suppressLevel, modKind, methKind, sig, body);
-    }
-
-    static void check(SourceLevel sourceLevel, DiagnosticChecker dc, JavaSource source,
-            XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind,
-            MethodKind methKind, SignatureKind meth, BodyKind body) {
+    class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
 
-        boolean hasPotentiallyUnsafeBody = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.TRUST &&
-                suppressLevel != SuppressLevel.VARARGS &&
-                xlint != XlintOption.NONE &&
-                meth.isVarargs && !meth.isReifiableArg && body.hasAliasing &&
-                (methKind == MethodKind.CONSTRUCTOR || (methKind == MethodKind.METHOD && modKind != ModifierKind.NONE));
-
-        boolean hasPotentiallyPollutingDecl = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.DONT_TRUST &&
-                meth.isVarargs &&
-                !meth.isReifiableArg &&
-                xlint == XlintOption.ALL;
-
-        boolean hasMalformedAnnoInDecl = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.TRUST &&
-                (!meth.isVarargs ||
-                (modKind == ModifierKind.NONE && methKind == MethodKind.METHOD));
-
-        boolean hasRedundantAnnoInDecl = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.TRUST &&
-                xlint != XlintOption.NONE &&
-                suppressLevel != SuppressLevel.VARARGS &&
-                (modKind != ModifierKind.NONE || methKind == MethodKind.CONSTRUCTOR) &&
-                meth.isVarargs &&
-                meth.isReifiableArg;
-
-        if (hasPotentiallyUnsafeBody != dc.hasPotentiallyUnsafeBody ||
-                hasPotentiallyPollutingDecl != dc.hasPotentiallyPollutingDecl ||
-                hasMalformedAnnoInDecl != dc.hasMalformedAnnoInDecl ||
-                hasRedundantAnnoInDecl != dc.hasRedundantAnnoInDecl) {
-            throw new Error("invalid diagnostics for source:\n" +
-                    source.getCharContent(true) +
-                    "\nOptions: " + xlint.getXlintOption() +
-                    "\nExpected potentially unsafe body warning: " + hasPotentiallyUnsafeBody +
-                    "\nExpected potentially polluting decl warning: " + hasPotentiallyPollutingDecl +
-                    "\nExpected malformed anno error: " + hasMalformedAnnoInDecl +
-                    "\nExpected redundant anno warning: " + hasRedundantAnnoInDecl +
-                    "\nFound potentially unsafe body warning: " + dc.hasPotentiallyUnsafeBody +
-                    "\nFound potentially polluting decl warning: " + dc.hasPotentiallyPollutingDecl +
-                    "\nFound malformed anno error: " + dc.hasMalformedAnnoInDecl +
-                    "\nFound redundant anno warning: " + dc.hasRedundantAnnoInDecl);
-        }
-    }
-
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
-
-        boolean hasPotentiallyUnsafeBody = false;
-        boolean hasPotentiallyPollutingDecl = false;
-        boolean hasMalformedAnnoInDecl = false;
-        boolean hasRedundantAnnoInDecl = false;
+        EnumSet<WarningKind> warnings = EnumSet.noneOf(WarningKind.class);
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.WARNING) {
                     if (diagnostic.getCode().contains("unsafe.use.varargs.param")) {
-                        hasPotentiallyUnsafeBody = true;
+                        setWarning(WarningKind.UNSAFE_BODY);
                     } else if (diagnostic.getCode().contains("redundant.trustme")) {
-                        hasRedundantAnnoInDecl = true;
+                        setWarning(WarningKind.REDUNDANT_SAFEVARARGS);
                     }
             } else if (diagnostic.getKind() == Diagnostic.Kind.MANDATORY_WARNING &&
                     diagnostic.getCode().contains("varargs.non.reifiable.type")) {
-                hasPotentiallyPollutingDecl = true;
+                setWarning(WarningKind.UNSAFE_DECL);
             } else if (diagnostic.getKind() == Diagnostic.Kind.ERROR &&
                     diagnostic.getCode().contains("invalid.trustme")) {
-                hasMalformedAnnoInDecl = true;
+                setWarning(WarningKind.MALFORMED_SAFEVARARGS);
             }
         }
+
+        void setWarning(WarningKind wk) {
+            if (!warnings.add(wk)) {
+                throw new AssertionError("Duplicate warning of kind " + wk + " in source:\n" + source);
+            }
+        }
+
+        boolean hasWarning(WarningKind wk) {
+            return warnings.contains(wk);
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/warnings/7090499/T7090499.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,37 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 7094099
+ * @summary -Xlint:rawtypes
+ * @compile/fail/ref=T7090499.out -XDrawDiagnostics -Xlint:rawtypes T7090499.java
+ */
+
+
+class T7090499<E> {
+
+    static class B<X> {}
+
+    class A<X> {
+        class X {}
+        class Z<Y> {}
+    }
+
+    T7090499 t = new T7090499() { //raw warning (2)
+
+        A.X x1;//raw warning
+        A.Z z1;//raw warning
+
+        T7090499.B<Integer> b1;//ok
+        T7090499.B b2;//raw warning
+
+        A<String>.X x2;//ok
+        A<String>.Z<Integer> z2;//ok
+        A<B>.Z<A<B>> z3;//raw warning (2)
+
+        void test(Object arg1, B arg2) {//raw warning
+            boolean b = arg1 instanceof A;//ok
+            Object a = (A)arg1;//ok
+            A a2 = new A() {};//raw warning (2)
+            a2.new Z() {};//raw warning
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/warnings/7090499/T7090499.out	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,17 @@
+T7090499.java:18:5: compiler.warn.raw.class.use: T7090499, T7090499<E>
+T7090499.java:18:22: compiler.warn.raw.class.use: T7090499, T7090499<E>
+T7090499.java:20:10: compiler.warn.raw.class.use: T7090499.A.X, T7090499<E>.A<X>.X
+T7090499.java:21:10: compiler.warn.raw.class.use: T7090499.A.Z, T7090499<E>.A<X>.Z<Y>
+T7090499.java:24:17: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:26:10: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:27:10: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:28:18: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:28:17: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:28:11: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:28:10: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:30:32: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:33:13: compiler.warn.raw.class.use: T7090499.A, T7090499<E>.A<X>
+T7090499.java:33:24: compiler.warn.raw.class.use: T7090499.A, T7090499<E>.A<X>
+T7090499.java:34:20: compiler.warn.raw.class.use: T7090499.A.Z, T7090499<E>.A<X>.Z<Y>
+4 errors
+11 warnings
--- a/test/tools/javac/warnings/Serial.java	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javac/warnings/Serial.java	Tue May 29 00:27:58 2012 +0100
@@ -29,7 +29,6 @@
  * @compile -Xlint:all Serial.java
  * @compile -Werror Serial.java
  * @compile/fail -Werror -Xlint:serial Serial.java
- * @compile/fail -Werror -Xlint:all,-path T4994049/ Serial.java
  */
 
 import java.io.Serializable;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/parser/7091528/T7091528.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     7091528
+ * @summary javadoc attempts to parse .class files
+ * @compile p/C1.java p/q/C2.java
+ * @run main T7091528
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class T7091528 {
+    public static void main(String... args) {
+        new T7091528().run();
+    }
+
+    void run() {
+        File testSrc = new File(System.getProperty("test.src"));
+        File testClasses = new File(System.getProperty("test.classes"));
+        String[] args = {
+            "-d", ".",
+            "-sourcepath", testClasses + File.pathSeparator + testSrc,
+            "-subpackages",
+            "p"
+        };
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String doclet = com.sun.tools.doclets.standard.Standard.class.getName();
+        int rc = com.sun.tools.javadoc.Main.execute("javadoc", pw, pw, pw, doclet, args);
+        pw.close();
+
+        String out = sw.toString();
+        if (!out.isEmpty()) {
+            System.err.println(out);
+        }
+
+        if (rc != 0)
+            System.err.println("javadoc failed: exit code = " + rc);
+
+        if (out.matches("(?s).*p/[^ ]+\\.class.*"))
+            throw new Error("reading .class files");
+
+        if (!new File("index.html").exists())
+            throw new Error("index.html not found");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/parser/7091528/p/C1.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p1;
+
+/** This is class C1. */
+public class C1 { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/parser/7091528/p/q/C2.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p.q;
+
+/** This is class p.q.C2. */
+public class C2 { }
+
--- a/test/tools/javah/6257087/foo.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javah/6257087/foo.sh	Tue May 29 00:27:58 2012 +0100
@@ -41,7 +41,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/tools/javah/ConstMacroTest.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javah/ConstMacroTest.sh	Tue May 29 00:27:58 2012 +0100
@@ -56,7 +56,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/tools/javah/MissingParamClassTest.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javah/MissingParamClassTest.sh	Tue May 29 00:27:58 2012 +0100
@@ -58,7 +58,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     PS=":"
     FS="/"
     ;;
--- a/test/tools/javah/ReadOldClass.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javah/ReadOldClass.sh	Tue May 29 00:27:58 2012 +0100
@@ -43,7 +43,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     PS=":"
     FS="/"
     ;;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javah/T7126832/T7126832.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7126832
+ * @compile java.java
+ * @summary com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager cannot be cast
+ * @run main T7126832
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class T7126832 {
+    public static void main(String... args) throws Exception {
+        new T7126832().run();
+    }
+
+    void run() throws Exception {
+        Locale prev = Locale.getDefault();
+        Locale.setDefault(Locale.ENGLISH);
+        try {
+            // Verify that a .java file is correctly diagnosed
+            File ff = writeFile(new File("JavahTest.java"), "class JavahTest {}");
+            test(Arrays.asList(ff.getPath()), 1, "Could not find class file for 'JavahTest.java'.");
+
+            // Verify that a class named 'xx.java' is accepted.
+            // Note that ./xx/java.class exists, so this should work ok
+            test(Arrays.asList("xx.java"), 0, null);
+
+            if (errors > 0) {
+                throw new Exception(errors + " errors occurred");
+            }
+        } finally {
+           Locale.setDefault(prev);
+        }
+    }
+
+    void test(List<String> args, int expectRC, String expectOut) {
+        System.err.println("Test: " + args
+                + " rc:" + expectRC
+                + ((expectOut != null) ? " out:" + expectOut : ""));
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = 0;
+        String out = null;
+        try {
+            rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), pw);
+            out = sw.toString();
+        } catch(Exception ee) {
+            rc = 1;
+            out = ee.toString();;
+        }
+        pw.close();
+        if (!out.isEmpty()) {
+            System.err.println(out);
+        }
+        if (rc != expectRC) {
+            error("Unexpected exit code: " + rc + "; expected: " + expectRC);
+        }
+        if (expectOut != null && !out.contains(expectOut)) {
+            error("Expected string not found: " + expectOut);
+        }
+
+        System.err.println();
+    }
+
+    File writeFile(File ff, String ss) throws IOException {
+        if (ff.getParentFile() != null)
+            ff.getParentFile().mkdirs();
+
+        try (FileWriter out = new FileWriter(ff)) {
+            out.write(ss);
+        }
+        return ff;
+    }
+
+    void error(String msg) {
+        System.err.println(msg);
+        errors++;
+    }
+
+    int errors;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javah/T7126832/java.java	Tue May 29 00:27:58 2012 +0100
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package xx;
+class java {
+    int fred;
+}
--- a/test/tools/javap/pathsep.sh	Mon Jul 11 22:31:52 2011 +0100
+++ b/test/tools/javap/pathsep.sh	Tue May 29 00:27:58 2012 +0100
@@ -40,7 +40,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows* )