[jboss-jira] [JBoss JIRA] (LOGTOOL-115) Ambiguous import problem with conflicting class name

David Lloyd (JIRA) issues at jboss.org
Tue Nov 15 09:22:02 EST 2016


David Lloyd created LOGTOOL-115:
-----------------------------------

             Summary: Ambiguous import problem with conflicting class name
                 Key: LOGTOOL-115
                 URL: https://issues.jboss.org/browse/LOGTOOL-115
             Project: Log Tool
          Issue Type: Bug
    Affects Versions: 2.0.1.Final
            Reporter: David Lloyd
            Priority: Blocker


If I have two classes with the same simple name in the logging interface, and a single method uses both of them, the generated class fails to qualify one of them, resulting in compilation errors like this:

{noformat}
[ERROR] /home/david/src/java/wildfly-naming/target/generated-sources/annotations/org/wildfly/naming/client/_private/Messages_$logger.java:[35,8] org.wildfly.naming.client._private.Messages_$logger is not abstract and does not override abstract method authenticationFailed(org.wildfly.security.auth.AuthenticationException) in org.wildfly.naming.client._private.Messages
[ERROR] /home/david/src/java/wildfly-naming/target/generated-sources/annotations/org/wildfly/naming/client/_private/Messages_$logger.java:[403,5] method does not override or implement a method from a supertype
{noformat}

The source looks like this:

{code}
// ...
import org.wildfly.security.auth.AuthenticationException;
// ...

@MessageLogger(projectCode = "WFNAM", length = 5)
public interface Messages extends BasicLogger {
    // ...
        @Message(id = 32, value = "Peer authentication failed")
    javax.naming.AuthenticationException authenticationFailed(@Cause AuthenticationException cause);
    // ...
{code}

The generated code is:

{code}
    private static final String authenticationFailed = "WFNAM00032: Peer authentication failed";
    protected String authenticationFailed$str() {
        return authenticationFailed;
    }
    @Override
    public final AuthenticationException authenticationFailed(final AuthenticationException cause) { // XXX This is a problem line; return type is not qualified
        final AuthenticationException result = new AuthenticationException(String.format(authenticationFailed$str())); // XXX and this type and constructor are also not qualified
        result.initCause(cause);
        final StackTraceElement[] st = result.getStackTrace();
        result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
        return result;
    }
{code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list