Reputation: 14373
With the following simple class I get java: Duplicate methods named spliterator with the parameters () and () are inherited from the types java.util.List<T> and java.lang.Iterable<T>
error if using Eclipse compiler in IDEA with JDK 8:
public class Java8Test {
public static interface Traverable<T> extends Iterable<T> {}
public static interface List<T> extends Traverable<T>, java.util.List<T> {}
}
If change the compiler to javac, then there is no error. The error also gone if switched to JDK 6 with eclipse compiler.
IDEA version: 12.1.5
Upvotes: 8
Views: 11067
Reputation: 2810
I got the same error when trying to compile Java 7 code with a Java 8 JDK.
The solution that worked for me was changing the JRE configured in Eclipse to a Java 7 one: Window -> Preferences -> Java -> Installed JREs
. Edit the existing one and select a directory containing a Java 7 JDK.
Upvotes: 5
Reputation: 3344
I had the same issue. It seem that Eclipse's 4.3 JTD is not carrying on well with Java8. On the words of Stephan Herrmann (CLA):
A Java 7 compiler should never try to compile against a JRE 8. True compatibility for the scenario is not specified anywhere and may not even be possible because of default methods that have been added to the libraries in a way that ensures runtime compatibility of old code but not compile time compatibility with a Java 7 compiler and new libraries. Hence I'm marking this bug as invalid, it's s.t. we cannot support by design.
You may read more in here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=407010
and here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409473
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390889
Upvotes: 0