Tommy Svensson created GROOVY-9270:
--------------------------------------
Summary: Using "instanceof boolean" or using a Trait will cause
the compiled code to not work with OSGi/maven-bundle-plugin/bnd
Key: GROOVY-9270
URL: https://issues.apache.org/jira/browse/GROOVY-9270
Project: Groovy
Issue Type: Bug
Components: class generator, Compiler
Environment: OSX (Mojave) JDK 11.
Reporter: Tommy Svensson
Using "instanceof boolean" or using a Trait will cause the compiled code to not
work with OSGi/maven-bundle-plugin/bnd.
The "if ( val instanceof boolean)..." should cause a compiler error since
"boolean" is not an object, and clearly not autoboxed here. This compiles fine
and produced a .class file. maven-bundle-plugin or possibly Bnd used under the
surface will however have nothing to do with this class since Groovy has
produced some strange code. m-b-p/bnd complains about code in default package
in this case. Making the "boolean" a "Boolean" makes the problem go away. But
the first one is wrong, it should not compile, but cause an error. Groovy does
not produce valid code for this case.
Using a "trait" has exactly the same effect as described above. m-b-p/bnd
complains about code in default package. If that is a side effect of using
traits then traits cannot be used in an OSGi environment. This feels more of a
less than optimal implementation of traits in groovy. I will not call this a
bug :).
The instanceof case however feels like a bug.
I also HATE JIRA!! No this is not "Critical", but it is however not "Minor"
either. In Jira you are either in hell or in heaven, earth does not exist ...
--
This message was sent by Atlassian Jira
(v8.3.4#803005)