Community
Participate
Working Groups
Created attachment 269736 [details] Sample project - Import the attached project. - In Package explorer, copy module-info.java file and paste it in the package "p". We get this exception in Error log view: org.eclipse.jdt.core Error Tue Aug 08 16:56:54 IST 2017 JavaBuilder handling ImageBuilderInternalException while building: Test1 Java Model Exception: Java Model Status [module-info [in module-info.java [in p [in src [in Test1]]]] does not exist] at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:558) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:592) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:318) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:304) at org.eclipse.jdt.internal.core.Member.getNameRange(Member.java:343) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.createProblemFor(AbstractImageBuilder.java:409) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:187) at org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:615) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:472) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:423) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:376) at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:334) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:309) at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:139) at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:267) at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:195) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) ...
I checked if I could find a connection to bug 501507 and this is what I found: org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(CompilationResult) fails to account for module-info in several regards, in particular each call to findType() / getType() may return an IType that does not exist() if the name is "module-info". For this specific exception a snippet like the following - inserted right before createProblemFor() - would prevent the exception: if (type != null && CharOperation.equals(TypeConstants.MODULE_INFO_NAME, typeName)) { try { type = type.getCompilationUnit().getModule(); typeName = type.getElementName().toCharArray(); } catch (JavaModelException e) { type = null; } } (assuming type is changed to IMember). But at a closer look, isDuplicateLocator() should never have triggered in this case. Interestingly, duplication is detected even if one of the module-infos is changed to "module Test2 {}". It seems that duplication is detected based on the unqualified name "module-info" rather then on the real name. => As nothing in this analysis hints at a connection to the UI issue of where we show module-info in package explorer, I gratefully leave this bug to Jay :)
New Gerrit change created: https://git.eclipse.org/r/102818
(In reply to Eclipse Genie from comment #2) > New Gerrit change created: https://git.eclipse.org/r/102818 Dumped my last WIP for your entertainment, which somewhat sanitizes the current code section without fixing the root problem.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Still reproducible with 4.16 latest build.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.