return getTypeName(signature.substring(1)) + "[]";
}
+ // If it does not contain '<' and '>' then it is
+ // a Type signature, e.g., T, U, etc.
+ if (Types.isParameterWithType(signature)) {
+ // Clean the ';' character first and return the Type
+ return Types.getTypeParameter(signature.replace(";", ""));
+ }
+
int len1 = len-1;
if (signature.charAt(len1) == ';') {
// TODO: Fix for Groovy's model-checking
return 1 + getTypeLength(signature, idx + 1);
case 'L':
-
+ default:
int semicolon = signature.indexOf(';', idx);
// TODO: Fix for Groovy's model-checking
// Check if this is a generic!
return semicolon - idx + 1;
}
- throw new JPFException("invalid type signature");
+ //throw new JPFException("invalid type signature");
}
/**
return arrTypeVarNames;
}
- // TODO: Fix for Groovy's model-checking
public static String[] getParameterizedTypes(String signature) {
int pos = signature.indexOf('<', 0);
if (pos == -1)
public static boolean isTypeParameter(String parameterizedType, String signature) {
if (signature == null || signature.equals(""))
return false;
+ // The comparison has to be done without the "[]" part if it is an array
+ if (Types.isArraySignature(parameterizedType)) {
+ parameterizedType = Types.getArrayClassName(parameterizedType);
+ }
String typeParamSig = parameterizedType.concat(":");
return signature.contains(typeParamSig);
}
return signature.replaceAll("\\+L|-L", "");
}
+ public static boolean isParameterWithType(String signature) {
+ // Does not contain a class name
+ if (signature.charAt(0) != 'L' && !signature.contains(".") && !signature.contains("/")) {
+ return true;
+ }
+ return false;
+ }
+
public static String getTypeParameter(String signature) {
if (signature == null || signature.equals(""))
return signature;
}
String cleanSig = signature.replaceAll("\\+|-", "");
- // This kind of signature should be a repetition of its class' type parameter, e.g., TT for Class<T>
if (cleanSig.length()%2 != 0) {
// This is probably a class, e.g., +java.lang.Class
return signature;