3030import org .eclipse .jdt .core .dom .AbstractTypeDeclaration ;
3131import org .eclipse .jdt .core .dom .AnonymousClassDeclaration ;
3232import org .eclipse .jdt .core .dom .Assignment ;
33- import org .eclipse .jdt .core .dom .EnumDeclaration ;
3433import org .eclipse .jdt .core .dom .Expression ;
3534import org .eclipse .jdt .core .dom .FieldAccess ;
3635import org .eclipse .jdt .core .dom .IBinding ;
4342import org .eclipse .jdt .core .dom .QualifiedName ;
4443import org .eclipse .jdt .core .dom .SimpleName ;
4544import org .eclipse .jdt .core .dom .SuperFieldAccess ;
46- import org .eclipse .jdt .internal .compiler .lookup .TypeBinding ;
4745
4846public class Bindings {
4947
@@ -223,6 +221,8 @@ public static String getTypeQualifiedName(ITypeBinding type) {
223221 */
224222 public static String getFullyQualifiedName (ITypeBinding type ) {
225223 String name = type .getQualifiedName ();
224+ // TODO: ?
225+ // return removeBrackets(name);
226226 final int index = name .indexOf ('<' );
227227 if (index > 0 )
228228 name = name .substring (0 , index );
@@ -930,10 +930,14 @@ public static boolean isEqualMethod(IMethodBinding method, String methodName, St
930930 int index ;
931931 for (int i = 0 ; i < parameters .length ; i ++) {
932932 first = parameters [i ];
933+ // TODO: ?
934+ // first = removeBrackets(first);
933935 index = first .indexOf ('<' );
934936 if (index > 0 )
935937 first = first .substring (0 , index );
936938 second = methodParameters [i ].getErasure ().getQualifiedName ();
939+ // TODO: ?
940+ // second = removeBrackets(second);
937941 index = second .indexOf ('<' );
938942 if (index > 0 )
939943 second = second .substring (0 , index );
@@ -1125,6 +1129,7 @@ private static boolean sameParameter(ITypeBinding type, String candidate, IType
11251129 return false ;
11261130 }
11271131
1132+ /*
11281133 private static boolean isPrimitiveType(String s) {
11291134 return Signature.getTypeSignatureKind(s) == Signature.BASE_TYPE_SIGNATURE;
11301135 }
@@ -1133,6 +1138,7 @@ private static boolean isResolvedType(String s) {
11331138 int arrayCount= Signature.getArrayCount(s);
11341139 return s.charAt(arrayCount) == Signature.C_RESOLVED;
11351140 }
1141+ */
11361142
11371143 /**
11381144 * Normalizes a type binding received from an expression to a type binding that can be used in a declaration signature.
@@ -1208,6 +1214,8 @@ public static ITypeBinding getBindingOfParentType(ASTNode node) {
12081214 public static String getRawName (ITypeBinding binding ) {
12091215 String name = binding .getName ();
12101216 if (binding .isParameterizedType () || binding .isGenericType ()) {
1217+ // TODO: ?
1218+ // return removeBrackets(name);
12111219 int idx = name .indexOf ('<' );
12121220 if (idx != -1 ) {
12131221 return name .substring (0 , idx );
@@ -1419,4 +1427,23 @@ public static boolean isMethodInvoking(Expression exp, String className, String
14191427 }
14201428 return false ;
14211429 }
1430+
1431+ public static String removeBrackets (String qName ) {
1432+ int length = qName .length ();
1433+ StringBuffer buf = new StringBuffer ();
1434+ int ltCount = 0 ;
1435+ for (int i = 0 ; i < length ; i ++) {
1436+ char c = qName .charAt (i );
1437+ if (c == '<' ) {
1438+ ltCount ++;
1439+ } else if (c == '>' ) {
1440+ ltCount --;
1441+ }
1442+ if (ltCount == 0 && c != '>' ) {
1443+ buf .append (c );
1444+ }
1445+ }
1446+ qName = buf .toString ().trim ();
1447+ return qName ;
1448+ }
14221449}
0 commit comments