changeset 3192:54d5a3dba74a

Merge
author lana
date Thu, 07 Jan 2016 15:13:50 -0800
parents 1e4be39c1401 e9a7033b2546
children 3b3bea483542
files test/tools/javac/util/context/T7021650.java
diffstat 31 files changed, 41 insertions(+), 288 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Thu Jan 07 15:13:50 2016 -0800
@@ -145,7 +145,7 @@
      * The version recognized by the Java Platform, Standard Edition
      * 9.
      *
-     * @since 1.9
+     * @since 9
      */
      RELEASE_9;
 
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -57,7 +57,7 @@
  * @see AbstractAnnotationValueVisitor6
  * @see AbstractAnnotationValueVisitor7
  * @see AbstractAnnotationValueVisitor8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public abstract class AbstractAnnotationValueVisitor9<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -61,7 +61,7 @@
  * @see AbstractElementVisitor6
  * @see AbstractElementVisitor7
  * @see AbstractElementVisitor8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public abstract class AbstractElementVisitor9<R, P> extends AbstractElementVisitor8<R, P> {
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -61,7 +61,7 @@
  * @see AbstractTypeVisitor6
  * @see AbstractTypeVisitor7
  * @see AbstractTypeVisitor8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public abstract class AbstractTypeVisitor9<R, P> extends AbstractTypeVisitor8<R, P> {
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -74,7 +74,7 @@
  * @see ElementKindVisitor6
  * @see ElementKindVisitor7
  * @see ElementKindVisitor8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -87,7 +87,7 @@
  * @see ElementScanner6
  * @see ElementScanner7
  * @see ElementScanner8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -64,7 +64,7 @@
  * @see SimpleAnnotationValueVisitor6
  * @see SimpleAnnotationValueVisitor7
  * @see SimpleAnnotationValueVisitor8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public class SimpleAnnotationValueVisitor9<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -69,7 +69,7 @@
  * @see SimpleElementVisitor6
  * @see SimpleElementVisitor7
  * @see SimpleElementVisitor8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public class SimpleElementVisitor9<R, P> extends SimpleElementVisitor8<R, P> {
--- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java	Thu Jan 07 15:13:50 2016 -0800
@@ -72,7 +72,7 @@
  * @see TypeKindVisitor6
  * @see TypeKindVisitor7
  * @see TypeKindVisitor8
- * @since 1.9
+ * @since 9
  */
 @SupportedSourceVersion(RELEASE_9)
 public class TypeKindVisitor9<R, P> extends TypeKindVisitor8<R, P> {
--- a/src/java.compiler/share/classes/javax/tools/FileManagerUtils.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/tools/FileManagerUtils.java	Thu Jan 07 15:13:50 2016 -0800
@@ -32,7 +32,7 @@
 /**
  * Package-private utility methods to convert between files and paths.
  *
- * @since 1.9
+ * @since 9
  */
 class FileManagerUtils {
     private FileManagerUtils() { }
--- a/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java	Thu Jan 07 15:13:50 2016 -0800
@@ -187,7 +187,7 @@
      * a directory or if this file manager does not support any of the
      * given paths.
      *
-     * @since 1.9
+     * @since 9
      */
     default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
             Iterable<? extends Path> paths) {
@@ -226,7 +226,7 @@
      * @throws NullPointerException if the given array contains null
      * elements
      *
-     * @since 1.9
+     * @since 9
      */
     default Iterable<? extends JavaFileObject> getJavaFileObjects(Path... paths) {
         return getJavaFileObjectsFromPaths(Arrays.asList(paths));
@@ -295,7 +295,7 @@
      * @throws IOException if {@code location} is an output location and
      * {@code paths} does not represent an existing directory
      *
-     * @since 1.9
+     * @since 9
      */
     default void setLocationFromPaths(Location location, Iterable<? extends Path> paths)
         throws IOException {
@@ -324,7 +324,7 @@
      * associated search path
      *
      * @see #setLocationFromPaths
-     * @since 1.9
+     * @since 9
      */
     default Iterable<? extends Path> getLocationAsPaths(Location location) {
         return asPaths(getLocation(location));
@@ -345,7 +345,7 @@
      * @throws IllegalArgumentException if the file object does not have an underlying path
      * @throws UnsupportedOperationException if the operation is not supported by this file manager
      *
-     * @since 1.9
+     * @since 9
      */
     default Path asPath(FileObject file) {
         throw new UnsupportedOperationException();
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocCommentTree.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocCommentTree.java	Thu Jan 07 15:13:50 2016 -0800
@@ -49,7 +49,7 @@
      * before any block tags, including the first sentence.
      * @return body of a documentation comment first sentence inclusive
      *
-     * @since 1.9
+     * @since 9
      */
     default List<? extends DocTree> getFullBody() {
         ArrayList<DocTree> bodyList = new ArrayList<>();
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/IndexTree.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/IndexTree.java	Thu Jan 07 15:13:50 2016 -0800
@@ -33,7 +33,7 @@
  * <p>
  * {&#064;index keyword optional description} <br>
  *
- * @since 1.9
+ * @since 9
  */
 @jdk.Exported
 public interface IndexTree extends InlineTagTree {
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/CompilationUnitTree.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/CompilationUnitTree.java	Thu Jan 07 15:13:50 2016 -0800
@@ -59,7 +59,7 @@
      * Returns the package tree associated with this compilation unit,
      * or {@code null} if there is no package declaration.
      * @return the package tree
-     * @since 1.9
+     * @since 9
      */
     PackageTree getPackage();
 
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/PackageTree.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/PackageTree.java	Thu Jan 07 15:13:50 2016 -0800
@@ -33,7 +33,7 @@
  * @jls sections 7.3, and 7.4
  *
  * @author Paul Govereau
- * @since 1.9
+ * @since 9
  */
 @jdk.Exported
 public interface PackageTree extends Tree {
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java	Thu Jan 07 15:13:50 2016 -0800
@@ -212,7 +212,7 @@
 
         /**
          * Used for instances of {@link PackageTree}.
-         * @since 1.9
+         * @since 9
          */
         PACKAGE(PackageTree.class),
 
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java	Thu Jan 07 15:13:50 2016 -0800
@@ -73,7 +73,7 @@
      * Returns {@code null} if none has been specified.
      * @return the break iterator
      *
-     * @since 1.9
+     * @since 9
      */
     public abstract BreakIterator getBreakIterator();
 
@@ -91,7 +91,7 @@
      * @param e an element whose documentation is required
      * @return the doc comment tree
      *
-     * @since 1.9
+     * @since 9
      */
     public abstract DocCommentTree getDocCommentTree(Element e);
 
@@ -105,7 +105,7 @@
      * @param fileObject the content container
      * @return the doc comment tree
      *
-     * @since 1.9
+     * @since 9
      */
     public abstract DocCommentTree getDocCommentTree(FileObject fileObject);
 
@@ -122,7 +122,7 @@
      * @return the doc comment tree
      * @throws java.io.IOException if an exception occurs
      *
-     * @since 1.9
+     * @since 9
      */
     public abstract DocCommentTree getDocCommentTree(Element e, String relativePath) throws IOException;
 
@@ -141,7 +141,7 @@
      * @param list the DocTree list to interrogate
      * @return the first sentence
      *
-     * @since 1.9
+     * @since 9
      */
     public abstract List<DocTree> getFirstSentence(List<? extends DocTree> list);
 
@@ -173,7 +173,7 @@
      * @param breakiterator a break iterator or {@code null} to specify the default
      *                      sentence breaker
      *
-     * @since 1.9
+     * @since 9
      */
     public abstract void setBreakIterator(BreakIterator breakiterator);
 }
--- a/src/jdk.compiler/share/classes/com/sun/source/util/TaskEvent.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/TaskEvent.java	Thu Jan 07 15:13:50 2016 -0800
@@ -74,7 +74,7 @@
          * This event is not sent when using {@link JavacTask#parse()},
          * {@link JavacTask#analyze()} or {@link JavacTask#generate()}.
          *
-         * @since 1.9
+         * @since 9
          */
         COMPILATION,
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CleanProperties.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CleanProperties.java	Thu Jan 07 15:13:50 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
     public boolean transform(CompilationService sjavac,
                              Map<String,Set<URI>> pkgSrcs,
                              Set<URI>             visibleSrcs,
-                             Map<URI,Set<String>> visibleClasses,
                              Map<String,Set<String>> oldPackageDependencies,
                              URI destRoot,
                              Map<String,Set<URI>>    packageArtifacts,
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Thu Jan 07 15:13:50 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +80,6 @@
     public boolean transform(final CompilationService sjavac,
                              Map<String,Set<URI>> pkgSrcs,
                              final Set<URI>             visibleSources,
-                             final Map<URI,Set<String>> visibleClasses,
                              Map<String,Set<String>> oldPackageDependents,
                              URI destRoot,
                              final Map<String,Set<URI>>    packageArtifacts,
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileProperties.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileProperties.java	Thu Jan 07 15:13:50 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,6 @@
     public boolean transform(CompilationService compilationService,
                              Map<String,Set<URI>> pkgSrcs,
                              Set<URI>             visibleSrcs,
-                             Map<URI,Set<String>> visibleClasses,
                              Map<String,Set<String>> oldPackageDependents,
                              URI destRoot,
                              Map<String,Set<URI>>    packageArtifacts,
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CopyFile.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CopyFile.java	Thu Jan 07 15:13:50 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
     public boolean transform(CompilationService compilationService,
                              Map<String,Set<URI>> pkgSrcs,
                              Set<URI> visibleSrcs,
-                             Map<URI,Set<String>> visibleClasses,
                              Map<String,Set<String>> oldPackageDependents,
                              URI destRoot,
                              Map<String,Set<URI>>    packageArtifacts,
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java	Thu Jan 07 15:13:50 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -120,13 +120,6 @@
     // ones that -sourcepath is allowed to see.
     Set<URI> visibleSrcs;
 
-    // Visible classes for linking. These are the only
-    // ones that -classpath is allowed to see.
-    // It maps from a classpath root to the set of visible classes for that root.
-    // If the set is empty, then all classes are visible for that root.
-    // It can also map from a jar file to the set of visible classes for that jar file.
-    Map<URI,Set<String>> visibleClasses;
-
     // Setup transform that always exist.
     private CompileJavaPackages compileJavaPackages = new CompileJavaPackages();
 
@@ -214,16 +207,6 @@
     }
 
     /**
-     * Specify which classes are visible to the compiler through -classpath.
-     */
-    public void setVisibleClasses(Map<String,Source> vs) {
-        visibleSrcs = new HashSet<>();
-        for (String s : vs.keySet()) {
-            Source src = vs.get(s);
-            visibleSrcs.add(src.file().toURI());
-        }
-    }
-    /**
      * Returns true if this is an incremental build.
      */
     public boolean isIncremental() {
@@ -820,7 +803,6 @@
             boolean r = t.transform(sjavac,
                                     srcs,
                                     visibleSrcs,
-                                    visibleClasses,
                                     prev.dependents(),
                                     outputDir.toURI(),
                                     packageArtifacts,
@@ -954,8 +936,7 @@
             }
         }
         // Read in the file and create another set of filenames with full paths.
-        try {
-            BufferedReader in = new BufferedReader(new FileReader(makefileSourceList));
+        try(BufferedReader in = new BufferedReader(new FileReader(makefileSourceList))) {
             for (;;) {
                 String l = in.readLine();
                 if (l==null) break;
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Transformer.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Transformer.java	Thu Jan 07 15:13:50 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,6 @@
     boolean transform(CompilationService sjavac,
                       Map<String,Set<URI>> pkgSrcs,
                       Set<URI>             visibleSources,
-                      Map<URI,Set<String>> visibleClasses,
                       Map<String,Set<String>> oldPackageDependencies,
                       URI destRoot,
                       Map<String,Set<URI>>    packageArtifacts,
--- a/test/tools/javac/proprietary/WarnImport.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/test/tools/javac/proprietary/WarnImport.java	Thu Jan 07 15:13:50 2016 -0800
@@ -9,6 +9,6 @@
  * @compile/fail/ref=WarnImport.out -XDrawDiagnostics  -Werror -Xlint:none WarnImport.java
  */
 
-import sun.misc.VM;
+import sun.security.x509.X509CertInfo;
 
 public class WarnImport {}
--- a/test/tools/javac/proprietary/WarnImport.out	Thu Jan 07 09:34:04 2016 -0800
+++ b/test/tools/javac/proprietary/WarnImport.out	Thu Jan 07 15:13:50 2016 -0800
@@ -1,4 +1,4 @@
-WarnImport.java:12:16: compiler.warn.sun.proprietary: sun.misc.VM
+WarnImport.java:12:25: compiler.warn.sun.proprietary: sun.security.x509.X509CertInfo
 - compiler.err.warnings.and.werror
 1 error
 1 warning
--- a/test/tools/javac/proprietary/WarnMethod.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/test/tools/javac/proprietary/WarnMethod.java	Thu Jan 07 15:13:50 2016 -0800
@@ -3,7 +3,7 @@
  * @bug     6380059
  * @summary Emit warnings for proprietary packages in the boot class path
  * @author  Peter von der Ah\u00e9
- * @modules java.base/sun.misc
+ * @modules java.base/sun.security.x509
  * @compile WarnMethod.java
  * @compile/fail/ref=WarnMethod.out -XDrawDiagnostics  -Werror WarnMethod.java
  * @compile/fail/ref=WarnMethod.out -XDrawDiagnostics  -Werror -nowarn WarnMethod.java
@@ -12,6 +12,6 @@
 
 public class WarnMethod {
     public static void main(String... args) {
-        System.out.println(sun.misc.VM.getFinalRefCount());
+        System.out.println(sun.security.x509.OIDMap.getOID(""));
     }
 }
--- a/test/tools/javac/proprietary/WarnMethod.out	Thu Jan 07 09:34:04 2016 -0800
+++ b/test/tools/javac/proprietary/WarnMethod.out	Thu Jan 07 15:13:50 2016 -0800
@@ -1,4 +1,4 @@
-WarnMethod.java:15:36: compiler.warn.sun.proprietary: sun.misc.VM
+WarnMethod.java:15:45: compiler.warn.sun.proprietary: sun.security.x509.OIDMap
 - compiler.err.warnings.and.werror
 1 error
 1 warning
--- a/test/tools/javac/proprietary/WarnStaticImport.java	Thu Jan 07 09:34:04 2016 -0800
+++ b/test/tools/javac/proprietary/WarnStaticImport.java	Thu Jan 07 15:13:50 2016 -0800
@@ -9,6 +9,6 @@
  * @compile/fail/ref=WarnStaticImport.out -XDrawDiagnostics  -Werror -Xlint:none WarnStaticImport.java
  */
 
-import static sun.misc.VM.getFinalRefCount;
+import static sun.security.x509.OIDMap.getOID;
 
 public class WarnStaticImport {}
--- a/test/tools/javac/proprietary/WarnStaticImport.out	Thu Jan 07 09:34:04 2016 -0800
+++ b/test/tools/javac/proprietary/WarnStaticImport.out	Thu Jan 07 15:13:50 2016 -0800
@@ -1,4 +1,4 @@
-WarnStaticImport.java:12:23: compiler.warn.sun.proprietary: sun.misc.VM
+WarnStaticImport.java:12:32: compiler.warn.sun.proprietary: sun.security.x509.OIDMap
 - compiler.err.warnings.and.werror
 1 error
 1 warning
--- a/test/tools/javac/util/context/T7021650.java	Thu Jan 07 09:34:04 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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 7021650
- * @summary Fix Context issues
- * @library /tools/javac/lib
- * @modules jdk.compiler/com.sun.tools.javac.comp
- *          jdk.compiler/com.sun.tools.javac.file
- *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.compiler/com.sun.tools.javac.processing
- *          jdk.compiler/com.sun.tools.javac.util
- * @build JavacTestingAbstractProcessor T7021650
- * @run main T7021650
- */
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import javax.annotation.processing.*;
-import javax.lang.model.element.*;
-import javax.tools.*;
-
-import com.sun.tools.javac.comp.Attr;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.main.Main;
-import com.sun.tools.javac.processing.JavacProcessingEnvironment;
-import com.sun.tools.javac.util.Context;
-
-public class T7021650 extends JavacTestingAbstractProcessor {
-    public static void main(String... args) throws Exception {
-        new T7021650().run();
-    }
-
-    static File testSrc = new File(System.getProperty("test.src"));
-    static final int MAX_ROUNDS = 3;
-
-    /**
-     * Perform a compilation with custom factories registered in the context,
-     * and verify that corresponding objects are created in each round.
-     */
-    void run() throws Exception {
-        Counter myDemoCounter = new Counter();
-        Counter myAttrCounter = new Counter();
-
-        Context context = new Context();
-        // Use a custom file manager which creates classloaders for annotation
-        // processors with a sensible delegation parent, so that all instances
-        // of test classes come from the same class loader. This is important
-        // because the test performs class checks on the instances of classes
-        // found in the context for each round or processing.
-        context.put(JavaFileManager.class, new Context.Factory<JavaFileManager>() {
-            public JavaFileManager make(Context c) {
-                return new JavacFileManager(c, true, null) {
-                    @Override
-                    protected ClassLoader getClassLoader(URL[] urls) {
-                        return new URLClassLoader(urls, T7021650.class.getClassLoader());
-                    }
-                };
-            }
-        });
-
-        MyDemo.preRegister(context, myDemoCounter);
-        MyAttr.preRegister(context, myAttrCounter);
-
-        String[] args = {
-            "-d", ".",
-            "-processor", T7021650.class.getName(),
-            "-XprintRounds",
-            new File(testSrc, T7021650.class.getName() + ".java").getPath()
-        };
-
-        compile(context, args);
-
-        // the services should only be created once in the current scheme:
-        checkEqual("demoCounter", myDemoCounter.count, 1);
-        checkEqual("myAttrCounter", myAttrCounter.count, 1);
-    }
-
-    void compile(Context context, String... args) throws Exception {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        Main m = new Main("javac", pw);
-        Main.Result res = m.compile(args, context);
-        pw.close();
-        String out = sw.toString();
-        if (!out.isEmpty())
-            System.err.println(out);
-        if (!res.isOK())
-            throw new Exception("compilation failed unexpectedly: result=" + res);
-    }
-
-    void checkEqual(String label, int found, int expect) throws Exception {
-        if (found != expect)
-            throw new Exception("unexpected value for " + label
-                    + ": expected " + expect
-                    + ": found " + found);
-    }
-
-    //---------------
-
-    /*
-     * A custom class unknown to javac but nonetheless registered in the context.
-     */
-    static class Demo {
-        Demo(Context c) {
-            c.put(Demo.class, this);
-        }
-
-        static Demo instance(Context context) {
-            return context.get(Demo.class);
-        }
-    }
-
-    static class MyDemo extends Demo {
-        static void preRegister(Context context, final Counter counter) {
-            context.put(Demo.class, new Context.Factory<Demo>() {
-                public Demo make(Context c) {
-                    counter.count++;
-                    return new MyDemo(c);
-                }
-            });
-        }
-
-        MyDemo(Context c) {
-            super(c);
-        }
-    }
-
-    /**
-     * A custom version of a standard javac component.
-     */
-    static class MyAttr extends Attr {
-        static void preRegister(Context context, final Counter counter) {
-            context.put(attrKey, new Context.Factory<Attr>() {
-                public Attr make(Context c) {
-                    counter.count++;
-                    return new MyAttr(c);
-                }
-            });
-        }
-
-        MyAttr(Context c) {
-            super(c);
-        }
-    }
-
-    static class Counter {
-        int count;
-    }
-
-    //---------------
-
-    int round = 0;
-
-    @Override
-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-        round++;
-
-        Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
-
-        // verify items in context as expected
-        check("Demo", Demo.instance(context), MyDemo.class);
-        check("Attr", Attr.instance(context), MyAttr.class);
-
-        // For a few rounds, generate new source files, so that we can check whether
-        // values in the context are correctly handled in subsequent processing rounds
-        if (round <= MAX_ROUNDS) {
-            String pkg = "p";
-            String currClass = "Gen" + round;
-            String curr = pkg + "." + currClass;
-            String next = (pkg + ".Gen" + (round + 1));
-            StringBuilder text = new StringBuilder();
-            text.append("package ").append(pkg).append(";\n");
-            text.append("public class ").append(currClass).append(" {\n");
-            if (round < MAX_ROUNDS)
-                text.append("    ").append(next).append(" x;\n");
-            text.append("}\n");
-
-            try {
-                JavaFileObject fo = filer.createSourceFile(curr);
-                Writer out = fo.openWriter();
-                try {
-                    out.write(text.toString());
-                } finally {
-                    out.close();
-                }
-            } catch (IOException e) {
-                throw new Error(e);
-            }
-        }
-
-        return true;
-    }
-
-    void check(String label, Object o, Class<?> clazz) {
-        if (o == null)
-            throw new IllegalStateException(label + ": no item found");
-        if (!clazz.isAssignableFrom(o.getClass()))
-            throw new IllegalStateException(label + ": unexpected class: " + o.getClass());
-    }
-}