ceylon-ide-intellij icon indicating copy to clipboard operation
ceylon-ide-intellij copied to clipboard

"Fake" runtime error?

Open loldrup opened this issue 7 years ago • 3 comments

I have a Ceylon module 'tests' with a single file 'run.ceylon' with three functions: run, myTests1, myTests2. Whenever I change something in the two latter files (like, adding assert(40+2 == 42);), it causes the program to throw an assertionError stating: "Module tests/1.0.0 is not available". However, if I then immediately compile the program once again, it compiles and runs just fine. Is the compiler non-deterministic?

I'm using the IntelliJ IDE with the Ceylon plugin.

This is the full error message:

"C:\Program Files\Java\jdk1.8.0_121\bin\java" -Dceylon.system.repo=C:\Users\Jon.IdeaIC2017.2\config\plugins\CeylonIDEA\classes\embeddedDist\repo "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.1\lib\idea_rt.jar=49685:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.1\bin" -Dfile.encoding=windows-1252 -classpath C:\Users\Jon.IdeaIC2017.2\config\plugins\CeylonIDEA\classes\embeddedDist\lib\ceylon-bootstrap.jar com.redhat.ceylon.launcher.Bootstrap run --run run tests/1.0.0 Exception in thread "main" ceylon.language.AssertionError "Module tests/1.0.0 is not available" at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.checkModule(Metamodel.java:1951) at tests.run_.run(run.ceylon:27) at tests.run_.main(run.ceylon) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57) at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48) at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:68) at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:105) at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:101) at ceylon.modules.Main.execute(Main.java:69) at ceylon.modules.Main.main(Main.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.modules.Module.run(Module.java:308) at org.jboss.modules.Main.main(Main.java:487) at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:367) at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547) at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108) at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38) at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.redhat.ceylon.launcher.Bootstrap.runVersion(Bootstrap.java:162) at com.redhat.ceylon.launcher.Bootstrap.runInternal(Bootstrap.java:117) at com.redhat.ceylon.launcher.Bootstrap.run(Bootstrap.java:93) at com.redhat.ceylon.launcher.Bootstrap.main(Bootstrap.java:85)

Process finished with exit code 1

This is the content of run.ceylon:

import ceylon.test {
    TestRunner, createTestRunner
}


Anything myTests1 () {
    // assert something!
    assert(40 + 2 == 42);
    print("myTests2");
    return null;
}

void myTests2 () {
    // assert something!
    assert(2 +2 == 4);
    print("myTests2");
}


"Run the module `tests`."
shared void run() {

    TestRunner myTestRunner = createTestRunner(
        [`function myTests1`, `function myTests2`]);

    myTestRunner.run();
}

loldrup avatar Sep 11 '17 09:09 loldrup

One for @FroMage.

gavinking avatar Sep 11 '17 09:09 gavinking

@loldrup do you run the module from the IDE (the green arrow), or from the CLI?

If it's from the IDE, could you check that your run configuration has "Build project" under the "Before launch" actions?

bjansen avatar Sep 11 '17 09:09 bjansen

I click the green arrow to build/run. Here's a screenshot of my run configuration: https://imgur.com/halIccL

loldrup avatar Sep 11 '17 09:09 loldrup