-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
8, 11, 13
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
my code is follow:
public interface IFly {
String fly1();
Object fly2();
}
public class FlyImpl implements IFly {
@Override
@FlyEnable
public String fly1() {
return null;
}
@Override
@FlyEnable
public String fly2() {
return null;
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
public @interface FlyEnable {
}
public class Main {
public static void main(String[] args) {
//out 3, but i want 2
//com.zj.IFly.fly2 should not be count
System.out.println(FlyImpl.class.getDeclaredMethods().length);
//is this is a bug? if this is not a bug, what should i do, then it out 2.
for(Method method: FlyImpl.class.getDeclaredMethods()){
if( method.isAnnotationPresent( FlyEnable.class)){
// this out 3 times, but i want 2
// com.zj.IFly.fly2 call isAnnotationPresent( FlyEnable.class) should not return true
System.out.println("method:" + method.getName() + " is annotated by FlyEnable");
//is this is a bug? if this is not a bug, what should i do, com.zj.IFly.fly2 call isAnnotationPresent( FlyEnable.class) return false
}
}
}
}
i'm not good at English,
If I say something wrong, don't be angry.
REGRESSION : Last worked in version 8u202
FREQUENCY : always
my code is follow:
public interface IFly {
String fly1();
Object fly2();
}
public class FlyImpl implements IFly {
@Override
@FlyEnable
public String fly1() {
return null;
}
@Override
@FlyEnable
public String fly2() {
return null;
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
public @interface FlyEnable {
}
public class Main {
public static void main(String[] args) {
//out 3, but i want 2
//com.zj.IFly.fly2 should not be count
System.out.println(FlyImpl.class.getDeclaredMethods().length);
//is this is a bug? if this is not a bug, what should i do, then it out 2.
for(Method method: FlyImpl.class.getDeclaredMethods()){
if( method.isAnnotationPresent( FlyEnable.class)){
// this out 3 times, but i want 2
// com.zj.IFly.fly2 call isAnnotationPresent( FlyEnable.class) should not return true
System.out.println("method:" + method.getName() + " is annotated by FlyEnable");
//is this is a bug? if this is not a bug, what should i do, com.zj.IFly.fly2 call isAnnotationPresent( FlyEnable.class) return false
}
}
}
}
i'm not good at English,
If I say something wrong, don't be angry.
REGRESSION : Last worked in version 8u202
FREQUENCY : always
- relates to
-
JDK-6695379 Copy method annotations and parameter annotations to synthetic bridge methods
- Closed