Summary: | [1.5][compiler] Unexpected compiler error: type must implement inherited abstract method | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Frederic Fusier <frederic_fusier> |
Component: | Core | Assignee: | Kent Johnson <kent_johnson> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | philippe_mulet |
Version: | 3.1 | ||
Target Milestone: | 3.1 RC2 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Frederic Fusier
2005-05-13 07:10:34 EDT
Kent, talking with philippe, it seems to comes from MethodVerifier... I tried to reproduce this problem with a simple test case but without any success: Test.java: package jdt.core; import java.lang.annotation.Annotation; import sun.mirror.PackageDeclaration; public class Test implements PackageDeclaration { public <A extends Object & Annotation> A getAnnotation(Class<A> arg0) { return null; } } Declaration.java: package sun.mirror; import java.lang.annotation.Annotation; public interface Declaration { public <A extends Object & Annotation> A getAnnotation(Class<A> arg0); } PackageDeclaration.java package sun.mirror; public interface PackageDeclaration extends Declaration {} ...compiles with no error both with 3.1 M6 and 3.1 M7... What does this mean? org.eclipse.jdt.apt.core: APT branch, version v_548_APT_20050512 I can only see 2 versions of org.eclipse.jdt.apt.core 0421 & 0414 My fault, I mixed projects... You should read: org.eclipse.jdt.apt.core: HEAD org.eclipse.jdt.core: APT branch, version v_548_APT_20050512 However, org.eclipse.jdt.apt.core HEAD has been changed since 05/12 and this error has now disappeared... So, to reproduce, you need to have in your workspace: org.eclipse.jdt.apt.core: Date 2005/05/12 (time does not matter) org.eclipse.jdt.core: APT branch, version v_548_APT_20050512 Sorry for the confusion Reproduced with the following test case (must add tools.jar to classpath): import java.lang.annotation.Annotation; import java.util.*; import com.sun.mirror.declaration.*; import com.sun.mirror.util.*; class X implements PackageDeclaration { public <A extends Object & Annotation> A getAnnotation(Class<A> arg0) { return null; } public String getQualifiedName() {return null;} public Collection<ClassDeclaration> getClasses() {return null;} public Collection<EnumDeclaration> getEnums() {return null;} public Collection<InterfaceDeclaration> getInterfaces() {return null;} public Collection<AnnotationTypeDeclaration> getAnnotationTypes() { return null; } public String getDocComment() {return null;} public Collection<AnnotationMirror> getAnnotationMirrors() {return null;} public Collection<Modifier> getModifiers() {return null;} public String getSimpleName() {return null;} public SourcePosition getPosition() {return null;} public void accept(final DeclarationVisitor visitor) {} } javac detects the same error as we do: javac -classpath tools.jar X.java X.java:7: X is not abstract and does not override abstract method <A>getAnnotation(java.lang.Class<A>) in com.sun.mirror.declaration.Declaration class X implements PackageDeclaration { ^ 1 error You cannot override an inherited method while adding additional bounds even if its Object. |