[jboss-jira] [JBoss JIRA] (LOGTOOL-134) Incompatible type error with @Cause and ctors with unusual exception types
David Lloyd (JIRA)
issues at jboss.org
Mon Apr 2 13:44:00 EDT 2018
David Lloyd created LOGTOOL-134:
-----------------------------------
Summary: Incompatible type error with @Cause and ctors with unusual exception types
Key: LOGTOOL-134
URL: https://issues.jboss.org/browse/LOGTOOL-134
Project: Log Tool
Issue Type: Bug
Affects Versions: 2.1.0.Final
Reporter: David Lloyd
Priority: Minor
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:
{noformat}
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
{noformat}
If the {{\@Cause}} method parameter type is not assignable to the exception's cause parameter type, then the {{initCause}} strategy should be used instead.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list