Merge
authorlana
Thu, 26 May 2016 17:18:12 +0000
changeset 38610 a7c1eb127ec9
parent 38603 56f3e2091968 (current diff)
parent 38609 a1c0c73078b3 (diff)
child 38612 43c4bd1d4cb5
Merge
--- a/langtools/make/build.xml	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/build.xml	Thu May 26 17:18:12 2016 +0000
@@ -89,11 +89,17 @@
     </pathconvert>
 
     <pathconvert property="xpatch.rest" pathsep=" -Xpatch:">
+        <regexpmapper from="${file.separator}([^${file.separator}]+)$" to='\1="${build.modules}${file.separator}\1"' />
+        <dirset dir="${src.dir}" includes="*.*"/>
+    </pathconvert>
+
+    <pathconvert property="xpatch.noquotes.rest" pathsep=" -Xpatch:">
         <regexpmapper from="${file.separator}([^${file.separator}]+)$" to="\1=${build.modules}${file.separator}\1" />
         <dirset dir="${src.dir}" includes="*.*"/>
     </pathconvert>
 
     <property name="xpatch.cmd" value="-Xpatch:${xpatch.rest}"/>
+    <property name="xpatch.noquotes.cmd" value="-Xpatch:${xpatch.noquotes.rest}"/>
 
     <!-- java.marker is set to a marker file to check for within a Java install dir.
          The best file to check for across Solaris/Linux/Windows/MacOS is one of the
@@ -341,7 +347,7 @@
                     jdk="@{jdk}"
                     agentvm="@{agentvm}" verbose="@{verbose}"
                     failonerror="false" resultproperty="jtreg.@{name}.result"
-                    vmoptions="${coverage.options} @{extra.jvmargs} ${xpatch.cmd}">
+                    vmoptions="${coverage.options} @{extra.jvmargs} ${xpatch.noquotes.cmd}">
                     <arg value="-debug:@{jpda.jvmargs}"/>
                     <arg line="@{keywords}"/>
                     <arg line="@{options}"/>
--- a/langtools/make/intellij/runConfigurations/javac.xml	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/intellij/runConfigurations/javac.xml	Thu May 26 17:18:12 2016 +0000
@@ -2,7 +2,7 @@
   <configuration default="false" name="javac" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
-    <option name="VM_PARAMETERS" value="@XPATCH@" />
+    <option name="VM_PARAMETERS" value='@XPATCH@' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/javadoc.xml	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/intellij/runConfigurations/javadoc.xml	Thu May 26 17:18:12 2016 +0000
@@ -2,7 +2,7 @@
   <configuration default="false" name="javadoc" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.javadoc.Main" />
-    <option name="VM_PARAMETERS" value="@XPATCH@" />
+    <option name="VM_PARAMETERS" value='@XPATCH@' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/javah.xml	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/intellij/runConfigurations/javah.xml	Thu May 26 17:18:12 2016 +0000
@@ -2,7 +2,7 @@
   <configuration default="false" name="javah" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
-    <option name="VM_PARAMETERS" value="@XPATCH@ -XaddExports:jdk.compiler/com.sun.tools.javah=ALL-UNNAMED" />
+    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.compiler/com.sun.tools.javah=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/javap.xml	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/intellij/runConfigurations/javap.xml	Thu May 26 17:18:12 2016 +0000
@@ -2,7 +2,7 @@
   <configuration default="false" name="javap" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
-    <option name="VM_PARAMETERS" value="@XPATCH@ -XaddExports:jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED" />
+    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/jshell.xml	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/intellij/runConfigurations/jshell.xml	Thu May 26 17:18:12 2016 +0000
@@ -2,7 +2,7 @@
   <configuration default="false" name="jshell" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="jdk.internal.jshell.tool.JShellTool" />
-    <option name="VM_PARAMETERS" value="@XPATCH@ -XaddExports:jdk.jshell/jdk.internal.jshell.tool=ALL-UNNAMED" />
+    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.jshell/jdk.internal.jshell.tool=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/sjavac.xml	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/intellij/runConfigurations/sjavac.xml	Thu May 26 17:18:12 2016 +0000
@@ -2,7 +2,7 @@
   <configuration default="false" name="sjavac" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
-    <option name="VM_PARAMETERS" value="@XPATCH@ -XaddExports:jdk.compiler/com.sun.tools.sjavac=ALL-UNNAMED" />
+    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.compiler/com.sun.tools.sjavac=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/launcher.sh-template	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/make/launcher.sh-template	Thu May 26 17:18:12 2016 +0000
@@ -48,4 +48,4 @@
 unset DUALCASE
 
 IFS=$nl
-"#TARGET_JAVA#" "#XPATCH#" ${ea} ${javaOpts} #PROGRAM# ${toolOpts}
+"#TARGET_JAVA#" #XPATCH# ${ea} ${javaOpts} #PROGRAM# ${toolOpts}
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java	Thu May 26 17:18:12 2016 +0000
@@ -27,6 +27,8 @@
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.TypeElement;
+import java.util.LinkedHashSet;
+import java.util.Collections;
 import java.util.Set;
 import java.lang.annotation.Annotation;
 
@@ -92,6 +94,38 @@
     Set<? extends Element> getElementsAnnotatedWith(TypeElement a);
 
     /**
+     * Returns the elements annotated with one or more of the given
+     * annotation types.
+     *
+     * @apiNote This method may be useful when processing repeating
+     * annotations by looking for an annotation type and its
+     * containing annotation type at the same time.
+     *
+     * @implSpec The default implementation of this method creates an
+     * empty result set, iterates over the annotations in the argument
+     * set calling {@link #getElementsAnnotatedWith(TypeElement)} on
+     * each annotation and adding those results to the result
+     * set. Finally, the contents of the result set are returned as an
+     * unmodifiable set.
+     *
+     * @param annotations  annotation types being requested
+     * @return the elements annotated with one or more of the given
+     * annotation types, or an empty set if there are none
+     * @throws IllegalArgumentException if the any elements of the
+     * argument set do not represent an annotation type
+     * @jls 9.6.3 Repeatable Annotation Types
+     * @since 9
+     */
+    default Set<? extends Element> getElementsAnnotatedWithAny(TypeElement... annotations){
+        // Use LinkedHashSet rather than HashSet for predictability
+        Set<Element> result = new LinkedHashSet<>();
+        for (TypeElement annotation : annotations) {
+            result.addAll(getElementsAnnotatedWith(annotation));
+        }
+        return Collections.unmodifiableSet(result);
+    }
+
+    /**
      * Returns the elements annotated with the given annotation type.
      * The annotation may appear directly or be inherited.  Only
      * package elements and type elements <i>included</i> in this
@@ -110,4 +144,36 @@
      * represent an annotation type
      */
     Set<? extends Element> getElementsAnnotatedWith(Class<? extends Annotation> a);
+
+    /**
+     * Returns the elements annotated with one or more of the given
+     * annotation types.
+     *
+     * @apiNote This method may be useful when processing repeating
+     * annotations by looking for an annotation type and its
+     * containing annotation type at the same time.
+     *
+     * @implSpec The default implementation of this method creates an
+     * empty result set, iterates over the annotations in the argument
+     * set calling {@link #getElementsAnnotatedWith(Class)} on
+     * each annotation and adding those results to the result
+     * set. Finally, the contents of the result set are returned as an
+     * unmodifiable set.
+     *
+     * @param annotations  annotation types being requested
+     * @return the elements annotated with one or more of the given
+     * annotation types, or an empty set if there are none
+     * @throws IllegalArgumentException if the any elements of the
+     * argument set do not represent an annotation type
+     * @jls 9.6.3 Repeatable Annotation Types
+     * @since 9
+     */
+    default Set<? extends Element> getElementsAnnotatedWithAny(Set<Class<? extends Annotation>> annotations){
+        // Use LinkedHashSet rather than HashSet for predictability
+        Set<Element> result = new LinkedHashSet<>();
+        for (Class<? extends Annotation> annotation : annotations) {
+            result.addAll(getElementsAnnotatedWith(annotation));
+        }
+        return Collections.unmodifiableSet(result);
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Thu May 26 17:18:12 2016 +0000
@@ -148,9 +148,10 @@
 
     // For exception parameters, index into exception table.  In
     // com.sun.tools.javac.jvm.Gen.genCatch, we first use this to hold
-    // the catch type index.  Then in
+    // the catch type's constant pool entry index.  Then in
     // com.sun.tools.javac.jvm.Code.fillExceptionParameterPositions we
     // use that value to determine the exception table index.
+    // When read from class file, this holds
     private int exception_index = Integer.MIN_VALUE;
 
     // If this type annotation is within a lambda expression,
@@ -303,13 +304,13 @@
     }
 
     public int getExceptionIndex() {
-        Assert.check(exception_index >= 0, "exception_index does not contain a bytecode offset");
+        Assert.check(exception_index >= 0, "exception_index is not set");
         return exception_index;
     }
 
     public void setExceptionIndex(final int exception_index) {
-        Assert.check(hasCatchType(), "exception_index already contains a bytecode offset");
-        Assert.check(exception_index >= 0, "Expected a valid bytecode offset");
+        Assert.check(!hasExceptionIndex(), "exception_index already set");
+        Assert.check(exception_index >= 0, "Expected a valid index into exception table");
         this.exception_index = exception_index;
     }
 
@@ -330,8 +331,8 @@
     }
 
     public void setCatchInfo(final int catchType, final int startPos) {
-        Assert.check(this.exception_index < 0,
-                     "exception_index already contains a bytecode index");
+        Assert.check(!hasExceptionIndex(),
+                     "exception_index is already set");
         Assert.check(catchType >= 0, "Expected a valid catch type");
         this.exception_index = -((catchType | startPos << 8) + 1);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu May 26 17:18:12 2016 +0000
@@ -811,6 +811,7 @@
         DiagnosticPosition prevLintPos
                 = deferredLintHandler.setPos(variable.pos());
 
+        final JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
         try {
             Type itype = attribExpr(variable.init, env, type);
             if (itype.constValue() != null) {
@@ -819,6 +820,7 @@
                 return null;
             }
         } finally {
+            log.useSource(prevSource);
             deferredLintHandler.setPos(prevLintPos);
         }
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Thu May 26 17:18:12 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -51,6 +51,7 @@
     private final boolean processingOver;
     private final boolean errorRaised;
     private final ProcessingEnvironment processingEnv;
+    private final Elements eltUtils;
 
     // Caller must pass in an immutable set
     private final Set<? extends Element> rootElements;
@@ -63,6 +64,7 @@
         this.errorRaised = errorRaised;
         this.rootElements = rootElements;
         this.processingEnv = processingEnv;
+        this.eltUtils = processingEnv.getElementUtils();
     }
 
     public String toString() {
@@ -100,9 +102,6 @@
         return rootElements;
     }
 
-    private static final String NOT_AN_ANNOTATION_TYPE =
-        "The argument does not represent an annotation type: ";
-
     /**
      * Returns the elements annotated with the given annotation type.
      * Only type elements <i>included</i> in this round of annotation
@@ -117,10 +116,9 @@
      */
     @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Set<? extends Element> getElementsAnnotatedWith(TypeElement a) {
+        throwIfNotAnnotation(a);
+
         Set<Element> result = Collections.emptySet();
-        if (a.getKind() != ElementKind.ANNOTATION_TYPE)
-            throw new IllegalArgumentException(NOT_AN_ANNOTATION_TYPE + a);
-
         ElementScanner9<Set<Element>, TypeElement> scanner =
             new AnnotationSetScanner(result);
 
@@ -130,41 +128,93 @@
         return result;
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
+    public Set<? extends Element> getElementsAnnotatedWithAny(TypeElement... annotations) {
+        // Don't bother to special-case annotations.length == 1 as
+        // return getElementsAnnotatedWith(annotations[0]);
+
+        Set<TypeElement> annotationSet = new LinkedHashSet<>(annotations.length);
+        for (TypeElement annotation : annotations) {
+            throwIfNotAnnotation(annotation);
+            annotationSet.add(annotation);
+        }
+
+        Set<Element> result = Collections.emptySet();
+        ElementScanner9<Set<Element>, Set<TypeElement>> scanner =
+            new AnnotationSetMultiScanner(result);
+
+        for (Element element : rootElements)
+            result = scanner.scan(element, annotationSet);
+
+        return result;
+    }
+
     // Could be written as a local class inside getElementsAnnotatedWith
     private class AnnotationSetScanner extends
-        ElementScanner9<Set<Element>, TypeElement> {
+        ElementScanningIncludingTypeParameters<Set<Element>, TypeElement> {
         // Insertion-order preserving set
-        Set<Element> annotatedElements = new LinkedHashSet<>();
+        private Set<Element> annotatedElements = new LinkedHashSet<>();
 
         AnnotationSetScanner(Set<Element> defaultSet) {
             super(defaultSet);
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public Set<Element> visitType(TypeElement e, TypeElement p) {
+        public Set<Element> scan(Element e, TypeElement annotation) {
+            for (AnnotationMirror annotMirror :  eltUtils.getAllAnnotationMirrors(e)) {
+                if (annotation.equals(mirrorAsElement(annotMirror))) {
+                    annotatedElements.add(e);
+                    break;
+                }
+            }
+            e.accept(this, annotation);
+            return annotatedElements;
+        }
+    }
+
+    // Could be written as a local class inside getElementsAnnotatedWithAny
+    private class AnnotationSetMultiScanner extends
+        ElementScanningIncludingTypeParameters<Set<Element>, Set<TypeElement>> {
+        // Insertion-order preserving set
+        private Set<Element> annotatedElements = new LinkedHashSet<>();
+
+        AnnotationSetMultiScanner(Set<Element> defaultSet) {
+            super(defaultSet);
+        }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public Set<Element> scan(Element e, Set<TypeElement> annotations) {
+            for (AnnotationMirror annotMirror : eltUtils.getAllAnnotationMirrors(e)) {
+                if (annotations.contains(mirrorAsElement(annotMirror))) {
+                    annotatedElements.add(e);
+                    break;
+                }
+            }
+            e.accept(this, annotations);
+            return annotatedElements;
+        }
+    }
+
+    private static abstract class ElementScanningIncludingTypeParameters<R, P>
+        extends ElementScanner9<R, P> {
+
+        protected ElementScanningIncludingTypeParameters(R defaultValue) {
+            super(defaultValue);
+        }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public R visitType(TypeElement e, P p) {
             // Type parameters are not considered to be enclosed by a type
             scan(e.getTypeParameters(), p);
             return super.visitType(e, p);
         }
 
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public Set<Element> visitExecutable(ExecutableElement e, TypeElement p) {
+        public R visitExecutable(ExecutableElement e, P p) {
             // Type parameters are not considered to be enclosed by an executable
             scan(e.getTypeParameters(), p);
             return super.visitExecutable(e, p);
         }
-
-        @Override @DefinedBy(Api.LANGUAGE_MODEL)
-        public Set<Element> scan(Element e, TypeElement p) {
-            java.util.List<? extends AnnotationMirror> annotationMirrors =
-                processingEnv.getElementUtils().getAllAnnotationMirrors(e);
-            for (AnnotationMirror annotationMirror : annotationMirrors) {
-                if (p.equals(annotationMirror.getAnnotationType().asElement()))
-                    annotatedElements.add(e);
-            }
-            e.accept(this, p);
-            return annotatedElements;
-        }
     }
 
     /**
@@ -172,17 +222,48 @@
      */
     @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Set<? extends Element> getElementsAnnotatedWith(Class<? extends Annotation> a) {
-        if (!a.isAnnotation())
-            throw new IllegalArgumentException(NOT_AN_ANNOTATION_TYPE + a);
+        throwIfNotAnnotation(a);
         String name = a.getCanonicalName();
         if (name == null)
             return Collections.emptySet();
         else {
-            TypeElement annotationType = processingEnv.getElementUtils().getTypeElement(name);
+            TypeElement annotationType = eltUtils.getTypeElement(name);
             if (annotationType == null)
                 return Collections.emptySet();
             else
                 return getElementsAnnotatedWith(annotationType);
         }
     }
+
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
+    public Set<? extends Element> getElementsAnnotatedWithAny(Set<Class<? extends Annotation>> annotations) {
+        List<TypeElement> annotationsAsElements = new ArrayList<>(annotations.size());
+
+        for (Class<? extends Annotation> annotation : annotations) {
+            throwIfNotAnnotation(annotation);
+            String name = annotation.getCanonicalName();
+            if (name == null)
+                continue;
+            annotationsAsElements.add(eltUtils.getTypeElement(name));
+        }
+
+        return getElementsAnnotatedWithAny(annotationsAsElements.toArray(new TypeElement[0]));
+    }
+
+    private Element mirrorAsElement(AnnotationMirror annotationMirror) {
+        return annotationMirror.getAnnotationType().asElement();
+    }
+
+    private static final String NOT_AN_ANNOTATION_TYPE =
+        "The argument does not represent an annotation type: ";
+
+    private void throwIfNotAnnotation(Class<? extends Annotation> a) {
+        if (!a.isAnnotation())
+            throw new IllegalArgumentException(NOT_AN_ANNOTATION_TYPE + a);
+    }
+
+    private void throwIfNotAnnotation(TypeElement a) {
+        if (a.getKind() != ElementKind.ANNOTATION_TYPE)
+            throw new IllegalArgumentException(NOT_AN_ANNOTATION_TYPE + a);
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java	Thu May 26 17:18:12 2016 +0000
@@ -429,6 +429,10 @@
 
     public boolean run() throws Util.Exit {
 
+        if (!javac_extras.contains("-XDsuppress-tool-removal-message")) {
+            log.println(getMessage("javah.misc.Deprecation"));
+        }
+
         Util util = new Util(log, diagnosticListener);
 
         if (noArgs || help) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n.properties	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n.properties	Thu May 26 17:18:12 2016 +0000
@@ -164,3 +164,12 @@
 err.missing.arg=value missing for {0}
 err.no.classes.specified=no classes specified
 err.unknown.option=unknown option: {0}
+
+#
+# miscellaneous strings
+#
+javah.misc.Deprecation=\
+    \nWarning:\u0020The javah tool is planned to be removed in the next major\n\
+    JDK release. The tool has been superseded by the ''-h'' option added\n\
+    to javac in JDK 8. Users are recommended to migrate to using the\n\
+    javac ''-h'' option; see the javac man page for more information.\n
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/jdi/JDIConnection.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/jdi/JDIConnection.java	Thu May 26 17:18:12 2016 +0000
@@ -50,6 +50,7 @@
 class JDIConnection {
 
     private VirtualMachine vm;
+    private boolean active = true;
     private Process process = null;
     private int outputCompleteCount = 0;
 
@@ -175,6 +176,11 @@
         return process != null && process.isAlive();
     }
 
+    // Beginning shutdown, ignore any random dying squeals
+    void beginShutdown() {
+        active = false;
+    }
+
     public synchronized void disposeVM() {
         try {
             if (vm != null) {
@@ -233,14 +239,19 @@
         int i;
         try {
             while ((i = in.read()) != -1) {
-                pStream.print((char) i);
+                // directly copy input to output, but skip if asked to close
+                if (active) {
+                    pStream.print((char) i);
+                }
             }
         } catch (IOException ex) {
             String s = ex.getMessage();
-            if (!s.startsWith("Bad file number")) {
+            if (active && !s.startsWith("Bad file number")) {
                 throw ex;
             }
-            // else we got a Bad file number IOException which just means
+            // else we are being shutdown (and don't want any spurious death
+            // throws to ripple) or
+            // we got a Bad file number IOException which just means
             // that the debuggee has gone away.  We'll just treat it the
             // same as if we got an EOF.
         }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/jdi/JDIExecutionControl.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/jdi/JDIExecutionControl.java	Thu May 26 17:18:12 2016 +0000
@@ -109,11 +109,14 @@
     @Override
     public void close() {
         try {
+            JDIConnection c = jdiEnv.connection();
+            if (c != null) {
+                c.beginShutdown();
+            }
             if (remoteOut != null) {
                 remoteOut.writeInt(CMD_EXIT);
                 remoteOut.flush();
             }
-            JDIConnection c = jdiEnv.connection();
             if (c != null) {
                 c.disposeVM();
             }
--- a/langtools/test/jdk/jshell/StartOptionTest.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/test/jdk/jshell/StartOptionTest.java	Thu May 26 17:18:12 2016 +0000
@@ -34,7 +34,6 @@
  */
 
 import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
 import java.io.PrintStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
@@ -48,85 +47,76 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
 
 @Test
 public class StartOptionTest {
 
-    private ByteArrayOutputStream out;
-    private ByteArrayOutputStream err;
+    private ByteArrayOutputStream cmdout;
+    private ByteArrayOutputStream cmderr;
+    private ByteArrayOutputStream console;
+    private ByteArrayOutputStream userout;
+    private ByteArrayOutputStream usererr;
 
     private JShellTool getShellTool() {
-        class NoOutputAllowedStream extends OutputStream {
-            private final String label;
-            NoOutputAllowedStream(String label) {
-               this.label = label;
-            }
-            @Override
-            public void write(int b) { fail("Unexpected output to: " + label); }
-        }
         return new JShellTool(
                 new TestingInputStream(),
-                new PrintStream(out),
-                new PrintStream(err),
-                new PrintStream(new NoOutputAllowedStream("console")),
+                new PrintStream(cmdout),
+                new PrintStream(cmderr),
+                new PrintStream(console),
                 new TestingInputStream(),
-                new PrintStream(new NoOutputAllowedStream("userout")),
-                new PrintStream(new NoOutputAllowedStream("usererr")),
+                new PrintStream(userout),
+                new PrintStream(usererr),
                 new ReplToolTesting.MemoryPreferences(),
                 Locale.ROOT);
     }
 
-    private String getOutput() {
-        byte[] bytes = out.toByteArray();
-        out.reset();
-        return new String(bytes, StandardCharsets.UTF_8);
-    }
-
-    private String getError() {
-        byte[] bytes = err.toByteArray();
-        err.reset();
-        return new String(bytes, StandardCharsets.UTF_8);
+    private void check(ByteArrayOutputStream str, Consumer<String> checkOut, String label) {
+        byte[] bytes = str.toByteArray();
+        str.reset();
+        String out =  new String(bytes, StandardCharsets.UTF_8);
+        if (checkOut != null) {
+            checkOut.accept(out);
+        } else {
+            assertEquals("", out, label + ": Expected empty -- ");
+        }
     }
 
     private void start(Consumer<String> checkOutput, Consumer<String> checkError, String... args) throws Exception {
         JShellTool tool = getShellTool();
         tool.start(args);
-        if (checkOutput != null) {
-            checkOutput.accept(getOutput());
-        } else {
-            assertEquals("", getOutput(), "Output: ");
-        }
-        if (checkError != null) {
-            checkError.accept(getError());
-        } else {
-            assertEquals("", getError(), "Error: ");
-        }
+        check(cmdout, checkOutput, "cmdout");
+        check(cmderr, checkError, "cmderr");
+        check(console, null, "console");
+        check(userout, null, "userout");
+        check(usererr, null, "usererr");
     }
 
     private void start(String expectedOutput, String expectedError, String... args) throws Exception {
-        start(s -> assertEquals(s.trim(), expectedOutput, "Output: "), s -> assertEquals(s.trim(), expectedError, "Error: "), args);
+        start(s -> assertEquals(s.trim(), expectedOutput, "cmdout: "), s -> assertEquals(s.trim(), expectedError, "cmderr: "), args);
     }
 
     @BeforeMethod
     public void setUp() {
-        out = new ByteArrayOutputStream();
-        err = new ByteArrayOutputStream();
+        cmdout  = new ByteArrayOutputStream();
+        cmderr  = new ByteArrayOutputStream();
+        console = new ByteArrayOutputStream();
+        userout = new ByteArrayOutputStream();
+        usererr = new ByteArrayOutputStream();
     }
 
     @Test
     public void testUsage() throws Exception {
         start(s -> {
-            assertTrue(s.split("\n").length >= 7, s);
-            assertTrue(s.startsWith("Usage:   jshell <options>"), s);
+            assertTrue(s.split("\n").length >= 7, "Not enough usage lines: " + s);
+            assertTrue(s.startsWith("Usage:   jshell <options>"), "Unexpect usage start: " + s);
         },  null, "-help");
     }
 
     @Test
     public void testUnknown() throws Exception {
         start(s -> {
-            assertTrue(s.split("\n").length >= 7, s);
-            assertTrue(s.startsWith("Usage:   jshell <options>"), s);
+            assertTrue(s.split("\n").length >= 7, "Not enough usage lines (unknown): " + s);
+            assertTrue(s.startsWith("Usage:   jshell <options>"), "Unexpect usage start (unknown): " + s);
         }, s -> assertEquals(s.trim(), "Unknown option: -unknown"), "-unknown");
     }
 
@@ -157,12 +147,15 @@
 
     @Test
     public void testVersion() throws Exception {
-        start(s -> assertTrue(s.startsWith("jshell")), null, "-version");
+        start(s -> assertTrue(s.startsWith("jshell"), "unexpected version: " + s), null, "-version");
     }
 
     @AfterMethod
     public void tearDown() {
-        out = null;
-        err = null;
+        cmdout  = null;
+        cmderr  = null;
+        console = null;
+        userout = null;
+        usererr = null;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8152360/DeprecateJavahTest.java	Thu May 26 17:18:12 2016 +0000
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 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
+ * 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 8152360
+ * @summary deprecate javah
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javah
+ * @build toolbox.ToolBox toolbox.JavahTask
+ * @run main DeprecateJavahTest
+ */
+
+import toolbox.JavahTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
+public class DeprecateJavahTest {
+    public static void main(String... args) throws Exception {
+        new DeprecateJavahTest().run();
+    }
+
+    ToolBox tb = new ToolBox();
+
+    void printDeprecationWarning() throws Exception {
+        String output = new JavahTask(tb)
+                .options("-version")
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!output.contains(
+                "Warning: The javah tool is planned to be removed in the next major\n" +
+                "JDK release. The tool has been superseded by the '-h' option added\n" +
+                "to javac in JDK 8. Users are recommended to migrate to using the\n" +
+                "javac '-h' option; see the javac man page for more information.")) {
+            throw new Exception("test failed");
+        }
+    }
+
+    void dontPrintDeprecationWarning() throws Exception {
+        String output = new JavahTask(tb)
+                .options("-version", "-XDsuppress-tool-removal-message")
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!output.startsWith("javah version")) {
+            throw new Exception("test failed");
+        }
+    }
+
+    void run() throws Exception {
+        printDeprecationWarning();
+        dontPrintDeprecationWarning();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/8047024/T8047024.java	Thu May 26 17:18:12 2016 +0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 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
+ * 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 8047024
+ * @summary AssertionError: exception_index already contains a bytecode offset
+ * @compile T8047024_01.java
+ * @compile -XDsave-parameter-names=true T8047024.java
+ */
+
+public class T8047024 {
+    public static void main(String [] args) {
+        T8047024_01.run();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/8047024/T8047024_01.java	Thu May 26 17:18:12 2016 +0000
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 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
+ * 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;
+
+public class T8047024_01 {
+
+    @Target(ElementType.TYPE_USE)
+    @interface TA {}
+
+    public static void run() {
+        try {
+            System.out.println("");
+        } catch (@TA Throwable e) {
+
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/EagerInitCheck.java	Thu May 26 17:18:12 2016 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 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
+ * 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 8154052
+ * @summary Java compiler error displays line from the wrong file
+ * @compile/fail/ref=EagerInitCheck.out -XDrawDiagnostics EagerInitCheck.java
+ */
+
+public class EagerInitCheck implements IEagerInitCheck {
+    float x = VAL;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/EagerInitCheck.out	Thu May 26 17:18:12 2016 +0000
@@ -0,0 +1,2 @@
+IEagerInitCheck.java:25:17: compiler.err.prob.found.req: (compiler.misc.possible.loss.of.precision: double, float)
+1 error
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/IEagerInitCheck.java	Thu May 26 17:18:12 2016 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 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
+ * 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 IEagerInitCheck {
+    float VAL = 1.0;
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Thu May 26 17:18:12 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 8030049 8038080
+ * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 8030049 8038080 8032230
  * @summary Tests that getElementsAnnotatedWith works properly.
  * @author  Joseph D. Darcy
  * @library /tools/javac/lib
@@ -51,69 +51,183 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Arrays;
+import java.util.Objects;
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
 import static javax.lang.model.util.ElementFilter.*;
 
 /**
  * This processor verifies that the information returned by
- * getElementsAnnotatedWith is consistent with the expected results
- * stored in an AnnotatedElementInfo annotation.
+ * getElementsAnnotatedWith and getElementsAnnotatedWithAny is
+ * consistent with the expected results stored in an
+ * AnnotatedElementInfo annotation.
  */
 @AnnotatedElementInfo(annotationName="java.lang.SuppressWarnings", expectedSize=0, names={})
 public class TestElementsAnnotatedWith extends JavacTestingAbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annotations,
-                           RoundEnvironment roundEnvironment) {
-        TypeElement annotatedElementInfoElement =
-            elements.getTypeElement("AnnotatedElementInfo");
-        Set<? extends Element> resultsMeta = Collections.emptySet();
-        Set<? extends Element> resultsBase = Collections.emptySet();
+                           RoundEnvironment roundEnv) {
+        // First check sets of annotated elements using the round
+        // environment from the annotation processing tool framework.
+        checkSetOfAnnotatedElements(roundEnv);
+
+        // Next check sets of annotated elements using a round
+        // environment which uses the default implementations of the
+        // getElementsAnnotatedWithAny methods from the interface.
+        checkSetOfAnnotatedElements(new TestingRoundEnvironment(roundEnv));
+        return true;
+    }
+
+    /**
+     * To allow testing of the executable code of the default methods
+     * for the two overloaded getElementsAnnotatedWithAny methods
+     * defined in the RoundEnvironment interface, this class delegates
+     * the non-default methods of RoundEnvironment to a given
+     * RoundEnvironment object and then explicitly calls the default
+     * methods of the interface instead of relying on the object's
+     * implementation of those methods.
+     */
+    private class TestingRoundEnvironment implements RoundEnvironment {
+        private RoundEnvironment re;
+
+        public TestingRoundEnvironment(RoundEnvironment re) {
+            this.re = re;
+        }
+
+        @Override
+        public boolean errorRaised() {
+            return re.errorRaised();
+        }
+
+        @Override
+        public Set<? extends Element> getElementsAnnotatedWith(Class<? extends Annotation> a) {
+            return re.getElementsAnnotatedWith(a);
+        }
+
+        @Override
+        public Set<? extends Element> getElementsAnnotatedWithAny(Set<Class<? extends Annotation>> a) {
+            // Default method defined in the interface
+            return RoundEnvironment.super.getElementsAnnotatedWithAny(a);
+        }
+
+        @Override
+        public Set<? extends Element> getElementsAnnotatedWith(TypeElement a) {
+            return re.getElementsAnnotatedWith(a);
+        }
 
-        if (!roundEnvironment.processingOver()) {
-            testNonAnnotations(roundEnvironment);
+        @Override
+        public Set<? extends Element> getElementsAnnotatedWithAny(TypeElement... a) {
+            // Default method defined in the interface
+            return RoundEnvironment.super.getElementsAnnotatedWithAny(a);
+        }
+
+        @Override
+        public Set<? extends Element> getRootElements() {
+            return re.getRootElements();
+        }
+
+        @Override
+        public boolean processingOver() {
+            return re.processingOver();
+        }
+
+    }
+
+    /**
+     * The method checks the following conditions:
+     *
+     * 1) The sets of elements found are equal for the TypeElement and
+     * Class<? extends Annotation> methods on logically equivalent
+     * arguments.
+     *
+     * 2) getElementsAnnotatedWithAny(X) is equal to
+     * getElementsAnnotatedWith(X') where X is a set/var-args array
+     * with one element and X' is the element.
+     *
+     * 3) Verify the result of getElementsAnnotatedWithAny({X, Y}) is equal to
+     * getElementsAnnotatedWith(X) UNION getElementsAnnotatedWith(Y).
+     */
+    void checkSetOfAnnotatedElements(RoundEnvironment re) {
+        TypeElement annotatedElemInfoElem =  elements.getTypeElement("AnnotatedElementInfo");
+
+        // For the "Any" methods, search for both the expected
+        // annotation and AnnotatedElementInfo and verify the return
+        // set is the union of searching for AnnotatedElementInfo and
+        // the other annotation
+        Set<? extends Element> resultsMeta         = Collections.emptySet();
+        Set<? extends Element> resultsMetaAny      = Collections.emptySet();
+        Set<Element>           resultsMetaMulti    = new HashSet<>();
+        Set<? extends Element> resultsMetaAnyMulti = Collections.emptySet();
+        Set<? extends Element> resultsBase         = Collections.emptySet();
+        Set<? extends Element> resultsBaseAny      = Collections.emptySet();
+        Set<? extends Element> resultsBaseAnyMulti = Collections.emptySet();
+
+        if (!re.processingOver()) {
+            testNonAnnotations(re);
 
             // Verify AnnotatedElementInfo is present on the first
             // specified type.
 
-            TypeElement firstType = typesIn(roundEnvironment.getRootElements()).iterator().next();
+            TypeElement firstType = typesIn(re.getRootElements()).iterator().next();
 
-            AnnotatedElementInfo annotatedElementInfo = firstType.getAnnotation(AnnotatedElementInfo.class);
+            AnnotatedElementInfo annotatedElemInfo =
+                firstType.getAnnotation(AnnotatedElementInfo.class);
 
             boolean failed = false;
 
-            if (annotatedElementInfo == null)
-                throw new IllegalArgumentException("Missing AnnotatedElementInfo annotation on " +
-                                                  firstType);
-            else {
-                // Verify that the annotation information is as
-                // expected.
+            Objects.requireNonNull(annotatedElemInfo,
+                                   "Missing AnnotatedElementInfo annotation on " + firstType);
+
+            // Verify that the annotation information is as expected.
+            Set<String> expectedNames =
+                new HashSet<>(Arrays.asList(annotatedElemInfo.names()));
 
-                Set<String> expectedNames = new HashSet<String>(Arrays.asList(annotatedElementInfo.names()));
+            String annotationName = annotatedElemInfo.annotationName();
+            TypeElement annotationTypeElem = elements.getTypeElement(annotationName);
 
-                resultsMeta =
-                    roundEnvironment.
-                    getElementsAnnotatedWith(elements.getTypeElement(annotatedElementInfo.annotationName()));
+            resultsMeta         = re.getElementsAnnotatedWith(annotationTypeElem);
+            resultsMetaAny      = re.getElementsAnnotatedWithAny(annotationTypeElem);
+            resultsMetaMulti.addAll(resultsMeta);
+            resultsMetaMulti.addAll(re.getElementsAnnotatedWith(annotatedElemInfoElem));
+            resultsMetaAnyMulti = re.getElementsAnnotatedWithAny(annotationTypeElem, annotatedElemInfoElem);
 
-                if (!resultsMeta.isEmpty())
-                    System.err.println("Results: " + resultsMeta);
+            if (!resultsMeta.isEmpty())
+                System.err.println("Results: " + resultsMeta);
+
+            if (!resultsMeta.equals(resultsMetaAny)) {
+                failed = true;
+                System.err.printf("Inconsistent Meta with vs withAny results");
+            }
 
-                if (resultsMeta.size() != annotatedElementInfo.expectedSize()) {
-                    failed = true;
-                    System.err.printf("Bad number of elements; expected %d, got %d%n",
-                                      annotatedElementInfo.expectedSize(), resultsMeta.size());
-                } else {
-                    for(Element element : resultsMeta) {
-                        String simpleName = element.getSimpleName().toString();
-                        if (!expectedNames.contains(simpleName) ) {
-                            failed = true;
-                            System.err.println("Name ``" + simpleName + "'' not expected.");
-                        }
+            if (resultsMeta.size() != annotatedElemInfo.expectedSize()) {
+                failed = true;
+                System.err.printf("Bad number of elements; expected %d, got %d%n",
+                                  annotatedElemInfo.expectedSize(), resultsMeta.size());
+            } else {
+                for(Element element : resultsMeta) {
+                    String simpleName = element.getSimpleName().toString();
+                    if (!expectedNames.contains(simpleName) ) {
+                        failed = true;
+                        System.err.println("Name ``" + simpleName + "'' not expected.");
                     }
                 }
             }
 
-            resultsBase = computeResultsBase(roundEnvironment, annotatedElementInfo.annotationName());
+            resultsBase    = computeResultsBase(re, annotationName);
+            resultsBaseAny = computeResultsBaseAny(re, annotationName);
+            try {
+                Set<Class<? extends Annotation>> tmp = new HashSet<>();
+                tmp.add(AnnotatedElementInfo.class);
+                tmp.add(Class.forName(annotationName).asSubclass(Annotation.class));
+                resultsBaseAnyMulti = re.getElementsAnnotatedWithAny(tmp);
+            } catch (ClassNotFoundException e) {
+                throw new RuntimeException(e);
+            }
+
+            if (!resultsBase.equals(resultsBaseAny)) {
+                failed = true;
+                System.err.printf("Inconsistent Base with vs withAny results");
+            }
 
             if (!resultsMeta.equals(resultsBase)) {
                 failed = true;
@@ -121,29 +235,53 @@
                                    "\nbase: " + resultsBase);
             }
 
+            if (!resultsMetaAnyMulti.equals(resultsMetaMulti)) {
+                failed = true;
+                System.err.println("MetaMultAny and MetaMulti sets unequal;\n meta: " + resultsMeta +
+                                   "\nbase: " + resultsBase);
+            }
+
+            if (!resultsBaseAnyMulti.equals(resultsMetaAnyMulti)) {
+                failed = true;
+                System.err.println("BaseMulti and MetaMulti sets unequal;\n meta: " + resultsMeta +
+                                   "\nbase: " + resultsBase);
+            }
+
             if (failed) {
-                System.err.println("AnnotatedElementInfo: " + annotatedElementInfo);
+                System.err.println("AnnotatedElementInfo: " + annotatedElemInfo);
                 throw new RuntimeException();
             }
         } else {
             // If processing is over without an error, the specified
-            // elements should be empty so an empty set should be returned.
-            resultsMeta = roundEnvironment.getElementsAnnotatedWith(annotatedElementInfoElement);
-            resultsBase = roundEnvironment.getElementsAnnotatedWith(AnnotatedElementInfo.class);
-            if (!resultsMeta.isEmpty())
-                throw new RuntimeException("Nonempty resultsMeta: " + resultsMeta);
-            if (!resultsBase.isEmpty())
-                throw new RuntimeException("Nonempty resultsBase: " + resultsBase);
+            // elements should be empty so an empty set should be
+            // returned.
+            throwOnNonEmpty(re.getElementsAnnotatedWith(annotatedElemInfoElem), "resultsMeta");
+            throwOnNonEmpty(re.getElementsAnnotatedWithAny(annotatedElemInfoElem), "resultsMetaAny");
+            throwOnNonEmpty(re.getElementsAnnotatedWith(AnnotatedElementInfo.class),    "resultsBase");
+            throwOnNonEmpty(re.getElementsAnnotatedWithAny(Set.of(AnnotatedElementInfo.class)), "resultsBaseAny");
+        }
+    }
 
+    private void throwOnNonEmpty(Set<? extends Element> results, String message) {
+        if (!results.isEmpty()) {
+                throw new RuntimeException("Nonempty " + message +  "\t"  + results);
         }
-        return true;
     }
 
-    private Set<? extends Element> computeResultsBase(RoundEnvironment roundEnvironment, String name) {
+    private Set<? extends Element> computeResultsBase(RoundEnvironment roundEnv, String name) {
         try {
-            return roundEnvironment.
+            return roundEnv.
                 getElementsAnnotatedWith(Class.forName(name).asSubclass(Annotation.class));
-        } catch(ClassNotFoundException cnfe) {
+        } catch (ClassNotFoundException cnfe) {
+            throw new RuntimeException(cnfe);
+        }
+    }
+
+    private Set<? extends Element> computeResultsBaseAny(RoundEnvironment roundEnv, String name) {
+        try {
+            return roundEnv.
+                getElementsAnnotatedWithAny(Set.of(Class.forName(name).asSubclass(Annotation.class)));
+        } catch (ClassNotFoundException cnfe) {
             throw new RuntimeException(cnfe);
         }
     }
@@ -152,18 +290,28 @@
      * Verify non-annotation types result in
      * IllegalArgumentExceptions.
      */
-    private void testNonAnnotations(RoundEnvironment roundEnvironment) {
+    private void testNonAnnotations(RoundEnvironment roundEnv) {
+        Class objectClass = (Class)Object.class;
+        Set<? extends Element> elements;
         try {
-            Set<? extends Element> elements = roundEnvironment.getElementsAnnotatedWith((Class)Object.class );
+            elements = roundEnv.getElementsAnnotatedWith(objectClass);
             throw new RuntimeException("Illegal argument exception not thrown");
-        } catch(IllegalArgumentException iae) {}
+        } catch (IllegalArgumentException iae) {}
 
         try {
-            Set<? extends Element> elements =
-                roundEnvironment.getElementsAnnotatedWith(processingEnv.
-                                                          getElementUtils().
-                                                          getTypeElement("java.lang.Object") );
+            elements = roundEnv.getElementsAnnotatedWithAny(Set.of(objectClass));
             throw new RuntimeException("Illegal argument exception not thrown");
-        } catch(IllegalArgumentException iae) {}
+        } catch (IllegalArgumentException iae) {}
+
+        TypeElement objectElement = processingEnv.getElementUtils().getTypeElement("java.lang.Object");
+        try {
+            elements = roundEnv.getElementsAnnotatedWith(objectElement);
+            throw new RuntimeException("Illegal argument exception not thrown");
+        } catch (IllegalArgumentException iae) {}
+
+        try {
+            elements = roundEnv.getElementsAnnotatedWithAny(objectElement);
+            throw new RuntimeException("Illegal argument exception not thrown");
+        } catch (IllegalArgumentException iae) {}
     }
 }
--- a/langtools/test/tools/javah/T6893943.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/test/tools/javah/T6893943.java	Thu May 26 17:18:12 2016 +0000
@@ -32,8 +32,8 @@
 import java.util.*;
 
 public class T6893943 {
-    static final String[] NO_ARGS = { };
-    static final String[] HELP = { "-help" };
+    static final String[] NO_ARGS = { "-XDsuppress-tool-removal-message" };
+    static final String[] SUPPRESS_WARNING_PLUS_HELP = { "-XDsuppress-tool-removal-message", "-help" };
     static final String NEWLINE = System.getProperty("line.separator");
 
     public static void main(String... args) throws Exception {
@@ -42,9 +42,9 @@
 
     void run() throws Exception {
         testSimpleAPI(NO_ARGS, 1);
-        testSimpleAPI(HELP, 0);
+        testSimpleAPI(SUPPRESS_WARNING_PLUS_HELP, 0);
         testCommand(NO_ARGS, 1);
-        testCommand(HELP, 0);
+        testCommand(SUPPRESS_WARNING_PLUS_HELP, 0);
     }
 
     void testSimpleAPI(String[] args, int expect_rc) throws Exception {
@@ -81,11 +81,6 @@
         if (out.isEmpty())
             throw new Exception("No output from javah");
 
-        if (!out.startsWith("Usage:")) {
-            System.err.println(out);
-            throw new Exception("Unexpected output from javah");
-        }
-
         if (actual_rc != expect_rc)
             throw new Exception(name + ": unexpected exit: " + actual_rc + ", expected: " + expect_rc);
     }
--- a/langtools/test/tools/javah/VersionTest.java	Thu May 26 16:02:17 2016 +0000
+++ b/langtools/test/tools/javah/VersionTest.java	Thu May 26 17:18:12 2016 +0000
@@ -37,8 +37,8 @@
         try {
             Locale.setDefault(Locale.ENGLISH);
             System.err.println(Locale.getDefault());
-            test("-version", "\\S+ version \"\\S+\"");
-            test("-fullversion", "\\S+ full version \"\\S+\"");
+            test("-version -XDsuppress-tool-removal-message", "\\S+ version \"\\S+\"");
+            test("-fullversion -XDsuppress-tool-removal-message", "\\S+ full version \"\\S+\"");
         } finally {
             Locale.setDefault(prev);
         }
@@ -47,7 +47,7 @@
     static void test(String option, String regex) {
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
-        String[] args = { option };
+        String[] args = option.split(" ");
         int rc = com.sun.tools.javah.Main.run(args, pw);
         pw.close();
         if (rc != 0)