use of com.sun.tools.javac.jvm.ClassReader.BadClassFile in project ceylon-compiler by ceylon.
the class T6435291 method main.
public static void main(String... args) {
javax.tools.JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavacTaskImpl task = (JavacTaskImpl) tool.getTask(null, null, null, null, null, null);
JavaCompiler compiler = JavaCompiler.instance(task.getContext());
try {
compiler.resolveIdent("T").complete();
} catch (BadClassFile e) {
System.err.println("Passed: expected completion failure " + e.getClass().getName());
return;
} catch (Exception e) {
throw new RuntimeException("Failed: unexpected exception");
}
throw new RuntimeException("Failed: no error reported");
}
use of com.sun.tools.javac.jvm.ClassReader.BadClassFile in project ceylon-compiler by ceylon.
the class T6330997 method main.
public static void main(String... args) {
increaseMajor("T1.class", 1);
increaseMajor("T2.class", 2);
javax.tools.JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavacTaskImpl task = (JavacTaskImpl) tool.getTask(null, null, null, null, null, null);
JavaCompiler compiler = JavaCompiler.instance(task.getContext());
try {
compiler.resolveIdent("T1").complete();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Failed: unexpected exception while reading class T1");
}
try {
compiler.resolveIdent("T2").complete();
} catch (BadClassFile e) {
System.err.println("Passed: expected completion failure " + e.getClass().getName());
return;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Failed: unexpected exception while reading class T2");
}
throw new RuntimeException("Failed: no error reported");
}
Aggregations