Uploaded image for project: 'Log Tool'
  1. Log Tool
  2. LOGTOOL-115

Ambiguous import problem with conflicting class name

    XMLWordPrintable

Details

    • Hide

      Explicitly upgrade JDeparser2 to a newer version, like this:

              <dependency>
                  <groupId>org.jboss.logging</groupId>
                  <artifactId>jboss-logging-processor</artifactId>
                  <version>2.0.1.Final</version>
                  <scope>provided</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.jdeparser</groupId>
                  <artifactId>jdeparser</artifactId>
                  <version>2.0.2.Final</version>
                  <scope>provided</scope>
              </dependency>
      
      Show
      Explicitly upgrade JDeparser2 to a newer version, like this: <dependency> <groupId> org.jboss.logging </groupId> <artifactId> jboss-logging-processor </artifactId> <version> 2.0.1.Final </version> <scope> provided </scope> </dependency> <dependency> <groupId> org.jboss.jdeparser </groupId> <artifactId> jdeparser </artifactId> <version> 2.0.2.Final </version> <scope> provided </scope> </dependency>

    Description

      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:

      [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
      

      The source looks like this:

      // ...
      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);
          // ...
      

      The generated code is:

          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;
          }
      

      Attachments

        Issue Links

          Activity

            People

              jperkins-rhn James Perkins
              dlloyd@redhat.com David Lloyd
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: