| Summary: | [1.8][compiler] Wrong "Duplicate default methods" error on AbstractDoubleSpliterator | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | critical | ||
| Priority: | P3 | CC: | jarthana, srikanth_sankaran |
| Version: | 4.4 | ||
| Target Milestone: | BETA J8 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 427787 | ||
I'm not blocked by this bug. Disabled tests released here. Stephan, I heard from Jay that he is seeing in quite a few files in the effort to build JRE8 using ECJ. Thanks for taking a look. in MV15.checkInheritedMethods, indices appear misaligned at first sight. (In reply to Srikanth Sankaran from comment #2) > Disabled tests released here. Here: org.eclipse.jdt.core.tests.compiler.regression.InterfaceMethodsTest._test427478() (In reply to Srikanth Sankaran from comment #2) > in MV15.checkInheritedMethods, indices appear misaligned at first sight. checkInheritedMethods(MethodBinding[] methods, int length, boolean[] isOverridden, boolean[] isInherited) isOverridden and isInherited - indices seem to relative to original array of inherited methods. methods [] - a subset of matching methods collected into a fresh array. Indices will not always match. One possible solution is to identically aligned arrays that contain null entries which need to be skipped over. Now therefore, thus sayeth the Lord: The path of the righteous code is beset on all sides by the misalignment of the arrays and the tyranny of incorrect index variables. Blessed is the method, who in the name of correctness and good practice, shepherds the contracts through the valley of verification, for he is truly his correctness's keeper and the finder of lost inheritance. :) Fix and tests released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=c9c353b1f3633c7934ab02e6b5f4d6f7b6d921d9 (In reply to Srikanth Sankaran from comment #5) > Now therefore, thus sayeth the Lord: The path of the righteous code is beset > on > all sides by the misalignment of the arrays and the tyranny of incorrect > index > variables. Blessed is the method, who in the name of correctness and good > practice, shepherds the contracts through the valley of verification, for he > is > truly his correctness's keeper and the finder of lost inheritance. :-) Verified for Java 8 RC1 using Kepler SR2 + Eclipse Java Development Tools Patch for Java 8 Support (BETA) 1.0.0.v20140220-2054 |
When trying to compile rt.jar of Java 8 with ecj, I'm getting a compile error in java.util.Spliterators.AbstractDoubleSpliterator. I've extracted the problem into a self-contained example below. I think the compile error is wrong because interface OfDouble already overrides the method Spliterator#forEachRemaining(Consumer<? super T>) with a concrete variant OfDouble#forEachRemaining(Consumer<? super Double>), so the former method should not be considered any more when AbstractDoubleSpliterator is compiled. ===================================================================== package split2; import java.util.function.Consumer; import java.util.function.DoubleConsumer; public interface Spliterator<T> { default void forEachRemaining(Consumer<? super T> action) { } public interface OfPrimitive<T, T_CONS, T_SPLITR extends OfPrimitive<T, T_CONS, T_SPLITR>> extends Spliterator<T> { // overloads Spliterator#forEachRemaining(Consumer<? super T>) default void forEachRemaining(T_CONS action) { } } public interface OfDouble extends OfPrimitive<Double, DoubleConsumer, OfDouble> { @Override // the method from Spliterator default void forEachRemaining(Consumer<? super Double> action) { } @Override // the method from OfPrimitive default void forEachRemaining(DoubleConsumer action) { } } } class Spliterators { /* Error on class: Duplicate default methods named forEachRemaining with * the parameters (Consumer<? super Double>) and (Consumer<? super T>) are * inherited from the types Spliterator.OfDouble and Spliterator<Double> */ public abstract static class AbstractDoubleSpliterator implements Spliterator.OfDouble { /* Implementation that prevents the compile error: */ // @Override // the method from Spliterator // public void forEachRemaining(Consumer<? super Double> action) { // } } } =====================================================================