Menu

#1555 [java] UnnecessaryFullyQualifiedName: Really necessary fully qualified name

PMD-5.4.4
closed
None
PMD
3-Major
Bug
5.5.1
UnnecessaryFullyQualifiedName
2017-01-03
2016-12-07
No

The rule does not take into account, the necessity to distinguish between the imported class and a user defined class of the same name.

import java.util.*;

final class Test {
  private Test() { }

  private static class Locale {
    public final java.util.Locale locale; // Here we need to fully qualify
    public Locale(final String tag) {
      this.locale = java.util.Locale.forLanguageTag(tag);
    }
  }

  // ...
  // Lots of uses of classes imported by java.util.*
  // ...

  public static void main(String[] args) {
    final Locale l = new Locale("fr-CA");
    System.out.println(l.toString());
  }
}

Discussion

  • Juan Sotuyo

    Juan Sotuyo - 2016-12-10
    • assigned_to: Maraxus
    • Milestone: New Tickets --> PMD-5.4.4
     
  • Juan Sotuyo

    Juan Sotuyo - 2016-12-10

    This one is another case of conflict resolution, such as https://sourceforge.net/p/pmd/bugs/1546/

    However, the fix for that issue doesn't cover this one. I'll try to get it fixed.

     

    Last edit: Juan Sotuyo 2016-12-10
  • Juan Sotuyo

    Juan Sotuyo - 2016-12-10
     
  • Andreas Dangel

    Andreas Dangel - 2017-01-03
    • summary: Really necessary fully qualified name in UnnecessaryFullyQualifiedName --> [java] UnnecessaryFullyQualifiedName: Really necessary fully qualified name
     
  • Andreas Dangel

    Andreas Dangel - 2017-01-03
    • status: open --> closed
     
  • Andreas Dangel

    Andreas Dangel - 2017-01-03

    This bug will be fixed with PMD 5.4.4, 5.5.3 and later.

     

Log in to post a comment.

MongoDB Logo MongoDB