Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-27075

Remove packages exposed by more than one module

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11.1
    • Component/s: Runtime

      Description

      Since we are using JDK 11 to compile the Nuxeo Platform, see NXP-24952, we get these kind of errors in Eclipse when setting the Compiler Compliance Level to 11 in Preferences > Java > Compiler > JDK Compliance.

      The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
      

      For instance in DomHelper from nuxeo-commons on:

      import javax.xml.parsers.DocumentBuilderFactory;
      import javax.xml.parsers.ParserConfigurationException;
      
      import org.w3c.dom.Document;
      import org.w3c.dom.DocumentFragment;
      import org.w3c.dom.Element;
      import org.w3c.dom.Node;
      import org.xml.sax.InputSource;
      import org.xml.sax.SAXException;
      

      Basically, this happens on all the packages that are split between classpath (pom.xml) and system image (JDK).

      This is only visible in Eclipse because it uses its own Java compiler, which apparently adheres to the Java Language Specification more closely than Oracle's own compiler.

      Yet, having for instance both xml-apis and JRE 9+ in our dependencies is no longer valid according to JLS 9+.

      It seems that we'll have to remove all dependencies to these "duplicate" packages and always add exclusions to avoid transitive dependencies.
      But this is not trivial: to fix the issue with org.w3c.dom, removing dependencies on xml-apis is not enough as it is also exposed by some libs like xercesImpl.

      Workaround for Eclipse: set the Compiler Compliance Level to 1.8.

      See:
      http://mail.openjdk.java.net/pipermail/jigsaw-dev/2018-December/014077.html

      tl;dr A package split between the classpath and the system image is just
      as bad as a package split between two modules on the modulepath.

      https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928

      Eclipse is not the cause, we're just the messenger of a situation that has become illegal.

      When Java 13 fixes https://bugs.openjdk.java.net/browse/JDK-8215739 your current structure will definitely stop to compile also in maven. Nothing we can possibly fix in Eclipse.

      https://bugs.openjdk.java.net/browse/JDK-8215739

      javac does not detect split packages between classpath and system image

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days, 5 hours
                  3d 5h

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.