Index: Util.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java,v retrieving revision 1.45 diff -u -r1.45 Util.java --- Util.java 20 Jan 2005 15:48:26 -0000 1.45 +++ Util.java 21 Jan 2005 17:02:55 -0000 @@ -2111,6 +2111,10 @@ case Signature.C_SHORT : case Signature.C_VOID : return scanBaseTypeSignature(string, start); + case Signature.C_EXTENDS: + case Signature.C_SUPER: + case Signature.C_STAR: + return scanTypeBoundSignature(string, start); default : throw new IllegalArgumentException(); } @@ -2200,6 +2204,50 @@ return id + 1; } else { throw new IllegalArgumentException(); + } + } + + /** + * Scans the given string for a type bound signature starting at the given + * index and returns the index of the last character. + *
+	 * TypeBoundSignature:
+	 *     [-+] TypeSignature ;
+	 *     *
+	 * 
+ * + * @param string the signature string + * @param start the 0-based character index of the first character + * @return the 0-based character index of the last character + * @exception IllegalArgumentException if this is not a type variable signature + */ + public static int scanTypeBoundSignature(char[] string, int start) { + // need a minimum 1 char for wildcard + if (start >= string.length) { + throw new IllegalArgumentException(); + } + char c = string[start]; + if (c == Signature.C_STAR) { //$NON-NLS-1$ + return start; + } + + // need a minimum 4 chars "+Lx;" + if (start >= string.length - 3) { + throw new IllegalArgumentException(); + } + // must start in "+/-" + if (c != Signature.C_SUPER && c != Signature.C_EXTENDS) { + throw new IllegalArgumentException(); + } + c = string[start + 1]; + switch (c) { + case Signature.C_RESOLVED : + case Signature.C_UNRESOLVED : + return scanClassTypeSignature(string, start + 1); + case Signature.C_TYPE_VARIABLE : + return scanTypeVariableSignature(string, start + 1); + default: + throw new IllegalArgumentException(); } }