Top Description Inners Fields Constructors Methods
org.codehaus.janino.util.signature

public Class SignatureParser

extends Object
Class Inheritance
Imports
java.io.EOFException, java.util.ArrayList, .Collections, .Iterator, .List, org.codehaus.commons.nullanalysis.Nullable, org.codehaus.janino.util.charstream.StringCharStream, .UnexpectedCharacterException

Helper class for parsing signatures and descriptors. See Java 5 class file format, section 4.4.4, "Signatures".

The various structures that the parser returns (e.g. ClassTypeSignature) all have Object#toString() methods that convert them into nice, human-readable strings. This conversion can be customized using SignatureParser(Options) and passing a custom Options object.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SignatureParser.ArrayTypeSignature

Representation of the "ArrayTypeSignature" clause.

public static class
SignatureParser.ClassSignature

Representation of the "ClassSignature" clause.

public static class
SignatureParser.ClassTypeSignature

Representation of the "ClassTypeSignature" clause, e.g. 'pkg.Outer<T>.Inner<U>'.

public static interface
SignatureParser.FieldTypeSignature

Representation of the "FieldTypeSignature" clause.

public static interface
public static class
SignatureParser.FormalTypeParameter

Representation of the "FormalTypeParameter" clause, e.g. 'T extends MyClass & MyInterface'.

public static class
SignatureParser.MethodTypeSignature

Representation of the "MethodTypeSignature" clause.

public static interface
public static class
SignatureParser.PrimitiveTypeSignature

Representation of the "PrimitiveTypeSignature" clause, i.e. 'byte', 'int', etc., but not 'void'.

public static class
SignatureParser.SignatureException

Signalizes am malformed signature.

public static class
SignatureParser.SimpleClassTypeSignature

Representation of the "SimpleClassTypeSignature" clause, e.g. 'MyMap<K, V>'.

public static interface
SignatureParser.ThrowsSignature

Representation of the "ThrowsSignature" clause.

public static class
SignatureParser.TypeArgument

Representation of the "TypeArgument" clause.

public static interface
SignatureParser.TypeSignature

Representation of the "TypeSignature" clause.

public static class
SignatureParser.TypeVariableSignature

Representation of the "TypeVariableSignature" clause, e.g. 'T'.

Field Summary

Modifier and TypeField and Description
public static final SignatureParser.PrimitiveTypeSignature
BOOLEAN

The primitive 'boolean' type.

public static final SignatureParser.PrimitiveTypeSignature
BYTE

The primitive 'byte' type.

public static final SignatureParser.PrimitiveTypeSignature
CHAR

The primitive 'char' type.

public static final SignatureParser.Options
DEFAULT_OPTIONS

A trivial implementation of Options.

public static final SignatureParser.PrimitiveTypeSignature
DOUBLE

The primitive 'double' type.

public static final SignatureParser.PrimitiveTypeSignature
FLOAT

The primitive 'float' type.

public static final SignatureParser.PrimitiveTypeSignature
INT

The primitive 'int' type.

public static final SignatureParser.PrimitiveTypeSignature
LONG

The primitive 'long' type.

public final SignatureParser.ClassTypeSignature
object

The class type signature of the Object class.

private SignatureParser.Options
private static final SignatureParser.PrimitiveTypeSignature[]
public static final SignatureParser.PrimitiveTypeSignature
SHORT

The primitive 'short' type.

public static final SignatureParser.TypeSignature
VOID

Representation of the 'void' type.

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private SignatureParser.TypeSignature
decodeClassName(String internalName)

public SignatureParser.TypeSignature
decodeClassNameOrFieldDescriptor(String s)

Decodes a "class-name-or-field-descriptor" as defined in JLS8 4.4.1 ("name_index").

public SignatureParser.ClassSignature
decodeClassSignature(String s)

Decodes a 'class signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.

public SignatureParser.TypeSignature
decodeFieldDescriptor(String s)

Decodes a 'field descriptor' as defined in JLS7 4.3.2.

public SignatureParser.FieldTypeSignature
decodeFieldTypeSignature(String s)

Decodes a 'field type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.

public SignatureParser.MethodTypeSignature

Returns:

E.g. "(Object[]) => java.util.stream.Stream" or "join()" (void method)
decodeMethodDescriptor
(String s)

Decodes a 'method descriptor' as defined in JVMS[78] 4.3.3.

public SignatureParser.MethodTypeSignature
decodeMethodTypeSignature(String s)

Decodes a 'method type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.

public SignatureParser.TypeSignature
decodeReturnType(String s)

Decodes a 'return type' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.

public SignatureParser.TypeSignature
decodeTypeSignature(String s)

Decodes a 'type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.

private SignatureParser.FieldTypeSignature
private SignatureParser.ClassSignature
private SignatureParser.ClassTypeSignature
private SignatureParser.TypeSignature
private SignatureParser.FieldTypeSignature
private SignatureParser.FormalTypeParameter
private static String
private static String
private SignatureParser.MethodTypeSignature
private SignatureParser.MethodTypeSignature
private SignatureParser.TypeSignature
private SignatureParser.ThrowsSignature
private SignatureParser.TypeArgument
private SignatureParser.TypeSignature
private static SignatureParser.TypeVariableSignature
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait