X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=blobdiff_plain;f=src%2Fmain%2Fgov%2Fnasa%2Fjpf%2Fvm%2FTypes.java;h=30efa1fe872d11b15957bf79763e0bde5526f8ef;hp=313e8aab7d0fb0f01027262c8ea64abc1ea0fe91;hb=44ae66df31d1ad4f0d390e982e5a4b7a5672e8c0;hpb=8407476b0dce3b2c1d1a5093d55df109aa7f9789 diff --git a/src/main/gov/nasa/jpf/vm/Types.java b/src/main/gov/nasa/jpf/vm/Types.java index 313e8aa..30efa1f 100644 --- a/src/main/gov/nasa/jpf/vm/Types.java +++ b/src/main/gov/nasa/jpf/vm/Types.java @@ -912,6 +912,13 @@ public class Types { 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 @@ -1105,7 +1112,7 @@ public class Types { 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! @@ -1132,7 +1139,7 @@ public class Types { return semicolon - idx + 1; } - throw new JPFException("invalid type signature"); + //throw new JPFException("invalid type signature"); } /** @@ -1282,6 +1289,10 @@ public class Types { 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); } @@ -1301,6 +1312,14 @@ public class Types { return signature.replaceAll("\\+L|-L", ""); } + public static boolean isParameterWithType(String signature) { + // Does not contain a class name + if (!signature.contains(".") && !signature.contains("/")) { + return true; + } + return false; + } + public static String getTypeParameter(String signature) { if (signature == null || signature.equals("")) return signature;