Bug 384992 - [java8] adopt grammar changes for Java 8 from
JDT/Core
1.: textual merge of java.g - not yet LALR(1)
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/readableNames.properties b/org.eclipse.jdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/readableNames.properties
deleted file mode 100644
index c2a8bb8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/readableNames.properties
+++ /dev/null
@@ -1,296 +0,0 @@
-,opt=,
-AbstractMethodDeclaration=AbstractMethodDeclaration
-AdditionalBound1=AdditionalBound1
-AdditionalBound=AdditionalBound
-AdditionalBoundList1=AdditionalBoundList1
-AdditionalBoundList=AdditionalBoundList
-AdditiveExpression=Expression
-AdditiveExpression_NotName=Expression
-AllocationHeader=AllocationHeader
-AndExpression=Expression
-AndExpression_NotName=Expression
-Annotation=Annotation
-AnnotationTypeBody=AnnotationTypeBody
-AnnotationTypeDeclaration=AnnotationTypeDeclaration
-AnnotationTypeDeclarationHeader=AnnotationTypeDeclarationHeader
-AnnotationTypeMemberDeclaration=AnnotationTypeMemberDeclaration
-AnnotationTypeMemberDeclarationHeader=AnnotationTypeMemberDeclarationHeader
-AnnotationTypeMemberDeclarations=AnnotationTypeMemberDeclarations
-AnnotationTypeMemberDeclarationsopt=AnnotationTypeMemberDeclarationsopt
-AnnotationTypeMemberHeaderExtendedDims=AnnotationTypeMemberHeaderExtendedDims
-ArgumentList=ArgumentList
-ArgumentListopt=ArgumentList
-Arguments=Arguments
-Argumentsopt=Argumentsopt
-ArrayAccess=ArrayAccess
-ArrayCreationHeader=ArrayCreationHeader
-ArrayCreationWithArrayInitializer=ArrayCreationWithArrayInitializer
-ArrayCreationWithoutArrayInitializer=ArrayCreationWithoutArrayInitializer
-ArrayInitializer=ArrayInitializer
-ArrayType=ArrayType
-ArrayTypeWithTypeArgumentsName=ArrayTypeWithTypeArgumentsName
-AssertStatement=AssertStatement
-Assignment=Assignment
-AssignmentExpression=Expression
-AssignmentExpression_NotName=Expression
-AssignmentOperator=AssignmentOperator
-Block=Block
-BlockStatement=BlockStatement
-BlockStatements=BlockStatements
-BlockStatementsopt=BlockStatements
-BooleanLiteral=BooleanLiteral
-BreakStatement=BreakStatement
-CastExpression=CastExpression
-CatchClause=CatchClause
-CatchHeader=CatchHeader
-Catches=Catches
-Catchesopt=Catches
-ClassBody=ClassBody
-ClassBodyDeclaration=ClassBodyDeclaration
-ClassBodyDeclarations=ClassBodyDeclarations
-ClassBodyDeclarationsopt=ClassBodyDeclarations
-ClassBodySimpleNameopt=ClassBody
-ClassBodyopt=ClassBody
-ClassDeclaration=ClassDeclaration
-ClassHeader=ClassHeader
-ClassHeaderExtends=ClassHeaderExtends
-ClassHeaderExtendsopt=ClassHeaderExtends
-ClassHeaderImplements=ClassHeaderImplements
-ClassHeaderImplementsopt=ClassHeaderImplements
-ClassHeaderName1=ClassHeaderName
-ClassHeaderName=ClassHeaderName
-ClassInstanceCreationExpression=ClassInstanceCreationExpression
-ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName
-ClassMemberDeclaration=ClassMemberDeclaration
-ClassOrInterface=Type
-ClassOrInterfaceType=Type
-ClassType=ClassType
-ClassTypeElt=ClassType
-ClassTypeList=ClassTypeList
-CompilationUnit=CompilationUnit
-ConditionalAndExpression=Expression
-ConditionalAndExpression_NotName=Expression
-ConditionalExpression=Expression
-ConditionalExpression_NotName=Expression
-ConditionalOrExpression=Expression
-ConditionalOrExpression_NotName=Expression
-ConstantDeclaration=ConstantDeclaration
-ConstantExpression=ConstantExpression
-ConstructorDeclaration=ConstructorDeclaration
-ConstructorHeader=ConstructorDeclaration
-ConstructorHeaderName=ConstructorHeaderName
-ContinueStatement=ContinueStatement
-DefaultValue=DefaultValue
-DefaultValueopt=DefaultValueopt
-Diet=Diet
-DimWithOrWithOutExpr=Dimension
-DimWithOrWithOutExprs=Dimensions
-Dims=Dimensions
-DimsLoop=Dimensions
-Dimsopt=Dimensions
-DoStatement=DoStatement
-EmptyStatement=EmptyStatement
-EnhancedForStatement=EnhancedForStatement
-EnhancedForStatementHeader=EnhancedForStatementHeader
-EnhancedForStatementNoShortIf=EnhancedForStatementNoShortIf
-EnterAnonymousClassBody=EnterAnonymousClassBody
-EnterAnonymousClassBodySimpleName=EnterAnonymousClassBodySimpleName
-EnterCompilationUnit=EnterCompilationUnit
-EnterVariable=EnterVariable
-EnumBody=EnumBody
-EnumBodyDeclarationsopt=EnumBodyDeclarationsopt
-EnumConstant=EnumConstant
-EnumConstantHeader=EnumConstantHeader
-EnumConstants=EnumConstants
-EnumDeclaration=EnumDeclaration
-EnumDeclarations=EnumDeclarations
-EnumHeader=EnumHeader
-EqualityExpression=Expression
-EqualityExpression_NotName=Expression
-ExclusiveOrExpression=Expression
-ExclusiveOrExpression_NotName=Expression
-ExitTryBlock=ExitTryBlock
-ExitVariableWithInitialization=ExitVariableWithInitialization
-ExitVariableWithoutInitialization=ExitVariableWithoutInitialization
-ExplicitConstructorInvocation=ExplicitConstructorInvocation
-Expression=Expression
-ExpressionStatement=Statement
-Expression_NotName=Expression
-Expressionopt=Expression
-FieldAccess=FieldAccess
-FieldDeclaration=FieldDeclaration
-Finally=Finally
-FloatingPointType=FloatingPointType
-ForInit=ForInit
-ForInitopt=ForInit
-ForStatement=ForStatement
-ForStatementNoShortIf=ForStatement
-ForUpdate=ForUpdate
-ForUpdateopt=ForUpdate
-ForceNoDiet=ForceNoDiet
-FormalParameter=FormalParameter
-FormalParameterList=FormalParameterList
-FormalParameterListopt=FormalParameterList
-GenericMethodDeclaration=GenericMethodDeclaration
-Goal=Goal
-Header=Header
-IfThenElseStatement=IfStatement
-IfThenElseStatementNoShortIf=IfStatement
-IfThenStatement=IfStatement
-ImportDeclaration=ImportDeclaration
-ImportDeclarations=ImportDeclarations
-InclusiveOrExpression=Expression
-InclusiveOrExpression_NotName=Expression
-Initializer=Initializer
-InsideCastExpression=InsideCastExpression
-InsideCastExpressionLL1=InsideCastExpression
-InsideCastExpressionWithQualifiedGenerics=InsideCastExpression
-InstanceofExpression=Expression
-InstanceofExpression_NotName=Expression
-IntegralType=IntegralType
-InterfaceBody=InterfaceBody
-InterfaceDeclaration=InterfaceDeclaration
-InterfaceHeader=InterfaceHeader
-InterfaceHeaderExtends=InterfaceHeaderExtends
-InterfaceHeaderExtendsopt=InterfaceHeaderExtends
-InterfaceHeaderName1=InterfaceHeaderName
-InterfaceHeaderName=InterfaceHeaderName
-InterfaceMemberDeclaration=InterfaceMemberDeclaration
-InterfaceMemberDeclarations=InterfaceMemberDeclarations
-InterfaceMemberDeclarationsopt=InterfaceMemberDeclarations
-InterfaceType=InterfaceType
-InterfaceTypeList=InterfaceTypeList
-InternalCompilationUnit=CompilationUnit
-InvalidArrayInitializerAssignement=ArrayInitializerAssignement
-InvalidConstructorDeclaration=InvalidConstructorDeclaration
-InvalidInterfaceDeclaration=InvalidInterfaceDeclaration
-InvalidMethodDeclaration=InvalidMethodDeclaration
-LabeledStatement=LabeledStatement
-LabeledStatementNoShortIf=LabeledStatement
-Literal=Literal
-LocalVariableDeclaration=LocalVariableDeclaration
-LocalVariableDeclarationStatement=LocalVariableDeclarationStatement
-MarkerAnnotation=MarkerAnnotation
-MemberValue=MemberValue
-MemberValueArrayInitializer=MemberValueArrayInitializer
-MemberValuePair=MemberValuePair
-MemberValuePairs=MemberValuePairs
-MemberValuePairsopt=MemberValuePairsopt
-MemberValues=MemberValues
-MethodBody=MethodBody
-MethodDeclaration=MethodDeclaration
-MethodHeader=MethodDeclaration
-MethodHeaderExtendedDims=MethodHeaderExtendedDims
-MethodHeaderName=MethodHeaderName
-MethodHeaderRightParen=)
-MethodHeaderThrowsClause=MethodHeaderThrowsClause
-MethodHeaderThrowsClauseopt=MethodHeaderThrowsClause
-MethodInvocation=MethodInvocation
-Modifier=Modifier
-Modifiers=Modifiers
-Modifiersopt=Modifiers
-MultiplicativeExpression=Expression
-MultiplicativeExpression_NotName=Expression
-Name=Name
-NestedMethod=NestedMethod
-NestedType=NestedType
-NormalAnnotation=NormalAnnotation
-NumericType=NumericType
-OneDimLoop=Dimension
-OnlySynchronized=OnlySynchronized
-OnlyTypeArguments=TypeArguments
-OnlyTypeArgumentsForCastExpression=TypeArguments
-OpenBlock=OpenBlock
-PackageDeclaration=PackageDeclaration
-PackageDeclarationName=PackageDeclarationName
-PostDecrementExpression=PostDecrementExpression
-PostIncrementExpression=PostIncrementExpression
-PostfixExpression=Expression
-PostfixExpression_NotName=Expression
-PreDecrementExpression=PreDecrementExpression
-PreIncrementExpression=PreIncrementExpression
-Primary=Expression
-PrimaryNoNewArray=Expression
-PrimitiveType=PrimitiveType
-PushLPAREN=(
-PushLeftBrace=PushLeftBrace
-PushModifiers=PushModifiers
-PushPosition=PushPosition
-PushRPAREN=)
-PushRealModifiers=PushModifiers
-QualifiedName=QualifiedName
-ReduceImports=ReduceImports
-ReferenceType1=ReferenceType1
-ReferenceType2=ReferenceType2
-ReferenceType3=ReferenceType3
-ReferenceType=ReferenceType
-RelationalExpression=Expression
-RelationalExpression_NotName=Expression
-RestoreDiet=RestoreDiet
-ReturnStatement=ReturnStatement
-ShiftExpression=Expression
-ShiftExpression_NotName=Expression
-SimpleName=SimpleName
-SingleMemberAnnotation=SingleMemberAnnotation
-SingleStaticImportDeclaration=SingleStaticImportDeclaration
-SingleStaticImportDeclarationName=SingleStaticImportDeclarationName
-SingleTypeImportDeclaration=SingleTypeImportDeclaration
-SingleTypeImportDeclarationName=SingleTypeImportDeclarationName
-Statement=Statement
-StatementExpression=Expression
-StatementExpressionList=StatementExpressionList
-StatementNoShortIf=Statement
-StatementWithoutTrailingSubstatement=Statement
-StaticImportOnDemandDeclaration=StaticImportOnDemandDeclaration
-StaticImportOnDemandDeclarationName=StaticImportOnDemandDeclarationName
-StaticInitializer=StaticInitializer
-StaticOnly=StaticOnly
-SwitchBlock=SwitchBlock
-SwitchBlockStatement=SwitchBlockStatement
-SwitchBlockStatements=SwitchBlockStatements
-SwitchLabel=SwitchLabel
-SwitchLabels=SwitchLabels
-SwitchStatement=SwitchStatement
-SynchronizedStatement=SynchronizedStatement
-ThrowStatement=ThrowStatement
-TryBlock=Block
-TryStatement=TryStatement
-Type=Type
-TypeArgument1=TypeArgument1
-TypeArgument2=TypeArgument2
-TypeArgument3=TypeArgument3
-TypeArgument=TypeArgument
-TypeArgumentList1=TypeArgumentList1
-TypeArgumentList2=TypeArgumentList2
-TypeArgumentList3=TypeArgumentList3
-TypeArgumentList=TypeArgumentList
-TypeArguments=TypeArguments
-TypeDeclaration=TypeDeclaration
-TypeDeclarations=TypeDeclarations
-TypeImportOnDemandDeclaration=TypeImportOnDemandDeclaration
-TypeImportOnDemandDeclarationName=TypeImportOnDemandDeclarationName
-TypeParameter1=TypeParameter1
-TypeParameter=TypeParameter
-TypeParameterHeader=TypeParameter
-TypeParameterList1=TypeParameterList1
-TypeParameterList=TypeParameterList
-TypeParameters=TypeParameters
-UnaryExpression=Expression
-UnaryExpressionNotPlusMinus=Expression
-UnaryExpressionNotPlusMinus_NotName=Expression
-UnaryExpression_NotName=Expression
-VariableDeclarator=VariableDeclarator
-VariableDeclaratorId=VariableDeclaratorId
-VariableDeclarators=VariableDeclarators
-VariableInitializer=VariableInitializer
-VariableInitializers=VariableInitializers
-WhileStatement=WhileStatement
-WhileStatementNoShortIf=WhileStatement
-Wildcard1=Wildcard1
-Wildcard2=Wildcard2
-Wildcard3=Wildcard3
-Wildcard=Wildcard
-WildcardBounds1=WildcardBounds1
-WildcardBounds2=WildcardBounds2
-WildcardBounds3=WildcardBound3
-WildcardBounds=WildcardBounds
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
deleted file mode 100644
index ee0442a..0000000
--- a/org.eclipse.jdt.core/.settings/.api_filters
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><component id="org.eclipse.jdt.core" version="2">
- <resource path="model/org/eclipse/jdt/core/IJavaModelMarker.java" type="org.eclipse.jdt.core.IJavaModelMarker">
- <filter id="1210056707">
- <message_arguments>
- <message_argument value="3.6.4"/>
- <message_argument value="OUTPUT_OVERLAPPING_SOURCE"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="model/org/eclipse/jdt/core/IJavaModelStatusConstants.java" type="org.eclipse.jdt.core.IJavaModelStatusConstants">
- <filter id="1210056707">
- <message_arguments>
- <message_argument value="3.6.4"/>
- <message_argument value="OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="model/org/eclipse/jdt/core/JavaCore.java" type="org.eclipse.jdt.core.JavaCore">
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="3.6.4"/>
- <message_argument value="CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
\ No newline at end of file
diff --git a/org.eclipse.jdt.core/grammar/java.g b/org.eclipse.jdt.core/grammar/java.g
index f520041..5845606 100644
--- a/org.eclipse.jdt.core/grammar/java.g
+++ b/org.eclipse.jdt.core/grammar/java.g
@@ -53,7 +53,7 @@
-- {ObjectTeams: keywords
as base callin playedBy precedence readonly team tsuper when with within
--- The following symbols are recoknized as keywords only in specific contexts:
+-- The following symbols are recognized as keywords only in specific contexts:
-- After "<-":
replace after before
-- After "->":
@@ -116,15 +116,22 @@
EQUAL
AT
ELLIPSIS
+ ARROW
+ COLON_COLON
+ BeginLambda
+ BeginTypeArguments
+ ElidedSemicolonAndRightBrace
+
-- {ObjectTeams
BINDIN
- BINDOUT
CALLOUT_OVERRIDE
-- Markus Witte}
-- BodyMarker
$Alias
+ '::' ::= COLON_COLON
+ '->' ::= ARROW
'++' ::= PLUS_PLUS
'--' ::= MINUS_MINUS
'==' ::= EQUAL_EQUAL
@@ -176,7 +183,6 @@
-- {ObjectTeams
'<-' ::= BINDIN
- '->' ::= BINDOUT
'=>' ::= CALLOUT_OVERRIDE
-- Markus Witte}
@@ -196,9 +202,8 @@
Goal ::= '>>' StaticInitializer
Goal ::= '>>' Initializer
-- error recovery
--- Modifiersopt is used to properly consume a header and exit the rule reduction at the end of the parse() method
-Goal ::= '>>>' Header1 Modifiersopt
-Goal ::= '!' Header2 Modifiersopt
+Goal ::= '>>>' Header1 RecoveryExitHeader
+Goal ::= '!' Header2 RecoveryExitHeader
Goal ::= '*' BlockStatements
Goal ::= '*' CatchHeader
-- JDOM
@@ -226,6 +231,10 @@
-- SH}
/:$readableName Goal:/
+RecoveryExitHeader ::= $empty
+RecoveryExitHeader ::= '...'
+/:$readableName RecoveryExitHeader:/
+
-- {ObjectTeams
-- insert new Goals for Delta-Compiling
-- for Callin/Callout-Binding
@@ -244,9 +253,38 @@
BooleanLiteral -> false
/:$readableName BooleanLiteral:/
-Type ::= PrimitiveType
+-- Type is a wrapper that automatically allows for jsr308 style
+-- annotations to prefix a (Java5/6) Type. If type annotations
+-- are illegal in a certain place, use TypeInternal instead.
+-- If type annotations are legal, but so are java5/6 style
+-- declaration annotations, use Type0 instead.
+
+Type ::= TypeInternal
+-- consumeUnannotatedType inserts 0 at the suitable place in the type
+-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
+-- length of the type annotations 0 or otherwise.
+/.$putCase consumeUnannotatedType(); $break ./
+Type ::= TypeAnnotations TypeInternal
+/:$compliance 1.8:/
+/:$readableName Type:/
+
+-- Type0 is to be used in places where type annotations are legal
+-- but are not consumed as TypeAnnotations, but as modifiers. This
+-- is because from the parser's point of view there are places where
+-- java5/6 style declarations annotations can occur in the same place
+-- and it is too early to tell which is which.
+Type0 ::= TypeInternal
+-- consumeUnannotatedType inserts 0 at the suitable place in the type
+-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
+-- length of the type annotations 0 or otherwise.
+/.$putCase consumeUnannotatedType(); $break ./
+/:$readableName Type:/
+
+-- TypeInternal is the Java5/6 Type
+TypeInternal ::= PrimitiveType
/.$putCase consumePrimitiveType(); $break ./
-Type -> ReferenceType
+TypeInternal -> ReferenceType0
+/:$readableName Type:/
-- {ObjectTeams
Type -> LiftingType
Type -> ArrayLiftingType
@@ -272,28 +310,73 @@
FloatingPointType -> 'double'
/:$readableName FloatingPointType:/
-ReferenceType ::= ClassOrInterfaceType
-/.$putCase consumeReferenceType(); $break ./
-ReferenceType -> ArrayType
+---------------------------- JSR308-------------------------------------------
+-- ReferenceType has been wrapped now, so that it can be used by itself without
+-- having to spell out the rule once with Modifiers & once without.
+-- If type annotations are not legal prefixes to ReferenceType at some point, use
+-- ReferenceType0 instead. Otherwise reject the annotations in the parser.
+
+ReferenceType ::= ReferenceType0
+-- consumeUnannotatedType inserts 0 at the suitable place in the type
+-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
+-- length of the type annotations 0 or otherwise.
+/.$putCase consumeUnannotatedType(); $break ./
+ReferenceType ::= Modifiers ReferenceType0
+/.$putCase consumeAnnotatedType(); $break ./
+/:$compliance 1.8:/
/:$readableName ReferenceType:/
----------------------------------------------------------------
--- 1.5 feature
----------------------------------------------------------------
-ClassOrInterfaceType -> ClassOrInterface
-ClassOrInterfaceType -> GenericType
+ReferenceType0 ::= ClassOrInterfaceType0
+/.$putCase consumeReferenceType(); $break ./
+ReferenceType0 -> ArrayType
+/:$readableName ReferenceType:/
+
+Annotationsopt ::= $empty
+/.$putCase consumeZeroTypeAnnotations(true); $break ./
+Annotationsopt -> TypeAnnotations
+/:$compliance 1.8:/
+/:$readableName Annotationsopt:/
+
+-- ClassOrInterfaceType has now been wrapped so that it automatically includes
+-- JSR308 style optional annotations. Use ClassOrInterfaceType0 if annotations
+-- are illegal in some place - otherwise reject the annotations in the parser.
+ClassOrInterfaceType ::= Annotationsopt ClassOrInterfaceType0
/:$readableName Type:/
-ClassOrInterface ::= Name
-/.$putCase consumeClassOrInterfaceName(); $break ./
-ClassOrInterface ::= GenericType '.' Name
-/.$putCase consumeClassOrInterface(); $break ./
+ClassOrInterfaceType0 -> ClassOrInterface0
+ClassOrInterfaceType0 -> GenericType
+/:$readableName Type:/
+---------------------------- JSR308-------------------------------------------
+
+-- ClassOrInterface has been wrapped now so that it ALWAYS PUSHES
+-- A 0 IN THE TYPE ANNOTATIONS LENGTH STACK. If this behavior is
+-- not desirable, then (a) use ClassOrInterface0 if possible or (b)
+-- if that is not possible due to conflicts, then this 0 will have
+-- to be popped suitably when erroneous/extraneous. See the use of
+-- the production PopZeroTypeAnnotations for examples.
+
+ClassOrInterface ::= ClassOrInterface0
+/.$putCase consumeZeroTypeAnnotations(true); $break ./
/:$readableName Type:/
-GenericType ::= ClassOrInterface TypeArguments
-/.$putCase consumeGenericType(); $break ./
+ClassOrInterface0 ::= Name
+/.$putCase consumeClassOrInterfaceName(); $break ./
+ClassOrInterface0 ::= GenericTypeDotName
+/:$readableName Type:/
+
+PopZeroTypeAnnotations ::= $empty
+/.$putCase consumeZeroTypeAnnotations(false); $break ./
+/:$readableName PopZeroTypeAnnotations:/
+
+GenericType ::= ClassOrInterface TypeArguments PopZeroTypeAnnotations
+/.$putCase consumeGenericType(); $break ./
+/:$compliance 1.5:/
/:$readableName GenericType:/
+GenericTypeDotName ::= GenericType '.' Name
+/.$putCase consumeClassOrInterface(); $break ./
+/:$readableName GenericTypeDotName:/
+
GenericType ::= ClassOrInterface '<' '>'
/.$putCase consumeGenericTypeWithDiamond(); $break ./
/:$readableName GenericType:/
@@ -345,8 +428,7 @@
-- ArrayType ::= ArrayType '[' ']'
--
-ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name
-/.$putCase consumeArrayTypeWithTypeArgumentsName(); $break ./
+ArrayTypeWithTypeArgumentsName ::= GenericTypeDotName
/:$readableName ArrayTypeWithTypeArgumentsName:/
ArrayType ::= PrimitiveType Dims
@@ -429,9 +511,14 @@
/:$readableName Header1:/
Header2 -> Header
-Header2 -> EnumConstantHeader
+Header2 -> EnumConstantHeader RecoveryEnumConstantSeparatoropt
/:$readableName Header2:/
+RecoveryEnumConstantSeparatoropt ::= $empty
+RecoveryEnumConstantSeparatoropt ::= ','
+RecoveryEnumConstantSeparatoropt ::= ';'
+/:$readableName RecoveryEnumConstantSeparatoropt:/
+
CatchHeader ::= 'catch' '(' CatchFormalParameter ')' '{'
/.$putCase consumeCatchHeader(); $break ./
/:$readableName CatchHeader:/
@@ -456,7 +543,7 @@
/:$compliance 1.5:/
PackageDeclarationName ::= PackageComment 'package' Name
-/.$putCase consumePackageDeclarationName(); $break ./
+/.$putCase consumePackageDeclarationName(); $break ./
/:$readableName PackageDeclarationName:/
PackageComment ::= $empty
@@ -704,7 +791,7 @@
-- | 'transient'
-- | 'volatile'
-FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
+FieldDeclaration ::= Modifiersopt Type0 VariableDeclarators ';'
/.$putCase consumeFieldDeclaration(); $break ./
/:$readableName FieldDeclaration:/
@@ -712,6 +799,7 @@
VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
/.$putCase consumeVariableDeclarators(); $break ./
/:$readableName VariableDeclarators:/
+/:$recovery_template Identifier:/
VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization
VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
@@ -737,6 +825,16 @@
/.$putCase consumeRestoreDiet(); $break ./
/:$readableName RestoreDiet:/
+VariableDeclaratorIdOrThis ::= 'this'
+/.$putCase consumeExplicitThisParameter(false); $break ./
+/:$compliance 1.8:/
+VariableDeclaratorIdOrThis ::= Name '.' 'this'
+/.$putCase consumeExplicitThisParameter(true); $break ./
+/:$compliance 1.8:/
+VariableDeclaratorIdOrThis ::= VariableDeclaratorId
+/.$putCase consumeVariableDeclaratorIdParameter(); $break ./
+/:$readableName VariableDeclaratorId:/
+
VariableDeclaratorId ::= 'Identifier' Dimsopt
/:$readableName VariableDeclaratorId:/
/:$recovery_template Identifier:/
@@ -775,7 +873,7 @@
MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
/.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./
-MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
+MethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
/.$putCase consumeMethodHeaderName(false); $break ./
/:$readableName MethodHeaderName:/
@@ -807,10 +905,33 @@
/.$putCase consumeFormalParameterList(); $break ./
/:$readableName FormalParameterList:/
+PotentialNameArray -> $empty
+/.$putCase consumePotentialNameArrayType(); $break ./
+/:$readableName PotentialNameArray:/
+
--1.1 feature
-FormalParameter ::= Modifiersopt Type VariableDeclaratorId
+--FormalParameter ::= Modifiersopt Type VariableDeclaratorId
+--FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId
+--The above rules have been rewritten by inlinng the type subgrammar
+--to avoid the conflicts resulting from jsr308 changes.
+FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt VariableDeclaratorIdOrThis
/.$putCase consumeFormalParameter(false); $break ./
-FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId
+FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt '...' VariableDeclaratorIdOrThis
+/.$putCase consumeFormalParameter(true); $break ./
+/:$compliance 1.5:/
+FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorIdOrThis
+/.$putCase consumeFormalParameter(false); $break ./
+FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorIdOrThis
+/.$putCase consumeFormalParameter(true); $break ./
+/:$compliance 1.5:/
+FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt VariableDeclaratorIdOrThis
+/.$putCase consumeFormalParameter(false); $break ./
+FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt '...' VariableDeclaratorIdOrThis
+/.$putCase consumeFormalParameter(true); $break ./
+/:$compliance 1.5:/
+FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt VariableDeclaratorIdOrThis
+/.$putCase consumeFormalParameter(false); $break ./
+FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt '...' VariableDeclaratorIdOrThis
/.$putCase consumeFormalParameter(true); $break ./
/:$readableName FormalParameter:/
/:$compliance 1.5:/
@@ -825,7 +946,7 @@
/.$putCase consumeCatchType(); $break ./
/:$readableName CatchType:/
-UnionType ::= Type
+UnionType ::= TypeInternal
/.$putCase consumeUnionTypeAsClassType(); $break ./
UnionType ::= UnionType '|' Type
/.$putCase consumeUnionType(); $break ./
@@ -1113,7 +1234,7 @@
--18.8.4 Productions from 8.5: Static Initializers
-StaticInitializer ::= StaticOnly Block
+StaticInitializer ::= StaticOnly Block
/.$putCase consumeStaticInitializer(); $break./
/:$readableName StaticInitializer:/
@@ -1253,9 +1374,17 @@
/.$putCase consumeEmptyTypeDeclaration(); $break ./
/:$readableName InterfaceMemberDeclaration:/
+PushDefault ::= $empty
+/.$putCase consumeInterfaceMethodDefault(); $break ./
+/:$readableName PushDefault:/
+/:$compliance 1.8:/
+
InterfaceMemberDeclaration -> ConstantDeclaration
+InterfaceMemberDeclaration ::= MethodHeader 'default' PushDefault MethodBody
+/:$compliance 1.8:/
+/.$putCase consumeInterfaceMethodDeclaration(true); $break ./
InterfaceMemberDeclaration ::= MethodHeader MethodBody
-/.$putCase consumeInvalidMethodDeclaration(); $break ./
+/.$putCase consumeInterfaceMethodDeclaration(false); $break ./
/:$readableName InterfaceMemberDeclaration:/
-- These rules are added to be able to parse constructors inside interface and then report a relevent error message
@@ -1270,7 +1399,6 @@
InvalidInitializer -> Initializer
/:$readableName InvalidInitializer:/
-
InterfaceMemberDeclaration -> AbstractMethodDeclaration
InterfaceMemberDeclaration -> InvalidConstructorDeclaration
InterfaceMemberDeclaration -> InvalidInitializer
@@ -1337,13 +1465,13 @@
/.$putCase consumeLocalVariableDeclarationStatement(); $break ./
/:$readableName LocalVariableDeclarationStatement:/
-LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators
+LocalVariableDeclaration ::= Type0 PushModifiers VariableDeclarators
/.$putCase consumeLocalVariableDeclaration(); $break ./
-- 1.1 feature
-- The modifiers part of this rule makes the grammar more permissive.
-- The only modifier here is final. We put Modifiers to allow multiple modifiers
-- This will require to check the validity of the modifier
-LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators
+LocalVariableDeclaration ::= Modifiers Type0 PushRealModifiers VariableDeclarators
/.$putCase consumeLocalVariableDeclaration(); $break ./
/:$readableName LocalVariableDeclaration:/
@@ -1414,7 +1542,7 @@
/:$readableName LabeledStatement:/
Label ::= 'Identifier'
-/.$putCase consumeLabel() ; $break ./
+/.$putCase consumeLabel(); $break ./
/:$readableName Label:/
ExpressionStatement ::= StatementExpression ';'
@@ -1568,6 +1696,7 @@
TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt
/.$putCase consumeStatementTry(false, true); $break ./
+/:$compliance 1.7:/
TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally
/.$putCase consumeStatementTry(true, true); $break ./
/:$readableName TryStatementWithResources:/
@@ -1580,6 +1709,7 @@
;opt ::= $empty
/.$putCase consumeResourceOptionalTrailingSemiColon(false); $break ./
+/:$compliance 1.7:/
;opt ::= ';'
/.$putCase consumeResourceOptionalTrailingSemiColon(true); $break ./
/:$readableName ;:/
@@ -1587,6 +1717,7 @@
Resources ::= Resource
/.$putCase consumeSingleResource(); $break ./
+/:$compliance 1.7:/
Resources ::= Resources TrailingSemiColon Resource
/.$putCase consumeMultipleResources(); $break ./
/:$readableName Resources:/
@@ -1597,12 +1728,12 @@
/:$readableName ;:/
/:$compliance 1.7:/
-Resource ::= Type PushModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
+Resource ::= TypeInternal PushModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
/:$readableName Resource:/
/:$compliance 1.7:/
-Resource ::= Modifiers Type PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
+Resource ::= Modifiers TypeInternal PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
/:$readableName Resource:/
/:$compliance 1.7:/
@@ -1623,7 +1754,7 @@
/.$putCase consumeStatementCatch() ; $break ./
/:$readableName CatchClause:/
-Finally ::= 'finally' Block
+Finally ::= 'finally' Block
/:$readableName Finally:/
/:$recovery_template finally { }:/
@@ -1634,10 +1765,27 @@
/.$putCase consumeLeftParen(); $break ./
/:$readableName (:/
/:$recovery_template (:/
+PushRPARENForUnannotatedTypeCast ::= ')'
+/.$putCase consumeRightParenForUnannotatedTypeCast(); $break ./
+/:$readableName ):/
+/:$recovery_template ):/
+PushRPARENForNameUnannotatedTypeCast ::= ')'
+/.$putCase consumeRightParenForNameUnannotatedTypeCast(); $break ./
+/:$readableName ):/
+/:$recovery_template ):/
PushRPAREN ::= ')'
/.$putCase consumeRightParen(); $break ./
/:$readableName ):/
/:$recovery_template ):/
+PushRPARENForAnnotatedTypeCast ::= ')'
+/.$putCase consumeRightParenForAnnotatedTypeCast(); $break ./
+/:$readableName ):/
+/:$recovery_template ):/
+
+PushRPARENForNameAndAnnotatedTypeCast ::= ')'
+/.$putCase consumeRightParenForNameAndAnnotatedTypeCast(); $break ./
+/:$readableName ):/
+/:$recovery_template ):/
Primary -> PrimaryNoNewArray
Primary -> ArrayCreationWithArrayInitializer
@@ -1660,6 +1808,7 @@
-- SH}
PrimaryNoNewArray -> FieldAccess
--1.1 feature
+-- javac doesn't permit type annotations here.
PrimaryNoNewArray ::= Name '.' 'this'
/.$putCase consumePrimaryNoNewArrayNameThis(); $break ./
PrimaryNoNewArray ::= Name '.' 'super'
@@ -1690,7 +1839,95 @@
PrimaryNoNewArray -> MethodInvocation
PrimaryNoNewArray -> ArrayAccess
+
+-----------------------------------------------------------------------
+-- Start of rules for JSR 335
+-----------------------------------------------------------------------
+
+PrimaryNoNewArray -> LambdaExpression
+PrimaryNoNewArray -> ReferenceExpression
/:$readableName Expression:/
+
+-- BeginTypeArguments is a synthetic token the scanner concocts to help disambiguate
+-- between '<' as an operator and '<' in '<' TypeArguments '>'
+OnlyTypeArgumentsForReferenceExpression -> BeginTypeArguments OnlyTypeArguments
+/:$readableName OnlyTypeArgumentsForReferenceExpression:/
+/:$compliance 1.8:/
+
+ReferenceExpression ::= PrimitiveType Dims '::' NonWildTypeArgumentsopt IdentifierOrNew
+/.$putCase consumeReferenceExpressionPrimitiveTypeForm(); $break ./
+ReferenceExpression ::= Name Dimsopt '::' NonWildTypeArgumentsopt IdentifierOrNew
+/.$putCase consumeReferenceExpressionNameForm(); $break ./
+ReferenceExpression ::= Name OnlyTypeArgumentsForReferenceExpression Dimsopt '::' NonWildTypeArgumentsopt IdentifierOrNew
+/.$putCase consumeReferenceExpressionTypeForm(false); $break ./
+ReferenceExpression ::= Name OnlyTypeArgumentsForReferenceExpression '.' ClassOrInterfaceType Dimsopt '::' NonWildTypeArgumentsopt IdentifierOrNew
+/.$putCase consumeReferenceExpressionTypeForm(true); $break ./
+ReferenceExpression ::= Primary '::' NonWildTypeArgumentsopt Identifier
+/.$putCase consumeReferenceExpressionPrimaryForm(); $break ./
+ReferenceExpression ::= 'super' '::' NonWildTypeArgumentsopt Identifier
+/.$putCase consumeReferenceExpressionSuperForm(); $break ./
+/:$readableName ReferenceExpression:/
+/:$compliance 1.8:/
+
+NonWildTypeArgumentsopt ::= $empty
+/.$putCase consumeEmptyTypeArguments(); $break ./
+NonWildTypeArgumentsopt -> OnlyTypeArguments
+/:$readableName NonWildTypeArgumentsopt:/
+/:$compliance 1.8:/
+
+IdentifierOrNew ::= 'Identifier'
+/.$putCase consumeIdentifierOrNew(false); $break ./
+IdentifierOrNew ::= 'new'
+/.$putCase consumeIdentifierOrNew(true); $break ./
+/:$readableName IdentifierOrNew:/
+/:$compliance 1.8:/
+
+LambdaExpression ::= LambdaParameters '->' LambdaBody
+/.$putCase consumeLambdaExpression(); $break ./
+/:$readableName LambdaExpression:/
+/:$compliance 1.8:/
+
+LambdaParameters ::= Identifier
+/.$putCase consumeTypeElidedLambdaParameter(false); $break ./
+/:$readableName TypeElidedFormalParameter:/
+/:$compliance 1.8:/
+
+-- to make the grammar LALR(1), the scanner transforms the input string to
+-- contain synthetic tokens to signal start of lambda parameter list.
+LambdaParameters -> BeginLambda PushLPAREN FormalParameterListopt PushRPAREN
+LambdaParameters -> BeginLambda PushLPAREN TypeElidedFormalParameterList PushRPAREN
+/:$readableName LambdaParameters:/
+/:$compliance 1.8:/
+
+TypeElidedFormalParameterList -> TypeElidedFormalParameter
+TypeElidedFormalParameterList ::= TypeElidedFormalParameterList ',' TypeElidedFormalParameter
+/.$putCase consumeFormalParameterList(); $break ./
+/:$readableName TypeElidedFormalParameterList:/
+/:$compliance 1.8:/
+
+-- to work around a shift reduce conflict, we accept Modifiersopt prefixed
+-- identifier - downstream phases should reject input strings with modifiers.
+TypeElidedFormalParameter ::= Modifiersopt Identifier
+/.$putCase consumeTypeElidedLambdaParameter(true); $break ./
+/:$readableName TypeElidedFormalParameter:/
+/:$compliance 1.8:/
+
+-- A lambda body of the form x is really '{' return x; '}'
+LambdaBody -> ElidedLeftBraceAndReturn Expression ElidedSemicolonAndRightBrace
+LambdaBody ::= NestedType NestedMethod '{' BlockStatementsopt '}'
+/.$putCase consumeBlock(); $break ./
+/:$readableName LambdaBody:/
+/:$compliance 1.8:/
+
+ElidedLeftBraceAndReturn ::= $empty
+/.$putCase consumeElidedLeftBraceAndReturn(); $break ./
+/:$readableName ElidedLeftBraceAndReturn:/
+/:$compliance 1.8:/
+
+-----------------------------------------------------------------------
+-- End of rules for JSR 335
+-----------------------------------------------------------------------
+
--1.1 feature
--
-- In Java 1.0 a ClassBody could not appear at all in a
@@ -1756,18 +1993,18 @@
/.$putCase consumeArgumentList(); $break ./
/:$readableName ArgumentList:/
-ArrayCreationHeader ::= 'new' PrimitiveType DimWithOrWithOutExprs
+-- ArrayCreationHeader is used only in recovery and the consume* method is a NOP.
+ArrayCreationHeader ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs
/.$putCase consumeArrayCreationHeader(); $break ./
-
ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
/.$putCase consumeArrayCreationHeader(); $break ./
/:$readableName ArrayCreationHeader:/
-ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
+ArrayCreationWithoutArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs
/.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./
/:$readableName ArrayCreationWithoutArrayInitializer:/
-ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
+ArrayCreationWithArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs ArrayInitializer
/.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./
/:$readableName ArrayCreationWithArrayInitializer:/
@@ -1782,12 +2019,46 @@
/.$putCase consumeDimWithOrWithOutExprs(); $break ./
/:$readableName Dimensions:/
-DimWithOrWithOutExpr ::= '[' Expression ']'
-DimWithOrWithOutExpr ::= '[' ']'
+DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations Expression ']'
+DimWithOrWithOutExpr ::= TypeAnnotations '[' Expression ']'
+/:$compliance 1.8:/
+DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations ']'
/. $putCase consumeDimWithOrWithOutExpr(); $break ./
+DimWithOrWithOutExpr ::= TypeAnnotations '[' ']'
+/. $putCase consumeDimWithOrWithOutExpr(); $break ./
+/:$compliance 1.8:/
/:$readableName Dimension:/
-- -----------------------------------------------
+-- jsr 308
+
+DimsoptAnnotsopt -> $empty
+/. $putCase consumeEmptyDimsoptAnnotsopt(); $break ./
+/:$readableName AnnotationsDimensionsSequence:/
+DimsoptAnnotsopt -> DimsAnnotLoop
+/. $putCase consumeDimsWithTrailingAnnotsopt(); $break ./
+/:$readableName Dimensionsoptannotsopt:/
+DimsAnnotLoop ::= OneDimOrAnnot
+DimsAnnotLoop ::= DimsAnnotLoop OneDimOrAnnot
+/:$readableName DimsAnnotLoop:/
+
+OneDimOrAnnot ::= Annotation
+/. $putCase consumeTypeAnnotation(true); $break ./
+-- Complain if source level < 1.8
+/:$compliance 1.8:/
+OneDimOrAnnot -> '[' ']'
+/. $putCase consumeOneDimLoop(true); $break ./
+-- Bump up dimensions && mark zero annotations.
+/:$readableName OneDimensionOrAnnotation:/
+
+TypeAnnotations ::= Annotation
+/. $putCase consumeTypeAnnotation(false); $break ./
+/:$compliance 1.8:/
+TypeAnnotations ::= TypeAnnotations Annotation
+/. $putCase consumeOneMoreTypeAnnotation(); $break ./
+/:$compliance 1.8:/
+/:$readableName TypeAnnotations:/
+
Dims ::= DimsLoop
/. $putCase consumeDims(); $break ./
/:$readableName Dimensions:/
@@ -1795,8 +2066,14 @@
DimsLoop ::= DimsLoop OneDimLoop
/:$readableName Dimensions:/
OneDimLoop ::= '[' ']'
-/. $putCase consumeOneDimLoop(); $break ./
+/. $putCase consumeOneDimLoop(false); $break ./
+-- Bump up dimensions && mark zero annotations.
/:$readableName Dimension:/
+OneDimLoop ::= TypeAnnotations '[' ']'
+/:$compliance 1.8:/
+/. $putCase consumeOneDimLoopWithAnnotations(); $break ./
+-- Bump up dimensions
+/:$readableName DimensionWithAnnotations:/
FieldAccess ::= Primary '.' 'Identifier'
/.$putCase consumeFieldAccess(false); $break ./
@@ -1904,16 +2181,31 @@
UnaryExpressionNotPlusMinus -> CastExpression
/:$readableName Expression:/
-CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
+CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpression
/.$putCase consumeCastExpressionWithPrimitiveType(); $break ./
-CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression
+/:$compliance 1.8:/
+/.$putCase consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations(); $break ./
+CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
/.$putCase consumeCastExpressionWithGenericsArray(); $break ./
-CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
+CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
+/:$compliance 1.8:/
+/.$putCase consumeCastExpressionWithGenericsArrayWithTypeAnnotations(); $break ./
+CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
/.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./
-CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
+CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpressionWithAnnotatedQualifiedGenerics UnaryExpressionNotPlusMinus
+/:$compliance 1.8:/
+/.$putCase consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations(); $break ./
+CastExpression ::= PushLPAREN Name PushRPARENForNameUnannotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
/.$putCase consumeCastExpressionLL1(); $break ./
-CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+CastExpression ::= PushLPAREN Modifiers Name PushRPARENForNameAndAnnotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
+/:$compliance 1.8:/
+/.$putCase consumeCastExpressionLL1WithTypeAnnotations(); $break ./
+CastExpression ::= PushLPAREN Name Dims PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
/.$putCase consumeCastExpressionWithNameArray(); $break ./
+CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
+/:$compliance 1.8:/
+/.$putCase consumeCastExpressionWithNameArrayWithTypeAnnotations(); $break ./
/:$readableName CastExpression:/
OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
@@ -1930,6 +2222,10 @@
/.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./
/:$readableName InsideCastExpression:/
+InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty
+/.$putCase consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); $break ./
+/:$readableName InsideCastExpression:/
+
MultiplicativeExpression -> UnaryExpression
MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression
/.$putCase consumeBinaryExpression(OperatorIds.MULTIPLY); $break ./
@@ -2052,7 +2348,10 @@
/:$readableName AssignmentOperator:/
/:$recovery_template =:/
-Expression -> AssignmentExpression
+-- For handling lambda expressions, we need to know when a full Expression
+-- has been reduced.
+Expression ::= AssignmentExpression
+/.$putCase consumeExpression(); $break ./
/:$readableName Expression:/
/:$recovery_template Identifier:/
@@ -2232,11 +2531,11 @@
/.$putCase consumeEnhancedForStatement(); $break ./
/:$readableName EnhancedForStatementNoShortIf:/
-EnhancedForStatementHeaderInit ::= 'for' '(' Type PushModifiers Identifier Dimsopt
+EnhancedForStatementHeaderInit ::= 'for' '(' Type0 PushModifiers Identifier Dimsopt
/.$putCase consumeEnhancedForStatementHeaderInit(false); $break ./
/:$readableName EnhancedForStatementHeaderInit:/
-EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type PushRealModifiers Identifier Dimsopt
+EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type0 PushRealModifiers Identifier Dimsopt
/.$putCase consumeEnhancedForStatementHeaderInit(true); $break ./
/:$readableName EnhancedForStatementHeaderInit:/
@@ -2345,8 +2644,11 @@
/:$compliance 1.5:/
ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2
/.$putCase consumeTypeArgumentReferenceType1(); $break ./
-/:$readableName ReferenceType1:/
/:$compliance 1.5:/
+ReferenceType1 ::= Modifiers ClassOrInterface '<' TypeArgumentList2
+/:$compliance 1.8:/
+/.$putCase consumeTypeArgumentReferenceType1WithTypeAnnotations(); $break ./
+/:$readableName ReferenceType1:/
TypeArgumentList2 -> TypeArgument2
/:$compliance 1.5:/
@@ -2366,8 +2668,11 @@
/:$compliance 1.5:/
ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3
/.$putCase consumeTypeArgumentReferenceType2(); $break ./
-/:$readableName ReferenceType2:/
/:$compliance 1.5:/
+ReferenceType2 ::= Modifiers ClassOrInterface '<' TypeArgumentList3
+/:$compliance 1.8:/
+/.$putCase consumeTypeArgumentReferenceType2WithTypeAnnotations(); $break ./
+/:$readableName ReferenceType2:/
TypeArgumentList3 -> TypeArgument3
TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3
@@ -2449,10 +2754,17 @@
/:$readableName WildcardBound3:/
/:$compliance 1.5:/
-TypeParameterHeader ::= Identifier
+PushZeroTypeAnnotations ::= $empty
+/.$putCase consumeZeroTypeAnnotations(true); $break ./
+/:$readableName ZeroTypeAnnotations:/
+
+TypeParameterHeader ::= PushZeroTypeAnnotations Identifier
+/.$putCase consumeTypeParameterHeader(); $break ./
+/:$compliance 1.5:/
+TypeParameterHeader ::= TypeAnnotations Identifier
+/:$compliance 1.8:/
/.$putCase consumeTypeParameterHeader(); $break ./
/:$readableName TypeParameter:/
-/:$compliance 1.5:/
TypeParameters ::= '<' TypeParameterList1
/.$putCase consumeTypeParameters(); $break ./
@@ -2765,7 +3077,7 @@
AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
/.$putCase consumeMethodHeaderNameWithTypeParameters(true); $break ./
-AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
+AnnotationMethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
/.$putCase consumeMethodHeaderName(true); $break ./
/:$readableName MethodHeaderName:/
/:$compliance 1.5:/
@@ -2811,6 +3123,7 @@
/.$putCase consumeAnnotationName() ; $break ./
/:$readableName AnnotationName:/
/:$compliance 1.5:/
+/:$recovery_template @ Identifier:/
NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')'
/.$putCase consumeNormalAnnotation() ; $break ./
@@ -2908,7 +3221,7 @@
RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
/.$putCase consumeRecoveryMethodHeaderNameWithTypeParameters(); $break ./
/:$compliance 1.5:/
-RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
+RecoveryMethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
/.$putCase consumeRecoveryMethodHeaderName(); $break ./
/:$readableName MethodHeaderName:/
@@ -3031,7 +3344,6 @@
-- {ObjectTeams
BINDIN ::= '<-'
-BINDOUT ::= '->'
CALLOUT_OVERRIDE ::= '=>'
-- Markus Witte}