Community
Participate
Working Groups
Using 3.1 M7 candidate: build I20050513-0010. I've 2 projects in my workspace: org.eclipse.jdt.core: HEAD or v_557 does not matter org.eclipse.jdt.apt.core: APT branch, version v_548_APT_20050512 After having built all my workspace, I got following unexpected compiler error: "The type PackageDeclarationImplNoBinding must implement the inherited abstract method Declaration.getAnnotation(Class<A>)" I've launched 3.1 M6 on this workspace and rebuild all and got no error...
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.