Type parseTypeSignature() { switch (symbol) { case 'B': scanSymbol(); return byte.class; case 'C': scanSymbol(); return char.class; case 'D': scanSymbol(); return double.class; case 'F': scanSymbol(); return float.class; case 'I': scanSymbol(); return int.class; case 'J': scanSymbol(); return long.class; case 'S': scanSymbol(); return short.class; case 'Z': scanSymbol(); return boolean.class; default: // Not an elementary type, but a FieldTypeSignature. return parseFieldTypeSignature(); } }
void setInput(GenericDeclaration genericDecl, String input) { if (input != null) { this.genericDecl = genericDecl; this.buffer = input.toCharArray(); this.eof = false; scanSymbol(); } else { this.eof = true; } }
Type parseReturnType() { // ReturnType ::= TypeSignature | "V". if (symbol != 'V') { return parseTypeSignature(); } else { scanSymbol(); return void.class; } }
void expect(char c) { if (symbol == c) { scanSymbol(); } else { throw new GenericSignatureFormatError(); } }
} else { identifier = identBuf.toString(); scanSymbol(); return;
Type parseClassTypeSignature() { // ClassTypeSignature ::= "L" {Ident "/"} Ident // OptTypeArguments {"." Ident OptTypeArguments} ";". expect('L'); StringBuilder qualIdent = new StringBuilder(); scanIdentifier(); while (symbol == '/') { scanSymbol(); qualIdent.append(identifier).append("."); scanIdentifier(); } qualIdent.append(this.identifier); ListOfTypes typeArgs = parseOptTypeArguments(); ParameterizedTypeImpl parentType = new ParameterizedTypeImpl(null, qualIdent.toString(), typeArgs, loader); ParameterizedTypeImpl type = parentType; while (symbol == '.') { // Deal with Member Classes: scanSymbol(); scanIdentifier(); qualIdent.append("$").append(identifier); // FIXME: is "$" correct? typeArgs = parseOptTypeArguments(); type = new ParameterizedTypeImpl(parentType, qualIdent.toString(), typeArgs, loader); } expect(';'); return type; }
Type parseTypeArgument() { // TypeArgument ::= (["+" | "-"] FieldTypeSignature) | "*". ListOfTypes extendsBound = new ListOfTypes(1); ListOfTypes superBound = new ListOfTypes(1); if (symbol == '*') { scanSymbol(); extendsBound.add(Object.class); return new WildcardTypeImpl(extendsBound, superBound); } else if (symbol == '+') { scanSymbol(); extendsBound.add(parseFieldTypeSignature()); return new WildcardTypeImpl(extendsBound, superBound); } else if (symbol == '-') { scanSymbol(); superBound.add(parseFieldTypeSignature()); extendsBound.add(Object.class); return new WildcardTypeImpl(extendsBound, superBound); } else { return parseFieldTypeSignature(); } }
Type parseFieldTypeSignature() { // FieldTypeSignature ::= ClassTypeSignature | ArrayTypeSignature // | TypeVariableSignature. switch (symbol) { case 'L': return parseClassTypeSignature(); case '[': // ArrayTypeSignature ::= "[" TypSignature. scanSymbol(); return new GenericArrayTypeImpl(parseTypeSignature()); case 'T': return parseTypeVariableSignature(); default: throw new GenericSignatureFormatError(); } }
ListOfTypes parseOptTypeArguments() { // OptTypeArguments ::= "<" TypeArgument {TypeArgument} ">". ListOfTypes typeArgs = new ListOfTypes(8); if (symbol == '<') { scanSymbol(); typeArgs.add(parseTypeArgument()); while ((symbol != '>') && (symbol > 0)) { typeArgs.add(parseTypeArgument()); } expect('>'); } return typeArgs; }
TypeVariableImpl<GenericDeclaration> parseFormalTypeParameter() { // FormalTypeParameter ::= Ident ClassBound {InterfaceBound}. scanIdentifier(); String name = identifier.intern(); // FIXME: is this o.k.? ListOfTypes bounds = new ListOfTypes(8); // ClassBound ::= ":" [FieldTypeSignature]. expect(':'); if (symbol == 'L' || symbol == '[' || symbol == 'T') { bounds.add(parseFieldTypeSignature()); } while (symbol == ':') { // InterfaceBound ::= ":" FieldTypeSignature. scanSymbol(); bounds.add(parseFieldTypeSignature()); } return new TypeVariableImpl<GenericDeclaration>(genericDecl, name, bounds); }
void parseOptFormalTypeParameters() { // OptFormalTypeParameters ::= // ["<" FormalTypeParameter {FormalTypeParameter} ">"]. ListOfVariables typeParams = new ListOfVariables(); if (symbol == '<') { scanSymbol(); typeParams.add(parseFormalTypeParameter()); while ((symbol != '>') && (symbol > 0)) { typeParams.add(parseFormalTypeParameter()); } expect('>'); } this.formalTypeParameters = typeParams.getArray(); }
exceptionTypes = new ListOfTypes(8); do { scanSymbol();
void setInput(GenericDeclaration genericDecl, String input) { if (input != null) { this.genericDecl = genericDecl; this.buffer = input.toCharArray(); this.eof = false; scanSymbol(); } else { this.eof = true; } }
void setInput(GenericDeclaration genericDecl, String input) { if (input != null) { this.genericDecl = genericDecl; this.buffer = input.toCharArray(); this.eof = false; scanSymbol(); } else { this.eof = true; } }
void expect(char c) { if (symbol == c) { scanSymbol(); } else { throw new GenericSignatureFormatError(); } }
Type parseReturnType() { // ReturnType ::= TypeSignature | "V". if (symbol != 'V') { return parseTypeSignature(); } else { scanSymbol(); return void.class; } }
void expect(char c) { if (symbol == c) { scanSymbol(); } else { throw new GenericSignatureFormatError(); } }
void expect(char c) { if (symbol == c) { scanSymbol(); } else { throw new GenericSignatureFormatError(); } }
Type parseReturnType() { // ReturnType ::= TypeSignature | "V". if (symbol != 'V') { return parseTypeSignature(); } else { scanSymbol(); return void.class; } }
void expect(char c) { if (symbol == c) { scanSymbol(); } else { throw new GenericSignatureFormatError(); } }