8169197: Improve error reporting for compiling against unexported package
When a type cannot be found, look into other modules, search for possible viable types, and report them conveniently to the user. Reviewed-by: mcimadamore, jjg
This commit is contained in:
parent
6c4a689750
commit
c2d9172419
@ -921,6 +921,7 @@ public abstract class Symbol extends AnnoConstruct implements Element {
|
||||
|
||||
public PackageSymbol unnamedPackage;
|
||||
public Map<Name, PackageSymbol> visiblePackages;
|
||||
public Set<ModuleSymbol> readModules;
|
||||
public List<Symbol> enclosedPackages = List.nil();
|
||||
|
||||
public Completer usesProvidesCompleter = Completer.NULL_COMPLETER;
|
||||
|
@ -353,7 +353,7 @@ public class Attr extends JCTree.Visitor {
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Symbol visitMemberSelect(MemberSelectTree node, Env<AttrContext> env) {
|
||||
Symbol site = visit(node.getExpression(), env);
|
||||
if (site.kind == ERR || site.kind == ABSENT_TYP)
|
||||
if (site.kind == ERR || site.kind == ABSENT_TYP || site.kind == HIDDEN)
|
||||
return site;
|
||||
Name name = (Name)node.getIdentifier();
|
||||
if (site.kind == PCK) {
|
||||
|
@ -1327,6 +1327,7 @@ public class Modules extends JCTree.Visitor {
|
||||
initAddExports();
|
||||
|
||||
msym.visiblePackages = new LinkedHashMap<>();
|
||||
msym.readModules = new HashSet<>(readable);
|
||||
|
||||
Map<Name, ModuleSymbol> seen = new HashMap<>();
|
||||
|
||||
|
@ -54,14 +54,19 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.lang.model.element.ElementVisitor;
|
||||
|
||||
import com.sun.tools.javac.code.Directive.ExportsDirective;
|
||||
import static com.sun.tools.javac.code.Flags.*;
|
||||
import static com.sun.tools.javac.code.Flags.BLOCK;
|
||||
import static com.sun.tools.javac.code.Flags.STATIC;
|
||||
@ -69,6 +74,8 @@ import static com.sun.tools.javac.code.Kinds.*;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.*;
|
||||
import static com.sun.tools.javac.code.TypeTag.*;
|
||||
import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
|
||||
import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
||||
import com.sun.tools.javac.resources.CompilerProperties.Fragments;
|
||||
import static com.sun.tools.javac.tree.JCTree.Tag.*;
|
||||
|
||||
/** Helper class for name resolution, used mostly by the attribution phase.
|
||||
@ -89,6 +96,7 @@ public class Resolve {
|
||||
Check chk;
|
||||
Infer infer;
|
||||
ClassFinder finder;
|
||||
ModuleFinder moduleFinder;
|
||||
Types types;
|
||||
JCDiagnostic.Factory diags;
|
||||
public final boolean allowMethodHandles;
|
||||
@ -116,6 +124,7 @@ public class Resolve {
|
||||
chk = Check.instance(context);
|
||||
infer = Infer.instance(context);
|
||||
finder = ClassFinder.instance(context);
|
||||
moduleFinder = ModuleFinder.instance(context);
|
||||
types = Types.instance(context);
|
||||
diags = JCDiagnostic.Factory.instance(context);
|
||||
Source source = Source.instance(context);
|
||||
@ -315,7 +324,6 @@ public class Resolve {
|
||||
isAccessible = true;
|
||||
break;
|
||||
case PUBLIC:
|
||||
isAccessible = true;
|
||||
if (allowModules) {
|
||||
ModuleSymbol currModule = env.toplevel.modle;
|
||||
currModule.complete();
|
||||
@ -491,7 +499,7 @@ public class Resolve {
|
||||
public Void visitClassType(ClassType t, Env<AttrContext> env) {
|
||||
visit(t.getTypeArguments(), env);
|
||||
if (!isAccessible(env, t, true)) {
|
||||
accessBase(new AccessError(t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
|
||||
accessBase(new AccessError(env, null, t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1965,7 +1973,7 @@ public class Resolve {
|
||||
Symbol loadClass(Env<AttrContext> env, Name name) {
|
||||
try {
|
||||
ClassSymbol c = finder.loadClass(env.toplevel.modle, name);
|
||||
return isAccessible(env, c) ? c : new AccessError(c);
|
||||
return isAccessible(env, c) ? c : new AccessError(env, null, c);
|
||||
} catch (ClassFinder.BadClassFile err) {
|
||||
throw err;
|
||||
} catch (CompletionFailure ex) {
|
||||
@ -1983,20 +1991,29 @@ public class Resolve {
|
||||
Symbol loadClass(Env<AttrContext> env, Name name);
|
||||
}
|
||||
|
||||
private RecoveryLoadClass recoveryLoadClass = (env, name) -> {
|
||||
//even if a class cannot be found in the current module and packages in modules it depends on that
|
||||
//are exported for any or this module, the class may exist internally in some of these modules,
|
||||
//or may exist in a module on which this module does not depend. Provide better diagnostic in
|
||||
//such cases by looking for the class in any module:
|
||||
for (ModuleSymbol ms : syms.getAllModules()) {
|
||||
//do not load currently unloaded classes, to avoid too eager completion of random things in other modules:
|
||||
ClassSymbol clazz = syms.getClass(ms, name);
|
||||
private RecoveryLoadClass recoveryLoadClass = new RecoveryLoadClass() {
|
||||
@Override
|
||||
public Symbol loadClass(Env<AttrContext> env, Name name) {
|
||||
if (allowModules) {
|
||||
Scope importScope = env.toplevel.namedImportScope;
|
||||
Symbol existing = importScope.findFirst(Convert.shortName(name),
|
||||
sym -> sym.kind == TYP && sym.flatName() == name);
|
||||
|
||||
if (clazz != null) {
|
||||
return new AccessError(clazz);
|
||||
if (existing != null) {
|
||||
return new InvisibleSymbolError(env, true, existing);
|
||||
}
|
||||
|
||||
return lookupInvisibleSymbol(env, name, syms::getClass, (ms, n) -> {
|
||||
try {
|
||||
return finder.loadClass(ms, n);
|
||||
} catch (CompletionFailure cf) {
|
||||
//ignore
|
||||
return null;
|
||||
}
|
||||
}, sym -> sym.kind == Kind.TYP, false, typeNotFound);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
public RecoveryLoadClass setRecoveryLoadClass(RecoveryLoadClass recovery) {
|
||||
@ -2005,6 +2022,84 @@ public class Resolve {
|
||||
return prev;
|
||||
}
|
||||
|
||||
Symbol lookupPackage(Env<AttrContext> env, Name name) {
|
||||
PackageSymbol pack = syms.lookupPackage(env.toplevel.modle, name);
|
||||
|
||||
if (allowModules && isImportOnDemand(env, name)) {
|
||||
pack.complete();
|
||||
if (!pack.exists()) {
|
||||
Name nameAndDot = name.append('.', names.empty);
|
||||
boolean prefixOfKnown =
|
||||
env.toplevel.modle.visiblePackages.values()
|
||||
.stream()
|
||||
.anyMatch(p -> p.fullname.startsWith(nameAndDot));
|
||||
|
||||
return lookupInvisibleSymbol(env, name, syms::getPackage, syms::enterPackage, sym -> {
|
||||
sym.complete();
|
||||
return sym.exists();
|
||||
}, prefixOfKnown, pack);
|
||||
}
|
||||
}
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
private boolean isImportOnDemand(Env<AttrContext> env, Name name) {
|
||||
if (!env.tree.hasTag(IMPORT))
|
||||
return false;
|
||||
|
||||
JCTree qualid = ((JCImport) env.tree).qualid;
|
||||
|
||||
if (!qualid.hasTag(SELECT))
|
||||
return false;
|
||||
|
||||
if (TreeInfo.name(qualid) != names.asterisk)
|
||||
return false;
|
||||
|
||||
return TreeInfo.fullName(((JCFieldAccess) qualid).selected) == name;
|
||||
}
|
||||
|
||||
private Symbol lookupInvisibleSymbol(Env<AttrContext> env,
|
||||
Name name,
|
||||
BiFunction<ModuleSymbol, Name, Symbol> get,
|
||||
BiFunction<ModuleSymbol, Name, Symbol> load,
|
||||
Predicate<Symbol> validate,
|
||||
boolean suppressError,
|
||||
Symbol defaultResult) {
|
||||
//even if a class/package cannot be found in the current module and among packages in modules
|
||||
//it depends on that are exported for any or this module, the class/package may exist internally
|
||||
//in some of these modules, or may exist in a module on which this module does not depend.
|
||||
//Provide better diagnostic in such cases by looking for the class in any module:
|
||||
Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules());
|
||||
|
||||
recoverableModules.remove(env.toplevel.modle);
|
||||
|
||||
for (ModuleSymbol ms : recoverableModules) {
|
||||
Symbol sym = get.apply(ms, name);
|
||||
|
||||
//avoid overly eager completing classes from source-based modules, as those
|
||||
//may not be completable with the current compiler settings:
|
||||
if (sym == null && (ms.sourceLocation == null)) {
|
||||
if (ms.classLocation == null) {
|
||||
ms = moduleFinder.findModule(ms);
|
||||
}
|
||||
|
||||
if (ms.kind != ERR) {
|
||||
sym = load.apply(ms, name);
|
||||
}
|
||||
}
|
||||
|
||||
if (sym == null)
|
||||
continue;
|
||||
|
||||
if (validate.test(sym)) {
|
||||
return new InvisibleSymbolError(env, suppressError, sym);
|
||||
}
|
||||
}
|
||||
|
||||
return defaultResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a type declared in a scope (not inherited). Return null
|
||||
* if none is found.
|
||||
@ -2205,7 +2300,7 @@ public class Resolve {
|
||||
}
|
||||
|
||||
if (kind.contains(KindSelector.PCK))
|
||||
return syms.lookupPackage(env.toplevel.modle, name);
|
||||
return lookupPackage(env, name);
|
||||
else return bestSoFar;
|
||||
}
|
||||
|
||||
@ -2219,11 +2314,6 @@ public class Resolve {
|
||||
Name name, KindSelector kind) {
|
||||
Name fullname = TypeSymbol.formFullName(name, pck);
|
||||
Symbol bestSoFar = typeNotFound;
|
||||
PackageSymbol pack = null;
|
||||
if (kind.contains(KindSelector.PCK)) {
|
||||
pack = syms.lookupPackage(env.toplevel.modle, fullname);
|
||||
if (pack.exists()) return pack;
|
||||
}
|
||||
if (kind.contains(KindSelector.TYP)) {
|
||||
Symbol sym = loadClass(env, fullname);
|
||||
if (sym.exists()) {
|
||||
@ -2232,7 +2322,10 @@ public class Resolve {
|
||||
}
|
||||
else bestSoFar = bestOf(bestSoFar, sym);
|
||||
}
|
||||
return (pack != null) ? pack : bestSoFar;
|
||||
if (kind.contains(KindSelector.PCK)) {
|
||||
return lookupPackage(env, fullname);
|
||||
}
|
||||
return bestSoFar;
|
||||
}
|
||||
|
||||
/** Find an identifier among the members of a given type `site'.
|
||||
@ -3941,10 +4034,6 @@ public class Resolve {
|
||||
private Env<AttrContext> env;
|
||||
private Type site;
|
||||
|
||||
AccessError(Symbol sym) {
|
||||
this(null, null, sym);
|
||||
}
|
||||
|
||||
AccessError(Env<AttrContext> env, Type site, Symbol sym) {
|
||||
super(HIDDEN, sym, "access error");
|
||||
this.env = env;
|
||||
@ -3977,7 +4066,14 @@ public class Resolve {
|
||||
if (sym.owner.kind == PCK) {
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.package.cant.access",
|
||||
sym, sym.location());
|
||||
sym, sym.location(), inaccessiblePackageReason(env, sym.packge()));
|
||||
} else if ( sym.packge() != syms.rootPackage
|
||||
&& sym.packge().modle != env.toplevel.modle
|
||||
&& !isAccessible(env, sym.outermostClass())) {
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.class.intf.cant.access.reason",
|
||||
sym, sym.location(), sym.location().packge(),
|
||||
inaccessiblePackageReason(env, sym.packge()));
|
||||
} else {
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.class.intf.cant.access",
|
||||
@ -4009,6 +4105,90 @@ public class Resolve {
|
||||
}
|
||||
}
|
||||
|
||||
class InvisibleSymbolError extends InvalidSymbolError {
|
||||
|
||||
private final Env<AttrContext> env;
|
||||
private final boolean suppressError;
|
||||
|
||||
InvisibleSymbolError(Env<AttrContext> env, boolean suppressError, Symbol sym) {
|
||||
super(HIDDEN, sym, "invisible class error");
|
||||
this.env = env;
|
||||
this.suppressError = suppressError;
|
||||
this.name = sym.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
|
||||
DiagnosticPosition pos,
|
||||
Symbol location,
|
||||
Type site,
|
||||
Name name,
|
||||
List<Type> argtypes,
|
||||
List<Type> typeargtypes) {
|
||||
if (suppressError)
|
||||
return null;
|
||||
|
||||
if (sym.kind == PCK) {
|
||||
JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "package.not.visible", sym, details);
|
||||
}
|
||||
|
||||
JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
|
||||
|
||||
if (pos.getTree() != null && pos.getTree().hasTag(SELECT) && sym.owner.kind == PCK) {
|
||||
pos = ((JCFieldAccess) pos.getTree()).selected.pos();
|
||||
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "package.not.visible", sym.packge(), details);
|
||||
}
|
||||
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.package.cant.access", sym, sym.packge(), details);
|
||||
}
|
||||
}
|
||||
|
||||
JCDiagnostic inaccessiblePackageReason(Env<AttrContext> env, PackageSymbol sym) {
|
||||
//no dependency:
|
||||
if (!env.toplevel.modle.readModules.contains(sym.modle)) {
|
||||
//does not read:
|
||||
if (sym.modle != syms.unnamedModule) {
|
||||
if (env.toplevel.modle != syms.unnamedModule) {
|
||||
return diags.fragment(Fragments.NotDefAccessDoesNotRead(env.toplevel.modle,
|
||||
sym,
|
||||
sym.modle));
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessDoesNotReadFromUnnamed(sym,
|
||||
sym.modle));
|
||||
}
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessDoesNotReadUnnamed(sym,
|
||||
env.toplevel.modle));
|
||||
}
|
||||
} else {
|
||||
if (sym.packge().modle.exports.stream().anyMatch(e -> e.packge == sym)) {
|
||||
//not exported to this module:
|
||||
if (env.toplevel.modle != syms.unnamedModule) {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExportedToModule(sym,
|
||||
sym.modle,
|
||||
env.toplevel.modle));
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExportedToModuleFromUnnamed(sym,
|
||||
sym.modle));
|
||||
}
|
||||
} else {
|
||||
//not exported:
|
||||
if (env.toplevel.modle != syms.unnamedModule) {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExported(sym,
|
||||
sym.modle));
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExportedFromUnnamed(sym,
|
||||
sym.modle));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* InvalidSymbolError error class indicating that an instance member
|
||||
* has erroneously been accessed from a static context.
|
||||
|
@ -410,7 +410,7 @@ public class TypeEnter implements Completer {
|
||||
importNamedStatic(tree, p, name, localEnv);
|
||||
chk.checkCanonical(imp.selected);
|
||||
} else {
|
||||
TypeSymbol c = attribImportType(imp, localEnv).tsym;
|
||||
TypeSymbol c = attribImportType(imp, localEnv).getOriginalType().tsym;
|
||||
chk.checkCanonical(imp);
|
||||
importNamed(tree.pos(), c, env, tree);
|
||||
}
|
||||
|
@ -823,17 +823,87 @@ compiler.err.no.match.entry=\
|
||||
compiler.err.not.annotation.type=\
|
||||
{0} is not an annotation type
|
||||
|
||||
# 0: symbol, 1: symbol
|
||||
# 0: symbol, 1: symbol, 2: message segment
|
||||
compiler.err.not.def.access.package.cant.access=\
|
||||
{0} is not visible because package {1} is not visible
|
||||
{0} is not visible\n\
|
||||
({2})
|
||||
|
||||
# 0: symbol, 1: symbol, 2: message segment
|
||||
compiler.misc.not.def.access.package.cant.access=\
|
||||
{0} is not visible\n\
|
||||
({2})
|
||||
|
||||
# 0: symbol, 1: message segment
|
||||
compiler.err.package.not.visible=\
|
||||
package {0} is not visible\n\
|
||||
({1})
|
||||
|
||||
# 0: symbol, 1: message segment
|
||||
compiler.misc.package.not.visible=\
|
||||
package {0} is not visible\n\
|
||||
({1})
|
||||
|
||||
# {0} - current module
|
||||
# {1} - package in which the invisible class is declared
|
||||
# {2} - module in which {1} is declared
|
||||
# 0: symbol, 1: symbol, 2: symbol
|
||||
compiler.misc.not.def.access.does.not.read=\
|
||||
package {1} is declared in module {2}, but module {0} does not read it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.does.not.read.from.unnamed=\
|
||||
package {0} is declared in module {1}, which is not in the module graph
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - current module
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.does.not.read.unnamed=\
|
||||
package {0} is declared in the unnamed module, but module {0} does not read it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.not.exported=\
|
||||
package {0} is declared in module {1}, which does not export it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.not.exported.from.unnamed=\
|
||||
package {0} is declared in module {1}, which does not export it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# {2} - current module
|
||||
# 0: symbol, 1: symbol, 2: symbol
|
||||
compiler.misc.not.def.access.not.exported.to.module=\
|
||||
package {0} is declared in module {1}, which does not export it to module {2}
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.not.exported.to.module.from.unnamed=\
|
||||
package {0} is declared in module {1}, which does not export it to the unnamed module
|
||||
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.err.not.def.access.class.intf.cant.access=\
|
||||
{0} in {1} is defined in an inaccessible class or interface
|
||||
{1}.{0} is defined in an inaccessible class or interface
|
||||
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.class.intf.cant.access=\
|
||||
{0} in {1} is defined in an inaccessible class or interface
|
||||
{1}.{0} is defined in an inaccessible class or interface
|
||||
|
||||
# 0: symbol, 1: symbol, 2: symbol, 3: message segment
|
||||
compiler.err.not.def.access.class.intf.cant.access.reason=\
|
||||
{1}.{0} in package {2} is not accessible\n\
|
||||
({3})
|
||||
|
||||
# 0: symbol, 1: symbol, 2: symbol, 3: message segment
|
||||
compiler.misc.not.def.access.class.intf.cant.access.reason=\
|
||||
{1}.{0} in package {2} is not accessible\n\
|
||||
({3})
|
||||
|
||||
# 0: symbol, 1: list of type, 2: type
|
||||
compiler.misc.cant.access.inner.cls.constr=\
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @bug 5003235
|
||||
* @summary Private inner class accessible from subclasses
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail/ref=T5003235a.out --diags:layout=%b:%l:%_%m T5003235a.java
|
||||
* @compile/fail/ref=T5003235a.out -XDrawDiagnostics T5003235a.java
|
||||
*/
|
||||
|
||||
class Super {
|
||||
|
@ -1,13 +1,5 @@
|
||||
T5003235a.java:21: defaultM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.defaultM();
|
||||
^
|
||||
T5003235a.java:22: protectedM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.protectedM();
|
||||
^
|
||||
T5003235a.java:23: publicM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.publicM();
|
||||
^
|
||||
T5003235a.java:24: privateM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.privateM();
|
||||
^
|
||||
T5003235a.java:21:10: compiler.err.not.def.access.class.intf.cant.access: defaultM(), Super.Inner
|
||||
T5003235a.java:22:10: compiler.err.not.def.access.class.intf.cant.access: protectedM(), Super.Inner
|
||||
T5003235a.java:23:10: compiler.err.not.def.access.class.intf.cant.access: publicM(), Super.Inner
|
||||
T5003235a.java:24:10: compiler.err.not.def.access.class.intf.cant.access: privateM(), Super.Inner
|
||||
4 errors
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @bug 5003235
|
||||
* @summary Accessibility of private inner class
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail/ref=T5003235b.out --diags:layout=%b:%l:%_%m T5003235b.java
|
||||
* @compile/fail/ref=T5003235b.out -XDrawDiagnostics T5003235b.java
|
||||
*/
|
||||
|
||||
class Outer {
|
||||
|
@ -1,13 +1,5 @@
|
||||
T5003235b.java:28: k in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of k: " + outer.inner.k);
|
||||
^
|
||||
T5003235b.java:29: l in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of l: " + outer.inner.l);
|
||||
^
|
||||
T5003235b.java:30: m in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of m: " + outer.inner.m);
|
||||
^
|
||||
T5003235b.java:31: n in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of n: " + outer.inner.n);
|
||||
^
|
||||
T5003235b.java:28:56: compiler.err.not.def.access.class.intf.cant.access: k, Outer.Inner
|
||||
T5003235b.java:29:56: compiler.err.not.def.access.class.intf.cant.access: l, Outer.Inner
|
||||
T5003235b.java:30:56: compiler.err.not.def.access.class.intf.cant.access: m, Outer.Inner
|
||||
T5003235b.java:31:56: compiler.err.not.def.access.class.intf.cant.access: n, Outer.Inner
|
||||
4 errors
|
||||
|
@ -61,9 +61,10 @@ class Example implements Comparable<Example> {
|
||||
declaredKeys = new TreeSet<String>();
|
||||
srcFiles = new ArrayList<File>();
|
||||
procFiles = new ArrayList<File>();
|
||||
supportFiles = new ArrayList<File>();
|
||||
srcPathFiles = new ArrayList<File>();
|
||||
moduleSourcePathFiles = new ArrayList<File>();
|
||||
modulePathFiles = new ArrayList<File>();
|
||||
classPathFiles = new ArrayList<File>();
|
||||
additionalFiles = new ArrayList<File>();
|
||||
|
||||
findFiles(file, srcFiles);
|
||||
@ -89,10 +90,13 @@ class Example implements Comparable<Example> {
|
||||
} else if (files == srcFiles && c.getName().equals("additional")) {
|
||||
additionalFilesDir = c;
|
||||
findFiles(c, additionalFiles);
|
||||
} else if (files == srcFiles && c.getName().equals("support"))
|
||||
findFiles(c, supportFiles);
|
||||
else
|
||||
} else if (files == srcFiles && c.getName().equals("modulepath")) {
|
||||
findFiles(c, modulePathFiles);
|
||||
} else if (files == srcFiles && c.getName().equals("classpath")) {
|
||||
findFiles(c, classPathFiles);
|
||||
} else {
|
||||
findFiles(c, files);
|
||||
}
|
||||
}
|
||||
} else if (f.isFile()) {
|
||||
if (f.getName().endsWith(".java")) {
|
||||
@ -194,23 +198,32 @@ class Example implements Comparable<Example> {
|
||||
*/
|
||||
private void run(PrintWriter out, Set<String> keys, boolean raw, boolean verbose)
|
||||
throws IOException {
|
||||
ClassLoader loader = getClass().getClassLoader();
|
||||
if (supportFiles.size() > 0) {
|
||||
File supportDir = new File(tempDir, "support");
|
||||
supportDir.mkdirs();
|
||||
clean(supportDir);
|
||||
List<String> sOpts = Arrays.asList("-d", supportDir.getPath());
|
||||
new Jsr199Compiler(verbose).run(null, null, false, sOpts, procFiles);
|
||||
URLClassLoader ucl =
|
||||
new URLClassLoader(new URL[] { supportDir.toURI().toURL() }, loader);
|
||||
loader = ucl;
|
||||
List<String> opts = new ArrayList<String>();
|
||||
if (!modulePathFiles.isEmpty()) {
|
||||
File modulepathDir = new File(tempDir, "modulepath");
|
||||
modulepathDir.mkdirs();
|
||||
clean(modulepathDir);
|
||||
List<String> sOpts = Arrays.asList("-d", modulepathDir.getPath(),
|
||||
"--module-source-path", new File(file, "modulepath").getAbsolutePath());
|
||||
new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles);
|
||||
opts.add("--module-path");
|
||||
opts.add(modulepathDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!classPathFiles.isEmpty()) {
|
||||
File classpathDir = new File(tempDir, "classpath");
|
||||
classpathDir.mkdirs();
|
||||
clean(classpathDir);
|
||||
List<String> sOpts = Arrays.asList("-d", classpathDir.getPath());
|
||||
new Jsr199Compiler(verbose).run(null, null, false, sOpts, classPathFiles);
|
||||
opts.add("--class-path");
|
||||
opts.add(classpathDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
File classesDir = new File(tempDir, "classes");
|
||||
classesDir.mkdirs();
|
||||
clean(classesDir);
|
||||
|
||||
List<String> opts = new ArrayList<String>();
|
||||
opts.add("-d");
|
||||
opts.add(classesDir.getPath());
|
||||
if (options != null)
|
||||
@ -327,8 +340,9 @@ class Example implements Comparable<Example> {
|
||||
File additionalFilesDir;
|
||||
List<File> srcPathFiles;
|
||||
List<File> moduleSourcePathFiles;
|
||||
List<File> modulePathFiles;
|
||||
List<File> classPathFiles;
|
||||
List<File> additionalFiles;
|
||||
List<File> supportFiles;
|
||||
File infoFile;
|
||||
private List<String> runOpts;
|
||||
private List<String> options;
|
||||
|
@ -239,8 +239,10 @@ public class RunExamples {
|
||||
srcFiles.remove(e.infoFile);
|
||||
showFiles(e, srcFiles);
|
||||
showFiles(e, e.srcPathFiles);
|
||||
showFiles(e, e.moduleSourcePathFiles);
|
||||
showFiles(e, e.modulePathFiles);
|
||||
showFiles(e, e.classPathFiles);
|
||||
showFiles(e, e.procFiles);
|
||||
showFiles(e, e.supportFiles);
|
||||
}
|
||||
run(e);
|
||||
}
|
||||
|
@ -20,11 +20,13 @@ compiler.err.limit.pool.in.class # UNUSED?
|
||||
compiler.err.limit.stack # Code
|
||||
compiler.err.limit.string # Gen
|
||||
compiler.err.limit.string.overflow # JavaCompiler
|
||||
compiler.err.module.non.zero.opens # bad class file
|
||||
compiler.err.name.reserved.for.internal.use # UNUSED
|
||||
compiler.err.no.annotation.member
|
||||
compiler.err.no.encl.instance.of.type.in.scope # cannot occur; always followed by assert false;
|
||||
compiler.err.no.match.entry # UNUSED?
|
||||
compiler.err.not.annotation.type # cannot occur given preceding checkType
|
||||
compiler.err.not.def.access.package.cant.access
|
||||
compiler.err.proc.bad.config.file # JavacProcessingEnvironment
|
||||
compiler.err.proc.cant.access # completion failure
|
||||
compiler.err.proc.cant.access.1 # completion failure, no stack trace
|
||||
@ -69,10 +71,11 @@ compiler.misc.kindname.type.variable.bound
|
||||
compiler.misc.kindname.value
|
||||
compiler.misc.incompatible.eq.lower.bounds # cannot happen?
|
||||
compiler.misc.module.name.mismatch
|
||||
compiler.misc.module.non.zero.opens # bad class file
|
||||
compiler.misc.no.unique.minimal.instance.exists
|
||||
compiler.misc.no.unique.maximal.instance.exists # cannot happen?
|
||||
compiler.err.module.non.zero.opens # bad class file
|
||||
compiler.misc.module.non.zero.opens # bad class file
|
||||
compiler.misc.not.def.access.package.cant.access
|
||||
compiler.misc.package.not.visible
|
||||
compiler.misc.resume.abort # prompt for a response
|
||||
compiler.misc.source.unavailable # DiagnosticSource
|
||||
compiler.misc.token.bad-symbol
|
||||
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//key: compiler.err.not.def.access.class.intf.cant.access.reason
|
||||
//key: compiler.misc.not.def.access.does.not.read
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api1;
|
||||
|
||||
public class Api {
|
||||
public static void test() {}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module apia {
|
||||
exports api1;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api2;
|
||||
|
||||
public class Api {
|
||||
public static api1.Api get() { return null; }
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module apib {
|
||||
requires apia;
|
||||
exports api2;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package impl;
|
||||
|
||||
public class Impl {
|
||||
void test() {
|
||||
api2.Api.get().test();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires apib;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// key: compiler.err.prob.found.req
|
||||
// key: compiler.misc.invalid.mref
|
||||
// key: compiler.misc.not.def.access.class.intf.cant.access.reason
|
||||
// key: compiler.misc.not.def.access.does.not.read
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api1;
|
||||
|
||||
public class Api {
|
||||
public static void test() {}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module apia {
|
||||
exports api1;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api2;
|
||||
|
||||
public class Api {
|
||||
public static api1.Api get() { return null; }
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module apib {
|
||||
requires apia;
|
||||
exports api2;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package impl;
|
||||
|
||||
public class Impl {
|
||||
void test(api2.Api a2) {
|
||||
Runnable r = a2.get() :: test;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires apib;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.does.not.read
|
@ -21,8 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package p2;
|
||||
package api;
|
||||
|
||||
public class C2 {
|
||||
p1.C1 c1;
|
||||
public class Api {
|
||||
}
|
@ -21,6 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package p1;
|
||||
|
||||
public class C1 {}
|
||||
module api {
|
||||
exports api;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package impl;
|
||||
|
||||
public class Impl {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.does.not.read.from.unnamed
|
||||
|
||||
public class NotDefAccessDoesNotReadFromUnnamed {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api;
|
||||
|
||||
public class Api {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module api {
|
||||
exports api;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//key: compiler.err.not.def.access.class.intf.cant.access.reason
|
||||
//key: compiler.misc.not.def.access.does.not.read.unnamed
|
||||
//options: --add-reads=auxiliary=ALL-UNNAMED
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api;
|
||||
|
||||
public class Api {
|
||||
public void test() {}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package auxiliary;
|
||||
|
||||
public class Auxiliary {
|
||||
public static api.Api get() { return null; }
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module auxiliary {
|
||||
exports auxiliary;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package impl;
|
||||
|
||||
public class Impl {
|
||||
{
|
||||
auxiliary.Auxiliary.get().test();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires auxiliary;
|
||||
}
|
@ -21,4 +21,5 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// key: compiler.err.not.def.access.package.cant.access
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.not.exported
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api;
|
||||
|
||||
public class Api {
|
||||
}
|
@ -21,4 +21,5 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module m1x {}
|
||||
module api {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package impl;
|
||||
|
||||
public class Impl {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires api;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.not.exported.from.unnamed
|
||||
//options: --add-modules api
|
||||
|
||||
public class NotDefAccessNotExportedFromUnnamed {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api;
|
||||
|
||||
public class Api {
|
||||
}
|
@ -21,4 +21,5 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module m2x {}
|
||||
module api {
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.not.exported.to.module
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api;
|
||||
|
||||
public class Api {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module api {
|
||||
exports api to other;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package impl;
|
||||
|
||||
public class Impl {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires api;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module other {
|
||||
requires api;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.not.exported.to.module.from.unnamed
|
||||
//options: --add-modules api
|
||||
|
||||
public class NotDefAccessNotExportedToModuleFromUnnamed {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package api;
|
||||
|
||||
public class Api {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module api {
|
||||
exports api to other;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module other {
|
||||
requires api;
|
||||
}
|
@ -217,8 +217,8 @@ public class AddLimitMods extends ModuleTestBase {
|
||||
|
||||
private static final List<Entry<String[], String>> variants = Arrays.asList(
|
||||
new SimpleEntry<String[], String>(new String[] {},
|
||||
"Test.java:2:18: compiler.err.doesnt.exist: javax.annotation\n"
|
||||
+ "Test.java:5:19: compiler.err.doesnt.exist: javax.xml.bind\n"
|
||||
"Test.java:2:7: compiler.err.package.not.visible: javax.annotation, (compiler.misc.not.def.access.does.not.read.from.unnamed: javax.annotation, java.annotations.common)\n"
|
||||
+ "Test.java:5:14: compiler.err.package.not.visible: javax.xml.bind, (compiler.misc.not.def.access.does.not.read.from.unnamed: javax.xml.bind, java.xml.bind)\n"
|
||||
+ "2 errors\n"),
|
||||
new SimpleEntry<String[], String>(new String[] {"--add-modules", "java.annotations.common,java.xml.bind"},
|
||||
null),
|
||||
|
@ -81,7 +81,7 @@ public class AddReadsTest extends ModuleTestBase {
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
checkOutputContains(log,
|
||||
"Test.java:1:44: compiler.err.not.def.access.package.cant.access: api.Api, api");
|
||||
"Test.java:1:41: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read: m2x, api, m1x)");
|
||||
|
||||
//test add dependencies:
|
||||
new JavacTask(tb)
|
||||
|
@ -283,7 +283,7 @@ public class AutomaticModules extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList("Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
|
||||
List<String> expected = Arrays.asList("Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log)) {
|
||||
@ -300,8 +300,8 @@ public class AutomaticModules extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
expected = Arrays.asList("Impl.java:1:51: compiler.err.doesnt.exist: apiB",
|
||||
"Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
|
||||
expected = Arrays.asList("Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read: m1x, apiB, automaticB)",
|
||||
"Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
|
||||
"2 errors");
|
||||
|
||||
if (!expected.equals(log)) {
|
||||
|
@ -0,0 +1,515 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Check convenient errors are produced for inaccessible classes.
|
||||
* @library /tools/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
|
||||
* @run main ConvenientAccessErrorsTest
|
||||
*/
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import toolbox.JarTask;
|
||||
import toolbox.JavacTask;
|
||||
import toolbox.Task;
|
||||
|
||||
public class ConvenientAccessErrorsTest extends ModuleTestBase {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
new ConvenientAccessErrorsTest().runTests();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoDep(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path src_m1 = src.resolve("m1x");
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { exports api; }",
|
||||
"package api; public class Api { public void call() { } }");
|
||||
Path src_m2 = src.resolve("m2x");
|
||||
tb.writeJavaFiles(src_m2,
|
||||
"module m2x { }",
|
||||
"package test; public class Test { api.Api api; }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read: m2x, api, m1x)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotExported(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path src_m1 = src.resolve("m1x");
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { exports api; }",
|
||||
"package api; public class Api { }",
|
||||
"package impl; public class Impl { }");
|
||||
Path src_m2 = src.resolve("m2x");
|
||||
tb.writeJavaFiles(src_m2,
|
||||
"module m2x { requires m1x; }",
|
||||
"package test; public class Test { impl.Impl api; }");
|
||||
Path src_m3 = src.resolve("m3x");
|
||||
tb.writeJavaFiles(src_m3,
|
||||
"module m3x { requires m1x; }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:35: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported: impl, m1x)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { exports api; exports impl to m3x;}");
|
||||
|
||||
log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
expected = Arrays.asList(
|
||||
"Test.java:1:35: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported.to.module: impl, m1x, m2x)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInaccessibleInExported(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path src_m1 = src.resolve("m1x");
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { exports api; }",
|
||||
"package api; class Api { }");
|
||||
Path src_m2 = src.resolve("m2x");
|
||||
tb.writeJavaFiles(src_m2,
|
||||
"module m2x { requires m1x; }",
|
||||
"package test; public class Test { api.Api api; }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:38: compiler.err.not.def.public.cant.access: api.Api, api",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testInaccessibleUnnamedModule(Path base) throws Exception {
|
||||
Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }");
|
||||
|
||||
Path moduleSrc = base.resolve("module-src");
|
||||
Path m1x = moduleSrc.resolve("m1x");
|
||||
|
||||
Path classes = base.resolve("classes");
|
||||
|
||||
Files.createDirectories(classes);
|
||||
|
||||
tb.writeJavaFiles(m1x,
|
||||
"module m1x { }",
|
||||
"package test; public class Test { api.Api api; api.Api.Foo api; }");
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-classpath", jar.toString(),
|
||||
"-XDrawDiagnostics")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(moduleSrc))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:38: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
|
||||
"Test.java:1:51: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
|
||||
"2 errors");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIndirectReferenceToUnnamedModule(Path base) throws Exception {
|
||||
Path jar = prepareTestJar(base, "package api; public class Api { public void test() {} }");
|
||||
|
||||
Path moduleSrc = base.resolve("module-src");
|
||||
Path m1x = moduleSrc.resolve("m1x");
|
||||
Path auxiliary = moduleSrc.resolve("auxiliary");
|
||||
|
||||
Path classes = base.resolve("classes");
|
||||
|
||||
Files.createDirectories(classes);
|
||||
|
||||
tb.writeJavaFiles(m1x,
|
||||
"module m1x { requires auxiliary; }",
|
||||
"package test; public class Test { { auxiliary.Auxiliary.get().test(); } }");
|
||||
|
||||
tb.writeJavaFiles(auxiliary,
|
||||
"module auxiliary { exports auxiliary; }",
|
||||
"package auxiliary; public class Auxiliary { public static api.Api get() { return null; } }");
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-classpath", jar.toString(),
|
||||
"-XDrawDiagnostics",
|
||||
"--add-reads", "auxiliary=ALL-UNNAMED",
|
||||
"--module-source-path", moduleSrc.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(moduleSrc))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:62: compiler.err.not.def.access.class.intf.cant.access.reason: test(), api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
private Path prepareTestJar(Path base, String code) throws Exception {
|
||||
Path legacySrc = base.resolve("legacy-src");
|
||||
tb.writeJavaFiles(legacySrc, code);
|
||||
Path legacyClasses = base.resolve("legacy-classes");
|
||||
Files.createDirectories(legacyClasses);
|
||||
|
||||
String log = new JavacTask(tb)
|
||||
.options()
|
||||
.outdir(legacyClasses)
|
||||
.files(findJavaFiles(legacySrc))
|
||||
.run()
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.isEmpty()) {
|
||||
throw new Exception("unexpected output: " + log);
|
||||
}
|
||||
|
||||
Path lib = base.resolve("lib");
|
||||
|
||||
Files.createDirectories(lib);
|
||||
|
||||
Path jar = lib.resolve("test-api-1.0.jar");
|
||||
|
||||
new JarTask(tb, jar)
|
||||
.baseDir(legacyClasses)
|
||||
.files("api/Api.class")
|
||||
.run();
|
||||
|
||||
return jar;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnnamedModuleAccess(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path src_m1 = src.resolve("m1x");
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { exports api to m2x; }",
|
||||
"package api; class Api { }",
|
||||
"package impl; class Impl { }");
|
||||
Path src_m2 = src.resolve("m2x");
|
||||
tb.writeJavaFiles(src_m2,
|
||||
"module m2x { requires m1x; }");
|
||||
Path modulepath = base.resolve("modulepath");
|
||||
tb.createDirectories(modulepath);
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("--module-source-path", src.toString())
|
||||
.outdir(modulepath)
|
||||
.files(findJavaFiles(src))
|
||||
.run()
|
||||
.writeAll();
|
||||
|
||||
Path unnamedSrc = base.resolve("unnamedSrc");
|
||||
tb.writeJavaFiles(unnamedSrc,
|
||||
"public class Test { api.Api api; impl.Impl impl; }");
|
||||
Path unnamedClasses = base.resolve("unnamed-classes");
|
||||
Files.createDirectories(unnamedClasses);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("--module-path", modulepath.toString(),
|
||||
"-XDrawDiagnostics")
|
||||
.outdir(unnamedClasses)
|
||||
.files(findJavaFiles(unnamedSrc))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:21: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.from.unnamed: api, m1x)",
|
||||
"Test.java:1:34: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.does.not.read.from.unnamed: impl, m1x)",
|
||||
"2 errors"
|
||||
);
|
||||
|
||||
if (!expected.equals(log)) {
|
||||
throw new Exception("unexpected output: " + log);
|
||||
}
|
||||
|
||||
log = new JavacTask(tb)
|
||||
.options("--module-path", modulepath.toString(),
|
||||
"--add-modules", "m1x",
|
||||
"-XDrawDiagnostics")
|
||||
.outdir(unnamedClasses)
|
||||
.files(findJavaFiles(unnamedSrc))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
expected = Arrays.asList(
|
||||
"Test.java:1:21: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported.to.module.from.unnamed: api, m1x)",
|
||||
"Test.java:1:34: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported.from.unnamed: impl, m1x)",
|
||||
"2 errors"
|
||||
);
|
||||
|
||||
if (!expected.equals(log)) {
|
||||
throw new Exception("unexpected output: " + log);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInImport(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path src_m1 = src.resolve("m1x");
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { }",
|
||||
"package api; public class Api { public String test() { return null; } }");
|
||||
Path src_m2 = src.resolve("m2x");
|
||||
tb.writeJavaFiles(src_m2,
|
||||
"module m2x { requires m1x; }",
|
||||
"package test; import api.Api; public class Test { Api api; { api.test().length(); } }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInImportOnDemand(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path src_m1 = src.resolve("m1x");
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { }",
|
||||
"package api; public class Api { public String test() { return null; } }");
|
||||
Path src_m2 = src.resolve("m2x");
|
||||
tb.writeJavaFiles(src_m2,
|
||||
"module m2x { requires m1x; }",
|
||||
"package test; import api.*; public class Test { Api api; { api.test().length(); } }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
|
||||
"Test.java:1:49: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.not.exported: api, m1x)",
|
||||
"2 errors");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnusedImportOnDemand1(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
tb.writeJavaFiles(src,
|
||||
"package test; import javax.annotation.*; public class Test { }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--add-modules", "java.compiler")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run()
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList("");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnusedImportOnDemand2(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
Path src_m1 = src.resolve("m1x");
|
||||
tb.writeJavaFiles(src_m1,
|
||||
"module m1x { }",
|
||||
"package api; public class Api { }");
|
||||
Path src_m2 = src.resolve("m2x");
|
||||
tb.writeJavaFiles(src_m2,
|
||||
"module m2x { requires m1x; }",
|
||||
"package test; import api.*; public class Test { }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
List<String> log = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
throw new Exception("expected output not found; actual: " + log);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassPackageConflict(Path base) throws Exception {
|
||||
Path libSrc = base.resolve("libSrc");
|
||||
tb.writeJavaFiles(libSrc,
|
||||
"package test.desktop; public class Any { }");
|
||||
Path libClasses = base.resolve("libClasses");
|
||||
tb.createDirectories(libClasses);
|
||||
|
||||
new JavacTask(tb)
|
||||
.outdir(libClasses)
|
||||
.files(findJavaFiles(libSrc))
|
||||
.run()
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
Path src = base.resolve("src");
|
||||
tb.writeJavaFiles(src,
|
||||
"package test; public class desktop { public static class Action { } }",
|
||||
"package use; import test.desktop.*; public class Use { test.desktop.Action a; }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics")
|
||||
.classpath(libClasses)
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run()
|
||||
.writeAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassPackageConflictInUnnamed(Path base) throws Exception {
|
||||
Path libSrc = base.resolve("libSrc");
|
||||
tb.writeJavaFiles(libSrc,
|
||||
"package desktop; public class Any { }");
|
||||
Path libClasses = base.resolve("libClasses");
|
||||
tb.createDirectories(libClasses);
|
||||
|
||||
new JavacTask(tb)
|
||||
.outdir(libClasses)
|
||||
.files(findJavaFiles(libSrc))
|
||||
.run()
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
Path src = base.resolve("src");
|
||||
tb.writeJavaFiles(src,
|
||||
"public class desktop { public static class Action { } }",
|
||||
"import desktop.*; public class Use { desktop.Action a; }");
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics")
|
||||
.classpath(libClasses)
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run()
|
||||
.writeAll();
|
||||
}
|
||||
|
||||
}
|
@ -178,7 +178,7 @@ public class EdgeCases extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access: call(), api1.Api1") ||
|
||||
if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access.reason: call(), api1.Api1, api1, (compiler.misc.not.def.access.does.not.read: m3x, api1, m1x)") ||
|
||||
!log.contains("Test.java:1:76: compiler.err.not.def.access.class.intf.cant.access: toString(), java.lang.Object"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
|
@ -134,9 +134,9 @@ public class GraphsTest extends ModuleTestBase {
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Negative.java:1:43: compiler.err.doesnt.exist: closedO",
|
||||
"Negative.java:1:56: compiler.err.doesnt.exist: closedN",
|
||||
"Negative.java:1:69: compiler.err.doesnt.exist: closedL");
|
||||
"Negative.java:1:36: compiler.err.package.not.visible: closedO, (compiler.misc.not.def.access.not.exported: closedO, O)",
|
||||
"Negative.java:1:49: compiler.err.package.not.visible: closedN, (compiler.misc.not.def.access.not.exported: closedN, N)",
|
||||
"Negative.java:1:62: compiler.err.package.not.visible: closedL, (compiler.misc.not.def.access.not.exported: closedL, L)");
|
||||
if (!log.containsAll(expected)) {
|
||||
throw new Exception("Expected output not found");
|
||||
}
|
||||
@ -153,9 +153,9 @@ public class GraphsTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
expected = Arrays.asList(
|
||||
"Negative.java:1:43: compiler.err.not.def.access.package.cant.access: closedO.O, closedO",
|
||||
"Negative.java:1:56: compiler.err.not.def.access.package.cant.access: closedN.N, closedN",
|
||||
"Negative.java:1:69: compiler.err.not.def.access.package.cant.access: closedL.L, closedL");
|
||||
"Negative.java:1:36: compiler.err.package.not.visible: closedO, (compiler.misc.not.def.access.not.exported: closedO, O)",
|
||||
"Negative.java:1:49: compiler.err.package.not.visible: closedN, (compiler.misc.not.def.access.not.exported: closedN, N)",
|
||||
"Negative.java:1:62: compiler.err.package.not.visible: closedL, (compiler.misc.not.def.access.not.exported: closedL, L)");
|
||||
if (!out.containsAll(expected)) {
|
||||
throw new Exception("Expected output not found");
|
||||
}
|
||||
@ -201,7 +201,7 @@ public class GraphsTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
String expected = "A.java:1:35: compiler.err.not.def.access.package.cant.access: pack.Clazz, pack";
|
||||
String expected = "A.java:1:31: compiler.err.package.not.visible: pack, (compiler.misc.not.def.access.not.exported.to.module: pack, N, L)";
|
||||
if (!log.contains(expected)) {
|
||||
throw new Exception("Expected output not found");
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class LimitModulesTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("C.java:1:41: compiler.err.doesnt.exist: com.sun.tools.javac"))
|
||||
if (!log.contains("C.java:1:35: compiler.err.package.not.visible: com.sun.tools.javac, (compiler.misc.not.def.access.does.not.read.from.unnamed: com.sun.tools.javac, jdk.compiler)"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class OpenModulesTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
|
||||
List<String> expected2 = Arrays.asList("Test.java:1:49: compiler.err.package.not.visible: api2, (compiler.misc.not.def.access.not.exported: api2, m1x)",
|
||||
"1 error");
|
||||
if (!Objects.equals(log2, expected2))
|
||||
throw new Exception("expected output not found: " + log2);
|
||||
@ -180,7 +180,7 @@ public class OpenModulesTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
|
||||
List<String> expected2 = Arrays.asList("Test.java:1:49: compiler.err.package.not.visible: api2, (compiler.misc.not.def.access.not.exported: api2, m1x)",
|
||||
"1 error");
|
||||
if (!Objects.equals(log2, expected2))
|
||||
throw new Exception("expected output not found: " + log2);
|
||||
|
@ -70,8 +70,8 @@ public class PackageMultipleModules extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList("A.java:1:26: compiler.err.not.def.access.package.cant.access: test.B, test",
|
||||
"B.java:1:26: compiler.err.not.def.access.package.cant.access: test.A, test",
|
||||
List<String> expected = Arrays.asList("A.java:1:22: compiler.err.package.not.visible: test, (compiler.misc.not.def.access.does.not.read: m1x, test, m2x)",
|
||||
"B.java:1:22: compiler.err.package.not.visible: test, (compiler.misc.not.def.access.does.not.read: m2x, test, m1x)",
|
||||
"2 errors");
|
||||
if (!log.equals(expected))
|
||||
throw new Exception("expected output not found");
|
||||
|
@ -88,7 +88,7 @@ public class RequiresStaticTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
|
||||
if (!log.contains("Test.java:1:22: compiler.err.package.not.visible: com.sun.source.tree, (compiler.misc.not.def.access.does.not.read: m, com.sun.source.tree, jdk.compiler)"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
|
||||
@ -124,18 +124,10 @@ public class RequiresStaticTest extends ModuleTestBase {
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
String[] expect = {
|
||||
"C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
|
||||
"C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
|
||||
"C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
|
||||
"C1.java:5:52: compiler.err.not.def.access.package.cant.access: p8.C8, p8",
|
||||
"C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
|
||||
+ "(compiler.misc.location: kindname.class, p1.C1, null)",
|
||||
"C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
|
||||
+ "(compiler.misc.location: kindname.class, p1.C1, null)",
|
||||
"C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
|
||||
+ "(compiler.misc.location: kindname.class, p1.C1, null)",
|
||||
"C1.java:8:22: compiler.err.cant.resolve.location: kindname.class, C8, , , "
|
||||
+ "(compiler.misc.location: kindname.class, p1.C1, null)"
|
||||
"C1.java:5:8: compiler.err.package.not.visible: p5, (compiler.misc.not.def.access.does.not.read: m1x, p5, m5x)",
|
||||
"C1.java:5:22: compiler.err.package.not.visible: p6, (compiler.misc.not.def.access.does.not.read: m1x, p6, m6x)",
|
||||
"C1.java:5:36: compiler.err.package.not.visible: p7, (compiler.misc.not.def.access.does.not.read: m1x, p7, m7x)",
|
||||
"C1.java:5:50: compiler.err.package.not.visible: p8, (compiler.misc.not.def.access.does.not.read: m1x, p8, m8x)"
|
||||
};
|
||||
|
||||
for (String e: expect) {
|
||||
|
@ -85,7 +85,7 @@ public class RequiresTransitiveTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
|
||||
if (!log.contains("Test.java:1:22: compiler.err.package.not.visible: com.sun.source.tree, (compiler.misc.not.def.access.does.not.read: m, com.sun.source.tree, jdk.compiler)"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
|
||||
@ -121,15 +121,9 @@ public class RequiresTransitiveTest extends ModuleTestBase {
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
String[] expect = {
|
||||
"C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
|
||||
"C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
|
||||
"C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
|
||||
"C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
|
||||
+ "(compiler.misc.location: kindname.class, p1.C1, null)",
|
||||
"C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
|
||||
+ "(compiler.misc.location: kindname.class, p1.C1, null)",
|
||||
"C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
|
||||
+ "(compiler.misc.location: kindname.class, p1.C1, null)"
|
||||
"C1.java:5:8: compiler.err.package.not.visible: p5, (compiler.misc.not.def.access.does.not.read: m1x, p5, m5x)",
|
||||
"C1.java:5:22: compiler.err.package.not.visible: p6, (compiler.misc.not.def.access.does.not.read: m1x, p6, m6x)",
|
||||
"C1.java:5:36: compiler.err.package.not.visible: p7, (compiler.misc.not.def.access.does.not.read: m1x, p7, m7x)"
|
||||
};
|
||||
|
||||
for (String e: expect) {
|
||||
|
@ -99,7 +99,7 @@ public class ResolveTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
|
||||
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2x, p1, m1x)"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ public class ResolveTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
|
||||
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported: p1, m1x)"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public class ResolveTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
|
||||
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported.to.module: p1, m1x, m2x)"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ public class ResolveTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
|
||||
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2x, p1, m1x)"))
|
||||
throw new Exception("expected output not found");
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class UsesTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
|
||||
List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.package.not.visible: p, (compiler.misc.not.def.access.not.exported: p, m1x)",
|
||||
"1 error");
|
||||
if (!output.containsAll(expected)) {
|
||||
throw new Exception("Expected output not found");
|
||||
@ -286,7 +286,7 @@ public class UsesTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
|
||||
List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.package.not.visible: p, (compiler.misc.not.def.access.not.exported: p, m1x)",
|
||||
"1 error");
|
||||
if (!output.containsAll(expected)) {
|
||||
throw new Exception("Expected output not found");
|
||||
|
@ -288,7 +288,7 @@ public class XModuleTest extends ModuleTestBase {
|
||||
.writeAll()
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList("A.java:1:36: compiler.err.doesnt.exist: pkg2",
|
||||
List<String> expected = Arrays.asList("A.java:1:32: compiler.err.package.not.visible: pkg2, (compiler.misc.not.def.access.does.not.read: m1, pkg2, m2)",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
|
Loading…
Reference in New Issue
Block a user