-
Bug
-
Resolution: Not an Issue
-
P3
-
7u51
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux ip-172-31-23-54 3.2.0-40-virtual #64-Ubuntu SMP Mon Mar 25 21:42:18 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Given a class C that inherits an Interface with generic parameters.
Given that C overrides an interface method M with generic parameters.
If we call getDeclaredMethods() on Class<C> instance it returns two versions os M if C has more than one method.
But if C has only the overriden method M then getDeclaredMethods returns OK.
ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Server VM (build 24.45-b08, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See source code: note that the lines printed shows "execute" twice.
If you remove "public void someMethod" then "execute" appears only once.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Class.getDeclaredMethods() should return only the declared methods.
ACTUAL -
Class.getDeclaredMethods() should return the same method twice.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.lang.reflect.Method;
public class ExpressionsTest {
interface Expression<Input, Output> {
Output execute(Input parameters);
}
class ExpressionImpl implements Expression<String, Integer> {
@Override
public Integer execute(String parameter) {
return parameter.length();
}
public void someMethod() {
}
}
public static void main(String... args) throws NoSuchMethodException, SecurityException {
for (Method method : ExpressionImpl.class.getDeclaredMethods()) {
System.out.println(method);
}
}
}
---------- END SOURCE ----------
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux ip-172-31-23-54 3.2.0-40-virtual #64-Ubuntu SMP Mon Mar 25 21:42:18 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Given a class C that inherits an Interface with generic parameters.
Given that C overrides an interface method M with generic parameters.
If we call getDeclaredMethods() on Class<C> instance it returns two versions os M if C has more than one method.
But if C has only the overriden method M then getDeclaredMethods returns OK.
ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Server VM (build 24.45-b08, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See source code: note that the lines printed shows "execute" twice.
If you remove "public void someMethod" then "execute" appears only once.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Class.getDeclaredMethods() should return only the declared methods.
ACTUAL -
Class.getDeclaredMethods() should return the same method twice.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.lang.reflect.Method;
public class ExpressionsTest {
interface Expression<Input, Output> {
Output execute(Input parameters);
}
class ExpressionImpl implements Expression<String, Integer> {
@Override
public Integer execute(String parameter) {
return parameter.length();
}
public void someMethod() {
}
}
public static void main(String... args) throws NoSuchMethodException, SecurityException {
for (Method method : ExpressionImpl.class.getDeclaredMethods()) {
System.out.println(method);
}
}
}
---------- END SOURCE ----------