< prev index next >
test/hotspot/jtreg/runtime/InvocationTests/invokespecial/Checker.java
Print this page
*** 32,51 ****
public Checker(Class staticTargetClass, Class dynamicTargetClass) {
super(staticTargetClass, dynamicTargetClass);
}
public String check (Class callerClass) {
! /*
! * If objectref is null, the invokespecial instruction throws a NullPointerException.
! */
if (dynamicTargetClass == null) {
return "java.lang.NullPointerException";
}
! /*
! * TODO: find a citiation from spec for this case
! */
Method resolvedMethod;
try {
// May throw VerifyError
resolvedMethod = getMethodInHierarchy(staticTargetClass);
} catch (Throwable e) {
--- 32,47 ----
public Checker(Class staticTargetClass, Class dynamicTargetClass) {
super(staticTargetClass, dynamicTargetClass);
}
public String check (Class callerClass) {
! // If objectref is null, the invokespecial instruction throws a NullPointerException.
if (dynamicTargetClass == null) {
return "java.lang.NullPointerException";
}
! // TODO: find a citation from spec for this case
Method resolvedMethod;
try {
// May throw VerifyError
resolvedMethod = getMethodInHierarchy(staticTargetClass);
} catch (Throwable e) {
*** 54,72 ****
if (resolvedMethod == null) {
return "java.lang.NoSuchMethodError";
}
! /*
! * If:
! * - the resolved method is protected (4.7)
! * - it is a member of a superclass of the current class
! * - the method is not declared in the same run-time package (5.3) as the current class
! * then:
! * the class of objectref must be either the current class or a subclass of the
! * current class.
! */
if (Modifier.isProtected(resolvedMethod.getModifiers())) {
Method methodInSuperclass = getMethodInHierarchy(resolvedMethod.getDeclaringClass().getSuperclass());
if (methodInSuperclass != null) {
--- 50,66 ----
if (resolvedMethod == null) {
return "java.lang.NoSuchMethodError";
}
! // If:
! // - the resolved method is protected (4.7)
! // - it is a member of a superclass of the current class
! // - the method is not declared in the same run-time package (5.3) as the current class
! // then:
! // the class of objectref must be either the current class or a subclass of the
! // current class.
if (Modifier.isProtected(resolvedMethod.getModifiers())) {
Method methodInSuperclass = getMethodInHierarchy(resolvedMethod.getDeclaringClass().getSuperclass());
if (methodInSuperclass != null) {
< prev index next >