Search in sources :

Example 41 with CompilerError

use of com.redhat.ceylon.compiler.java.test.CompilerError in project ceylon-compiler by ceylon.

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("com.redhat.ceylon.compiler.java.test.issues.bug13xx.bug1347.test", new ModuleWithArtifact("com.redhat.ceylon.compiler.java.test.issues.bug13xx.bug1347", "1"), new ModuleWithArtifact("com.ceylon.java8", "1", "test/java8/modules", "jar"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) ErrorCollector(com.redhat.ceylon.compiler.java.test.ErrorCollector) Test(org.junit.Test)

Example 42 with CompilerError

use of com.redhat.ceylon.compiler.java.test.CompilerError in project ceylon-compiler by ceylon.

the class IssuesTests_1000_1499 method testBug1185.

@Test
public void testBug1185() {
    compareWithJavaSource("bug11xx/Bug1185");
    run("com.redhat.ceylon.compiler.java.test.issues.bug11xx.bug1185");
    assertErrors("bug11xx/Bug1185_errors", new CompilerError(3, "literal outside representable range: '9223372036854775808' is too large to be represented as an 'Integer'"), new CompilerError(4, "literal outside representable range: '-9223372036854775809' is too large to be represented as an 'Integer'"), new CompilerError(5, "invalid hexadecimal literal: '#10000000000000000' has more than 64 bits"), new CompilerError(6, "invalid binary literal: '$10000000000000000000000000000000000000000000000000000000000000000' has more than 64 bits"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 43 with CompilerError

use of com.redhat.ceylon.compiler.java.test.CompilerError in project ceylon-compiler by ceylon.

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 com.redhat.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving toplevel attribute com.redhat.ceylon.compiler.java.test.model::bogusTopLevelAttributeNoGetter: getter method missing"), new CompilerError(-1, "Error while resolving type of toplevel attribute for com.redhat.ceylon.compiler.java.test.model::bogusTopLevelAttributeMissingType: Could not find type 'com.redhat.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(-1, "Error while parsing type of toplevel attribute for com.redhat.ceylon.compiler.java.test.model::bogusTopLevelAttributeInvalidType: Expecting word but got AND"), new CompilerError(3, "could not determine type of function or value reference: 'bogusTopLevelAttributeNoGetter': Error while loading the com.redhat.ceylon.compiler.java.test.model/1 module:\n" + "   Error while resolving toplevel attribute com.redhat.ceylon.compiler.java.test.model::bogusTopLevelAttributeNoGetter: getter method missing"), new CompilerError(4, "could not determine type of function or value reference: 'bogusTopLevelAttributeMissingType': Error while resolving type of toplevel attribute for com.redhat.ceylon.compiler.java.test.model::bogusTopLevelAttributeMissingType: Could not find type 'com.redhat.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(5, "could not determine type of function or value reference: 'bogusTopLevelAttributeInvalidType': Error while parsing type of toplevel attribute for com.redhat.ceylon.compiler.java.test.model::bogusTopLevelAttributeInvalidType: Expecting word but got AND"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 44 with CompilerError

use of com.redhat.ceylon.compiler.java.test.CompilerError in project ceylon-compiler by ceylon.

the class ModelLoaderTests method bogusModelAnnotationsTopLevelClass.

@Test
public void bogusModelAnnotationsTopLevelClass() {
    compile("BogusTopLevelClass.java", "BogusTopLevelClass2.java");
    assertErrors("bogusTopLevelClassUser", new CompilerError(-1, "Constructor for 'com.redhat.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 com.redhat.ceylon.compiler.java.test.model::BogusTopLevelClass: com.redhat.ceylon.compiler.java.test.model::MissingType is not a type parameter"), new CompilerError(2, "Error while loading the com.redhat.ceylon.compiler.java.test.model/1 module:\n   Error while resolving type of extended type for com.redhat.ceylon.compiler.java.test.model::BogusTopLevelClass:\n   Could not find type 'com.redhat.ceylon.compiler.java.test.model.MissingType'"), new CompilerError(3, "class cannot be instantiated: 'BogusTopLevelClass' does not have a default constructor"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 45 with CompilerError

use of com.redhat.ceylon.compiler.java.test.CompilerError in project ceylon-compiler by ceylon.

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(com.redhat.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Aggregations

CompilerError (com.redhat.ceylon.compiler.java.test.CompilerError)47 Test (org.junit.Test)47 ErrorCollector (com.redhat.ceylon.compiler.java.test.ErrorCollector)15 File (java.io.File)13 CeyloncTaskImpl (com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl)11 JarFile (java.util.jar.JarFile)11 ZipEntry (java.util.zip.ZipEntry)7 LinkedList (java.util.LinkedList)6 ZipFile (java.util.zip.ZipFile)4 HttpServer (com.sun.net.httpserver.HttpServer)2 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 JarOutputStream (java.util.jar.JarOutputStream)2 CompilationTask (javax.tools.JavaCompiler.CompilationTask)2 ExitState (com.redhat.ceylon.compiler.java.launcher.Main.ExitState)1 Module (com.redhat.ceylon.model.typechecker.model.Module)1 FileWriter (java.io.FileWriter)1 Writer (java.io.Writer)1 Ignore (org.junit.Ignore)1