This commit is contained in:
Lana Steuck 2015-10-06 08:43:24 -07:00
commit a113b52db0
26 changed files with 496 additions and 65 deletions

View File

@ -29,6 +29,7 @@ import com.sun.source.tree.LambdaExpressionTree;
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.tree.TreeScanner;
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.GENERATEDCONSTR;
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 @@ public class Analyzer {
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 @@ public class Analyzer {
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 @@ public class Analyzer {
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())

View File

@ -109,9 +109,6 @@ public class ArgumentAttr extends JCTree.Visitor {
/** Cache for argument types; behavior is influences by the currrently selected cache policy. */
Map<UniquePos, ArgumentType<?>> 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 @@ public class ArgumentAttr extends JCTree.Visitor {
}
/**
* 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.
*/
CachePolicy withCachePolicy(CachePolicy newPolicy) {
CachePolicy oldPolicy = this.cachePolicy;
this.cachePolicy = newPolicy;
return oldPolicy;
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.
*/
class LocalCacheContext {
Map<UniquePos, ArgumentType<?>> prevCache;
public LocalCacheContext() {
this.prevCache = argumentTypeCache;
argumentTypeCache = new HashMap<>();
}
public void leave() {
argumentTypeCache = prevCache;
}
}
/**
@ -226,9 +240,7 @@ public class ArgumentAttr extends JCTree.Visitor {
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 @@ public class ArgumentAttr extends JCTree.Visitor {
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 @@ public class ArgumentAttr extends JCTree.Visitor {
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;
}
}

View File

@ -2215,7 +2215,7 @@ public class Attr extends JCTree.Visitor {
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;

View File

@ -808,7 +808,7 @@ public class Check {
*/
List<Type> checkDiamondDenotable(ClassType t) {
ListBuffer<Type> 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 @@ public class Check {
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 @@ public class Check {
@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;
}

View File

@ -29,7 +29,7 @@ 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.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 @@ public class DeferredAttr extends JCTree.Visitor {
boolean canLambdaBodyCompleteNormally(JCLambda tree) {
List<JCVariableDecl> 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;
}
}

View File

@ -194,7 +194,7 @@ public class TypeEnter implements Completer {
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 @@ public class TypeEnter implements Completer {
this.next = next;
}
public List<Env<AttrContext>> runPhase(List<Env<AttrContext>> envs) {
public final List<Env<AttrContext>> completeEnvs(List<Env<AttrContext>> envs) {
boolean firstToComplete = queue.isEmpty();
doCompleteEnvs(envs);
if (firstToComplete) {
List<Env<AttrContext>> out = queue.toList();
queue.clear();
return next != null ? next.completeEnvs(out) : out;
} else {
return List.nil();
}
}
protected void doCompleteEnvs(List<Env<AttrContext>> envs) {
for (Env<AttrContext> env : envs) {
JCClassDecl tree = (JCClassDecl)env.tree;
@ -249,7 +262,7 @@ public class TypeEnter implements Completer {
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 @@ public class TypeEnter implements Completer {
log.useSource(prev);
}
}
}
if (firstToComplete) {
List<Env<AttrContext>> out = queue.toList();
queue.clear();
return next != null ? next.runPhase(out) : out;
} else {
return List.nil();
}
}
protected abstract void doRunPhase(Env<AttrContext> env);
protected abstract void runPhase(Env<AttrContext> env);
}
private final ImportsPhase completeClass = new ImportsPhase();
@ -289,7 +293,7 @@ public class TypeEnter implements Completer {
(imp, cf) -> chk.completionError(imp.pos(), cf);
@Override
protected void doRunPhase(Env<AttrContext> env) {
protected void runPhase(Env<AttrContext> env) {
JCClassDecl tree = env.enclClass;
ClassSymbol sym = tree.sym;
@ -699,14 +703,29 @@ public class TypeEnter implements Completer {
}
}
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<AttrContext> env) {
protected void doCompleteEnvs(List<Env<AttrContext>> 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<AttrContext> env : envs) {
env.enclClass.sym.completer = this;
}
for (Env<AttrContext> env : envs) {
env.enclClass.sym.complete();
}
}
@Override
protected void runPhase(Env<AttrContext> env) {
JCClassDecl tree = env.enclClass;
ClassSymbol sym = tree.sym;
ClassType ct = (ClassType)sym.type;
@ -760,6 +779,14 @@ public class TypeEnter implements Completer {
}
return false;
}
@Override
public void complete(Symbol sym) throws CompletionFailure {
Env<AttrContext> env = typeEnvs.get((ClassSymbol) sym);
super.doCompleteEnvs(List.of(env));
}
}
private final class HeaderPhase extends AbstractHeaderPhase {
@ -769,7 +796,7 @@ public class TypeEnter implements Completer {
}
@Override
protected void doRunPhase(Env<AttrContext> env) {
protected void runPhase(Env<AttrContext> env) {
JCClassDecl tree = env.enclClass;
ClassSymbol sym = tree.sym;
ClassType ct = (ClassType)sym.type;
@ -824,7 +851,7 @@ public class TypeEnter implements Completer {
}
@Override
protected void doRunPhase(Env<AttrContext> env) {
protected void runPhase(Env<AttrContext> env) {
JCClassDecl tree = env.enclClass;
ClassSymbol sym = tree.sym;
ClassType ct = (ClassType)sym.type;

View File

@ -320,9 +320,9 @@ These options are non-standard and subject to change without notice.
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\

View File

@ -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 @@ public class LineNumberTestBase extends TestBase {
boolean failed = false;
for (TestCase testCase : testCases) {
try {
writeToFileIfEnabled(Paths.get(testCase.getName() + ".java"), testCase.src);
Set<Integer> coveredLines = new HashSet<>();
for (JavaFileObject file : compile(testCase.src).getClasses().values()) {
ClassFile classFile = ClassFile.read(file.openInputStream());

View File

@ -218,7 +218,7 @@ public abstract class AnnotationsTestBase extends TestResult {
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());

View File

@ -26,8 +26,10 @@ import com.sun.tools.classfile.ClassFile;
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 abstract class InnerClassesTestBase extends TestResult {
*/
public void test(String classToTest, String...skipClasses) throws TestFailedException {
try {
for (TestCase test : generateTestCases()) {
addTestCase(test.getSource());
String testName = getClass().getName();
List<TestCase> 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 @@ public abstract class InnerClassesTestBase extends TestResult {
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 @@ public abstract class InnerClassesTestBase extends TestResult {
private final String classType;
private ClassType(String clazz) {
ClassType(String clazz) {
this.classType = clazz;
}
@ -435,7 +442,7 @@ public abstract class InnerClassesTestBase extends TestResult {
private final String str;
private Modifier(String str) {
Modifier(String str) {
this.str = str;
}

View File

@ -44,6 +44,7 @@ import com.sun.tools.classfile.ConstantPoolException;
public class TestBase {
public static final String LINE_SEPARATOR = System.lineSeparator();
public static final boolean isDumpOfSourceEnabled = Boolean.getBoolean("dump.src");
private <S> InMemoryFileManager compile(
List<String> options,
@ -176,7 +177,9 @@ public class TestBase {
* @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 class TestBase {
}
}
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", "."));
}

View File

@ -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 <T extends java.io.Serializable & Cloneable> {
class A <X>{}
public void foo(){
new Neg21<>().new A<>(){} ;
}
}

View File

@ -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

View File

@ -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<X extends Runnable & java.io.Serializable> {
class Inner<Y> { }
}
class Box<Z> {
Box(Z z) { }
}
{
new Box<>(new Outer<>().new Inner<>()) { };
}
}

View File

@ -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<java.lang.Object&java.io.Serializable&java.lang.Runnable>.Inner<java.lang.Object>, (compiler.misc.diamond: Neg22.Box))
1 error

View File

@ -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<>();
}
}

View File

@ -0,0 +1,2 @@
Neg23.java:10:39: compiler.err.not.def.public.cant.access: pkg.Neg23_02, pkg
1 error

View File

@ -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<X extends Neg23_02> {
public class Inner<Y> { }
}
class Neg23_02 {}

View File

@ -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<T> {
}
static class FooOuter {
class Foo<T> {
public Foo(){}
}
}
public static <T> List<T> m(List<T> list, T item) {
return list;
}
public static void run() {
m(new List<FooOuter.Foo<String>>(), new FooOuter().new Foo<>(){ });
}
}

View File

@ -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 {
}

View File

@ -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 {
}
}

View File

@ -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 {
}
}

View File

@ -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 {}
}
}

View File

@ -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 {
}
}

View File

@ -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 {
}

View File

@ -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 {
}