/** * Reads the next {@link PrimitiveType} from source. * * @return The type * @throws IllegalStateException If the descriptor is invalid */ public PrimitiveType readPrimitiveType() { // Void Type if (this.peek() == 'V') { this.advance(); return VoidType.INSTANCE; } // Base Type if (BaseType.isValidBase(this.peek())) { return this.readBaseType(); } throw new IllegalStateException("Invalid descriptor provided!"); }
/** * Reads the next {@link FieldType} from source. * * @return The type * @throws IllegalStateException If the descriptor is invalid */ public FieldType readFieldType() { // Array Type if (this.peek() == '[') { return this.readArrayType(); } // Base Type if (BaseType.isValidBase(this.peek())) { return this.readBaseType(); } // Object Type if (this.peek() == 'L') { return this.readObjectType(); } throw new IllegalStateException("Invalid descriptor provided!"); }