use of com.sun.source.tree.Scope in project ceylon by eclipse.
the class T6598108 method main.
public static void main(String[] args) throws Exception {
// NOI18N
final String bootPath = System.getProperty("sun.boot.class.path");
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
assert tool != null;
final JavacTask ct = (JavacTask) tool.getTask(null, null, null, Arrays.asList("-bootclasspath", bootPath), null, Arrays.asList(new MyFileObject()));
CompilationUnitTree cut = ct.parse().iterator().next();
TreePath tp = new TreePath(new TreePath(cut), cut.getTypeDecls().get(0));
Scope s = Trees.instance(ct).getScope(tp);
TypeElement type = ct.getElements().getTypeElement("com.sun.java.util.jar.pack.Package.File");
if (Trees.instance(ct).isAccessible(s, type)) {
// "false" would be expected here.
throw new IllegalStateException("");
}
}
use of com.sun.source.tree.Scope in project ceylon-compiler by ceylon.
the class T6598108 method main.
public static void main(String[] args) throws Exception {
// NOI18N
final String bootPath = System.getProperty("sun.boot.class.path");
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
assert tool != null;
final JavacTask ct = (JavacTask) tool.getTask(null, null, null, Arrays.asList("-bootclasspath", bootPath), null, Arrays.asList(new MyFileObject()));
CompilationUnitTree cut = ct.parse().iterator().next();
TreePath tp = new TreePath(new TreePath(cut), cut.getTypeDecls().get(0));
Scope s = Trees.instance(ct).getScope(tp);
TypeElement type = ct.getElements().getTypeElement("com.sun.java.util.jar.pack.Package.File");
if (Trees.instance(ct).isAccessible(s, type)) {
// "false" would be expected here.
throw new IllegalStateException("");
}
}
Aggregations