Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 403867 - [1.8][compiler] Suspect error about duplicate default methods
Summary: [1.8][compiler] Suspect error about duplicate default methods
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 380501
  Show dependency tree
 
Reported: 2013-03-20 04:31 EDT by Srikanth Sankaran CLA
Modified: 2013-03-26 12:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2013-03-20 04:31:34 EDT
As part of the work for upgrading our test infrastructure to use 8b81,
I had to modify org.eclipse.jdt.core.tests.compiler.regression.InterfaceMethodsTest.testSuperCall2
to be:

// ---
import java.util.*;
import java.util.stream.Stream;
public abstract class X<E> implements OrderedSet<E> {
	@Override
	public Stream<E> stream() {
		return List.super.stream(); // List is not a direct super interface
	}
	@Override
	public Stream<E> parallelStream() { return OrderedSet.super.parallelStream();}
   class Inner {
		public Stream<E> stream() {
			return OrderedSet.super.stream(); // not a super interface of the direct enclosing class
		}
	}
	@Override
	public boolean add(E o) {
		OrderedSet.super.add(o); // target not a default method
	}
	X() {
		OrderedSet.super(); // not applicable for super ctor call
	}
}
interface OrderedSet<E> extends List<E>, Set<E> {
	@Override
	boolean add(E o);
	@Override
   default Spliterator<E> spliterator() { return List.super.spliterator(); }
}
// --

This program generates 4 errors when compiled with javac 8b81.
Eclipse reports the same 4 errors, but in addition also reports againt
class X an error about there being unrelated default methods spliterator().

This is suspect since OrderedSet's implementation has replaced List and Set's
versions and these should be out of reckoning altogether.

See that there is no error reported against OrderedSet itself regarding
duplicate unrelated defaults.

Strangely, the unmodified method must have had the same issue - but we never
reported an error earlier.
Comment 1 Srikanth Sankaran CLA 2013-03-20 04:32:03 EDT
Stephan, thanks for following up.
Comment 2 Srikanth Sankaran CLA 2013-03-20 06:25:59 EDT
(In reply to comment #0)
> As part of the work for upgrading our test infrastructure to use 8b81,
> I had to modify
> org.eclipse.jdt.core.tests.compiler.regression.InterfaceMethodsTest.
> testSuperCall2

This test is disabled now - please reenable after investigation/fix. TIA.
Comment 3 Stephan Herrmann CLA 2013-03-20 10:38:22 EDT
Ack
Comment 4 Stephan Herrmann CLA 2013-03-26 12:33:35 EDT
MethodVerifier15 was being over-eager, ignoring that we already knew isOverridden[idx].
Fix is by better respecting that bit of information in two locations.
Comment 5 Stephan Herrmann CLA 2013-03-26 12:35:50 EDT
Fix has been released for BETA_JAVA8 via commit 11ebb7eac78033ed4b8b7f8bf2dae372f511166c