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