Details
-
Bug
-
Resolution: Done
-
Minor
-
2.1.0.Final
-
None
-
Workaround Exists
-
Description
Incorrect generated code can be generated if an exception constructor's "cause" parameter is a subtype of Throwable (say, Exception) instead of being Throwable itself, and a @Cause parameter exists whose type is a superclass of that type (say, Throwable).
The compilation errors can look something like this:
2018-04-02 12:37:40 [ERROR] /home/david/src/java/wildfly/ejb3/target/generated-sources/annotations/org/jboss/as/ejb3/logging/EjbLogger_$logger.java:[3340,112] incompatible types: java.lang.Throwable cannot be converted to java.lang.Exception 2018-04-02 12:37:40 [ERROR] /home/david/src/java/wildfly/ejb3/target/generated-sources/annotations/org/jboss/as/ejb3/logging/EjbLogger_$logger.java:[3479,164] incompatible types: java.lang.Error cannot be converted to java.lang.Exception
If the @Cause method parameter type is not assignable to the exception's cause parameter type, then the initCause strategy should be used instead.