In brief, the 2.0 prototype compiler allows variance specifiers
'-', '+', '=', or '*' to start a TypeArgument
or
after the open-brackets in an ArrayTypeSignature
.
A formal grammar (with corrections from the JSR-14 spec, including a
new correction to ClassTypeSignature
) is:
MethodOrFieldSignature ::= TypeSignature ClassSignature ::= ParameterPartOpt super_TypeSignature interface_TypeSignatures TypeSignatures ::= TypeSignatures TypeSignature | TypeSignature ::= ... | ArrayTypeSignature | ClassTypeSignature | MethodTypeSignature | TypeVariableSignature VariantTypeSignature ::= '-' TypeSignature | '+' TypeSignature | '=' TypeSignature | TypeSignature | '*' VariantTypeSignatures ::= VariantTypeSignatures VariantTypeSignature | ClassTypeSignature ::= 'L' Ident TypeArgumentsOpt ';' | ClassTypeSignature '.' 'L' Ident TypeArgumentsOpt ';' MethodTypeSignature ::= ParameterPartOpt '(' TypeSignatures ')' TypeSignature ThrowsSignatureListOpt ThrowsSignatureList ::= ThrowsSignature ThrowsSignatureList | ThrowsSignature ThrowsSignature ::= '^' TypeSignature TypeVariableSignature ::= 'T' Ident ';' TypeArguments ::= '<' VariantTypeSignature VariantTypeSignatures '>' ParameterPart ::= '<' ParameterSignature ParameterSignatures '>' ParameterSignatures ::= ParameterSignatures ParameterSignature | ParameterSignature ::= Ident ':' TypeSignature | Ident ':' TypeSignatureOpt ':' TypeSignature TypeSignatures ArrayTypeSignature ::= '[' VariantTypeSignature interface_TypeSignature::= TypeSignature super_TypeSignature ::= TypeSignature