use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class IssuesTests_6500_6999 method testBug6592.
@Test
public void testBug6592() {
CompilationAssertion expectSysError = new CompilationAssertion() {
public void onError(ErrorCollector collector, ExitState exitState) {
TreeSet<CompilerError> treeSet = collector.get(Kind.ERROR);
assertEquals(1, treeSet.size());
CompilerError e = treeSet.iterator().next();
assertTrue(e.message.contains("No such overrides file: "));
assertTrue(e.message.contains("doesNotExist.xml"));
}
};
assertCompiles(Arrays.asList("-overrides", "doesNotExist.xml"), new String[] { "bug65xx/bug6592/bug6592.ceylon" }, expectSysError);
expectSysError = new CompilationAssertion() {
public void onError(ErrorCollector collector, ExitState exitState) {
TreeSet<CompilerError> treeSet = collector.get(Kind.ERROR);
assertEquals(1, treeSet.size());
CompilerError e = treeSet.iterator().next();
assertTrue(e.message.contains("overrides.xml:2:12: Missing 'module' attribute in element [module: null]."));
}
};
assertCompiles(Arrays.asList("-overrides", "test/src/org/eclipse/ceylon/compiler/java/test/issues/bug65xx/bug6592/overrides.xml"), new String[] { "bug65xx/bug6592/bug6592.ceylon" }, expectSysError);
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class ModelLoaderTests method bogusModelAnnotationsTopLevelAttribute.
@Test
public void bogusModelAnnotationsTopLevelAttribute() {
compile("bogusTopLevelAttributeNoGetter_.java", "bogusTopLevelAttributeMissingType_.java", "bogusTopLevelAttributeInvalidType_.java");
assertErrors("bogusTopLevelAttributeUser", new CompilerError(2, "Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + " Error while resolving toplevel attribute org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelAttributeNoGetter: getter method missing"), new CompilerError(-1, "Error while resolving type of toplevel attribute for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelAttributeMissingType: Could not find type 'org.eclipse.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(-1, "Error while parsing type of toplevel attribute for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelAttributeInvalidType: Expecting word but got AND"), new CompilerError(3, "could not determine type of function or value reference: the type of 'bogusTopLevelAttributeNoGetter' is not known - Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + " Error while resolving toplevel attribute org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelAttributeNoGetter: getter method missing"), new CompilerError(4, "could not determine type of function or value reference: the type of 'bogusTopLevelAttributeMissingType' is not known - Error while resolving type of toplevel attribute for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelAttributeMissingType: Could not find type 'org.eclipse.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(5, "could not determine type of function or value reference: the type of 'bogusTopLevelAttributeInvalidType' is not known - Error while parsing type of toplevel attribute for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelAttributeInvalidType: Expecting word but got AND"));
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class InteropTests method testIopCallsDefaultAccessClassInAnotherPkg.
@Test
public void testIopCallsDefaultAccessClassInAnotherPkg() {
compile("access/JavaAccessModifiers.java");
compile("access/JavaDefaultAccessClass3.java");
assertErrors("CallsDefaultAccessClassInAnotherPkg", new CompilerError(21, "imported declaration is not visible: 'JavaDefaultAccessClass' is not shared"), new CompilerError(22, "imported declaration is not visible: 'JavaDefaultAccessClass2' is not shared"), new CompilerError(28, "type is not visible: 'JavaDefaultAccessClass'"), new CompilerError(29, "type is not visible: 'JavaDefaultAccessClass2'"), new CompilerError(30, "type constructor is not visible: 'JavaDefaultAccessClass3'"));
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class InteropTests method testIopAmbiguousOverloading.
@Test
public void testIopAmbiguousOverloading() {
compile("TypesJava.java", "JavaWithOverloadedMembers.java");
assertErrors("AmbiguousOverloading", new CompilerError(25, "illegal argument types in invocation of overloaded method or class: there must be exactly one overloaded declaration of 'ambiguousOverload' which accepts the given argument types 'String, String'"), new CompilerError(26, "illegal argument types in invocation of overloaded method or class: there must be exactly one overloaded declaration of 'ambiguousOverload2' which accepts the given argument types 'Integer, Integer'"));
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class InteropTests method testJava9Module.
/**
* Warning: this test requires a build with "ant -Djigsaw=true clean dist" and to run on Java 9+Jigsaw
*/
@Test
public void testJava9Module() throws Throwable {
Assume.assumeTrue("Runs on JDK9", JDKUtils.jdk == JDKUtils.JDK.JDK9);
assertErrors(new String[] { "java9/user/runError.ceylon", "java9/user/package.ceylon" }, Arrays.asList("-out", destDir, "-rep", "test/java9/modules"), null, new CompilerError(1, "imported package is not shared: 'com.ceylon.java9.internal'"));
ErrorCollector c = new ErrorCollector();
assertCompilesOk(c, getCompilerTask(Arrays.asList("-out", destDir, "-rep", "test/java9/modules"), c, "java9/user/run.ceylon", "java9/user/package.ceylon").call2());
// check that we do not have a module-info.class
File archive = getModuleArchive("org.eclipse.ceylon.compiler.java.test.interop.java9.user", "1");
try (ZipFile zf = new ZipFile(archive)) {
ZipEntry entry = zf.getEntry("module-info.class");
assertNull(entry);
}
c = new ErrorCollector();
assertCompilesOk(c, getCompilerTask(Arrays.asList("-out", destDir, "-rep", "test/java9/modules", "-module-info"), c, "java9/user/run.ceylon", "java9/user/package.ceylon").call2());
// check that we do have a module-info.class
try (ZipFile zf = new ZipFile(archive)) {
ZipEntry entry = zf.getEntry("module-info.class");
assertNotNull(entry);
}
run("org.eclipse.ceylon.compiler.java.test.interop.java9.user.run", new ModuleWithArtifact("org.eclipse.ceylon.compiler.java.test.interop.java9.user", "1"), new ModuleWithArtifact("com.ceylon.java9", "123", "test/java9/modules", "jar"));
assertEquals(0, runInJava9(new String[] { destDir, "test/java9/modules", "../dist/dist/repo" }, new ModuleSpec(null, "org.eclipse.ceylon.compiler.java.test.interop.java9.user", "1"), Collections.<String>emptyList()));
}
Aggregations