javaintellij-ideajava-9module-infointellij-idea2017

Service interface provided but not exported or used warning in module-info class


Java9 - jdk-9+181
intelliJ - 2017.2.2 built on August 9,2017

The java.management.rmi's module-info.java implementation is somewhat like:

module java.management.rmi {
    ...
    requires transitive java.management;

    exports com.sun.jmx.remote.protocol.rmi to java.management;

    provides javax.management.remote.JMXConnectorProvider with
        com.sun.jmx.remote.protocol.rmi.ClientProvider;
    provides javax.management.remote.JMXConnectorServerProvider with
        com.sun.jmx.remote.protocol.rmi.ServerProvider;
}

For both the provides statement I got to see a compiler warning stating

Service interface provided but not exported or used

I ended up guessing wrong when I tried using these in another module as:

module interactor {
    requires java.management.rmi;
    uses javax.management.remote.JMXConnectorProvider;
}

The warning still remains.

Furthermore, I could also reach java.management's module to find

uses javax.management.remote.JMXConnectorProvider;
uses javax.management.remote.JMXConnectorServerProvider;

What's the reason for this warning still and how could this be solved?

Attaching screenshot as per the ask in comments:

enter image description here


Solution

  • For any future references, this might turn up to be relevant due to some regressions in IntelliJ updates, answering this myself.

    This was a bug with IntelliJ and was tracked at IDEA-178041 which resulted in:

    omitting some JDK or library modules from a module graph used to generate warnings.


    Update September 7, 2017

    The issue has been fixed with IntelliJ IDEA 2017.3 EAP build.

    IntelliJ IDEA 2017.3 EAP (Community Edition)
    Build #IC-173.2099.14, built on September 6, 2017
    JRE: 1.8.0_152-release-915-b11 x86_64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o