-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The package XXXXXX is accessible from more than one module: <unnamed>, XXXXXX #2865
Comments
I assume this was (before gitlab scrubbed html-ish stuff):
Unfortunately this is all that the compiler knows at the point. There are two reasons to it:
I think you are best helped by performing a little search in the IDE: Ctrl+T and type the package name followed by a |
If no-one has an idea how the compiler could collect the desired information, then likely this will be a wontfix, unfortunately. |
Is there may be an information in the target platform instead of the compiler ? |
Perhaps, but how could that be used to augment an error message issued by the compiler? Or are you thinking of a separate analysis provided by PDE? |
Yes that could be an error raised by the PDE. If we have 2 java modules providing the same packages, the error message will be correct I guess because it will be raised by the JDT. But when an OSGi bundle (without module name) provides the same java packages than another "named" module (from the JDK or from another "module-bundle" named), the message will not contain the bundle ID, because there could be no module name in some cases... So we could have 2 solutions:
Is there a way to listen to JDT raised errors/warning ? |
This would require to remember the file name for every class visited by the compiler, which might be undesired overhead, since normally this information is 100% unnecessary.
Btw. the compiler isn't saying the module lacks a name, but refers to what JPMS calls "the unnamed module", which is the one module comprising all classes from the classpath.
Errors are reported through markers, so an |
When we are migrating Eclipse RCP projects on new target platforms using java 17, we can get this stupid error :
The package javax.xml.namespace is accessible from more than one module: , java.xml
This is an example with java.xml.namespace but we can have this error also for javax.xml.bind or other libraries..
Actually it means that java.xml is provided by the JDK (java.xml), and by another 'module' which has no name. This unnamed module is basically a plugin without any module name in the eclipse target platform.
I hesitated to open this bug in the PDE, but I have the feeling, this is a JDT issue... because the information is available at this level...
By the way, I got this error when I am building with maven (which probably do not use the JDT), but also in Eclipse with the jdt compiler ...
Something that could be really handy is to change the error message to give more information.
Namely the jdt should provide the name of the missing module (at least its path or whatever that can be used to recognize it (computed classpath used when the module is compiled for instance))... Without this information we have to look in all the code where the java.xml.namespace is used, if this is a plugin dependency or an import package, deal with transitive dependencies, search in the current target platform which plugin is pulling this dependency which should be used as an 'import package' so as to be directly bound to the idk, etc...
What I would like to see in the error message would be :
The package javax.xml.namespace is accessible from more than one module: (from : xxx/xxx/xxx.jar, and java.xml (from jdk 17)...
The text was updated successfully, but these errors were encountered: