View | Details | Raw Unified | Return to bug 83383
Collapse All | Expand All

(-)Util.java (+48 lines)
Lines 2111-2116 Link Here
2111
			case Signature.C_SHORT :
2111
			case Signature.C_SHORT :
2112
			case Signature.C_VOID :
2112
			case Signature.C_VOID :
2113
				return scanBaseTypeSignature(string, start);
2113
				return scanBaseTypeSignature(string, start);
2114
			case Signature.C_EXTENDS:
2115
			case Signature.C_SUPER:
2116
			case Signature.C_STAR:
2117
				return scanTypeBoundSignature(string, start);
2114
			default :
2118
			default :
2115
				throw new IllegalArgumentException();
2119
				throw new IllegalArgumentException();
2116
		}
2120
		}
Lines 2200-2205 Link Here
2200
			return id + 1;
2204
			return id + 1;
2201
		} else {
2205
		} else {
2202
			throw new IllegalArgumentException();
2206
			throw new IllegalArgumentException();
2207
		}
2208
	}
2209
2210
	/**
2211
	 * Scans the given string for a type bound signature starting at the given
2212
	 * index and returns the index of the last character.
2213
	 * <pre>
2214
	 * TypeBoundSignature:
2215
	 *     <b>[-+]</b> TypeSignature <b>;</b>
2216
	 *     <b>*</b></b>
2217
	 * </pre>
2218
	 * 
2219
	 * @param string the signature string
2220
	 * @param start the 0-based character index of the first character
2221
	 * @return the 0-based character index of the last character
2222
	 * @exception IllegalArgumentException if this is not a type variable signature
2223
	 */
2224
	public static int scanTypeBoundSignature(char[] string, int start) {
2225
		// need a minimum 1 char for wildcard
2226
		if (start >= string.length) {
2227
			throw new IllegalArgumentException();
2228
		}
2229
		char c = string[start];
2230
		if (c == Signature.C_STAR) { //$NON-NLS-1$
2231
			return start;
2232
		}
2233
2234
		// need a minimum 4 chars "+Lx;"
2235
		if (start >= string.length - 3) { 
2236
			throw new IllegalArgumentException();
2237
		}
2238
		// must start in "+/-"
2239
		if (c != Signature.C_SUPER && c != Signature.C_EXTENDS) {
2240
			throw new IllegalArgumentException();
2241
		}
2242
		c = string[start + 1];
2243
		switch (c) {
2244
			case Signature.C_RESOLVED :
2245
			case Signature.C_UNRESOLVED :
2246
				return scanClassTypeSignature(string, start + 1);
2247
			case Signature.C_TYPE_VARIABLE :
2248
				return scanTypeVariableSignature(string, start + 1);
2249
			default:
2250
				throw new IllegalArgumentException();
2203
		}
2251
		}
2204
	}
2252
	}
2205
2253

Return to bug 83383