Search in sources :

Example 31 with CompilerError

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

the class CMRTests method testMdlBug1062IncompatibleSharedImport.

@Test
public void testMdlBug1062IncompatibleSharedImport() throws IOException {
    // compile our java class
    File classesOutputFolder = new File(destDir + "-jar-classes");
    cleanCars(classesOutputFolder.getPath());
    classesOutputFolder.mkdirs();
    File jarOutputFolder = new File(destDir + "-jar");
    cleanCars(jarOutputFolder.getPath());
    jarOutputFolder.mkdirs();
    compileJavaModule(jarOutputFolder, classesOutputFolder, "bug1062.javaA", "1", new File(getPackagePath() + "/modules/bug1062/javaA1-src"), new File[0], "bug1062/javaA/JavaA.java");
    compileJavaModule(jarOutputFolder, classesOutputFolder, "bug1062.javaA", "2", new File(getPackagePath() + "/modules/bug1062/javaA2-src"), new File[0], "bug1062/javaA/JavaA.java");
    compileJavaModule(jarOutputFolder, classesOutputFolder, "bug1062.javaB", "1", new File(getPackagePath() + "/modules/bug1062/javaB-module-export-src"), new File[] { new File(jarOutputFolder, "bug1062/javaA/1/bug1062.javaA-1.jar") }, "bug1062/javaB/JavaB.java");
    // ceylon module imports JavaA/2 and JavaB/1
    // JavaB/1 shared imports JavaA/1
    assertErrors("modules/bug1062/ceylon/test", Arrays.asList("-rep", jarOutputFolder.getPath()), null, new CompilerError(2, "module (transitively) imports conflicting versions of dependency 'bug1062.javaA': version '1' and version '2'"), new CompilerError(2, "source code imports two different versions of module 'bug1062.javaA': version '1' and version '2'"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) JarFile(java.util.jar.JarFile) ZipFile(java.util.zip.ZipFile) File(java.io.File) Test(org.junit.Test)

Example 32 with CompilerError

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

the class IssuesTests_1500_1999 method testBug1773.

@Test
public void testBug1773() {
    ErrorCollector collector = new ErrorCollector();
    CeyloncTaskImpl task = getCompilerTask(defaultOptions, collector, "bug17xx/Bug1773.ceylon");
    // now compile it all the way
    ExitState exitState = task.call2();
    Assert.assertEquals(ExitState.CeylonState.ERROR, exitState.ceylonState);
    // make sure we only got one, do not trust actualErrors.size() for that since it's a Set so
    // two methods with same contents would count as one.
    Assert.assertEquals(1, exitState.errorCount);
    TreeSet<CompilerError> actualErrors = collector.get(Diagnostic.Kind.ERROR);
    compareErrors(actualErrors, new CompilerError(22, "dynamic is not supported on the JVM"));
}
Also used : ExitState(com.redhat.ceylon.compiler.java.launcher.Main.ExitState) ErrorCollector(com.redhat.ceylon.compiler.java.test.ErrorCollector) CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 33 with CompilerError

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

the class InteropTests method testIopExtendsDefaultAccessClassInAnotherPkg.

@Test
public void testIopExtendsDefaultAccessClassInAnotherPkg() {
    compile("access/JavaAccessModifiers.java");
    compile("access/JavaDefaultAccessClass3.java");
    assertErrors("ExtendsDefaultAccessClassInAnotherPkg", new CompilerError(21, "imported declaration is not shared: 'JavaDefaultAccessClass'"), new CompilerError(22, "imported declaration is not shared: 'JavaDefaultAccessClass2'"), new CompilerError(27, "supertype is not visible everywhere type 'ExtendsDefaultAccessClassInAnotherPkg' is visible: 'JavaDefaultAccessClass' involves an unshared type declaration"), new CompilerError(27, "type is not visible: 'JavaDefaultAccessClass'"), new CompilerError(29, "supertype is not visible everywhere type 'ExtendsDefaultAccessClassInAnotherPkg2' is visible: 'JavaDefaultAccessClass2' involves an unshared type declaration"), new CompilerError(29, "type is not visible: 'JavaDefaultAccessClass2'"), new CompilerError(31, "package private constructor is not visible: 'JavaDefaultAccessClass3'"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 34 with CompilerError

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

the class InteropTests method testIopCallsDefaultAccessMethodInAnotherPkg.

@Test
public void testIopCallsDefaultAccessMethodInAnotherPkg() {
    compile("access/JavaAccessModifiers.java");
    assertErrors("CallsDefaultAccessMethodInAnotherPkg", new CompilerError(25, "protected method or attribute is not visible: 'protectedAccessMethod' of type 'JavaAccessModifiers'"), new CompilerError(27, "package private method or attribute is not visible: 'defaultAccessMethod' of type 'JavaAccessModifiers'"), new CompilerError(36, "package private function or value is not visible: 'defaultAccessMethod'"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) Test(org.junit.Test)

Example 35 with CompilerError

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

the class InteropTests method testIopCallsDefaultAccessClassWithOverloading.

@Test
public void testIopCallsDefaultAccessClassWithOverloading() {
    compile("access/JavaDefaultAccessClass4.java");
    assertErrors("access/CallsDefaultAccessClassWithOverloading", new CompilerError(22, "class cannot be instantiated: 'JavaDefaultAccessClass4' does not have a default constructor"), new CompilerError(22, "ambiguous invocation of overloaded method or class: there must be exactly one overloaded declaration of 'JavaDefaultAccessClass4' that accepts the given argument types ''"));
}
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