False-positive java:S1191 for com.sun.net.httpserver.HttpServer

I’m getting java:S1191 reported by SonarLint in Intellij for the usage of com.sun.net.httpserver.HttpServer. I think this is a false-positive after reading JEP 403: Strongly Encapsulate JDK Internals:

Exported com.sun APIs

Most com.sun.* packages in the JDK are for internal use, but a few are supported for external use. These supported packages were exported in JDK 9 and will continue to be exported, so you can continue to program against their public APIs. They will, however, no longer be open. Examples include

  • The Compiler Tree API in the jdk.compiler module,
  • The HTTP Server API in the jdk.httpserver module,
  • The SCTP API in the jdk.sctp module, and
  • JDK-specific extensions to the NIO API in the com.sun.nio.file package of the jdk.unsupported module

Class com.sun.net.httpserver.HttpServer is in module jdk.httpserver.

Hi,

Welcome to the community and thanks for this report!

Could you just verify

  • Your version of SonarLint
  • Whether you’re in Connected Mode with SonarCloud / SonarQube
  • And if the latter, what SQ version you’re using

?

 
Ann

Hi Ann,

Here’s the information you requested:

  • SonarLint Version: 7.2.0.56810
  • Not connected to any SonarCloud/SonarQube instance

I hope that helps.

-Thomas

1 Like

Hi Thomas,

Since you’re on the latest version of SonarLint for IntelliJ, that should be the most up-to-date implementation of the rule. So I’ve flagged this for the language experts to take a look at.

 
Ann

1 Like