4 Replies Latest reply on Dec 13, 2018 2:08 AM by pmm

    Depending on a Jigsaw module

    pmm

      We have a JBoss module that depends on a Jigsaw module in the JDK. Right now we have a <system> dependency in module.xml but from looking at the comments in the "sun.jdk" module there is mention of a way to depend on a Jigsaw module but we could not find any documentation. How can this be achieved?

       

      Message was edited by: Philippe Marschall fixed typos

        • 1. Re: Depending on a Jigsaw module
          emeuwese

          To me your question is a bit vague. Jigsaw is the name of the project to create the module system. In your module-info.java you can define which packages, services are accessible to others and which modules are required. Code from sun packages should not be used directly. Internal code could be removed or be inaccessible in future releases of the JDK. May be you could tell a little bit more about which module your code depends on?

           

          If you intent to use something like sun.misc.Unsafe then your module-info.java could look like

          module com.company.example { 
               requires jdk.unsupported;
          }

          then your class can import sun.misc.Unsafe; and do something like

          Unsafe.class.getDeclaredField("unsafe");

          JDK Module Summary

           

          Or is your idea to do something like this Dealing with Sun JDK related NoClassDefFoundError under Jboss | Planet JBoss Developer

          • 2. Re: Depending on a Jigsaw module
            jaikiran

            I think what Philippe wants is to refer/add a dependency in JBoss module.xml to a Java module instead of a JBoss module.

             

            > How can this be achieved?

             

            You can just add a dependency by the same name as that of the Java module. There are other JBoss modules within WildFly which do that. For example here wildfly-core/module.xml at master · wildfly/wildfly-core · GitHub

            • 3. Re: Depending on a Jigsaw module
              pmm

              emeuwese  wrote:

               

              To me your question is a bit vague. Jigsaw is the name of the project to create the module system. In your module-info.java you can define which packages, services are accessible to others and which modules are required. Code from sun packages should not be used directly. Internal code could be removed or be inaccessible in future releases of the JDK. May be you could tell a little bit more about which module your code depends on?

               

              jdk.jfr

              • 4. Re: Depending on a Jigsaw module
                pmm

                jaikiran  wrote:

                 

                I think what Philippe wants is to refer/add a dependency in JBoss module.xml to a Java module instead of a JBoss module.

                 

                > How can this be achieved?

                 

                You can just add a dependency by the same name as that of the Java module. There are other JBoss modules within WildFly which do that. For example here wildfly-core/module.xml at master · wildfly/wildfly-core · GitHub

                That does what we need, thanks.