Search in sources :

Example 21 with CompilerError

use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.

the class InteropTests method testIopCallsDefaultAccessClassWithOverloading.

@Test
public void testIopCallsDefaultAccessClassWithOverloading() {
    compile("access/JavaDefaultAccessClass4.java");
    assertErrors("access/CallsDefaultAccessClassWithOverloading", new CompilerError(22, "illegal argument types in invocation of overloaded method or class: there must be exactly one overloaded declaration of 'JavaDefaultAccessClass4' which accepts the given argument types ''"));
}
Also used : CompilerError(org.eclipse.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 22 with CompilerError

use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.

the class ModelLoaderTests method bogusModelAnnotationsTopLevelClass.

@Test
public void bogusModelAnnotationsTopLevelClass() {
    compile("BogusTopLevelClass.java", "BogusTopLevelClass2.java");
    assertErrors("bogusTopLevelClassUser", new CompilerError(-1, "Constructor for 'org.eclipse.ceylon.compiler.java.test.model.BogusTopLevelClass' should take 1 reified type arguments (TypeDescriptor) but has '0': skipping constructor."), new CompilerError(-1, "Invalid type signature for self type of org.eclipse.ceylon.compiler.java.test.model::BogusTopLevelClass: org.eclipse.ceylon.compiler.java.test.model::MissingType is not a type parameter"), new CompilerError(2, "Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n   Error while resolving type of extended type for org.eclipse.ceylon.compiler.java.test.model::BogusTopLevelClass:\n   Could not find type 'org.eclipse.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(3, "class cannot be instantiated: 'BogusTopLevelClass' does not have a default constructor"));
}
Also used : CompilerError(org.eclipse.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 23 with CompilerError

use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.

the class ModelLoaderTests method bogusModelAnnotationsTopLevelMethod.

@Test
public void bogusModelAnnotationsTopLevelMethod() {
    compile("bogusTopLevelMethodNoMethod_.java", "bogusTopLevelMethodMissingType_.java", "bogusTopLevelMethodInvalidType_.java", "bogusTopLevelMethodNotStatic_.java");
    assertErrors("bogusTopLevelMethodUser", new CompilerError(2, "Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving toplevel method org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodNoMethod: static method missing"), new CompilerError(2, "Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving toplevel method org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodNotStatic: method is not static"), new CompilerError(2, "Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving type of toplevel method for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodMissingType:\n" + "   Could not find type 'org.eclipse.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(2, "Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while parsing type of toplevel method for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodInvalidType:\n" + "   Expecting word but got AND"), new CompilerError(3, "could not determine type of function or value reference: the type of 'bogusTopLevelMethodNoMethod' is not known - Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving toplevel method org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodNoMethod: static method missing"), new CompilerError(4, "could not determine type of function or value reference: the type of 'bogusTopLevelMethodNotStatic' is not known - Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving toplevel method org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodNotStatic: method is not static"), new CompilerError(5, "could not determine type of function or value reference: the type of 'bogusTopLevelMethodMissingType' is not known - Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving type of toplevel method for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodMissingType:\n" + "   Could not find type 'org.eclipse.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(6, "could not determine type of function or value reference: the type of 'bogusTopLevelMethodInvalidType' is not known - Error while loading the org.eclipse.ceylon.compiler.java.test.model/1 module:\n" + "   Error while parsing type of toplevel method for org.eclipse.ceylon.compiler.java.test.model::bogusTopLevelMethodInvalidType:\n" + "   Expecting word but got AND"));
}
Also used : CompilerError(org.eclipse.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 24 with CompilerError

use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.

the class ModelLoaderTests method loadVariadic.

@Test
public void loadVariadic() {
    compile("Variadic.ceylon");
    assertErrors("variadictest", new CompilerError(7, "missing argument to required parameter 'String+ seq' of 'VariadicPlus'"));
}
Also used : CompilerError(org.eclipse.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 25 with CompilerError

use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.

the class IssuesTests_1000_1499 method testBug1347.

@Test
public void testBug1347() {
    Assume.assumeTrue("Runs on JDK8", JDKUtils.jdk == JDKUtils.JDK.JDK8);
    assertErrors("bug13xx/bug1347/bug1347", Arrays.asList("-out", destDir, "-rep", "test/java8/modules"), null, new CompilerError(12, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(14, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(16, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(28, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(30, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"));
    ErrorCollector c = new ErrorCollector();
    assertCompilesOk(c, getCompilerTask(Arrays.asList("-target", "8", "-out", destDir, "-rep", "test/java8/modules"), c, "bug13xx/bug1347/bug1347.ceylon").call2());
    run("org.eclipse.ceylon.compiler.java.test.issues.bug13xx.bug1347.test", new ModuleWithArtifact("org.eclipse.ceylon.compiler.java.test.issues.bug13xx.bug1347", "1"), new ModuleWithArtifact("com.ceylon.java8", "1", "test/java8/modules", "jar"));
}
Also used : CompilerError(org.eclipse.ceylon.compiler.java.test.CompilerError) ErrorCollector(org.eclipse.ceylon.compiler.java.test.ErrorCollector) Test(org.junit.Test)

Aggregations

CompilerError (org.eclipse.ceylon.compiler.java.test.CompilerError)55 Test (org.junit.Test)54 ErrorCollector (org.eclipse.ceylon.compiler.java.test.ErrorCollector)19 File (java.io.File)15 CeyloncTaskImpl (org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl)12 JarFile (java.util.jar.JarFile)11 ZipEntry (java.util.zip.ZipEntry)8 LinkedList (java.util.LinkedList)7 ZipFile (java.util.zip.ZipFile)5 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 JarOutputStream (java.util.jar.JarOutputStream)2 ExitState (org.eclipse.ceylon.compiler.java.launcher.Main.ExitState)2 CompilationTask (org.eclipse.ceylon.javax.tools.JavaCompiler.CompilationTask)2 Ignore (org.junit.Ignore)2 HttpServer (com.sun.net.httpserver.HttpServer)1 FileWriter (java.io.FileWriter)1 Writer (java.io.Writer)1 TreeSet (java.util.TreeSet)1 JarEntry (java.util.jar.JarEntry)1