Community
Participate
Working Groups
4.6 M6, source: bug 489878 - create a Java project with 1.5 compiler compliance - add org.eclipse.jface from 4.6 M6 to the build path - create this class: package p; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.Viewer; public class MyArrayContentProvider extends ArrayContentProvider { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { super.inputChanged(viewer, oldInput, newInput); } } There's a compile error "The method inputChanged(Viewer, Object, Object) of type MyArrayContentProvider must override a superclass method". I don't get this compile error with Javac: C:\java\jdk8\bin\javac.exe -bootclasspath C:\java\jdk1.5.0_22\jre\lib\rt.jar -source 5 -target 5 -version -g -Xlint -cp C:\e\w\master\git\eclipse.platform.ui\bundles\org.eclipse.jface\bin -d C:\e\w\master\zz1.5\sunbin -sourcepath C:\e\w\master\zz1.5\src C:\e\w\master\zz1.5\src\p\MyArrayContentProvider.java The checks before "this.scope.problemReporter().methodMustOverride(..)" in org.eclipse.jdt.internal.compiler.ast.MethodDeclaration#resolveStatements() should accept the method if it's a default method.
It's hard to find the exact JLS as of Java 5 these days, but this seems to match: "... If a method declaration is annotated with the annotation @Override, but the method does not in fact override any method declared in a superclass, a compile-time error will occur.... Note that if a method overrides a method from a superinterface but not from a superclass, using @Override will cause a compile-time error. " Counting a default method (which doesn't exist in Java 5) as a "method declared in a superclass" sound quite far fetched, if you ask me. Note, that JLS doesn't speak of abstract vs. concrete methods, just about where it is declared. A default method is concrete but it is still declared in an interface. The error is not *wrong* by any interpretation of JLS that I can see. Why, to begin with, should we explicitly support combining source code 1.5 with 1.8 super types? To me this doesn't sound like a healthy exercise.
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.