diff --git a/core/src/main/java/org/jboss/jandex/ClassInfo.java b/core/src/main/java/org/jboss/jandex/ClassInfo.java
index 119d5b53..bcd8dc72 100644
--- a/core/src/main/java/org/jboss/jandex/ClassInfo.java
+++ b/core/src/main/java/org/jboss/jandex/ClassInfo.java
@@ -745,8 +745,8 @@ final byte[] methodPositionArray() {
* inherited methods. These must be discovered by traversing the class hierarchy.
*
* @param name the name of the method to find
- * @param parameters the type parameters of the method
- * @return the located method or null if not found
+ * @param parameters the parameter types of the method
+ * @return the located method or {@code null} if not found
*/
public final MethodInfo method(String name, Type... parameters) {
MethodInternal key = new MethodInternal(Utils.toUTF8(name), MethodInternal.EMPTY_PARAMETER_NAMES, parameters, null,
@@ -755,6 +755,24 @@ public final MethodInfo method(String name, Type... parameters) {
return i >= 0 ? new MethodInfo(this, methods[i]) : null;
}
+ /**
+ * Retrieves a method based on its signature, which includes a method name and a parameter type list.
+ * The parameter type list is compared based on the underlying raw types. As an example,
+ * a generic type parameter {@code T} is considered equal to {@code java.lang.Object}, since the raw form
+ * of a type variable is its upper bound.
+ *
+ * Eligible methods include constructors and static initializer blocks which have the special
+ * names of {@code } and {@code }, respectively. This does not, however, include
+ * inherited methods. These must be discovered by traversing the class hierarchy.
+ *
+ * @param name the name of the method to find
+ * @param parameters the parameter types of the method
+ * @return the located method or {@code null} if not found
+ */
+ public final MethodInfo method(String name, List parameters) {
+ return method(name, parameters.toArray(Type.EMPTY_ARRAY));
+ }
+
/**
* Retrieves the "first" occurrence of a method by the given name. Note that the order of methods
* is not defined, and may change in the future. Therefore, this method should not be used when
diff --git a/core/src/test/java/org/jboss/jandex/test/BasicTestCase.java b/core/src/test/java/org/jboss/jandex/test/BasicTestCase.java
index abb174cf..aa7018f1 100644
--- a/core/src/test/java/org/jboss/jandex/test/BasicTestCase.java
+++ b/core/src/test/java/org/jboss/jandex/test/BasicTestCase.java
@@ -51,6 +51,7 @@
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -60,6 +61,7 @@
import org.jboss.jandex.AnnotationTarget.Kind;
import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.ClassType;
import org.jboss.jandex.DotName;
import org.jboss.jandex.Index;
import org.jboss.jandex.IndexReader;
@@ -635,6 +637,10 @@ private void verifyDummy(Index index, boolean v2features) {
assertEquals("y", method.parameterName(1));
assertEquals("foo", method.parameterName(2));
+ MethodInfo method2 = clazz.method("doSomething", Arrays.asList(PrimitiveType.INT, PrimitiveType.LONG,
+ ClassType.create("java.lang.String")));
+ assertEquals(method, method2);
+
ClassInfo nested = index.getClassByName(DotName.createSimple(DummyClass.Nested.class.getName()));
assertNotNull(nested);
MethodInfo nestedConstructor1 = nested.method("", PrimitiveType.INT);