lf-lang / lingua-franca

Intuitive concurrent programming in any language
https://www.lf-lang.org
Other
231 stars 62 forks source link

`lfc` returns exit code `0` after NullPointerException in C generator #1892

Open lhstrh opened 1 year ago

lhstrh commented 1 year ago
> Task :cli:lfc:run
lfc: info: ##### Generating code for federate federate__c in directory /home/marten/lingua-franca-master/git/lingua-franca/test/C/fed-gen/InheritanceFederated/src
lfc: info: ******** Using 1 threads to compile the program.
lfc: info: Generating code for: file:/home/marten/lingua-franca-master/git/lingua-franca/test/C/fed-gen/InheritanceFederated/src/federate__c.lf
lfc: info: Generation mode: STANDALONE
lfc: info: Generating sources into: /home/marten/lingua-franca-master/git/lingua-franca/test/C/fed-gen/InheritanceFederated/src-gen/federate__c
lfc: info: Copied 'include/federate__c_extension.cmake' from the file system.
Exception in thread "pool-1-thread-1" java.lang.NullPointerException: Cannot invoke "org.lflang.lf.Reactor.getTypeParms()" because "definition" is null
        at org.lflang.generator.c.TypeParameterizedReactor.<init>(TypeParameterizedReactor.java:84)
        at org.lflang.generator.c.TypeParameterizedReactor.<init>(TypeParameterizedReactor.java:35)
        at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:817)
        at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:874)
        at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:874)
        at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:94)
        at org.lflang.generator.c.CGenerator.createMainReactorInstance(CGenerator.java:2117)
        at org.lflang.generator.c.CGenerator.setUpGeneralParameters(CGenerator.java:1960)
        at org.lflang.generator.c.CGenerator.doGenerate(CGenerator.java:397)
        at org.lflang.generator.LFGenerator.doGenerate(LFGenerator.java:115)
        at org.lflang.federated.generator.FedGenerator.lambda$compileFederates$2(FedGenerator.java:329)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
lfc: info: ##### Generating launcher for federation  in directory /home/marten/lingua-franca-master/git/lingua-franca/test/C/bin
lfc: info: Code generation finished.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3s
petervdonovan commented 1 year ago

Is the problem here just that it finished with exit code 0, or are we also concerned about the NPE?

The NPE is clearly related to my recent work on generics, so if it happened in master, then I should fix it.

lhstrh commented 1 year ago

The NPE has been fixed already. It's just that when such error happens, we shouldn't use exit code 0.