Source:
public static boolean matches(String type, String type2) { if (Signature.getArrayCount(type) != Signature.getArrayCount(type2)) { return false; } String el1 = Signature.getElementType(type); String el2 = Signature.getElementType(type2); if (Signature.getTypeSignatureKind(el1) == Signature.TYPE_VARIABLE_SIGNATURE || Signature.getTypeSignatureKind(el2) == Signature.TYPE_VARIABLE_SIGNATURE) { return el1.substring(1).equals(el2.substring(1)); } else if (Signature.getTypeSignatureKind(el1) != Signature.getTypeSignatureKind(el2)) { return false; } if (Signature.getTypeSignatureKind(el1) == Signature.WILDCARD_TYPE_SIGNATURE) { if (el1.charAt(0) != el2.charAt(0)) { return false; } else if (el1.charAt(0) == Signature.C_STAR) { return el1.length() == 1 && el2.length() == 1; } END/C_SUPER el1 = el1.substring(1); el2 = el2.substring(1); } if (Signature.getTypeSignatureKind(el1) != Signature.BASE_TYPE_SIGNATURE && Signature.getTypeSignatureKind(el1) != Signature.CLASS_TYPE_SIGNATURE) { System.err.println("Signatures#matches: Unhandled signature kind: " + el1); return false; } String[] typeargs1 = Signature.getTypeArguments(el1); String[] typeargs2 = Signature.getTypeArguments(el2); if (typeargs1.length != typeargs2.length) { return false; } String erased1 = Signature.getTypeErasure(el1); String erased2 = Signature.getTypeErasure(el2); if (el1.charAt(0) != Signature.C_UNRESOLVED && el2.charAt(0) != Signature.C_UNRESOLVED) { if (!erased1.equals(erased2)) { return false; } } else { String signatureSimpleName = Signature.getSimpleName(Signature.getSignatureSimpleName(erased1)); String signatureSimpleName2 = Signature.getSimpleName(Signature.getSignatureSimpleName(erased2)); if (!signatureSimpleName.equals(signatureSimpleName2)) { return false; } } for (int i = 0; i < typeargs1.length; i++) { if (!matches(typeargs1[i], typeargs2[i])) { return false; } } return true; }

Target:
public static boolean matches(String type, String type2) { if (Signature.getArrayCount(type) != Signature.getArrayCount(type2)) { return false; } String el1 = Signature.getElementType(type); String el2 = Signature.getElementType(type2); if (Signature.getTypeSignatureKind(el1) == Signature.TYPE_VARIABLE_SIGNATURE || Signature.getTypeSignatureKind(el2) == Signature.TYPE_VARIABLE_SIGNATURE) { return el1.substring(1).equals(el2.substring(1)); } else if (Signature.getTypeSignatureKind(el1) != Signature.getTypeSignatureKind(el2)) { return false; } if (Signature.getTypeSignatureKind(el1) == Signature.WILDCARD_TYPE_SIGNATURE) { if (el1.charAt(0) != el2.charAt(0)) { return false; } else if (el1.charAt(0) == Signature.C_STAR) { return el1.length() == 1 && el2.length() == 1; } END/C_SUPER el1 = el1.substring(1); el2 = el2.substring(1); } if (Signature.getTypeSignatureKind(el1) != Signature.BASE_TYPE_SIGNATURE && Signature.getTypeSignatureKind(el1) != Signature.CLASS_TYPE_SIGNATURE) { ApiPlugin.logErrorMessage("Signatures#matches: Unhandled signature kind: " + el1); return false; } String[] typeargs1 = Signature.getTypeArguments(el1); String[] typeargs2 = Signature.getTypeArguments(el2); if (typeargs1.length != typeargs2.length) { return false; } String erased1 = Signature.getTypeErasure(el1); String erased2 = Signature.getTypeErasure(el2); if (el1.charAt(0) != Signature.C_UNRESOLVED && el2.charAt(0) != Signature.C_UNRESOLVED) { if (!erased1.equals(erased2)) { return false; } } else { String signatureSimpleName = Signature.getSimpleName(Signature.getSignatureSimpleName(erased1)); String signatureSimpleName2 = Signature.getSimpleName(Signature.getSignatureSimpleName(erased2)); if (!signatureSimpleName.equals(signatureSimpleName2)) { return false; } } for (int i = 0; i < typeargs1.length; i++) { if (!matches(typeargs1[i], typeargs2[i])) { return false; } } return true; }