# HG changeset patch # User lana # Date 1444146204 25200 # Node ID fe2f2101a69278cfdf822b1a6f34d00115d7fcd7 # Parent bd87d6d4b81c9d74b8c240278dccae92ef581526# Parent 586e23a1b1167fce13c07c242f96619f860c1e99 Merge diff -r bd87d6d4b81c -r fe2f2101a692 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java Tue Oct 06 08:43:24 2015 -0700 @@ -29,6 +29,7 @@ import com.sun.tools.javac.code.Source; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Types; +import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCBlock; import com.sun.tools.javac.tree.JCTree.JCClassDecl; @@ -54,7 +55,6 @@ import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.DefinedBy; import com.sun.tools.javac.util.DefinedBy.Api; -import com.sun.tools.javac.util.Filter; import com.sun.tools.javac.util.JCDiagnostic; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; import com.sun.tools.javac.util.List; @@ -72,7 +72,6 @@ import static com.sun.tools.javac.code.Flags.SYNTHETIC; import static com.sun.tools.javac.code.TypeTag.CLASS; import static com.sun.tools.javac.tree.JCTree.Tag.APPLY; -import static com.sun.tools.javac.tree.JCTree.Tag.CLASSDEF; import static com.sun.tools.javac.tree.JCTree.Tag.METHODDEF; import static com.sun.tools.javac.tree.JCTree.Tag.NEWCLASS; import static com.sun.tools.javac.tree.JCTree.Tag.TYPEAPPLY; @@ -88,6 +87,7 @@ final Log log; final Attr attr; final DeferredAttr deferredAttr; + final ArgumentAttr argumentAttr; final TreeMaker make; final Names names; private final boolean allowDiamondWithAnonymousClassCreation; @@ -107,6 +107,7 @@ log = Log.instance(context); attr = Attr.instance(context); deferredAttr = DeferredAttr.instance(context); + argumentAttr = ArgumentAttr.instance(context); make = TreeMaker.instance(context); names = Names.instance(context); Options options = Options.instance(context); @@ -363,8 +364,13 @@ TreeMapper treeMapper = new TreeMapper(context); //TODO: to further refine the analysis, try all rewriting combinations - deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper, - t -> new AnalyzeDeferredDiagHandler(context)); + LocalCacheContext localCacheContext = argumentAttr.withLocalCacheContext(); + try { + deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper, + t -> new AnalyzeDeferredDiagHandler(context)); + } finally { + localCacheContext.leave(); + } context.treeMap.entrySet().forEach(e -> { context.treesToAnalyzer.get(e.getKey()) diff -r bd87d6d4b81c -r fe2f2101a692 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java Tue Oct 06 08:43:24 2015 -0700 @@ -109,9 +109,6 @@ /** Cache for argument types; behavior is influences by the currrently selected cache policy. */ Map> argumentTypeCache = new LinkedHashMap<>(); - /** Cache policy: should argument types be cached? */ - private CachePolicy cachePolicy = CachePolicy.CACHE; - public static ArgumentAttr instance(Context context) { ArgumentAttr instance = context.get(methodAttrKey); if (instance == null) @@ -160,12 +157,29 @@ } /** - * Sets given ache policy and returns current policy. + * Returns a local caching context in which argument types can safely be cached without + * the risk of polluting enclosing contexts. This is useful when attempting speculative + * attribution of potentially erroneous expressions, which could end up polluting the cache. + */ + LocalCacheContext withLocalCacheContext() { + return new LocalCacheContext(); + } + + /** + * Local cache context; this class keeps track of the previous cache and reverts to it + * when the {@link LocalCacheContext#leave()} method is called. */ - CachePolicy withCachePolicy(CachePolicy newPolicy) { - CachePolicy oldPolicy = this.cachePolicy; - this.cachePolicy = newPolicy; - return oldPolicy; + class LocalCacheContext { + Map> prevCache; + + public LocalCacheContext() { + this.prevCache = argumentTypeCache; + argumentTypeCache = new HashMap<>(); + } + + public void leave() { + argumentTypeCache = prevCache; + } } /** @@ -226,9 +240,7 @@ setResult(that, cached.dup(that, env)); } else { Z res = argumentTypeFactory.get(); - if (cachePolicy == CachePolicy.CACHE) { - argumentTypeCache.put(pos, res); - } + argumentTypeCache.put(pos, res); setResult(that, res); } } @@ -341,7 +353,7 @@ speculativeTypes.put(resultInfo, t); return t; } else { - if (!env.info.isSpeculative && cachePolicy == CachePolicy.CACHE) { + if (!env.info.isSpeculative) { argumentTypeCache.remove(new UniquePos(dt.tree)); } return deferredAttr.basicCompleter.complete(dt, resultInfo, deferredAttrContext); @@ -663,17 +675,4 @@ return source.getFile().getName() + " @ " + source.getLineNumber(pos); } } - - /** - * Argument type caching policy. - */ - enum CachePolicy { - /** Cache argument types. */ - CACHE, - /** - * Don't cache argument types. This is useful when performing speculative attribution on - * a tree that is known to contain erroneous info. - */ - NO_CACHE; - } } diff -r bd87d6d4b81c -r fe2f2101a692 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 Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Tue Oct 06 08:43:24 2015 -0700 @@ -2215,7 +2215,7 @@ inferenceContext.addFreeTypeListener(List.of(tree.constructorType, tree.clazz.type), instantiatedContext -> { tree.constructorType = instantiatedContext.asInstType(tree.constructorType); - clazz.type = instantiatedContext.asInstType(clazz.type); + tree.clazz.type = clazz.type = instantiatedContext.asInstType(clazz.type); ResultInfo prevResult = this.resultInfo; try { this.resultInfo = resultInfoForClassDefinition; diff -r bd87d6d4b81c -r fe2f2101a692 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Tue Oct 06 08:43:24 2015 -0700 @@ -808,7 +808,7 @@ */ List checkDiamondDenotable(ClassType t) { ListBuffer buf = new ListBuffer<>(); - for (Type arg : t.getTypeArguments()) { + for (Type arg : t.allparams()) { if (!diamondTypeChecker.visit(arg, null)) { buf.append(arg); } @@ -831,7 +831,7 @@ if (t.isCompound()) { return false; } - for (Type targ : t.getTypeArguments()) { + for (Type targ : t.allparams()) { if (!visit(targ, s)) { return false; } @@ -842,13 +842,16 @@ @Override public Boolean visitTypeVar(TypeVar t, Void s) { /* Any type variable mentioned in the inferred type must have been declared as a type parameter - (i.e cannot have been produced by capture conversion (5.1.10) or by inference (18.4) + (i.e cannot have been produced by inference (18.4)) */ return t.tsym.owner.type.getTypeArguments().contains(t); } @Override public Boolean visitCapturedType(CapturedType t, Void s) { + /* Any type variable mentioned in the inferred type must have been declared as a type parameter + (i.e cannot have been produced by capture conversion (5.1.10)) + */ return false; } diff -r bd87d6d4b81c -r fe2f2101a692 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 Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Tue Oct 06 08:43:24 2015 -0700 @@ -29,7 +29,7 @@ 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.comp.ArgumentAttr.CachePolicy; +import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext; import com.sun.tools.javac.comp.Resolve.ResolveError; import com.sun.tools.javac.resources.CompilerProperties.Fragments; import com.sun.tools.javac.tree.*; @@ -777,14 +777,14 @@ boolean canLambdaBodyCompleteNormally(JCLambda tree) { List oldParams = tree.params; - CachePolicy prevPolicy = argumentAttr.withCachePolicy(CachePolicy.NO_CACHE); + LocalCacheContext localCacheContext = argumentAttr.withLocalCacheContext(); try { tree.params = tree.params.stream() .map(vd -> make.VarDef(vd.mods, vd.name, make.Erroneous(), null)) .collect(List.collector()); return attribSpeculativeLambda(tree, env, attr.unknownExprInfo).canCompleteNormally; } finally { - argumentAttr.withCachePolicy(prevPolicy); + localCacheContext.leave(); tree.params = oldParams; } } diff -r bd87d6d4b81c -r fe2f2101a692 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Tue Oct 06 08:43:24 2015 -0700 @@ -194,7 +194,7 @@ dependencies.push((ClassSymbol) sym, CompletionCause.MEMBER_ENTER); try { - queue = completeClass.runPhase(List.of(typeEnvs.get((ClassSymbol) sym))); + queue = completeClass.completeEnvs(List.of(typeEnvs.get((ClassSymbol) sym))); } finally { dependencies.pop(); } @@ -237,9 +237,22 @@ this.next = next; } - public List> runPhase(List> envs) { + public final List> completeEnvs(List> envs) { boolean firstToComplete = queue.isEmpty(); + doCompleteEnvs(envs); + + if (firstToComplete) { + List> out = queue.toList(); + + queue.clear(); + return next != null ? next.completeEnvs(out) : out; + } else { + return List.nil(); + } + } + + protected void doCompleteEnvs(List> envs) { for (Env env : envs) { JCClassDecl tree = (JCClassDecl)env.tree; @@ -249,7 +262,7 @@ DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos()); try { dependencies.push(env.enclClass.sym, phaseName); - doRunPhase(env); + runPhase(env); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); } finally { @@ -258,18 +271,9 @@ log.useSource(prev); } } - - if (firstToComplete) { - List> out = queue.toList(); + } - queue.clear(); - return next != null ? next.runPhase(out) : out; - } else { - return List.nil(); - } - } - - protected abstract void doRunPhase(Env env); + protected abstract void runPhase(Env env); } private final ImportsPhase completeClass = new ImportsPhase(); @@ -289,7 +293,7 @@ (imp, cf) -> chk.completionError(imp.pos(), cf); @Override - protected void doRunPhase(Env env) { + protected void runPhase(Env env) { JCClassDecl tree = env.enclClass; ClassSymbol sym = tree.sym; @@ -699,14 +703,29 @@ } } - private final class HierarchyPhase extends AbstractHeaderPhase { + private final class HierarchyPhase extends AbstractHeaderPhase implements Completer { public HierarchyPhase() { super(CompletionCause.HIERARCHY_PHASE, new HeaderPhase()); } @Override - protected void doRunPhase(Env env) { + protected void doCompleteEnvs(List> envs) { + //The ClassSymbols in the envs list may not be in the dependency order. + //To get proper results, for every class or interface C, the supertypes of + //C must be processed by the HierarchyPhase phase before C. + //To achieve that, the HierarchyPhase is registered as the Completer for + //all the classes first, and then all the classes are completed. + for (Env env : envs) { + env.enclClass.sym.completer = this; + } + for (Env env : envs) { + env.enclClass.sym.complete(); + } + } + + @Override + protected void runPhase(Env env) { JCClassDecl tree = env.enclClass; ClassSymbol sym = tree.sym; ClassType ct = (ClassType)sym.type; @@ -760,6 +779,14 @@ } return false; } + + @Override + public void complete(Symbol sym) throws CompletionFailure { + Env env = typeEnvs.get((ClassSymbol) sym); + + super.doCompleteEnvs(List.of(env)); + } + } private final class HeaderPhase extends AbstractHeaderPhase { @@ -769,7 +796,7 @@ } @Override - protected void doRunPhase(Env env) { + protected void runPhase(Env env) { JCClassDecl tree = env.enclClass; ClassSymbol sym = tree.sym; ClassType ct = (ClassType)sym.type; @@ -824,7 +851,7 @@ } @Override - protected void doRunPhase(Env env) { + protected void runPhase(Env env) { JCClassDecl tree = env.enclClass; ClassSymbol sym = tree.sym; ClassType ct = (ClassType)sym.type; diff -r bd87d6d4b81c -r fe2f2101a692 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Tue Oct 06 08:43:24 2015 -0700 @@ -320,9 +320,9 @@ javac.msg.bug=\ An exception has occurred in the compiler ({0}). \ -Please file a bug at the Java Bug Database (http://bugreport.java.com/bugreport/) \ -after checking the database for duplicates. \ -Include your program and the following diagnostic in your report. Thank you. +Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) \ +after checking the Bug Database (http://bugs.java.com) for duplicates. \ +Include your program and the following diagnostic in your report. Thank you. javac.msg.io=\ \n\nAn input/output error occurred.\n\ diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTestBase.java --- a/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTestBase.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTestBase.java Tue Oct 06 08:43:24 2015 -0700 @@ -23,6 +23,7 @@ import com.sun.tools.classfile.*; +import java.nio.file.Paths; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -62,6 +63,7 @@ boolean failed = false; for (TestCase testCase : testCases) { try { + writeToFileIfEnabled(Paths.get(testCase.getName() + ".java"), testCase.src); Set coveredLines = new HashSet<>(); for (JavaFileObject file : compile(testCase.src).getClasses().values()) { ClassFile classFile = ClassFile.read(file.openInputStream()); diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/classfiles/attributes/annotations/AnnotationsTestBase.java --- a/langtools/test/tools/javac/classfiles/attributes/annotations/AnnotationsTestBase.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/test/tools/javac/classfiles/attributes/annotations/AnnotationsTestBase.java Tue Oct 06 08:43:24 2015 -0700 @@ -218,7 +218,7 @@ String source = testCase.generateSource(); Path sourceFile = Paths.get(getClass().getSimpleName() + i + ".java"); addTestCase(sourceFile.toAbsolutePath().toString()); - writeToFile(sourceFile, source); + writeToFileIfEnabled(sourceFile, source); echo("Testing: " + sourceFile.toString()); try { test(testCase, compile(source).getClasses()); diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java --- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java Tue Oct 06 08:43:24 2015 -0700 @@ -26,8 +26,10 @@ import com.sun.tools.classfile.InnerClasses_attribute; import com.sun.tools.classfile.InnerClasses_attribute.Info; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -87,8 +89,13 @@ */ public void test(String classToTest, String...skipClasses) throws TestFailedException { try { - for (TestCase test : generateTestCases()) { - addTestCase(test.getSource()); + String testName = getClass().getName(); + List testCases = generateTestCases(); + for (int i = 0; i < testCases.size(); ++i) { + TestCase test = testCases.get(i); + String testCaseName = testName + i + ".java"; + addTestCase(testCaseName); + writeToFileIfEnabled(Paths.get(testCaseName), test.getSource()); test(classToTest, test, skipClasses); } } catch (Exception e) { @@ -330,7 +337,7 @@ list.add(Arrays.asList(access, mod1, mod2)); } if (mod1 == Modifier.EMPTY) { - list.add(Arrays.asList(access)); + list.add(Collections.singletonList(access)); } } } @@ -413,7 +420,7 @@ private final String classType; - private ClassType(String clazz) { + ClassType(String clazz) { this.classType = clazz; } @@ -435,7 +442,7 @@ private final String str; - private Modifier(String str) { + Modifier(String str) { this.str = str; } diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java --- a/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java Mon Oct 05 20:25:08 2015 -0700 +++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java Tue Oct 06 08:43:24 2015 -0700 @@ -44,6 +44,7 @@ public class TestBase { public static final String LINE_SEPARATOR = System.lineSeparator(); + public static final boolean isDumpOfSourceEnabled = Boolean.getBoolean("dump.src"); private InMemoryFileManager compile( List options, @@ -176,7 +177,9 @@ * @throws ConstantPoolException if constant pool error occurs */ public ClassFile readClassFile(File file) throws IOException, ConstantPoolException { - return readClassFile(new FileInputStream(file)); + try (InputStream is = new FileInputStream(file)) { + return readClassFile(is); + } } public void assertEquals(Object actual, Object expected, String message) { @@ -215,6 +218,14 @@ } } + public void writeToFileIfEnabled(Path path, String source) throws IOException { + if (isDumpOfSourceEnabled) { + writeToFile(path, source); + } else { + System.err.println("Source dumping disabled. To enable, run the test with '-Ddump.src=true'"); + } + } + public File getSourceDir() { return new File(System.getProperty("test.src", ".")); } diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/neg/Neg21.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg21.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,15 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8132535 + * @summary Compiler fails with diamond anonymous class creation with intersection bound of enclosing class. + * @compile/fail/ref=Neg21.out Neg21.java -XDrawDiagnostics + */ + +public class Neg21 { + + class A {} + + public void foo(){ + new Neg21<>().new A<>(){} ; + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/neg/Neg21.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg21.out Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,2 @@ +Neg21.java:13:28: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg21.A), (compiler.misc.diamond.invalid.arg: java.lang.Object&java.io.Serializable&java.lang.Cloneable, (compiler.misc.diamond: Neg21.A)) +1 error diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/neg/Neg22.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg22.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,21 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8132535 + * @summary Compiler fails with diamond anonymous class creation with intersection bound of enclosing class. + * @compile/fail/ref=Neg22.out Neg22.java -XDrawDiagnostics + */ + +public class Neg22 { + + class Outer { + class Inner { } + } + + class Box { + Box(Z z) { } + } + + { + new Box<>(new Outer<>().new Inner<>()) { }; + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/neg/Neg22.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg22.out Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,2 @@ +Neg22.java:19:16: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg22.Box), (compiler.misc.diamond.invalid.arg: Neg22.Outer.Inner, (compiler.misc.diamond: Neg22.Box)) +1 error diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/neg/Neg23.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg23.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,12 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8132535 + * @summary Compiler fails with diamond anonymous class creation with intersection bound of enclosing class. + * @compile/fail/ref=Neg23.out Neg23.java -XDrawDiagnostics + */ + +public class Neg23 { + { + new pkg.Neg23_01<>().new Inner<>(); + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/neg/Neg23.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg23.out Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,2 @@ +Neg23.java:10:39: compiler.err.not.def.public.cant.access: pkg.Neg23_02, pkg +1 error diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/neg/pkg/Neg23_01.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/neg/pkg/Neg23_01.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +public class Neg23_01 { + public class Inner { } +} + +class Neg23_02 {} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/generics/diamond/pos/Pos08.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/diamond/pos/Pos08.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8133135 + * + * @summary Compiler internall error (NPE) on anonymous class defined by qualified instance creation expression with diamond + * @author sadayapalam + * @compile Pos08.java + * + */ + +class Pos08 { + + static class List { + } + + static class FooOuter { + class Foo { + public Foo(){} + } + } + + public static List m(List list, T item) { + return list; + } + + + public static void run() { + m(new List>(), new FooOuter().new Foo<>(){ }); + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/importscope/T8075274/C.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/T8075274/C.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package P.Q; + +public class C extends D { +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/importscope/T8075274/D.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/T8075274/D.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package P.Q; + +public class D { + public interface I { + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/importscope/T8075274/Outer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/T8075274/Outer.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8075274 + * @summary Ensuring order of imports or inputs does not affect compilability of the sources + * @compile C.java D.java Outer.java + * @compile C.java Outer.java D.java + * @compile D.java C.java Outer.java + * @compile D.java Outer.java C.java + * @compile Outer.java D.java C.java + * @compile Outer.java C.java D.java + */ +package P; + +import static P.Outer.Nested.*; +import static P.Q.C.*; + +public class Outer { + public static class Nested implements I { + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/importscope/T8133235/A.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/T8133235/A.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8133235 + * @summary Ensuring order of inputs does not affect compilability of the sources + * @compile A.java B.java C.java D.java + * @compile A.java B.java D.java C.java + * @compile A.java C.java B.java D.java + * @compile A.java C.java D.java B.java + * @compile A.java D.java B.java C.java + * @compile A.java D.java C.java B.java + * @compile D.java A.java B.java C.java + * @compile D.java A.java C.java B.java + * @compile D.java B.java A.java C.java + * @compile D.java B.java C.java A.java + * @compile D.java C.java B.java A.java + * @compile D.java C.java A.java B.java + */ +package pkg; + +public class A { + public interface One { + public interface N2 { + public class N3 { } + } + + public class Foo extends D {} + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/importscope/T8133235/B.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/T8133235/B.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +import pkg.A; + +public class B extends A { + public static interface Two { + } +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/importscope/T8133235/C.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/T8133235/C.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +import pkg.B.Two; + +public class C implements B.One { +} diff -r bd87d6d4b81c -r fe2f2101a692 langtools/test/tools/javac/importscope/T8133235/D.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/T8133235/D.java Tue Oct 06 08:43:24 2015 -0700 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +import static pkg.C.*; + +public class D implements C.N2 { +}