SonarQube Java
  1. SonarQube Java
  2. SONARJAVA-281

Rule: Classes located in 'com.sun.*' and 'sun.*' packages should never be used

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: Rules
    • Labels:
      None
    • Number of attachments :
      0

      Activity

      Hide
      Dinesh Bolkensteyn added a comment -

      Done

      Show
      Dinesh Bolkensteyn added a comment - Done
      Hide
      Freddy Mallet added a comment -

      @Dinesh, I'm reopening this ticket to also log an issue when using classes located in 'sun.*' packages. Could you also replace double quotes by simple quotes in rule title ?
      Thanks

      Show
      Freddy Mallet added a comment - @Dinesh, I'm reopening this ticket to also log an issue when using classes located in 'sun.*' packages. Could you also replace double quotes by simple quotes in rule title ? Thanks
      Hide
      Dinesh Bolkensteyn added a comment -

      Done!

      Show
      Dinesh Bolkensteyn added a comment - Done!
      Hide
      Freddy Mallet added a comment -

      Manually tested !

      Show
      Freddy Mallet added a comment - Manually tested !
      Hide
      J.BERNARD added a comment -

      Why do you exclude classes located in 'com.sun.*' ?
      We are using Jersey and the new rule detects all classes as issues but they are not... (com.sun.jersey.api.client.WebResource)

      Show
      J.BERNARD added a comment - Why do you exclude classes located in 'com.sun.*' ? We are using Jersey and the new rule detects all classes as issues but they are not... (com.sun.jersey.api.client.WebResource)
      Hide
      Freddy Mallet added a comment -

      Here is the full description J. Bernard :

      Classes in <code>com.sun.</code> and <code>sun.</code> packages are considered implementation details, and are not part of the Java API.
      They can cause problems when moving to new versions of Java because there is no backwards compatibility guarantee.
      Such classes are almost always wrapped by Java API classes that should be used instead.
      The following code snippet illustrates this rule:

      import com.sun.jna.Native;  // Non-Compliant
      

      If this rule doesn't make sense in your context, you just have to deactivate it.

      Show
      Freddy Mallet added a comment - Here is the full description J. Bernard : Classes in <code>com.sun.</code> and <code>sun.</code> packages are considered implementation details, and are not part of the Java API. They can cause problems when moving to new versions of Java because there is no backwards compatibility guarantee. Such classes are almost always wrapped by Java API classes that should be used instead. The following code snippet illustrates this rule: import com.sun.jna.Native; // Non-Compliant If this rule doesn't make sense in your context, you just have to deactivate it.

        People

        • Assignee:
          Dinesh Bolkensteyn
          Reporter:
          Freddy Mallet
        • Votes:
          0 Vote for this issue
          Watchers:
          3 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: