< prev index next >
src/java.base/share/classes/java/lang/reflect/Method.java
Print this page
@@ -35,10 +35,11 @@
import sun.reflect.annotation.AnnotationType;
import sun.reflect.annotation.AnnotationParser;
import java.lang.annotation.Annotation;
import java.lang.annotation.AnnotationFormatError;
import java.nio.ByteBuffer;
+import java.util.Arrays;
/**
* A {@code Method} provides information about, and access to, a single method
* on a class or interface. The reflected method may be a class method
* or an instance method (including an abstract method).
@@ -176,10 +177,31 @@
byte[] getAnnotationBytes() {
return annotations;
}
/**
+ * Used by java.lang.MethodTable to optimize comparing/locating
+ * method signatures.
+ */
+ boolean parameterTypesEquals(Method other) {
+ int len = parameterTypes.length;
+ if (len != other.parameterTypes.length) {
+ return false;
+ }
+ for (int i = 0; i < len; i++) {
+ if (parameterTypes[i] != other.parameterTypes[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ int parameterTypesHashCode() {
+ return Arrays.hashCode(parameterTypes);
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
public Class<?> getDeclaringClass() {
return clazz;
< prev index next >