/** * Reads the next {@link ObjectType} from source. * * @return The type * @throws IllegalStateException If the descriptor is invalid */ public ObjectType readObjectType() { final int start = this.current; this.advance(); while (this.hasNext() && this.peek() != ';') { this.advance(); } if (this.peek() != ';') throw new IllegalStateException("Incomplete descriptor provided!"); this.advance(); return new ObjectType(this.source.substring(start + 1, this.current - 1)); }
/** * Reads the next {@link ArrayType} from source. * * @return The type * @throws IllegalStateException If the descriptor is invalid */ public ArrayType readArrayType() { int count = 0; while (this.hasNext() && this.peek() == '[') { this.advance(); count++; } return new ArrayType(count, this.readFieldType()); }