# HG changeset patch # User lana # Date 1489101355 0 # Node ID 8df2751b6247ddff0476bf2e4a968982679308bd # Parent 03eb0d2f8485627da05eee794cc157a4555e4ced# Parent dd311cfb920b89dfbf0ccc4b6253ed4d544fa19b Merge diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java --- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Mar 09 23:15:55 2017 +0000 @@ -251,7 +251,7 @@ * @param p a visitor-specified parameter * @return a visitor-specified result * @throws UnknownDirectiveException a visitor implementation may optionally throw this exception - * @implSpec This implementation throws {@code UnknownDirectiveException}. + * @implSpec This implementation throws {@code new UnknownDirectiveException(d, p)}. */ default R visitUnknown(Directive d, P p) { throw new UnknownDirectiveException(d, p); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java --- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java Thu Mar 09 23:15:55 2017 +0000 @@ -106,7 +106,7 @@ * * @implSpec The default implementation of this method in {@code * AbstractAnnotationValueVisitor6} will always throw {@code - * UnknownAnnotationValueException}. This behavior is not + * new UnknownAnnotationValueException(av, p)}. This behavior is not * required of a subclass. * * @param av {@inheritDoc} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java --- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java Thu Mar 09 23:15:55 2017 +0000 @@ -111,7 +111,7 @@ * * @implSpec The default implementation of this method in * {@code AbstractElementVisitor6} will always throw - * {@code UnknownElementException}. + * {@code new UnknownElementException(e, p)}. * This behavior is not required of a subclass. * * @param e {@inheritDoc} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java --- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java Thu Mar 09 23:15:55 2017 +0000 @@ -142,7 +142,7 @@ * * @implSpec The default implementation of this method in {@code * AbstractTypeVisitor6} will always throw {@code - * UnknownTypeException}. This behavior is not required of a + * new UnknownTypeException(t, p)}. This behavior is not required of a * subclass. * * @param t {@inheritDoc} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java Thu Mar 09 23:15:55 2017 +0000 @@ -29,8 +29,6 @@ import java.lang.ref.WeakReference; import java.util.*; import java.util.function.BiConsumer; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; import com.sun.tools.javac.code.Symbol.CompletionFailure; import com.sun.tools.javac.code.Symbol.TypeSymbol; @@ -40,6 +38,8 @@ import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; import static com.sun.tools.javac.code.Scope.LookupKind.RECURSIVE; +import static com.sun.tools.javac.util.Iterators.createCompoundIterator; +import static com.sun.tools.javac.util.Iterators.createFilterIterator; /** A scope represents an area of visibility in a Java program. The * Scope class is a container for symbols which provides @@ -898,7 +898,11 @@ return tsym.members().getSymbols(sf, lookupKind); } }; - return si.importFrom((TypeSymbol) origin.owner) :: iterator; + List> results = + si.importFrom((TypeSymbol) origin.owner, List.nil()); + return () -> createFilterIterator(createCompoundIterator(results, + Iterable::iterator), + s -> filter.accepts(origin, s)); } catch (CompletionFailure cf) { cfHandler.accept(imp, cf); return Collections.emptyList(); @@ -918,7 +922,11 @@ return tsym.members().getSymbolsByName(name, sf, lookupKind); } }; - return si.importFrom((TypeSymbol) origin.owner) :: iterator; + List> results = + si.importFrom((TypeSymbol) origin.owner, List.nil()); + return () -> createFilterIterator(createCompoundIterator(results, + Iterable::iterator), + s -> filter.accepts(origin, s)); } catch (CompletionFailure cf) { cfHandler.accept(imp, cf); return Collections.emptyList(); @@ -942,22 +950,19 @@ public SymbolImporter(boolean inspectSuperTypes) { this.inspectSuperTypes = inspectSuperTypes; } - Stream importFrom(TypeSymbol tsym) { + List> importFrom(TypeSymbol tsym, List> results) { if (tsym == null || !processed.add(tsym)) - return Stream.empty(); + return results; - Stream result = Stream.empty(); if (inspectSuperTypes) { // also import inherited names - result = importFrom(types.supertype(tsym.type).tsym); + results = importFrom(types.supertype(tsym.type).tsym, results); for (Type t : types.interfaces(tsym.type)) - result = Stream.concat(importFrom(t.tsym), result); + results = importFrom(t.tsym, results); } - return Stream.concat(StreamSupport.stream(doLookup(tsym).spliterator(), false) - .filter(s -> filter.accepts(origin, s)), - result); + return results.prepend(doLookup(tsym)); } abstract Iterable doLookup(TypeSymbol tsym); } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Thu Mar 09 23:15:55 2017 +0000 @@ -30,12 +30,12 @@ import java.util.Collections; import java.util.EnumMap; import java.util.Map; -import java.util.function.Function; import javax.lang.model.type.*; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.TypeMetadata.Entry; +import com.sun.tools.javac.code.Types.TypeMapping; import com.sun.tools.javac.comp.Infer.IncorporationAction; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.DefinedBy.Api; @@ -222,18 +222,12 @@ this.metadata = metadata; } - /** An abstract class for mappings from types to types + /** + * A subclass of {@link Types.TypeMapping} which applies a mapping recursively to the subterms + * of a given type expression. This mapping returns the original type is no changes occurred + * when recursively mapping the original type's subterms. */ - public static abstract class TypeMapping extends Types.MapVisitor implements Function { - - @Override - public Type apply(Type type) { - return visit(type); - } - - List visit(List ts, S s) { - return ts.map(t -> visit(t, s)); - } + public static abstract class StructuralTypeMapping extends Types.TypeMapping { @Override public Type visitClassType(ClassType t, S s) { @@ -299,11 +293,6 @@ } @Override - public Type visitCapturedType(CapturedType t, S s) { - return visitTypeVar(t, s); - } - - @Override public Type visitForAll(ForAll t, S s) { return visit(t.qtype, s); } @@ -373,7 +362,7 @@ return accept(stripMetadata, null); } //where - private final static TypeMapping stripMetadata = new TypeMapping() { + private final static TypeMapping stripMetadata = new StructuralTypeMapping() { @Override public Type visitClassType(ClassType t, Void aVoid) { return super.visitClassType((ClassType)t.typeNoMetadata(), aVoid); @@ -2125,7 +2114,7 @@ } } //where - TypeMapping toTypeVarMap = new TypeMapping() { + TypeMapping toTypeVarMap = new StructuralTypeMapping() { @Override public Type visitUndetVar(UndetVar uv, Void _unused) { return uv.inst != null ? uv.inst : uv.qtype; diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Thu Mar 09 23:15:55 2017 +0000 @@ -34,6 +34,7 @@ import java.util.Set; import java.util.WeakHashMap; import java.util.function.BiPredicate; +import java.util.function.Function; import java.util.stream.Collector; import javax.tools.JavaFileObject; @@ -2095,7 +2096,7 @@ } } // where - private TypeMapping erasure = new TypeMapping() { + private TypeMapping erasure = new StructuralTypeMapping() { private Type combineMetadata(final Type s, final Type t) { if (t.getMetadata() != TypeMetadata.EMPTY) { @@ -3019,7 +3020,7 @@ return t.map(new Subst(from, to)); } - private class Subst extends TypeMapping { + private class Subst extends StructuralTypeMapping { List from; List to; @@ -4707,6 +4708,25 @@ final public Type visit(Type t) { return t.accept(this, null); } public Type visitType(Type t, S s) { return t; } } + + /** + * An abstract class for mappings from types to types (see {@link Type#map(TypeMapping)}. + * This class implements the functional interface {@code Function}, that allows it to be used + * fluently in stream-like processing. + */ + public static class TypeMapping extends MapVisitor implements Function { + @Override + public Type apply(Type type) { return visit(type); } + + List visit(List ts, S s) { + return ts.map(t -> visit(t, s)); + } + + @Override + public Type visitCapturedType(CapturedType t, S s) { + return visitTypeVar(t, s); + } + } // diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Mar 09 23:15:55 2017 +0000 @@ -3058,7 +3058,8 @@ if (!returnType.hasTag(VOID) && !resType.hasTag(VOID)) { if (resType.isErroneous() || - new FunctionalReturnContext(checkContext).compatible(resType, returnType, types.noWarnings)) { + new FunctionalReturnContext(checkContext).compatible(resType, returnType, + checkContext.checkWarner(tree, resType, returnType))) { incompatibleReturnType = null; } } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Mar 09 23:15:55 2017 +0000 @@ -28,7 +28,8 @@ import com.sun.source.tree.LambdaExpressionTree.BodyKind; import com.sun.source.tree.NewClassTree; import com.sun.tools.javac.code.*; -import com.sun.tools.javac.code.Type.TypeMapping; +import com.sun.tools.javac.code.Type.StructuralTypeMapping; +import com.sun.tools.javac.code.Types.TypeMapping; import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext; import com.sun.tools.javac.comp.Resolve.ResolveError; import com.sun.tools.javac.resources.CompilerProperties.Fragments; @@ -929,7 +930,7 @@ * where T is computed by retrieving the type that has already been * computed for D during a previous deferred attribution round of the given kind. */ - class DeferredTypeMap extends TypeMapping { + class DeferredTypeMap extends StructuralTypeMapping { DeferredAttrContext deferredAttrContext; protected DeferredTypeMap(AttrMode mode, Symbol msym, MethodResolutionPhase phase) { diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Thu Mar 09 23:15:55 2017 +0000 @@ -26,6 +26,7 @@ package com.sun.tools.javac.comp; import com.sun.tools.javac.code.Type.UndetVar.UndetVarListener; +import com.sun.tools.javac.code.Types.TypeMapping; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCTypeCast; import com.sun.tools.javac.tree.TreeInfo; @@ -61,9 +62,6 @@ import java.util.Set; import java.util.function.BiFunction; import java.util.function.BiPredicate; -import java.util.stream.Collectors; - -import com.sun.tools.javac.main.Option; import static com.sun.tools.javac.code.TypeTag.*; @@ -628,7 +626,7 @@ } } - TypeMapping fromTypeVarFun = new TypeMapping() { + TypeMapping fromTypeVarFun = new StructuralTypeMapping() { @Override public Type visitTypeVar(TypeVar tv, Void aVoid) { UndetVar uv = new UndetVar(tv, incorporationEngine(), types); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -334,6 +334,9 @@ } InferenceContext min(List roots, boolean shouldSolve, Warner warn) { + if (roots.length() == inferencevars.length()) { + return this; + } ReachabilityVisitor rv = new ReachabilityVisitor(); rv.scan(roots); if (rv.min.size() == inferencevars.length()) { @@ -347,8 +350,8 @@ ListBuffer minUndetVars = new ListBuffer<>(); for (Type minVar : minVars) { UndetVar uv = (UndetVar)asUndetVar(minVar); - Assert.check(uv.incorporationActions.size() == 0); - UndetVar uv2 = new UndetVar((TypeVar)minVar, infer.incorporationEngine(), types); + Assert.check(uv.incorporationActions.isEmpty()); + UndetVar uv2 = uv.dup(types); for (InferenceBound ib : InferenceBound.values()) { List newBounds = uv.getBounds(ib).stream() .filter(b -> !redundantVars.contains(b)) @@ -363,15 +366,19 @@ for (Type t : minContext.inferencevars) { //add listener that forwards notifications to original context minContext.addFreeTypeListener(List.of(t), (inferenceContext) -> { - List depVars = List.from(rv.minMap.get(t)); - solve(depVars, warn); - notifyChange(); + ((UndetVar)asUndetVar(t)).setInst(inferenceContext.asInstType(t)); + infer.doIncorporation(inferenceContext, warn); + solve(List.from(rv.minMap.get(t)), warn); + notifyChange(); }); } if (shouldSolve) { //solve definitively unreachable variables List unreachableVars = redundantVars.diff(List.from(rv.equiv)); - solve(unreachableVars, warn); + minContext.addFreeTypeListener(minVars, (inferenceContext) -> { + solve(unreachableVars, warn); + notifyChange(); + }); } return minContext; } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Mar 09 23:15:55 2017 +0000 @@ -2354,7 +2354,7 @@ (flags & ABSTRACT) == 0 && !name.equals(names.clinit)) { if (majorVersion > Version.V52.major || (majorVersion == Version.V52.major && minorVersion >= Version.V52.minor)) { - if ((flags & STATIC) == 0) { + if ((flags & (STATIC | PRIVATE)) == 0) { currentOwner.flags_field |= DEFAULT; flags |= DEFAULT | ABSTRACT; } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Iterators.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Iterators.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Iterators.java Thu Mar 09 23:15:55 2017 +0000 @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import java.util.function.Function; +import java.util.function.Predicate; /** Utilities for Iterators. * @@ -92,4 +93,32 @@ return null; } }; + + public static Iterator createFilterIterator(Iterator input, Predicate test) { + return new Iterator() { + private E current = update(); + private E update () { + while (input.hasNext()) { + E sym = input.next(); + if (test.test(sym)) { + return sym; + } + } + + return null; + } + @Override + public boolean hasNext() { + return current != null; + } + + @Override + public E next() { + E res = current; + current = update(); + return res; + } + }; + } + } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2003, 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. 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 jdk.javadoc.doclet; + +import java.util.Locale; +import java.util.Set; + +import javax.lang.model.SourceVersion; + +import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet; + +/** + * This doclet generates HTML-formatted documentation for the specified modules, packages and types. + */ +public class StandardDoclet implements Doclet { + + private final HtmlDoclet htmlDoclet; + + public StandardDoclet() { + htmlDoclet = new HtmlDoclet(); + } + + @Override + public void init(Locale locale, Reporter reporter) { + htmlDoclet.init(locale, reporter); + } + + @Override + public String getName() { + return "Standard"; + } + + @Override + public Set getSupportedOptions() { + return htmlDoclet.getSupportedOptions(); + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return htmlDoclet.getSupportedSourceVersion(); + } + + @Override + public boolean run(DocletEnvironment docEnv) { + return htmlDoclet.run(docEnv); + } +} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute 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 jdk.javadoc.doclet; + +import java.util.List; +import java.util.Set; + +import com.sun.source.doctree.DocTree; + +/** + * The interface for a custom taglet supported by doclets such as + * the {@link jdk.javadoc.doclet.StandardDoclet standard doclet}. + * Custom taglets are used to handle custom tags in documentation + * comments. + * + *

A custom taglet must implement this interface, and must have + * a public default constructor (i.e. a public constructor with no + * parameters), by which, the doclet will instantiate and + * register the custom taglet. + * + * @since 9 + */ + +public interface Taglet { + + /** + * Returns the set of locations in which a tag may be used. + * @return the set of locations in which a tag may be used + */ + Set getAllowedLocations(); + + /** + * Indicates whether this taglet is for inline tags or not. + * @return true if this taglet is for an inline tag, and false otherwise + */ + boolean isInlineTag(); + + /** + * Returns the name of the tag. + * @return the name of this custom tag. + */ + String getName(); + + /** + * Returns the string representation of a series of instances of + * this tag to be included in the generated output. + * If this taglet is for an {@link #isInlineTag inline} tag} it will + * be called once per instance of the tag, each time with a singleton list. + * Otherwise, if this tag is a block tag, it will be called once per + * comment, with a list of all the instances of the tag in the comment. + * @param tags the list of {@code DocTree} containing one or more + * instances of this tag + * @return the string representation of the tags to be included in + * the generated output + */ + String toString(List tags); + + /** + * The kind of location in which a tag may be used. + */ + public static enum Location { + /** In an Overview document. */ + OVERVIEW, + /** In the documentation for a module. */ + MODULE, + /** In the documentation for a package. */ + PACKAGE, + /** In the documentation for a class, interface or enum. */ + TYPE, + /** In the documentation for a constructor. */ + CONSTRUCTOR, + /** In the documentation for a method. */ + METHOD, + /** In the documentation for a field. */ + FIELD + } +} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java Thu Mar 09 23:15:55 2017 +0000 @@ -29,6 +29,12 @@ * to inspect the source-level structures of programs and * libraries, including API comments embedded in the source. * + *

+ * The {@link StandardDoclet standard doclet} can be used to + * generate HTML-formatted documentation. It supports user-defined + * {@link Taglet taglets}, which can be used to generate customized + * output for user-defined tags in documentation comments. + * *

* Note: The declarations in this package supersede those * in the older package {@code com.sun.javadoc}. For details on the diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/Taglet.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/Taglet.java Thu Mar 09 21:35:20 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * 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 - * 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 jdk.javadoc.doclet.taglet; - -import java.util.List; -import java.util.Set; - -import com.sun.source.doctree.DocTree; - -/** - * The interface for a custom tag used by Doclets. A custom - * tag must implement this interface, and must have a public - * default constructor (i.e. a public constructor with no - * parameters), by which, the doclet will instantiate and - * register the custom tag. - * - * @since 9 - */ - -public interface Taglet { - - /** - * Returns the set of locations in which a taglet may be used. - * @return the set of locations in which a taglet may be used - * allowed in or an empty set. - */ - Set getAllowedLocations(); - - /** - * Indicates the tag is an inline or a body tag. - * @return true if this Taglet - * is an inline tag, false otherwise. - */ - boolean isInlineTag(); - - /** - * Returns the name of the tag. - * @return the name of this custom tag. - */ - String getName(); - - /** - * Given the {@link DocTree DocTree} representation of this custom - * tag, return its string representation, which is output - * to the generated page. - * @param tag the Tag representation of this custom tag. - * @return the string representation of this Tag. - */ - String toString(DocTree tag); - - /** - * Given a List of {@link DocTree DocTrees} representing this custom - * tag, return its string representation, which is output - * to the generated page. This method should - * return null if this taglet represents an inline or body tag. - * @param tags the list of DocTrees representing this custom tag. - * @return the string representation of this Tag. - */ - String toString(List tags); - - /** - * The kind of location. - */ - public static enum Location { - /** In an Overview document. */ - OVERVIEW, - /** In the documentation for a module. */ - MODULE, - /** In the documentation for a package. */ - PACKAGE, - /** In the documentation for a class, interface or enum. */ - TYPE, - /** In the documentation for a constructor. */ - CONSTRUCTOR, - /** In the documentation for a method. */ - METHOD, - /** In the documentation for a field. */ - FIELD - } -} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/package-info.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/package-info.java Thu Mar 09 21:35:20 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2003, 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. 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. - */ - -/** - * The Taglet API provides a way to declare custom tags that can be - * used by the standard doclet. - * - *

- * Note: The declarations in this package supersede those - * in the older package {@code com.sun.tools.doclets}. - *

- * - * @since 9 - */ -package jdk.javadoc.doclet.taglet; diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclets/StandardDoclet.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclets/StandardDoclet.java Thu Mar 09 21:35:20 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, 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. 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 jdk.javadoc.doclets; - -import java.util.Locale; -import java.util.Set; - -import javax.lang.model.SourceVersion; - -import jdk.javadoc.doclet.Doclet; -import jdk.javadoc.doclet.DocletEnvironment; -import jdk.javadoc.doclet.Reporter; -import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet; - -/** - * This doclet generates HTML-formatted documentation for the specified modules, packages and types. - */ -public class StandardDoclet implements Doclet { - - private final HtmlDoclet htmlDoclet; - - public StandardDoclet() { - htmlDoclet = new HtmlDoclet(); - } - - @Override - public void init(Locale locale, Reporter reporter) { - htmlDoclet.init(locale, reporter); - } - - @Override - public String getName() { - return "Standard"; - } - - @Override - public Set getSupportedOptions() { - return htmlDoclet.getSupportedOptions(); - } - - @Override - public SourceVersion getSupportedSourceVersion() { - return htmlDoclet.getSupportedSourceVersion(); - } - - @Override - public boolean run(DocletEnvironment docEnv) { - return htmlDoclet.run(docEnv); - } -} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclets/package-info.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclets/package-info.java Thu Mar 09 21:35:20 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * 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. 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. - */ - -/** - * This package contains standard, supported doclets. - */ -package jdk.javadoc.doclets; - diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java Thu Mar 09 23:15:55 2017 +0000 @@ -34,7 +34,7 @@ import jdk.javadoc.doclet.Doclet; import jdk.javadoc.doclet.DocletEnvironment; -import jdk.javadoc.doclets.StandardDoclet; +import jdk.javadoc.doclet.StandardDoclet; import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet; import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder; import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory; diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java Thu Mar 09 23:15:55 2017 +0000 @@ -251,7 +251,7 @@ tagClassLoader = fileManager.getClassLoader(TAGLET_PATH); Class customTagClass = tagClassLoader.loadClass(classname); Object instance = customTagClass.getConstructor().newInstance(); - Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.taglet.Taglet)instance); + Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.Taglet)instance); String tname = newLegacy.getName(); Taglet t = customTags.get(tname); if (t != null) { @@ -315,8 +315,8 @@ private void checkTaglet(Object taglet) { if (taglet instanceof Taglet) { checkTagName(((Taglet) taglet).getName()); - } else if (taglet instanceof jdk.javadoc.doclet.taglet.Taglet) { - jdk.javadoc.doclet.taglet.Taglet legacyTaglet = (jdk.javadoc.doclet.taglet.Taglet) taglet; + } else if (taglet instanceof jdk.javadoc.doclet.Taglet) { + jdk.javadoc.doclet.Taglet legacyTaglet = (jdk.javadoc.doclet.Taglet) taglet; customTags.remove(legacyTaglet.getName()); customTags.put(legacyTaglet.getName(), new UserTaglet(legacyTaglet)); checkTagName(legacyTaglet.getName()); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/UserTaglet.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/UserTaglet.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/UserTaglet.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * 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,6 +24,7 @@ */ package jdk.javadoc.internal.doclets.toolkit.taglets; +import java.util.Collections; import java.util.List; import javax.lang.model.element.Element; @@ -33,10 +34,10 @@ import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.Utils; -import static jdk.javadoc.doclet.taglet.Taglet.Location.*; +import static jdk.javadoc.doclet.Taglet.Location.*; /** - * A taglet wrapper, allows the public taglet {@link jdk.javadoc.doclet.taglet.Taglet} + * A taglet wrapper, allows the public taglet {@link jdk.javadoc.doclet.Taglet} * wrapped into an internal Taglet representation. * *

This is NOT part of any supported API. @@ -48,9 +49,9 @@ */ public class UserTaglet implements Taglet { - final private jdk.javadoc.doclet.taglet.Taglet userTaglet; + final private jdk.javadoc.doclet.Taglet userTaglet; - public UserTaglet(jdk.javadoc.doclet.taglet.Taglet t) { + public UserTaglet(jdk.javadoc.doclet.Taglet t) { userTaglet = t; } @@ -131,7 +132,7 @@ */ public Content getTagletOutput(Element element, DocTree tag, TagletWriter writer){ Content output = writer.getOutputInstance(); - output.addContent(new RawHtml(userTaglet.toString(tag))); + output.addContent(new RawHtml(userTaglet.toString(Collections.singletonList(tag)))); return output; } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java Thu Mar 09 23:15:55 2017 +0000 @@ -188,6 +188,11 @@ .classTrees(classTrees.toList()) .scanSpecifiedItems(); + // abort, if errors were encountered during modules initialization + if (messager.hasErrors()) { + return null; + } + // Parse the files in the packages and subpackages to be documented ListBuffer packageTrees = new ListBuffer<>(); parse(etable.getFilesToParse(), packageTrees, false); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Thu Mar 09 23:15:55 2017 +0000 @@ -93,7 +93,7 @@ com.sun.tools.doclets.standard.Standard.class; private static final Class StdDoclet = - jdk.javadoc.doclets.StandardDoclet.class; + jdk.javadoc.doclet.StandardDoclet.class; /** Context for this invocation. */ private final Context context; diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.javadoc/share/classes/module-info.java --- a/langtools/src/jdk.javadoc/share/classes/module-info.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/module-info.java Thu Mar 09 23:15:55 2017 +0000 @@ -40,8 +40,6 @@ exports com.sun.tools.javadoc; exports jdk.javadoc.doclet; - exports jdk.javadoc.doclet.taglet; - exports jdk.javadoc.doclets; provides java.util.spi.ToolProvider with jdk.javadoc.internal.tool.JavadocToolProvider; diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Mar 09 23:15:55 2017 +0000 @@ -524,7 +524,7 @@ e.printStackTrace(); return EXIT_CMDERR; } catch (MultiReleaseException e) { - reportError(e.getKey(), (Object)e.getMsg()); + reportError(e.getKey(), e.getParams()); return EXIT_CMDERR; // could be EXIT_ABNORMAL sometimes } finally { log.flush(); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/MultiReleaseException.java --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/MultiReleaseException.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/MultiReleaseException.java Thu Mar 09 23:15:55 2017 +0000 @@ -34,7 +34,7 @@ class MultiReleaseException extends RuntimeException { private static final long serialVersionUID = 4474870142461654108L; private final String key; - private final String[] msg; + private final Object[] params; /** * Constructs an {@code MultiReleaseException} with the specified detail @@ -42,13 +42,13 @@ * * @param key * The key that identifies the message in the jdeps.properties file - * @param msg + * @param params * The detail message array */ - public MultiReleaseException(String key, String... msg) { + public MultiReleaseException(String key, Object... params) { super(); this.key = key; - this.msg = msg; + this.params = params; } /** @@ -63,7 +63,7 @@ * * @return the detailed error message array */ - public String[] getMsg() { - return msg; + public Object[] getParams() { + return params; } } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Thu Mar 09 23:15:55 2017 +0000 @@ -93,7 +93,7 @@ main.opt.R=\ \ -R -recursive Recursively traverse all run-time dependences.\n\ \ The -R option implies -filter:none. If -p,\n\ -\ -e, -foption is specified, only the matching\n\ +\ -e, -f option is specified, only the matching\n\ \ dependences are analyzed. main.opt.I=\ @@ -196,8 +196,8 @@ err.root.module.not.set=root module set empty err.option.already.specified={0} option specified more than once. err.filter.not.specified=--package (-p), --regex (-e), --require option must be specified -err.multirelease.option.exists={0} is not a multi-release jar file, but the --multi-release option is set -err.multirelease.option.notfound={0} is a multi-release jar file, but the --multi-release option is not set +err.multirelease.option.exists={0} is not a multi-release jar file but --multi-release option is set +err.multirelease.option.notfound={0} is a multi-release jar file but --multi-release option is not set err.multirelease.version.associated=class {0} already associated with version {1}, trying to add version {2} err.multirelease.jar.malformed=malformed multi-release jar, {0}, bad entry: {1} warn.invalid.arg=Path does not exist: {0} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java Thu Mar 09 23:15:55 2017 +0000 @@ -43,7 +43,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; @@ -82,7 +81,7 @@ ConsoleIOContext(JShellTool repl, InputStream cmdin, PrintStream cmdout) throws Exception { this.repl = repl; - this.input = new StopDetectingInputStream(() -> repl.state.stop(), ex -> repl.hard("Error on input: %s", ex)); + this.input = new StopDetectingInputStream(() -> repl.stop(), ex -> repl.hard("Error on input: %s", ex)); Terminal term; if (System.getProperty("test.jdk") != null) { term = new TestTerminal(input); @@ -617,7 +616,7 @@ @Override public void perform(ConsoleReader in) throws IOException { - repl.state.eval("import " + type + ";"); + repl.processCompleteSource("import " + type + ";"); in.println("Imported: " + type); performToVar(in, stype); } @@ -641,7 +640,7 @@ @Override public void perform(ConsoleReader in) throws IOException { - repl.state.eval("import " + fqn + ";"); + repl.processCompleteSource("import " + fqn + ";"); in.println("Imported: " + fqn); in.redrawLine(); } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Thu Mar 09 23:15:55 2017 +0000 @@ -187,7 +187,7 @@ private Options options; SourceCodeAnalysis analysis; - JShell state = null; + private JShell state = null; Subscription shutdownSubscription = null; static final EditorSetting BUILT_IN_EDITOR = new EditorSetting(null, false); @@ -1704,6 +1704,11 @@ return null; } + // Attempt to stop currently running evaluation + void stop() { + state.stop(); + } + // --- Command implementations --- private static final String[] SET_SUBCOMMANDS = new String[]{ @@ -2857,7 +2862,7 @@ } } //where - private boolean processCompleteSource(String source) throws IllegalStateException { + boolean processCompleteSource(String source) throws IllegalStateException { debug("Compiling: %s", source); boolean failed = false; boolean isActive = false; diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java --- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java Thu Mar 09 23:15:55 2017 +0000 @@ -36,7 +36,7 @@ import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.code.Type.CapturedType; -import com.sun.tools.javac.code.Type.TypeMapping; +import com.sun.tools.javac.code.Type.StructuralTypeMapping; import com.sun.tools.javac.code.Type.TypeVar; import com.sun.tools.javac.code.Type.WildcardType; import com.sun.tools.javac.code.Types; @@ -158,7 +158,7 @@ } } - class TypeProjection extends TypeMapping { + class TypeProjection extends StructuralTypeMapping { List vars; Set seen = new HashSet<>(); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/doclet/testLegacyTaglet/Check.java --- a/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/Check.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/Check.java Thu Mar 09 23:15:55 2017 +0000 @@ -26,12 +26,11 @@ import java.util.Set; import com.sun.source.doctree.DocTree; -import jdk.javadoc.doclet.taglet.Taglet; +import jdk.javadoc.doclet.Taglet; public class Check implements Taglet { private static final String TAG_NAME = "check"; - private static final String TAG_HEADER = "Check:"; private final EnumSet allowedSet = EnumSet.allOf(Location.class); @@ -45,6 +44,7 @@ * * @return false since the tag is not an inline tag. */ + @Override public boolean isInlineTag() { return false; } @@ -54,28 +54,19 @@ * * @return the name of this tag. */ + @Override public String getName() { return TAG_NAME; } /** - * Given the DocTree representation of this custom tag, return its string - * representation. - * - * @param tag the DocTree representing this custom tag. - */ - public String toString(DocTree tag) { - return "

" + TAG_HEADER + ":
" + - tag.toString() + "
\n"; - } - - /** - * Given an array of DocTrees representing this custom tag, return its string + * Given a list of DocTrees representing this custom tag, return its string * representation. * * @param tags the array of tags representing this custom tag. * @return null to test if the javadoc throws an exception or not. */ + @Override public String toString(List tags) { return null; } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/doclet/testLegacyTaglet/TestLegacyTaglet.java --- a/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/TestLegacyTaglet.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/TestLegacyTaglet.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * 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 4638723 8015882 + * @bug 4638723 8015882 8176131 8176331 * @summary Test to ensure that the refactored version of the standard * doclet still works with Taglets that implement the 1.4.0 interface. * @author jamieh diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/doclet/testLegacyTaglet/ToDoTaglet.java --- a/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/ToDoTaglet.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/ToDoTaglet.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * 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,9 @@ import com.sun.source.doctree.UnknownBlockTagTree; import com.sun.source.doctree.UnknownInlineTagTree; import com.sun.source.util.SimpleDocTreeVisitor; -import jdk.javadoc.doclet.taglet.Taglet; -import jdk.javadoc.doclet.taglet.Taglet.Location; -import static jdk.javadoc.doclet.taglet.Taglet.Location.*; +import jdk.javadoc.doclet.Taglet; +import jdk.javadoc.doclet.Taglet.Location; +import static jdk.javadoc.doclet.Taglet.Location.*; /** @@ -84,19 +84,6 @@ } /** - * Given the DocTree representation of this custom - * tag, return its string representation. - * @param tag the DocTree representing this custom tag. - */ - public String toString(DocTree tag) { - - return "
" + HEADER + "
" - + "
" - + getText(tag) - + "
\n"; - } - - /** * Given an array of Tags representing this custom * tag, return its string representation. * @param tags the array of DocTrees representing this custom tag. @@ -104,7 +91,7 @@ @Override public String toString(List tags) { if (tags.isEmpty()) { - return null; + return ""; } String result = "\n
" + HEADER + "
"; result += "
"; diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/doclet/testLegacyTaglet/UnderlineTaglet.java --- a/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/UnderlineTaglet.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/doclet/testLegacyTaglet/UnderlineTaglet.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * 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,8 +26,8 @@ import java.util.Set; import com.sun.source.doctree.DocTree; -import jdk.javadoc.doclet.taglet.Taglet; -import static jdk.javadoc.doclet.taglet.Taglet.Location.*; +import jdk.javadoc.doclet.Taglet; +import static jdk.javadoc.doclet.Taglet.Location.*; /** * A sample Inline Taglet representing {@underline ...}. The text @@ -69,20 +69,10 @@ /** * Given the DocTree representation of this custom * tag, return its string representation. - * @param tag he DocTree representation of this custom tag. - */ - @Override - public String toString(DocTree tag) { - return "" + ToDoTaglet.getText(tag) + ""; - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method {@link #tostring(DocTree)} should be used to convert this - * inline tag to a string. + * @param tags the DocTree representation of this custom tag. */ @Override public String toString(List tags) { - return null; + return "" + ToDoTaglet.getText(tags.get(0)) + ""; } } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/tool/EnsureNewOldDoclet.java --- a/langtools/test/jdk/javadoc/tool/EnsureNewOldDoclet.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/tool/EnsureNewOldDoclet.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * 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 8035473 8154482 8154399 8159096 + * @bug 8035473 8154482 8154399 8159096 8176131 8176331 * @summary make sure the javadoc tool responds correctly to Xold, * old doclets and taglets. * @library /tools/lib @@ -87,7 +87,7 @@ CLASS_NAME + "\\$OldTaglet.*"); final static String OLD_STDDOCLET = "com.sun.tools.doclets.standard.Standard"; - final static String NEW_STDDOCLET = "jdk.javadoc.doclets.StandardDoclet"; + final static String NEW_STDDOCLET = "jdk.javadoc.doclet.StandardDoclet"; public EnsureNewOldDoclet() throws Exception { @@ -340,7 +340,7 @@ } } - public static class NewTaglet implements jdk.javadoc.doclet.taglet.Taglet { + public static class NewTaglet implements jdk.javadoc.doclet.Taglet { @Override public Set getAllowedLocations() { @@ -358,11 +358,6 @@ } @Override - public String toString(DocTree tag) { - return tag.toString(); - } - - @Override public String toString(List tags) { return tags.toString(); } diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/tool/api/basic/taglets/UnderlineTaglet.java --- a/langtools/test/jdk/javadoc/tool/api/basic/taglets/UnderlineTaglet.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/tool/api/basic/taglets/UnderlineTaglet.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -45,7 +45,7 @@ import com.sun.source.doctree.UnknownBlockTagTree; import com.sun.source.doctree.UnknownInlineTagTree; import com.sun.source.util.SimpleDocTreeVisitor; -import jdk.javadoc.doclet.taglet.Taglet; +import jdk.javadoc.doclet.Taglet; /** * A sample Inline Taglet representing {@underline ...}. This tag can @@ -85,22 +85,12 @@ } /** - * Given the Tag representation of this custom + * Given the DocTree representation of this custom * tag, return its string representation. - * @param tag he Tag representation of this custom tag. - */ - public String toString(DocTree tag) { - return "" + getText(tag) + ""; - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method {@link #tostring(Tag)} should be used to convert this - * inline tag to a string. - * @param tags the array of Tags representing of this custom tag. + * @param tags the list of trees representing of this custom tag. */ public String toString(List tags) { - return null; + return "" + getText(tags.get(0)) + ""; } static String getText(DocTree dt) { diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/tool/modules/ModuleTestBase.java --- a/langtools/test/jdk/javadoc/tool/modules/ModuleTestBase.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/tool/modules/ModuleTestBase.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -184,6 +184,10 @@ assertPresent(regex, Task.OutputKind.DIRECT); } + void assertErrorNotPresent(String regex) throws Exception { + assertNotPresent(regex, Task.OutputKind.DIRECT); + } + void assertPresent(String regex, Task.OutputKind kind) throws Exception { List foundList = tb.grep(regex, currentTask.getOutputLines(kind)); if (foundList.isEmpty()) { @@ -192,6 +196,14 @@ } } + void assertNotPresent(String regex, Task.OutputKind kind) throws Exception { + List foundList = tb.grep(regex, currentTask.getOutputLines(kind)); + if (!foundList.isEmpty()) { + dumpDocletDiagnostics(); + throw new Exception(regex + " found in: " + kind); + } + } + void dumpDocletDiagnostics() { for (Task.OutputKind kind : Task.OutputKind.values()) { String output = currentTask.getOutput(kind); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/jdk/javadoc/tool/modules/Modules.java --- a/langtools/test/jdk/javadoc/tool/modules/Modules.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/jdk/javadoc/tool/modules/Modules.java Thu Mar 09 23:15:55 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * 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 8159305 8166127 + * @bug 8159305 8166127 8175860 * @summary Tests primarily the module graph computations. * @modules * jdk.javadoc/jdk.javadoc.internal.api @@ -38,6 +38,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import toolbox.*; import toolbox.Task.Expect; @@ -93,6 +94,29 @@ } @Test + public void testMissingModuleWithSourcePath(Path base) throws Exception { + Path src = base.resolve("src"); + Path mod = src.resolve("m1"); + + ModuleBuilder mb1 = new ModuleBuilder(tb, "m1"); + mb1.comment("The first module.") + .exports("m1pub") + .requires("m2") + .classes("package m1pub; /** Class A */ public class A {}") + .classes("package m1pro; /** Class B */ public class B {}") + .write(src); + + Path javafile = Paths.get(mod.toString(), "m1pub/A.java"); + + execNegativeTask("--source-path", mod.toString(), + javafile.toString()); + + assertErrorPresent("error: cannot access module-info"); + assertErrorNotPresent("error - fatal error encountered"); + + } + + @Test public void testMultipleModulesAggregatedModuleOption(Path base) throws Exception { Path src = base.resolve("src"); diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/tools/javac/T8175235/InferenceRegressionTest01.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/T8175235/InferenceRegressionTest01.java Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute 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 8175235 + * @summary type inference regression after JDK-8046685 + * @compile InferenceRegressionTest01.java + */ + +import java.util.function.Predicate; + +abstract class InferenceRegressionTest01 { + + void f(String r) { + a(r, c(o(p(s -> s.isEmpty())))); + } + + abstract U o(U u); + abstract Predicate c(Predicate xs); + abstract void a(S a, Predicate m); + abstract Predicate p(Predicate p); +} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/tools/javac/T8175235/InferenceRegressionTest02.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/T8175235/InferenceRegressionTest02.java Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute 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 8175235 + * @summary type inference regression after JDK-8046685 + * @library /tools/javac/lib + * @modules jdk.compiler/com.sun.source.util + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.file + * jdk.compiler/com.sun.tools.javac.tree + * jdk.compiler/com.sun.tools.javac.util + * @build DPrinter + * @run main InferenceRegressionTest02 + */ + +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.ToolProvider; + +import com.sun.source.tree.CompilationUnitTree; +import com.sun.source.util.JavacTask; +import com.sun.source.util.Trees; +import com.sun.tools.javac.api.JavacTrees; +import com.sun.tools.javac.file.JavacFileManager; +import com.sun.tools.javac.tree.JCTree; +import com.sun.tools.javac.util.Assert; +import com.sun.tools.javac.util.Context; + +public class InferenceRegressionTest02 { + public static void main(String... args) throws Exception { + new InferenceRegressionTest02().run(); + } + + void run() throws Exception { + Context context = new Context(); + JavacFileManager.preRegister(context); + Trees trees = JavacTrees.instance(context); + StringWriter strOut = new StringWriter(); + PrintWriter pw = new PrintWriter(strOut); + DPrinter dprinter = new DPrinter(pw, trees); + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); + JavacTask ct = (JavacTask)tool.getTask(null, null, null, null, null, Arrays.asList(new JavaSource())); + Iterable elements = ct.parse(); + ct.analyze(); + Assert.check(elements.iterator().hasNext()); + dprinter.treeTypes(true).printTree("", (JCTree)elements.iterator().next()); + String output = strOut.toString(); + Assert.check(!output.contains("java.lang.Object"), "there shouldn't be any type instantiated to Object"); + } + + static class JavaSource extends SimpleJavaFileObject { + + String source = + "import java.util.function.*;\n" + + "import java.util.*;\n" + + "import java.util.stream.*;\n" + + + "class Foo {\n" + + " void test(List> ls) {\n" + + " Map> res = ls.stream()\n" + + " .collect(Collectors.groupingBy(Map.Entry::getKey,\n" + + " HashMap::new,\n" + + " Collectors.mapping(Map.Entry::getValue, Collectors.toSet())));\n" + + " }\n" + + "}"; + + public JavaSource() { + super(URI.create("myfo:/Foo.java"), JavaFileObject.Kind.SOURCE); + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + } +} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/tools/javac/defaultMethods/private/PrivateInterfaceMethodProcessorTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/defaultMethods/private/PrivateInterfaceMethodProcessorTest.java Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute 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 8175184 + * @summary Annotation processor observes interface private methods as default methods + * @library /tools/javac/lib + * @modules java.compiler + * jdk.compiler + * @build JavacTestingAbstractProcessor PrivateInterfaceMethodProcessorTest + * @compile/process -processor PrivateInterfaceMethodProcessorTest -proc:only PrivateInterfaceMethodProcessorTest_I + */ + +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import static javax.lang.model.util.ElementFilter.*; + +interface PrivateInterfaceMethodProcessorTest_I { + private void foo() {} +} + +public class PrivateInterfaceMethodProcessorTest extends JavacTestingAbstractProcessor { + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + for (Element element : roundEnv.getRootElements()) { + for (ExecutableElement method : methodsIn(element.getEnclosedElements())) { + if (method.isDefault()) { + throw new AssertionError("Unexpected default method seen"); + } + } + } + } + return true; + } +} \ No newline at end of file diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/tools/javac/lambda/T8175317.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/T8175317.java Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,31 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8175317 + * @summary javac does not issue unchecked warnings when checking method reference return types + * @compile/fail/ref=T8175317.out -Werror -Xlint:unchecked -XDrawDiagnostics T8175317.java + */ + +import java.util.function.*; +import java.util.*; + +class T8175317 { + void m(Supplier> s) { } + + void testMethodLambda(List l) { + m(() -> l); + } + + void testAssignLambda(List l) { + Supplier> s = () -> l; + } + + void testMethodMref() { + m(this::g); + } + + void testAssignMref() { + Supplier> s = this::g; + } + + List g() { return null; } +} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/tools/javac/lambda/T8175317.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/T8175317.out Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,7 @@ +T8175317.java:15:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.function.Supplier>, java.util.function.Supplier>, kindname.class, T8175317 +T8175317.java:19:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List +T8175317.java:23:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.function.Supplier>, java.util.function.Supplier>, kindname.class, T8175317 +T8175317.java:27:36: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List +- compiler.err.warnings.and.werror +1 error +4 warnings diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/tools/javac/overload/T8176265.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/overload/T8176265.java Thu Mar 09 23:15:55 2017 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute 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 8176265 + * @summary Method overload resolution on a covariant base type doesn't work in 9 + * @compile T8176265.java + */ + +class T8176265 { + static class Sup { } + static class Sub extends Sup { } + + void method(Sup f) { } + void method(Sub f) { } + + + static void m(T8176265 test, Sub sz) { + test.method(sz); + } +} diff -r 03eb0d2f8485 -r 8df2751b6247 langtools/test/tools/jdeps/MultiReleaseJar.java --- a/langtools/test/tools/jdeps/MultiReleaseJar.java Thu Mar 09 21:35:20 2017 +0000 +++ b/langtools/test/tools/jdeps/MultiReleaseJar.java Thu Mar 09 23:15:55 2017 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 8153654 + * @bug 8153654 8176333 * @summary Tests for jdeps tool with multi-release jar files * @modules jdk.jdeps/com.sun.tools.jdeps * @library mrjar mrjar/base mrjar/9 mrjar/10 mrjar/v9 mrjar/v10 @@ -67,7 +67,7 @@ checkResult(r, false, "Warning: Path does not exist: missing.jar"); r = run("jdeps -v Version.jar"); - checkResult(r, false, "the --multi-release option is not set"); + checkResult(r, false, "--multi-release option is not set"); r = run("jdeps --multi-release base -v Version.jar"); checkResult(r, true, @@ -105,7 +105,7 @@ checkResult(r, false, "Error: invalid argument for option: 9.1"); r = run("jdeps -v -R -cp Version.jar test/Main.class"); - checkResult(r, false, "the --multi-release option is not set"); + checkResult(r, false, "--multi-release option is not set"); r = run("jdeps -v -R -cp Version.jar -multi-release 9 test/Main.class"); checkResult(r, false,