Interface MethodSignature
public sealed interface MethodSignature
Models the generic signature of a method or constructor, as defined by JVMS
4.7.9.1.
- See Java Language Specification:
-
8.4 Method Declarations
8.8 Constructor Declarations - See Java Virtual Machine Specification:
-
4.7.9.1 Signatures
- Since:
- 24
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the signatures of the parameters of this method or constructor, may be empty.static MethodSignature
Returns a method signature with no type parameter or exception type.static MethodSignature
of
(MethodTypeDesc methodDescriptor) Returns a method signature for a raw method descriptor.static MethodSignature
of
(List<Signature.TypeParam> typeParameters, List<Signature.ThrowableSig> exceptions, Signature result, Signature... arguments) Returns a method signature.static MethodSignature
Parses a raw method signature string into aMethodSignature
.result()
Returns the signatures of the return value of this method.Returns the raw signature string.Returns the signatures of the exceptions thrown by this method or constructor.Returns the type parameters of this method or constructor, may be empty.
-
Method Details
-
typeParameters
List<Signature.TypeParam> typeParameters()Returns the type parameters of this method or constructor, may be empty.- Returns:
- the type parameters of this method or constructor, may be empty
- See Java Language Specification:
-
8.4.4 Generic Methods
8.8.4 Generic Constructors - See Also:
-
arguments
Returns the signatures of the parameters of this method or constructor, may be empty. The parameters may differ from those in the method descriptor because some synthetic or implicit parameters are omitted.- Returns:
- the signatures of the parameters of this method or constructor, may be empty
- See Java Language Specification:
-
8.4.1 Formal Parameters
8.8.1 Formal Parameters - See Also:
-
result
Signature result()Returns the signatures of the return value of this method. For constructors, this returns a signature representingvoid
.- Returns:
- the signatures of the return value of this method
- See Java Language Specification:
-
8.4.5 Method Result
- See Also:
-
throwableSignatures
List<Signature.ThrowableSig> throwableSignatures()Returns the signatures of the exceptions thrown by this method or constructor.- Returns:
- the signatures of the exceptions thrown by this method or constructor
- See Java Language Specification:
-
8.4.6 Method Throws
8.8.5 Constructor Throws - See Also:
-
signatureString
-
of
Returns a method signature for a raw method descriptor. The resulting signature has no type parameter or exception type declared.- Parameters:
methodDescriptor
- the method descriptor- Returns:
- a method signature for a raw method descriptor
-
of
Returns a method signature with no type parameter or exception type. The parameters may differ from those in the method descriptor because some synthetic or implicit parameters are omitted.- Parameters:
result
- signature for the return typearguments
- signatures for the method parameters- Returns:
- a method signature with no type parameter or exception type
-
of
static MethodSignature of(List<Signature.TypeParam> typeParameters, List<Signature.ThrowableSig> exceptions, Signature result, Signature... arguments) Returns a method signature. The parameters may differ from those in the method descriptor because some synthetic or implicit parameters are omitted.- Parameters:
typeParameters
- signatures for the type parametersexceptions
- signatures for the exceptionsresult
- signature for the return typearguments
- signatures for the method parameters- Returns:
- a method signature
-
parseFrom
Parses a raw method signature string into aMethodSignature
.- Parameters:
methodSignature
- the raw method signature string- Returns:
- the parsed method signature
- Throws:
IllegalArgumentException
- if the string is not a valid method signature string
-