private boolean containsGenerics(String aWord) { return containsGenerics(aWord, 0); }
private boolean containsGenerics(String aWord) { return containsGenerics(aWord, 0); }
private boolean containsGenerics(String aWord) { return containsGenerics(aWord, 0); }
/** * Returns whether the given word contains angle brackets around * a non-digit string. */ private boolean containsGenerics(String aWord, int startIndex) { int openIndex = aWord.indexOf('<', startIndex); if (openIndex < 0) { return false; } int closeIndex = aWord.indexOf('>', startIndex + openIndex + 1); if (closeIndex < 0) { return false; } try { Integer.parseInt(aWord.substring(openIndex + 1, closeIndex)); } catch (NumberFormatException e) { return true; } return containsGenerics(aWord,closeIndex); }
/** * Returns whether the given word contains angle brackets around * a non-digit string. */ private boolean containsGenerics(String aWord, int startIndex) { int openIndex = aWord.indexOf('<', startIndex); if (openIndex < 0) { return false; } int closeIndex = aWord.indexOf('>', startIndex + openIndex + 1); if (closeIndex < 0) { return false; } try { Integer.parseInt(aWord.substring(openIndex + 1, closeIndex)); } catch (NumberFormatException e) { return true; } return containsGenerics(aWord,closeIndex); }
/** * Returns whether the given word contains angle brackets around * a non-digit string. */ private boolean containsGenerics(String aWord, int startIndex) { int openIndex = aWord.indexOf('<', startIndex); if (openIndex < 0) { return false; } int closeIndex = aWord.indexOf('>', startIndex + openIndex + 1); if (closeIndex < 0) { return false; } try { Integer.parseInt(aWord.substring(openIndex + 1, closeIndex)); } catch (NumberFormatException e) { return true; } return containsGenerics(aWord,closeIndex); }
/** * Checks whether the given word is a valid Java identifier and throws * a ParseException if it isn't. Wildcard characters are accepted. */ private void checkJavaIdentifier(String expectedDescription, boolean allowGenerics) throws ParseException { if (!isJavaIdentifier(nextWord)) { throw new ParseException("Expecting " + expectedDescription + " before " + reader.locationDescription()); } if (!allowGenerics && containsGenerics(nextWord)) { throw new ParseException("Use of generics not allowed for " + expectedDescription + " at " + reader.locationDescription()); } }
/** * Checks whether the given word is a valid Java identifier and throws * a ParseException if it isn't. Wildcard characters are accepted. */ private void checkJavaIdentifier(String expectedDescription, boolean allowGenerics) throws ParseException { if (!isJavaIdentifier(nextWord)) { throw new ParseException("Expecting " + expectedDescription + " before " + reader.locationDescription()); } if (!allowGenerics && containsGenerics(nextWord)) { throw new ParseException("Use of generics not allowed for " + expectedDescription + " at " + reader.locationDescription()); } }
/** * Checks whether the given word is a valid Java identifier and throws * a ParseException if it isn't. Wildcard characters are accepted. */ private void checkJavaIdentifier(String expectedDescription, boolean allowGenerics) throws ParseException { if (!isJavaIdentifier(nextWord)) { throw new ParseException("Expecting " + expectedDescription + " before " + reader.locationDescription()); } if (!allowGenerics && containsGenerics(nextWord)) { throw new ParseException("Use of generics not allowed for " + expectedDescription + " at " + reader.locationDescription()); } }