| Summary: | JDK10: Incorrect Name clash error | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Benjamin Manes <ben.manes> | ||||
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | jarthana, lgoldstein, manoj.palat, martin.keller, stephan.herrmann | ||||
| Version: | 4.7.3 | ||||||
| Target Milestone: | 4.8 M7 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X | ||||||
| See Also: |
https://git.eclipse.org/r/121535 https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=235a3d96bce67e31626ffca69b9b34eaacd105d9 https://bugs.eclipse.org/bugs/show_bug.cgi?id=534471 |
||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Benjamin Manes
Can you please attach a small reproducible test case? Created attachment 273637 [details]
sample project
This shows an error in Eclipse for me. No issue command-line.
(In reply to Benjamin Manes from comment #2) > Created attachment 273637 [details] > sample project > > This shows an error in Eclipse for me. No issue command-line. Thanks, these steps reproduce the bug without additional libraries / build tools: 1. Compile the following sources (e.g., in a separate project P1): //--- package q; import java.io.Serializable; public interface JobDetail extends Serializable, Cloneable { } //--- package q; import java.util.Map; import java.util.Set; public interface Scheduler { void scheduleJobs(Map<JobDetail, Set<? extends Trigger>> triggersAndJobs, boolean replace) throws SchedulerException; } //--- package q; public class SchedulerException extends Exception { private static final long serialVersionUID = 174841398690789156L; } //--- package q; import java.io.Serializable; public interface Trigger extends Serializable, Cloneable, Comparable<Trigger> { public static final long serialVersionUID = -3904243490805975570L; } //--- 2. Then compile the following file against compiled .class from above (e.g., by creating a second project P2 that depends on P1): //--- import java.util.Map; import java.util.Set; import q.JobDetail; import q.Scheduler; import q.SchedulerException; import q.Trigger; public class ForwardingScheduler implements Scheduler { @Override public void scheduleJobs(Map<JobDetail, Set<? extends Trigger>> triggersAndJobs, boolean replace) throws SchedulerException { } } //--- The left ruler will show these contradictory messages: Multiple markers at this line - implements q.Scheduler.scheduleJobs - The method scheduleJobs(Map<JobDetail,Set<? extends Trigger>>, boolean) of type ForwardingScheduler must override or implement a supertype method - Name clash: The method scheduleJobs(Map<JobDetail,Set<? extends Trigger>>, boolean) of type ForwardingScheduler has the same erasure as scheduleJobs(Map<JobDetail,Set<? extends Trigger>>, boolean) of type Scheduler but does not override it Putting all sources into the same project and performing Project Clean does not trigger the bug. *** Bug 533348 has been marked as a duplicate of this bug. *** (In reply to Stephan Herrmann from comment #4) > *** Bug 533348 has been marked as a duplicate of this bug. *** In that bug I found the problem to be introduced in 4.7.3 and 4.8M3. (In reply to Stephan Herrmann from comment #5) > (In reply to Stephan Herrmann from comment #4) > > *** Bug 533348 has been marked as a duplicate of this bug. *** > > In that bug I found the problem to be introduced in 4.7.3 and 4.8M3. I had to un-duplicate the other bug, which happened without JDK10 and is already fixed, whereas here we definitely need JDK10 and don't yet have a fix. Strange enough, I didn't succeed so far in creating a pure compiler JUnit, error is seen only in the IDE ... Debugging the IDE I observed:
We don't detect the override, because the wildcard in the signature ("? extends Trigger") has duplicate representations in TypeSystem.types.
Duplicate wildcard representations seem to be caused by duplicate representations of java.util.Set as UnresolvedReferenceBinding (which cause us to search in the wrong derivedTypes slot).
This in turn seems to be caused by bogus lookup via split package java.util from java.base, java.logging, java.prefs. Those packages exist indeed, but don't contain any types (types are in java.util.logging and java.util.prefs).
New Gerrit change created: https://git.eclipse.org/r/121535 (In reply to Eclipse Genie from comment #8) > New Gerrit change created: https://git.eclipse.org/r/121535 Test needs to use module mode to trigger the problem. Not sure what impact JDK 10 had nor why this issue didn't occur before. The root cause could be found where the URB is created in the first place: we must not place the URB into a SplitPackageBinding otherwise it will not be found by subsequent lookup. Checking which incarnation has CUs resolves the problem - given that no illegal package split (accessible from more than one module) exists. Gerrit change https://git.eclipse.org/r/121535 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=235a3d96bce67e31626ffca69b9b34eaacd105d9 (In reply to Eclipse Genie from comment #10) > Gerrit change https://git.eclipse.org/r/121535 was merged to [master]. > Commit: > http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/ > ?id=235a3d96bce67e31626ffca69b9b34eaacd105d9 Released for 4.8 M7. Thank you! Verified for 4.8 M7 with build I20180509-2000 *** Bug 534471 has been marked as a duplicate of this bug. *** |