diff options
author | Srikanth | 2012-06-26 22:10:59 +0000 |
---|---|---|
committer | Srikanth | 2012-06-26 22:10:59 +0000 |
commit | 831d96bc5763622ed503192c35bfd6688abedd96 (patch) | |
tree | af2df81f06983050089f97fa289a2235e2ec079b /org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal | |
parent | a11ec54f2e1e149e77b968382e79f482cc29add9 (diff) | |
download | eclipse.jdt.core-831d96bc5763622ed503192c35bfd6688abedd96.tar.gz eclipse.jdt.core-831d96bc5763622ed503192c35bfd6688abedd96.tar.xz eclipse.jdt.core-831d96bc5763622ed503192c35bfd6688abedd96.zip |
Grammar + parser + AST construction + Symbol/Type Resolution changes for
JSR 308.
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal')
67 files changed, 3434 insertions, 675 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java index 04c9835970..1ce84271e8 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -51,6 +55,9 @@ public abstract class ASTVisitor { public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) { // do nothing by default } + public void endVisit(ArrayInitializer arrayInitializer, ClassScope scope) { + // do nothing by default + } public void endVisit( ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope) { @@ -271,12 +278,26 @@ public abstract class ASTVisitor { // do nothing by default } /** + * @param annotation + * @param scope + */ + public void endVisit(MarkerAnnotation annotation, ClassScope scope) { + // do nothing by default + } + /** * @param pair * @param scope */ public void endVisit(MemberValuePair pair, BlockScope scope) { // do nothing by default } + /** + * @param pair + * @param scope + */ + public void endVisit(MemberValuePair pair, ClassScope scope) { + // do nothing by default + } public void endVisit(MessageSend messageSend, BlockScope scope) { // do nothing by default } @@ -294,6 +315,9 @@ public abstract class ASTVisitor { public void endVisit(NormalAnnotation annotation, BlockScope scope) { // do nothing by default } + public void endVisit(NormalAnnotation annotation, ClassScope scope) { + // do nothing by default + } public void endVisit(NullLiteral nullLiteral, BlockScope scope) { // do nothing by default } @@ -374,6 +398,13 @@ public abstract class ASTVisitor { public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) { // do nothing by default } + /** + * @param annotation + * @param scope + */ + public void endVisit(SingleMemberAnnotation annotation, ClassScope scope) { + // do nothing by default + } public void endVisit( SingleNameReference singleNameReference, BlockScope scope) { @@ -493,6 +524,9 @@ public abstract class ASTVisitor { public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) { return true; // do nothing by default, keep traversing } + public boolean visit(ArrayInitializer arrayInitializer, ClassScope scope) { + return true; // do nothing by default, keep traversing + } public boolean visit( ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope) { @@ -713,6 +747,13 @@ public abstract class ASTVisitor { return true; } /** + * @param annotation + * @param scope + */ + public boolean visit(MarkerAnnotation annotation, ClassScope scope) { + return true; + } + /** * @param pair * @param scope * @since 3.1 @@ -720,6 +761,13 @@ public abstract class ASTVisitor { public boolean visit(MemberValuePair pair, BlockScope scope) { return true; } + /** + * @param pair + * @param scope + */ + public boolean visit(MemberValuePair pair, ClassScope scope) { + return true; + } public boolean visit(MessageSend messageSend, BlockScope scope) { return true; // do nothing by default, keep traversing } @@ -739,6 +787,13 @@ public abstract class ASTVisitor { public boolean visit(NormalAnnotation annotation, BlockScope scope) { return true; } + /** + * @param annotation + * @param scope + */ + public boolean visit(NormalAnnotation annotation, ClassScope scope) { + return true; + } public boolean visit(NullLiteral nullLiteral, BlockScope scope) { return true; // do nothing by default, keep traversing } @@ -819,6 +874,13 @@ public abstract class ASTVisitor { public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) { return true; } + /** + * @param annotation + * @param scope + */ + public boolean visit(SingleMemberAnnotation annotation, ClassScope scope) { + return true; + } public boolean visit( SingleNameReference singleNameReference, BlockScope scope) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java index fdc9823f27..071ccdd052 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java @@ -253,6 +253,9 @@ public abstract class ASTNode implements TypeConstants, TypeIds { public static final int INVOCATION_ARGUMENT_UNCHECKED = 1; public static final int INVOCATION_ARGUMENT_WILDCARD = 2; + // for all declarations that can contain type references that have type annotations + public static final int HasTypeAnnotations = Bit21; + // for type reference (diamond case) - Java 7 public static final int IsUnionType = Bit30; // Used to tag ParameterizedSingleTypeReference or ParameterizedQualifiedTypeReference when they are @@ -528,8 +531,15 @@ public abstract class ASTNode implements TypeConstants, TypeIds { public static StringBuffer printAnnotations(Annotation[] annotations, StringBuffer output) { int length = annotations.length; for (int i = 0; i < length; i++) { - annotations[i].print(0, output); - output.append(" "); //$NON-NLS-1$ + if (i > 0) { + output.append(" "); //$NON-NLS-1$ + } + Annotation annotation2 = annotations[i]; + if (annotation2 != null) { + annotation2.print(0, output); + } else { + output.append('?'); + } } return output; } @@ -616,6 +626,25 @@ public abstract class ASTNode implements TypeConstants, TypeIds { local.setAnnotations(annotations, scope); } break; + case Binding.TYPE_PARAMETER : + // jsr308 + ReferenceBinding typeVariableBinding = (ReferenceBinding) recipient; + if ((typeVariableBinding.tagBits & TagBits.AnnotationResolved) != 0) return; + typeVariableBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); + if (length > 0) { + annotations = new AnnotationBinding[length]; + typeVariableBinding.setAnnotations(annotations); + } + break; + case Binding.TYPE_USE : + ReferenceBinding typeUseBinding = (ReferenceBinding) recipient; + if ((typeUseBinding.tagBits & TagBits.AnnotationResolved) != 0) return; + typeUseBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); + if (length > 0) { + annotations = new AnnotationBinding[length]; + typeUseBinding.setAnnotations(annotations); + } + break; default : return; } @@ -712,6 +741,122 @@ public abstract class ASTNode implements TypeConstants, TypeIds { } } + /** + * Resolve annotations, and check duplicates, answers combined tagBits + * for recognized standard annotations + */ + public static void resolveAnnotations(ClassScope scope, Annotation[] sourceAnnotations, Binding recipient) { + AnnotationBinding[] annotations = null; + int length = sourceAnnotations == null ? 0 : sourceAnnotations.length; + if (recipient != null) { + switch (recipient.kind()) { + case Binding.PACKAGE : + PackageBinding packageBinding = (PackageBinding) recipient; + if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return; + packageBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); + break; + case Binding.TYPE : + case Binding.GENERIC_TYPE : + ReferenceBinding type = (ReferenceBinding) recipient; + if ((type.tagBits & TagBits.AnnotationResolved) != 0) return; + type.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); + if (length > 0) { + annotations = new AnnotationBinding[length]; + type.setAnnotations(annotations); + } + break; + case Binding.METHOD : + MethodBinding method = (MethodBinding) recipient; + if ((method.tagBits & TagBits.AnnotationResolved) != 0) return; + method.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); + if (length > 0) { + annotations = new AnnotationBinding[length]; + method.setAnnotations(annotations); + } + break; + case Binding.FIELD : + FieldBinding field = (FieldBinding) recipient; + if ((field.tagBits & TagBits.AnnotationResolved) != 0) return; + field.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); + if (length > 0) { + annotations = new AnnotationBinding[length]; + field.setAnnotations(annotations); + } + break; + case Binding.LOCAL : + LocalVariableBinding local = (LocalVariableBinding) recipient; + if ((local.tagBits & TagBits.AnnotationResolved) != 0) return; + local.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); + if (length > 0) { + annotations = new AnnotationBinding[length]; + local.setAnnotations(annotations, scope); + } + break; + default : + return; + } + } + if (sourceAnnotations == null) + return; + for (int i = 0; i < length; i++) { + Annotation annotation = sourceAnnotations[i]; + final Binding annotationRecipient = annotation.recipient; + if (annotationRecipient != null && recipient != null) { + // only local and field can share annnotations + switch (recipient.kind()) { + case Binding.FIELD : + FieldBinding field = (FieldBinding) recipient; + field.tagBits = ((FieldBinding) annotationRecipient).tagBits; + break; + case Binding.LOCAL : + LocalVariableBinding local = (LocalVariableBinding) recipient; + local.tagBits = ((LocalVariableBinding) annotationRecipient).tagBits; + break; + } + if (annotations != null) { + // need to fill the instances array + annotations[0] = annotation.getCompilerAnnotation(); + for (int j = 1; j < length; j++) { + Annotation annot = sourceAnnotations[j]; + annotations[j] = annot.getCompilerAnnotation(); + } + } + return; + } else { + annotation.recipient = recipient; + annotation.resolveType(scope); + // null if receiver is a package binding + if (annotations != null) { + annotations[i] = annotation.getCompilerAnnotation(); + } + } + } + // check duplicate annotations + if (annotations != null) { + AnnotationBinding[] distinctAnnotations = annotations; // only copy after 1st duplicate is detected + for (int i = 0; i < length; i++) { + AnnotationBinding annotation = distinctAnnotations[i]; + if (annotation == null) continue; + TypeBinding annotationType = annotation.getAnnotationType(); + boolean foundDuplicate = false; + for (int j = i+1; j < length; j++) { + AnnotationBinding otherAnnotation = distinctAnnotations[j]; + if (otherAnnotation == null) continue; + if (otherAnnotation.getAnnotationType() == annotationType) { + foundDuplicate = true; + if (distinctAnnotations == annotations) { + System.arraycopy(distinctAnnotations, 0, distinctAnnotations = new AnnotationBinding[length], 0, length); + } + distinctAnnotations[j] = null; // report it only once + scope.problemReporter().duplicateAnnotation(sourceAnnotations[j]); + } + } + if (foundDuplicate) { + scope.problemReporter().duplicateAnnotation(sourceAnnotations[i]); + } + } + } + } /** * Figures if @Deprecated annotation is specified, do not resolve entire annotations. */ diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java index d4f065e0aa..28c782f992 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for @@ -15,6 +19,8 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import java.util.List; + import org.eclipse.jdt.core.compiler.*; import org.eclipse.jdt.internal.compiler.*; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; @@ -39,6 +45,8 @@ public abstract class AbstractMethodDeclaration public int modifiers; public int modifiersSourceStart; public Annotation[] annotations; + // jsr 308 + public Annotation[] receiverAnnotations; public Argument[] arguments; public TypeReference[] thrownExceptions; public Statement[] statements; @@ -301,6 +309,10 @@ public abstract class AbstractMethodDeclaration classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber); } + public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) { + // do nothing + } + private void checkArgumentsSize() { TypeBinding[] parameters = this.binding.parameters; int size = 1; // an abstract method or a native method cannot be static @@ -396,7 +408,10 @@ public abstract class AbstractMethodDeclaration } printIndent(tab, output); printModifiers(this.modifiers, output); - if (this.annotations != null) printAnnotations(this.annotations, output); + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } TypeParameter[] typeParams = typeParameters(); if (typeParams != null) { @@ -418,6 +433,10 @@ public abstract class AbstractMethodDeclaration } } output.append(')'); + if (this.receiverAnnotations != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.receiverAnnotations, output); + } if (this.thrownExceptions != null) { output.append(" throws "); //$NON-NLS-1$ for (int i = 0; i < this.thrownExceptions.length; i++) { @@ -462,6 +481,14 @@ public abstract class AbstractMethodDeclaration bindThrownExceptions(); resolveJavadoc(); resolveAnnotations(this.scope, this.annotations, this.binding); + // jsr308 + if (this.receiverAnnotations != null && this.scope.isStatic) { + int last = this.receiverAnnotations.length - 1; + this.scope.problemReporter().illegalReceiverAnnotations(this.receiverAnnotations[0], + this.receiverAnnotations[last]); + } + // jsr 308 + resolveAnnotations(this.scope, this.receiverAnnotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); validateNullAnnotations(); resolveStatements(); // check @Deprecated annotation presence diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java index ab66d39ede..71e11ac53b 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -87,7 +91,10 @@ public abstract class AbstractVariableDeclaration extends Statement implements I public StringBuffer printAsExpression(int indent, StringBuffer output) { printIndent(indent, output); printModifiers(this.modifiers, output); - if (this.annotations != null) printAnnotations(this.annotations, output); + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } if (this.type != null) { this.type.print(0, output).append(' '); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java index 1331b11186..132293a774 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for @@ -13,6 +17,8 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import java.util.Stack; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; @@ -25,6 +31,329 @@ import org.eclipse.jdt.internal.compiler.lookup.*; * Annotation */ public abstract class Annotation extends Expression { + + /** + * Return the location for the corresponding annotation inside the type reference, <code>null</code> if none. + */ + public static int[] getLocations( + final TypeReference reference, + final Annotation[] primaryAnnotation, + final Annotation annotation, + final Annotation[][] annotationsOnDimensionsOnExpression) { + class LocationCollector extends ASTVisitor { + Stack currentIndexes; + Annotation currentAnnotation; + boolean search = true; + + public LocationCollector(Annotation currentAnnotation) { + this.currentIndexes = new Stack(); + this.currentAnnotation = currentAnnotation; + } + public boolean visit(ArrayTypeReference typeReference, BlockScope scope) { + if (!this.search) return false; + Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; + if (annotationsOnDimensions != null) { + // check if the annotation is located on the first dimension + Annotation[] annotations = annotationsOnDimensions[0]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + + this.currentIndexes.push(new Integer(0)); + for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { + annotations = annotationsOnDimensions[i]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); + } + } + Annotation[] annotations = typeReference.annotations; + if (annotations == null) { + annotations = primaryAnnotation; + } + if (annotations != null) { + for (int i = 0; i < annotations.length; i++) { + Annotation current = annotations[i]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + this.currentIndexes.pop(); + return true; + } + public boolean visit(ArrayQualifiedTypeReference typeReference, BlockScope scope) { + if (!this.search) return false; + Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; + if (annotationsOnDimensions != null) { + // check if the annotation is located on the first dimension + Annotation[] annotations = annotationsOnDimensions[0]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + + this.currentIndexes.push(new Integer(0)); + for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { + annotations = annotationsOnDimensions[i]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); + } + } + Annotation[] annotations = typeReference.annotations; + if (annotations == null) { + annotations = primaryAnnotation; + } + if (annotations != null) { + for (int i = 0; i < annotations.length; i++) { + Annotation current = annotations[i]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + this.currentIndexes.pop(); + return true; + } + public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) { + if (!this.search) return false; + Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; + if (annotationsOnDimensions != null) { + // check if the annotation is located on the first dimension + Annotation[] annotations = annotationsOnDimensions[0]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + + this.currentIndexes.push(new Integer(0)); + for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { + annotations = annotationsOnDimensions[i]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); + } + } + Annotation[] annotations = typeReference.annotations; + if (annotations == null) { + annotations = primaryAnnotation; + } + if (annotations != null) { + for (int i = 0; i < annotations.length; i++) { + Annotation current = annotations[i]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + TypeReference[] typeReferences = typeReference.typeArguments; + this.currentIndexes.push(new Integer(0)); + for (int i = 0, max = typeReferences.length; i < max; i++) { + typeReferences[i].traverse(this, scope); + if (!this.search) return false; + this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); + } + this.currentIndexes.pop(); + return true; + } + public boolean visit(ParameterizedQualifiedTypeReference typeReference, BlockScope scope) { + if (!this.search) return false; + Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; + if (annotationsOnDimensions != null) { + // check if the annotation is located on the first dimension + Annotation[] annotations = annotationsOnDimensions[0]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + + this.currentIndexes.push(new Integer(0)); + for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { + annotations = annotationsOnDimensions[i]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); + } + } + Annotation[] annotations = typeReference.annotations; + if (annotations == null) { + annotations = primaryAnnotation; + } + if (annotations != null) { + for (int i = 0; i < annotations.length; i++) { + Annotation current = annotations[i]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + //TODO it is unclear how to manage annotations located in the first type arguments + TypeReference[] typeReferences = typeReference.typeArguments[typeReference.typeArguments.length - 1]; + this.currentIndexes.push(new Integer(0)); + for (int i = 0, max = typeReferences.length; i < max; i++) { + typeReferences[i].traverse(this, scope); + if (!this.search) return false; + this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); + } + this.currentIndexes.pop(); + return true; + } + public boolean visit(SingleTypeReference typeReference, BlockScope scope) { + if (!this.search) return false; + Annotation[][] annotationsOnDimensions = annotationsOnDimensionsOnExpression; + if (annotationsOnDimensions != null) { + // check if the annotation is located on the first dimension + Annotation[] annotations = annotationsOnDimensions[0]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + + this.currentIndexes.push(new Integer(0)); + for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { + annotations = annotationsOnDimensions[i]; + if (annotations != null) { + for (int j = 0, max2 = annotations.length; j < max2; j++) { + Annotation current = annotations[j]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); + } + } + Annotation[] annotations = typeReference.annotations; + if (annotations != null) { + for (int i = 0; i < annotations.length; i++) { + Annotation current = annotations[i]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + return false; + } + public boolean visit(Wildcard typeReference, BlockScope scope) { + if (!this.search) return false; + TypeReference bound = typeReference.bound; + bound.traverse(this, scope); + return true; + } + public boolean visit(QualifiedTypeReference typeReference, BlockScope scope) { + if (!this.search) return false; + Annotation[] annotations = typeReference.annotations; + if (annotations != null) { + for (int i = 0; i < annotations.length; i++) { + Annotation current = annotations[i]; + if (current == this.currentAnnotation) { + this.search = false; + return false; + } + } + } + return true; + } + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer + .append("search location for ") //$NON-NLS-1$ + .append(this.currentAnnotation) + .append("\ncurrent indexes : ") //$NON-NLS-1$ + .append(this.currentIndexes); + return String.valueOf(buffer); + } + } + if (reference == null) return null; + LocationCollector collector = new LocationCollector(annotation); + reference.traverse(collector, (BlockScope) null); + if (collector.currentIndexes.isEmpty()) { + return null; + } + int size = collector.currentIndexes.size(); + int[] result = new int[size]; + for (int i = 0; i < size; i++) { + result[size - i - 1] = ((Integer) collector.currentIndexes.pop()).intValue(); + } + return result; + } + + // jsr 308 + public static class TypeUseBinding extends ReferenceBinding { + private int kind; + public TypeUseBinding(int kind) { + this.tagBits = 0L; + this.kind = kind; + } + public int kind() { + return this.kind; + } + public boolean hasTypeBit(int bit) { + // TODO Auto-generated method stub + return false; + } + } final static MemberValuePair[] NoValuePairs = new MemberValuePair[0]; private static final long TAGBITS_NULLABLE_OR_NONNULL = TagBits.AnnotationNullable|TagBits.AnnotationNonNull; @@ -91,6 +420,10 @@ public abstract class Annotation extends Expression { case 'T' : if (CharOperation.equals(elementName, TypeConstants.TYPE)) return TagBits.AnnotationForType; + if (CharOperation.equals(elementName, TypeConstants.TYPE_USE_TARGET)) + return TagBits.AnnotationForTypeUse; + if (CharOperation.equals(elementName, TypeConstants.TYPE_PARAMETER_TARGET)) + return TagBits.AnnotationForTypeParameter; break; } return 0; // unknown @@ -202,18 +535,62 @@ public abstract class Annotation extends Expression { return false; } long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference + // jsr 308 + // we need to filter out type use and type parameter annotations + if ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) != 0) { + return false; + } + + if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) + return true; // by default the retention is CLASS + + return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention; + } + + public boolean isRuntimeTypeInvisible() { + final TypeBinding annotationBinding = this.resolvedType; + if (annotationBinding == null) { + return false; + } + long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference + // jsr 308 + // we need to filter out type use and type parameter annotations + if ((metaTagBits & (TagBits.AnnotationTargetMASK)) != 0 + && ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) == 0)) { + return false; + } + if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) return true; // by default the retention is CLASS return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention; } + public boolean isRuntimeTypeVisible() { + final TypeBinding annotationBinding = this.resolvedType; + if (annotationBinding == null) { + return false; + } + long metaTagBits = annotationBinding.getAnnotationTagBits(); + if ((metaTagBits & (TagBits.AnnotationTargetMASK)) != 0 + && ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) == 0)) { + return false; + } + if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) + return false; // by default the retention is CLASS + + return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention; + } + public boolean isRuntimeVisible() { final TypeBinding annotationBinding = this.resolvedType; if (annotationBinding == null) { return false; } long metaTagBits = annotationBinding.getAnnotationTagBits(); + if ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) != 0) { + return false; + } if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) return false; // by default the retention is CLASS @@ -341,16 +718,19 @@ public abstract class Annotation extends Expression { } } } - if (!foundValue && - (method.modifiers & ClassFileConstants.AccAnnotationDefault) == 0 && - (this.bits & IsRecovered) == 0) { + if (!foundValue + && (method.modifiers & ClassFileConstants.AccAnnotationDefault) == 0 + && (this.bits & IsRecovered) == 0 + && annotationType.isValidBinding()) { scope.problemReporter().missingValueForAnnotationMember(this, selector); } } // check unused pairs for (int i = 0; i < pairsLength; i++) { if (pairs[i] != null) { - scope.problemReporter().undefinedAnnotationValue(annotationType, pairs[i]); + if (annotationType.isValidBinding()) { + scope.problemReporter().undefinedAnnotationValue(annotationType, pairs[i]); + } pairs[i].resolveTypeExpecting(scope, null); // resilient } } @@ -421,19 +801,32 @@ public abstract class Annotation extends Expression { } // check (meta)target compatibility checkTargetCompatibility: { + if (!annotationType.isValidBinding()) { + // no need to check annotation usage if missing + break checkTargetCompatibility; + } + long metaTagBits = annotationType.getAnnotationTagBits(); // could be forward reference - if ((metaTagBits & TagBits.AnnotationTargetMASK) == 0) // does not specify any target restriction + if ((metaTagBits & TagBits.AnnotationTargetMASK) == 0) { + // does not specify any target restriction - all locations are possible including type annotations break checkTargetCompatibility; + } switch (this.recipient.kind()) { case Binding.PACKAGE : if ((metaTagBits & TagBits.AnnotationForPackage) != 0) break checkTargetCompatibility; break; + case Binding.TYPE_USE : + if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { + // jsr 308 + break checkTargetCompatibility; + } + break; case Binding.TYPE : case Binding.GENERIC_TYPE : if (((ReferenceBinding)this.recipient).isAnnotationType()) { - if ((metaTagBits & (TagBits.AnnotationForAnnotationType|TagBits.AnnotationForType)) != 0) + if ((metaTagBits & (TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType)) != 0) break checkTargetCompatibility; } else if ((metaTagBits & TagBits.AnnotationForType) != 0) { break checkTargetCompatibility; @@ -443,24 +836,48 @@ public abstract class Annotation extends Expression { } break; case Binding.METHOD : - if (((MethodBinding)this.recipient).isConstructor()) { + MethodBinding methodBinding = (MethodBinding) this.recipient; + if (methodBinding.isConstructor()) { if ((metaTagBits & TagBits.AnnotationForConstructor) != 0) break checkTargetCompatibility; - } else if ((metaTagBits & TagBits.AnnotationForMethod) != 0) + } else if ((metaTagBits & TagBits.AnnotationForMethod) != 0) { break checkTargetCompatibility; + } else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { + // jsr 308 - annotation on method return type + if (methodBinding.returnType != null && methodBinding.returnType.id == T_void) { + scope.problemReporter().illegalUsageOfTypeAnnotations(this); + } + break checkTargetCompatibility; + } break; case Binding.FIELD : - if ((metaTagBits & TagBits.AnnotationForField) != 0) + if ((metaTagBits & TagBits.AnnotationForField) != 0) { + break checkTargetCompatibility; + } else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { + // jsr 308 - annotation on field type break checkTargetCompatibility; + } break; case Binding.LOCAL : if ((((LocalVariableBinding)this.recipient).tagBits & TagBits.IsArgument) != 0) { - if ((metaTagBits & TagBits.AnnotationForParameter) != 0) + if ((metaTagBits & TagBits.AnnotationForParameter) != 0) { + break checkTargetCompatibility; + } else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { + // jsr 308 - annotation on method parameter type break checkTargetCompatibility; - } else if ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0) + } + } else if ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0) { break checkTargetCompatibility; + } else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { + // jsr 308 - annotation on local type + break checkTargetCompatibility; + } break; - } + case Binding.TYPE_PARAMETER : // jsr308 + if ((metaTagBits & TagBits.AnnotationForTypeParameter) != 0) { + break checkTargetCompatibility; + } + } scope.problemReporter().disallowedTargetForAnnotation(this); } } @@ -469,4 +886,5 @@ public abstract class Annotation extends Expression { public abstract void traverse(ASTVisitor visitor, BlockScope scope); + public abstract void traverse(ASTVisitor visitor, ClassScope scope); } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java index 8860ec6260..69840bbdd1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -55,7 +59,10 @@ public class AnnotationMethodDeclaration extends MethodDeclaration { printIndent(tab, output); printModifiers(this.modifiers, output); - if (this.annotations != null) printAnnotations(this.annotations, output); + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } TypeParameter[] typeParams = typeParameters(); if (typeParams != null) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java index 0eaad4a054..8c96cec8b6 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java @@ -34,6 +34,9 @@ public class Argument extends LocalDeclaration { this.declarationSourceEnd = (int) posNom; this.modifiers = modifiers; this.type = tr; + if (tr != null) { + this.bits |= (tr.bits & ASTNode.HasTypeAnnotations); + } this.bits |= (IsLocalDeclarationReachable | IsArgument); } @@ -43,6 +46,9 @@ public class Argument extends LocalDeclaration { this.declarationSourceEnd = (int) posNom; this.modifiers = modifiers; this.type = tr; + if (tr != null) { + this.bits |= (tr.bits & ASTNode.HasTypeAnnotations); + } this.bits |= (IsLocalDeclarationReachable | IsArgument | IsTypeElided); } @@ -97,6 +103,10 @@ public class Argument extends LocalDeclaration { return (this.bits & ASTNode.IsArgument) != 0 ? PARAMETER : LOCAL_VARIABLE; } + public boolean isArgument() { + return true; + } + public boolean isVarArgs() { return this.type != null && (this.type.bits & IsVarArgs) != 0; } @@ -105,7 +115,10 @@ public class Argument extends LocalDeclaration { printIndent(indent, output); printModifiers(this.modifiers, output); - if (this.annotations != null) printAnnotations(this.annotations, output); + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } if (this.type == null) { output.append("<no type> "); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java index a7af1885f5..664cbac837 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE @@ -24,6 +28,7 @@ public class ArrayAllocationExpression extends Expression { //dimensions.length gives the number of dimensions, but the // last ones may be nulled as in new int[4][5][][] public Expression[] dimensions; + public Annotation [][] annotationsOnDimensions; // jsr308 style annotations. public ArrayInitializer initializer; public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { @@ -83,6 +88,11 @@ public class ArrayAllocationExpression extends Expression { output.append("new "); //$NON-NLS-1$ this.type.print(0, output); for (int i = 0; i < this.dimensions.length; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(' '); + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(' '); + } if (this.dimensions[i] == null) output.append("[]"); //$NON-NLS-1$ else { @@ -163,6 +173,12 @@ public class ArrayAllocationExpression extends Expression { return null; } } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations = this.annotationsOnDimensions[i]; + resolveAnnotations(scope, annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + } + } return this.resolvedType; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java index 803966a05c..cfca32742e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -17,17 +21,29 @@ import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; public class ArrayQualifiedTypeReference extends QualifiedTypeReference { int dimensions; + Annotation[][] annotationsOnDimensions; // jsr308 style type annotations on dimensions public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) { super( sources , poss); this.dimensions = dim ; + this.annotationsOnDimensions = null; + } + + public ArrayQualifiedTypeReference(char[][] sources, int dim, Annotation[][] annotationsOnDimensions, long[] poss) { + this(sources, dim, poss); + this.annotationsOnDimensions = annotationsOnDimensions; + this.bits |= ASTNode.HasTypeAnnotations; } public int dimensions() { return this.dimensions; } + + public Annotation[][] getAnnotationsOnDimensions() { + return this.annotationsOnDimensions; + } /** * @return char[][] @@ -70,16 +86,47 @@ public class ArrayQualifiedTypeReference extends QualifiedTypeReference { } } + protected TypeBinding internalResolveType(Scope scope) { + TypeBinding internalResolveType = super.internalResolveType(scope); + if (this.annotationsOnDimensions != null) { + switch(scope.kind) { + case Scope.BLOCK_SCOPE : + case Scope.METHOD_SCOPE : + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i]; + resolveAnnotations((BlockScope) scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + } + break; + } + } + return internalResolveType; + } + public StringBuffer printExpression(int indent, StringBuffer output){ super.printExpression(indent, output); if ((this.bits & IsVarArgs) != 0) { for (int i= 0 ; i < this.dimensions - 1; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(' '); + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(' '); + } output.append("[]"); //$NON-NLS-1$ } + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) { + output.append(' '); + printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output); + output.append(' '); + } output.append("..."); //$NON-NLS-1$ } else { for (int i= 0 ; i < this.dimensions; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(" "); //$NON-NLS-1$ + } output.append("[]"); //$NON-NLS-1$ } } @@ -87,14 +134,52 @@ public class ArrayQualifiedTypeReference extends QualifiedTypeReference { } public void traverse(ASTVisitor visitor, BlockScope scope) { - - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } + } visitor.endVisit(this, scope); } public void traverse(ASTVisitor visitor, ClassScope scope) { - - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } + } visitor.endVisit(this, scope); } + + protected void resolveAnnotations(BlockScope scope) { + super.resolveAnnotations(scope); + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i]; + resolveAnnotations(scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + } + } + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java index fa6c8d5b7f..18f9ce80e6 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -12,6 +16,7 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.ClassScope; import org.eclipse.jdt.internal.compiler.lookup.Scope; @@ -19,6 +24,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class ArrayTypeReference extends SingleTypeReference { public int dimensions; + public Annotation[][] annotationsOnDimensions; // jsr308 style type annotations on dimensions. public int originalSourceEnd; /** @@ -32,12 +38,25 @@ public class ArrayTypeReference extends SingleTypeReference { super(source, pos); this.originalSourceEnd = this.sourceEnd; this.dimensions = dimensions ; + this.annotationsOnDimensions = null; + } + + public ArrayTypeReference(char[] source, int dimensions, Annotation[][] annotationsOnDimensions, long pos) { + this(source, dimensions, pos); + if (annotationsOnDimensions != null) { + this.bits |= ASTNode.HasTypeAnnotations; + } + this.annotationsOnDimensions = annotationsOnDimensions; } public int dimensions() { return this.dimensions; } + + public Annotation[][] getAnnotationsOnDimensions() { + return this.annotationsOnDimensions; + } /** * @return char[][] */ @@ -69,11 +88,26 @@ public class ArrayTypeReference extends SingleTypeReference { super.printExpression(indent, output); if ((this.bits & IsVarArgs) != 0) { for (int i= 0 ; i < this.dimensions - 1; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(' '); + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(' '); + } output.append("[]"); //$NON-NLS-1$ } + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) { + output.append(' '); + printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output); + output.append(' '); + } output.append("..."); //$NON-NLS-1$ } else { for (int i= 0 ; i < this.dimensions; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(" "); //$NON-NLS-1$ + } output.append("[]"); //$NON-NLS-1$ } } @@ -81,14 +115,71 @@ public class ArrayTypeReference extends SingleTypeReference { } public void traverse(ASTVisitor visitor, BlockScope scope) { - - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + if (annotations2 != null) { + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } + } + } visitor.endVisit(this, scope); } public void traverse(ASTVisitor visitor, ClassScope scope) { - - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + if (annotations2 != null) { + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } + } + } visitor.endVisit(this, scope); } + + protected TypeBinding internalResolveType(Scope scope) { + TypeBinding internalResolveType = super.internalResolveType(scope); + if (this.annotationsOnDimensions != null) { + switch(scope.kind) { + case Scope.BLOCK_SCOPE : + case Scope.METHOD_SCOPE : + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i]; + resolveAnnotations((BlockScope) scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + } + break; + } + } + return internalResolveType; + } + protected void resolveAnnotations(BlockScope scope) { + super.resolveAnnotations(scope); + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i]; + resolveAnnotations(scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + } + } + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java index 17d5ffa10d..19dc05386f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java @@ -5,14 +5,21 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import java.util.List; + import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.*; +import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.*; import org.eclipse.jdt.internal.compiler.flow.*; @@ -109,7 +116,13 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) { } codeStream.recordPositionsFrom(pc, this.sourceStart); } - +public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts); + for (int i = 0, max = this.annotations.length; i < max; i++) { + Annotation annotation = this.annotations[i]; + annotation.traverse(collector, (BlockScope) null); + } +} /** * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#getKind() */ diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java index 6cb2c1634b..8a14ea4853 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java @@ -5,6 +5,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -87,7 +90,10 @@ public class Initializer extends FieldDeclaration { if (this.modifiers != 0) { printIndent(indent, output); printModifiers(this.modifiers, output); - if (this.annotations != null) printAnnotations(this.annotations, output); + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } output.append("{\n"); //$NON-NLS-1$ if (this.block != null) { this.block.printBody(indent, output); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java index 696a693658..7f985aa6e4 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -30,6 +34,10 @@ public class JavadocImplicitTypeReference extends TypeReference { public TypeReference copyDims(int dim) { return null; } + + public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) { + return null; + } /* (non-Javadoc) * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope) diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java index 48723a64a0..9e044ebc2d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for @@ -19,8 +23,11 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import java.util.List; + import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.*; +import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.*; import org.eclipse.jdt.internal.compiler.flow.*; @@ -189,11 +196,25 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl return LOCAL_VARIABLE; } + // for local variables + public void getAllAnnotationContexts(int targetType, LocalVariableBinding localVariable, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, localVariable, allAnnotationContexts); + this.traverse(collector, (BlockScope) null); + } + // for arguments + public void getAllAnnotationContexts(int targetType, int parameterIndex, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, parameterIndex, allAnnotationContexts); + this.traverse(collector, (BlockScope) null); + } + public boolean isArgument() { + return false; + } public void resolve(BlockScope scope) { // create a binding and add it to the scope TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/); + this.bits |= (this.type.bits & ASTNode.HasTypeAnnotations); checkModifiers(); if (variableType != null) { if (variableType == TypeBinding.VOID) { @@ -282,6 +303,11 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl } // only resolve annotation at the end, for constant to be positioned before (96991) resolveAnnotations(scope, this.annotations, this.binding); + // jsr 308 + Annotation[] typeAnnotations = this.type.annotations; + if (typeAnnotations != null) { + ASTNode.resolveAnnotations(scope, typeAnnotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + } scope.validateNullAnnotation(this.binding.tagBits, this.type, this.annotations); } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java index 2a48484942..eae5b91a4d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -42,4 +46,12 @@ public class MarkerAnnotation extends Annotation { } visitor.endVisit(this, scope); } + public void traverse(ASTVisitor visitor, ClassScope scope) { + if (visitor.visit(this, scope)) { + if (this.type != null) { + this.type.traverse(visitor, scope); + } + } + visitor.endVisit(this, scope); + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java index e0f7cfb01c..53c7b16659 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for @@ -17,6 +21,7 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; @@ -241,4 +246,12 @@ public class MemberValuePair extends ASTNode { } visitor.endVisit(this, scope); } + public void traverse(ASTVisitor visitor, ClassScope scope) { + if (visitor.visit(this, scope)) { + if (this.value != null) { + this.value.traverse(visitor, scope); + } + } + visitor.endVisit(this, scope); + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java index a488177473..93256efba3 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for @@ -15,6 +19,8 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import java.util.List; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.CompilationResult; @@ -24,6 +30,7 @@ import org.eclipse.jdt.internal.compiler.flow.FlowContext; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.ClassScope; import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; @@ -35,6 +42,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.parser.Parser; import org.eclipse.jdt.internal.compiler.problem.AbortMethod; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; +import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; public class MethodDeclaration extends AbstractMethodDeclaration { @@ -88,6 +96,7 @@ public class MethodDeclaration extends AbstractMethodDeclaration { if (this.arguments != null) { for (int i = 0, count = this.arguments.length; i < count; i++) { + this.bits |= (this.arguments[i].bits & ASTNode.HasTypeAnnotations); // if this method uses a type parameter declared by the declaring class, // it can't be static. https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682 if (this.arguments[i].binding != null && (this.arguments[i].binding.type instanceof TypeVariableBinding)) { @@ -146,6 +155,14 @@ public class MethodDeclaration extends AbstractMethodDeclaration { } } + public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts); + for (int i = 0, max = this.annotations.length; i < max; i++) { + Annotation annotation = this.annotations[i]; + annotation.traverse(collector, (BlockScope) null); + } + } + public boolean isMethod() { return true; } @@ -163,6 +180,7 @@ public class MethodDeclaration extends AbstractMethodDeclaration { public void resolveStatements() { // ========= abort on fatal error ============= if (this.returnType != null && this.binding != null) { + this.bits |= (this.returnType.bits & ASTNode.HasTypeAnnotations); this.returnType.resolvedType = this.binding.returnType; // record the return type binding } @@ -177,7 +195,10 @@ public class MethodDeclaration extends AbstractMethodDeclaration { } if (this.typeParameters != null) { for (int i = 0, length = this.typeParameters.length; i < length; i++) { - this.typeParameters[i].resolve(this.scope); + TypeParameter typeParameter = this.typeParameters[i]; + this.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations); + typeParameter.resolve(this.scope); + typeParameter.resolveAnnotations(this.scope); if (returnsUndeclTypeVar && this.typeParameters[i].binding == this.returnType.resolvedType) { returnsUndeclTypeVar = false; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java index a1d1bd19b7..381cc9add7 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -71,4 +75,17 @@ public class NormalAnnotation extends Annotation { } visitor.endVisit(this, scope); } + public void traverse(ASTVisitor visitor, ClassScope scope) { + if (visitor.visit(this, scope)) { + if (this.type != null) { + this.type.traverse(visitor, scope); + } + if (this.memberValuePairs != null) { + int memberValuePairsLength = this.memberValuePairs.length; + for (int i = 0; i < memberValuePairsLength; i++) + this.memberValuePairs[i].traverse(visitor, scope); + } + } + visitor.endVisit(this, scope); + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java index e1cd52ef86..b396b556d0 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for Bug 342671 - ClassCastException: org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ArrayBinding @@ -35,6 +39,13 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer super(tokens, dim, positions); this.typeArguments = typeArguments; } + public ParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, int dim, Annotation[][] annotationsOnDimensions, long[] positions) { + this(tokens, typeArguments, dim, positions); + this.annotationsOnDimensions = annotationsOnDimensions; + if (annotationsOnDimensions != null) { + this.bits |= ASTNode.HasTypeAnnotations; + } + } public void checkBounds(Scope scope) { if (this.resolvedType == null) return; @@ -60,6 +71,17 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer public TypeReference copyDims(int dim){ return new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, this.sourcePositions); } + public TypeReference copyDims(int dim, Annotation[][] dimensionAnnotations){ + ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, dimensionAnnotations, this.sourcePositions); + parameterizedQualifiedTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations); + if (dimensionAnnotations != null) { + parameterizedQualifiedTypeReference.bits |= ASTNode.HasTypeAnnotations; + } + return parameterizedQualifiedTypeReference; + } + public boolean isParameterizedTypeReference() { + return true; + } /** * @return char[][] @@ -129,6 +151,14 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer } } this.bits |= ASTNode.DidResolve; + if (this.annotations != null) { + switch(scope.kind) { + case Scope.BLOCK_SCOPE : + case Scope.METHOD_SCOPE : + resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + break; + } + } TypeBinding type = internalResolveLeafType(scope, checkBounds); createArrayType(scope); return type == null ? type : this.resolvedType; @@ -300,6 +330,11 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer } public StringBuffer printExpression(int indent, StringBuffer output) { + if (this.annotations != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotations, output); + output.append(' '); + } int length = this.tokens.length; for (int i = 0; i < length - 1; i++) { output.append(this.tokens[i]); @@ -336,11 +371,26 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer } if ((this.bits & IsVarArgs) != 0) { for (int i= 0 ; i < this.dimensions - 1; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(" "); //$NON-NLS-1$ + } output.append("[]"); //$NON-NLS-1$ } + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output); + output.append(" "); //$NON-NLS-1$ + } output.append("..."); //$NON-NLS-1$ } else { for (int i= 0 ; i < this.dimensions; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(" "); //$NON-NLS-1$ + } output.append("[]"); //$NON-NLS-1$ } } @@ -355,6 +405,20 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer } public void traverse(ASTVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } for (int i = 0, max = this.typeArguments.length; i < max; i++) { if (this.typeArguments[i] != null) { for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) { @@ -368,6 +432,20 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer public void traverse(ASTVisitor visitor, ClassScope scope) { if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } for (int i = 0, max = this.typeArguments.length; i < max; i++) { if (this.typeArguments[i] != null) { for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java index 40bdc8612d..8d7ae99d1c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for Bug 342671 - ClassCastException: org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ArrayBinding @@ -30,6 +34,13 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { this.originalSourceEnd = this.sourceEnd; this.typeArguments = typeArguments; } + public ParameterizedSingleTypeReference(char[] name, TypeReference[] typeArguments, int dim, Annotation[][] annotationsOnDimensions, long pos) { + this(name, typeArguments, dim, pos); + this.annotationsOnDimensions = annotationsOnDimensions; + if (annotationsOnDimensions != null) { + this.bits |= ASTNode.HasTypeAnnotations; + } + } public void checkBounds(Scope scope) { if (this.resolvedType == null) return; @@ -49,6 +60,14 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { public TypeReference copyDims(int dim) { return new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, (((long)this.sourceStart)<<32)+this.sourceEnd); } + public TypeReference copyDims(int dim, Annotation [][] annotationsOnDims) { + ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, annotationsOnDims, (((long)this.sourceStart)<<32)+this.sourceEnd); + parameterizedSingleTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations); + if (annotationsOnDims != null) { + parameterizedSingleTypeReference.bits |= ASTNode.HasTypeAnnotations; + } + return parameterizedSingleTypeReference; + } /** * @return char[][] @@ -82,6 +101,10 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { protected TypeBinding getTypeBinding(Scope scope) { return null; // not supported here - combined with resolveType(...) } + + public boolean isParameterizedTypeReference() { + return true; + } /* * No need to check for reference to raw type per construction @@ -107,6 +130,14 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { } } this.bits |= ASTNode.DidResolve; + if (this.annotations != null) { + switch(scope.kind) { + case Scope.BLOCK_SCOPE : + case Scope.METHOD_SCOPE : + resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + break; + } + } TypeBinding type = internalResolveLeafType(scope, enclosingType, checkBounds); // handle three different outcomes: if (type == null) { @@ -190,6 +221,7 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { TypeBinding argType = isClassScope ? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i) : typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i); + this.bits |= (typeArgument.bits & ASTNode.HasTypeAnnotations); if (argType == null) { argHasError = true; } else { @@ -261,8 +293,19 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { } return type; } + + protected void resolveAnnotations(BlockScope scope) { + super.resolveAnnotations(scope); + for (int i = 0, length = this.typeArguments.length; i < length; i++) { + this.typeArguments[i].resolveAnnotations(scope); + } + } public StringBuffer printExpression(int indent, StringBuffer output){ + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } output.append(this.token); output.append("<"); //$NON-NLS-1$ int length = this.typeArguments.length; @@ -277,11 +320,26 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { output.append(">"); //$NON-NLS-1$ if ((this.bits & IsVarArgs) != 0) { for (int i= 0 ; i < this.dimensions - 1; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(" "); //$NON-NLS-1$ + } output.append("[]"); //$NON-NLS-1$ } + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output); + output.append(" "); //$NON-NLS-1$ + } output.append("..."); //$NON-NLS-1$ } else { for (int i= 0 ; i < this.dimensions; i++) { + if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { + output.append(" "); //$NON-NLS-1$ + printAnnotations(this.annotationsOnDimensions[i], output); + output.append(" "); //$NON-NLS-1$ + } output.append("[]"); //$NON-NLS-1$ } } @@ -302,6 +360,22 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { public void traverse(ASTVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + if (annotations2 != null) { + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } + } for (int i = 0, max = this.typeArguments.length; i < max; i++) { this.typeArguments[i].traverse(visitor, scope); } @@ -311,6 +385,20 @@ public class ParameterizedSingleTypeReference extends ArrayTypeReference { public void traverse(ASTVisitor visitor, ClassScope scope) { if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + if (this.annotationsOnDimensions != null) { + for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotations2 = this.annotationsOnDimensions[i]; + for (int j = 0, max2 = annotations2.length; j < max2; j++) { + Annotation annotation = annotations2[j]; + annotation.traverse(visitor, scope); + } + } + } for (int i = 0, max = this.typeArguments.length; i < max; i++) { this.typeArguments[i].traverse(visitor, scope); } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java index f6d5e3ebab..1ac39c922c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -33,6 +37,17 @@ public class QualifiedTypeReference extends TypeReference { //warning : the new type ref has a null binding return new ArrayQualifiedTypeReference(this.tokens, dim, this.sourcePositions); } + + public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) { + //return a type reference copy of me with some dimensions + //warning : the new type ref has a null binding + ArrayQualifiedTypeReference arrayQualifiedTypeReference = new ArrayQualifiedTypeReference(this.tokens, dim, annotationsOnDimensions, this.sourcePositions); + arrayQualifiedTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations); + if (annotationsOnDimensions != null) { + arrayQualifiedTypeReference.bits |= ASTNode.HasTypeAnnotations; + } + return arrayQualifiedTypeReference; + } protected TypeBinding findNextTypeBinding(int tokenIndex, Scope scope, PackageBinding packageBinding) { LookupEnvironment env = scope.environment(); @@ -122,7 +137,10 @@ public class QualifiedTypeReference extends TypeReference { } public StringBuffer printExpression(int indent, StringBuffer output) { - + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } for (int i = 0; i < this.tokens.length; i++) { if (i > 0) output.append('.'); output.append(this.tokens[i]); @@ -131,14 +149,24 @@ public class QualifiedTypeReference extends TypeReference { } public void traverse(ASTVisitor visitor, BlockScope scope) { - - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + } visitor.endVisit(this, scope); } public void traverse(ASTVisitor visitor, ClassScope scope) { - - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + } visitor.endVisit(this, scope); } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java index e64bf0c534..2eff389161 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -62,4 +66,16 @@ public class SingleMemberAnnotation extends Annotation { } visitor.endVisit(this, scope); } + + public void traverse(ASTVisitor visitor, ClassScope scope) { + if (visitor.visit(this, scope)) { + if (this.type != null) { + this.type.traverse(visitor, scope); + } + if (this.memberValue != null) { + this.memberValue.traverse(visitor, scope); + } + } + visitor.endVisit(this, scope); + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java index 9d3b703dd3..dc1b822bf9 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -33,6 +37,17 @@ public class SingleTypeReference extends TypeReference { return new ArrayTypeReference(this.token, dim,(((long)this.sourceStart)<<32)+this.sourceEnd); } + + public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){ + //return a type reference copy of me with some dimensions + //warning : the new type ref has a null binding + ArrayTypeReference arrayTypeReference = new ArrayTypeReference(this.token, dim, annotationsOnDimensions, (((long)this.sourceStart)<<32)+this.sourceEnd); + arrayTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations); + if (annotationsOnDimensions != null) { + arrayTypeReference.bits |= ASTNode.HasTypeAnnotations; + } + return arrayTypeReference; + } public char[] getLastToken() { return this.token; @@ -54,7 +69,10 @@ public class SingleTypeReference extends TypeReference { } public StringBuffer printExpression(int indent, StringBuffer output){ - + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } return output.append(this.token); } @@ -85,12 +103,24 @@ public class SingleTypeReference extends TypeReference { } public void traverse(ASTVisitor visitor, BlockScope scope) { - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + } visitor.endVisit(this, scope); } public void traverse(ASTVisitor visitor, ClassScope scope) { - visitor.visit(this, scope); + if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } + } visitor.endVisit(this, scope); } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java index a694c1abdf..e8c3207dc9 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for Bug 360328 - [compiler][null] detect null problems in nested code (local class inside a loop) @@ -906,7 +910,10 @@ public StringBuffer printBody(int indent, StringBuffer output) { public StringBuffer printHeader(int indent, StringBuffer output) { printModifiers(this.modifiers, output); - if (this.annotations != null) printAnnotations(this.annotations, output); + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } switch (kind(this.modifiers)) { case TypeDeclaration.CLASS_DECL : @@ -971,6 +978,19 @@ public void resolve() { try { this.staticInitializerScope.insideTypeAnnotation = true; resolveAnnotations(this.staticInitializerScope, this.annotations, sourceType); + if (this.superclass != null) { + this.superclass.resolveAnnotations(this.staticInitializerScope); + } + if (this.superInterfaces != null) { + for (int i = 0, max = this.superInterfaces.length; i < max; i++) { + this.superInterfaces[i].resolveAnnotations(this.staticInitializerScope); + } + } + if (this.typeParameters != null) { + for (int i = 0, count = this.typeParameters.length; i < count; i++) { + this.typeParameters[i].resolveAnnotations(this.staticInitializerScope); + } + } } finally { this.staticInitializerScope.insideTypeAnnotation = old; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java index 37edacc0ef..29edabdff9 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java @@ -1,16 +1,24 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import java.util.List; + import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; +import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; @@ -42,6 +50,36 @@ public class TypeParameter extends AbstractVariableDeclaration { } } + public void getAllAnnotationContexts(int targetType, int typeParameterIndex, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, typeParameterIndex, allAnnotationContexts); + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(collector, (BlockScope) null); + } + switch(collector.targetType) { + case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER : + collector.targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND; + break; + case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER : + collector.targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND; + } + if (this.type != null && ((this.type.bits & ASTNode.HasTypeAnnotations) != 0)) { + collector.info2 = 0; + this.type.traverse(collector, (BlockScope) null); + } + if (this.bounds != null) { + int boundsLength = this.bounds.length; + for (int i = 0; i < boundsLength; i++) { + TypeReference bound = this.bounds[i]; + if ((bound.bits & ASTNode.HasTypeAnnotations) == 0) { + continue; + } + collector.info2 = i + 1; + bound.traverse(collector, (BlockScope) null); + } + } + } private void internalResolve(Scope scope, boolean staticContext) { // detect variable/type name collisions if (this.binding != null) { @@ -63,10 +101,27 @@ public class TypeParameter extends AbstractVariableDeclaration { internalResolve(scope, scope.enclosingSourceType().isStatic()); } + public void resolveAnnotations(BlockScope scope) { + if (this.annotations != null) { + resolveAnnotations(scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_PARAMETER)); + } + if (this.type != null) { + this.type.resolveAnnotations(scope); + } + if (this.bounds != null) { + for (int i = 0, max = this.bounds.length; i < max; i++) { + this.bounds[i].resolveAnnotations(scope); + } + } + } /* (non-Javadoc) * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer) */ public StringBuffer printStatement(int indent, StringBuffer output) { + if (this.annotations != null) { + printAnnotations(this.annotations, output); + output.append(' '); + } output.append(this.name); if (this.type != null) { output.append(" extends "); //$NON-NLS-1$ @@ -87,6 +142,11 @@ public class TypeParameter extends AbstractVariableDeclaration { public void traverse(ASTVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } if (this.type != null) { this.type.traverse(visitor, scope); } @@ -102,6 +162,11 @@ public class TypeParameter extends AbstractVariableDeclaration { public void traverse(ASTVisitor visitor, ClassScope scope) { if (visitor.visit(this, scope)) { + if (this.annotations != null) { + int annotationsLength = this.annotations.length; + for (int i = 0; i < annotationsLength; i++) + this.annotations[i].traverse(visitor, scope); + } if (this.type != null) { this.type.traverse(visitor, scope); } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java index 7b07cb3f53..5f150de131 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java @@ -1,23 +1,34 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext; +import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants; import org.eclipse.jdt.internal.compiler.flow.FlowContext; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; @@ -28,12 +39,210 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; public abstract class TypeReference extends Expression { - public static final TypeReference[] NO_TYPE_ARGUMENTS = new TypeReference[0]; +static class AnnotationCollector extends ASTVisitor { + List annotationContexts; + TypeReference typeReference; + int targetType; + Annotation[] primaryAnnotations; + int info = -1; + int info2 = -1; + LocalVariableBinding localVariable; + Annotation[][] annotationsOnDimensions; + Wildcard currentWildcard; + + public AnnotationCollector( + TypeParameter typeParameter, + int targetType, + int typeParameterIndex, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = typeParameter.type; + this.targetType = targetType; + this.primaryAnnotations = typeParameter.annotations; + this.info = typeParameterIndex; + } + + public AnnotationCollector( + LocalDeclaration localDeclaration, + int targetType, + LocalVariableBinding localVariable, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = localDeclaration.type; + this.targetType = targetType; + this.primaryAnnotations = localDeclaration.annotations; + this.localVariable = localVariable; + } + + public AnnotationCollector( + LocalDeclaration localDeclaration, + int targetType, + int parameterIndex, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = localDeclaration.type; + this.targetType = targetType; + this.primaryAnnotations = localDeclaration.annotations; + this.info = parameterIndex; + } + + public AnnotationCollector( + MethodDeclaration methodDeclaration, + int targetType, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = methodDeclaration.returnType; + this.targetType = targetType; + this.primaryAnnotations = methodDeclaration.annotations; + } + + public AnnotationCollector( + FieldDeclaration fieldDeclaration, + int targetType, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = fieldDeclaration.type; + this.targetType = targetType; + this.primaryAnnotations = fieldDeclaration.annotations; + } + public AnnotationCollector( + TypeReference typeReference, + int targetType, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = typeReference; + this.targetType = targetType; + } + public AnnotationCollector( + TypeReference typeReference, + int targetType, + int info, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = typeReference; + this.info = info; + this.targetType = targetType; + } + public AnnotationCollector( + TypeReference typeReference, + int targetType, + int info, + int typeIndex, + List annotationContexts) { + this.annotationContexts = annotationContexts; + this.typeReference = typeReference; + this.info = info; + this.targetType = targetType; + this.info2 = typeIndex; + } + public AnnotationCollector( + TypeReference typeReference, + int targetType, + int info, + List annotationContexts, + Annotation[][] annotationsOnDimensions) { + this.annotationContexts = annotationContexts; + this.typeReference = typeReference; + this.info = info; + this.targetType = targetType; + this.annotationsOnDimensions = annotationsOnDimensions; + } + private boolean internalVisit(Annotation annotation) { + AnnotationContext annotationContext = null; + if (annotation.isRuntimeTypeInvisible()) { + annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.INVISIBLE, this.annotationsOnDimensions); + } else if (annotation.isRuntimeTypeVisible()) { + annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.VISIBLE, this.annotationsOnDimensions); + } + if (annotationContext != null) { + annotationContext.wildcard = this.currentWildcard; + switch(this.targetType) { + case AnnotationTargetTypeConstants.THROWS : + case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER : + case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER : + case AnnotationTargetTypeConstants.METHOD_PARAMETER : + case AnnotationTargetTypeConstants.TYPE_CAST : + case AnnotationTargetTypeConstants.TYPE_INSTANCEOF : + case AnnotationTargetTypeConstants.OBJECT_CREATION : + case AnnotationTargetTypeConstants.CLASS_LITERAL : + case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS: + annotationContext.info = this.info; + break; + case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND : + case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND : + annotationContext.info2 = this.info2; + annotationContext.info = this.info; + break; + case AnnotationTargetTypeConstants.LOCAL_VARIABLE : + annotationContext.variableBinding = this.localVariable; + break; + case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL : + case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : + annotationContext.info2 = this.info2; + annotationContext.info = this.info; + } + this.annotationContexts.add(annotationContext); + } + return true; + } + public boolean visit(MarkerAnnotation annotation, BlockScope scope) { + return internalVisit(annotation); + } + public boolean visit(NormalAnnotation annotation, BlockScope scope) { + return internalVisit(annotation); + } + public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) { + return internalVisit(annotation); + } + public boolean visit(Wildcard wildcard, BlockScope scope) { + this.currentWildcard = wildcard; + return true; + } + public boolean visit(Argument argument, BlockScope scope) { + if ((argument.bits & ASTNode.IsUnionType) == 0) { + return true; + } + for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) { + int startPC = this.localVariable.initializationPCs[i << 1]; + int endPC = this.localVariable.initializationPCs[(i << 1) + 1]; + if (startPC != endPC) { // only entries for non zero length + return true; + } + } + return false; + } + public boolean visit(Argument argument, ClassScope scope) { + if ((argument.bits & ASTNode.IsUnionType) == 0) { + return true; + } + for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) { + int startPC = this.localVariable.initializationPCs[i << 1]; + int endPC = this.localVariable.initializationPCs[(i << 1) + 1]; + if (startPC != endPC) { // only entries for non zero length + return true; + } + } + return false; + } + public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) { + for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) { + int startPC = this.localVariable.initializationPCs[i << 1]; + int endPC = this.localVariable.initializationPCs[(i << 1) + 1]; + if (startPC != endPC) { // only entries for non zero length + return true; + } + } + return false; + } + public void endVisit(Wildcard wildcard, BlockScope scope) { + this.currentWildcard = null; + } +} /* * Answer a base type reference (can be an array of base type). */ -public static final TypeReference baseTypeReference(int baseType, int dim) { +public static final TypeReference baseTypeReference(int baseType, int dim, Annotation [][] dimAnnotations) { if (dim == 0) { switch (baseType) { @@ -59,26 +268,29 @@ public static final TypeReference baseTypeReference(int baseType, int dim) { } switch (baseType) { case (TypeIds.T_void) : - return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, dimAnnotations, 0); case (TypeIds.T_boolean) : - return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, dimAnnotations, 0); case (TypeIds.T_char) : - return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, dimAnnotations, 0); case (TypeIds.T_float) : - return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, dimAnnotations, 0); case (TypeIds.T_double) : - return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, dimAnnotations, 0); case (TypeIds.T_byte) : - return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, dimAnnotations, 0); case (TypeIds.T_short) : - return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, dimAnnotations, 0); case (TypeIds.T_int) : - return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, dimAnnotations, 0); default : //T_long - return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, 0); + return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, dimAnnotations, 0); } } +// JSR308 type annotations... +public Annotation[] annotations = null; + // allows us to trap completion & selection nodes public void aboutToResolve(Scope scope) { // default implementation: do nothing @@ -90,9 +302,57 @@ public void checkBounds(Scope scope) { // only parameterized type references have bounds } public abstract TypeReference copyDims(int dim); +public abstract TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions); public int dimensions() { return 0; } +public AnnotationContext[] getAllAnnotationContexts(int targetType) { + List allAnnotationContexts = new ArrayList(); + AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts); + this.traverse(collector, (BlockScope) null); + return (AnnotationContext[]) allAnnotationContexts.toArray(new AnnotationContext[allAnnotationContexts.size()]); +} +/** + * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode + * @param targetType + * @param info + * @param allAnnotationContexts + */ +public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts); + this.traverse(collector, (BlockScope) null); +} +/** + * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode + * @param targetType + * @param info + * @param allAnnotationContexts + */ +public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts, Annotation[][] annotationsOnDimensions) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts, annotationsOnDimensions); + this.traverse(collector, (BlockScope) null); + if (annotationsOnDimensions != null) { + for (int i = 0, max = annotationsOnDimensions.length; i < max; i++) { + Annotation[] annotationsOnDimension = annotationsOnDimensions[i]; + if (annotationsOnDimension != null) { + for (int j = 0, max2 = annotationsOnDimension.length; j< max2; j++) { + annotationsOnDimension[j].traverse(collector, (BlockScope) null); + } + } + } + } +} +public void getAllAnnotationContexts(int targetType, int info, int typeIndex, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, info, typeIndex, allAnnotationContexts); + this.traverse(collector, (BlockScope) null); +} +public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) { + AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts); + this.traverse(collector, (BlockScope) null); +} +public Annotation[][] getAnnotationsOnDimensions() { + return null; +} public abstract char[] getLastToken(); @@ -159,6 +419,15 @@ protected TypeBinding internalResolveType(Scope scope) { && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) { scope.problemReporter().rawTypeReference(this, type); } + if (this.annotations != null) { + switch(scope.kind) { + case Scope.BLOCK_SCOPE : + case Scope.METHOD_SCOPE : + resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + break; + } + } + if (hasError) { // do not store the computed type, keep the problem type instead return type; @@ -169,6 +438,9 @@ public boolean isTypeReference() { return true; } +public boolean isParameterizedTypeReference() { + return false; +} protected void reportDeprecatedType(TypeBinding type, Scope scope, int index) { scope.problemReporter().deprecatedType(type, this, index); } @@ -234,4 +506,10 @@ public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding g public abstract void traverse(ASTVisitor visitor, BlockScope scope); public abstract void traverse(ASTVisitor visitor, ClassScope scope); + +protected void resolveAnnotations(BlockScope scope) { + if (this.annotations != null) { + resolveAnnotations(scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); + } +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java index f1d7415970..bbf7806082 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -156,4 +160,9 @@ public class UnionTypeReference extends TypeReference { return output; } + public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) { + // TODO Auto-generated method stub + return null; + } + } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java index 73b985db29..8f4db261ea 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -59,7 +63,7 @@ public class Wildcard extends SingleTypeReference { boundType = scope.kind == Scope.CLASS_SCOPE ? this.bound.resolveType((ClassScope)scope) : this.bound.resolveType((BlockScope)scope, true /* check bounds*/); - + this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations); if (boundType == null) { return null; } @@ -89,6 +93,7 @@ public class Wildcard extends SingleTypeReference { public TypeBinding resolveType(BlockScope scope, boolean checkBounds) { if (this.bound != null) { this.bound.resolveType(scope, checkBounds); + this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations); } return null; } @@ -96,6 +101,7 @@ public class Wildcard extends SingleTypeReference { public TypeBinding resolveType(ClassScope scope) { if (this.bound != null) { this.bound.resolveType(scope); + this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations); } return null; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java index 0a91ea8b9a..7ce2a10ee2 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java @@ -132,4 +132,5 @@ public interface ClassFileConstants { int ATTR_VARS = 0x4; // LocalVariableTableAttribute int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc + int ATTR_TYPE_ANNOTATION = 0x20; // type annotation attribute (jsr 308) } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java new file mode 100644 index 0000000000..75de873efc --- /dev/null +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2012 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.compiler.codegen; + +import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.eclipse.jdt.internal.compiler.ast.Wildcard; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; + +public class AnnotationContext { + public static final int VISIBLE = 0x1; + public static final int INVISIBLE = 0x2; + public Annotation annotation; + public TypeReference typeReference; + public int targetType; + public int info; + public int info2; + public int visibility; + public Annotation[] primaryAnnotations; + public LocalVariableBinding variableBinding; + public Annotation[][] annotationsOnDimensions; + public Wildcard wildcard; + + public AnnotationContext( + Annotation annotation, + TypeReference typeReference, + int targetType, + Annotation[] primaryAnnotations, + int visibility, + Annotation[][] annotationsOnDimensions) { + this.annotation = annotation; + this.typeReference = typeReference; + this.targetType = targetType; + this.primaryAnnotations = primaryAnnotations; + this.visibility = visibility; + this.annotationsOnDimensions = annotationsOnDimensions; + } + + public String toString() { + return "AnnotationContext [annotation=" //$NON-NLS-1$ + + this.annotation + + ", typeReference=" //$NON-NLS-1$ + + this.typeReference + + ", targetType=" //$NON-NLS-1$ + + this.targetType + + ", info =" //$NON-NLS-1$ + + this.info + + ", boundIndex=" //$NON-NLS-1$ + + this.info2 + + "]"; //$NON-NLS-1$ + } +} diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java new file mode 100644 index 0000000000..ad66617ce7 --- /dev/null +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2012 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.compiler.codegen; + +public interface AnnotationTargetTypeConstants { + int METHOD_RECEIVER = 0x06; + int METHOD_RECEIVER_GENERIC_OR_ARRAY = 0x07; + int METHOD_RETURN_TYPE = 0x0A; + int METHOD_RETURN_TYPE_GENERIC_OR_ARRAY = 0x0B; + int METHOD_PARAMETER = 0x0C; + int METHOD_PARAMETER_GENERIC_OR_ARRAY = 0x0D; + int FIELD = 0x0E; + int FIELD_GENERIC_OR_ARRAY = 0x0F; + int CLASS_TYPE_PARAMETER_BOUND = 0x10; + int CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x11; + int METHOD_TYPE_PARAMETER_BOUND = 0x12; + int METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x13; + int CLASS_EXTENDS_IMPLEMENTS = 0x14; + int CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY = 0x15; + int THROWS = 0x16; + int THROWS_GENERIC_OR_ARRAY = 0x17; + int WILDCARD_BOUND = 0x1C; + int WILDCARD_BOUND_GENERIC_OR_ARRAY = 0x1D; + int METHOD_TYPE_PARAMETER = 0x20; + int METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x21; + int CLASS_TYPE_PARAMETER = 0x22; + int CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x23; + int TYPE_CAST = 0x00; + int TYPE_CAST_GENERIC_OR_ARRAY = 0x01; + int TYPE_INSTANCEOF = 0x02; + int TYPE_INSTANCEOF_GENERIC_OR_ARRAY = 0x03; + int OBJECT_CREATION = 0x04; + int OBJECT_CREATION_GENERIC_OR_ARRAY = 0x05; + int LOCAL_VARIABLE = 0x08; + int LOCAL_VARIABLE_GENERIC_OR_ARRAY = 0x09; + int TYPE_ARGUMENT_CONSTRUCTOR_CALL = 0x18; + int TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY = 0x19; + int TYPE_ARGUMENT_METHOD_CALL = 0x1A; + int TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY = 0x1B; + int CLASS_LITERAL = 0x1E; + int CLASS_LITERAL_GENERIC_OR_ARRAY = 0x1F; +} diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java index cd163a23dc..8d0573d2ec 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for @@ -32,6 +36,8 @@ public abstract class Binding { public static final int GENERIC_TYPE = TYPE | ASTNode.Bit12; public static final int TYPE_PARAMETER = TYPE | ASTNode.Bit13; public static final int INTERSECTION_TYPE = TYPE | ASTNode.Bit14; + // jsr 308 + public static final int TYPE_USE = TYPE | ASTNode.Bit15; // Shared binding collections public static final TypeBinding[] NO_TYPES = new TypeBinding[0]; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java index 22b5da1e9e..228d32b519 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java @@ -13,9 +13,11 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; +import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; @@ -325,12 +327,33 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { Argument[] argTypes = method.arguments; int argLength = argTypes == null ? 0 : argTypes.length; - if (argLength > 0 && compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { - if (argTypes[--argLength].isVarArgs()) + long sourceLevel = compilerOptions().sourceLevel; + if (argLength > 0 && sourceLevel >= ClassFileConstants.JDK1_5) { + Argument argument = argTypes[--argLength]; + if (argument.isVarArgs()) method.binding.modifiers |= ClassFileConstants.AccVarargs; + if (CharOperation.equals(argument.name, ConstantPool.This)) { + if (argLength != 0 || sourceLevel <= ClassFileConstants.JDK1_7) { + problemReporter().illegalThis(argument, method, sourceLevel); + } + if (argument.annotations != null) { + method.receiverAnnotations = argument.annotations; + method.bits |= ASTNode.HasTypeAnnotations; + } + } while (--argLength >= 0) { - if (argTypes[argLength].isVarArgs()) - problemReporter().illegalVararg(argTypes[argLength], method); + argument = argTypes[argLength]; + if (argument.isVarArgs()) + problemReporter().illegalVararg(argument, method); + if (CharOperation.equals(argument.name, ConstantPool.This)) { + if (argLength != 0 || sourceLevel <= ClassFileConstants.JDK1_7) { + problemReporter().illegalThis(argument, method, sourceLevel); + } + if (argument.annotations != null) { + method.receiverAnnotations = argument.annotations; + method.bits |= ASTNode.HasTypeAnnotations; + } + } } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java index 25fee09cb8..8edbacbf0e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for bug 186342 [compiler][null] Using annotations for null checking @@ -783,6 +787,25 @@ public abstract class Scope { parameterBinding.fPackage = unitPackage; typeParameter.binding = parameterBinding; + if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) { + switch(declaringElement.kind()) { + case Binding.METHOD : + MethodBinding methodBinding = (MethodBinding) declaringElement; + AbstractMethodDeclaration sourceMethod = methodBinding.sourceMethod(); + if (sourceMethod != null) { + sourceMethod.bits |= ASTNode.HasTypeAnnotations; + } + break; + case Binding.TYPE : + if (declaringElement instanceof SourceTypeBinding) { + SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) declaringElement; + TypeDeclaration typeDeclaration = sourceTypeBinding.scope.referenceContext; + if (typeDeclaration != null) { + typeDeclaration.bits |= ASTNode.HasTypeAnnotations; + } + } + } + } // detect duplicates, but keep each variable to reduce secondary errors with instantiating this generic type (assume number of variables is correct) for (int j = 0; j < count; j++) { TypeVariableBinding knownVar = typeVariableBindings[j]; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java index 21b1c1188a..ccc0064575 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for bug 186342 - [compiler][null] Using annotations for null checking @@ -109,11 +113,14 @@ public interface TagBits { long AnnotationForLocalVariable = ASTNode.Bit42L; long AnnotationForAnnotationType = ASTNode.Bit43L; long AnnotationForPackage = ASTNode.Bit44L; + long AnnotationForTypeUse = ASTNode.Bit54L; + long AnnotationForTypeParameter = ASTNode.Bit55L; long AnnotationTargetMASK = AnnotationTarget | AnnotationForType | AnnotationForField | AnnotationForMethod | AnnotationForParameter | AnnotationForConstructor | AnnotationForLocalVariable - | AnnotationForAnnotationType | AnnotationForPackage; + | AnnotationForAnnotationType | AnnotationForPackage + | AnnotationForTypeUse | AnnotationForTypeParameter; // 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention long AnnotationSourceRetention = ASTNode.Bit45L; long AnnotationClassRetention = ASTNode.Bit46L; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java index 95ebdc3952..67e770e017 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java @@ -5,6 +5,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for @@ -80,6 +84,10 @@ public interface TypeConstants { char[] UPPER_LOCAL_VARIABLE = "LOCAL_VARIABLE".toCharArray(); //$NON-NLS-1$ char[] UPPER_ANNOTATION_TYPE = "ANNOTATION_TYPE".toCharArray(); //$NON-NLS-1$ char[] UPPER_PACKAGE = "PACKAGE".toCharArray(); //$NON-NLS-1$ + + // jsr308 + char[] TYPE_USE_TARGET = "TYPE_USE".toCharArray(); //$NON-NLS-1$ + char[] TYPE_PARAMETER_TARGET = "TYPE_PARAMETER".toCharArray(); //$NON-NLS-1$ // Constant compound names char[][] JAVA_LANG = {JAVA, LANG}; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java index 2bbfc3cc4f..d7de0f52f1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java @@ -31,6 +31,7 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.ast.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; @@ -71,6 +72,9 @@ public class Parser implements ParserBasicInformation, TerminalTokens, Operator //expression stack protected final static int ExpressionStackIncrement = 100; + // annotation stack + protected final static int TypeAnnotationStackIncrement = 100; + protected final static int GenericsStackIncrement = 10; private final static String FILEPREFIX = "parser"; //$NON-NLS-1$ @@ -788,7 +792,25 @@ public class Parser implements ParserBasicInformation, TerminalTokens, Operator protected int[] expressionLengthStack; protected int expressionPtr; protected Expression[] expressionStack = new Expression[ExpressionStackIncrement]; + protected int unattachedAnnotationPtr; // used for figuring out whether some set of annotations are annotating a dimension or not. public int firstToken ; // handle for multiple parsing goals + + /* jsr308 -- Type annotation management, we now maintain type annotations in a separate stack + as otherwise they get interspersed with other expressions and some of the code is not prepared + to handle such interleaving and will look ugly if changed. + + See consumeArrayCreationExpressionWithoutInitializer for example. + + See that annotations gets pushed into expression stack the moment an annotation is discovered and + get moved to the new type annotations stack only later when the annotation is recognized to be a + type annotation. Where ambiguities exist (i.e 1.7 annotation occurs in a place sanctioned for an + 1.5 type annotation, the annotation continues to stay in the expression stack, but in these case + interleaving is not an issue. + */ + protected int typeAnnotationPtr; + protected int typeAnnotationLengthPtr; + protected Annotation [] typeAnnotationStack = new Annotation[TypeAnnotationStackIncrement]; + protected int [] typeAnnotationLengthStack; // generics management protected int genericsIdentifiersLengthPtr; protected int[] genericsIdentifiersLengthStack = new int[GenericsStackIncrement]; @@ -884,6 +906,7 @@ public Parser(ProblemReporter problemReporter, boolean optimizeStringLiterals) { this.parsingJava8Plus = this.options.sourceLevel >= ClassFileConstants.JDK1_8; this.astLengthStack = new int[50]; this.expressionLengthStack = new int[30]; + this.typeAnnotationLengthStack = new int[30]; this.intStack = new int[50]; this.identifierStack = new char[30][]; this.identifierLengthStack = new int[30]; @@ -1232,6 +1255,7 @@ protected void checkForDiamond(TypeReference allocType) { } } protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightSide(TypeReference rightSide, int dim) { + Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim); int nameSize = this.identifierLengthStack[this.identifierLengthPtr]; int tokensSize = nameSize; if (rightSide instanceof ParameterizedSingleTypeReference) { @@ -1287,7 +1311,19 @@ protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightS typeArguments[nameSize - 1] = currentTypeArguments; } this.identifierLengthPtr--; - return new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions); + ParameterizedQualifiedTypeReference typeRef = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, annotationsOnDimensions, positions); + int length; + if (this.typeAnnotationLengthPtr >= 0 && (length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { + System.arraycopy( + this.typeAnnotationStack, + (this.typeAnnotationPtr -= length) + 1, + typeRef.annotations = new Annotation[length], + 0, + length); + typeRef.sourceStart = typeRef.annotations[0].sourceStart; + typeRef.bits |= ASTNode.HasTypeAnnotations; + } + return typeRef; } protected void concatExpressionLists() { this.expressionLengthStack[--this.expressionLengthPtr]++; @@ -1630,8 +1666,6 @@ protected void consumeArrayCreationExpressionWithInitializer() { this.expressionLengthPtr -- ; arrayAllocation.initializer = (ArrayInitializer) this.expressionStack[this.expressionPtr--]; - arrayAllocation.type = getTypeReference(0); - arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage length = (this.expressionLengthStack[this.expressionLengthPtr--]); this.expressionPtr -= length ; System.arraycopy( @@ -1640,6 +1674,14 @@ protected void consumeArrayCreationExpressionWithInitializer() { arrayAllocation.dimensions = new Expression[length], 0, length); + Annotation[][] annotationsOnDimensions = getAnnotationsOnDimensions(length); + arrayAllocation.annotationsOnDimensions = annotationsOnDimensions; + if (annotationsOnDimensions != null) { + arrayAllocation.bits |= ASTNode.HasTypeAnnotations; + } + arrayAllocation.type = getTypeReference(0); + arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage + arrayAllocation.sourceStart = this.intStack[this.intPtr--]; if (arrayAllocation.initializer == null) { arrayAllocation.sourceEnd = this.endStatementPosition; @@ -1654,8 +1696,6 @@ protected void consumeArrayCreationExpressionWithoutInitializer() { int length; ArrayAllocationExpression arrayAllocation = new ArrayAllocationExpression(); - arrayAllocation.type = getTypeReference(0); - arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage length = (this.expressionLengthStack[this.expressionLengthPtr--]); this.expressionPtr -= length ; System.arraycopy( @@ -1664,6 +1704,13 @@ protected void consumeArrayCreationExpressionWithoutInitializer() { arrayAllocation.dimensions = new Expression[length], 0, length); + Annotation[][] annotationsOnDimensions = getAnnotationsOnDimensions(length); + arrayAllocation.annotationsOnDimensions = annotationsOnDimensions; + if (annotationsOnDimensions != null) { + arrayAllocation.bits |= ASTNode.HasTypeAnnotations; + } + arrayAllocation.type = getTypeReference(0); + arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage arrayAllocation.sourceStart = this.intStack[this.intPtr--]; if (arrayAllocation.initializer == null) { arrayAllocation.sourceEnd = this.endStatementPosition; @@ -2059,7 +2106,7 @@ protected void consumeCaseLabel() { pushOnAstStack(caseStatement); } protected void consumeCastExpressionLL1() { - //CastExpression ::= '(' Expression ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus + //CastExpression ::= '(' Name ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus // Expression is used in order to make the grammar LL1 //optimize push/pop @@ -2075,6 +2122,44 @@ protected void consumeCastExpressionLL1() { updateSourcePosition(cast); cast.sourceEnd=exp.sourceEnd; } +protected void consumeCastExpressionLL1WithTypeAnnotations() { + // CastExpression ::= '(' Modifiers Name ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus + // Expression is used in order to make the grammar LL1 + + //optimize push/pop + + // pop the expression + Expression expression = this.expressionStack[this.expressionPtr--]; + this.expressionLengthPtr--; + // pop the type reference + TypeReference typeReference = (TypeReference) this.expressionStack[this.expressionPtr--]; + this.expressionLengthPtr--; + + int length; + if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + typeReference.annotations = new Annotation[length], + 0, + length); + int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; + if (this.modifiersSourceStart < typeReferenceSourceStart) { + typeReferenceSourceStart = this.modifiersSourceStart; + } + typeReference.sourceStart = typeReferenceSourceStart; + typeReference.bits |= ASTNode.HasTypeAnnotations; + } + Expression cast; + pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); + // pop the two positions for left and right parenthesis + updateSourcePosition(cast); + cast.sourceEnd = expression.sourceEnd; + if (this.modifiers != ClassFileConstants.AccDefault) { + problemReporter().invalidLocationForModifiers(typeReference); + } + resetModifiers(); +} protected void consumeCastExpressionWithGenericsArray() { // CastExpression ::= PushLPAREN Name TypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus @@ -2092,6 +2177,44 @@ protected void consumeCastExpressionWithGenericsArray() { castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; cast.sourceEnd = exp.sourceEnd; } +protected void consumeCastExpressionWithGenericsArrayWithTypeAnnotations() { + // CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus + int end = this.intStack[this.intPtr--]; + int dim = this.intStack[this.intPtr--]; + + pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); + TypeReference typeReference = getTypeReference(dim); + + // pop expression + Expression expression = this.expressionStack[this.expressionPtr--]; + this.expressionLengthPtr--; + + int length; + if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + typeReference.annotations = new Annotation[length], + 0, + length); + int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; + if (this.modifiersSourceStart < typeReferenceSourceStart) { + typeReferenceSourceStart = this.modifiersSourceStart; + } + typeReference.bits |= ASTNode.HasTypeAnnotations; + typeReference.sourceStart = typeReferenceSourceStart; + } + Expression cast; + pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); + this.intPtr--; + typeReference.sourceEnd = end - 1; + typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; + cast.sourceEnd = expression.sourceEnd; + if (this.modifiers != ClassFileConstants.AccDefault) { + problemReporter().invalidLocationForModifiers(typeReference); + } + resetModifiers(); +} protected void consumeCastExpressionWithNameArray() { // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus @@ -2109,6 +2232,45 @@ protected void consumeCastExpressionWithNameArray() { castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; cast.sourceEnd = exp.sourceEnd; } +protected void consumeCastExpressionWithNameArrayWithTypeAnnotations() { + // CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus + + int end = this.intStack[this.intPtr--]; + + // handle type arguments + pushOnGenericsLengthStack(0); + pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); + + // pop expression + Expression expression = this.expressionStack[this.expressionPtr--]; + this.expressionLengthPtr--; + TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]); + + int length; + if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + typeReference.annotations = new Annotation[length], + 0, + length); + int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; + if (this.modifiersSourceStart < typeReferenceSourceStart) { + typeReferenceSourceStart = this.modifiersSourceStart; + } + typeReference.bits |= ASTNode.HasTypeAnnotations; + typeReference.sourceStart = typeReferenceSourceStart; + } + Expression cast; + pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); + typeReference.sourceEnd = end - 1; + typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; + cast.sourceEnd = expression.sourceEnd; + if (this.modifiers != ClassFileConstants.AccDefault) { + problemReporter().invalidLocationForModifiers(typeReference); + } + resetModifiers(); +} protected void consumeCastExpressionWithPrimitiveType() { // CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression @@ -2125,6 +2287,44 @@ protected void consumeCastExpressionWithPrimitiveType() { castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; cast.sourceEnd = exp.sourceEnd; } +protected void consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations() { + // CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression + + //this.intStack : posOfLeftParen dim posOfRightParen + int end = this.intStack[this.intPtr--]; + + // pop expression + Expression expression = this.expressionStack[this.expressionPtr--]; + this.expressionLengthPtr--; + + TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]); + int length; + if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + typeReference.annotations = new Annotation[length], + 0, + length); + int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; + if (this.modifiersSourceStart < typeReferenceSourceStart) { + typeReferenceSourceStart = this.modifiersSourceStart; + } + typeReference.bits |= ASTNode.HasTypeAnnotations; + typeReference.sourceStart = typeReferenceSourceStart; + } + + Expression cast; + pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); + + typeReference.sourceEnd = end - 1; + typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; + cast.sourceEnd = expression.sourceEnd; + if (this.modifiers != ClassFileConstants.AccDefault) { + problemReporter().invalidLocationForModifiers(typeReference); + } + resetModifiers(); +} protected void consumeCastExpressionWithQualifiedGenericsArray() { // CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus Expression exp; @@ -2133,7 +2333,7 @@ protected void consumeCastExpressionWithQualifiedGenericsArray() { int end = this.intStack[this.intPtr--]; int dim = this.intStack[this.intPtr--]; - TypeReference rightSide = getTypeReference(0); + TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated. ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(rightSide, dim); this.intPtr--; @@ -2142,6 +2342,44 @@ protected void consumeCastExpressionWithQualifiedGenericsArray() { castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; cast.sourceEnd = exp.sourceEnd; } +protected void consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations() { + // CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus + int end = this.intStack[this.intPtr--]; + + int dim = this.intStack[this.intPtr--]; + // pop expression + Expression expression = this.expressionStack[this.expressionPtr--]; + this.expressionLengthPtr--; + + TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated. + + ParameterizedQualifiedTypeReference typeReference = computeQualifiedGenericsFromRightSide(rightSide, dim); + this.intPtr--; + int length; + if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + typeReference.annotations = new Annotation[length], + 0, + length); + int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; + if (this.modifiersSourceStart < typeReferenceSourceStart) { + typeReferenceSourceStart = this.modifiersSourceStart; + } + typeReference.bits |= ASTNode.HasTypeAnnotations; + typeReference.sourceStart = typeReferenceSourceStart; + } + Expression cast; + pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); + typeReference.sourceEnd = end - 1; + typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; + cast.sourceEnd = expression.sourceEnd; + if (this.modifiers != ClassFileConstants.AccDefault) { + problemReporter().invalidLocationForModifiers(typeReference); + } + resetModifiers(); +} protected void consumeCatches() { // Catches ::= Catches CatchClause optimizedConcatNodeLists(); @@ -2334,6 +2572,7 @@ protected void consumeClassHeaderExtends() { TypeReference superClass = getTypeReference(0); // There is a class declaration on the top of stack TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr]; + typeDecl.bits |= (superClass.bits & ASTNode.HasTypeAnnotations); typeDecl.superclass = superClass; superClass.bits |= ASTNode.IsSuperType; typeDecl.bodyStart = typeDecl.superclass.sourceEnd + 1; @@ -2355,8 +2594,11 @@ protected void consumeClassHeaderImplements() { typeDecl.superInterfaces = new TypeReference[length], 0, length); - for (int i = 0, max = typeDecl.superInterfaces.length; i < max; i++) { - typeDecl.superInterfaces[i].bits |= ASTNode.IsSuperType; + TypeReference[] superinterfaces = typeDecl.superInterfaces; + for (int i = 0, max = superinterfaces.length; i < max; i++) { + TypeReference typeReference = superinterfaces[i]; + typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations); + typeReference.bits |= ASTNode.IsSuperType; } typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1; this.listLength = 0; // reset after having read super-interfaces @@ -2690,9 +2932,11 @@ protected void consumeConstructorDeclaration() { } } - if (!this.diet || insideFieldInitializer){ - // add it only in non-diet mode, if diet_bodies, then constructor call will be added elsewhere. - constructorCall = SuperReference.implicitSuperConstructorCall(); + if (!this.options.ignoreMethodBodies) { + if (!this.diet || insideFieldInitializer){ + // add it only in non-diet mode, if diet_bodies, then constructor call will be added elsewhere. + constructorCall = SuperReference.implicitSuperConstructorCall(); + } } } @@ -2888,6 +3132,7 @@ protected void consumeDims() { } protected void consumeDimWithOrWithOutExpr() { // DimWithOrWithOutExpr ::= '[' ']' + // DimWithOrWithOutExpr ::= OneOrMoreAnnotations '[' ']' pushOnExpressionStack(null); if(this.currentElement != null && this.currentToken == TokenNameLBRACE) { @@ -3097,6 +3342,7 @@ protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) { localDeclaration.annotations = new Annotation[length], 0, length); + localDeclaration.bits |= ASTNode.HasTypeAnnotations; } if (hasModifiers) { localDeclaration.declarationSourceStart = declarationSourceStart; @@ -3105,6 +3351,7 @@ protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) { localDeclaration.declarationSourceStart = type.sourceStart; } localDeclaration.type = type; + localDeclaration.bits |= (type.bits & ASTNode.HasTypeAnnotations); ForeachStatement iteratorForStatement = new ForeachStatement( @@ -3195,6 +3442,8 @@ protected void consumeEnterVariable() { char[] identifierName = this.identifierStack[this.identifierPtr]; long namePosition = this.identifierPositionStack[this.identifierPtr]; int extendedDimension = this.intStack[this.intPtr--]; + // pop any annotations on extended dimensions now, so they don't pollute the base dimensions. + Annotation [][] annotationsOnExtendedDimensions = extendedDimension == 0 ? null : getAnnotationsOnDimensions(extendedDimension); AbstractVariableDeclaration declaration; // create the ast node boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0; @@ -3227,6 +3476,7 @@ protected void consumeEnterVariable() { declaration.annotations = new Annotation[length], 0, length); + declaration.bits |= ASTNode.HasTypeAnnotations; } type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension if (declaration.declarationSourceStart == -1) { @@ -3248,6 +3498,7 @@ protected void consumeEnterVariable() { declaration.annotations = new Annotation[length], 0, length); + declaration.bits |= ASTNode.HasTypeAnnotations; } // Store javadoc only on first declaration as it is the same for all ones FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration; @@ -3265,14 +3516,22 @@ protected void consumeEnterVariable() { if (annotations != null) { final int annotationsLength = annotations.length; System.arraycopy(annotations, 0, declaration.annotations = new Annotation[annotationsLength], 0, annotationsLength); + declaration.bits |= ASTNode.HasTypeAnnotations; } } if (extendedDimension == 0) { declaration.type = type; + declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations); } else { int dimension = typeDim + extendedDimension; - declaration.type = copyDims(type, dimension); + Annotation [][] annotationsOnAllDimensions = null; + Annotation[][] annotationsOnDimensions = type.getAnnotationsOnDimensions(); + if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) { + annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(typeDim, annotationsOnDimensions, extendedDimension, annotationsOnExtendedDimensions); + declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations); + } + declaration.type = copyDims(type, dimension, annotationsOnAllDimensions); } this.variablesCounter[this.nestedType]++; pushOnAstStack(declaration); @@ -3299,6 +3558,30 @@ protected void consumeEnterVariable() { this.lastIgnoredToken = -1; } } +protected Annotation[][] getMergedAnnotationsOnDimensions(int dims, Annotation[][] annotationsOnDimensions, + int extendedDims, Annotation[][] annotationsOnExtendedDimensions) { + + if (annotationsOnDimensions == null && annotationsOnExtendedDimensions == null) + return null; + + Annotation [][] mergedAnnotations = new Annotation[dims + extendedDims][]; + for (int i = 0; i < dims; i++) { + if (annotationsOnDimensions != null) { + mergedAnnotations[i] = annotationsOnDimensions[i]; + } else { + mergedAnnotations[i] = null; + } + } + for (int i = dims, j = 0; i < dims + extendedDims; i++, j++) { + if (annotationsOnExtendedDimensions != null) { + mergedAnnotations[i] = annotationsOnExtendedDimensions[j]; + } else { + mergedAnnotations[i] = null; + } + } + + return mergedAnnotations; +} protected void consumeEnumBodyNoConstants() { // nothing to do // The 0 on the astLengthStack has been pushed by EnumBodyDeclarationsopt @@ -3409,6 +3692,7 @@ protected void consumeEnumConstantHeaderName() { enumConstant.annotations = new Annotation[length], 0, length); + enumConstant.bits |= ASTNode.HasTypeAnnotations; } pushOnAstStack(enumConstant); if (this.currentElement != null){ @@ -3928,10 +4212,32 @@ protected void consumeFormalParameter(boolean isVarArgs) { endOfEllipsis = this.intStack[this.intPtr--]; } int firstDimensions = this.intStack[this.intPtr--]; - final int typeDimensions = firstDimensions + extendedDimensions; - TypeReference type = getTypeReference(typeDimensions); + TypeReference type = getUnannotatedTypeReference(extendedDimensions); + Annotation [] varArgsAnnotations = null; + int length; + if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { + System.arraycopy( + this.typeAnnotationStack, + (this.typeAnnotationPtr -= length) + 1, + varArgsAnnotations = new Annotation[length], + 0, + length); + } + final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0); + + if (typeDimensions != extendedDimensions) { + // jsr308 type annotations management + Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions); + Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions(); + Annotation [][] annotationsOnAllDimensions = null; + if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) { + annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); + annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null); + } + type = copyDims(type, typeDimensions, annotationsOnAllDimensions); + type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition; + } if (isVarArgs) { - type = copyDims(type, typeDimensions + 1); if (extendedDimensions == 0) { type.sourceEnd = endOfEllipsis; } @@ -3946,8 +4252,8 @@ protected void consumeFormalParameter(boolean isVarArgs) { type, this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers arg.declarationSourceStart = modifierPositions; + arg.bits |= (type.bits & ASTNode.HasTypeAnnotations); // consume annotations - int length; if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { System.arraycopy( this.expressionStack, @@ -3955,6 +4261,7 @@ protected void consumeFormalParameter(boolean isVarArgs) { arg.annotations = new Annotation[length], 0, length); + arg.bits |= ASTNode.HasTypeAnnotations; RecoveredType currentRecoveryType = this.currentRecoveryType(); if (currentRecoveryType != null) currentRecoveryType.annotationsConsumed(arg.annotations); @@ -3974,7 +4281,37 @@ protected void consumeFormalParameter(boolean isVarArgs) { extendedDimensions > 0) { problemReporter().illegalExtendedDimensions(arg); } + } else { + // The grammar allows trailing annotations in FormalParameter as in + // "int @NonNull[] @Misplaced parameter" in order to allow for constructs such as + // "Object @NonNull[] @Correct ... objects" -- we prune these here. + if (varArgsAnnotations != null) { + problemReporter().misplacedTypeAnnotations(varArgsAnnotations[0], + varArgsAnnotations[varArgsAnnotations.length-1]); + } + } +} +protected Annotation[][] getAnnotationsOnDimensions(int dimensionsCount) { + Annotation [][] dimensionsAnnotations = null; + if (dimensionsCount > 0) { + for (int i = 0; i < dimensionsCount; i++) { + Annotation [] annotations = null; + int length; + if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { + System.arraycopy( + this.typeAnnotationStack, + (this.typeAnnotationPtr -= length) + 1, + annotations = new Annotation[length], + 0, + length); + if (dimensionsAnnotations == null) { + dimensionsAnnotations = new Annotation[dimensionsCount][]; + } + dimensionsAnnotations[dimensionsCount - i - 1] = annotations; + } + } } + return dimensionsAnnotations; } protected void consumeFormalParameterList() { // FormalParameterList ::= FormalParameterList ',' FormalParameter @@ -4037,6 +4374,9 @@ protected void consumeInsideCastExpressionLL1() { protected void consumeInsideCastExpressionWithQualifiedGenerics() { // InsideCastExpressionWithQualifiedGenerics ::= $empty } +protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() { + // InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty +} protected void consumeInstanceOfExpression() { // RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType //optimize the push/pop @@ -4133,8 +4473,11 @@ protected void consumeInterfaceHeaderExtends() { typeDecl.superInterfaces = new TypeReference[length], 0, length); - for (int i = 0, max = typeDecl.superInterfaces.length; i < max; i++) { - typeDecl.superInterfaces[i].bits |= ASTNode.IsSuperType; + TypeReference[] superinterfaces = typeDecl.superInterfaces; + for (int i = 0, max = superinterfaces.length; i < max; i++) { + TypeReference typeReference = superinterfaces[i]; + typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations); + typeReference.bits |= ASTNode.IsSuperType; } typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1; this.listLength = 0; // reset after having read super-interfaces @@ -4494,8 +4837,10 @@ protected void consumeMethodDeclaration(boolean isNotAbstract) { if (isNotAbstract) { //statements explicitDeclarations = this.realBlockStack[this.realBlockPtr--]; - if (!this.options.ignoreMethodBodies) { - if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) { + if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) { + if (this.options.ignoreMethodBodies) { + this.astPtr -= length; + } else { System.arraycopy( this.astStack, (this.astPtr -= length) + 1, @@ -4503,9 +4848,6 @@ protected void consumeMethodDeclaration(boolean isNotAbstract) { 0, length); } - } else { - length = this.astLengthStack[this.astLengthPtr--]; - this.astPtr -= length; } } @@ -4598,7 +4940,13 @@ protected void consumeMethodHeaderExtendedDims() { TypeReference returnType = md.returnType; md.sourceEnd = this.endPosition; int dims = returnType.dimensions() + extendedDims; - md.returnType = copyDims(returnType, dims); + Annotation [][] annotationsOnDimensions = returnType.getAnnotationsOnDimensions(); + Annotation [][] annotationsOnExtendedDimensions = getAnnotationsOnDimensions(extendedDims); + Annotation [][] annotationsOnAllDimensions = null; + if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) { + annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(returnType.dimensions(), annotationsOnDimensions, extendedDims, annotationsOnExtendedDimensions); + } + md.returnType = copyDims(returnType, dims, annotationsOnAllDimensions); if (this.currentToken == TokenNameLBRACE){ md.bodyStart = this.endPosition + 1; } @@ -4682,7 +5030,9 @@ protected void consumeMethodHeaderNameWithTypeParameters(boolean isAnnotationMet long selectorSource = this.identifierPositionStack[this.identifierPtr--]; this.identifierLengthPtr--; //type - md.returnType = getTypeReference(this.intStack[this.intPtr--]); + TypeReference returnType = getTypeReference(this.intStack[this.intPtr--]); + md.returnType = returnType; + md.bits |= (returnType.bits & ASTNode.HasTypeAnnotations); // consume type parameters int length = this.genericsLengthStack[this.genericsLengthPtr--]; @@ -4908,6 +5258,27 @@ protected void consumeMultipleResources() { // Resources ::= Resources ';' Resource concatNodeLists(); } +protected void consumeOneMoreTypeAnnotation() { + // OneOrMoreAnnotations ::= OneOrMoreAnnotations Annotation + this.expressionLengthPtr --; + Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--]; + pushOnTypeAnnotationStack(annotation); + this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++; + if(!this.statementRecoveryActivated && + this.options.sourceLevel <= ClassFileConstants.JDK1_7 && + this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { + problemReporter().invalidUsageOfTypeAnnotations(annotation); + } +} +protected void consumePotentialNameArrayType () { + + // FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorId + // FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorId + // PotentialNameArray -> $empty + // Dimensions including lack of have been pushed appropriately by action attached to DimsoptAnnotsopt + pushOnGenericsLengthStack(0); // handle type arguments + pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); +} protected void consumeNameArrayType() { pushOnGenericsLengthStack(0); // handle type arguments pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); @@ -4971,9 +5342,21 @@ protected void consumeNormalAnnotation() { } this.recordStringLiterals = true; } -protected void consumeOneDimLoop() { +protected void consumeOneDimLoop(boolean expressionStackMayHaveAnnotations) { // OneDimLoop ::= '[' ']' + // OneDimOrAnnot -> '[' ']' + this.dimensions++; + if (!expressionStackMayHaveAnnotations || this.unattachedAnnotationPtr == -1 ) { + pushOnTypeAnnotationLengthStack(0); // no annotations for the current dimension. + } else { + this.unattachedAnnotationPtr = -1; // Leave type annotation stacks they are. + } +} +protected void consumeOneDimLoopWithAnnotations() { + // OneDimLoop ::= OneOrMoreAnnotations '[' ']' this.dimensions++; + // Top of expression stack contains annotations of length specified + // by top of expression length stack that apply to this dimension. } protected void consumeOnlySynchronized() { // OnlySynchronized ::= 'synchronized' @@ -5143,7 +5526,7 @@ protected void consumePrimaryNoNewArrayArrayType() { pushOnGenericsLengthStack(0); pushOnExpressionStack( - new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--]))); + new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(this.intStack[this.intPtr--]))); } protected void consumePrimaryNoNewArrayName() { // PrimaryNoNewArray ::= Name '.' 'class' @@ -5152,7 +5535,7 @@ protected void consumePrimaryNoNewArrayName() { // handle type arguments pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); pushOnGenericsLengthStack(0); - TypeReference typeReference = getTypeReference(0); + TypeReference typeReference = getUnannotatedTypeReference(0); pushOnExpressionStack( new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference)); @@ -5162,6 +5545,7 @@ protected void consumePrimaryNoNewArrayNameSuper() { // handle type arguments pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); pushOnGenericsLengthStack(0); + pushOnTypeAnnotationLengthStack(0); // javac complains on annotations here. TypeReference typeReference = getTypeReference(0); pushOnExpressionStack( @@ -5175,7 +5559,7 @@ protected void consumePrimaryNoNewArrayNameThis() { // handle type arguments pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); pushOnGenericsLengthStack(0); // handle type arguments - + pushOnTypeAnnotationLengthStack(0); // javac complains on annotations here. TypeReference typeReference = getTypeReference(0); pushOnExpressionStack( @@ -5188,13 +5572,13 @@ protected void consumePrimaryNoNewArrayPrimitiveArrayType() { // PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class' this.intPtr--; // remove the class start position pushOnExpressionStack( - new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--]))); + new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(this.intStack[this.intPtr--]))); } protected void consumePrimaryNoNewArrayPrimitiveType() { // PrimaryNoNewArray ::= PrimitiveType '.' 'class' this.intPtr--; // remove the class start position pushOnExpressionStack( - new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(0))); + new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(0))); } protected void consumePrimaryNoNewArrayThis() { // PrimaryNoNewArray ::= 'this' @@ -5325,1821 +5709,2145 @@ protected void consumeRightParen() { // PushRPAREN ::= ')' pushOnIntStack(this.rParenPos); } +protected void consumeUnannotatedType() { + /* We go through some song & dance here to get the type annotations stacks + to reflect the fact that this type was unannotated. Using a dummy non-terminal + with an empty rhs leads to conflicts in many places :-( + */ + pushOnTypeAnnotationLengthStack(0); // either done or else made room. + int dims = this.intStack[this.intPtr]; + if (dims != 0) { + System.arraycopy( + this.typeAnnotationLengthStack, + this.typeAnnotationLengthPtr - dims, + this.typeAnnotationLengthStack, + this.typeAnnotationLengthPtr - dims + 1, + dims); + this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims] = 0; // tag type as unannotated + } +} +protected void consumeAnnotatedType() { + /* We go through some song & dance here to get the type annotations stacks + to reflect the fact that this type was unannotated. Using a dummy non-terminal + with an empty rhs leads to conflicts in many places :-( + */ + int dims = this.intStack[this.intPtr]; + if (dims != 0) { + int counter = 0; + for (int i = 0; i < dims; i++) { + // we count existing dimensions with annotations + counter += this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1 + i]; + } + System.arraycopy( + this.typeAnnotationLengthStack, + this.typeAnnotationLengthPtr - dims + 1, + this.typeAnnotationLengthStack, + this.typeAnnotationLengthPtr - dims + 2, + dims); + int length = this.expressionLengthStack[this.expressionLengthPtr--]; + this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1] = length; + int typeAnnotationStackLength = this.typeAnnotationStack.length; + if (this.typeAnnotationPtr + counter + length >= typeAnnotationStackLength) { + System.arraycopy( + this.typeAnnotationStack, + 0, + this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement], + 0, + typeAnnotationStackLength); + } + System.arraycopy( + this.typeAnnotationStack, + this.typeAnnotationPtr - counter + 1, + this.typeAnnotationStack, + this.typeAnnotationPtr - counter + 1 + length, + counter); + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + this.typeAnnotationStack, + this.typeAnnotationPtr - counter + 1, + length); + this.typeAnnotationPtr += length; + this.typeAnnotationLengthPtr++; + } else { + int length = this.expressionLengthStack[this.expressionLengthPtr--]; + int typeAnnotationStackLength = this.typeAnnotationStack.length; + if (this.typeAnnotationPtr + length >= typeAnnotationStackLength) { + System.arraycopy( + this.typeAnnotationStack, + 0, + this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement], + 0, + typeAnnotationStackLength); + } + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + this.typeAnnotationStack, + this.typeAnnotationPtr + 1, + length); + this.typeAnnotationPtr += length; + pushOnTypeAnnotationLengthStack(length); + } +// if (this.modifiers != ClassFileConstants.AccDefault) { +// problemReporter().invalidLocationForModifiers(typeReference); +// } +// resetModifiers(); +} +protected void consumeTypeAnnotation (boolean markAsUnattached) { + if(!this.statementRecoveryActivated && + this.options.sourceLevel <= ClassFileConstants.JDK1_7 && + this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { + problemReporter().invalidUsageOfTypeAnnotations((Annotation) this.expressionStack[this.expressionPtr]); + } + this.expressionLengthPtr --; + Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--]; + pushOnTypeAnnotationStack(annotation); + if (markAsUnattached) { + if (this.unattachedAnnotationPtr == -1) { + this.unattachedAnnotationPtr = this.typeAnnotationPtr; + } else { + this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++; + } + } +} +protected void consumeDimsWithTrailingAnnotsopt() { + // DimsoptAnnotsopt -> DimsAnnotLoop + pushOnIntStack(this.dimensions); + this.dimensions = 0; + if (this.unattachedAnnotationPtr == -1) { + pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg) + } else { + this.unattachedAnnotationPtr = -1; // reset this and leave the annotation stacks as they are. + } +} +protected void consumeZeroTypeAnnotations(boolean shouldPush) { + if (shouldPush) { + pushOnTypeAnnotationLengthStack(0); + } else { + this.typeAnnotationLengthPtr --; // pop the 0 from the length stack + } +} +protected void consumeEmptyDimsoptAnnotsopt() { + // DimsoptAnnotsopt ::= $empty + pushOnIntStack(0); // signal a non array + pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg) +} +protected void consumeRightParenForUnannotatedTypeCast() { + consumeUnannotatedType(); + // PushRPAREN ::= ')' + pushOnIntStack(this.rParenPos); +} +protected void consumeRightParenForNameUnannotatedTypeCast() { + pushOnIntStack(0); // signal a non array + consumeUnannotatedType(); + // remove the fake dimension + this.intPtr--; + // PushRPAREN ::= ')' + pushOnIntStack(this.rParenPos); +} +protected void consumeRightParenForAnnotatedTypeCast() { + consumeUnannotatedType(); + // PushRPAREN ::= ')' + pushOnIntStack(this.rParenPos); +} +protected void consumeRightParenForNameAndAnnotatedTypeCast() { + // push a zero for dimensions + pushOnIntStack(0); + consumeUnannotatedType(); + // remove the fake dimension + this.intPtr--; + // PushRPAREN ::= ')' + pushOnIntStack(this.rParenPos); +} // This method is part of an automatic generation : do NOT edit-modify protected void consumeRule(int act) { switch ( act ) { - case 30 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); } //$NON-NLS-1$ + case 32 : if (DEBUG) { System.out.println("Type ::= TypeInternal"); } //$NON-NLS-1$ + consumeUnannotatedType(); + break; + + case 34 : if (DEBUG) { System.out.println("Type0 ::= TypeInternal"); } //$NON-NLS-1$ + consumeUnannotatedType(); + break; + + case 35 : if (DEBUG) { System.out.println("TypeInternal ::= PrimitiveType"); } //$NON-NLS-1$ consumePrimitiveType(); break; - case 44 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ - consumeReferenceType(); + case 49 : if (DEBUG) { System.out.println("ReferenceType ::= ReferenceType0"); } //$NON-NLS-1$ + consumeUnannotatedType(); break; - case 48 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$ - consumeClassOrInterfaceName(); + case 50 : if (DEBUG) { System.out.println("ReferenceType ::= Modifiers ReferenceType0"); } //$NON-NLS-1$ + consumeAnnotatedType(); break; - case 49 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); } //$NON-NLS-1$ - consumeClassOrInterface(); + case 51 : if (DEBUG) { System.out.println("ReferenceType0 ::= ClassOrInterfaceType0"); } //$NON-NLS-1$ + consumeReferenceType(); break; - case 50 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); } //$NON-NLS-1$ - consumeGenericType(); + case 53 : if (DEBUG) { System.out.println("Annotationsopt ::="); } //$NON-NLS-1$ + consumeZeroTypeAnnotations(true); break; - case 51 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$ - consumeGenericTypeWithDiamond(); + case 58 : if (DEBUG) { System.out.println("ClassOrInterface ::= ClassOrInterface0"); } //$NON-NLS-1$ + consumeZeroTypeAnnotations(true); + break; + + case 59 : if (DEBUG) { System.out.println("ClassOrInterface0 ::= Name"); } //$NON-NLS-1$ + consumeClassOrInterfaceName(); + break; + + case 61 : if (DEBUG) { System.out.println("PopZeroTypeAnnotations ::="); } //$NON-NLS-1$ + consumeZeroTypeAnnotations(false); + break; + + case 62 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments..."); } //$NON-NLS-1$ + consumeGenericType(); break; - case 52 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); } //$NON-NLS-1$ - consumeArrayTypeWithTypeArgumentsName(); + case 63 : if (DEBUG) { System.out.println("GenericTypeDotName ::= GenericType DOT Name"); } //$NON-NLS-1$ + consumeClassOrInterface(); break; - case 53 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$ + case 64 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$ + consumeGenericTypeWithDiamond(); + break; + + case 66 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$ consumePrimitiveArrayType(); break; - case 54 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$ + case 67 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$ consumeNameArrayType(); break; - case 55 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$ + case 68 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$ consumeGenericTypeNameArrayType(); break; - case 56 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$ + case 69 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$ consumeGenericTypeArrayType(); break; - case 61 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$ + case 74 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$ consumeQualifiedName(); break; - case 62 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$ + case 75 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$ consumeCompilationUnit(); break; - case 63 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$ + case 76 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$ consumeInternalCompilationUnit(); break; - case 64 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ + case 77 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ consumeInternalCompilationUnit(); break; - case 65 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ + case 78 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ consumeInternalCompilationUnitWithTypes(); break; - case 66 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ + case 79 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ consumeInternalCompilationUnitWithTypes(); break; - case 67 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ + case 80 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ consumeInternalCompilationUnit(); break; - case 68 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$ + case 81 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$ consumeInternalCompilationUnitWithTypes(); break; - case 69 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ + case 82 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ consumeInternalCompilationUnitWithTypes(); break; - case 70 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$ + case 83 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$ consumeEmptyInternalCompilationUnit(); break; - case 71 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$ + case 84 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$ consumeReduceImports(); break; - case 72 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$ + case 85 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$ consumeEnterCompilationUnit(); break; - case 88 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ + case 104 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ consumeCatchHeader(); break; - case 90 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$ + case 106 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$ consumeImportDeclarations(); break; - case 92 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$ + case 108 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$ consumeTypeDeclarations(); break; - case 93 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$ + case 109 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$ consumePackageDeclaration(); break; - case 94 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$ + case 110 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$ consumePackageDeclarationNameWithModifiers(); break; - case 95 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$ - consumePackageDeclarationName(); + case 111 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$ + consumePackageDeclarationName(); break; - case 96 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$ + case 112 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$ consumePackageComment(); break; - case 101 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$ + case 117 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$ consumeImportDeclaration(); break; - case 102 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); } //$NON-NLS-1$ + case 118 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); } //$NON-NLS-1$ consumeSingleTypeImportDeclarationName(); break; - case 103 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ + case 119 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ consumeImportDeclaration(); break; - case 104 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$ + case 120 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$ consumeTypeImportOnDemandDeclarationName(); break; - case 107 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ + case 123 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ consumeEmptyTypeDeclaration(); break; - case 111 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$ + case 127 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$ consumeModifiers2(); break; - case 123 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$ + case 139 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$ consumeAnnotationAsModifier(); break; - case 124 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$ + case 140 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$ consumeClassDeclaration(); break; - case 125 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$ + case 141 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$ consumeClassHeader(); break; - case 126 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$ + case 142 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$ consumeTypeHeaderNameWithTypeParameters(); break; - case 128 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$ + case 144 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$ consumeClassHeaderName1(); break; - case 129 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$ + case 145 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$ consumeClassHeaderExtends(); break; - case 130 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$ + case 146 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$ consumeClassHeaderImplements(); break; - case 132 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$ + case 148 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$ consumeInterfaceTypeList(); break; - case 133 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ + case 149 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ consumeInterfaceType(); break; - case 136 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$ + case 152 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$ consumeClassBodyDeclarations(); break; - case 140 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$ + case 156 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$ consumeClassBodyDeclaration(); break; - case 141 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$ + case 157 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$ consumeDiet(); break; - case 142 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$ + case 158 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$ consumeClassBodyDeclaration(); break; - case 143 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$ + case 159 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$ consumeCreateInitializer(); break; - case 150 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ + case 166 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ consumeEmptyTypeDeclaration(); break; - case 153 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$ + case 169 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type0..."); } //$NON-NLS-1$ consumeFieldDeclaration(); break; - case 155 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$ + case 171 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$ consumeVariableDeclarators(); break; - case 158 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$ + case 174 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$ consumeEnterVariable(); break; - case 159 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$ + case 175 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$ consumeExitVariableWithInitialization(); break; - case 160 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$ + case 176 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$ consumeExitVariableWithoutInitialization(); break; - case 161 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$ + case 177 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$ consumeForceNoDiet(); break; - case 162 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$ + case 178 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$ consumeRestoreDiet(); break; - case 167 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ + case 179 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= this"); } //$NON-NLS-1$ + consumeExplicitThisParameter(); + break; + + case 185 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ // set to true to consume a method with a body consumeMethodDeclaration(true); break; - case 168 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$ + case 186 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$ // set to false to consume a method without body consumeMethodDeclaration(false); break; - case 169 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$ + case 187 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$ consumeMethodHeader(); break; - case 170 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$ + case 188 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$ consumeMethodHeaderNameWithTypeParameters(false); break; - case 171 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$ + case 189 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type0 Identifier..."); } //$NON-NLS-1$ consumeMethodHeaderName(false); break; - case 172 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$ + case 190 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$ consumeMethodHeaderRightParen(); break; - case 173 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$ + case 191 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$ consumeMethodHeaderExtendedDims(); break; - case 174 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$ + case 192 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$ consumeMethodHeaderThrowsClause(); break; - case 175 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$ + case 193 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$ consumeConstructorHeader(); break; - case 176 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$ + case 194 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$ consumeConstructorHeaderNameWithTypeParameters(); break; - case 177 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$ + case 195 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$ consumeConstructorHeaderName(); break; - case 179 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$ + case 197 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$ consumeFormalParameterList(); break; - case 180 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$ + case 198 : if (DEBUG) { System.out.println("PotentialNameArray ::="); } //$NON-NLS-1$ + consumePotentialNameArrayType(); + break; + + case 199 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); } //$NON-NLS-1$ + consumeFormalParameter(false); + break; + + case 200 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); } //$NON-NLS-1$ + consumeFormalParameter(true); + break; + + case 201 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); } //$NON-NLS-1$ + consumeFormalParameter(false); + break; + + case 202 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); } //$NON-NLS-1$ + consumeFormalParameter(true); + break; + + case 203 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); } //$NON-NLS-1$ + consumeFormalParameter(false); + break; + + case 204 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); } //$NON-NLS-1$ + consumeFormalParameter(true); + break; + + case 205 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); } //$NON-NLS-1$ consumeFormalParameter(false); break; - case 181 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type ELLIPSIS..."); } //$NON-NLS-1$ + case 206 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); } //$NON-NLS-1$ consumeFormalParameter(true); break; - case 182 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$ + case 207 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$ consumeCatchFormalParameter(); break; - case 183 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$ + case 208 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$ consumeCatchType(); break; - case 184 : if (DEBUG) { System.out.println("UnionType ::= Type"); } //$NON-NLS-1$ + case 209 : if (DEBUG) { System.out.println("UnionType ::= TypeInternal"); } //$NON-NLS-1$ consumeUnionTypeAsClassType(); break; - case 185 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$ + case 210 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$ consumeUnionType(); break; - case 187 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$ + case 212 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$ consumeClassTypeList(); break; - case 188 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$ + case 213 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$ consumeClassTypeElt(); break; - case 189 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$ + case 214 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$ consumeMethodBody(); break; - case 190 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$ + case 215 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$ consumeNestedMethod(); break; - case 191 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$ + case 216 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$ consumeStaticInitializer(); break; - case 192 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$ + case 217 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$ consumeStaticOnly(); break; - case 193 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$ + case 218 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$ consumeConstructorDeclaration() ; break; - case 194 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$ + case 219 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$ consumeInvalidConstructorDeclaration() ; break; - case 195 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$ + case 220 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocation(0, THIS_CALL); break; - case 196 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$ + case 221 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$ consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL); break; - case 197 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$ + case 222 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocation(0,SUPER_CALL); break; - case 198 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$ + case 223 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL); break; - case 199 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$ + case 224 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocation(1, SUPER_CALL); break; - case 200 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ + case 225 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL); break; - case 201 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$ + case 226 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$ consumeExplicitConstructorInvocation(2, SUPER_CALL); break; - case 202 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ + case 227 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL); break; - case 203 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$ + case 228 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocation(1, THIS_CALL); break; - case 204 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ + case 229 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL); break; - case 205 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$ + case 230 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$ consumeExplicitConstructorInvocation(2, THIS_CALL); break; - case 206 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ + case 231 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL); break; - case 207 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$ + case 232 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$ consumeInterfaceDeclaration(); break; - case 208 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$ + case 233 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$ consumeInterfaceHeader(); break; - case 209 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$ + case 234 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$ consumeTypeHeaderNameWithTypeParameters(); break; - case 211 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$ + case 236 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$ consumeInterfaceHeaderName1(); break; - case 212 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$ + case 237 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$ consumeInterfaceHeaderExtends(); break; - case 215 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$ + case 240 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$ consumeInterfaceMemberDeclarations(); break; - case 216 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ + case 241 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ consumeEmptyTypeDeclaration(); break; - case 217 : if (DEBUG) { System.out.println("PushDefault ::="); } //$NON-NLS-1$ + case 242 : if (DEBUG) { System.out.println("PushDefault ::="); } //$NON-NLS-1$ consumeInterfaceMethodDefault(); break; - case 219 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader default..."); } //$NON-NLS-1$ + case 244 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader default..."); } //$NON-NLS-1$ consumeInterfaceMethodDeclaration(true); break; - case 220 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ + case 245 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ consumeInterfaceMethodDeclaration(false); break; - case 221 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ + case 246 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ consumeInvalidConstructorDeclaration(true); break; - case 222 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ + case 247 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ consumeInvalidConstructorDeclaration(false); break; - case 233 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ + case 258 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ consumePushLeftBrace(); break; - case 234 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ + case 259 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ consumeEmptyArrayInitializer(); break; - case 235 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ + case 260 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ consumeArrayInitializer(); break; - case 236 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ + case 261 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ consumeArrayInitializer(); break; - case 238 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ + case 263 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ consumeVariableInitializers(); break; - case 239 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ + case 264 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ consumeBlock(); break; - case 240 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ + case 265 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ consumeOpenBlock() ; break; - case 242 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ + case 267 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ consumeBlockStatements() ; break; - case 246 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ + case 271 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ consumeInvalidInterfaceDeclaration(); break; - case 247 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ + case 272 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ consumeInvalidAnnotationTypeDeclaration(); break; - case 248 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ + case 273 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ consumeInvalidEnumDeclaration(); break; - case 249 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ + case 274 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ consumeLocalVariableDeclarationStatement(); break; - case 250 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$ + case 275 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type0 PushModifiers..."); } //$NON-NLS-1$ consumeLocalVariableDeclaration(); break; - case 251 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$ + case 276 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type0..."); } //$NON-NLS-1$ consumeLocalVariableDeclaration(); break; - case 252 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ + case 277 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ consumePushModifiers(); break; - case 253 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ + case 278 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ consumePushModifiersForHeader(); break; - case 254 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ + case 279 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ consumePushRealModifiers(); break; - case 281 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ + case 306 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ consumeEmptyStatement(); break; - case 282 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ + case 307 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ consumeStatementLabel() ; break; - case 283 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ + case 308 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ consumeStatementLabel() ; break; - case 284 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ - consumeLabel() ; + case 309 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ + consumeLabel(); break; - case 285 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ + case 310 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ consumeExpressionStatement(); break; - case 294 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 319 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementIfNoElse(); break; - case 295 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 320 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementIfWithElse(); break; - case 296 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ + case 321 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ consumeStatementIfWithElse(); break; - case 297 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 322 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementSwitch() ; break; - case 298 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ + case 323 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ consumeEmptySwitchBlock() ; break; - case 301 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ + case 326 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ consumeSwitchBlock() ; break; - case 303 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ + case 328 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ consumeSwitchBlockStatements() ; break; - case 304 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ + case 329 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ consumeSwitchBlockStatement() ; break; - case 306 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ + case 331 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ consumeSwitchLabels() ; break; - case 307 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ + case 332 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ consumeCaseLabel(); break; - case 308 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ + case 333 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ consumeDefaultLabel(); break; - case 309 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 334 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementWhile() ; break; - case 310 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ + case 335 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ consumeStatementWhile() ; break; - case 311 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ + case 336 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ consumeStatementDo() ; break; - case 312 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ + case 337 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ consumeStatementFor() ; break; - case 313 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ + case 338 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ consumeStatementFor() ; break; - case 314 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ + case 339 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ consumeForInit() ; break; - case 318 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ + case 343 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ consumeStatementExpressionList() ; break; - case 319 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ + case 344 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ consumeSimpleAssertStatement() ; break; - case 320 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ + case 345 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ consumeAssertStatement() ; break; - case 321 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ + case 346 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ consumeStatementBreak() ; break; - case 322 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ + case 347 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ consumeStatementBreakWithLabel() ; break; - case 323 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ + case 348 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ consumeStatementContinue() ; break; - case 324 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ + case 349 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ consumeStatementContinueWithLabel() ; break; - case 325 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ + case 350 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ consumeStatementReturn() ; break; - case 326 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ + case 351 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ consumeStatementThrow(); break; - case 327 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ + case 352 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ consumeStatementSynchronized(); break; - case 328 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ + case 353 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ consumeOnlySynchronized(); break; - case 329 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ + case 354 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ consumeStatementTry(false, false); break; - case 330 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ + case 355 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ consumeStatementTry(true, false); break; - case 331 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ + case 356 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ consumeStatementTry(false, true); break; - case 332 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ + case 357 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ consumeStatementTry(true, true); break; - case 333 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$ + case 358 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$ consumeResourceSpecification(); break; - case 334 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$ + case 359 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$ consumeResourceOptionalTrailingSemiColon(false); break; - case 335 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$ + case 360 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$ consumeResourceOptionalTrailingSemiColon(true); break; - case 336 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$ + case 361 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$ consumeSingleResource(); break; - case 337 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$ + case 362 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$ consumeMultipleResources(); break; - case 338 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$ + case 363 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$ consumeResourceOptionalTrailingSemiColon(true); break; - case 339 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); } //$NON-NLS-1$ + case 364 : if (DEBUG) { System.out.println("Resource ::= TypeInternal PushModifiers..."); } //$NON-NLS-1$ consumeResourceAsLocalVariableDeclaration(); break; - case 340 : if (DEBUG) { System.out.println("Resource ::= Modifiers Type PushRealModifiers..."); } //$NON-NLS-1$ + case 365 : if (DEBUG) { System.out.println("Resource ::= Modifiers TypeInternal PushRealModifiers..."); } //$NON-NLS-1$ consumeResourceAsLocalVariableDeclaration(); break; - case 342 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ + case 367 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ consumeExitTryBlock(); break; - case 344 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ + case 369 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ consumeCatches(); break; - case 345 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ + case 370 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ consumeStatementCatch() ; break; - case 347 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ + case 372 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ consumeLeftParen(); break; - case 348 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ + case 373 : if (DEBUG) { System.out.println("PushRPARENForUnannotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ + consumeRightParenForUnannotatedTypeCast(); + break; + + case 374 : if (DEBUG) { System.out.println("PushRPARENForNameUnannotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ + consumeRightParenForNameUnannotatedTypeCast(); + break; + + case 375 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ consumeRightParen(); break; - case 353 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ + case 376 : if (DEBUG) { System.out.println("PushRPARENForAnnotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ + consumeRightParenForAnnotatedTypeCast(); + break; + + case 377 : if (DEBUG) { System.out.println("PushRPARENForNameAndAnnotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ + consumeRightParenForNameAndAnnotatedTypeCast(); + break; + + case 382 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ consumePrimaryNoNewArrayThis(); break; - case 354 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ + case 383 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ consumePrimaryNoNewArray(); break; - case 355 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ + case 384 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ consumePrimaryNoNewArrayWithName(); break; - case 358 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ + case 387 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ consumePrimaryNoNewArrayNameThis(); break; - case 359 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ + case 388 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ consumePrimaryNoNewArrayNameSuper(); break; - case 360 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ + case 389 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayName(); break; - case 361 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ + case 390 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayArrayType(); break; - case 362 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ + case 391 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayPrimitiveArrayType(); break; - case 363 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ + case 392 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayPrimitiveType(); break; - case 369 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name COLON_COLON..."); } //$NON-NLS-1$ + case 398 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name COLON_COLON..."); } //$NON-NLS-1$ consumeReferenceExpressionNameForm(); break; - case 370 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ + case 399 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ consumeReferenceExpressionTypeForm(false); break; - case 371 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ + case 400 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ consumeReferenceExpressionTypeForm(true); break; - case 372 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$ + case 401 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$ consumeReferenceExpressionPrimaryForm(); break; - case 373 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); } //$NON-NLS-1$ + case 402 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); } //$NON-NLS-1$ consumeReferenceExpressionSuperForm(); break; - case 374 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$ + case 403 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$ consumeEmptyTypeArguments(); break; - case 376 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$ + case 405 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$ consumeIdentifierOrNew(false); break; - case 377 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$ + case 406 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$ consumeIdentifierOrNew(true); break; - case 378 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); } //$NON-NLS-1$ + case 407 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); } //$NON-NLS-1$ consumeLambdaExpression(); break; - case 379 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier"); } //$NON-NLS-1$ + case 408 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier"); } //$NON-NLS-1$ consumeTypeElidedLambdaParameter(false); break; - case 383 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$ + case 412 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$ consumeFormalParameterList(); break; - case 384 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$ + case 413 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$ consumeTypeElidedLambdaParameter(true); break; - case 386 : if (DEBUG) { System.out.println("LambdaBody ::= NestedType NestedMethod LBRACE..."); } //$NON-NLS-1$ + case 415 : if (DEBUG) { System.out.println("LambdaBody ::= NestedType NestedMethod LBRACE..."); } //$NON-NLS-1$ consumeBlock(); break; - case 387 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$ + case 416 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$ consumeElidedLeftBraceAndReturn(); break; - case 388 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ + case 417 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ consumeAllocationHeader(); break; - case 389 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ + case 418 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionWithTypeArguments(); break; - case 390 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$ + case 419 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpression(); break; - case 391 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ + case 420 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; break; - case 392 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ + case 421 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualified() ; break; - case 393 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ + case 422 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualified() ; break; - case 394 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ + case 423 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; break; - case 395 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$ + case 424 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$ consumeEnterInstanceCreationArgumentList(); break; - case 396 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ + case 425 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionName() ; break; - case 397 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ + case 426 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ consumeClassBodyopt(); break; - case 399 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ + case 428 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ consumeEnterAnonymousClassBody(false); break; - case 400 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ + case 429 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ consumeClassBodyopt(); break; - case 402 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ + case 431 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ consumeEnterAnonymousClassBody(true); break; - case 404 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ + case 433 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ consumeArgumentList(); break; - case 405 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$ + case 434 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new Annotationsopt PrimitiveType"); } //$NON-NLS-1$ consumeArrayCreationHeader(); break; - case 406 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ + case 435 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ consumeArrayCreationHeader(); break; - case 407 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ + case 436 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ consumeArrayCreationExpressionWithoutInitializer(); break; - case 408 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$ + case 437 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new Annotationsopt"); } //$NON-NLS-1$ consumeArrayCreationExpressionWithInitializer(); break; - case 409 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ + case 438 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ consumeArrayCreationExpressionWithoutInitializer(); break; - case 410 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ + case 439 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ consumeArrayCreationExpressionWithInitializer(); break; - case 412 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ + case 441 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ consumeDimWithOrWithOutExprs(); break; - case 414 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ + case 444 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET..."); } //$NON-NLS-1$ + consumeDimWithOrWithOutExpr(); + break; + + case 445 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotations LBRACKET..."); } //$NON-NLS-1$ consumeDimWithOrWithOutExpr(); break; - case 415 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ + case 446 : if (DEBUG) { System.out.println("DimsoptAnnotsopt ::="); } //$NON-NLS-1$ + consumeEmptyDimsoptAnnotsopt(); + break; + + case 447 : if (DEBUG) { System.out.println("DimsoptAnnotsopt -> DimsAnnotLoop"); } //$NON-NLS-1$ + consumeDimsWithTrailingAnnotsopt(); + break; + + case 450 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= Annotation"); } //$NON-NLS-1$ + consumeTypeAnnotation(true); + break; + + case 451 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ + consumeOneDimLoop(true); + break; + + case 452 : if (DEBUG) { System.out.println("TypeAnnotations ::= Annotation"); } //$NON-NLS-1$ + consumeTypeAnnotation(false); + break; + + case 453 : if (DEBUG) { System.out.println("TypeAnnotations ::= TypeAnnotations Annotation"); } //$NON-NLS-1$ + consumeOneMoreTypeAnnotation(); + break; + + case 454 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ consumeDims(); break; - case 418 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ - consumeOneDimLoop(); + case 457 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ + consumeOneDimLoop(false); break; - case 419 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ + case 458 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); } //$NON-NLS-1$ + consumeOneDimLoopWithAnnotations(); + break; + + case 459 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ consumeFieldAccess(false); break; - case 420 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ + case 460 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ consumeFieldAccess(true); break; - case 421 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ + case 461 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ consumeMethodInvocationName(); break; - case 422 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 462 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationNameWithTypeArguments(); break; - case 423 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 463 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationPrimaryWithTypeArguments(); break; - case 424 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ + case 464 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ consumeMethodInvocationPrimary(); break; - case 425 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 465 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationSuperWithTypeArguments(); break; - case 426 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ + case 466 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ consumeMethodInvocationSuper(); break; - case 427 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ + case 467 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ consumeArrayAccess(true); break; - case 428 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ + case 468 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ consumeArrayAccess(false); break; - case 429 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ + case 469 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ consumeArrayAccess(false); break; - case 431 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ + case 471 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ consumePostfixExpression(); break; - case 434 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ + case 474 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS,true); break; - case 435 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ + case 475 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS,true); break; - case 436 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ + case 476 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ consumePushPosition(); break; - case 439 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ + case 479 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS); break; - case 440 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ + case 480 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS); break; - case 442 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ + case 482 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS,false); break; - case 443 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ + case 483 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS,false); break; - case 445 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ + case 485 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.TWIDDLE); break; - case 446 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ + case 486 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.NOT); break; - case 448 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ + case 488 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ consumeCastExpressionWithPrimitiveType(); break; - case 449 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ + case 489 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers PrimitiveType..."); } //$NON-NLS-1$ + consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations(); + break; + + case 490 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ consumeCastExpressionWithGenericsArray(); break; - case 450 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ + case 491 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ + consumeCastExpressionWithGenericsArrayWithTypeAnnotations(); + break; + + case 492 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ consumeCastExpressionWithQualifiedGenericsArray(); break; - case 451 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$ + case 493 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ + consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations(); + break; + + case 494 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ consumeCastExpressionLL1(); break; - case 452 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); } //$NON-NLS-1$ + case 495 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ + consumeCastExpressionLL1WithTypeAnnotations(); + break; + + case 496 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); } //$NON-NLS-1$ consumeCastExpressionWithNameArray(); break; - case 453 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ + case 497 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name Dims..."); } //$NON-NLS-1$ + consumeCastExpressionWithNameArrayWithTypeAnnotations(); + break; + + case 498 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ consumeOnlyTypeArgumentsForCastExpression(); break; - case 454 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ + case 499 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ consumeInsideCastExpression(); break; - case 455 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ + case 500 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ consumeInsideCastExpressionLL1(); break; - case 456 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ + case 501 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ consumeInsideCastExpressionWithQualifiedGenerics(); break; - case 458 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ + case 502 : if (DEBUG) { System.out.println("InsideCastExpressionWithAnnotatedQualifiedGenerics ::="); } //$NON-NLS-1$ + consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); + break; + + case 504 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MULTIPLY); break; - case 459 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ + case 505 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.DIVIDE); break; - case 460 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ + case 506 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.REMAINDER); break; - case 462 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ + case 508 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.PLUS); break; - case 463 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ + case 509 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MINUS); break; - case 465 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ + case 511 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LEFT_SHIFT); break; - case 466 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ + case 512 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); break; - case 467 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ + case 513 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); break; - case 469 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ + case 515 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS); break; - case 470 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ + case 516 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER); break; - case 471 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ + case 517 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS_EQUAL); break; - case 472 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ + case 518 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER_EQUAL); break; - case 474 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ + case 520 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ consumeInstanceOfExpression(); break; - case 476 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ + case 522 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); break; - case 477 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ + case 523 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.NOT_EQUAL); break; - case 479 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ + case 525 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND); break; - case 481 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ + case 527 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.XOR); break; - case 483 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ + case 529 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR); break; - case 485 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ + case 531 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND_AND); break; - case 487 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ + case 533 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR_OR); break; - case 489 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ + case 535 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; break; - case 492 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ + case 538 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ consumeAssignment(); break; - case 494 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ + case 540 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ ignoreExpressionAssignment(); break; - case 495 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ + case 541 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(EQUAL); break; - case 496 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ + case 542 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(MULTIPLY); break; - case 497 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ + case 543 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(DIVIDE); break; - case 498 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ + case 544 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(REMAINDER); break; - case 499 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ + case 545 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(PLUS); break; - case 500 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ + case 546 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(MINUS); break; - case 501 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ + case 547 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(LEFT_SHIFT); break; - case 502 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ + case 548 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(RIGHT_SHIFT); break; - case 503 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ + case 549 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT); break; - case 504 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ + case 550 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(AND); break; - case 505 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ + case 551 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(XOR); break; - case 506 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ + case 552 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(OR); break; - case 507 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$ + case 553 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$ consumeExpression(); break; - case 510 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ + case 556 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ consumeEmptyExpression(); break; - case 515 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ + case 561 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyClassBodyDeclarationsopt(); break; - case 516 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ + case 562 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ consumeClassBodyDeclarationsopt(); break; - case 517 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ + case 563 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ consumeDefaultModifiers(); break; - case 518 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ + case 564 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ consumeModifiers(); break; - case 519 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ + case 565 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ consumeEmptyBlockStatementsopt(); break; - case 521 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ + case 567 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ consumeEmptyDimsopt(); break; - case 523 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ + case 569 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ consumeEmptyArgumentListopt(); break; - case 527 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ + case 573 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ consumeFormalParameterListopt(); break; - case 531 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ + case 577 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyInterfaceMemberDeclarationsopt(); break; - case 532 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ + case 578 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ consumeInterfaceMemberDeclarationsopt(); break; - case 533 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ + case 579 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ consumeNestedType(); break; - case 534 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ + case 580 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ consumeEmptyForInitopt(); break; - case 536 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ + case 582 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ consumeEmptyForUpdateopt(); break; - case 540 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ + case 586 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ consumeEmptyCatchesopt(); break; - case 542 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ + case 588 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ consumeEnumDeclaration(); break; - case 543 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ + case 589 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ consumeEnumHeader(); break; - case 544 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ + case 590 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ consumeEnumHeaderName(); break; - case 545 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ + case 591 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ consumeEnumHeaderNameWithTypeParameters(); break; - case 546 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ + case 592 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ consumeEnumBodyNoConstants(); break; - case 547 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ + case 593 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ consumeEnumBodyNoConstants(); break; - case 548 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ + case 594 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ consumeEnumBodyWithConstants(); break; - case 549 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ + case 595 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ consumeEnumBodyWithConstants(); break; - case 551 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ + case 597 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ consumeEnumConstants(); break; - case 552 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ + case 598 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ consumeEnumConstantHeaderName(); break; - case 553 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ + case 599 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ consumeEnumConstantHeader(); break; - case 554 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ + case 600 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ consumeEnumConstantWithClassBody(); break; - case 555 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ + case 601 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ consumeEnumConstantNoClassBody(); break; - case 556 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ + case 602 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ consumeArguments(); break; - case 557 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ + case 603 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ consumeEmptyArguments(); break; - case 559 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ + case 605 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ consumeEnumDeclarations(); break; - case 560 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ + case 606 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyEnumDeclarations(); break; - case 562 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ + case 608 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ consumeEnhancedForStatement(); break; - case 563 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ + case 609 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ consumeEnhancedForStatement(); break; - case 564 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$ + case 610 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type0..."); } //$NON-NLS-1$ consumeEnhancedForStatementHeaderInit(false); break; - case 565 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ + case 611 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ consumeEnhancedForStatementHeaderInit(true); break; - case 566 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ + case 612 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ consumeEnhancedForStatementHeader(); break; - case 567 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ + case 613 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ consumeImportDeclaration(); break; - case 568 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ + case 614 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ consumeSingleStaticImportDeclarationName(); break; - case 569 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ + case 615 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ consumeImportDeclaration(); break; - case 570 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ + case 616 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ consumeStaticImportOnDemandDeclarationName(); break; - case 571 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ + case 617 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ consumeTypeArguments(); break; - case 572 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ + case 618 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ consumeOnlyTypeArguments(); break; - case 574 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ + case 620 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ consumeTypeArgumentList1(); break; - case 576 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ + case 622 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ consumeTypeArgumentList(); break; - case 577 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ + case 623 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ consumeTypeArgument(); break; - case 581 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ + case 627 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ consumeReferenceType1(); break; - case 582 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ + case 628 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ consumeTypeArgumentReferenceType1(); break; - case 584 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ + case 629 : if (DEBUG) { System.out.println("ReferenceType1 ::= Modifiers ClassOrInterface LESS..."); } //$NON-NLS-1$ + consumeTypeArgumentReferenceType1WithTypeAnnotations(); + break; + + case 631 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ consumeTypeArgumentList2(); break; - case 587 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ + case 634 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ consumeReferenceType2(); break; - case 588 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ + case 635 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ consumeTypeArgumentReferenceType2(); break; - case 590 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ + case 636 : if (DEBUG) { System.out.println("ReferenceType2 ::= Modifiers ClassOrInterface LESS..."); } //$NON-NLS-1$ + consumeTypeArgumentReferenceType2WithTypeAnnotations(); + break; + + case 638 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ consumeTypeArgumentList3(); break; - case 593 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ + case 641 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ consumeReferenceType3(); break; - case 594 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ + case 642 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ consumeWildcard(); break; - case 595 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ + case 643 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ consumeWildcardWithBounds(); break; - case 596 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ + case 644 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ consumeWildcardBoundsExtends(); break; - case 597 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ + case 645 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ consumeWildcardBoundsSuper(); break; - case 598 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ + case 646 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ consumeWildcard1(); break; - case 599 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ + case 647 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ consumeWildcard1WithBounds(); break; - case 600 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ + case 648 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ consumeWildcardBounds1Extends(); break; - case 601 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ + case 649 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ consumeWildcardBounds1Super(); break; - case 602 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ + case 650 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ consumeWildcard2(); break; - case 603 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ + case 651 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ consumeWildcard2WithBounds(); break; - case 604 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ + case 652 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ consumeWildcardBounds2Extends(); break; - case 605 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ + case 653 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ consumeWildcardBounds2Super(); break; - case 606 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ + case 654 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ consumeWildcard3(); break; - case 607 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ + case 655 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ consumeWildcard3WithBounds(); break; - case 608 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ + case 656 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ consumeWildcardBounds3Extends(); break; - case 609 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ + case 657 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ consumeWildcardBounds3Super(); break; - case 610 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); } //$NON-NLS-1$ + case 658 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); } //$NON-NLS-1$ + consumeZeroTypeAnnotations(true); + break; + + case 659 : if (DEBUG) { System.out.println("TypeParameterHeader ::= PushZeroTypeAnnotations..."); } //$NON-NLS-1$ consumeTypeParameterHeader(); break; - case 611 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ + case 660 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotations Identifier"); } //$NON-NLS-1$ + consumeTypeParameterHeader(); + break; + + case 661 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ consumeTypeParameters(); break; - case 613 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ + case 663 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ consumeTypeParameterList(); break; - case 615 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 665 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameterWithExtends(); break; - case 616 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 666 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameterWithExtendsAndBounds(); break; - case 618 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ + case 668 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ consumeAdditionalBoundList(); break; - case 619 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ + case 669 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ consumeAdditionalBound(); break; - case 621 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ + case 671 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ consumeTypeParameterList1(); break; - case 622 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ + case 672 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ consumeTypeParameter1(); break; - case 623 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 673 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameter1WithExtends(); break; - case 624 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 674 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameter1WithExtendsAndBounds(); break; - case 626 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ + case 676 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ consumeAdditionalBoundList1(); break; - case 627 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ + case 677 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ consumeAdditionalBound1(); break; - case 633 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ + case 683 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS); break; - case 634 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ + case 684 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS); break; - case 637 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ + case 687 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.TWIDDLE); break; - case 638 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ + case 688 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.NOT); break; - case 641 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ + case 691 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MULTIPLY); break; - case 642 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ + case 692 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.MULTIPLY); break; - case 643 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ + case 693 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.DIVIDE); break; - case 644 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ + case 694 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.DIVIDE); break; - case 645 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ + case 695 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.REMAINDER); break; - case 646 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ + case 696 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.REMAINDER); break; - case 648 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ + case 698 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.PLUS); break; - case 649 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ + case 699 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.PLUS); break; - case 650 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ + case 700 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MINUS); break; - case 651 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ + case 701 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.MINUS); break; - case 653 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ + case 703 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LEFT_SHIFT); break; - case 654 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ + case 704 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT); break; - case 655 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ + case 705 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); break; - case 656 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ + case 706 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT); break; - case 657 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ + case 707 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); break; - case 658 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ + case 708 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT); break; - case 660 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ + case 710 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS); break; - case 661 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ + case 711 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.LESS); break; - case 662 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ + case 712 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER); break; - case 663 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ + case 713 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.GREATER); break; - case 664 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ + case 714 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS_EQUAL); break; - case 665 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ + case 715 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL); break; - case 666 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ + case 716 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER_EQUAL); break; - case 667 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ + case 717 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL); break; - case 669 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ + case 719 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ consumeInstanceOfExpressionWithName(); break; - case 670 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ + case 720 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ consumeInstanceOfExpression(); break; - case 672 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ + case 722 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); break; - case 673 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ + case 723 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL); break; - case 674 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ + case 724 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.NOT_EQUAL); break; - case 675 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ + case 725 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL); break; - case 677 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ + case 727 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND); break; - case 678 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ + case 728 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.AND); break; - case 680 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ + case 730 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.XOR); break; - case 681 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ + case 731 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.XOR); break; - case 683 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ + case 733 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR); break; - case 684 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ + case 734 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.OR); break; - case 686 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ + case 736 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND_AND); break; - case 687 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ + case 737 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.AND_AND); break; - case 689 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ + case 739 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR_OR); break; - case 690 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ + case 740 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.OR_OR); break; - case 692 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ + case 742 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; break; - case 693 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ + case 743 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ; break; - case 697 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ + case 747 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderName() ; break; - case 698 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ + case 748 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; break; - case 699 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ + case 749 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; break; - case 700 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ + case 750 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderName() ; break; - case 701 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ + case 751 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeader() ; break; - case 702 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ + case 752 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclaration() ; break; - case 704 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ + case 754 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyAnnotationTypeMemberDeclarationsopt() ; break; - case 705 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ + case 755 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ consumeAnnotationTypeMemberDeclarationsopt() ; break; - case 707 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ + case 757 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeMemberDeclarations() ; break; - case 708 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ + case 758 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ consumeMethodHeaderNameWithTypeParameters(true); break; - case 709 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ + case 759 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type0..."); } //$NON-NLS-1$ consumeMethodHeaderName(true); break; - case 710 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ + case 760 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ consumeEmptyMethodHeaderDefaultValue() ; break; - case 711 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ + case 761 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ consumeMethodHeaderDefaultValue(); break; - case 712 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ + case 762 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ consumeMethodHeader(); break; - case 713 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ + case 763 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeMemberDeclaration() ; break; - case 721 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ + case 771 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ consumeAnnotationName() ; break; - case 722 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ + case 772 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ consumeNormalAnnotation() ; break; - case 723 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ + case 773 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ consumeEmptyMemberValuePairsopt() ; break; - case 726 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ + case 776 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ consumeMemberValuePairs() ; break; - case 727 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ + case 777 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ consumeMemberValuePair() ; break; - case 728 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ + case 778 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ consumeEnterMemberValue() ; break; - case 729 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ + case 779 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ consumeExitMemberValue() ; break; - case 731 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ + case 781 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ consumeMemberValueAsName() ; break; - case 734 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 784 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeMemberValueArrayInitializer() ; break; - case 735 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 785 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeMemberValueArrayInitializer() ; break; - case 736 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 786 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeEmptyMemberValueArrayInitializer() ; break; - case 737 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 787 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeEmptyMemberValueArrayInitializer() ; break; - case 738 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ + case 788 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ consumeEnterMemberValueArrayInitializer() ; break; - case 740 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ + case 790 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ consumeMemberValues() ; break; - case 741 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ + case 791 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ consumeMarkerAnnotation() ; break; - case 742 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ + case 792 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ consumeSingleMemberAnnotationMemberValue() ; break; - case 743 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ + case 793 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ consumeSingleMemberAnnotation() ; break; - case 744 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ + case 794 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ consumeRecoveryMethodHeaderNameWithTypeParameters(); break; - case 745 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ + case 795 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type0..."); } //$NON-NLS-1$ consumeRecoveryMethodHeaderName(); break; - case 746 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ + case 796 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ consumeMethodHeader(); break; - case 747 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ + case 797 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ consumeMethodHeader(); break; } } +protected void consumeExplicitThisParameter() { + // VariableDeclaratorIdOrThis ::= 'this' + + int stackLength = this.identifierStack.length; + if (++this.identifierPtr >= stackLength) { + System.arraycopy( + this.identifierStack, 0, + this.identifierStack = new char[stackLength + 20][], 0, + stackLength); + System.arraycopy( + this.identifierPositionStack, 0, + this.identifierPositionStack = new long[stackLength + 20], 0, + stackLength); + } + this.identifierStack[this.identifierPtr] = ConstantPool.This; + int thisStart = this.intStack[this.intPtr--]; + this.identifierPositionStack[this.identifierPtr] = + (((long) thisStart << 32)) + (thisStart + 3); + + stackLength = this.identifierLengthStack.length; + if (++this.identifierLengthPtr >= stackLength) { + System.arraycopy( + this.identifierLengthStack, 0, + this.identifierLengthStack = new int[stackLength + 10], 0, + stackLength); + } + this.identifierLengthStack[this.identifierLengthPtr] = 1; + pushOnIntStack(0); // extended dimensions.. +} protected void consumeLambdaExpression() { // LambdaExpression ::= LambdaParameters ARROW LambdaBody @@ -8287,11 +8995,65 @@ protected void consumeTypeArgumentReferenceType1() { pushOnGenericsStack(getTypeReference(0)); this.intPtr--; } +protected void consumeTypeArgumentReferenceType1WithTypeAnnotations() { + concatGenericsLists(); + TypeReference typeReference = getUnannotatedTypeReference(0); + // copy from expression stack to type annotation stack + int length; + if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + typeReference.annotations = new Annotation[length], + 0, + length); + int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; + if (this.modifiersSourceStart < typeReferenceSourceStart) { + typeReferenceSourceStart = this.modifiersSourceStart; + } + typeReference.bits |= ASTNode.HasTypeAnnotations; + typeReference.sourceStart = typeReferenceSourceStart; + } + pushOnGenericsStack(typeReference); + // remove the 0 pushed by ZeroTypeAnnotation + this.typeAnnotationLengthPtr--; + this.intPtr--; + if (this.modifiers != ClassFileConstants.AccDefault) { + problemReporter().invalidLocationForModifiers(typeReference); + } + resetModifiers(); +} protected void consumeTypeArgumentReferenceType2() { concatGenericsLists(); pushOnGenericsStack(getTypeReference(0)); this.intPtr--; } +protected void consumeTypeArgumentReferenceType2WithTypeAnnotations() { + concatGenericsLists(); + TypeReference typeReference = getUnannotatedTypeReference(0); + // copy from expression stack to type annotation stack + int length; + if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { + System.arraycopy( + this.expressionStack, + (this.expressionPtr -= length) + 1, + typeReference.annotations = new Annotation[length], + 0, + length); + int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; + if (this.modifiersSourceStart < typeReferenceSourceStart) { + typeReferenceSourceStart = this.modifiersSourceStart; + } + typeReference.bits |= ASTNode.HasTypeAnnotations; + typeReference.sourceStart = typeReferenceSourceStart; + } + pushOnGenericsStack(typeReference); + this.intPtr--; + if (this.modifiers != ClassFileConstants.AccDefault) { + problemReporter().invalidLocationForModifiers(typeReference); + } + resetModifiers(); +} protected void consumeTypeArguments() { concatGenericsLists(); this.intPtr--; @@ -8380,6 +9142,7 @@ protected void consumeTypeParameter1WithExtends() { typeParameter.declarationSourceEnd = superType.sourceEnd; typeParameter.type = superType; superType.bits |= ASTNode.IsSuperType; + typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations); this.genericsStack[this.genericsPtr] = typeParameter; } protected void consumeTypeParameter1WithExtendsAndBounds() { @@ -8392,15 +9155,28 @@ protected void consumeTypeParameter1WithExtendsAndBounds() { TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr]; typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd; typeParameter.type = superType; + typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations); superType.bits |= ASTNode.IsSuperType; typeParameter.bounds = bounds; for (int i = 0, max = bounds.length; i < max; i++) { - bounds[i].bits |= ASTNode.IsSuperType; + TypeReference bound = bounds[i]; + bound.bits |= ASTNode.IsSuperType; + typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations); } } protected void consumeTypeParameterHeader() { //TypeParameterHeader ::= Identifier TypeParameter typeParameter = new TypeParameter(); + int length; + if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { + System.arraycopy( + this.typeAnnotationStack, + (this.typeAnnotationPtr -= length) + 1, + typeParameter.annotations = new Annotation[length], + 0, + length); + typeParameter.bits |= ASTNode.HasTypeAnnotations; + } long pos = this.identifierPositionStack[this.identifierPtr]; final int end = (int) pos; typeParameter.declarationSourceEnd = end; @@ -8452,6 +9228,7 @@ protected void consumeTypeParameterWithExtends() { TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr]; typeParameter.declarationSourceEnd = superType.sourceEnd; typeParameter.type = superType; + typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations); superType.bits |= ASTNode.IsSuperType; } protected void consumeTypeParameterWithExtendsAndBounds() { @@ -8463,11 +9240,14 @@ protected void consumeTypeParameterWithExtendsAndBounds() { TypeReference superType = getTypeReference(this.intStack[this.intPtr--]); TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr]; typeParameter.type = superType; + typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations); superType.bits |= ASTNode.IsSuperType; typeParameter.bounds = bounds; typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd; for (int i = 0, max = bounds.length; i < max; i++) { - bounds[i].bits |= ASTNode.IsSuperType; + TypeReference bound = bounds[i]; + bound.bits |= ASTNode.IsSuperType; + typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations); } } protected void consumeUnaryExpression(int op) { @@ -8705,12 +9485,18 @@ public MethodDeclaration convertToMethodDeclaration(ConstructorDeclaration c, Co m.explicitDeclarations = c.explicitDeclarations; m.returnType = null; m.javadoc = c.javadoc; + m.bits = c.bits; return m; } protected TypeReference copyDims(TypeReference typeRef, int dim) { return typeRef.copyDims(dim); } + +protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation[][]annotationsOnDimensions) { + return typeRef.copyDims(dim, annotationsOnDimensions); +} + protected FieldDeclaration createFieldDeclaration(char[] fieldDeclarationName, int sourceStart, int sourceEnd) { return new FieldDeclaration(fieldDeclarationName, sourceStart, sourceEnd); } @@ -9192,13 +9978,35 @@ protected Expression getTypeReference(Expression exp) { return exp; } protected TypeReference getTypeReference(int dim) { + TypeReference ref = getUnannotatedTypeReference(dim); + int length; + if (this.typeAnnotationLengthPtr >= 0 + && (length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { + // if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { + + System.arraycopy( + this.typeAnnotationStack, + (this.typeAnnotationPtr -= length) + 1, + ref.annotations = new Annotation[length], + 0, + length); + ref.sourceStart = ref.annotations[0].sourceStart; + ref.bits |= ASTNode.HasTypeAnnotations; + } + return ref; + } +protected TypeReference getUnannotatedTypeReference(int dim) { /* build a Reference on a variable that may be qualified or not This variable is a type reference and dim will be its dimensions*/ TypeReference ref; + Annotation [][] annotationsOnDimensions = null; int length = this.identifierLengthStack[this.identifierLengthPtr--]; if (length < 0) { //flag for precompiled type reference on base types - ref = TypeReference.baseTypeReference(-length, dim); + if (dim > 0) { + annotationsOnDimensions = getAnnotationsOnDimensions(dim); + } + ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions); ref.sourceStart = this.intStack[this.intPtr--]; if (dim == 0) { ref.sourceEnd = this.intStack[this.intPtr--]; @@ -9220,12 +10028,17 @@ protected TypeReference getTypeReference(int dim) { this.identifierStack[this.identifierPtr], this.identifierPositionStack[this.identifierPtr--]); } else { + annotationsOnDimensions = getAnnotationsOnDimensions(dim); ref = new ArrayTypeReference( this.identifierStack[this.identifierPtr], dim, + annotationsOnDimensions, this.identifierPositionStack[this.identifierPtr--]); ref.sourceEnd = this.endPosition; + if (annotationsOnDimensions != null) { + ref.bits |= ASTNode.HasTypeAnnotations; + } } } else { this.genericsLengthPtr--; @@ -9243,14 +10056,17 @@ protected TypeReference getTypeReference(int dim) { if (dim == 0) { ref = new QualifiedTypeReference(tokens, positions); } else { - ref = new ArrayQualifiedTypeReference(tokens, dim, positions); + annotationsOnDimensions = getAnnotationsOnDimensions(dim); + ref = new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions); ref.sourceEnd = this.endPosition; + ref.bits |= ASTNode.HasTypeAnnotations; } } } return ref; } protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) { + Annotation[][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim); if (identifierLength == 1 && numberOfIdentifiers == 1) { int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--]; TypeReference[] typeArguments = null; @@ -9261,7 +10077,7 @@ protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLe this.genericsPtr -= currentTypeArgumentsLength; System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments, 0, currentTypeArgumentsLength); } - ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.identifierStack[this.identifierPtr], typeArguments, dim, this.identifierPositionStack[this.identifierPtr--]); + ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.identifierStack[this.identifierPtr], typeArguments, dim, annotationsOnDimensions, this.identifierPositionStack[this.identifierPtr--]); if (dim != 0) { parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition; } @@ -9303,7 +10119,7 @@ protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLe currentIdentifiersLength = this.identifierLengthStack[this.identifierLengthPtr--]; } } - ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions); + ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, annotationsOnDimensions, positions); if (dim != 0) { parameterizedQualifiedTypeReference.sourceEnd = this.endStatementPosition; } @@ -9535,6 +10351,9 @@ public void initialize(boolean initializeNLS) { this.astLengthPtr = -1; this.expressionPtr = -1; this.expressionLengthPtr = -1; + this.unattachedAnnotationPtr = -1; + this.typeAnnotationLengthPtr = -1; + this.typeAnnotationPtr = -1; this.identifierPtr = -1; this.identifierLengthPtr = -1; this.intPtr = -1; @@ -10755,6 +11574,37 @@ protected void pushOnAstStack(ASTNode node) { } this.astLengthStack[this.astLengthPtr] = 1; } +protected void pushOnTypeAnnotationStack(Annotation annotation) { + + int stackLength = this.typeAnnotationStack.length; + if (++this.typeAnnotationPtr >= stackLength) { + System.arraycopy( + this.typeAnnotationStack, 0, + this.typeAnnotationStack = new Annotation[stackLength + TypeAnnotationStackIncrement], 0, + stackLength); + } + this.typeAnnotationStack[this.typeAnnotationPtr] = annotation; + + stackLength = this.typeAnnotationLengthStack.length; + if (++this.typeAnnotationLengthPtr >= stackLength) { + System.arraycopy( + this.typeAnnotationLengthStack, 0, + this.typeAnnotationLengthStack = new int[stackLength + TypeAnnotationStackIncrement], 0, + stackLength); + } + this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = 1; +} +protected void pushOnTypeAnnotationLengthStack(int pos) { + + int stackLength = this.typeAnnotationLengthStack.length; + if (++this.typeAnnotationLengthPtr >= stackLength) { + System.arraycopy( + this.typeAnnotationLengthStack, 0, + this.typeAnnotationLengthStack = new int[stackLength + TypeAnnotationStackIncrement], 0, + stackLength); + } + this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = pos; +} protected void pushOnExpressionStack(Expression expr) { int stackLength = this.expressionStack.length; @@ -11178,6 +12028,9 @@ protected void resetStacks() { this.astLengthPtr = -1; this.expressionPtr = -1; this.expressionLengthPtr = -1; + this.unattachedAnnotationPtr = -1; + this.typeAnnotationLengthPtr = -1; + this.typeAnnotationPtr = -1; this.identifierPtr = -1; this.identifierLengthPtr = -1; this.intPtr = -1; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java index cbd1e2ab84..962044221c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java @@ -9,6 +9,10 @@ * Community Process (JCP) and is made available for testing and evaluation purposes * only. The code is not compatible with any specification of the JCP. * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -19,21 +23,21 @@ package org.eclipse.jdt.internal.compiler.parser; public interface ParserBasicInformation { int ERROR_SYMBOL = 115, - MAX_NAME_LENGTH = 41, - NUM_STATES = 1033, + MAX_NAME_LENGTH = 50, + NUM_STATES = 1095, NT_OFFSET = 115, - SCOPE_UBOUND = 144, - SCOPE_SIZE = 145, - LA_STATE_OFFSET = 13788, + SCOPE_UBOUND = 240, + SCOPE_SIZE = 241, + LA_STATE_OFFSET = 16594, MAX_LA = 1, - NUM_RULES = 747, + NUM_RULES = 797, NUM_TERMINALS = 115, - NUM_NON_TERMINALS = 335, - NUM_SYMBOLS = 450, - START_STATE = 939, + NUM_NON_TERMINALS = 357, + NUM_SYMBOLS = 472, + START_STATE = 864, EOFT_SYMBOL = 67, EOLT_SYMBOL = 67, - ACCEPT_ACTION = 13787, - ERROR_ACTION = 13788; + ACCEPT_ACTION = 16593, + ERROR_ACTION = 16594; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java index cc25135e58..597b28ec65 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java @@ -10,6 +10,10 @@ * only. The code is not compatible with any specification of the JCP. * * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -39,118 +43,118 @@ public interface TerminalTokens { TokenNameCOMMENT_BLOCK = 1002, TokenNameCOMMENT_JAVADOC = 1003; - int TokenNameIdentifier = 22, - TokenNameabstract = 58, - TokenNameassert = 89, - TokenNameboolean = 33, - TokenNamebreak = 90, - TokenNamebyte = 34, - TokenNamecase = 106, - TokenNamecatch = 104, - TokenNamechar = 35, - TokenNameclass = 76, - TokenNamecontinue = 91, + int TokenNameIdentifier = 19, + TokenNameabstract = 46, + TokenNameassert = 79, + TokenNameboolean = 32, + TokenNamebreak = 80, + TokenNamebyte = 33, + TokenNamecase = 107, + TokenNamecatch = 105, + TokenNamechar = 34, + TokenNameclass = 77, + TokenNamecontinue = 81, TokenNameconst = 113, - TokenNamedefault = 100, - TokenNamedo = 92, - TokenNamedouble = 36, - TokenNameelse = 108, - TokenNameenum = 102, - TokenNameextends = 103, - TokenNamefalse = 46, - TokenNamefinal = 59, - TokenNamefinally = 107, - TokenNamefloat = 37, - TokenNamefor = 93, + TokenNamedefault = 90, + TokenNamedo = 82, + TokenNamedouble = 35, + TokenNameelse = 109, + TokenNameenum = 103, + TokenNameextends = 104, + TokenNamefalse = 57, + TokenNamefinal = 47, + TokenNamefinally = 108, + TokenNamefloat = 36, + TokenNamefor = 83, TokenNamegoto = 114, - TokenNameif = 94, - TokenNameimplements = 111, - TokenNameimport = 105, + TokenNameif = 84, + TokenNameimplements = 112, + TokenNameimport = 106, TokenNameinstanceof = 17, - TokenNameint = 38, - TokenNameinterface = 99, - TokenNamelong = 39, - TokenNamenative = 60, - TokenNamenew = 44, - TokenNamenull = 47, - TokenNamepackage = 101, - TokenNameprivate = 61, - TokenNameprotected = 62, - TokenNamepublic = 63, - TokenNamereturn = 95, - TokenNameshort = 40, - TokenNamestatic = 56, - TokenNamestrictfp = 64, - TokenNamesuper = 42, - TokenNameswitch = 96, - TokenNamesynchronized = 57, + TokenNameint = 37, + TokenNameinterface = 89, + TokenNamelong = 38, + TokenNamenative = 48, + TokenNamenew = 56, + TokenNamenull = 58, + TokenNamepackage = 91, + TokenNameprivate = 49, + TokenNameprotected = 50, + TokenNamepublic = 51, + TokenNamereturn = 85, + TokenNameshort = 39, + TokenNamestatic = 44, + TokenNamestrictfp = 52, + TokenNamesuper = 53, + TokenNameswitch = 86, + TokenNamesynchronized = 45, TokenNamethis = 43, - TokenNamethrow = 97, - TokenNamethrows = 110, - TokenNametransient = 65, - TokenNametrue = 48, - TokenNametry = 98, - TokenNamevoid = 41, - TokenNamevolatile = 66, - TokenNamewhile = 77, - TokenNameIntegerLiteral = 49, - TokenNameLongLiteral = 50, - TokenNameFloatingPointLiteral = 51, - TokenNameDoubleLiteral = 52, - TokenNameCharacterLiteral = 53, - TokenNameStringLiteral = 54, + TokenNamethrow = 87, + TokenNamethrows = 111, + TokenNametransient = 54, + TokenNametrue = 59, + TokenNametry = 88, + TokenNamevoid = 40, + TokenNamevolatile = 55, + TokenNamewhile = 78, + TokenNameIntegerLiteral = 60, + TokenNameLongLiteral = 61, + TokenNameFloatingPointLiteral = 62, + TokenNameDoubleLiteral = 63, + TokenNameCharacterLiteral = 64, + TokenNameStringLiteral = 65, TokenNamePLUS_PLUS = 2, TokenNameMINUS_MINUS = 3, - TokenNameEQUAL_EQUAL = 19, + TokenNameEQUAL_EQUAL = 20, TokenNameLESS_EQUAL = 13, TokenNameGREATER_EQUAL = 14, - TokenNameNOT_EQUAL = 20, + TokenNameNOT_EQUAL = 21, TokenNameLEFT_SHIFT = 18, TokenNameRIGHT_SHIFT = 15, TokenNameUNSIGNED_RIGHT_SHIFT = 16, - TokenNamePLUS_EQUAL = 78, - TokenNameMINUS_EQUAL = 79, - TokenNameMULTIPLY_EQUAL = 80, - TokenNameDIVIDE_EQUAL = 81, - TokenNameAND_EQUAL = 82, - TokenNameOR_EQUAL = 83, - TokenNameXOR_EQUAL = 84, - TokenNameREMAINDER_EQUAL = 85, - TokenNameLEFT_SHIFT_EQUAL = 86, - TokenNameRIGHT_SHIFT_EQUAL = 87, - TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 88, - TokenNameOR_OR = 30, - TokenNameAND_AND = 29, + TokenNamePLUS_EQUAL = 92, + TokenNameMINUS_EQUAL = 93, + TokenNameMULTIPLY_EQUAL = 94, + TokenNameDIVIDE_EQUAL = 95, + TokenNameAND_EQUAL = 96, + TokenNameOR_EQUAL = 97, + TokenNameXOR_EQUAL = 98, + TokenNameREMAINDER_EQUAL = 99, + TokenNameLEFT_SHIFT_EQUAL = 100, + TokenNameRIGHT_SHIFT_EQUAL = 101, + TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 102, + TokenNameOR_OR = 31, + TokenNameAND_AND = 30, TokenNamePLUS = 4, TokenNameMINUS = 5, - TokenNameNOT = 70, + TokenNameNOT = 69, TokenNameREMAINDER = 8, - TokenNameXOR = 23, - TokenNameAND = 21, + TokenNameXOR = 24, + TokenNameAND = 22, TokenNameMULTIPLY = 7, TokenNameOR = 25, - TokenNameTWIDDLE = 71, + TokenNameTWIDDLE = 70, TokenNameDIVIDE = 9, TokenNameGREATER = 12, - TokenNameLESS = 11, - TokenNameLPAREN = 24, - TokenNameRPAREN = 26, + TokenNameLESS = 10, + TokenNameLPAREN = 26, + TokenNameRPAREN = 27, TokenNameLBRACE = 68, - TokenNameRBRACE = 32, + TokenNameRBRACE = 42, TokenNameLBRACKET = 6, TokenNameRBRACKET = 72, TokenNameSEMICOLON = 28, - TokenNameQUESTION = 27, - TokenNameCOLON = 69, - TokenNameCOMMA = 31, + TokenNameQUESTION = 29, + TokenNameCOLON = 71, + TokenNameCOMMA = 41, TokenNameDOT = 1, TokenNameEQUAL = 74, - TokenNameAT = 45, - TokenNameELLIPSIS = 112, - TokenNameARROW = 109, - TokenNameCOLON_COLON = 10, - TokenNameBeginLambda = 55, - TokenNameBeginTypeArguments = 75, + TokenNameAT = 23, + TokenNameELLIPSIS = 75, + TokenNameARROW = 110, + TokenNameCOLON_COLON = 11, + TokenNameBeginLambda = 66, + TokenNameBeginTypeArguments = 76, TokenNameElidedSemicolonAndRightBrace = 73, TokenNameEOF = 67, TokenNameERROR = 115; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java index 95c03fa355..49352aa871 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java @@ -20,6 +20,7 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.parser.Parser; import org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation; import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner; +import org.eclipse.jdt.internal.compiler.parser.Scanner; import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; @@ -788,9 +789,9 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens { } } - // - // Next, try deletion of the error token. - // + /* Next, try deletion of the error token, preferring deletion as a criteria in + case of identical, superfluous keyword tokens. See below. + */ j = parseCheck( stck, stack_top, @@ -806,6 +807,25 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens { repair.misspellIndex = k; repair.code = DELETION_CODE; repair.distance = j; + } else if (j == repair.distance) { + /* Handle some cases where deletion as a repair strategy is obviously superior to + others. e.g: Object o = new new Object() {}; For some reason, with the new grammar + rules to support type annotations in place, the scopeTrial's choice above wins out + with the repair strategy being to insert a semicolon after the first new. That looks + very suspicious. It is not clear if that is due to the bug in the implementation of + scopeTrial or in the jikespg parser generator or in the grammar. + + The current fix is a temporary point-fix to address this problem. It does make sense + as a rule, but is a bit ad-hoc in nature and the reason why scopeTrial succeeds needs + to be understood. + */ + LexStream.Token previousToken = this.lexStream.token(repair.bufferPosition + 1); + LexStream.Token curToken = this.lexStream.token(repair.bufferPosition + 2); + if (previousToken != null && curToken != null && previousToken.kind == curToken.kind && Scanner.isKeyword(curToken.kind)) { + repair.misspellIndex = k; + repair.code = DELETION_CODE; + repair.distance = j; + } } // diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc Binary files differindex b2721bdb08..9fa1ceebca 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc Binary files differindex 9f5fc24ac4..3f1a7b5262 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc Binary files differindex 1a994f4175..5de4d12ecc 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc Binary files differindex 43d5e27de9..6ab8ca36f6 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc Binary files differindex 2ebc772820..d763fed56f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc Binary files differindex c4fc780ad8..75f3e0603d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc Binary files differindex a1e78b9294..3d76c4e58f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc Binary files differindex 2a567fdb97..ca4cfcaf63 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc Binary files differindex 71db35c43d..17e81bb116 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc Binary files differindex 3e3af72aa3..cabd42c41d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc index 66cd08d174..f475c1d4c3 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc @@ -1 +1,8 @@ -ll k HHHDDk EEE" HIhE jEMDYYD"DDfJJmc""L"Ef"d"""--"
\ No newline at end of file +mmJ**D*l+)KJ**HHHHHDl****+++GGG)KKK!++55**IiG**** + +!k!)!G!!NDOOD!DD!h)) +) +)gJJnY!M!hGg!Z! +!! +! +5+!
\ No newline at end of file diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc Binary files differindex 18f4599c8a..11b17ab527 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc Binary files differindex ca4ffc6c35..3de489c02c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc Binary files differindex fcc8c55d81..ef0665bf8c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc Binary files differindex 297828e5e2..4592b12a60 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc Binary files differindex 7378156864..3843daec39 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc Binary files differindex 0d5b79d2b0..5a6823f293 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc Binary files differindex 48e1a25e54..d8e8e6250f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc Binary files differindex c548b4b15b..b304e67c4c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc Binary files differindex b09a72b77b..d9694d2193 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc Binary files differindex ba1b8f163b..3ec273db7b 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc Binary files differindex 9590181704..b01c32d881 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc Binary files differindex 070db1f4a7..0469444a33 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc Binary files differindex 3526827cfa..e8c5a7150a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props index 814820d7da..463a10d3fc 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props @@ -36,6 +36,7 @@ AnnotationTypeDeclarationHeaderName=AnnotationTypeDeclarationHeaderName AnnotationTypeMemberDeclaration=AnnotationTypeMemberDeclaration AnnotationTypeMemberDeclarations=AnnotationTypeMemberDeclarations AnnotationTypeMemberDeclarationsopt=AnnotationTypeMemberDeclarations +Annotationsopt=Annotationsopt ArgumentList=ArgumentList ArgumentListopt=ArgumentList Arguments=Arguments @@ -80,7 +81,9 @@ ClassHeaderName=ClassHeaderName ClassInstanceCreationExpression=ClassInstanceCreationExpression ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName ClassMemberDeclaration=ClassMemberDeclaration +ClassOrInterface0=Type ClassOrInterface=Type +ClassOrInterfaceType0=Type ClassOrInterfaceType=Type ClassType=ClassType ClassTypeElt=ClassType @@ -104,8 +107,10 @@ Diet=Diet DimWithOrWithOutExpr=Dimension DimWithOrWithOutExprs=Dimensions Dims=Dimensions +DimsAnnotLoop=DimsAnnotLoop DimsLoop=Dimensions Dimsopt=Dimensions +DimsoptAnnotsopt=AnnotationsDimensionsSequence DoStatement=DoStatement ElidedLeftBraceAndReturn=ElidedLeftBraceAndReturn EmptyStatement=EmptyStatement @@ -157,6 +162,7 @@ FormalParameterList=FormalParameterList FormalParameterListopt=FormalParameterList GenericMethodDeclaration=GenericMethodDeclaration GenericType=GenericType +GenericTypeDotName=GenericTypeDotName Goal=Goal Header1=Header1 Header2=Header2 @@ -172,6 +178,7 @@ InclusiveOrExpression_NotName=Expression Initializer=Initializer InsideCastExpression=InsideCastExpression InsideCastExpressionLL1=InsideCastExpression +InsideCastExpressionWithAnnotatedQualifiedGenerics=InsideCastExpression InsideCastExpressionWithQualifiedGenerics=InsideCastExpression InstanceofExpression=Expression InstanceofExpression_NotName=Expression @@ -229,6 +236,7 @@ NonWildTypeArgumentsopt=NonWildTypeArgumentsopt NormalAnnotation=NormalAnnotation NumericType=NumericType OneDimLoop=Dimension +OneDimOrAnnot=OneDimensionOrAnnotation OnlySynchronized=OnlySynchronized OnlyTypeArguments=TypeArguments OnlyTypeArgumentsForCastExpression=TypeArguments @@ -237,10 +245,12 @@ OpenBlock=OpenBlock PackageComment=PackageComment PackageDeclaration=PackageDeclaration PackageDeclarationName=PackageDeclarationName +PopZeroTypeAnnotations=PopZeroTypeAnnotations PostDecrementExpression=PostDecrementExpression PostIncrementExpression=PostIncrementExpression PostfixExpression=Expression PostfixExpression_NotName=Expression +PotentialNameArray=PotentialNameArray PreDecrementExpression=PreDecrementExpression PreIncrementExpression=PreIncrementExpression Primary=Expression @@ -253,14 +263,22 @@ PushModifiers=PushModifiers PushModifiersForHeader=PushModifiersForHeader PushPosition=PushPosition PushRPAREN=) +PushRPARENForAnnotatedTypeCast=) +PushRPARENForNameAndAnnotatedTypeCast=) +PushRPARENForNameUnannotatedTypeCast=) +PushRPARENForUnannotatedTypeCast=) PushRealModifiers=PushRealModifiers +PushZeroTypeAnnotations=ZeroTypeAnnotations QualifiedClassBodyopt=ClassBody QualifiedEnterAnonymousClassBody=EnterAnonymousClassBody QualifiedName=QualifiedName +RecoveryEnumConstantSeparatoropt=RecoveryEnumConstantSeparatoropt +RecoveryExitHeader=RecoveryExitHeader RecoveryMethodHeader=MethodHeader RecoveryMethodHeaderName=MethodHeaderName ReduceImports=ReduceImports ReferenceExpression=ReferenceExpression +ReferenceType0=ReferenceType ReferenceType1=ReferenceType1 ReferenceType2=ReferenceType2 ReferenceType3=ReferenceType3 @@ -302,7 +320,9 @@ TrailingSemiColon=; TryBlock=Block TryStatement=TryStatement TryStatementWithResources=TryStatementWithResources +Type0=Type Type=Type +TypeAnnotations=TypeAnnotations TypeArgument1=TypeArgument1 TypeArgument2=TypeArgument2 TypeArgument3=TypeArgument3 @@ -318,6 +338,7 @@ TypeElidedFormalParameter=TypeElidedFormalParameter TypeElidedFormalParameterList=TypeElidedFormalParameterList TypeImportOnDemandDeclaration=TypeImportOnDemandDeclaration TypeImportOnDemandDeclarationName=TypeImportOnDemandDeclarationName +TypeInternal=Type TypeParameter1=TypeParameter1 TypeParameter=TypeParameter TypeParameterHeader=TypeParameter @@ -333,6 +354,7 @@ UnqualifiedClassBodyopt=ClassBody UnqualifiedEnterAnonymousClassBody=EnterAnonymousClassBody VariableDeclarator=VariableDeclarator VariableDeclaratorId=VariableDeclaratorId +VariableDeclaratorIdOrThis=VariableDeclaratorIdOrThis VariableDeclarators=VariableDeclarators VariableInitializer=VariableInitializer VariableInitializers=VariableInitializers diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java index 9ebf5e7f44..759a8bb7c0 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java @@ -2573,6 +2573,14 @@ public void illegalModifierForMethod(AbstractMethodDeclaration methodDecl) { methodDecl.sourceStart, methodDecl.sourceEnd); } +public void invalidLocationForModifiers(ASTNode location) { + this.handle( + IProblem.InvalidLocationForModifiers, + NoArgument, + NoArgument, + location.sourceStart, + location.sourceEnd); +} public void illegalModifierForVariable(LocalDeclaration localDecl, boolean complainAsArgument) { String[] arguments = new String[] {new String(localDecl.name)}; this.handle( @@ -2641,6 +2649,15 @@ public void illegalVararg(Argument argType, AbstractMethodDeclaration methodDecl argType.sourceStart, argType.sourceEnd); } +public void illegalThis(Argument argument, AbstractMethodDeclaration method, long sourceLevel) { + String[] arguments = NoArgument; + this.handle( + sourceLevel <= ClassFileConstants.JDK1_7 ? IProblem.ExplicitThisParameterNotBelow18 : IProblem.IllegalDeclarationOfThisParameter, + arguments, + arguments, + argument.sourceStart, + argument.sourceEnd); +} public void illegalVisibilityModifierCombinationForField(ReferenceBinding type, FieldDeclaration fieldDecl) { String[] arguments = new String[] {new String(fieldDecl.name)}; this.handle( @@ -4148,6 +4165,41 @@ public void invalidUsageOfVarargs(Argument argument) { argument.type.sourceStart, argument.sourceEnd); } + +public void invalidUsageOfTypeAnnotations(Annotation annotation) { + this.handle( + IProblem.InvalidUsageOfTypeAnnotations, + NoArgument, + NoArgument, + annotation.sourceStart, + annotation.sourceEnd); +} + +public void illegalReceiverAnnotations(Annotation first, Annotation last) { + this.handle( + IProblem.InvalidUsageOfReceiverAnnotations, + NoArgument, + NoArgument, + first.sourceStart, + last.sourceEnd); +} + +public void misplacedTypeAnnotations(Annotation first, Annotation last) { + this.handle( + IProblem.MisplacedTypeAnnotations, + NoArgument, + NoArgument, + first.sourceStart, + last.sourceEnd); +} +public void illegalUsageOfTypeAnnotations(Annotation annotation) { + this.handle( + IProblem.IllegalUsageOfTypeAnnotations, + NoArgument, + NoArgument, + annotation.sourceStart, + annotation.sourceEnd); +} public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl, Object location) { this.referenceContext = compUnitDecl; String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)}; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties index 62774eb2c2..f1576dd6b2 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties @@ -586,7 +586,13 @@ 634 = The method {0}({1}) of type {2} must override or implement a supertype method 635 = Unnecessary @SuppressWarnings("{0}") 636 = The method {0}({1}) of type {2} should be tagged with @Override since it actually overrides a superinterface method - +637 = Syntax error, type annotations are available only when source level is at least 1.8 +638 = Receiver annotations are illegal in a static method context +639 = Syntax error, type annotations are illegal here +640 = Syntax error, modifiers are illegal here +641 = Type annotation is illegal for a method that returns void +642 = Only the first formal parameter of an instance method may be declared explicitly as "this" +643 = Explicit declaration of "this" parameter is allowed only at source level 1.8 or above ### MORE GENERICS 660 = Unused type arguments for the non generic constructor {0}({1}) of type {2}; it should not be parameterized with arguments <{3}> |