Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 187248 Details for
Bug 287648
[1.8][compiler] Add support for JSR 308 - Type Annotations Specification
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch containing original implementation done in 2010 (2011/01/20)
patch_jsr308.txt (text/plain), 1.01 MB, created by
Olivier Thomann
on 2011-01-20 16:57:33 EST
(
hide
)
Description:
Patch containing original implementation done in 2010 (2011/01/20)
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2011-01-20 16:57:33 EST
Size:
1.01 MB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java,v >retrieving revision 1.29 >diff -u -r1.29 CompletionOnQualifiedTypeReference.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java 16 Jan 2009 14:29:29 -0000 1.29 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java 20 Jan 2011 21:55:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -55,6 +55,9 @@ > public TypeReference copyDims(int dim){ > return this; > } >+public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){ >+ return this; >+} > protected TypeBinding getTypeBinding(Scope scope) { > // it can be a package, type or member type > Binding binding = scope.parent.getTypeOrPackage(this.tokens); // step up from the ClassScope >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java,v >retrieving revision 1.30 >diff -u -r1.30 CompletionOnSingleTypeReference.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java 27 Jun 2008 16:03:58 -0000 1.30 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java 20 Jan 2011 21:55:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -55,6 +55,12 @@ > public TypeReference copyDims(int dim){ > return this; > } >+/* >+ * No expansion of the completion reference into an array one >+ */ >+public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){ >+ return this; >+} > protected TypeBinding getTypeBinding(Scope scope) { > if (this.fieldTypeCompletionNode != null) { > throw new CompletionNodeFound(this.fieldTypeCompletionNode, scope); >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java,v >retrieving revision 1.218 >diff -u -r1.218 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 7 Jul 2010 13:20:03 -0000 1.218 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 20 Jan 2011 21:55:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -799,7 +799,7 @@ > Expression castType; > if(this.expressionPtr > 0 > && ((castType = this.expressionStack[this.expressionPtr-1]) instanceof TypeReference)) { >- CastExpression cast = new CastExpression(expression, castType); >+ CastExpression cast = new CastExpression(expression, (TypeReference) castType); > cast.sourceStart = castType.sourceStart; > cast.sourceEnd= expression.sourceEnd; > this.assistNodeParent = cast; >@@ -1158,9 +1158,12 @@ > if(info == LESS && node instanceof TypeReference) { > if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) { > if (consumeTypeArguments) consumeTypeArguments(); >- TypeReference ref = this.getTypeReference(0); >+ TypeReference ref; > if(prevKind == K_PARAMETERIZED_CAST) { >+ ref = this.getUnannotatedTypeReference(0); // by design type is not annotated. > ref = computeQualifiedGenericsFromRightSide(ref, 0); >+ } else { >+ ref = this.getTypeReference(0); > } > if(this.currentElement instanceof RecoveredType) { > this.currentElement = this.currentElement.add(new CompletionOnFieldType(ref, false), 0); >@@ -1337,7 +1340,8 @@ > if ((length = this.identifierLengthStack[this.identifierLengthPtr-1]) < 0) { > // build the primitive type node > int dim = isAfterArrayType() ? this.intStack[this.intPtr--] : 0; >- SingleTypeReference typeRef = (SingleTypeReference)TypeReference.baseTypeReference(-length, dim); >+ Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim); >+ SingleTypeReference typeRef = (SingleTypeReference)TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions); > typeRef.sourceStart = this.intStack[this.intPtr--]; > if (dim == 0) { > typeRef.sourceEnd = this.intStack[this.intPtr--]; >@@ -2058,50 +2062,170 @@ > protected void consumeCastExpressionWithPrimitiveType() { > popElement(K_CAST_STATEMENT); > >- Expression exp, cast, castType; >+ Expression exp; >+ Expression cast; >+ TypeReference castType; > this.expressionPtr--; > this.expressionLengthPtr--; >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = this.expressionStack[this.expressionPtr]); >+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = (TypeReference) this.expressionStack[this.expressionPtr]); > cast.sourceStart = castType.sourceStart - 1; > cast.sourceEnd = exp.sourceEnd; > } >+protected void consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations() { >+ popElement(K_CAST_STATEMENT); >+ >+ Expression expression = this.expressionStack[this.expressionPtr--]; >+ this.expressionLengthPtr--; >+ 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; >+ } >+ >+ Expression cast; >+ pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); >+ cast.sourceStart = typeReference.sourceStart - 1; >+ cast.sourceEnd = expression.sourceEnd; >+} > protected void consumeCastExpressionWithGenericsArray() { > popElement(K_CAST_STATEMENT); > >- Expression exp, cast, castType; >+ Expression exp; >+ Expression cast; >+ TypeReference castType; > this.expressionPtr--; > this.expressionLengthPtr--; >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = this.expressionStack[this.expressionPtr]); >+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = (TypeReference) this.expressionStack[this.expressionPtr]); > cast.sourceStart = castType.sourceStart - 1; > cast.sourceEnd = exp.sourceEnd; > } >+protected void consumeCastExpressionWithGenericsArrayWithTypeAnnotations() { >+ popElement(K_CAST_STATEMENT); > >+ Expression exp = 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; >+ } >+ >+ Expression cast; >+ pushOnExpressionStack(cast = new CastExpression(exp, typeReference)); >+ cast.sourceStart = typeReference.sourceStart - 1; >+ cast.sourceEnd = exp.sourceEnd; >+} > protected void consumeCastExpressionWithQualifiedGenericsArray() { > popElement(K_CAST_STATEMENT); > >- Expression exp, cast, castType; >+ Expression exp; >+ Expression cast; >+ TypeReference castType; > this.expressionPtr--; > this.expressionLengthPtr--; >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = this.expressionStack[this.expressionPtr]); >+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = (TypeReference) this.expressionStack[this.expressionPtr]); > cast.sourceStart = castType.sourceStart - 1; > cast.sourceEnd = exp.sourceEnd; > } >+protected void consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations() { >+ popElement(K_CAST_STATEMENT); >+ >+ Expression expression = this.expressionStack[this.expressionPtr--]; >+ this.expressionLengthPtr--; >+ 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; >+ } >+ Expression cast; >+ pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); >+ cast.sourceStart = typeReference.sourceStart - 1; >+ cast.sourceEnd = expression.sourceEnd; >+} > protected void consumeCastExpressionWithNameArray() { > // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus > popElement(K_CAST_STATEMENT); > >- Expression exp, cast, castType; >+ Expression exp; >+ Expression cast; >+ TypeReference castType; > > this.expressionPtr--; > this.expressionLengthPtr--; >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = this.expressionStack[this.expressionPtr]); >+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = (TypeReference) this.expressionStack[this.expressionPtr]); > cast.sourceStart = castType.sourceStart - 1; > cast.sourceEnd = exp.sourceEnd; > } >+protected void consumeCastExpressionWithNameArrayWithTypeAnnotations() { >+ popElement(K_CAST_STATEMENT); >+ >+ Expression expression = this.expressionStack[this.expressionPtr--]; >+ this.expressionLengthPtr--; >+ 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; >+ } >+ Expression cast; >+ pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); >+ cast.sourceStart = typeReference.sourceStart - 1; >+ cast.sourceEnd = expression.sourceEnd; >+} > protected void consumeCastExpressionLL1() { > popElement(K_CAST_STATEMENT); > super.consumeCastExpressionLL1(); > } >+protected void consumeCastExpressionLL1WithTypeAnnotations() { >+ popElement(K_CAST_STATEMENT); >+ super.consumeCastExpressionLL1WithTypeAnnotations(); >+} > protected void consumeClassBodyDeclaration() { > popElement(K_BLOCK_DELIMITER); > super.consumeClassBodyDeclaration(); >@@ -2513,6 +2637,10 @@ > } > } > protected void consumeFormalParameter(boolean isVarArgs) { >+ >+ this.invocationType = NO_RECEIVER; >+ this.qualifier = -1; >+ > if (this.indexOfAssistIdentifier() < 0) { > super.consumeFormalParameter(isVarArgs); > if (this.pendingAnnotation != null) { >@@ -2530,10 +2658,31 @@ > 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; > } >@@ -2547,7 +2696,6 @@ > type, > this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers > // consume annotations >- int length; > if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { > System.arraycopy( > this.expressionStack, >@@ -2638,6 +2786,24 @@ > } > pushOnElementStack(K_CAST_STATEMENT); > } >+protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() { >+ popElement(K_PARAMETERIZED_CAST); >+ >+ Expression castType; >+ int end = this.intStack[this.intPtr--]; >+ >+ int dim = this.intStack[this.intPtr--]; >+ // TODO is it an annotated type reference? >+ TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated. >+ >+ castType = computeQualifiedGenericsFromRightSide(rightSide, dim); >+ this.intPtr--; >+ castType.sourceEnd = end - 1; >+ castType.sourceStart = this.intStack[this.intPtr--] + 1; >+ pushOnExpressionStack(castType); >+ >+ pushOnElementStack(K_CAST_STATEMENT); >+} > protected void consumeInsideCastExpressionWithQualifiedGenerics() { > popElement(K_PARAMETERIZED_CAST); > >@@ -2645,7 +2811,7 @@ > 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. > > castType = computeQualifiedGenericsFromRightSide(rightSide, dim); > this.intPtr--; >@@ -4279,6 +4445,16 @@ > } > return result; > } >+protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation[][] annotationsOnDimensions) { >+ if (this.assistNode == typeRef) { >+ return typeRef; >+ } >+ TypeReference result = super.copyDims(typeRef, dim, annotationsOnDimensions); >+ if (this.assistNodeParent == typeRef) { >+ this.assistNodeParent = result; >+ } >+ return result; >+} > public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) { > > this.cursorLocation = cursorLoc; >@@ -4383,7 +4559,7 @@ > if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) != K_SWITCH_LABEL) { > if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) { > // if recovery is taking place in an array initializer, we should prevent popping >- // up to the enclosing block until the array initializer is properly closed >+ // upto the enclosing block until the array initializer is properly closed > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704 > popUntilElement(K_ARRAY_INITIALIZER); > } else { >@@ -4674,7 +4850,7 @@ > super.recoveryTokenCheck(); > if(this.currentElement != oldElement && oldElement instanceof RecoveredBlock) { > if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) { >- // When inside an array initializer, we should not prematurely pop the enclosing block >+ // When inside an array initializer, we shud not prematurely pop the enclosing block > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704 > popElement(K_ARRAY_INITIALIZER); > } else { >Index: codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java,v >retrieving revision 1.95 >diff -u -r1.95 AssistParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java 27 Oct 2010 02:55:29 -0000 1.95 >+++ codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java 20 Jan 2011 21:55:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -897,13 +897,13 @@ > /* > * Build specific type reference nodes in case the cursor is located inside the type reference > */ >-protected TypeReference getTypeReference(int dim) { >+protected TypeReference getUnannotatedTypeReference(int dim) { > > int index; > > /* no need to take action if not inside completed identifiers */ > if ((index = indexOfAssistIdentifier(true)) < 0) { >- return super.getTypeReference(dim); >+ return super.getUnannotatedTypeReference(dim); > } > int length = this.identifierLengthStack[this.identifierLengthPtr]; > TypeReference reference; >@@ -1622,6 +1622,9 @@ > 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; >Index: codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java,v >retrieving revision 1.92 >diff -u -r1.92 SelectionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java 28 Jul 2010 16:17:04 -0000 1.92 >+++ codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java 20 Jan 2011 21:55:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -133,8 +133,8 @@ > case K_CAST_STATEMENT : > Expression castType; > if(this.expressionPtr > 0 >- && ((castType = this.expressionStack[this.expressionPtr-1]) instanceof TypeReference)) { >- CastExpression cast = new CastExpression(expression, castType); >+ && ((castType = this.expressionStack[this.expressionPtr-1]) instanceof TypeReference)) { >+ CastExpression cast = new CastExpression(expression, (TypeReference) castType); > cast.sourceStart = castType.sourceStart; > cast.sourceEnd= expression.sourceEnd; > parentNode = cast; >@@ -548,10 +548,31 @@ > 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; > } >@@ -568,7 +589,6 @@ > arg.declarationSourceStart = modifierPositions; > > // consume annotations >- int length; > if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { > System.arraycopy( > this.expressionStack, >Index: compiler/org/eclipse/jdt/core/compiler/IProblem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java,v >retrieving revision 1.225 >diff -u -r1.225 IProblem.java >--- compiler/org/eclipse/jdt/core/compiler/IProblem.java 16 Jan 2011 22:43:21 -0000 1.225 >+++ compiler/org/eclipse/jdt/core/compiler/IProblem.java 20 Jan 2011 21:55:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -466,7 +466,7 @@ > int IncorrectSwitchType = TypeRelated + 169; > int DuplicateCase = FieldRelated + 170; > >- // labelled >+ // labeled > int DuplicateLabel = Internal + 171; > int InvalidBreak = Internal + 172; > int InvalidContinue = Internal + 173; >@@ -526,6 +526,7 @@ > int ThisInStaticContext = Internal + 200; > int StaticMethodRequested = Internal + MethodRelated + 201; > int IllegalDimension = Internal + 202; >+ /** @deprecated This is no longer used */ > int InvalidTypeExpression = Internal + 203; > int ParsingError = Syntax + Internal + 204; > int ParsingErrorNoSuggestion = Syntax + Internal + 205; >@@ -598,6 +599,24 @@ > int InvalidHighSurrogate = Syntax + Internal + 264; > /** @since 3.2 */ > int UnnecessaryNLSTag = Internal + 265; >+ /** @since 3.7 */ >+ int InvalidBinary = Syntax + Internal + 266; >+ /** @since 3.7 */ >+ int IllegalBinaryLiteral = Syntax + Internal + 267; >+ /** @since 3.7 */ >+ int IllegalUnderscorePosition = Syntax + Internal + 268; >+ /** @since 3.7 */ >+ int IllegalUsageOfUnderscore = Syntax + Internal + 269; >+ /** @since 3.7 */ >+ int IllegalHexaLiteral = Syntax + Internal + 270; >+ /** @since 3.7 */ >+ int UnterminatedExoticIdentifier = Syntax + Internal + 271; >+ /** @since 3.7 */ >+ int InvalidEmptyExoticIdentifier = Syntax + Internal + 272; >+ /** @since 3.7 */ >+ int IllegalDangerousCharacter = Syntax + Internal + 273; >+ /** @since 3.7 */ >+ int IllegalExoticIdentifier = Syntax + Internal + 274; > > // type related problems > /** @since 3.1 */ >@@ -1238,7 +1257,16 @@ > int UnusedWarningToken = Internal + 635; > /** @since 3.6 */ > int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + 636; >- >+ /** @since 3.7 */ >+ int InvalidUsageOfTypeAnnotations = Syntax + Internal + 637; >+ /** @since 3.7 */ >+ int InvalidUsageOfReceiverAnnotations = Syntax + Internal + 638; >+ /** @since 3.7 */ >+ int MisplacedTypeAnnotations = Syntax + Internal + 639; >+ /** @since 3.7 */ >+ int InvalidLocationForModifiers = Syntax + Internal + 640; >+ /** @since 3.7*/ >+ int IllegalUsageOfTypeAnnotations = Internal + Syntax + 641; > /** > * More problems in generics > */ >Index: compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java,v >retrieving revision 1.18 >diff -u -r1.18 ASTVisitor.java >--- compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java 7 Mar 2009 01:08:10 -0000 1.18 >+++ compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java 20 Jan 2011 21:55:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -44,13 +44,16 @@ > // do nothing by default > } > public void endVisit( >- ArrayAllocationExpression arrayAllocationExpression, >- BlockScope scope) { >+ ArrayAllocationExpression arrayAllocationExpression, >+ BlockScope scope) { > // do nothing by default > } > 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 +274,27 @@ > // do nothing by default > } > /** >+ * @param annotation >+ * @param scope >+ * @since 3.1 >+ */ >+ 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 +312,9 @@ > 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 +395,14 @@ > public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) { > // do nothing by default > } >+ /** >+ * @param annotation >+ * @param scope >+ * @since 3.1 >+ */ >+ public void endVisit(SingleMemberAnnotation annotation, ClassScope scope) { >+ // do nothing by default >+ } > public void endVisit( > SingleNameReference singleNameReference, > BlockScope scope) { >@@ -483,6 +512,9 @@ > 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) { >@@ -703,6 +735,14 @@ > return true; > } > /** >+ * @param annotation >+ * @param scope >+ * @since 3.1 >+ */ >+ public boolean visit(MarkerAnnotation annotation, ClassScope scope) { >+ return true; >+ } >+ /** > * @param pair > * @param scope > * @since 3.1 >@@ -710,6 +750,14 @@ > public boolean visit(MemberValuePair pair, BlockScope scope) { > return true; > } >+ /** >+ * @param pair >+ * @param scope >+ * @since 3.1 >+ */ >+ public boolean visit(MemberValuePair pair, ClassScope scope) { >+ return true; >+ } > public boolean visit(MessageSend messageSend, BlockScope scope) { > return true; // do nothing by default, keep traversing > } >@@ -729,6 +777,14 @@ > public boolean visit(NormalAnnotation annotation, BlockScope scope) { > return true; > } >+ /** >+ * @param annotation >+ * @param scope >+ * @since 3.1 >+ */ >+ public boolean visit(NormalAnnotation annotation, ClassScope scope) { >+ return true; >+ } > public boolean visit(NullLiteral nullLiteral, BlockScope scope) { > return true; // do nothing by default, keep traversing > } >@@ -809,6 +865,14 @@ > public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) { > return true; > } >+ /** >+ * @param annotation >+ * @param scope >+ * @since 3.1 >+ */ >+ public boolean visit(SingleMemberAnnotation annotation, ClassScope scope) { >+ return true; >+ } > public boolean visit( > SingleNameReference singleNameReference, > BlockScope scope) { >Index: compiler/org/eclipse/jdt/internal/compiler/ClassFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java,v >retrieving revision 1.205 >diff -u -r1.205 ClassFile.java >--- compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 14 Jan 2011 15:34:16 -0000 1.205 >+++ compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 20 Jan 2011 21:55:10 -0000 >@@ -17,6 +17,7 @@ > import java.util.HashSet; > import java.util.List; > import java.util.Set; >+import java.util.Stack; > > import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.core.compiler.CharOperation; >@@ -30,14 +31,22 @@ > import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; > import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; > import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; > import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation; >+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference; > import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; > import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation; > import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; > import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.TypeParameter; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; >+import org.eclipse.jdt.internal.compiler.ast.Wildcard; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext; >+import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants; > import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants; > import org.eclipse.jdt.internal.compiler.codegen.CodeStream; > import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; >@@ -45,14 +54,16 @@ > import org.eclipse.jdt.internal.compiler.codegen.Opcodes; > import org.eclipse.jdt.internal.compiler.codegen.StackMapFrame; > import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream; >+import org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream; >+import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo; > import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.ExceptionMarker; > import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackDepthMarker; > import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackMarker; >-import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.impl.Constant; > import org.eclipse.jdt.internal.compiler.impl.StringConstant; > import org.eclipse.jdt.internal.compiler.lookup.Binding; >+import org.eclipse.jdt.internal.compiler.lookup.BlockScope; > import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; > import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; > import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; >@@ -227,6 +238,75 @@ > LookupEnvironment env = typeBinding.scope.environment(); > return env.classFilePool.acquire(typeBinding); > } >+ >+ /** >+ * Return the location for the corresponding annotation inside the type reference, <code>null</code> if none. >+ */ >+ private static int[] getWildcardLocations(TypeReference reference, Wildcard wildcard) { >+ class LocationCollector extends ASTVisitor { >+ Stack currentIndexes; >+ boolean search = true; >+ Wildcard currentWildcard; >+ >+ public LocationCollector(Wildcard currentWildcard) { >+ this.currentIndexes = new Stack(); >+ this.currentWildcard = currentWildcard; >+ } >+ public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) { >+ if (!this.search) 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; >+ 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(Wildcard typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ if (typeReference.equals(this.currentWildcard)) { >+ this.search = false; >+ } >+ return true; >+ } >+ public String toString() { >+ StringBuffer buffer = new StringBuffer(); >+ buffer >+ .append("search location for ") //$NON-NLS-1$ >+ .append(this.currentWildcard) >+ .append("\ncurrent indexes : ") //$NON-NLS-1$ >+ .append(this.currentIndexes); >+ return String.valueOf(buffer); >+ } >+ } >+ if (reference == null) return null; >+ LocationCollector collector = new LocationCollector(wildcard); >+ 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; >+ } >+ > /** > * INTERNAL USE-ONLY > * This methods creates a new instance of the receiver. >@@ -245,7 +325,12 @@ > this.isNestedType = typeBinding.isNestedType(); > if (this.targetJDK >= ClassFileConstants.JDK1_6) { > this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE; >- this.codeStream = new StackMapFrameCodeStream(this); >+ if (this.targetJDK >= ClassFileConstants.JDK1_7) { >+ this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION; >+ this.codeStream = new TypeAnnotationCodeStream(this); >+ } else { >+ this.codeStream = new StackMapFrameCodeStream(this); >+ } > } else if (this.targetJDK == ClassFileConstants.CLDC_1_1) { > this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3 > this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP; >@@ -358,6 +443,8 @@ > generateMissingTypesAttribute(); > attributesNumber++; > } >+ >+ attributesNumber += generateTypeAnnotationAttributeForTypeDeclaration(); > // update the number of attributes > if (attributeOffset + 2 >= this.contents.length) { > resizeContents(2); >@@ -412,8 +499,41 @@ > FieldDeclaration fieldDeclaration = fieldBinding.sourceField(); > if (fieldDeclaration != null) { > Annotation[] annotations = fieldDeclaration.annotations; >+ List allTypeAnnotationContexts = new ArrayList(); >+ int invisibleTypeAnnotationsCounter = 0; >+ int visibleTypeAnnotationsCounter = 0; > if (annotations != null) { > attributesNumber += generateRuntimeAnnotations(annotations); >+ if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) { >+ if ((fieldDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) { >+ fieldDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts); >+ } >+ } >+ } >+ TypeReference fieldType = fieldDeclaration.type; >+ if (fieldType != null >+ && ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) >+ && ((fieldType.bits & ASTNode.HasTypeAnnotations) != 0)) { >+ fieldType.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts); >+ } >+ int size = allTypeAnnotationContexts.size(); >+ if (size != 0) { >+ AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size]; >+ allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray); >+ for (int i = 0, max = allTypeAnnotationContextsArray.length; i < max; i++) { >+ AnnotationContext annotationContext = allTypeAnnotationContextsArray[i]; >+ if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) { >+ invisibleTypeAnnotationsCounter++; >+ allTypeAnnotationContexts.add(annotationContext); >+ } else { >+ visibleTypeAnnotationsCounter++; >+ allTypeAnnotationContexts.add(annotationContext); >+ } >+ } >+ attributesNumber += generateRuntimeTypeAnnotations( >+ allTypeAnnotationContextsArray, >+ visibleTypeAnnotationsCounter, >+ invisibleTypeAnnotationsCounter); > } > } > } >@@ -1834,10 +1954,200 @@ > MethodBinding binding, > int methodAttributeOffset, > int attributesNumber) { >+ >+ if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) { >+ List allTypeAnnotationContexts = ((TypeAnnotationCodeStream) this.codeStream).allTypeAnnotationContexts; >+ int invisibleTypeAnnotationsCounter = 0; >+ int visibleTypeAnnotationsCounter = 0; >+ for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) { >+ LocalVariableBinding localVariable = this.codeStream.locals[i]; >+ LocalDeclaration declaration = localVariable.declaration; >+ if (declaration == null >+ || (declaration.isArgument() && ((declaration.bits & ASTNode.CatchVariable) == 0)) >+ || (localVariable.initializationCount == 0) >+ || ((declaration.bits & ASTNode.HasTypeAnnotations) == 0)) { >+ continue; >+ } >+ declaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.LOCAL_VARIABLE, localVariable, allTypeAnnotationContexts); >+ } >+ AbstractMethodDeclaration methodDeclaration = binding.sourceMethod(); >+ if (methodDeclaration != null) { >+ if ((methodDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) { >+ Argument[] arguments = methodDeclaration.arguments; >+ if (arguments != null) { >+ for (int i = 0, max = arguments.length; i < max; i++) { >+ Argument argument = arguments[i]; >+ if ((argument.bits & ASTNode.HasTypeAnnotations) != 0) { >+ argument.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_PARAMETER, i, allTypeAnnotationContexts); >+ } >+ } >+ } >+ Annotation[] annotations = methodDeclaration.receiverAnnotations; >+ if (annotations != null) { >+ for (int i = 0, max = annotations.length; i < max; i++) { >+ Annotation annotation = annotations[i]; >+ AnnotationContext annotationContext = null; >+ if (annotation.isRuntimeTypeInvisible()) { >+ annotationContext = new AnnotationContext(annotation, null, AnnotationTargetTypeConstants.METHOD_RECEIVER, null, AnnotationContext.INVISIBLE, null); >+ invisibleTypeAnnotationsCounter++; >+ } else if (annotation.isRuntimeTypeVisible()) { >+ annotationContext = new AnnotationContext(annotation, null, AnnotationTargetTypeConstants.METHOD_RECEIVER, null, AnnotationContext.VISIBLE, null); >+ visibleTypeAnnotationsCounter++; >+ } >+ if (annotationContext != null) { >+ allTypeAnnotationContexts.add(annotationContext); >+ } >+ } >+ } >+ } >+ Annotation[] annotations = methodDeclaration.annotations; >+ if (annotations != null && binding.returnType.id != T_void) { >+ methodDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN_TYPE, allTypeAnnotationContexts); >+ } >+ if (!methodDeclaration.isConstructor() && !methodDeclaration.isClinit() && binding.returnType.id != T_void) { >+ MethodDeclaration declaration = (MethodDeclaration) methodDeclaration; >+ TypeReference typeReference = declaration.returnType; >+ if ((typeReference.bits & ASTNode.HasTypeAnnotations) != 0) { >+ typeReference.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN_TYPE, allTypeAnnotationContexts); >+ } >+ } >+ TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions; >+ if (thrownExceptions != null) { >+ for (int i = 0, max = thrownExceptions.length; i < max; i++) { >+ TypeReference thrownException = thrownExceptions[i]; >+ thrownException.getAllAnnotationContexts(AnnotationTargetTypeConstants.THROWS, i, allTypeAnnotationContexts); >+ } >+ } >+ TypeParameter[] typeParameters = methodDeclaration.typeParameters(); >+ if (typeParameters != null) { >+ for (int i = 0, max = typeParameters.length; i < max; i++) { >+ TypeParameter typeParameter = typeParameters[i]; >+ if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) { >+ typeParameter.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER, i, allTypeAnnotationContexts); >+ } >+ } >+ } >+ } >+ int size = allTypeAnnotationContexts.size(); >+ if (size != 0) { >+ AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size]; >+ allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray); >+ for (int j = 0, max2 = allTypeAnnotationContextsArray.length; j < max2; j++) { >+ AnnotationContext annotationContext = allTypeAnnotationContextsArray[j]; >+ if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) { >+ invisibleTypeAnnotationsCounter++; >+ } else { >+ visibleTypeAnnotationsCounter++; >+ } >+ } >+ attributesNumber += generateRuntimeTypeAnnotations( >+ allTypeAnnotationContextsArray, >+ visibleTypeAnnotationsCounter, >+ invisibleTypeAnnotationsCounter); >+ } >+ } >+ > // update the number of attributes > this.contents[methodAttributeOffset++] = (byte) (attributesNumber >> 8); > this.contents[methodAttributeOffset] = (byte) attributesNumber; > } >+ >+ private void dumpLocations(int[] locations) { >+ if (locations != null) { >+ int length = locations.length; >+ int actualSize = 2 + length; >+ if (this.contentsOffset + actualSize >= this.contents.length) { >+ resizeContents(actualSize); >+ } >+ this.contents[this.contentsOffset++] = (byte) (length >> 8); >+ this.contents[this.contentsOffset++] = (byte) length; >+ for (int i = 0; i < length; i++) { >+ this.contents[this.contentsOffset++] = (byte) locations[i]; >+ } >+ } >+ } >+ private void dumpTargetTypeContents(int targetType, AnnotationContext annotationContext) { >+ switch(targetType) { >+ case AnnotationTargetTypeConstants.THROWS : >+ case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS : >+ case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY : >+ case AnnotationTargetTypeConstants.OBJECT_CREATION : >+ case AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY : >+ case AnnotationTargetTypeConstants.CLASS_LITERAL : >+ case AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY : >+ case AnnotationTargetTypeConstants.TYPE_INSTANCEOF : >+ case AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY : >+ case AnnotationTargetTypeConstants.TYPE_CAST : >+ case AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY : >+ this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8); >+ this.contents[this.contentsOffset++] = (byte) annotationContext.info; >+ break; >+ case AnnotationTargetTypeConstants.LOCAL_VARIABLE : >+ case AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY : >+ int localVariableTableOffset = this.contentsOffset; >+ LocalVariableBinding localVariable = annotationContext.variableBinding; >+ int actualSize = 0; >+ int initializationCount = localVariable.initializationCount; >+ actualSize += 6 * initializationCount; >+ // reserve enough space >+ if (this.contentsOffset + actualSize >= this.contents.length) { >+ resizeContents(actualSize); >+ } >+ this.contentsOffset += 2; >+ int numberOfEntries = 0; >+ for (int j = 0; j < initializationCount; j++) { >+ int startPC = localVariable.initializationPCs[j << 1]; >+ int endPC = localVariable.initializationPCs[(j << 1) + 1]; >+ if (startPC != endPC) { // only entries for non zero length >+ // now we can safely add the local entry >+ numberOfEntries++; >+ this.contents[this.contentsOffset++] = (byte) (startPC >> 8); >+ this.contents[this.contentsOffset++] = (byte) startPC; >+ int length = endPC - startPC; >+ this.contents[this.contentsOffset++] = (byte) (length >> 8); >+ this.contents[this.contentsOffset++] = (byte) length; >+ int resolvedPosition = localVariable.resolvedPosition; >+ this.contents[this.contentsOffset++] = (byte) (resolvedPosition >> 8); >+ this.contents[this.contentsOffset++] = (byte) resolvedPosition; >+ } >+ } >+ this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8); >+ this.contents[localVariableTableOffset] = (byte) numberOfEntries; >+ break; >+ case AnnotationTargetTypeConstants.METHOD_PARAMETER : >+ case AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY : >+ this.contents[this.contentsOffset++] = (byte) annotationContext.info; >+ break; >+ // nothing to do >+ // case AnnotationTargetTypeConstants.METHOD_RECEIVER : >+ // case AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY : >+ // break; >+ // case AnnotationTargetTypeConstants.FIELD : >+ // case AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY : >+ // break; >+ case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER : >+ case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER : >+ this.contents[this.contentsOffset++] = (byte) annotationContext.info; >+ break; >+ case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND : >+ case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND : >+ case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ this.contents[this.contentsOffset++] = (byte) annotationContext.info; >+ this.contents[this.contentsOffset++] = (byte) annotationContext.info2; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL : >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY : >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY : >+ // offset >+ this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8); >+ this.contents[this.contentsOffset++] = (byte) annotationContext.info; >+ // type index >+ this.contents[this.contentsOffset++] = (byte) annotationContext.info2; >+ } >+ } >+ > /** > * INTERNAL USE-ONLY > * This methods returns a char[] representing the file name of the receiver >@@ -3124,6 +3434,112 @@ > } > return attributesNumber; > } >+ /** >+ * @param annotationContexts the given annotation contexts >+ * @param visibleTypeAnnotationsNumber the given number of visible type annotations >+ * @param invisibleTypeAnnotationsNumber the given number of invisible type annotations >+ * @return the number of attributes created while dumping the annotations in the .class file >+ */ >+ private int generateRuntimeTypeAnnotations(final AnnotationContext[] annotationContexts, int visibleTypeAnnotationsNumber, int invisibleTypeAnnotationsNumber) { >+ int attributesNumber = 0; >+ final int length = annotationContexts.length; >+ >+ int visibleTypeAnnotationsCounter = visibleTypeAnnotationsNumber; >+ int invisibleTypeAnnotationsCounter = invisibleTypeAnnotationsNumber; >+ int annotationAttributeOffset = this.contentsOffset; >+ int constantPOffset = this.constantPool.currentOffset; >+ int constantPoolIndex = this.constantPool.currentIndex; >+ if (invisibleTypeAnnotationsCounter != 0) { >+ if (this.contentsOffset + 10 >= this.contents.length) { >+ resizeContents(10); >+ } >+ int runtimeInvisibleAnnotationsAttributeNameIndex = >+ this.constantPool.literalIndex(AttributeNamesConstants.RuntimeInvisibleTypeAnnotationsName); >+ this.contents[this.contentsOffset++] = (byte) (runtimeInvisibleAnnotationsAttributeNameIndex >> 8); >+ this.contents[this.contentsOffset++] = (byte) runtimeInvisibleAnnotationsAttributeNameIndex; >+ int attributeLengthOffset = this.contentsOffset; >+ this.contentsOffset += 4; // leave space for the attribute length >+ >+ int annotationsLengthOffset = this.contentsOffset; >+ this.contentsOffset += 2; // leave space for the annotations length >+ >+ int counter = 0; >+ loop: for (int i = 0; i < length; i++) { >+ if (invisibleTypeAnnotationsCounter == 0) break loop; >+ AnnotationContext annotationContext = annotationContexts[i]; >+ if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) { >+ int currentAnnotationOffset = this.contentsOffset; >+ generateTypeAnnotation(annotationContext, currentAnnotationOffset); >+ invisibleTypeAnnotationsCounter--; >+ if (this.contentsOffset != currentAnnotationOffset) { >+ counter++; >+ } >+ } >+ } >+ if (counter != 0) { >+ this.contents[annotationsLengthOffset++] = (byte) (counter >> 8); >+ this.contents[annotationsLengthOffset++] = (byte) counter; >+ >+ int attributeLength = this.contentsOffset - attributeLengthOffset - 4; >+ this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); >+ this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); >+ this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8); >+ this.contents[attributeLengthOffset++] = (byte) attributeLength; >+ attributesNumber++; >+ } else { >+ this.contentsOffset = annotationAttributeOffset; >+ // reset the constant pool to its state before the clinit >+ this.constantPool.resetForAttributeName(AttributeNamesConstants.RuntimeInvisibleTypeAnnotationsName, constantPoolIndex, constantPOffset); >+ } >+ } >+ >+ annotationAttributeOffset = this.contentsOffset; >+ constantPOffset = this.constantPool.currentOffset; >+ constantPoolIndex = this.constantPool.currentIndex; >+ if (visibleTypeAnnotationsCounter != 0) { >+ if (this.contentsOffset + 10 >= this.contents.length) { >+ resizeContents(10); >+ } >+ int runtimeVisibleAnnotationsAttributeNameIndex = >+ this.constantPool.literalIndex(AttributeNamesConstants.RuntimeVisibleTypeAnnotationsName); >+ this.contents[this.contentsOffset++] = (byte) (runtimeVisibleAnnotationsAttributeNameIndex >> 8); >+ this.contents[this.contentsOffset++] = (byte) runtimeVisibleAnnotationsAttributeNameIndex; >+ int attributeLengthOffset = this.contentsOffset; >+ this.contentsOffset += 4; // leave space for the attribute length >+ >+ int annotationsLengthOffset = this.contentsOffset; >+ this.contentsOffset += 2; // leave space for the annotations length >+ >+ int counter = 0; >+ loop: for (int i = 0; i < length; i++) { >+ if (visibleTypeAnnotationsCounter == 0) break loop; >+ AnnotationContext annotationContext = annotationContexts[i]; >+ if ((annotationContext.visibility & AnnotationContext.VISIBLE) != 0) { >+ visibleTypeAnnotationsCounter--; >+ int currentAnnotationOffset = this.contentsOffset; >+ generateTypeAnnotation(annotationContext, currentAnnotationOffset); >+ if (this.contentsOffset != currentAnnotationOffset) { >+ counter++; >+ } >+ } >+ } >+ if (counter != 0) { >+ this.contents[annotationsLengthOffset++] = (byte) (counter >> 8); >+ this.contents[annotationsLengthOffset++] = (byte) counter; >+ >+ int attributeLength = this.contentsOffset - attributeLengthOffset - 4; >+ this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); >+ this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); >+ this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8); >+ this.contents[attributeLengthOffset++] = (byte) attributeLength; >+ attributesNumber++; >+ } else { >+ this.contentsOffset = annotationAttributeOffset; >+ this.constantPool.resetForAttributeName(AttributeNamesConstants.RuntimeVisibleTypeAnnotationsName, constantPoolIndex, constantPOffset); >+ } >+ } >+ return attributesNumber; >+ } > > private int generateSignatureAttribute(char[] genericSignature) { > int localContentsOffset = this.contentsOffset; >@@ -3724,6 +4140,228 @@ > return 1; > } > >+ private void generateTypeAnnotation(AnnotationContext annotationContext, int currentOffset) { >+ int targetType = annotationContext.targetType; >+ if (annotationContext.wildcard != null) { >+ generateWilcardTypeAnnotation(annotationContext, currentOffset); >+ return; >+ } >+ // common part between type annotation and annotation >+ generateAnnotation(annotationContext.annotation, currentOffset); >+ if (this.contentsOffset == currentOffset) { >+ // error occurred while generating the annotation >+ return; >+ } >+ int[] locations = Annotation.getLocations( >+ annotationContext.typeReference, >+ annotationContext.primaryAnnotations, >+ annotationContext.annotation, >+ annotationContext.annotationsOnDimensions); >+ if (locations != null) { >+ // convert to GENERIC_OR_ARRAY type >+ switch(targetType) { >+ case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS : >+ targetType = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.LOCAL_VARIABLE : >+ targetType = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.METHOD_PARAMETER : >+ targetType = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.FIELD : >+ targetType = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY; >+ break; >+// case AnnotationTargetTypeConstants.METHOD_RECEIVER : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY; >+// break; >+// case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY; >+// break; >+ case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND : >+ // should not happen - possible extension >+ targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY; >+ break; >+// case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY; >+// break; >+ case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND : >+ // should not happen - possible extension >+ targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY; >+ break; >+// case AnnotationTargetTypeConstants.THROWS : >+// targetType = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY; >+ case AnnotationTargetTypeConstants.TYPE_INSTANCEOF: >+ targetType = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.CLASS_LITERAL: >+ targetType = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.OBJECT_CREATION: >+ targetType = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_CAST: >+ targetType = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL : >+ targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : >+ targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.METHOD_RETURN_TYPE : >+ targetType = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY; >+ } >+ } >+ // reserve enough space >+ if (this.contentsOffset + 5 >= this.contents.length) { >+ resizeContents(5); >+ } >+ this.contents[this.contentsOffset++] = (byte) targetType; >+ dumpTargetTypeContents(targetType, annotationContext); >+ dumpLocations(locations); >+ } >+ >+ private void generateWilcardTypeAnnotation(AnnotationContext annotationContext, int currentOffset) { >+ // common part between type annotation and annotation >+ generateAnnotation(annotationContext.annotation, currentOffset); >+ if (this.contentsOffset == currentOffset) { >+ // error occurred while generating the annotation >+ return; >+ } >+ int[] wildcardLocations = getWildcardLocations(annotationContext.typeReference, annotationContext.wildcard); >+ int targetType = annotationContext.targetType; >+ switch(targetType) { >+ case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS : >+ targetType = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.LOCAL_VARIABLE : >+ targetType = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.METHOD_PARAMETER : >+ targetType = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.FIELD : >+ targetType = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY; >+ break; >+// case AnnotationTargetTypeConstants.METHOD_RECEIVER : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY; >+// break; >+// case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY; >+// break; >+// case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY; >+// break; >+// case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY; >+// break; >+// case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND : >+// // should not happen - possible extension >+// targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY; >+// break; >+// case AnnotationTargetTypeConstants.THROWS : >+// targetType = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY; >+ case AnnotationTargetTypeConstants.TYPE_INSTANCEOF: >+ targetType = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.CLASS_LITERAL: >+ targetType = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.OBJECT_CREATION: >+ targetType = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_CAST: >+ targetType = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL : >+ targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : >+ targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY; >+ break; >+ case AnnotationTargetTypeConstants.METHOD_RETURN_TYPE : >+ targetType = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY; >+ } >+ int[] locations = Annotation.getLocations( >+ annotationContext.wildcard.bound, >+ null, >+ annotationContext.annotation, >+ null); >+ // reserve enough space >+ if (this.contentsOffset + 5 >= this.contents.length) { >+ resizeContents(5); >+ } >+ this.contents[this.contentsOffset++] = >+ (byte) (locations != null ? >+ AnnotationTargetTypeConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY : >+ AnnotationTargetTypeConstants.WILDCARD_BOUND); >+ this.contents[this.contentsOffset++] = (byte) targetType; >+ dumpTargetTypeContents(targetType, annotationContext); >+ dumpLocations(wildcardLocations); >+ dumpLocations(locations); >+ } >+ private int generateTypeAnnotationAttributeForTypeDeclaration() { >+ TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext; >+ if ((typeDeclaration.bits & ASTNode.HasTypeAnnotations) == 0) { >+ return 0; >+ } >+ int attributesNumber = 0; >+ int visibleTypeAnnotationsCounter = 0; >+ int invisibleTypeAnnotationsCounter = 0; >+ TypeReference superclass = typeDeclaration.superclass; >+ List allTypeAnnotationContexts = new ArrayList(); >+ if (superclass != null && (superclass.bits & ASTNode.HasTypeAnnotations) != 0) { >+ superclass.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS, -1, allTypeAnnotationContexts); >+ } >+ TypeReference[] superInterfaces = typeDeclaration.superInterfaces; >+ if (superInterfaces != null) { >+ for (int i = 0; i < superInterfaces.length; i++) { >+ TypeReference superInterface = superInterfaces[i]; >+ if ((superInterface.bits & ASTNode.HasTypeAnnotations) == 0) { >+ continue; >+ } >+ superInterface.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS, i, allTypeAnnotationContexts); >+ } >+ } >+ TypeParameter[] typeParameters = typeDeclaration.typeParameters; >+ if (typeParameters != null) { >+ for (int i = 0, max = typeParameters.length; i < max; i++) { >+ TypeParameter typeParameter = typeParameters[i]; >+ if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) { >+ typeParameter.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER, i, allTypeAnnotationContexts); >+ } >+ } >+ } >+ int size = allTypeAnnotationContexts.size(); >+ if (size != 0) { >+ AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size]; >+ allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray); >+ for (int j = 0, max = allTypeAnnotationContextsArray.length; j < max; j++) { >+ AnnotationContext annotationContext = allTypeAnnotationContextsArray[j]; >+ if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) { >+ invisibleTypeAnnotationsCounter++; >+ allTypeAnnotationContexts.add(annotationContext); >+ } else { >+ visibleTypeAnnotationsCounter++; >+ allTypeAnnotationContexts.add(annotationContext); >+ } >+ } >+ attributesNumber += generateRuntimeTypeAnnotations( >+ allTypeAnnotationContextsArray, >+ visibleTypeAnnotationsCounter, >+ invisibleTypeAnnotationsCounter); >+ } >+ return attributesNumber; >+ } >+ > private int generateVarargsAttribute() { > int localContentsOffset = this.contentsOffset; > /* >@@ -4158,6 +4796,9 @@ > this.produceAttributes = options.produceDebugAttributes; > if (this.targetJDK >= ClassFileConstants.JDK1_6) { > this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE; >+ if (this.targetJDK >= ClassFileConstants.JDK1_7) { >+ this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION; >+ } > } else if (this.targetJDK == ClassFileConstants.CLDC_1_1) { > this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3 > this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP; >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v >retrieving revision 1.106 >diff -u -r1.106 ASTNode.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 17 Dec 2010 09:38:55 -0000 1.106 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -53,7 +53,16 @@ > public final static int Bit27 = 0x4000000; // parenthesis count (expression) > public final static int Bit28 = 0x8000000; // parenthesis count (expression) > public final static int Bit29 = 0x10000000; // parenthesis count (expression) >- public final static int Bit30 = 0x20000000; // elseif (if statement) | try block exit (try statement) | fall-through (case statement) | ignore no effect assign (expression ref) | needScope (for statement) | isAnySubRoutineEscaping (return statement) | blockExit (synchronized statement) >+ /* elseif (if statement) >+ * | try block exit (try statement) >+ * | fall-through (case statement) >+ * | ignore no effect assign (expression ref) >+ * | needScope (for statement) >+ * | isAnySubRoutineEscaping (return statement) >+ * | blockExit (synchronized statement) >+ * | hasTypeAnnotations (type decl, field decl, local decl, argument, method decl, type reference) >+ */ >+ public final static int Bit30 = 0x20000000; > public final static int Bit31 = 0x40000000; // local declaration reachable (local decl) | ignore raw type check (type ref) | discard entire assignment (assignment) | isSynchronized (return statement) | thenExit (if statement) > public final static int Bit32 = 0x80000000; // reachable (statement) > >@@ -238,6 +247,12 @@ > 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 = Bit30; >+ >+ // tag catch block variable as catch variable to distinguish them from argument >+ public static final int CatchVariable = Bit1; >+ > public ASTNode() { > > super(); >@@ -494,8 +509,15 @@ > 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; > } >@@ -582,6 +604,25 @@ > local.setAnnotations(annotations); > } > 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; > } >@@ -678,6 +719,122 @@ > } > } > >+ /** >+ * 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); >+ } >+ 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. > */ >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java,v >retrieving revision 1.112 >diff -u -r1.112 AbstractMethodDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java 16 Jan 2011 22:43:21 -0000 1.112 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -10,16 +10,37 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >-import org.eclipse.jdt.core.compiler.*; >-import org.eclipse.jdt.internal.compiler.*; >+import java.util.List; >+ >+import org.eclipse.jdt.core.compiler.CategorizedProblem; >+import org.eclipse.jdt.core.compiler.CharOperation; >+import org.eclipse.jdt.core.compiler.IProblem; >+import org.eclipse.jdt.internal.compiler.ASTVisitor; >+import org.eclipse.jdt.internal.compiler.ClassFile; >+import org.eclipse.jdt.internal.compiler.CompilationResult; >+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.jdt.internal.compiler.codegen.CodeStream; > import org.eclipse.jdt.internal.compiler.flow.FlowInfo; > import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext; >-import org.eclipse.jdt.internal.compiler.impl.*; >-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >-import org.eclipse.jdt.internal.compiler.codegen.*; >-import org.eclipse.jdt.internal.compiler.lookup.*; >-import org.eclipse.jdt.internal.compiler.problem.*; >-import org.eclipse.jdt.internal.compiler.parser.*; >+import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; >+import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; >+import org.eclipse.jdt.internal.compiler.lookup.Binding; >+import org.eclipse.jdt.internal.compiler.lookup.ClassScope; >+import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; >+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; >+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; >+import org.eclipse.jdt.internal.compiler.lookup.MethodScope; >+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; >+import org.eclipse.jdt.internal.compiler.lookup.TagBits; >+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; >+import org.eclipse.jdt.internal.compiler.lookup.TypeIds; >+import org.eclipse.jdt.internal.compiler.parser.Parser; >+import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; >+import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit; >+import org.eclipse.jdt.internal.compiler.problem.AbortMethod; >+import org.eclipse.jdt.internal.compiler.problem.AbortType; >+import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; >+import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; > import org.eclipse.jdt.internal.compiler.util.Util; > > public abstract class AbstractMethodDeclaration >@@ -35,6 +56,8 @@ > public int modifiers; > public int modifiersSourceStart; > public Annotation[] annotations; >+ // jsr 308 >+ public Annotation[] receiverAnnotations; > public Argument[] arguments; > public TypeReference[] thrownExceptions; > public Statement[] statements; >@@ -265,9 +288,13 @@ > 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 >+ int size = 1; // an abstact method or a native method cannot be static > for (int i = 0, max = parameters.length; i < max; i++) { > switch(parameters[i].id) { > case TypeIds.T_long : >@@ -353,7 +380,10 @@ > } > 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) { >@@ -375,6 +405,10 @@ > } > } > 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++) { >@@ -419,6 +453,14 @@ > 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)); > resolveStatements(); > // check @Deprecated annotation presence > if (this.binding != null >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java,v >retrieving revision 1.36 >diff -u -r1.36 AbstractVariableDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java 6 May 2010 18:37:17 -0000 1.36 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -87,7 +87,10 @@ > 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(' '); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java,v >retrieving revision 1.84 >diff -u -r1.84 AllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 12 Aug 2010 16:58:28 -0000 1.84 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -95,7 +95,7 @@ > MethodBinding codegenBinding = this.binding.original(); > ReferenceBinding allocatedType = codegenBinding.declaringClass; > >- codeStream.new_(allocatedType); >+ codeStream.new_(this.type, allocatedType); > boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0; > if (valueRequired || isUnboxing) { > codeStream.dup(); >@@ -128,7 +128,7 @@ > } > // invoke constructor > if (this.syntheticAccessor == null) { >- codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments); > } else { > // synthetic accessor got some extra arguments appended to its signature, which need values > for (int i = 0, >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java,v >retrieving revision 1.69 >diff -u -r1.69 Annotation.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java 16 Jan 2011 22:43:21 -0000 1.69 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -10,6 +10,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; >@@ -23,6 +25,324 @@ > */ > 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; >+ } >+ } >+ > final static MemberValuePair[] NoValuePairs = new MemberValuePair[0]; > public int declarationSourceEnd; > public Binding recipient; >@@ -86,6 +406,10 @@ > 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 >@@ -175,18 +499,62 @@ > 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 > >@@ -264,7 +632,6 @@ > scope.problemReporter().typeMismatchError(typeBinding, scope.getJavaLangAnnotationAnnotation(), this.type, null); > return null; > } >- > ReferenceBinding annotationType = (ReferenceBinding) this.resolvedType; > MethodBinding[] methods = annotationType.methods(); > // clone valuePairs to keep track of unused ones >@@ -314,16 +681,19 @@ > } > } > } >- 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 > } > } >@@ -386,19 +756,32 @@ > } > // 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; >@@ -408,24 +791,48 @@ > } > 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); > } > } >@@ -434,4 +841,5 @@ > > public abstract void traverse(ASTVisitor visitor, BlockScope scope); > >+ public abstract void traverse(ASTVisitor visitor, ClassScope scope); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java,v >retrieving revision 1.21 >diff -u -r1.21 AnnotationMethodDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java 20 Jul 2010 20:23:19 -0000 1.21 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java 20 Jan 2011 21:55:11 -0000 >@@ -55,7 +55,10 @@ > > 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) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java,v >retrieving revision 1.65 >diff -u -r1.65 Argument.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 3 Nov 2009 15:37:47 -0000 1.65 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -26,6 +26,9 @@ > this.declarationSourceEnd = (int) posNom; > this.modifiers = modifiers; > this.type = tr; >+ if (tr != null) { >+ this.bits |= (tr.bits & ASTNode.HasTypeAnnotations); >+ } > this.bits |= IsLocalDeclarationReachable; > } > >@@ -76,7 +79,9 @@ > public int getKind() { > return PARAMETER; > } >- >+ public boolean isArgument() { >+ return true; >+ } > public boolean isVarArgs() { > return this.type != null && (this.type.bits & IsVarArgs) != 0; > } >@@ -85,7 +90,10 @@ > > 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$ >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java,v >retrieving revision 1.44 >diff -u -r1.44 ArrayAllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java 12 Aug 2010 16:58:28 -0000 1.44 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -24,6 +24,7 @@ > //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) { >@@ -65,10 +66,10 @@ > // array allocation > if (explicitDimCount == 1) { > // Mono-dimensional array >- codeStream.newArray((ArrayBinding)this.resolvedType); >+ codeStream.newArray(this.type, (ArrayBinding)this.resolvedType); > } else { > // Multi-dimensional array >- codeStream.multianewarray(this.resolvedType, explicitDimCount); >+ codeStream.multianewarray(this.type, this.resolvedType, explicitDimCount, this.annotationsOnDimensions); > } > if (valueRequired) { > codeStream.generateImplicitConversion(this.implicitConversion); >@@ -83,6 +84,11 @@ > 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 { >@@ -130,7 +136,7 @@ > } > // allow new List<?>[5] - only check for generic array when no initializer, since also checked inside initializer resolution > if (referenceType != null && !referenceType.isReifiable()) { >- scope.problemReporter().illegalGenericArray(referenceType, this); >+ scope.problemReporter().illegalGenericArray(referenceType, this); > } > } else if (explicitDimIndex >= 0) { > scope.problemReporter().cannotDefineDimensionsAndInitializer(this); >@@ -163,6 +169,12 @@ > 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; > } > >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java,v >retrieving revision 1.55 >diff -u -r1.55 ArrayInitializer.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java 7 Mar 2009 00:58:58 -0000 1.55 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -48,7 +48,7 @@ > int pc = codeStream.position; > int expressionLength = (this.expressions == null) ? 0: this.expressions.length; > codeStream.generateInlinedValue(expressionLength); >- codeStream.newArray(this.binding); >+ codeStream.newArray(null, this.binding); > if (this.expressions != null) { > // binding is an ArrayType, so I can just deal with the dimension > int elementsTypeID = this.binding.dimensions > 1 ? -1 : this.binding.leafComponentType.id; >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java,v >retrieving revision 1.33 >diff -u -r1.33 ArrayQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java 6 Dec 2010 18:40:28 -0000 1.33 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -17,17 +17,29 @@ > > 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 +82,47 @@ > } > } > >+ 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 +130,52 @@ > } > > 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)); >+ } >+ } >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java,v >retrieving revision 1.32 >diff -u -r1.32 ArrayTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java 27 Jun 2008 16:03:55 -0000 1.32 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -12,6 +12,7 @@ > > 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 +20,7 @@ > > public class ArrayTypeReference extends SingleTypeReference { > public int dimensions; >+ public Annotation[][] annotationsOnDimensions; // jsr308 style type annotations on dimensions. > public int originalSourceEnd; > > /** >@@ -32,12 +34,25 @@ > 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 +84,26 @@ > 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 +111,71 @@ > } > > 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)); >+ } >+ } >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java,v >retrieving revision 1.35 >diff -u -r1.35 CaseStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java 13 Sep 2010 13:26:20 -0000 1.35 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java 20 Jan 2011 21:55:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -12,7 +12,7 @@ > > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >-import org.eclipse.jdt.internal.compiler.codegen.CaseLabel; >+import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; > import org.eclipse.jdt.internal.compiler.codegen.CodeStream; > import org.eclipse.jdt.internal.compiler.flow.FlowContext; > import org.eclipse.jdt.internal.compiler.flow.FlowInfo; >@@ -27,7 +27,7 @@ > public class CaseStatement extends Statement { > > public Expression constantExpression; >- public CaseLabel targetLabel; >+ public BranchLabel targetLabel; > > public CaseStatement(Expression constantExpression, int sourceEnd, int sourceStart) { > this.constantExpression = constantExpression; >Index: compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java,v >retrieving revision 1.137 >diff -u -r1.137 CastExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 17 Dec 2010 06:40:12 -0000 1.137 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -37,11 +37,11 @@ > public class CastExpression extends Expression { > > public Expression expression; >- public Expression type; >+ public TypeReference type; > public TypeBinding expectedType; // when assignment conversion to a given expected type: String s = (String) t; > > //expression.implicitConversion holds the cast for baseType casting >-public CastExpression(Expression expression, Expression type) { >+public CastExpression(Expression expression, TypeReference type) { > this.expression = expression; > this.type = type; > type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage >@@ -407,7 +407,7 @@ > if (valueRequired || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check > codeStream.generateConstant(this.constant, this.implicitConversion); > if (needRuntimeCheckcast) { >- codeStream.checkcast(this.resolvedType); >+ codeStream.checkcast(this.type, this.resolvedType); > } > if (!valueRequired) { > // the resolveType cannot be double or long >@@ -419,7 +419,7 @@ > } > this.expression.generateCode(currentScope, codeStream, valueRequired || needRuntimeCheckcast); > if (needRuntimeCheckcast && this.expression.postConversionType(currentScope) != this.resolvedType.erasure()) { // no need to issue a checkcast if already done as genericCast >- codeStream.checkcast(this.resolvedType); >+ codeStream.checkcast(this.type, this.resolvedType); > } > if (valueRequired) { > codeStream.generateImplicitConversion(this.implicitConversion); >@@ -476,55 +476,46 @@ > this.constant = Constant.NotAConstant; > this.implicitConversion = TypeIds.T_undefined; > >- if ((this.type instanceof TypeReference) || (this.type instanceof NameReference) >- && ((this.type.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0) { // no extra parenthesis around type: ((A))exp >+ boolean exprContainCast = false; > >- boolean exprContainCast = false; >- >- TypeBinding castType = this.resolvedType = this.type.resolveType(scope); >- //expression.setExpectedType(this.resolvedType); // needed in case of generic method invocation >- if (this.expression instanceof CastExpression) { >- this.expression.bits |= ASTNode.DisableUnnecessaryCastCheck; >- exprContainCast = true; >- } >- TypeBinding expressionType = this.expression.resolveType(scope); >- if (castType != null) { >- if (expressionType != null) { >- boolean isLegal = checkCastTypesCompatibility(scope, castType, expressionType, this.expression); >- if (isLegal) { >- this.expression.computeConversion(scope, castType, expressionType); >- if ((this.bits & ASTNode.UnsafeCast) != 0) { // unsafe cast >- if (scope.compilerOptions().reportUnavoidableGenericTypeProblems || !this.expression.forcedToBeRaw(scope.referenceContext())) { >- scope.problemReporter().unsafeCast(this, scope); >- } >- } else { >- if (castType.isRawType() && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){ >- scope.problemReporter().rawTypeReference(this.type, castType); >- } >- if ((this.bits & (ASTNode.UnnecessaryCast|ASTNode.DisableUnnecessaryCastCheck)) == ASTNode.UnnecessaryCast) { // unnecessary cast >- if (!isIndirectlyUsed()) // used for generic type inference or boxing ? >- scope.problemReporter().unnecessaryCast(this); >- } >+ TypeBinding castType = this.resolvedType = this.type.resolveType(scope); >+ //expression.setExpectedType(this.resolvedType); // needed in case of generic method invocation >+ if (this.expression instanceof CastExpression) { >+ this.expression.bits |= ASTNode.DisableUnnecessaryCastCheck; >+ exprContainCast = true; >+ } >+ TypeBinding expressionType = this.expression.resolveType(scope); >+ if (castType != null) { >+ if (expressionType != null) { >+ boolean isLegal = checkCastTypesCompatibility(scope, castType, expressionType, this.expression); >+ if (isLegal) { >+ this.expression.computeConversion(scope, castType, expressionType); >+ if ((this.bits & ASTNode.UnsafeCast) != 0) { // unsafe cast >+ if (scope.compilerOptions().reportUnavoidableGenericTypeProblems || !this.expression.forcedToBeRaw(scope.referenceContext())) { >+ scope.problemReporter().unsafeCast(this, scope); > } >- } else { // illegal cast >- if ((castType.tagBits & TagBits.HasMissingType) == 0) { // no complaint if secondary error >- scope.problemReporter().typeCastError(this, castType, expressionType); >+ } else { >+ if (castType.isRawType() && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){ >+ scope.problemReporter().rawTypeReference(this.type, castType); >+ } >+ if ((this.bits & (ASTNode.UnnecessaryCast|ASTNode.DisableUnnecessaryCastCheck)) == ASTNode.UnnecessaryCast) { // unnecessary cast >+ if (!isIndirectlyUsed()) // used for generic type inference or boxing ? >+ scope.problemReporter().unnecessaryCast(this); > } >- this.bits |= ASTNode.DisableUnnecessaryCastCheck; // disable further secondary diagnosis > } >+ } else { // illegal cast >+ if ((castType.tagBits & TagBits.HasMissingType) == 0) { // no complaint if secondary error >+ scope.problemReporter().typeCastError(this, castType, expressionType); >+ } >+ this.bits |= ASTNode.DisableUnnecessaryCastCheck; // disable further secondary diagnosis > } >- this.resolvedType = castType.capture(scope, this.sourceEnd); >- if (exprContainCast) { >- checkNeedForCastCast(scope, this); >- } > } >- return this.resolvedType; >- } else { // expression as a cast >- TypeBinding expressionType = this.expression.resolveType(scope); >- if (expressionType == null) return null; >- scope.problemReporter().invalidTypeReference(this.type); >- return null; >+ this.resolvedType = castType.capture(scope, this.sourceEnd); >+ if (exprContainCast) { >+ checkNeedForCastCast(scope, this); >+ } > } >+ return this.resolvedType; > } > > /** >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java,v >retrieving revision 1.54 >diff -u -r1.54 ClassLiteralAccess.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java 14 Jan 2011 17:02:24 -0000 1.54 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java 20 Jan 2011 21:55:12 -0000 >@@ -61,7 +61,7 @@ > > // in interface case, no caching occurs, since cannot make a cache field for interface > if (valueRequired) { >- codeStream.generateClassLiteralAccessForType(this.type.resolvedType, this.syntheticField); >+ codeStream.generateClassLiteralAccessForType(this.type, this.type.resolvedType, this.syntheticField); > codeStream.generateImplicitConversion(this.implicitConversion); > } > codeStream.recordPositionsFrom(pc, this.sourceStart); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java,v >retrieving revision 1.62 >diff -u -r1.62 Clinit.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java 5 Jan 2011 19:57:26 -0000 1.62 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java 20 Jan 2011 21:55:12 -0000 >@@ -176,6 +176,7 @@ > if (this.assertionSyntheticFieldBinding != null) { > // generate code related to the activation of assertion for this class > codeStream.generateClassLiteralAccessForType( >+ null, > classScope.outerMostClassScope().enclosingSourceType(), > this.classLiteralSyntheticField); > codeStream.invokeJavaLangClassDesiredAssertionStatus(); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java,v >retrieving revision 1.23 >diff -u -r1.23 DoubleLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java 21 Oct 2009 16:19:38 -0000 1.23 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -10,6 +10,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.impl.*; > import org.eclipse.jdt.internal.compiler.codegen.*; >@@ -26,6 +27,11 @@ > > public void computeConstant() { > Double computedValue; >+ boolean containsUnderscores = CharOperation.indexOf('_', this.source) > 0; >+ if (containsUnderscores) { >+ // remove all underscores from source >+ this.source = CharOperation.remove(this.source, '_'); >+ } > try { > computedValue = Double.valueOf(String.valueOf(this.source)); > } catch (NumberFormatException e) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java,v >retrieving revision 1.74 >diff -u -r1.74 ExplicitConstructorCall.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 12 Aug 2010 16:58:28 -0000 1.74 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -159,7 +159,7 @@ > } > codeStream.invoke(Opcodes.OPC_invokespecial, this.syntheticAccessor, null /* default declaringClass */); > } else { >- codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments); > } > codeStream.recordPositionsFrom(pc, this.sourceStart); > } finally { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java,v >retrieving revision 1.102 >diff -u -r1.102 FieldDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 5 Jan 2011 19:57:26 -0000 1.102 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 20 Jan 2011 21:55:12 -0000 >@@ -10,9 +10,12 @@ > *******************************************************************************/ > 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.*; >@@ -41,7 +44,7 @@ > // for subtypes or conversion > } > >-public FieldDeclaration( char[] name, int sourceStart, int sourceEnd) { >+public FieldDeclaration(char[] name, int sourceStart, int sourceEnd) { > this.name = name; > //due to some declaration like > // int x, y = 3, z , x ; >@@ -109,7 +112,13 @@ > } > 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() > */ >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java,v >retrieving revision 1.23 >diff -u -r1.23 FloatLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java 21 Oct 2009 16:19:38 -0000 1.23 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -10,6 +10,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.codegen.CodeStream; > import org.eclipse.jdt.internal.compiler.impl.FloatConstant; >@@ -27,6 +28,11 @@ > > public void computeConstant() { > Float computedValue; >+ boolean containsUnderscores = CharOperation.indexOf('_', this.source) > 0; >+ if (containsUnderscores) { >+ // remove all underscores from source >+ this.source = CharOperation.remove(this.source, '_'); >+ } > try { > computedValue = Float.valueOf(String.valueOf(this.source)); > } catch (NumberFormatException e) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java,v >retrieving revision 1.44 >diff -u -r1.44 Initializer.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java 7 Mar 2009 01:08:07 -0000 1.44 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -87,7 +87,10 @@ > 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); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java,v >retrieving revision 1.62 >diff -u -r1.62 InstanceOfExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java 15 Sep 2010 16:10:51 -0000 1.62 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -59,7 +59,7 @@ > public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { > int pc = codeStream.position; > this.expression.generateCode(currentScope, codeStream, true); >- codeStream.instance_of(this.type.resolvedType); >+ codeStream.instance_of(this.type, this.type.resolvedType); > if (valueRequired) { > codeStream.generateImplicitConversion(this.implicitConversion); > } else { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java,v >retrieving revision 1.29 >diff -u -r1.29 IntLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java 13 Sep 2010 13:26:20 -0000 1.29 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -35,45 +35,54 @@ > //which is legal if used with a - as prefix....cool.... > //notice that Integer.MIN_VALUE == -2147483648 > long MAX = Integer.MAX_VALUE; >- if (this == One) { >+ if (this == One) { > this.constant = IntConstant.fromValue(1); > return ; > } > int length = this.source.length; > long computedValue = 0L; >- if (this.source[0] == '0') { >+ if (this.source[0] == '0') { > MAX = 0xFFFFFFFFL ; //a long in order to be positive ! > if (length == 1) { >- this.constant = IntConstant.fromValue(0); return ; >+ this.constant = IntConstant.fromValue(0); >+ return ; > } > final int shift,radix; > int j ; >- if ((this.source[1] == 'x') || (this.source[1] == 'X')) { >- shift = 4 ; j = 2; radix = 16; >- } else { >- shift = 3 ; j = 1; radix = 8; >+ if ((this.source[1] == 'x') || (this.source[1] == 'X')) { >+ shift = 4; j = 2; radix = 16; >+ } else if ((this.source[1] == 'b') || (this.source[1] == 'B')) { >+ shift = 1; j = 2; radix = 2; >+ } else { >+ shift = 3; j = 1; radix = 8; > } >- while (this.source[j]=='0') { >- j++; //jump over redondant zero >- if (j == length) { >- //watch for 000000000000000000 >- this.constant = IntConstant.fromValue(this.value = (int)computedValue); >- return; >+ if (j < length) { >+ while (this.source[j]=='0') { >+ j++; //jump over redundant zero >+ if (j == length) { >+ //watch for 000000000000000000 >+ this.constant = IntConstant.fromValue(this.value = (int)computedValue); >+ return; >+ } > } > } >- while (j<length) { >- int digitValue ; >- if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0 ) { >+ while (j < length) { >+ int digitValue; >+ char currentChar = this.source[j++]; >+ if (currentChar == '_') continue; >+ if ((digitValue = ScannerHelper.digit(currentChar,radix)) < 0 ) { > return; /*constant stays null*/ > } > computedValue = (computedValue<<shift) | digitValue ; > if (computedValue > MAX) return; /*constant stays null*/ > } >- } else { >+ } else { > //-----------regular case : radix = 10----------- >- for (int i = 0 ; i < length;i++) { >+ loop: for (int i = 0 ; i < length;i++) { >+ char currentChar = this.source[i]; >+ if (currentChar == '_') continue loop; > int digitValue ; >- if ((digitValue = ScannerHelper.digit(this.source[i],10)) < 0 ) { >+ if ((digitValue = ScannerHelper.digit(this.source[i],10)) < 0 ) { > return; /*constant stays null*/ > } > computedValue = 10*computedValue + digitValue; >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java,v >retrieving revision 1.15 >diff -u -r1.15 JavadocImplicitTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java 27 Jun 2008 16:03:55 -0000 1.15 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -30,6 +30,10 @@ > 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) >Index: compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java,v >retrieving revision 1.77 >diff -u -r1.77 LocalDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 16 Jan 2011 22:43:21 -0000 1.77 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -12,8 +12,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.*; >@@ -152,11 +155,25 @@ > 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) { >@@ -202,7 +219,7 @@ > this.initialization.computeConversion(scope, variableType, initializationType); > } > } else { >- this.initialization.setExpectedType(variableType); >+ this.initialization.setExpectedType(variableType); > TypeBinding initializationType = this.initialization.resolveType(scope); > if (initializationType != null) { > if (variableType != initializationType) // must call before computeConversion() and typeMismatchError() >@@ -245,6 +262,11 @@ > } > // 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)); >+ } > } > > public void traverse(ASTVisitor visitor, BlockScope scope) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java,v >retrieving revision 1.30 >diff -u -r1.30 LongLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java 21 Oct 2009 16:19:38 -0000 1.30 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -26,7 +26,7 @@ > //the overflow (when radix=10) is tested using the fact that > //the value should always grow during its computation > int length = this.source.length - 1; //minus one because the last char is 'l' or 'L' >- long computedValue ; >+ long computedValue = 0; > if (this.source[0] == '0') { > if (length == 1) { > this.constant = LongConstant.fromValue(0L); >@@ -49,35 +49,41 @@ > } > } > >- int digitValue ; >- if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0 ) { >- return; /*constant stays null*/ >- } >- if (digitValue >= 8) >- nbDigit = 4; >- else if (digitValue >= 4) >- nbDigit = 3; >- else if (digitValue >= 2) >- nbDigit = 2; >- else >- nbDigit = 1; //digitValue is not 0 >- computedValue = digitValue ; >- while (j<length) { >- if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0) { >+ char currentChar = this.source[j++]; >+ if (currentChar != '_') { >+ int digitValue ; >+ if ((digitValue = ScannerHelper.digit(currentChar,radix)) < 0 ) { > return; /*constant stays null*/ > } >- if ((nbDigit += shift) > 64) >- return; /*constant stays null*/ >- computedValue = (computedValue<<shift) | digitValue ; >+ if (digitValue >= 8) >+ nbDigit = 4; >+ else if (digitValue >= 4) >+ nbDigit = 3; >+ else if (digitValue >= 2) >+ nbDigit = 2; >+ else >+ nbDigit = 1; //digitValue is not 0 >+ computedValue = digitValue ; >+ while (j<length) { >+ currentChar = this.source[j++]; >+ if (currentChar == '_') continue; >+ if ((digitValue = ScannerHelper.digit(currentChar,radix)) < 0) { >+ return; /*constant stays null*/ >+ } >+ if ((nbDigit += shift) > 64) >+ return; /*constant stays null*/ >+ computedValue = (computedValue<<shift) | digitValue ; >+ } > } > } else { > //-----------case radix=10----------------- > long previous = 0; >- computedValue = 0; > final long limit = Long.MAX_VALUE / 10; // needed to check prior to the multiplication >- for (int i = 0 ; i < length; i++) { >+ loop: for (int i = 0 ; i < length; i++) { > int digitValue ; >- if ((digitValue = ScannerHelper.digit(this.source[i], 10)) < 0 ) return /*constant stays null*/; >+ char currentChar = this.source[i]; >+ if (currentChar == '_') continue loop; >+ if ((digitValue = ScannerHelper.digit(currentChar, 10)) < 0 ) return /*constant stays null*/; > previous = computedValue; > if (computedValue > limit) > return; /*constant stays null*/ >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java,v >retrieving revision 1.13 >diff -u -r1.13 MarkerAnnotation.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java 27 Jun 2008 16:03:56 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2011 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 >@@ -42,4 +42,12 @@ > } > 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); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java,v >retrieving revision 1.39 >diff -u -r1.39 MemberValuePair.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java 1 Mar 2010 06:50:30 -0000 1.39 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java 20 Jan 2011 21:55:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -14,6 +14,7 @@ > 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; >@@ -238,4 +239,12 @@ > } > 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); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java,v >retrieving revision 1.151 >diff -u -r1.151 MessageSend.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 16 Jan 2011 22:43:21 -0000 1.151 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -166,13 +166,13 @@ > if (this.syntheticAccessor == null){ > TypeBinding constantPoolDeclaringClass = CodeStream.getConstantPoolDeclaringClass(currentScope, codegenBinding, this.actualReceiverType, this.receiver.isImplicitThis()); > if (isStatic){ >- codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass, this.typeArguments); > } else if((this.receiver.isSuper()) || codegenBinding.isPrivate()){ >- codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass, this.typeArguments); > } else if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type >- codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass, this.typeArguments); > } else { >- codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass, this.typeArguments); > } > } else { > codeStream.invoke(Opcodes.OPC_invokestatic, this.syntheticAccessor, null /* default declaringClass */); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java,v >retrieving revision 1.79 >diff -u -r1.79 MethodDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 16 Jan 2011 22:43:21 -0000 1.79 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -10,15 +10,19 @@ > *******************************************************************************/ > 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; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext; > import org.eclipse.jdt.internal.compiler.flow.FlowInfo; > import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext; > 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; >@@ -81,11 +85,13 @@ > // tag parameters as being set > if (this.arguments != null) { > for (int i = 0, count = this.arguments.length; i < count; i++) { >- flowInfo.markAsDefinitelyAssigned(this.arguments[i].binding); >+ Argument argument = this.arguments[i]; >+ this.bits |= (argument.bits & ASTNode.HasTypeAnnotations); >+ flowInfo.markAsDefinitelyAssigned(argument.binding); > // 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)) { >- Binding declaringElement = ((TypeVariableBinding)this.arguments[i].binding.type).declaringElement; >+ if (argument.binding != null && (argument.binding.type instanceof TypeVariableBinding)) { >+ Binding declaringElement = ((TypeVariableBinding)argument.binding.type).declaringElement; > if (this.binding != null && this.binding.declaringClass == declaringElement) > this.bits &= ~ASTNode.CanBeStatic; > } >@@ -95,6 +101,7 @@ > // method of a non-static member type can't be static. > this.bits &= ~ASTNode.CanBeStatic; > } >+ > // propagate to statements > if (this.statements != null) { > int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) == 0 ? Statement.NOT_COMPLAINED : Statement.COMPLAINED_FAKE_REACHABLE; >@@ -139,6 +146,14 @@ > } > } > >+ 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; > } >@@ -156,6 +171,7 @@ > 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 > } >@@ -168,9 +184,13 @@ > if (this.returnType != null && this.returnType.resolvedType instanceof TypeVariableBinding) { > returnsUndeclTypeVar = true; > } >+ > 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; > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java,v >retrieving revision 1.14 >diff -u -r1.14 NormalAnnotation.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java 27 Jun 2008 16:03:54 -0000 1.14 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -71,4 +71,17 @@ > } > 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); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java,v >retrieving revision 1.63 >diff -u -r1.63 ParameterizedQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 1 Nov 2010 14:15:46 -0000 1.63 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -34,6 +34,13 @@ > 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; > >@@ -59,6 +66,17 @@ > 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[][] >@@ -128,6 +146,14 @@ > } > } > 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; >+ } >+ } > boolean isClassScope = scope.kind == Scope.CLASS_SCOPE; > Binding binding = scope.getPackage(this.tokens); > if (binding != null && !binding.isValidBinding()) { >@@ -160,18 +186,18 @@ > reportInvalidType(scope); > // be resilient, still attempt resolving arguments > for (int j = i; j < max; j++) { >- TypeReference[] args = this.typeArguments[j]; >- if (args != null) { >+ TypeReference[] args = this.typeArguments[j]; >+ if (args != null) { > int argLength = args.length; > for (int k = 0; k < argLength; k++) { >- TypeReference typeArgument = args[k]; >- if (isClassScope) { >- typeArgument.resolveType((ClassScope) scope); >- } else { >- typeArgument.resolveType((BlockScope) scope); >- } >+ TypeReference typeArgument = args[k]; >+ if (isClassScope) { >+ typeArgument.resolveType((ClassScope) scope); >+ } else { >+ typeArgument.resolveType((BlockScope) scope); >+ } > } >- } >+ } > } > return null; > } >@@ -196,20 +222,20 @@ > } > > // check generic and arity >- TypeReference[] args = this.typeArguments[i]; >- if (args != null) { >- TypeReference keep = null; >- if (isClassScope) { >- keep = ((ClassScope) scope).superTypeReference; >- ((ClassScope) scope).superTypeReference = null; >- } >+ TypeReference[] args = this.typeArguments[i]; >+ if (args != null) { >+ TypeReference keep = null; >+ if (isClassScope) { >+ keep = ((ClassScope) scope).superTypeReference; >+ ((ClassScope) scope).superTypeReference = null; >+ } > int argLength = args.length; > TypeBinding[] argTypes = new TypeBinding[argLength]; > boolean argHasError = false; > ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original(); > for (int j = 0; j < argLength; j++) { >- TypeReference arg = args[j]; >- TypeBinding argType = isClassScope >+ TypeReference arg = args[j]; >+ TypeBinding argType = isClassScope > ? arg.resolveTypeArgument((ClassScope) scope, currentOriginal, j) > : arg.resolveTypeArgument((BlockScope) scope, currentOriginal, j); > if (argType == null) { >@@ -227,7 +253,7 @@ > return null; > } > >- TypeVariableBinding[] typeVariables = currentOriginal.typeVariables(); >+ TypeVariableBinding[] typeVariables = currentOriginal.typeVariables(); > if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic > if (scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_5) { // below 1.5, already reported as syntax error > scope.problemReporter().nonGenericTypeCannotBeParameterized(i, this, currentType, argTypes); >@@ -262,17 +288,17 @@ > else > scope.deferBoundCheck(this); > qualifyingType = parameterizedType; >- } else { >+ } else { > ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original(); > if (isClassScope) > if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this)) > return null; > if (currentOriginal.isGenericType()) { >- if (typeIsConsistent && qualifyingType != null && qualifyingType.isParameterizedType()) { >+ if (typeIsConsistent && qualifyingType != null && qualifyingType.isParameterizedType()) { > scope.problemReporter().parameterizedMemberTypeMissingArguments(this, scope.environment().createParameterizedType(currentOriginal, null, qualifyingType), i); > typeIsConsistent = false; > } >- qualifyingType = scope.environment().createRawType(currentOriginal, qualifyingType); // raw type >+ qualifyingType = scope.environment().createRawType(currentOriginal, qualifyingType); // raw type > } else { > qualifyingType = (qualifyingType != null && qualifyingType.isParameterizedType()) > ? scope.environment().createParameterizedType(currentOriginal, null, qualifyingType) >@@ -293,6 +319,11 @@ > } > > 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]); >@@ -323,11 +354,26 @@ > } > 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$ > } > } >@@ -342,6 +388,20 @@ > } > 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++) { >@@ -355,6 +415,20 @@ > > 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++) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java,v >retrieving revision 1.54 >diff -u -r1.54 ParameterizedSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 1 Nov 2010 14:15:46 -0000 1.54 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -29,6 +29,13 @@ > 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; > >@@ -48,6 +55,14 @@ > 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[][] >@@ -81,6 +96,10 @@ > 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 >@@ -105,9 +124,17 @@ > } > } > } >+ 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; >+ } >+ } > boolean hasGenericError = false; > ReferenceBinding currentType; >- this.bits |= ASTNode.DidResolve; > if (enclosingType == null) { > this.resolvedType = scope.getType(this.token); > if (this.resolvedType.isValidBinding()) { >@@ -163,32 +190,33 @@ > } > > // check generic and arity >- boolean isClassScope = scope.kind == Scope.CLASS_SCOPE; >- TypeReference keep = null; >- if (isClassScope) { >- keep = ((ClassScope) scope).superTypeReference; >- ((ClassScope) scope).superTypeReference = null; >- } >+ boolean isClassScope = scope.kind == Scope.CLASS_SCOPE; >+ TypeReference keep = null; >+ if (isClassScope) { >+ keep = ((ClassScope) scope).superTypeReference; >+ ((ClassScope) scope).superTypeReference = null; >+ } > int argLength = this.typeArguments.length; > TypeBinding[] argTypes = new TypeBinding[argLength]; > boolean argHasError = false; > ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original(); > for (int i = 0; i < argLength; i++) { >- TypeReference typeArgument = this.typeArguments[i]; >- TypeBinding argType = isClassScope >- ? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i) >- : typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i); >- if (argType == null) { >- argHasError = true; >- } else { >- argTypes[i] = argType; >- } >+ TypeReference typeArgument = this.typeArguments[i]; >+ 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 { >+ argTypes[i] = argType; >+ } > } > if (argHasError) { > return null; > } > if (isClassScope) { >- ((ClassScope) scope).superTypeReference = keep; >+ ((ClassScope) scope).superTypeReference = keep; > if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this)) > return null; > } >@@ -229,7 +257,7 @@ > } > } > >- ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType(currentOriginal, argTypes, enclosingType); >+ ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType(currentOriginal, argTypes, enclosingType); > // check argument type compatibility > if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution > parameterizedType.boundCheck(scope, this.typeArguments); >@@ -251,7 +279,17 @@ > return this.resolvedType = 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 max = this.typeArguments.length - 1; >@@ -263,11 +301,26 @@ > 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$ > } > } >@@ -288,6 +341,22 @@ > > 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); > } >@@ -297,6 +366,20 @@ > > 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); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java,v >retrieving revision 1.101 >diff -u -r1.101 QualifiedAllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 12 Aug 2010 16:58:28 -0000 1.101 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -113,7 +113,7 @@ > int pc = codeStream.position; > MethodBinding codegenBinding = this.binding.original(); > ReferenceBinding allocatedType = codegenBinding.declaringClass; >- codeStream.new_(allocatedType); >+ codeStream.new_(this.type, allocatedType); > boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0; > if (valueRequired || isUnboxing) { > codeStream.dup(); >@@ -146,7 +146,7 @@ > > // invoke constructor > if (this.syntheticAccessor == null) { >- codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments); > } else { > // synthetic accessor got some extra arguments appended to its signature, which need values > for (int i = 0, >Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java,v >retrieving revision 1.50 >diff -u -r1.50 QualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java 18 Mar 2010 16:22:38 -0000 1.50 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -33,6 +33,17 @@ > //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 +133,10 @@ > } > > 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 +145,24 @@ > } > > 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); > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java,v >retrieving revision 1.16 >diff -u -r1.16 SingleMemberAnnotation.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java 27 Jun 2008 16:03:56 -0000 1.16 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -62,4 +62,16 @@ > } > 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); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java,v >retrieving revision 1.34 >diff -u -r1.34 SingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java 11 May 2010 18:47:09 -0000 1.34 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java 20 Jan 2011 21:55:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -33,6 +33,17 @@ > > 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 +65,10 @@ > } > > public StringBuffer printExpression(int indent, StringBuffer output){ >- >+ if (this.annotations != null) { >+ printAnnotations(this.annotations, output); >+ output.append(' '); >+ } > return output.append(this.token); > } > >@@ -85,12 +99,24 @@ > } > > 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); > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java,v >retrieving revision 1.50 >diff -u -r1.50 Statement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java 14 Jan 2011 17:02:24 -0000 1.50 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java 20 Jan 2011 21:55:13 -0000 >@@ -106,7 +106,7 @@ > // called with (argLength - lastIndex) elements : foo(1, 2) or foo(1, 2, 3, 4) > // need to gen elements into an array, then gen each remaining element into created array > codeStream.generateInlinedValue(argLength - varArgIndex); >- codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array >+ codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array > for (int i = varArgIndex; i < argLength; i++) { > codeStream.dup(); > codeStream.generateInlinedValue(i - varArgIndex); >@@ -125,7 +125,7 @@ > // right number but not directly compatible or too many arguments - wrap extra into array > // need to gen elements into an array, then gen each remaining element into created array > codeStream.generateInlinedValue(1); >- codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array >+ codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array > codeStream.dup(); > codeStream.generateInlinedValue(0); > arguments[varArgIndex].generateCode(currentScope, codeStream, true); >@@ -135,7 +135,7 @@ > // scenario: foo(1) --> foo(1, new int[0]) > // generate code for an empty array of parameterType > codeStream.generateInlinedValue(0); >- codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array >+ codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array > } > } else if (arguments != null) { // standard generation for method arguments > for (int i = 0, max = arguments.length; i < max; i++) >Index: compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java,v >retrieving revision 1.79 >diff -u -r1.79 SwitchStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java 12 Aug 2010 16:58:28 -0000 1.79 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java 20 Jan 2011 21:55:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -11,6 +11,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >+import java.util.Arrays; >+ > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.codegen.*; >@@ -32,11 +34,13 @@ > public int blockStart; > public int caseCount; > int[] constants; >+ String[] stringConstants; > > // fallthrough > public final static int CASE = 0; > public final static int FALLTHROUGH = 1; > public final static int ESCAPING = 2; >+ private static final char[] SecretStringVariableName = " switchDispatchString".toCharArray(); //$NON-NLS-1$ > > > public SyntheticMethodBinding synthetic; // use for switch on enums types >@@ -44,6 +48,11 @@ > // for local variables table attributes > int preSwitchInitStateIndex = -1; > int mergedInitStateIndex = -1; >+ >+ CaseStatement[] duplicateCaseStatements = null; >+ int duplicateCaseStatementsCounter = 0; >+ private LocalVariableBinding dispatchStringCopy = null; >+ > > public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { > try { >@@ -121,13 +130,182 @@ > } > > /** >+ * Switch on String code generation >+ * This assumes that hashCode() specification for java.lang.String is API >+ * and is stable. >+ * @see "http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" >+ * @see "http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/lang/String.html" >+ * >+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope >+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream >+ */ >+ public void generateCodeForStringSwitch(BlockScope currentScope, CodeStream codeStream) { >+ >+ try { >+ if ((this.bits & IsReachable) == 0) { >+ return; >+ } >+ int pc = codeStream.position; >+ >+ class StringSwitchCase implements Comparable { >+ int hashCode; >+ String string; >+ BranchLabel label; >+ public StringSwitchCase(int hashCode, String string, BranchLabel label) { >+ this.hashCode = hashCode; >+ this.string = string; >+ this.label = label; >+ } >+ public int compareTo(Object o) { >+ StringSwitchCase that = (StringSwitchCase) o; >+ if (this.hashCode == that.hashCode) { >+ return 0; >+ } >+ if (this.hashCode > that.hashCode) { >+ return 1; >+ } >+ return -1; >+ } >+ public String toString() { >+ return "StringSwitchCase :\n" + //$NON-NLS-1$ >+ "case " + this.hashCode + ":(" + this.string + ")\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+ } >+ >+ final boolean hasCases = this.caseCount != 0; >+ final boolean valueRequired = this.expression.constant == Constant.NotAConstant || hasCases; >+ >+ StringSwitchCase [] stringCases = new StringSwitchCase[this.caseCount]; // may have to shrink later if multiple strings hash to same code. >+ BranchLabel[] sourceCaseLabels = new BranchLabel[this.caseCount]; >+ CaseLabel [] hashCodeCaseLabels = new CaseLabel[this.caseCount]; >+ this.constants = new int[this.caseCount]; // hashCode() values. >+ for (int i = 0, max = this.caseCount; i < max; i++) { >+ this.cases[i].targetLabel = (sourceCaseLabels[i] = new BranchLabel(codeStream)); // A branch label, not a case label. >+ sourceCaseLabels[i].tagBits |= BranchLabel.USED; >+ stringCases[i] = new StringSwitchCase(this.stringConstants[i].hashCode(), this.stringConstants[i], sourceCaseLabels[i]); >+ hashCodeCaseLabels[i] = new CaseLabel(codeStream); >+ hashCodeCaseLabels[i].tagBits |= BranchLabel.USED; >+ >+ } >+ Arrays.sort(stringCases); >+ >+ int uniqHashCount = 0; >+ int lastHashCode = 0; >+ for (int i = 0, length = this.caseCount; i < length; ++i) { >+ int hashCode = stringCases[i].hashCode; >+ if (i == 0 || hashCode != lastHashCode) { >+ lastHashCode = this.constants[uniqHashCount++] = hashCode; >+ } >+ } >+ >+ if (uniqHashCount != this.caseCount) { // multiple keys hashed to the same value. >+ System.arraycopy(this.constants, 0, this.constants = new int[uniqHashCount], 0, uniqHashCount); >+ System.arraycopy(hashCodeCaseLabels, 0, hashCodeCaseLabels = new CaseLabel[uniqHashCount], 0, uniqHashCount); >+ } >+ int[] sortedIndexes = new int[uniqHashCount]; // hash code are sorted already anyways. >+ for (int i = 0; i < uniqHashCount; i++) { >+ sortedIndexes[i] = i; >+ } >+ >+ CaseLabel defaultCaseLabel = new CaseLabel(codeStream); >+ defaultCaseLabel.tagBits |= BranchLabel.USED; >+ >+ // prepare the labels and constants >+ this.breakLabel.initialize(codeStream); >+ >+ BranchLabel defaultBranchLabel = new BranchLabel(codeStream); >+ if (hasCases) defaultBranchLabel.tagBits |= BranchLabel.USED; >+ if (this.defaultCase != null) { >+ this.defaultCase.targetLabel = defaultBranchLabel; >+ } >+ // generate expression >+ this.expression.generateCode(currentScope, codeStream, true); >+ codeStream.store(this.dispatchStringCopy, true); // leaves string on operand stack >+ codeStream.addVariable(this.dispatchStringCopy); >+ codeStream.invokeStringHashCode(); >+ if (hasCases) { >+ codeStream.lookupswitch(defaultCaseLabel, this.constants, sortedIndexes, hashCodeCaseLabels); >+ for (int i = 0, j = 0, max = this.caseCount; i < max; i++) { >+ int hashCode = stringCases[i].hashCode; >+ if (i == 0 || hashCode != lastHashCode) { >+ lastHashCode = hashCode; >+ if (i != 0) { >+ codeStream.goto_(defaultBranchLabel); >+ } >+ hashCodeCaseLabels[j++].place(); >+ } >+ codeStream.load(this.dispatchStringCopy); >+ codeStream.ldc(stringCases[i].string); >+ codeStream.invokeStringEquals(); >+ codeStream.ifne(stringCases[i].label); >+ } >+ codeStream.goto_(defaultBranchLabel); >+ } else if (valueRequired) { >+ codeStream.pop(); >+ } >+ >+ // generate the switch block statements >+ int caseIndex = 0; >+ if (this.statements != null) { >+ for (int i = 0, maxCases = this.statements.length; i < maxCases; i++) { >+ Statement statement = this.statements[i]; >+ if ((caseIndex < this.caseCount) && (statement == this.cases[caseIndex])) { // statements[i] is a case >+ this.scope.enclosingCase = this.cases[caseIndex]; // record entering in a switch case block >+ if (this.preSwitchInitStateIndex != -1) { >+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.preSwitchInitStateIndex); >+ } >+ caseIndex++; >+ } else { >+ if (statement == this.defaultCase) { // statements[i] is a case or a default case >+ defaultCaseLabel.place(); // branch label gets placed by generateCode below. >+ this.scope.enclosingCase = this.defaultCase; // record entering in a switch case block >+ if (this.preSwitchInitStateIndex != -1) { >+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.preSwitchInitStateIndex); >+ } >+ } >+ } >+ statement.generateCode(this.scope, codeStream); >+ } >+ } >+ >+ // May loose some local variable initializations : affecting the local variable attributes >+ if (this.mergedInitStateIndex != -1) { >+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex); >+ codeStream.addDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex); >+ } >+ codeStream.removeVariable(this.dispatchStringCopy); >+ if (this.scope != currentScope) { >+ codeStream.exitUserScope(this.scope); >+ } >+ // place the trailing labels (for break and default case) >+ this.breakLabel.place(); >+ if (this.defaultCase == null) { >+ // we want to force an line number entry to get an end position after the switch statement >+ codeStream.recordPositionsFrom(codeStream.position, this.sourceEnd, true); >+ defaultCaseLabel.place(); >+ defaultBranchLabel.place(); >+ } >+ codeStream.recordPositionsFrom(pc, this.sourceStart); >+ } catch (Throwable e) { >+ e.printStackTrace(); >+ } >+ finally { >+ if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block >+ } >+ } >+ >+ >+ /** > * Switch code generation > * > * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope > * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream > */ > public void generateCode(BlockScope currentScope, CodeStream codeStream) { >- >+ if (this.expression.resolvedType.id == TypeIds.T_JavaLangString) { >+ generateCodeForStringSwitch(currentScope, codeStream); >+ return; >+ } > try { > if ((this.bits & IsReachable) == 0) { > return; >@@ -267,6 +445,7 @@ > public void resolve(BlockScope upperScope) { > try { > boolean isEnumSwitch = false; >+ boolean isStringSwitch = false; > TypeBinding expressionType = this.expression.resolveType(upperScope); > if (expressionType != null) { > this.expression.computeConversion(upperScope, expressionType, expressionType); >@@ -285,6 +464,9 @@ > } else if (upperScope.isBoxingCompatibleWith(expressionType, TypeBinding.INT)) { > this.expression.computeConversion(upperScope, TypeBinding.INT, expressionType); > break checkType; >+ } else if (upperScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_7 && expressionType.id == TypeIds.T_JavaLangString) { >+ isStringSwitch = true; >+ break checkType; > } > upperScope.problemReporter().incorrectSwitchType(this.expression, expressionType); > expressionType = null; // fault-tolerance: ignore type mismatch from constants from hereon >@@ -295,51 +477,55 @@ > int length; > // collection of cases is too big but we will only iterate until caseCount > this.cases = new CaseStatement[length = this.statements.length]; >- this.constants = new int[length]; >- CaseStatement[] duplicateCaseStatements = null; >- int duplicateCaseStatementsCounter = 0; >+ if (!isStringSwitch) { >+ this.constants = new int[length]; >+ } else { >+ this.stringConstants = new String[length]; >+ } > int counter = 0; > for (int i = 0; i < length; i++) { > Constant constant; > final Statement statement = this.statements[i]; > if ((constant = statement.resolveCase(this.scope, expressionType, this)) != Constant.NotAConstant) { >- int key = constant.intValue(); >- //----check for duplicate case statement------------ >- for (int j = 0; j < counter; j++) { >- if (this.constants[j] == key) { >- final CaseStatement currentCaseStatement = (CaseStatement) statement; >- if (duplicateCaseStatements == null) { >- this.scope.problemReporter().duplicateCase(this.cases[j]); >- this.scope.problemReporter().duplicateCase(currentCaseStatement); >- duplicateCaseStatements = new CaseStatement[length]; >- duplicateCaseStatements[duplicateCaseStatementsCounter++] = this.cases[j]; >- duplicateCaseStatements[duplicateCaseStatementsCounter++] = currentCaseStatement; >- } else { >- boolean found = false; >- searchReportedDuplicate: for (int k = 2; k < duplicateCaseStatementsCounter; k++) { >- if (duplicateCaseStatements[k] == statement) { >- found = true; >- break searchReportedDuplicate; >- } >- } >- if (!found) { >- this.scope.problemReporter().duplicateCase(currentCaseStatement); >- duplicateCaseStatements[duplicateCaseStatementsCounter++] = currentCaseStatement; >- } >+ if (!isStringSwitch) { >+ int key = constant.intValue(); >+ //----check for duplicate case statement------------ >+ for (int j = 0; j < counter; j++) { >+ if (this.constants[j] == key) { >+ reportDuplicateCase((CaseStatement) statement, this.cases[j], length); >+ } >+ } >+ this.constants[counter++] = key; >+ } else { >+ String key = constant.stringValue(); >+ //----check for duplicate case statement------------ >+ for (int j = 0; j < counter; j++) { >+ if (this.stringConstants[j].equals(key)) { >+ reportDuplicateCase((CaseStatement) statement, this.cases[j], length); > } > } >+ this.stringConstants[counter++] = key; > } >- this.constants[counter++] = key; > } > } > if (length != counter) { // resize constants array >- System.arraycopy(this.constants, 0, this.constants = new int[counter], 0, counter); >+ if (!isStringSwitch) { >+ System.arraycopy(this.constants, 0, this.constants = new int[counter], 0, counter); >+ } else { >+ System.arraycopy(this.stringConstants, 0, this.stringConstants = new String[counter], 0, counter); >+ } > } > } else { > if ((this.bits & UndocumentedEmptyBlock) != 0) { > upperScope.problemReporter().undocumentedEmptyBlock(this.blockStart, this.sourceEnd); > } > } >+ if (isStringSwitch) { >+ this.dispatchStringCopy = new LocalVariableBinding(SecretStringVariableName, upperScope.getJavaLangString(), ClassFileConstants.AccDefault, false); >+ upperScope.addLocalVariable(this.dispatchStringCopy); >+ this.dispatchStringCopy.setConstant(Constant.NotAConstant); >+ this.dispatchStringCopy.useFlag = LocalVariableBinding.USED; >+ } > // for enum switch, check if all constants are accounted for (if no default) > if (isEnumSwitch && this.defaultCase == null > && upperScope.compilerOptions().getSeverity(CompilerOptions.IncompleteEnumSwitch) != ProblemSeverities.Ignore) { >@@ -366,6 +552,28 @@ > } > } > >+ private void reportDuplicateCase(final CaseStatement duplicate, final CaseStatement original, int length) { >+ if (this.duplicateCaseStatements == null) { >+ this.scope.problemReporter().duplicateCase(original); >+ this.scope.problemReporter().duplicateCase(duplicate); >+ this.duplicateCaseStatements = new CaseStatement[length]; >+ this.duplicateCaseStatements[this.duplicateCaseStatementsCounter++] = original; >+ this.duplicateCaseStatements[this.duplicateCaseStatementsCounter++] = duplicate; >+ } else { >+ boolean found = false; >+ searchReportedDuplicate: for (int k = 2; k < this.duplicateCaseStatementsCounter; k++) { >+ if (this.duplicateCaseStatements[k] == duplicate) { >+ found = true; >+ break searchReportedDuplicate; >+ } >+ } >+ if (!found) { >+ this.scope.problemReporter().duplicateCase(duplicate); >+ this.duplicateCaseStatements[this.duplicateCaseStatementsCounter++] = duplicate; >+ } >+ } >+ } >+ > public void traverse( > ASTVisitor visitor, > BlockScope blockScope) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java,v >retrieving revision 1.116 >diff -u -r1.116 TryStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 18 Dec 2010 22:09:26 -0000 1.116 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 20 Jan 2011 21:55:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -7,7 +7,6 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >- * Stephan Herrmann - Contribution for bug 332637 - Dead Code detection removing code that isn't dead > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >@@ -139,7 +138,9 @@ > } > > // catch var is always set >- LocalVariableBinding catchArg = this.catchArguments[i].binding; >+ Argument catchVariable = this.catchArguments[i]; >+ catchVariable.bits |= ASTNode.CatchVariable; >+ LocalVariableBinding catchArg = catchVariable.binding; > catchInfo.markAsDefinitelyAssigned(catchArg); > catchInfo.markAsDefinitelyNonNull(catchArg); > /* >@@ -235,7 +236,7 @@ > addPotentialInitializationsFrom(tryInfo). > addPotentialInitializationsFrom( > handlingContext.initsOnReturn)); >- }else { >+ } else { > FlowInfo initsOnException = handlingContext.initsOnException(this.caughtExceptionTypes[i]); > catchInfo = > flowInfo.nullInfoLessUnconditionalCopy() >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java,v >retrieving revision 1.165 >diff -u -r1.165 TypeDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 5 Jan 2011 19:57:26 -0000 1.165 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 20 Jan 2011 21:55:14 -0000 >@@ -892,7 +892,10 @@ > > 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 : >@@ -944,8 +947,6 @@ > return print(tab, output); > } > >- >- > public void resolve() { > SourceTypeBinding sourceType = this.binding; > if (sourceType == null) { >@@ -957,9 +958,23 @@ > 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; > } >+ > // check @Deprecated annotation > if ((sourceType.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0 > && (sourceType.modifiers & ClassFileConstants.AccDeprecated) != 0 >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java,v >retrieving revision 1.12 >diff -u -r1.12 TypeParameter.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java 7 Mar 2009 01:08:07 -0000 1.12 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java 20 Jan 2011 21:55:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -10,7 +10,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.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; >@@ -20,7 +24,7 @@ > > public class TypeParameter extends AbstractVariableDeclaration { > >- public TypeVariableBinding binding; >+ public TypeVariableBinding binding; > public TypeReference[] bounds; > > /** >@@ -42,8 +46,38 @@ > } > } > >+ 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 >+ // detect variable/type name collisions > if (this.binding != null) { > Binding existingType = scope.parent.getBinding(this.name, Binding.TYPE, this, false/*do not resolve hidden field*/); > if (existingType != null >@@ -63,10 +97,27 @@ > 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$ >@@ -82,11 +133,16 @@ > } > > public void generateCode(BlockScope currentScope, CodeStream codeStream) { >- // nothing to do >+ // nothing to do > } > > 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 +158,11 @@ > > 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); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java,v >retrieving revision 1.44 >diff -u -r1.44 TypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java 18 Mar 2010 16:22:38 -0000 1.44 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java 20 Jan 2011 21:55:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -10,14 +10,21 @@ > *******************************************************************************/ > 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,11 +35,209 @@ > import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; > > public abstract class TypeReference extends Expression { >+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.CatchVariable) == 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.CatchVariable) == 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) { >@@ -58,26 +263,29 @@ > } > 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 >@@ -89,9 +297,57 @@ > // 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(); > >@@ -158,6 +414,15 @@ > && 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; >@@ -168,6 +433,9 @@ > return true; > } > >+public boolean isParameterizedTypeReference() { >+ return false; >+} > protected void reportDeprecatedType(TypeBinding type, Scope scope, int index) { > scope.problemReporter().deprecatedType(type, this, index); > } >@@ -208,13 +476,13 @@ > } > > public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) { >- return resolveType(blockScope, true /* check bounds*/); >+ return resolveType(blockScope, true /* check bounds*/); > } > > public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) { > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057, circularity is allowed when we are >- // resolving type arguments i.e interface A<T extends C> {} interface B extends A<D> {} >- // interface D extends C {} interface C extends B {} >+ // resolving type arguments i.e interface A<T extends C> {} interface B extends A<D> {} >+ // interface D extends C {} interface C extends B {} > ReferenceBinding ref = classScope.referenceContext.binding; > boolean pauseHierarchyCheck = false; > try { >@@ -222,7 +490,7 @@ > ref.tagBits |= TagBits.PauseHierarchyCheck; > pauseHierarchyCheck = true; > } >- return resolveType(classScope); >+ return resolveType(classScope); > } finally { > if (pauseHierarchyCheck) { > ref.tagBits &= ~TagBits.PauseHierarchyCheck; >@@ -233,4 +501,10 @@ > 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)); >+ } >+} > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java,v >retrieving revision 1.12 >diff -u -r1.12 Wildcard.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java 7 Mar 2009 01:08:07 -0000 1.12 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java 20 Jan 2011 21:55:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -59,7 +59,7 @@ > 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 +89,7 @@ > 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 +97,7 @@ > public TypeBinding resolveType(ClassScope scope) { > if (this.bound != null) { > this.bound.resolveType(scope); >+ this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations); > } > return null; > } >@@ -104,7 +106,7 @@ > } > > public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) { >- return internalResolveType(classScope, genericType, rank); >+ return internalResolveType(classScope, genericType, rank); > } > > public void traverse(ASTVisitor visitor, BlockScope scope) { >Index: compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java,v >retrieving revision 1.23 >diff -u -r1.23 ClassFileConstants.java >--- compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java 27 Jun 2008 16:04:13 -0000 1.23 >+++ compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java 20 Jan 2011 21:55:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -120,4 +120,5 @@ > 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; // annotation type annotation (jsr 308) > } >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java >=================================================================== >RCS file: compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java >diff -N compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * 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$ >+ } >+} >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java >=================================================================== >RCS file: compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java >diff -N compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,50 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * 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; >+} >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java,v >retrieving revision 1.20 >diff -u -r1.20 AttributeNamesConstants.java >--- compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java 27 May 2008 22:21:14 -0000 1.20 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java 20 Jan 2011 21:55:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -33,4 +33,7 @@ > final char[] VarargsName = "Varargs".toCharArray(); //$NON-NLS-1$ > final char[] StackMapName = "StackMap".toCharArray(); //$NON-NLS-1$ > final char[] MissingTypesName = "MissingTypes".toCharArray(); //$NON-NLS-1$ >+ // jsr308 >+ final char[] RuntimeVisibleTypeAnnotationsName = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$ >+ final char[] RuntimeInvisibleTypeAnnotationsName = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$ > } >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java,v >retrieving revision 1.180 >diff -u -r1.180 CodeStream.java >--- compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 5 Jan 2011 19:57:26 -0000 1.180 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 20 Jan 2011 21:55:18 -0000 >@@ -17,11 +17,13 @@ > import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; > import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; >+import org.eclipse.jdt.internal.compiler.ast.Annotation; > import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall; > import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; > import org.eclipse.jdt.internal.compiler.ast.OperatorIds; > import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >@@ -631,8 +633,10 @@ > writeUnsignedShort(this.constantPool.literalIndexForType(ConstantPool.JavaLangBooleanConstantPoolName)); > } > } >- > public void checkcast(TypeBinding typeBinding) { >+ this.checkcast(null, typeBinding); >+} >+public void checkcast(TypeReference typeReference, TypeBinding typeBinding) { > this.countLabels = 0; > if (this.classFileOffset + 2 >= this.bCodeStream.length) { > resizeByteArray(); >@@ -641,7 +645,6 @@ > this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_checkcast; > writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding)); > } >- > public void d2f() { > this.countLabels = 0; > this.stackDepth--; >@@ -1690,11 +1693,13 @@ > } > } > } >- >+public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) { >+ this.generateClassLiteralAccessForType(null, accessedType, syntheticFieldBinding); >+} > /** > * Macro for building a class descriptor object > */ >-public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) { >+public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) { > if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) { > getTYPE(accessedType.id); > return; >@@ -1847,7 +1852,7 @@ > invokeClassForName(); > int paramLength = methodBinding.parameters.length; > this.generateInlinedValue(paramLength); >- newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1)); >+ newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1)); > if (paramLength > 0) { > dup(); > for (int i = 0; i < paramLength; i++) { >@@ -1903,7 +1908,7 @@ > this.ldc(String.valueOf(methodBinding.selector)); > int paramLength = methodBinding.parameters.length; > this.generateInlinedValue(paramLength); >- newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1)); >+ newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1)); > if (paramLength > 0) { > dup(); > for (int i = 0; i < paramLength; i++) { >@@ -2413,7 +2418,7 @@ > public void generateSyntheticBodyForEnumValueOf(SyntheticMethodBinding methodBinding) { > initializeMaxLocals(methodBinding); > final ReferenceBinding declaringClass = methodBinding.declaringClass; >- generateClassLiteralAccessForType(declaringClass, null); >+ generateClassLiteralAccessForType(null, declaringClass, null); > aload_0(); > invokeJavaLangEnumvalueOf(declaringClass); > this.checkcast(declaringClass); >@@ -2439,7 +2444,7 @@ > arraylength(); > dup(); > istore_1(); >- newArray((ArrayBinding) enumArray); >+ newArray(null, (ArrayBinding) enumArray); > dup(); > astore_2(); > iconst_0(); >@@ -3810,12 +3815,14 @@ > } > return (chaining & (L_OPTIMIZABLE|L_CANNOT_OPTIMIZE)) == L_OPTIMIZABLE; // check was some standards, and no case/recursive > } >- >+public void instance_of(TypeBinding typeBinding) { >+ this.instance_of(null, typeBinding); >+} > /** > * We didn't call it instanceof because there is a conflit with the > * instanceof keyword > */ >-public void instance_of(TypeBinding typeBinding) { >+public void instance_of(TypeReference typeReference, TypeBinding typeBinding) { > this.countLabels = 0; > if (this.classFileOffset + 2 >= this.bCodeStream.length) { > resizeByteArray(); >@@ -3853,8 +3860,7 @@ > this.stackMax = this.stackDepth; > } > } >- >-public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) { >+public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass, TypeReference[] typeArguments) { > if (declaringClass == null) declaringClass = methodBinding.declaringClass; > if ((declaringClass.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { > Util.recordNestedType(this.classFile, declaringClass); >@@ -3888,7 +3894,7 @@ > default: > receiverAndArgsSize++; > break; >- } >+ } > } > } > } >@@ -3935,6 +3941,9 @@ > methodBinding.selector, > methodBinding.signature(this.classFile)); > } >+public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) { >+ this.invoke(opcode, methodBinding, declaringClass, null); >+} > > protected void invokeAccessibleObjectSetAccessible() { > // invokevirtual: java.lang.reflect.AccessibleObject.setAccessible(Z)V; >@@ -4488,6 +4497,28 @@ > ConstantPool.InternSignature); > } > >+public void invokeStringHashCode() { >+ // invokevirtual: java.lang.String.hashCode() >+ invoke( >+ Opcodes.OPC_invokevirtual, >+ 1, // receiverAndArgsSize >+ 1, // return type size >+ ConstantPool.JavaLangStringConstantPoolName, >+ ConstantPool.HashCode, >+ ConstantPool.HashCodeSignature); >+} >+ >+public void invokeStringEquals() { >+ // invokevirtual: java.lang.String.equals() >+ invoke( >+ Opcodes.OPC_invokevirtual, >+ 2, // receiverAndArgsSize >+ 1, // return type size >+ ConstantPool.JavaLangStringConstantPoolName, >+ ConstantPool.Equals, >+ ConstantPool.EqualsSignature); >+} >+ > public void invokeStringValueOf(int typeID) { > // invokestatic: java.lang.String.valueOf(argumentType) > char[] signature; >@@ -5523,8 +5554,14 @@ > this.position++; > this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_monitorexit; > } >- > public void multianewarray(TypeBinding typeBinding, int dimensions) { >+ this.multianewarray(null, typeBinding, dimensions, null); >+} >+public void multianewarray( >+ TypeReference typeReference, >+ TypeBinding typeBinding, >+ int dimensions, >+ Annotation [][] annotationsOnDimensions) { > this.countLabels = 0; > this.stackDepth += (1 - dimensions); > if (this.classFileOffset + 3 >= this.bCodeStream.length) { >@@ -5535,9 +5572,11 @@ > writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding)); > this.bCodeStream[this.classFileOffset++] = (byte) dimensions; > } >- >-// We didn't call it new, because there is a conflit with the new keyword > public void new_(TypeBinding typeBinding) { >+ this.new_(null, typeBinding); >+} >+// We didn't call it new, because there is a conflit with the new keyword >+public void new_(TypeReference typeReference, TypeBinding typeBinding) { > this.countLabels = 0; > this.stackDepth++; > if (this.stackDepth > this.stackMax) >@@ -5559,8 +5598,10 @@ > this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_newarray; > this.bCodeStream[this.classFileOffset++] = (byte) array_Type; > } >- > public void newArray(ArrayBinding arrayBinding) { >+ this.newArray(null, arrayBinding); >+} >+public void newArray(TypeReference typeReference, ArrayBinding arrayBinding) { > TypeBinding component = arrayBinding.elementsType(); > switch (component.id) { > case TypeIds.T_int : >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java,v >retrieving revision 1.61 >diff -u -r1.61 ConstantPool.java >--- compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java 12 May 2009 20:49:56 -0000 1.61 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java 20 Jan 2011 21:55:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -126,6 +126,10 @@ > public static final char[] ITERATOR_SIGNATURE = "()Ljava/util/Iterator;".toCharArray(); //$NON-NLS-1$ > public static final char[] Intern = "intern".toCharArray(); //$NON-NLS-1$ > public static final char[] InternSignature = GetMessageSignature; >+ public static final char[] HashCode = "hashCode".toCharArray(); //$NON-NLS-1$ >+ public static final char[] HashCodeSignature = "()I".toCharArray(); //$NON-NLS-1$; >+ public static final char[] Equals = "equals".toCharArray(); //$NON-NLS-1$ >+ public static final char[] EqualsSignature = "(Ljava/lang/Object;)Z".toCharArray(); //$NON-NLS-1$; > public static final char[] IntIntegerSignature = "(I)Ljava/lang/Integer;".toCharArray(); //$NON-NLS-1$ > public static final char[] INTVALUE_INTEGER_METHOD_NAME = "intValue".toCharArray(); //$NON-NLS-1$ > public static final char[] INTVALUE_INTEGER_METHOD_SIGNATURE = "()I".toCharArray(); //$NON-NLS-1$ >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java,v >retrieving revision 1.29 >diff -u -r1.29 StackMapFrameCodeStream.java >--- compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java 9 Nov 2010 19:59:19 -0000 1.29 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java 20 Jan 2011 21:55:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2010 IBM Corporation and others. >+ * Copyright (c) 2006, 2011 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 >@@ -19,6 +19,7 @@ > > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.compiler.ClassFile; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; > import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; >@@ -260,7 +261,7 @@ > /** > * Macro for building a class descriptor object > */ >-public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) { >+public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) { > if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) { > getTYPE(accessedType.id); > return; >Index: compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java >=================================================================== >RCS file: compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java >diff -N compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,112 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.compiler.codegen; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.jdt.internal.compiler.ClassFile; >+import org.eclipse.jdt.internal.compiler.ast.ASTNode; >+import org.eclipse.jdt.internal.compiler.ast.Annotation; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; >+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; >+import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; >+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; >+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; >+ >+public class TypeAnnotationCodeStream extends StackMapFrameCodeStream { >+ public List allTypeAnnotationContexts; >+ >+ public TypeAnnotationCodeStream(ClassFile givenClassFile) { >+ super(givenClassFile); >+ this.generateAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION; >+ this.allTypeAnnotationContexts = new ArrayList(); >+ } >+ private void addAnnotationContext(TypeReference typeReference, int info, int targetType, Annotation[][] annotationsOnDimensions) { >+// if (this.allTypeAnnotationContexts == null) { >+// this.allTypeAnnotationContexts = new ArrayList(); >+// } >+ typeReference.getAllAnnotationContexts(targetType, info, this.allTypeAnnotationContexts, annotationsOnDimensions); >+ } >+ private void addAnnotationContext(TypeReference typeReference, int info, int targetType) { >+// if (this.allTypeAnnotationContexts == null) { >+// this.allTypeAnnotationContexts = new ArrayList(); >+// } >+ typeReference.getAllAnnotationContexts(targetType, info, this.allTypeAnnotationContexts); >+ } >+ private void addAnnotationContext(TypeReference typeReference, int info, int typeIndex, int targetType) { >+// if (this.allTypeAnnotationContexts == null) { >+// this.allTypeAnnotationContexts = new ArrayList(); >+// } >+ typeReference.getAllAnnotationContexts(targetType, info, typeIndex, this.allTypeAnnotationContexts); >+ } >+ public void instance_of(TypeReference typeReference, TypeBinding typeBinding) { >+ if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) { >+ addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.TYPE_INSTANCEOF); >+ } >+ super.instance_of(typeReference, typeBinding); >+ } >+ public void multianewarray( >+ TypeReference typeReference, >+ TypeBinding typeBinding, >+ int dimensions, >+ Annotation [][] annotationsOnDimensions) { >+ if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) { >+ addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION, annotationsOnDimensions); >+ } >+ super.multianewarray(typeReference, typeBinding, dimensions, annotationsOnDimensions); >+ } >+ public void new_(TypeReference typeReference, TypeBinding typeBinding) { >+ if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) { >+ addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION); >+ } >+ super.new_(typeReference, typeBinding); >+ } >+ public void newArray(TypeReference typeReference, ArrayBinding arrayBinding) { >+ if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) { >+ addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION); >+ } >+ super.newArray(typeReference, arrayBinding); >+ } >+ public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) { >+ if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) { >+ addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.CLASS_LITERAL); >+ } >+ super.generateClassLiteralAccessForType(typeReference, accessedType, syntheticFieldBinding); >+ } >+ public void checkcast(TypeReference typeReference, TypeBinding typeBinding) { >+ if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) { >+ addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.TYPE_CAST); >+ } >+ super.checkcast(typeReference, typeBinding); >+ } >+ public void reset(ClassFile givenClassFile) { >+ super.reset(givenClassFile); >+ this.allTypeAnnotationContexts = new ArrayList(); >+ } >+ public void init(ClassFile targetClassFile) { >+ super.init(targetClassFile); >+ this.allTypeAnnotationContexts = new ArrayList(); >+ } >+ public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass, TypeReference[] typeArguments) { >+ if (typeArguments != null) { >+ int targetType = methodBinding.isConstructor() >+ ? AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL >+ : AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL; >+ for (int i = 0, max = typeArguments.length; i < max; i++) { >+ TypeReference typeArgument = typeArguments[i]; >+ addAnnotationContext(typeArgument, this.position, i, targetType); >+ } >+ } >+ super.invoke(opcode, methodBinding, declaringClass, typeArguments); >+ } >+} >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v >retrieving revision 1.136 >diff -u -r1.136 BinaryTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 17 Jan 2011 13:00:56 -0000 1.136 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 20 Jan 2011 21:55:19 -0000 >@@ -178,7 +178,7 @@ > // attempt to find the enclosing type if it exists in the cache (otherwise - resolve it when requested) > this.enclosingType = environment.getTypeFromConstantPoolName(enclosingTypeName, 0, -1, true, null /* could not be missing */); // pretend parameterized to avoid raw > this.tagBits |= TagBits.MemberTypeMask; // must be a member type not a top-level or local type >- this.tagBits |= TagBits.HasUnresolvedEnclosingType; >+ this.tagBits |= TagBits.HasUnresolvedEnclosingType; > if (enclosingType().isStrictfp()) > this.modifiers |= ClassFileConstants.AccStrictfp; > if (enclosingType().isDeprecated()) >@@ -286,7 +286,7 @@ > for (int i = 0; i < size; i++) > // attempt to find each member type if it exists in the cache (otherwise - resolve it when requested) > this.memberTypes[i] = this.environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1, false, null /* could not be missing */); >- this.tagBits |= TagBits.HasUnresolvedMemberTypes; >+ this.tagBits |= TagBits.HasUnresolvedMemberTypes; > } > } > >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java,v >retrieving revision 1.38 >diff -u -r1.38 Binding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java 14 Jan 2011 17:02:24 -0000 1.38 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java 20 Jan 2011 21:55:19 -0000 >@@ -30,6 +30,8 @@ > 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]; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java,v >retrieving revision 1.49 >diff -u -r1.49 LocalVariableBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java 17 Dec 2010 06:40:13 -0000 1.49 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java 20 Jan 2011 21:55:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -41,6 +41,7 @@ > public LocalVariableBinding(char[] name, TypeBinding type, int modifiers, boolean isArgument) { > super(name, type, modifiers, isArgument ? Constant.NotAConstant : null); > if (isArgument) this.tagBits |= TagBits.IsArgument; >+ this.tagBits &= ~TagBits.ForcedToBeRawType; > } > > // regular local variable or argument >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.380 >diff -u -r1.380 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 3 Dec 2010 08:44:28 -0000 1.380 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 20 Jan 2011 21:55:20 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -719,6 +719,25 @@ > 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 |= (typeParameter.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 |= (typeParameter.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]; >@@ -947,8 +966,8 @@ > isSuperAccess(); this is used to determine if the discovered field is visible. > Only fields defined by the receiverType or its supertypes are answered; > a field of an enclosing type will not be found using this API. >- If no visible field is discovered, null is answered. >- */ >+ If no visible field is discovered, null is answered. >+ */ > public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) { > return findField(receiverType, fieldName, invocationSite, needResolve, false); > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v >retrieving revision 1.186 >diff -u -r1.186 SourceTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 16 Jan 2011 22:43:21 -0000 1.186 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 20 Jan 2011 21:55:21 -0000 >@@ -1329,10 +1329,6 @@ > if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0) > return method; > >- if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { >- if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0) >- method.modifiers |= ClassFileConstants.AccDeprecated; >- } > if (isViewedAsDeprecated() && !method.isDeprecated()) > method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; > if (hasRestrictedAccess()) >@@ -1464,6 +1460,10 @@ > } > } > } >+ if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { >+ if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0) >+ method.modifiers |= ClassFileConstants.AccDeprecated; >+ } > if (foundArgProblem) { > methodDecl.binding = null; > method.parameters = Binding.NO_PARAMETERS; // see 107004 >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java,v >retrieving revision 1.47 >diff -u -r1.47 TagBits.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 16 Jan 2011 22:43:21 -0000 1.47 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 20 Jan 2011 21:55:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -103,11 +103,14 @@ > 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; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java,v >retrieving revision 1.51 >diff -u -r1.51 TypeConstants.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 5 Jan 2011 19:57:26 -0000 1.51 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 20 Jan 2011 21:55:21 -0000 >@@ -40,14 +40,14 @@ > char[] CharArray_JAVA_IO_OBJECTSTREAMFIELD = "java.io.ObjectStreamField".toCharArray(); //$NON-NLS-1$ > char[] ANONYM_PREFIX = "new ".toCharArray(); //$NON-NLS-1$ > char[] ANONYM_SUFFIX = "(){}".toCharArray(); //$NON-NLS-1$ >- char[] WILDCARD_NAME = { '?' }; >- char[] WILDCARD_SUPER = " super ".toCharArray(); //$NON-NLS-1$ >- char[] WILDCARD_EXTENDS = " extends ".toCharArray(); //$NON-NLS-1$ >- char[] WILDCARD_MINUS = { '-' }; >- char[] WILDCARD_STAR = { '*' }; >- char[] WILDCARD_PLUS = { '+' }; >- char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture#".toCharArray(); //$NON-NLS-1$ >- char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$ >+ char[] WILDCARD_NAME = { '?' }; >+ char[] WILDCARD_SUPER = " super ".toCharArray(); //$NON-NLS-1$ >+ char[] WILDCARD_EXTENDS = " extends ".toCharArray(); //$NON-NLS-1$ >+ char[] WILDCARD_MINUS = { '-' }; >+ char[] WILDCARD_STAR = { '*' }; >+ char[] WILDCARD_PLUS = { '+' }; >+ char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture#".toCharArray(); //$NON-NLS-1$ >+ char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$ > char[] WILDCARD_CAPTURE = { '!' }; > char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$ > char[] SHORT = "short".toCharArray(); //$NON-NLS-1$ >@@ -59,22 +59,25 @@ > char[] BOOLEAN = "boolean".toCharArray(); //$NON-NLS-1$ > char[] NULL = "null".toCharArray(); //$NON-NLS-1$ > char[] VOID = "void".toCharArray(); //$NON-NLS-1$ >- char[] VALUE = "value".toCharArray(); //$NON-NLS-1$ >- char[] VALUES = "values".toCharArray(); //$NON-NLS-1$ >- char[] VALUEOF = "valueOf".toCharArray(); //$NON-NLS-1$ >- char[] UPPER_SOURCE = "SOURCE".toCharArray(); //$NON-NLS-1$ >- char[] UPPER_CLASS = "CLASS".toCharArray(); //$NON-NLS-1$ >- char[] UPPER_RUNTIME = "RUNTIME".toCharArray(); //$NON-NLS-1$ >+ char[] VALUE = "value".toCharArray(); //$NON-NLS-1$ >+ char[] VALUES = "values".toCharArray(); //$NON-NLS-1$ >+ char[] VALUEOF = "valueOf".toCharArray(); //$NON-NLS-1$ >+ char[] UPPER_SOURCE = "SOURCE".toCharArray(); //$NON-NLS-1$ >+ char[] UPPER_CLASS = "CLASS".toCharArray(); //$NON-NLS-1$ >+ char[] UPPER_RUNTIME = "RUNTIME".toCharArray(); //$NON-NLS-1$ > char[] ANNOTATION_PREFIX = "@".toCharArray(); //$NON-NLS-1$ > char[] ANNOTATION_SUFFIX = "()".toCharArray(); //$NON-NLS-1$ >- char[] TYPE = "TYPE".toCharArray(); //$NON-NLS-1$ >- char[] UPPER_FIELD = "FIELD".toCharArray(); //$NON-NLS-1$ >- char[] UPPER_METHOD = "METHOD".toCharArray(); //$NON-NLS-1$ >- char[] UPPER_PARAMETER = "PARAMETER".toCharArray(); //$NON-NLS-1$ >- char[] UPPER_CONSTRUCTOR = "CONSTRUCTOR".toCharArray(); //$NON-NLS-1$ >- 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$ >+ char[] TYPE = "TYPE".toCharArray(); //$NON-NLS-1$ >+ char[] UPPER_FIELD = "FIELD".toCharArray(); //$NON-NLS-1$ >+ char[] UPPER_METHOD = "METHOD".toCharArray(); //$NON-NLS-1$ >+ char[] UPPER_PARAMETER = "PARAMETER".toCharArray(); //$NON-NLS-1$ >+ char[] UPPER_CONSTRUCTOR = "CONSTRUCTOR".toCharArray(); //$NON-NLS-1$ >+ 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}; >@@ -136,9 +139,9 @@ > }; > > // Constraints for generic type argument inference >- int CONSTRAINT_EQUAL = 0; // Actual = Formal >- int CONSTRAINT_EXTENDS = 1; // Actual << Formal >- int CONSTRAINT_SUPER = 2; // Actual >> Formal >+ int CONSTRAINT_EQUAL = 0; // Actual = Formal >+ int CONSTRAINT_EXTENDS = 1; // Actual << Formal >+ int CONSTRAINT_SUPER = 2; // Actual >> Formal > > // Constants used to perform bound checks > int OK = 0; >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.422 >diff -u -r1.422 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 5 Jan 2011 19:57:26 -0000 1.422 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 20 Jan 2011 21:55:24 -0000 >@@ -11,7 +11,12 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.parser; > >-import java.io.*; >+import java.io.BufferedInputStream; >+import java.io.BufferedWriter; >+import java.io.File; >+import java.io.FileWriter; >+import java.io.IOException; >+import java.io.InputStream; > import java.util.ArrayList; > import java.util.Collections; > import java.util.Iterator; >@@ -24,14 +29,102 @@ > import org.eclipse.jdt.core.compiler.InvalidInputException; > 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.ast.AND_AND_Expression; >+import org.eclipse.jdt.internal.compiler.ast.ASTNode; >+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; >+import org.eclipse.jdt.internal.compiler.ast.Annotation; >+import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.Argument; >+import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression; >+import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer; >+import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.ArrayReference; >+import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.AssertStatement; >+import org.eclipse.jdt.internal.compiler.ast.Assignment; >+import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; >+import org.eclipse.jdt.internal.compiler.ast.Block; >+import org.eclipse.jdt.internal.compiler.ast.BreakStatement; >+import org.eclipse.jdt.internal.compiler.ast.CaseStatement; >+import org.eclipse.jdt.internal.compiler.ast.CastExpression; >+import org.eclipse.jdt.internal.compiler.ast.CharLiteral; >+import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; >+import org.eclipse.jdt.internal.compiler.ast.CombinedBinaryExpression; >+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment; >+import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression; >+import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.ContinueStatement; >+import org.eclipse.jdt.internal.compiler.ast.DoStatement; >+import org.eclipse.jdt.internal.compiler.ast.DoubleLiteral; >+import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; >+import org.eclipse.jdt.internal.compiler.ast.EqualExpression; >+import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall; >+import org.eclipse.jdt.internal.compiler.ast.Expression; >+import org.eclipse.jdt.internal.compiler.ast.FalseLiteral; >+import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.FieldReference; >+import org.eclipse.jdt.internal.compiler.ast.FloatLiteral; >+import org.eclipse.jdt.internal.compiler.ast.ForStatement; >+import org.eclipse.jdt.internal.compiler.ast.ForeachStatement; >+import org.eclipse.jdt.internal.compiler.ast.IfStatement; >+import org.eclipse.jdt.internal.compiler.ast.ImportReference; >+import org.eclipse.jdt.internal.compiler.ast.Initializer; >+import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; >+import org.eclipse.jdt.internal.compiler.ast.IntLiteral; >+import org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue; >+import org.eclipse.jdt.internal.compiler.ast.Javadoc; >+import org.eclipse.jdt.internal.compiler.ast.LabeledStatement; >+import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.LongLiteral; >+import org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue; >+import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation; >+import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; >+import org.eclipse.jdt.internal.compiler.ast.MessageSend; >+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.NameReference; >+import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation; >+import org.eclipse.jdt.internal.compiler.ast.NullLiteral; >+import org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression; >+import org.eclipse.jdt.internal.compiler.ast.OperatorIds; >+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.PostfixExpression; >+import org.eclipse.jdt.internal.compiler.ast.PrefixExpression; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.Reference; >+import org.eclipse.jdt.internal.compiler.ast.ReturnStatement; >+import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation; >+import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; >+import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.Statement; >+import org.eclipse.jdt.internal.compiler.ast.StringLiteral; >+import org.eclipse.jdt.internal.compiler.ast.SuperReference; >+import org.eclipse.jdt.internal.compiler.ast.SwitchStatement; >+import org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement; >+import org.eclipse.jdt.internal.compiler.ast.ThisReference; >+import org.eclipse.jdt.internal.compiler.ast.ThrowStatement; >+import org.eclipse.jdt.internal.compiler.ast.TrueLiteral; >+import org.eclipse.jdt.internal.compiler.ast.TryStatement; >+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.TypeParameter; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; >+import org.eclipse.jdt.internal.compiler.ast.UnaryExpression; >+import org.eclipse.jdt.internal.compiler.ast.WhileStatement; >+import org.eclipse.jdt.internal.compiler.ast.Wildcard; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; >+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.Binding; > import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; > import org.eclipse.jdt.internal.compiler.lookup.MethodScope; > import org.eclipse.jdt.internal.compiler.lookup.TypeIds; >@@ -64,11 +157,14 @@ > private static final String ERROR_TOKEN = "$error" ; //$NON-NLS-1$ > //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$ >- public static char in_symb[] = null; >+ public static char in_symb[] = null; > private static final String INVALID_CHARACTER = "Invalid Character" ; //$NON-NLS-1$ > public static char lhs[] = null; > >@@ -786,7 +882,25 @@ > 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]; >@@ -877,6 +991,7 @@ > initializeScanner(); > 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]; >@@ -1194,6 +1309,7 @@ > } > } > 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) { >@@ -1249,7 +1365,19 @@ > 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]++; >@@ -1592,8 +1720,6 @@ > 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( >@@ -1602,6 +1728,14 @@ > 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; >@@ -1616,8 +1750,6 @@ > > 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( >@@ -1626,6 +1758,13 @@ > 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; >@@ -2021,7 +2160,7 @@ > 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 >@@ -2031,41 +2170,165 @@ > this.expressionStack[this.expressionPtr] = > cast = new CastExpression( > exp=this.expressionStack[this.expressionPtr+1] , >- this.expressionStack[this.expressionPtr]); >+ (TypeReference) this.expressionStack[this.expressionPtr]); > this.expressionLengthPtr -- ; > 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 > >- Expression exp, cast, castType; >+ Expression exp, cast; >+ TypeReference castType; > int end = this.intStack[this.intPtr--]; > > int dim = this.intStack[this.intPtr--]; > pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); > >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(dim)); >+ this.expressionStack[this.expressionPtr] = cast = >+ new CastExpression( >+ exp = this.expressionStack[this.expressionPtr], >+ castType = getTypeReference(dim)); > this.intPtr--; > castType.sourceEnd = end - 1; > 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 > >- Expression exp, cast, castType; >+ Expression exp; >+ Expression cast; >+ TypeReference castType; > int end = this.intStack[this.intPtr--]; > > // handle type arguments > pushOnGenericsLengthStack(0); > pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); > >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(this.intStack[this.intPtr--])); >+ this.expressionStack[this.expressionPtr] = cast = >+ new CastExpression( >+ exp = this.expressionStack[this.expressionPtr], >+ castType = getTypeReference(this.intStack[this.intPtr--])); > castType.sourceEnd = end - 1; > 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 > >@@ -2073,28 +2336,114 @@ > > //optimize the push/pop > >- Expression exp, cast, castType; >+ Expression exp; >+ Expression cast; >+ TypeReference castType; > int end = this.intStack[this.intPtr--]; >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(this.intStack[this.intPtr--])); >+ this.expressionStack[this.expressionPtr] = cast = >+ new CastExpression( >+ exp = this.expressionStack[this.expressionPtr], >+ castType = getTypeReference(this.intStack[this.intPtr--])); > castType.sourceEnd = end - 1; > 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, cast, castType; >+ Expression exp; >+ Expression cast; >+ TypeReference castType; > 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--; >- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = qualifiedParameterizedTypeReference); >+ this.expressionStack[this.expressionPtr] = cast = >+ new CastExpression( >+ exp = this.expressionStack[this.expressionPtr], >+ castType = qualifiedParameterizedTypeReference); > castType.sourceEnd = end - 1; > 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(); >@@ -2228,6 +2577,7 @@ > 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; >@@ -2249,8 +2599,11 @@ > 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 >@@ -2581,9 +2934,11 @@ > } > } > >- 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(); >+ } > } > } > >@@ -2616,6 +2971,19 @@ > > AbstractMethodDeclaration method = (AbstractMethodDeclaration)this.astStack[this.astPtr]; > >+ // jsr308 -- consume receiver annotations >+ method.receiverAnnotations = null; >+ int length; >+ if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.typeAnnotationStack, >+ (this.typeAnnotationPtr -= length) + 1, >+ method.receiverAnnotations = new Annotation[length], >+ 0, >+ length); >+ method.bits |= ASTNode.HasTypeAnnotations; >+ } >+ > if (this.currentToken == TokenNameLBRACE){ > method.bodyStart = this.scanner.currentPosition; > } >@@ -2774,8 +3142,10 @@ > pushOnIntStack(this.dimensions); > this.dimensions = 0; > } >+ > protected void consumeDimWithOrWithOutExpr() { >- // DimWithOrWithOutExpr ::= '[' ']' >+ // DimWithOrWithOutExpr ::= '[' ']' >+ // DimWithOrWithOutExpr ::= OneOrMoreAnnotations '[' ']' > pushOnExpressionStack(null); > > if(this.currentElement != null && this.currentToken == TokenNameLBRACE) { >@@ -2976,6 +3346,7 @@ > localDeclaration.annotations = new Annotation[length], > 0, > length); >+ localDeclaration.bits |= ASTNode.HasTypeAnnotations; > } > if (hasModifiers) { > localDeclaration.declarationSourceStart = declarationSourceStart; >@@ -2984,6 +3355,7 @@ > localDeclaration.declarationSourceStart = type.sourceStart; > } > localDeclaration.type = type; >+ localDeclaration.bits |= (type.bits & ASTNode.HasTypeAnnotations); > > ForeachStatement iteratorForStatement = > new ForeachStatement( >@@ -3073,6 +3445,8 @@ > 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; >@@ -3105,6 +3479,7 @@ > declaration.annotations = new Annotation[length], > 0, > length); >+ declaration.bits |= ASTNode.HasTypeAnnotations; > } > type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension > if (declaration.declarationSourceStart == -1) { >@@ -3126,6 +3501,7 @@ > 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; >@@ -3143,14 +3519,22 @@ > 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); >@@ -3177,6 +3561,30 @@ > 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 >@@ -3277,16 +3685,17 @@ > enumConstant.declarationSourceStart = enumConstant.modifiersSourceStart; > > // consume annotations >- int length; >- if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { >- System.arraycopy( >- this.expressionStack, >- (this.expressionPtr -= length) + 1, >- enumConstant.annotations = new Annotation[length], >- 0, >- length); >- } >- pushOnAstStack(enumConstant); >+ int length; >+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ enumConstant.annotations = new Annotation[length], >+ 0, >+ length); >+ enumConstant.bits |= ASTNode.HasTypeAnnotations; >+ } >+ pushOnAstStack(enumConstant); > if (this.currentElement != null){ > this.lastCheckPoint = enumConstant.sourceEnd + 1; > this.currentElement = this.currentElement.add(enumConstant, 0); >@@ -3793,10 +4202,32 @@ > 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; > } >@@ -3811,8 +4242,9 @@ > 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, >@@ -3820,6 +4252,7 @@ > arg.annotations = new Annotation[length], > 0, > length); >+ arg.bits |= ASTNode.HasTypeAnnotations; > } > pushOnAstStack(arg); > >@@ -3836,8 +4269,38 @@ > 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 > optimizedConcatNodeLists(); >@@ -3848,15 +4311,15 @@ > } > protected void consumeGenericType() { > // nothing to do >- // Will be consume by a getTypeRefence call >+ // Will be consume by a getTypeReference call > } > protected void consumeGenericTypeArrayType() { > // nothing to do >- // Will be consume by a getTypeRefence call >+ // Will be consume by a getTypeReference call > } > protected void consumeGenericTypeNameArrayType() { > // nothing to do >- // Will be consume by a getTypeRefence call >+ // Will be consume by a getTypeReference call > } > protected void consumeImportDeclaration() { > // SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';' >@@ -3891,6 +4354,9 @@ > protected void consumeInsideCastExpressionWithQualifiedGenerics() { > // InsideCastExpressionWithQualifiedGenerics ::= $empty > } >+protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() { >+ // InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty >+} > protected void consumeInstanceOfExpression() { > // RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType > //optimize the push/pop >@@ -3987,8 +4453,11 @@ > 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 >@@ -4348,8 +4817,10 @@ > 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, >@@ -4357,9 +4828,6 @@ > 0, > length); > } >- } else { >- length = this.astLengthStack[this.astLengthPtr--]; >- this.astPtr -= length; > } > } > >@@ -4444,6 +4912,18 @@ > // MethodHeaderExtendedDims ::= Dimsopt > // now we update the returnType of the method > MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr]; >+ // jsr308 -- consume receiver annotations >+ md.receiverAnnotations = null; >+ int length; >+ if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.typeAnnotationStack, >+ (this.typeAnnotationPtr -= length) + 1, >+ md.receiverAnnotations = new Annotation[length], >+ 0, >+ length); >+ md.bits |= ASTNode.HasTypeAnnotations; >+ } > int extendedDims = this.intStack[this.intPtr--]; > if(md.isAnnotationMethod()) { > ((AnnotationMethodDeclaration)md).extendedDimensions = extendedDims; >@@ -4452,7 +4932,13 @@ > 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; > } >@@ -4536,7 +5022,9 @@ > 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--]; >@@ -4758,6 +5246,29 @@ > protected void consumeModifiers2() { > this.expressionLengthStack[this.expressionLengthPtr - 1] += this.expressionLengthStack[this.expressionLengthPtr--]; > } >+ >+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]); >@@ -4821,9 +5332,21 @@ > } > 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' >@@ -4993,7 +5516,37 @@ > 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 consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations() { >+ // PrimaryNoNewArray ::= Modifiers Name Dims '.' 'class' >+ this.intPtr--; // remove the class start position >+ >+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); >+ pushOnGenericsLengthStack(0); >+ >+ int classTokenSourceEnd = this.intStack[this.intPtr--]; >+ TypeReference typeReference = getUnannotatedTypeReference(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; >+ } >+ pushOnExpressionStack(new ClassLiteralAccess(classTokenSourceEnd, typeReference)); >+ if (this.modifiers != ClassFileConstants.AccDefault) { >+ problemReporter().invalidLocationForModifiers(typeReference); >+ } >+ resetModifiers(); > } > protected void consumePrimaryNoNewArrayName() { > // PrimaryNoNewArray ::= Name '.' 'class' >@@ -5002,16 +5555,47 @@ > // handle type arguments > pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); > pushOnGenericsLengthStack(0); >- TypeReference typeReference = getTypeReference(0); >+ TypeReference typeReference = getUnannotatedTypeReference(0); // TODO (Srikanth) needs fix > > pushOnExpressionStack( > new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference)); > } >+protected void consumePrimaryNoNewArrayNameWithTypeAnnotations() { >+ // PrimaryNoNewArray ::= Modifiers Name '.' 'class' >+ this.intPtr--; // remove the class start position >+ >+ // handle type arguments >+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); >+ pushOnGenericsLengthStack(0); >+ TypeReference typeReference = getUnannotatedTypeReference(0); // TODO (Srikanth) needs fix >+ 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; >+ } >+ >+ pushOnExpressionStack(new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference)); >+ if (this.modifiers != ClassFileConstants.AccDefault) { >+ problemReporter().invalidLocationForModifiers(typeReference); >+ } >+ resetModifiers(); >+} > protected void consumePrimaryNoNewArrayNameSuper() { > // PrimaryNoNewArray ::= Name '.' 'super' > // handle type arguments > pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); > pushOnGenericsLengthStack(0); >+ pushOnTypeAnnotationLengthStack(0); // javac complains on annotations here. > TypeReference typeReference = getTypeReference(0); > > pushOnExpressionStack( >@@ -5025,7 +5609,7 @@ > // 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( >@@ -5038,13 +5622,65 @@ > // 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 consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations() { >+ // PrimaryNoNewArray ::= Modifiers PrimitiveType Dims '.' 'class' >+ this.intPtr--; // remove the class start position >+ int classTokeSourceEnd = this.intStack[this.intPtr--]; >+ TypeReference typeReference = getUnannotatedTypeReference(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; >+ } >+ pushOnExpressionStack(new ClassLiteralAccess(classTokeSourceEnd, typeReference)); >+ if (this.modifiers != ClassFileConstants.AccDefault) { >+ problemReporter().invalidLocationForModifiers(typeReference); >+ } >+ resetModifiers(); > } > 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 consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations() { >+ // PrimaryNoNewArray ::= Modifiers PrimitiveType '.' 'class' >+ this.intPtr--; // remove the class start position >+ int classTokenSourceEnd = this.intStack[this.intPtr--]; >+ TypeReference typeReference = getUnannotatedTypeReference(0); >+ 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; >+ } >+ pushOnExpressionStack(new ClassLiteralAccess(classTokenSourceEnd, typeReference)); >+ if (this.modifiers != ClassFileConstants.AccDefault) { >+ problemReporter().invalidLocationForModifiers(typeReference); >+ } >+ resetModifiers(); > } > protected void consumePrimaryNoNewArrayThis() { > // PrimaryNoNewArray ::= 'this' >@@ -5160,1684 +5796,1991 @@ > // 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$ >+ case 49 : if (DEBUG) { System.out.println("ReferenceType ::= ReferenceType0"); } //$NON-NLS-1$ >+ consumeUnannotatedType(); >+ break; >+ >+ case 50 : if (DEBUG) { System.out.println("ReferenceType ::= Modifiers ReferenceType0"); } //$NON-NLS-1$ >+ consumeAnnotatedType(); >+ break; >+ >+ case 51 : if (DEBUG) { System.out.println("ReferenceType0 ::= ClassOrInterfaceType0"); } //$NON-NLS-1$ > consumeReferenceType(); > break; > >- case 48 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$ >+ case 53 : if (DEBUG) { System.out.println("Annotationsopt ::="); } //$NON-NLS-1$ >+ consumeZeroTypeAnnotations(true); >+ break; >+ >+ 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 49 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); } //$NON-NLS-1$ >- consumeClassOrInterface(); >+ case 61 : if (DEBUG) { System.out.println("PopZeroTypeAnnotations ::="); } //$NON-NLS-1$ >+ consumeZeroTypeAnnotations(false); > break; > >- case 50 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); } //$NON-NLS-1$ >+ case 62 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments..."); } //$NON-NLS-1$ > consumeGenericType(); > break; > >- case 51 : 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 52 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$ >+ case 65 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$ > consumePrimitiveArrayType(); > break; > >- case 53 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$ >+ case 66 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$ > consumeNameArrayType(); > break; > >- case 54 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$ >+ case 67 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$ > consumeGenericTypeNameArrayType(); > break; > >- case 55 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$ >+ case 68 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$ > consumeGenericTypeArrayType(); > break; > >- case 60 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$ >+ case 73 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$ > consumeQualifiedName(); > break; > >- case 61 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$ >+ case 74 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$ > consumeCompilationUnit(); > break; > >- case 62 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$ >+ case 75 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$ > consumeInternalCompilationUnit(); > 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$ > consumeInternalCompilationUnitWithTypes(); > 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 ::= ImportDeclarations..."); } //$NON-NLS-1$ >+ case 79 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ > consumeInternalCompilationUnit(); > break; > >- case 67 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$ >+ case 80 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$ > consumeInternalCompilationUnitWithTypes(); > break; > >- case 68 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ >+ case 81 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ > consumeInternalCompilationUnitWithTypes(); > break; > >- case 69 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$ >+ case 82 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$ > consumeEmptyInternalCompilationUnit(); > break; > >- case 70 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$ >+ case 83 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$ > consumeReduceImports(); > break; > >- case 71 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$ >+ case 84 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$ > consumeEnterCompilationUnit(); > break; > >- case 87 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$ >+ case 103 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$ > consumeCatchHeader(); > break; > >- case 89 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$ >+ case 105 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$ > consumeImportDeclarations(); > break; > >- case 91 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$ >+ case 107 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$ > consumeTypeDeclarations(); > break; > >- case 92 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$ >+ case 108 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$ > consumePackageDeclaration(); > break; > >- case 93 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$ >+ case 109 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$ > consumePackageDeclarationNameWithModifiers(); > break; > >- case 94 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$ >+ case 110 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$ > consumePackageDeclarationName(); > break; > >- case 95 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$ >+ case 111 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$ > consumePackageComment(); > break; > >- case 100 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$ >+ case 116 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 101 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); } //$NON-NLS-1$ >+ case 117 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); } //$NON-NLS-1$ > consumeSingleTypeImportDeclarationName(); > break; > >- case 102 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ >+ case 118 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 103 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$ >+ case 119 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$ > consumeTypeImportOnDemandDeclarationName(); > break; > >- case 106 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 122 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyTypeDeclaration(); > break; > >- case 110 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$ >+ case 126 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$ > consumeModifiers2(); > break; > >- case 122 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$ >+ case 138 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$ > consumeAnnotationAsModifier(); > break; > >- case 123 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$ >+ case 139 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$ > consumeClassDeclaration(); > break; > >- case 124 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$ >+ case 140 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$ > consumeClassHeader(); > break; > >- case 125 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$ >+ case 141 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$ > consumeTypeHeaderNameWithTypeParameters(); > break; > >- case 127 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$ >+ case 143 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$ > consumeClassHeaderName1(); > break; > >- case 128 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$ >+ case 144 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$ > consumeClassHeaderExtends(); > break; > >- case 129 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$ >+ case 145 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$ > consumeClassHeaderImplements(); > break; > >- case 131 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$ >+ case 147 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$ > consumeInterfaceTypeList(); > break; > >- case 132 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ >+ case 148 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ > consumeInterfaceType(); > break; > >- case 135 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$ >+ case 151 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$ > consumeClassBodyDeclarations(); > break; > >- case 139 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$ >+ case 155 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$ > consumeClassBodyDeclaration(); > break; > >- case 140 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$ >+ case 156 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$ > consumeDiet(); > break; > >- case 141 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$ >+ case 157 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$ > consumeClassBodyDeclaration(); > break; > >- case 142 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$ >+ case 158 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$ > consumeCreateInitializer(); > break; > >- case 149 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 165 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyTypeDeclaration(); > break; > >- case 152 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 168 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type0..."); } //$NON-NLS-1$ > consumeFieldDeclaration(); > break; > >- case 154 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$ >+ case 170 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$ > consumeVariableDeclarators(); > break; > >- case 157 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$ >+ case 173 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$ > consumeEnterVariable(); > break; > >- case 158 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$ >+ case 174 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$ > consumeExitVariableWithInitialization(); > break; > >- case 159 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$ >+ case 175 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$ > consumeExitVariableWithoutInitialization(); > break; > >- case 160 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$ >+ case 176 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$ > consumeForceNoDiet(); > break; > >- case 161 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$ >+ case 177 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$ > consumeRestoreDiet(); > break; > >- case 166 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ >+ case 182 : 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 167 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$ >+ case 183 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$ > // set to false to consume a method without body > consumeMethodDeclaration(false); > break; > >- case 168 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$ >+ case 184 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >- case 169 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$ >+ case 185 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$ > consumeMethodHeaderNameWithTypeParameters(false); > break; > >- case 170 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$ >+ case 186 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type0 Identifier..."); } //$NON-NLS-1$ > consumeMethodHeaderName(false); > break; > >- case 171 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$ >+ case 187 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$ > consumeMethodHeaderRightParen(); > break; > >- case 172 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$ >+ case 188 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= DimsoptAnnotsopt"); } //$NON-NLS-1$ > consumeMethodHeaderExtendedDims(); > break; > >- case 173 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$ >+ case 189 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$ > consumeMethodHeaderThrowsClause(); > break; > >- case 174 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$ >+ case 190 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$ > consumeConstructorHeader(); > break; > >- case 175 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$ >+ case 191 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$ > consumeConstructorHeaderNameWithTypeParameters(); > break; > >- case 176 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$ >+ case 192 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$ > consumeConstructorHeaderName(); > break; > >- case 178 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$ >+ case 194 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$ > consumeFormalParameterList(); > break; > >- case 179 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 195 : if (DEBUG) { System.out.println("PotentialNameArray ::="); } //$NON-NLS-1$ >+ consumePotentialNameArrayType(); >+ break; >+ >+ case 196 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); } //$NON-NLS-1$ >+ consumeFormalParameter(false); >+ break; >+ >+ case 197 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); } //$NON-NLS-1$ >+ consumeFormalParameter(true); >+ break; >+ >+ case 198 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); } //$NON-NLS-1$ >+ consumeFormalParameter(false); >+ break; >+ >+ case 199 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); } //$NON-NLS-1$ >+ consumeFormalParameter(true); >+ break; >+ >+ case 200 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); } //$NON-NLS-1$ >+ consumeFormalParameter(false); >+ break; >+ >+ case 201 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); } //$NON-NLS-1$ >+ consumeFormalParameter(true); >+ break; >+ >+ case 202 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); } //$NON-NLS-1$ > consumeFormalParameter(false); > break; > >- case 180 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type ELLIPSIS..."); } //$NON-NLS-1$ >+ case 203 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); } //$NON-NLS-1$ > consumeFormalParameter(true); > break; > >- case 182 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$ >+ case 205 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$ > consumeClassTypeList(); > break; > >- case 183 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$ >+ case 206 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$ > consumeClassTypeElt(); > break; > >- case 184 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$ >+ case 207 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$ > consumeMethodBody(); > break; > >- case 185 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$ >+ case 208 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$ > consumeNestedMethod(); > break; > >- case 186 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$ >+ case 209 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$ > consumeStaticInitializer(); > break; > >- case 187 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$ >+ case 210 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$ > consumeStaticOnly(); > break; > >- case 188 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$ >+ case 211 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$ > consumeConstructorDeclaration() ; > break; > >- case 189 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$ >+ case 212 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$ > consumeInvalidConstructorDeclaration() ; > break; > >- case 190 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$ >+ case 213 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(0, THIS_CALL); > break; > >- case 191 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$ >+ case 214 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL); > break; > >- case 192 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$ >+ case 215 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(0,SUPER_CALL); > break; > >- case 193 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 216 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL); > break; > >- case 194 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$ >+ case 217 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(1, SUPER_CALL); > break; > >- case 195 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ >+ case 218 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL); > break; > >- case 196 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$ >+ case 219 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(2, SUPER_CALL); > break; > >- case 197 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ >+ case 220 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL); > break; > >- case 198 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$ >+ case 221 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(1, THIS_CALL); > break; > >- case 199 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ >+ case 222 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL); > break; > >- case 200 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$ >+ case 223 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(2, THIS_CALL); > break; > >- case 201 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ >+ case 224 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL); > break; > >- case 202 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$ >+ case 225 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$ > consumeInterfaceDeclaration(); > break; > >- case 203 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$ >+ case 226 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$ > consumeInterfaceHeader(); > break; > >- case 204 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$ >+ case 227 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$ > consumeTypeHeaderNameWithTypeParameters(); > break; > >- case 206 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$ >+ case 229 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$ > consumeInterfaceHeaderName1(); > break; > >- case 207 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$ >+ case 230 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$ > consumeInterfaceHeaderExtends(); > break; > >- case 210 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$ >+ case 233 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$ > consumeInterfaceMemberDeclarations(); > break; > >- case 211 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 234 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyTypeDeclaration(); > break; > >- case 213 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ >+ case 236 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ > consumeInvalidMethodDeclaration(); > break; > >- case 214 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ >+ case 237 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ > consumeInvalidConstructorDeclaration(true); > break; > >- case 215 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ >+ case 238 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ > consumeInvalidConstructorDeclaration(false); > break; > >- case 226 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ >+ case 249 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ > consumePushLeftBrace(); > break; > >- case 227 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ >+ case 250 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ > consumeEmptyArrayInitializer(); > break; > >- case 228 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ >+ case 251 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ > consumeArrayInitializer(); > break; > >- case 229 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ >+ case 252 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ > consumeArrayInitializer(); > break; > >- case 231 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ >+ case 254 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ > consumeVariableInitializers(); > break; > >- case 232 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ >+ case 255 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ > consumeBlock(); > break; > >- case 233 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ >+ case 256 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ > consumeOpenBlock() ; > break; > >- case 235 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ >+ case 258 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ > consumeBlockStatements() ; > break; > >- case 239 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ >+ case 262 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ > consumeInvalidInterfaceDeclaration(); > break; > >- case 240 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ >+ case 263 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ > consumeInvalidAnnotationTypeDeclaration(); > break; > >- case 241 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ >+ case 264 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ > consumeInvalidEnumDeclaration(); > break; > >- case 242 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ >+ case 265 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ > consumeLocalVariableDeclarationStatement(); > break; > >- case 243 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$ >+ case 266 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type0 PushModifiers..."); } //$NON-NLS-1$ > consumeLocalVariableDeclaration(); > break; > >- case 244 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$ >+ case 267 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type0..."); } //$NON-NLS-1$ > consumeLocalVariableDeclaration(); > break; > >- case 245 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ >+ case 268 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ > consumePushModifiers(); > break; > >- case 246 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ >+ case 269 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ > consumePushModifiersForHeader(); > break; > >- case 247 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ >+ case 270 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ > consumePushRealModifiers(); > break; > >- case 273 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 296 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyStatement(); > break; > >- case 274 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ >+ case 297 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ > consumeStatementLabel() ; > break; > >- case 275 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ >+ case 298 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ > consumeStatementLabel() ; > break; > >- case 276 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ >+ case 299 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ > consumeLabel() ; > break; > >- case 277 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ >+ case 300 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ > consumeExpressionStatement(); > break; > >- case 286 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 309 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementIfNoElse(); > break; > >- case 287 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 310 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementIfWithElse(); > break; > >- case 288 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ >+ case 311 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ > consumeStatementIfWithElse(); > break; > >- case 289 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 312 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementSwitch() ; > break; > >- case 290 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ >+ case 313 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ > consumeEmptySwitchBlock() ; > break; > >- case 293 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ >+ case 316 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ > consumeSwitchBlock() ; > break; > >- case 295 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ >+ case 318 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ > consumeSwitchBlockStatements() ; > break; > >- case 296 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ >+ case 319 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ > consumeSwitchBlockStatement() ; > break; > >- case 298 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ >+ case 321 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ > consumeSwitchLabels() ; > break; > >- case 299 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ >+ case 322 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ > consumeCaseLabel(); > break; > >- case 300 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ >+ case 323 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ > consumeDefaultLabel(); > break; > >- case 301 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 324 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementWhile() ; > break; > >- case 302 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ >+ case 325 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ > consumeStatementWhile() ; > break; > >- case 303 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ >+ case 326 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ > consumeStatementDo() ; > break; > >- case 304 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ >+ case 327 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ > consumeStatementFor() ; > break; > >- case 305 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ >+ case 328 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ > consumeStatementFor() ; > break; > >- case 306 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ >+ case 329 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ > consumeForInit() ; > break; > >- case 310 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ >+ case 333 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ > consumeStatementExpressionList() ; > break; > >- case 311 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ >+ case 334 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ > consumeSimpleAssertStatement() ; > break; > >- case 312 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ >+ case 335 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ > consumeAssertStatement() ; > break; > >- case 313 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ >+ case 336 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ > consumeStatementBreak() ; > break; > >- case 314 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ >+ case 337 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ > consumeStatementBreakWithLabel() ; > break; > >- case 315 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ >+ case 338 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ > consumeStatementContinue() ; > break; > >- case 316 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ >+ case 339 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ > consumeStatementContinueWithLabel() ; > break; > >- case 317 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ >+ case 340 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ > consumeStatementReturn() ; > break; > >- case 318 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ >+ case 341 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ > consumeStatementThrow(); > break; > >- case 319 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ >+ case 342 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ > consumeStatementSynchronized(); > break; > >- case 320 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ >+ case 343 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ > consumeOnlySynchronized(); > break; > >- case 321 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ >+ case 344 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ > consumeStatementTry(false); > break; > >- case 322 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ >+ case 345 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ > consumeStatementTry(true); > break; > >- case 324 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ >+ case 347 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ > consumeExitTryBlock(); > break; > >- case 326 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ >+ case 349 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ > consumeCatches(); > break; > >- case 327 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$ >+ case 350 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$ > consumeStatementCatch() ; > break; > >- case 329 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ >+ case 352 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ > consumeLeftParen(); > break; > >- case 330 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ >+ case 353 : if (DEBUG) { System.out.println("PushRPARENForUnannotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForUnannotatedTypeCast(); >+ break; >+ >+ case 354 : if (DEBUG) { System.out.println("PushRPARENForNameUnannotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForNameUnannotatedTypeCast(); >+ break; >+ >+ case 355 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ > consumeRightParen(); > break; > >- case 335 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ >+ case 356 : if (DEBUG) { System.out.println("PushRPARENForAnnotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForAnnotatedTypeCast(); >+ break; >+ >+ case 357 : if (DEBUG) { System.out.println("PushRPARENForNameAndAnnotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForNameAndAnnotatedTypeCast(); >+ break; >+ >+ case 362 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayThis(); > break; > >- case 336 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ >+ case 363 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ > consumePrimaryNoNewArray(); > break; > >- case 337 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ >+ case 364 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayWithName(); > break; > >- case 340 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ >+ case 367 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayNameThis(); > break; > >- case 341 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ >+ case 368 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayNameSuper(); > break; > >- case 342 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ >+ case 369 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name DOT class"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayNameWithTypeAnnotations(); >+ break; >+ >+ case 370 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name Dims DOT class"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations(); >+ break; >+ >+ case 371 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType Dims DOT"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations(); >+ break; >+ >+ case 372 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType DOT class"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations(); >+ break; >+ >+ case 373 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayName(); > break; > >- case 343 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ >+ case 374 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayArrayType(); > break; > >- case 344 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ >+ case 375 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayPrimitiveArrayType(); > break; > >- case 345 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ >+ case 376 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayPrimitiveType(); > break; > >- case 348 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ >+ case 379 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ > consumeAllocationHeader(); > break; > >- case 349 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ >+ case 380 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionWithTypeArguments(); > break; > >- case 350 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN"); } //$NON-NLS-1$ >+ case 381 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN"); } //$NON-NLS-1$ > consumeClassInstanceCreationExpression(); > break; > >- case 351 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ >+ case 382 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; > break; > >- case 352 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ >+ case 383 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualified() ; > break; > >- case 353 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ >+ case 384 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualified() ; > break; > >- case 354 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ >+ case 385 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; > break; > >- case 355 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ >+ case 386 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionName() ; > break; > >- case 356 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ >+ case 387 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ > consumeClassBodyopt(); > break; > >- case 358 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ >+ case 389 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ > consumeEnterAnonymousClassBody(false); > break; > >- case 359 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ >+ case 390 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ > consumeClassBodyopt(); > break; > >- case 361 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ >+ case 392 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ > consumeEnterAnonymousClassBody(true); > break; > >- case 363 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ >+ case 394 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ > consumeArgumentList(); > break; > >- case 364 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$ >+ case 395 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new Annotationsopt PrimitiveType"); } //$NON-NLS-1$ > consumeArrayCreationHeader(); > break; > >- case 365 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ >+ case 396 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ > consumeArrayCreationHeader(); > break; > >- case 366 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ >+ case 397 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithoutInitializer(); > break; > >- case 367 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$ >+ case 398 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new Annotationsopt"); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithInitializer(); > break; > >- case 368 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ >+ case 399 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithoutInitializer(); > break; > >- case 369 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ >+ case 400 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithInitializer(); > break; > >- case 371 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ >+ case 402 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ > consumeDimWithOrWithOutExprs(); > break; > >- case 373 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ case 405 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET..."); } //$NON-NLS-1$ > consumeDimWithOrWithOutExpr(); > break; > >- case 374 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ >+ case 406 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotations LBRACKET..."); } //$NON-NLS-1$ >+ consumeDimWithOrWithOutExpr(); >+ break; >+ >+ case 407 : if (DEBUG) { System.out.println("DimsoptAnnotsopt ::="); } //$NON-NLS-1$ >+ consumeEmptyDimsoptAnnotsopt(); >+ break; >+ >+ case 408 : if (DEBUG) { System.out.println("DimsoptAnnotsopt -> DimsAnnotLoop"); } //$NON-NLS-1$ >+ consumeDimsWithTrailingAnnotsopt(); >+ break; >+ >+ case 411 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= Annotation"); } //$NON-NLS-1$ >+ consumeTypeAnnotation(true); >+ break; >+ >+ case 412 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ consumeOneDimLoop(true); >+ break; >+ >+ case 413 : if (DEBUG) { System.out.println("TypeAnnotations ::= Annotation"); } //$NON-NLS-1$ >+ consumeTypeAnnotation(false); >+ break; >+ >+ case 414 : if (DEBUG) { System.out.println("TypeAnnotations ::= TypeAnnotations Annotation"); } //$NON-NLS-1$ >+ consumeOneMoreTypeAnnotation(); >+ break; >+ >+ case 415 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ > consumeDims(); > break; > >- case 377 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >- consumeOneDimLoop(); >+ case 418 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ consumeOneDimLoop(false); > break; > >- case 378 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ >+ case 419 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ consumeOneDimLoopWithAnnotations(); >+ break; >+ >+ case 420 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ > consumeFieldAccess(false); > break; > >- case 379 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ >+ case 421 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ > consumeFieldAccess(true); > break; > >- case 380 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ >+ case 422 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ > consumeMethodInvocationName(); > break; > >- case 381 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 423 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeMethodInvocationNameWithTypeArguments(); > break; > >- case 382 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 424 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeMethodInvocationPrimaryWithTypeArguments(); > break; > >- case 383 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ >+ case 425 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ > consumeMethodInvocationPrimary(); > break; > >- case 384 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 426 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeMethodInvocationSuperWithTypeArguments(); > break; > >- case 385 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ >+ case 427 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ > consumeMethodInvocationSuper(); > break; > >- case 386 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ >+ case 428 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ > consumeArrayAccess(true); > break; > >- case 387 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ >+ case 429 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ > consumeArrayAccess(false); > break; > >- case 388 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ >+ case 430 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ > consumeArrayAccess(false); > break; > >- case 390 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ >+ case 432 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ > consumePostfixExpression(); > break; > >- case 393 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ >+ case 435 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS,true); > break; > >- case 394 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ >+ case 436 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS,true); > break; > >- case 395 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ >+ case 437 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ > consumePushPosition(); > break; > >- case 398 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ >+ case 440 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS); > break; > >- case 399 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ >+ case 441 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS); > break; > >- case 401 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ >+ case 443 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS,false); > break; > >- case 402 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ >+ case 444 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS,false); > break; > >- case 404 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ >+ case 446 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.TWIDDLE); > break; > >- case 405 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ >+ case 447 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.NOT); > break; > >- case 407 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ >+ case 449 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ > consumeCastExpressionWithPrimitiveType(); > break; > >- case 408 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ >+ case 450 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers PrimitiveType..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations(); >+ break; >+ >+ case 451 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ > consumeCastExpressionWithGenericsArray(); > break; > >- case 409 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ >+ case 452 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithGenericsArrayWithTypeAnnotations(); >+ break; >+ >+ case 453 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ > consumeCastExpressionWithQualifiedGenericsArray(); > break; > >- case 410 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$ >+ case 454 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations(); >+ break; >+ >+ case 455 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ > consumeCastExpressionLL1(); > break; > >- case 411 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); } //$NON-NLS-1$ >+ case 456 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ >+ consumeCastExpressionLL1WithTypeAnnotations(); >+ break; >+ >+ case 457 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); } //$NON-NLS-1$ > consumeCastExpressionWithNameArray(); > break; > >- case 412 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ >+ case 458 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name Dims..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithNameArrayWithTypeAnnotations(); >+ break; >+ >+ case 459 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ > consumeOnlyTypeArgumentsForCastExpression(); > break; > >- case 413 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ >+ case 460 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ > consumeInsideCastExpression(); > break; > >- case 414 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ >+ case 461 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ > consumeInsideCastExpressionLL1(); > break; > >- case 415 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ >+ case 462 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ > consumeInsideCastExpressionWithQualifiedGenerics(); > break; > >- case 417 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ >+ case 463 : if (DEBUG) { System.out.println("InsideCastExpressionWithAnnotatedQualifiedGenerics ::="); } //$NON-NLS-1$ >+ consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); >+ break; >+ >+ case 465 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MULTIPLY); > break; > >- case 418 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ >+ case 466 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.DIVIDE); > break; > >- case 419 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ >+ case 467 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.REMAINDER); > break; > >- case 421 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ >+ case 469 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.PLUS); > break; > >- case 422 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ >+ case 470 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MINUS); > break; > >- case 424 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ >+ case 472 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LEFT_SHIFT); > break; > >- case 425 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ >+ case 473 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); > break; > >- case 426 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 474 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); > break; > >- case 428 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ >+ case 476 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS); > break; > >- case 429 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ >+ case 477 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER); > break; > >- case 430 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ >+ case 478 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS_EQUAL); > break; > >- case 431 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ >+ case 479 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER_EQUAL); > break; > >- case 433 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ >+ case 481 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ > consumeInstanceOfExpression(); > break; > >- case 435 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ >+ case 483 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); > break; > >- case 436 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ >+ case 484 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.NOT_EQUAL); > break; > >- case 438 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ >+ case 486 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND); > break; > >- case 440 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ >+ case 488 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.XOR); > break; > >- case 442 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ >+ case 490 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR); > break; > >- case 444 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ >+ case 492 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND_AND); > break; > >- case 446 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ >+ case 494 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR_OR); > break; > >- case 448 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ >+ case 496 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ > consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; > break; > >- case 451 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ >+ case 499 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ > consumeAssignment(); > break; > >- case 453 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ >+ case 501 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ > ignoreExpressionAssignment(); > break; > >- case 454 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ >+ case 502 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(EQUAL); > break; > >- case 455 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ >+ case 503 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(MULTIPLY); > break; > >- case 456 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ >+ case 504 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(DIVIDE); > break; > >- case 457 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ >+ case 505 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(REMAINDER); > break; > >- case 458 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ >+ case 506 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(PLUS); > break; > >- case 459 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ >+ case 507 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(MINUS); > break; > >- case 460 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ >+ case 508 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(LEFT_SHIFT); > break; > >- case 461 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ >+ case 509 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(RIGHT_SHIFT); > break; > >- case 462 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ >+ case 510 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT); > break; > >- case 463 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ >+ case 511 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(AND); > break; > >- case 464 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ >+ case 512 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(XOR); > break; > >- case 465 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ >+ case 513 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(OR); > break; > >- case 469 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ >+ case 517 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ > consumeEmptyExpression(); > break; > >- case 474 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 522 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyClassBodyDeclarationsopt(); > break; > >- case 475 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ >+ case 523 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ > consumeClassBodyDeclarationsopt(); > break; > >- case 476 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ >+ case 524 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ > consumeDefaultModifiers(); > break; > >- case 477 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ >+ case 525 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ > consumeModifiers(); > break; > >- case 478 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ >+ case 526 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ > consumeEmptyBlockStatementsopt(); > break; > >- case 480 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ >+ case 528 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ > consumeEmptyDimsopt(); > break; > >- case 482 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ >+ case 530 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ > consumeEmptyArgumentListopt(); > break; > >- case 486 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ >+ case 534 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ > consumeFormalParameterListopt(); > break; > >- case 490 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 538 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyInterfaceMemberDeclarationsopt(); > break; > >- case 491 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ >+ case 539 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ > consumeInterfaceMemberDeclarationsopt(); > break; > >- case 492 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ >+ case 540 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ > consumeNestedType(); > break; > >- case 493 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ >+ case 541 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ > consumeEmptyForInitopt(); > break; > >- case 495 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ >+ case 543 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ > consumeEmptyForUpdateopt(); > break; > >- case 499 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ >+ case 547 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ > consumeEmptyCatchesopt(); > break; > >- case 501 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ >+ case 549 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ > consumeEnumDeclaration(); > break; > >- case 502 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ >+ case 550 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ > consumeEnumHeader(); > break; > >- case 503 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ >+ case 551 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ > consumeEnumHeaderName(); > break; > >- case 504 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ >+ case 552 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ > consumeEnumHeaderNameWithTypeParameters(); > break; > >- case 505 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ >+ case 553 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ > consumeEnumBodyNoConstants(); > break; > >- case 506 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ >+ case 554 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ > consumeEnumBodyNoConstants(); > break; > >- case 507 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ >+ case 555 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ > consumeEnumBodyWithConstants(); > break; > >- case 508 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ >+ case 556 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ > consumeEnumBodyWithConstants(); > break; > >- case 510 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ >+ case 558 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ > consumeEnumConstants(); > break; > >- case 511 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ >+ case 559 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ > consumeEnumConstantHeaderName(); > break; > >- case 512 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ >+ case 560 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ > consumeEnumConstantHeader(); > break; > >- case 513 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ >+ case 561 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ > consumeEnumConstantWithClassBody(); > break; > >- case 514 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ >+ case 562 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ > consumeEnumConstantNoClassBody(); > break; > >- case 515 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ >+ case 563 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ > consumeArguments(); > break; > >- case 516 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ >+ case 564 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ > consumeEmptyArguments(); > break; > >- case 518 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ >+ case 566 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ > consumeEnumDeclarations(); > break; > >- case 519 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 567 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyEnumDeclarations(); > break; > >- case 521 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ >+ case 569 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ > consumeEnhancedForStatement(); > break; > >- case 522 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ >+ case 570 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ > consumeEnhancedForStatement(); > break; > >- case 523 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$ >+ case 571 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type0..."); } //$NON-NLS-1$ > consumeEnhancedForStatementHeaderInit(false); > break; > >- case 524 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ >+ case 572 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ > consumeEnhancedForStatementHeaderInit(true); > break; > >- case 525 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ >+ case 573 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ > consumeEnhancedForStatementHeader(); > break; > >- case 526 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ >+ case 574 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 527 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ >+ case 575 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ > consumeSingleStaticImportDeclarationName(); > break; > >- case 528 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ >+ case 576 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 529 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ >+ case 577 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ > consumeStaticImportOnDemandDeclarationName(); > break; > >- case 530 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ >+ case 578 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ > consumeTypeArguments(); > break; > >- case 531 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ >+ case 579 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ > consumeOnlyTypeArguments(); > break; > >- case 533 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ >+ case 581 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ > consumeTypeArgumentList1(); > break; > >- case 535 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ >+ case 583 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ > consumeTypeArgumentList(); > break; > >- case 536 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ >+ case 584 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ > consumeTypeArgument(); > break; > >- case 540 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ >+ case 588 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ > consumeReferenceType1(); > break; > >- case 541 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ case 589 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ > consumeTypeArgumentReferenceType1(); > break; > >- case 543 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ >+ case 590 : if (DEBUG) { System.out.println("ReferenceType1 ::= Modifiers ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ consumeTypeArgumentReferenceType1WithTypeAnnotations(); >+ break; >+ >+ case 592 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ > consumeTypeArgumentList2(); > break; > >- case 546 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 595 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeReferenceType2(); > break; > >- case 547 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ case 596 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ > consumeTypeArgumentReferenceType2(); > break; > >- case 549 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ >+ case 597 : if (DEBUG) { System.out.println("ReferenceType2 ::= Modifiers ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ consumeTypeArgumentReferenceType2WithTypeAnnotations(); >+ break; >+ >+ case 599 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ > consumeTypeArgumentList3(); > break; > >- case 552 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 602 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeReferenceType3(); > break; > >- case 553 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ >+ case 603 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ > consumeWildcard(); > break; > >- case 554 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ >+ case 604 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ > consumeWildcardWithBounds(); > break; > >- case 555 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ >+ case 605 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ > consumeWildcardBoundsExtends(); > break; > >- case 556 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ >+ case 606 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ > consumeWildcardBoundsSuper(); > break; > >- case 557 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ >+ case 607 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ > consumeWildcard1(); > break; > >- case 558 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ >+ case 608 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ > consumeWildcard1WithBounds(); > break; > >- case 559 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ >+ case 609 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ > consumeWildcardBounds1Extends(); > break; > >- case 560 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ >+ case 610 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ > consumeWildcardBounds1Super(); > break; > >- case 561 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 611 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeWildcard2(); > break; > >- case 562 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ >+ case 612 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ > consumeWildcard2WithBounds(); > break; > >- case 563 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ >+ case 613 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ > consumeWildcardBounds2Extends(); > break; > >- case 564 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ >+ case 614 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ > consumeWildcardBounds2Super(); > break; > >- case 565 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 615 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeWildcard3(); > break; > >- case 566 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ >+ case 616 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ > consumeWildcard3WithBounds(); > break; > >- case 567 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ >+ case 617 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ > consumeWildcardBounds3Extends(); > break; > >- case 568 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ >+ case 618 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ > consumeWildcardBounds3Super(); > break; > >- case 569 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); } //$NON-NLS-1$ >+ case 619 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); } //$NON-NLS-1$ >+ consumeZeroTypeAnnotations(true); >+ break; >+ >+ case 620 : if (DEBUG) { System.out.println("TypeParameterHeader ::= PushZeroTypeAnnotations..."); } //$NON-NLS-1$ >+ consumeTypeParameterHeader(); >+ break; >+ >+ case 621 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotations Identifier"); } //$NON-NLS-1$ > consumeTypeParameterHeader(); > break; > >- case 570 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ >+ case 622 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ > consumeTypeParameters(); > break; > >- case 572 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ >+ case 624 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ > consumeTypeParameterList(); > break; > >- case 574 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 626 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameterWithExtends(); > break; > >- case 575 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 627 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameterWithExtendsAndBounds(); > break; > >- case 577 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ >+ case 629 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ > consumeAdditionalBoundList(); > break; > >- case 578 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ >+ case 630 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ > consumeAdditionalBound(); > break; > >- case 580 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ >+ case 632 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ > consumeTypeParameterList1(); > break; > >- case 581 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ >+ case 633 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ > consumeTypeParameter1(); > break; > >- case 582 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 634 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameter1WithExtends(); > break; > >- case 583 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 635 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameter1WithExtendsAndBounds(); > break; > >- case 585 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ >+ case 637 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ > consumeAdditionalBoundList1(); > break; > >- case 586 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ >+ case 638 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ > consumeAdditionalBound1(); > break; > >- case 592 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ >+ case 644 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS); > break; > >- case 593 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ >+ case 645 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS); > break; > >- case 596 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ >+ case 648 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.TWIDDLE); > break; > >- case 597 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ >+ case 649 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.NOT); > break; > >- case 600 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 652 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MULTIPLY); > break; > >- case 601 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ >+ case 653 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.MULTIPLY); > break; > >- case 602 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 654 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.DIVIDE); > break; > >- case 603 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ >+ case 655 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.DIVIDE); > break; > >- case 604 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 656 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.REMAINDER); > break; > >- case 605 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ >+ case 657 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.REMAINDER); > break; > >- case 607 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 659 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.PLUS); > break; > >- case 608 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ >+ case 660 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.PLUS); > break; > >- case 609 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 661 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MINUS); > break; > >- case 610 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ >+ case 662 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.MINUS); > break; > >- case 612 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ >+ case 664 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LEFT_SHIFT); > break; > >- case 613 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ >+ case 665 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT); > break; > >- case 614 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ >+ case 666 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); > break; > >- case 615 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ >+ case 667 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT); > break; > >- case 616 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ >+ case 668 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); > break; > >- case 617 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ >+ case 669 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT); > break; > >- case 619 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ >+ case 671 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS); > break; > >- case 620 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ >+ case 672 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.LESS); > break; > >- case 621 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ >+ case 673 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER); > break; > >- case 622 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ >+ case 674 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.GREATER); > break; > >- case 623 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 675 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS_EQUAL); > break; > >- case 624 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ >+ case 676 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL); > break; > >- case 625 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 677 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER_EQUAL); > break; > >- case 626 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ >+ case 678 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL); > break; > >- case 628 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ >+ case 680 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ > consumeInstanceOfExpressionWithName(); > break; > >- case 629 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 681 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeInstanceOfExpression(); > break; > >- case 631 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 683 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); > break; > >- case 632 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ >+ case 684 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL); > break; > >- case 633 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 685 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.NOT_EQUAL); > break; > >- case 634 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ >+ case 686 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL); > break; > >- case 636 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ >+ case 688 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND); > break; > >- case 637 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ >+ case 689 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.AND); > break; > >- case 639 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 691 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.XOR); > break; > >- case 640 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ >+ case 692 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.XOR); > break; > >- case 642 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 694 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR); > break; > >- case 643 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ >+ case 695 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.OR); > break; > >- case 645 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 697 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND_AND); > break; > >- case 646 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ >+ case 698 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.AND_AND); > break; > >- case 648 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 700 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR_OR); > break; > >- case 649 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ >+ case 701 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.OR_OR); > break; > >- case 651 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 703 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; > break; > >- case 652 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ >+ case 704 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ > consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ; > break; > >- case 656 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ >+ case 708 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderName() ; > break; > >- case 657 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ >+ case 709 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; > break; > >- case 658 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ >+ case 710 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; > break; > >- case 659 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ >+ case 711 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderName() ; > break; > >- case 660 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ >+ case 712 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeader() ; > break; > >- case 661 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ >+ case 713 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclaration() ; > break; > >- case 663 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 715 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyAnnotationTypeMemberDeclarationsopt() ; > break; > >- case 664 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ >+ case 716 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ > consumeAnnotationTypeMemberDeclarationsopt() ; > break; > >- case 666 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ >+ case 718 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeMemberDeclarations() ; > break; > >- case 667 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ >+ case 719 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ > consumeMethodHeaderNameWithTypeParameters(true); > break; > >- case 668 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 720 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type0..."); } //$NON-NLS-1$ > consumeMethodHeaderName(true); > break; > >- case 669 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ >+ case 721 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ > consumeEmptyMethodHeaderDefaultValue() ; > break; > >- case 670 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ >+ case 722 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ > consumeMethodHeaderDefaultValue(); > break; > >- case 671 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ >+ case 723 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >- case 672 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ >+ case 724 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeMemberDeclaration() ; > break; > >- case 680 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ >+ case 732 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ > consumeAnnotationName() ; > break; > >- case 681 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ >+ case 733 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ > consumeNormalAnnotation() ; > break; > >- case 682 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ >+ case 734 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ > consumeEmptyMemberValuePairsopt() ; > break; > >- case 685 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ >+ case 737 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ > consumeMemberValuePairs() ; > break; > >- case 686 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ >+ case 738 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ > consumeMemberValuePair() ; > break; > >- case 687 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ >+ case 739 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ > consumeEnterMemberValue() ; > break; > >- case 688 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ >+ case 740 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ > consumeExitMemberValue() ; > break; > >- case 690 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ >+ case 742 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ > consumeMemberValueAsName() ; > break; > >- case 693 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 745 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeMemberValueArrayInitializer() ; > break; > >- case 694 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 746 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeMemberValueArrayInitializer() ; > break; > >- case 695 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 747 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeEmptyMemberValueArrayInitializer() ; > break; > >- case 696 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 748 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeEmptyMemberValueArrayInitializer() ; > break; > >- case 697 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ >+ case 749 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ > consumeEnterMemberValueArrayInitializer() ; > break; > >- case 699 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ >+ case 751 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ > consumeMemberValues() ; > break; > >- case 700 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ >+ case 752 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ > consumeMarkerAnnotation() ; > break; > >- case 701 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ >+ case 753 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ > consumeSingleMemberAnnotationMemberValue() ; > break; > >- case 702 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ >+ case 754 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ > consumeSingleMemberAnnotation() ; > break; > >- case 703 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ >+ case 755 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ > consumeRecoveryMethodHeaderNameWithTypeParameters(); > break; > >- case 704 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 756 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type0..."); } //$NON-NLS-1$ > consumeRecoveryMethodHeaderName(); > break; > >- case 705 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ >+ case 757 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >- case 706 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ >+ case 758 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >@@ -7736,11 +8679,65 @@ > 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--; >@@ -7829,6 +8826,7 @@ > 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() { >@@ -7841,15 +8839,28 @@ > 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; >@@ -7901,6 +8912,7 @@ > 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() { >@@ -7912,11 +8924,14 @@ > 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) { >@@ -8141,12 +9156,18 @@ > 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); > } >@@ -8379,7 +9400,7 @@ > } else if (this.currentElement != null){ > if (VERBOSE_RECOVERY){ > System.out.print(Messages.parser_syntaxRecovery); >- System.out.println("--------------------------"); //$NON-NLS-1$ >+ System.out.println("--------------------------"); //$NON-NLS-1$ > System.out.println(this.compilationUnit); > System.out.println("----------------------------------"); //$NON-NLS-1$ > } >@@ -8628,13 +9649,35 @@ > 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--]; >@@ -8656,12 +9699,17 @@ > 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--; >@@ -8679,20 +9727,23 @@ > 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 = new TypeReference[currentTypeArgumentsLength]; > 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; > } >@@ -8726,7 +9777,7 @@ > 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; > } >@@ -8947,6 +9998,9 @@ > 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; >@@ -10087,6 +11141,37 @@ > } > 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; >@@ -10510,6 +11595,9 @@ > 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; >Index: compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java,v >retrieving revision 1.64 >diff -u -r1.64 ParserBasicInformation.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java 14 Jan 2011 17:02:24 -0000 1.64 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java 20 Jan 2011 21:55:24 -0000 >@@ -15,21 +15,21 @@ > public interface ParserBasicInformation { > > int ERROR_SYMBOL = 110, >- MAX_NAME_LENGTH = 41, >- NUM_STATES = 970, >+ MAX_NAME_LENGTH = 50, >+ NUM_STATES = 1052, > > NT_OFFSET = 110, >- SCOPE_UBOUND = 133, >- SCOPE_SIZE = 134, >- LA_STATE_OFFSET = 12789, >+ SCOPE_UBOUND = 222, >+ SCOPE_SIZE = 223, >+ LA_STATE_OFFSET = 15121, > MAX_LA = 1, >- NUM_RULES = 706, >+ NUM_RULES = 758, > NUM_TERMINALS = 110, >- NUM_NON_TERMINALS = 314, >- NUM_SYMBOLS = 424, >- START_STATE = 821, >- EOFT_SYMBOL = 69, >- EOLT_SYMBOL = 69, >- ACCEPT_ACTION = 12788, >- ERROR_ACTION = 12789; >+ NUM_NON_TERMINALS = 335, >+ NUM_SYMBOLS = 445, >+ START_STATE = 1765, >+ EOFT_SYMBOL = 66, >+ EOLT_SYMBOL = 66, >+ ACCEPT_ACTION = 15120, >+ ERROR_ACTION = 15121; > } >Index: compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java,v >retrieving revision 1.36 >diff -u -r1.36 TerminalTokens.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java 14 Jan 2011 17:02:24 -0000 1.36 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java 20 Jan 2011 21:55:24 -0000 >@@ -33,114 +33,114 @@ > TokenNameCOMMENT_BLOCK = 1002, > TokenNameCOMMENT_JAVADOC = 1003; > >- int TokenNameIdentifier = 26, >- TokenNameabstract = 56, >- TokenNameassert = 74, >- TokenNameboolean = 32, >- TokenNamebreak = 75, >- TokenNamebyte = 33, >- TokenNamecase = 101, >- TokenNamecatch = 102, >- TokenNamechar = 34, >- TokenNameclass = 72, >- TokenNamecontinue = 76, >+ int TokenNameIdentifier = 23, >+ TokenNameabstract = 33, >+ TokenNameassert = 75, >+ TokenNameboolean = 44, >+ TokenNamebreak = 76, >+ TokenNamebyte = 45, >+ TokenNamecase = 102, >+ TokenNamecatch = 103, >+ TokenNamechar = 46, >+ TokenNameclass = 71, >+ TokenNamecontinue = 77, > TokenNameconst = 108, >- TokenNamedefault = 97, >- TokenNamedo = 77, >- TokenNamedouble = 35, >- TokenNameelse = 103, >- TokenNameenum = 98, >- TokenNameextends = 99, >- TokenNamefalse = 44, >- TokenNamefinal = 57, >- TokenNamefinally = 104, >- TokenNamefloat = 36, >- TokenNamefor = 78, >+ TokenNamedefault = 87, >+ TokenNamedo = 78, >+ TokenNamedouble = 47, >+ TokenNameelse = 104, >+ TokenNameenum = 100, >+ TokenNameextends = 88, >+ TokenNamefalse = 56, >+ TokenNamefinal = 34, >+ TokenNamefinally = 105, >+ TokenNamefloat = 48, >+ TokenNamefor = 79, > TokenNamegoto = 109, >- TokenNameif = 79, >- TokenNameimplements = 106, >- TokenNameimport = 100, >- TokenNameinstanceof = 12, >- TokenNameint = 37, >- TokenNameinterface = 95, >- TokenNamelong = 38, >- TokenNamenative = 58, >- TokenNamenew = 43, >- TokenNamenull = 45, >- TokenNamepackage = 96, >- TokenNameprivate = 59, >- TokenNameprotected = 60, >- TokenNamepublic = 61, >- TokenNamereturn = 80, >- TokenNameshort = 39, >- TokenNamestatic = 54, >- TokenNamestrictfp = 62, >- TokenNamesuper = 41, >- TokenNameswitch = 81, >- TokenNamesynchronized = 55, >- TokenNamethis = 42, >- TokenNamethrow = 82, >- TokenNamethrows = 105, >- TokenNametransient = 63, >- TokenNametrue = 46, >- TokenNametry = 83, >- TokenNamevoid = 40, >- TokenNamevolatile = 64, >+ TokenNameif = 80, >+ TokenNameimplements = 107, >+ TokenNameimport = 101, >+ TokenNameinstanceof = 13, >+ TokenNameint = 49, >+ TokenNameinterface = 85, >+ TokenNamelong = 50, >+ TokenNamenative = 35, >+ TokenNamenew = 55, >+ TokenNamenull = 57, >+ TokenNamepackage = 86, >+ TokenNameprivate = 36, >+ TokenNameprotected = 37, >+ TokenNamepublic = 38, >+ TokenNamereturn = 81, >+ TokenNameshort = 51, >+ TokenNamestatic = 32, >+ TokenNamestrictfp = 39, >+ TokenNamesuper = 53, >+ TokenNameswitch = 82, >+ TokenNamesynchronized = 40, >+ TokenNamethis = 54, >+ TokenNamethrow = 83, >+ TokenNamethrows = 106, >+ TokenNametransient = 41, >+ TokenNametrue = 58, >+ TokenNametry = 84, >+ TokenNamevoid = 52, >+ TokenNamevolatile = 42, > TokenNamewhile = 73, >- TokenNameIntegerLiteral = 47, >- TokenNameLongLiteral = 48, >- TokenNameFloatingPointLiteral = 49, >- TokenNameDoubleLiteral = 50, >- TokenNameCharacterLiteral = 51, >- TokenNameStringLiteral = 52, >- TokenNamePLUS_PLUS = 8, >- TokenNameMINUS_MINUS = 9, >+ TokenNameIntegerLiteral = 59, >+ TokenNameLongLiteral = 60, >+ TokenNameFloatingPointLiteral = 61, >+ TokenNameDoubleLiteral = 62, >+ TokenNameCharacterLiteral = 63, >+ TokenNameStringLiteral = 64, >+ TokenNamePLUS_PLUS = 9, >+ TokenNameMINUS_MINUS = 10, > TokenNameEQUAL_EQUAL = 18, > TokenNameLESS_EQUAL = 15, > TokenNameGREATER_EQUAL = 16, > TokenNameNOT_EQUAL = 19, > TokenNameLEFT_SHIFT = 17, >- TokenNameRIGHT_SHIFT = 10, >- TokenNameUNSIGNED_RIGHT_SHIFT = 11, >- TokenNamePLUS_EQUAL = 84, >- TokenNameMINUS_EQUAL = 85, >- TokenNameMULTIPLY_EQUAL = 86, >- TokenNameDIVIDE_EQUAL = 87, >- TokenNameAND_EQUAL = 88, >- TokenNameOR_EQUAL = 89, >- TokenNameXOR_EQUAL = 90, >- TokenNameREMAINDER_EQUAL = 91, >- TokenNameLEFT_SHIFT_EQUAL = 92, >- TokenNameRIGHT_SHIFT_EQUAL = 93, >- TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 94, >- TokenNameOR_OR = 25, >- TokenNameAND_AND = 24, >+ TokenNameRIGHT_SHIFT = 11, >+ TokenNameUNSIGNED_RIGHT_SHIFT = 12, >+ TokenNamePLUS_EQUAL = 89, >+ TokenNameMINUS_EQUAL = 90, >+ TokenNameMULTIPLY_EQUAL = 91, >+ TokenNameDIVIDE_EQUAL = 92, >+ TokenNameAND_EQUAL = 93, >+ TokenNameOR_EQUAL = 94, >+ TokenNameXOR_EQUAL = 95, >+ TokenNameREMAINDER_EQUAL = 96, >+ TokenNameLEFT_SHIFT_EQUAL = 97, >+ TokenNameRIGHT_SHIFT_EQUAL = 98, >+ TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 99, >+ TokenNameOR_OR = 27, >+ TokenNameAND_AND = 26, > TokenNamePLUS = 1, > TokenNameMINUS = 2, >- TokenNameNOT = 66, >+ TokenNameNOT = 67, > TokenNameREMAINDER = 5, >- TokenNameXOR = 21, >+ TokenNameXOR = 22, > TokenNameAND = 20, > TokenNameMULTIPLY = 4, >- TokenNameOR = 22, >- TokenNameTWIDDLE = 67, >+ TokenNameOR = 24, >+ TokenNameTWIDDLE = 68, > TokenNameDIVIDE = 6, >- TokenNameGREATER = 13, >+ TokenNameGREATER = 14, > TokenNameLESS = 7, >- TokenNameLPAREN = 28, >- TokenNameRPAREN = 29, >- TokenNameLBRACE = 68, >- TokenNameRBRACE = 31, >- TokenNameLBRACKET = 14, >+ TokenNameLPAREN = 29, >+ TokenNameRPAREN = 30, >+ TokenNameLBRACE = 69, >+ TokenNameRBRACE = 43, >+ TokenNameLBRACKET = 8, > TokenNameRBRACKET = 70, >- TokenNameSEMICOLON = 27, >- TokenNameQUESTION = 23, >+ TokenNameSEMICOLON = 28, >+ TokenNameQUESTION = 25, > TokenNameCOLON = 65, >- TokenNameCOMMA = 30, >+ TokenNameCOMMA = 31, > TokenNameDOT = 3, >- TokenNameEQUAL = 71, >- TokenNameAT = 53, >- TokenNameELLIPSIS = 107, >- TokenNameEOF = 69, >+ TokenNameEQUAL = 74, >+ TokenNameAT = 21, >+ TokenNameELLIPSIS = 72, >+ TokenNameEOF = 66, > TokenNameERROR = 110; > } >Index: compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java,v >retrieving revision 1.32 >diff -u -r1.32 DiagnoseParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java 16 Jul 2008 09:46:50 -0000 1.32 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java 20 Jan 2011 21:55:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -15,6 +15,7 @@ > 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; >@@ -780,8 +781,8 @@ > } > > // >- // 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, >@@ -797,6 +798,24 @@ > 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. (TODO(Ayush): Investigate scopeTrial's choice) >+ 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; >+ } > } > > // >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.430 >diff -u -r1.430 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 16 Jan 2011 22:43:21 -0000 1.430 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 20 Jan 2011 21:55:27 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -2410,6 +2410,14 @@ > 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( >@@ -3784,14 +3792,6 @@ > expression.sourceStart, > expression.sourceEnd); > } >-public void invalidTypeReference(Expression expression) { >- this.handle( >- IProblem.InvalidTypeExpression, >- NoArgument, >- NoArgument, >- expression.sourceStart, >- expression.sourceEnd); >-} > public void invalidTypeToSynchronize(Expression expression, TypeBinding type) { > this.handle( > IProblem.InvalidTypeToSynchronized, >@@ -3923,77 +3923,13 @@ > end); > } > private boolean isIdentifier(int token) { >- return token == TerminalTokens.TokenNameIdentifier; >+ return Scanner.isIdentifier(token); > } > private boolean isKeyword(int token) { >- switch(token) { >- case TerminalTokens.TokenNameabstract: >- case TerminalTokens.TokenNameassert: >- case TerminalTokens.TokenNamebyte: >- case TerminalTokens.TokenNamebreak: >- case TerminalTokens.TokenNameboolean: >- case TerminalTokens.TokenNamecase: >- case TerminalTokens.TokenNamechar: >- case TerminalTokens.TokenNamecatch: >- case TerminalTokens.TokenNameclass: >- case TerminalTokens.TokenNamecontinue: >- case TerminalTokens.TokenNamedo: >- case TerminalTokens.TokenNamedouble: >- case TerminalTokens.TokenNamedefault: >- case TerminalTokens.TokenNameelse: >- case TerminalTokens.TokenNameextends: >- case TerminalTokens.TokenNamefor: >- case TerminalTokens.TokenNamefinal: >- case TerminalTokens.TokenNamefloat: >- case TerminalTokens.TokenNamefalse: >- case TerminalTokens.TokenNamefinally: >- case TerminalTokens.TokenNameif: >- case TerminalTokens.TokenNameint: >- case TerminalTokens.TokenNameimport: >- case TerminalTokens.TokenNameinterface: >- case TerminalTokens.TokenNameimplements: >- case TerminalTokens.TokenNameinstanceof: >- case TerminalTokens.TokenNamelong: >- case TerminalTokens.TokenNamenew: >- case TerminalTokens.TokenNamenull: >- case TerminalTokens.TokenNamenative: >- case TerminalTokens.TokenNamepublic: >- case TerminalTokens.TokenNamepackage: >- case TerminalTokens.TokenNameprivate: >- case TerminalTokens.TokenNameprotected: >- case TerminalTokens.TokenNamereturn: >- case TerminalTokens.TokenNameshort: >- case TerminalTokens.TokenNamesuper: >- case TerminalTokens.TokenNamestatic: >- case TerminalTokens.TokenNameswitch: >- case TerminalTokens.TokenNamestrictfp: >- case TerminalTokens.TokenNamesynchronized: >- case TerminalTokens.TokenNametry: >- case TerminalTokens.TokenNamethis: >- case TerminalTokens.TokenNametrue: >- case TerminalTokens.TokenNamethrow: >- case TerminalTokens.TokenNamethrows: >- case TerminalTokens.TokenNametransient: >- case TerminalTokens.TokenNamevoid: >- case TerminalTokens.TokenNamevolatile: >- case TerminalTokens.TokenNamewhile: >- return true; >- default: >- return false; >- } >+ return Scanner.isKeyword(token); > } > private boolean isLiteral(int token) { >- switch(token) { >- case TerminalTokens.TokenNameIntegerLiteral: >- case TerminalTokens.TokenNameLongLiteral: >- case TerminalTokens.TokenNameFloatingPointLiteral: >- case TerminalTokens.TokenNameDoubleLiteral: >- case TerminalTokens.TokenNameStringLiteral: >- case TerminalTokens.TokenNameCharacterLiteral: >- return true; >- default: >- return false; >- } >+ return Scanner.isLiteral(token); > } > > private boolean isRecoveredName(char[] simpleName) { >@@ -6297,13 +6233,15 @@ > flag = IProblem.EndOfSource; > else if (errorTokenName.equals(Scanner.INVALID_HEXA)) > flag = IProblem.InvalidHexa; >+ else if (errorTokenName.equals(Scanner.ILLEGAL_HEXA_LITERAL)) >+ flag = IProblem.IllegalHexaLiteral; > else if (errorTokenName.equals(Scanner.INVALID_OCTAL)) > flag = IProblem.InvalidOctal; > else if (errorTokenName.equals(Scanner.INVALID_CHARACTER_CONSTANT)) > flag = IProblem.InvalidCharacterConstant; > else if (errorTokenName.equals(Scanner.INVALID_ESCAPE)) > flag = IProblem.InvalidEscape; >- else if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)){ >+ else if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)) { > flag = IProblem.InvalidUnicodeEscape; > // better locate the error message > char[] source = scanner.source; >@@ -6336,6 +6274,24 @@ > flag = IProblem.UnterminatedString; > else if (errorTokenName.equals(Scanner.INVALID_DIGIT)) > flag = IProblem.InvalidDigit; >+ else if (errorTokenName.equals(Scanner.INVALID_BINARY)) >+ flag = IProblem.InvalidBinary; >+ else if (errorTokenName.equals(Scanner.ILLEGAL_BINARY_LITERAL)) >+ flag = IProblem.IllegalBinaryLiteral; >+ else if (errorTokenName.equals(Scanner.INVALID_UNDERSCORE)) >+ flag = IProblem.IllegalUnderscorePosition; >+ else if (errorTokenName.equals(Scanner.INVALID_USAGE_OF_UNDERSCORE)) >+ flag = IProblem.IllegalUsageOfUnderscore; >+ else if (errorTokenName.equals(Scanner.UNTERMINATED_EXOTIC_IDENTIFIER)) >+ flag = IProblem.UnterminatedExoticIdentifier; >+ else if (errorTokenName.equals(Scanner.INVALID_CHAR_IN_EXOTIC_IDENTIFIER)) >+ flag = IProblem.UnterminatedExoticIdentifier; >+ else if (errorTokenName.equals(Scanner.INVALID_EMPTY_EXOTIC_IDENTIFIER)) >+ flag = IProblem.InvalidEmptyExoticIdentifier; >+ else if (errorTokenName.equals(Scanner.ILLEGAL_DANGEROUS_CHARACTER)) >+ flag = IProblem.IllegalDangerousCharacter; >+ else if (errorTokenName.equals(Scanner.ILLEGAL_EXOTIC_IDENTIFIER)) >+ flag = IProblem.IllegalExoticIdentifier; > > String[] arguments = flag == IProblem.ParsingErrorNoSuggestion > ? new String[] {errorTokenName} >@@ -7617,4 +7573,37 @@ > typeRef.sourceStart, > typeRef.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); >+} > } >Index: compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties,v >retrieving revision 1.262 >diff -u -r1.262 messages.properties >--- compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 16 Jan 2011 22:43:21 -0000 1.262 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 20 Jan 2011 21:55:28 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2010 IBM Corporation and others. >+# Copyright (c) 2000, 2011 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 >@@ -213,7 +213,7 @@ > 242 = Syntax error, insert "{0}" to complete phrase > > 250 = Unexpected end of file >-251 = Invalid hex literal number >+251 = Invalid hexadecimal floating point literal number > 252 = Invalid octal literal number > 253 = Invalid character constant > 254 = Invalid escape sequence (valid ones are \\b \\t \\n \\f \\r \\" \\' \\\\ ) >@@ -228,6 +228,15 @@ > 263 = Invalid low surrogate: must be within 0xDC00 and 0xDFFF > 264 = Invalid high surrogate: must be within 0xD800 and 0xDBFF > 265 = Unnecessary $NON-NLS$ tag >+266 = Invalid binary literal number (only '0' and '1' are expected) >+267 = Binary literals can only be used with source level greater or equals to 1.7 >+268 = Underscores have to be located within digits >+269 = Underscores can only be used with source level greater or equals to 1.7 >+270 = Hexadecimal floating point literals can only be used with source level greater or equals to 1.5 >+271 = Exotic identifier is not properly closed by a double-quote >+272 = Exotic identifier cannot be empty >+273 = Invalid dangerous character (/ . ; < > [ ]). They must be escaped >+274 = Exotic identifiers can only be used with compliance level greater or equals to 1.7 > > 280 = Discouraged access: {0} > >@@ -568,7 +577,11 @@ > 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.7 >+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 > ### MORE GENERICS > 660 = Unused type arguments for the non generic constructor {0}({1}) of type {2}; it should not be parameterized with arguments <{3}> > >Index: dom/org/eclipse/jdt/core/dom/AST.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java,v >retrieving revision 1.167 >diff -u -r1.167 AST.java >--- dom/org/eclipse/jdt/core/dom/AST.java 31 Aug 2010 20:09:04 -0000 1.167 >+++ dom/org/eclipse/jdt/core/dom/AST.java 20 Jan 2011 21:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -131,6 +131,20 @@ > public static final int JLS3 = 3; > > /** >+ * Constant for indicating the AST API that handles JLS3 + JDK 7 construct. >+ * This API is capable of handling all constructs in the >+ * Java language as described in the Java Language >+ * Specification, Third Edition (JLS3) + new JDK 7 syntax. >+ * JLS3 is a superset of all earlier versions of the >+ * Java language, and the JLS3 API can be used to manipulate >+ * programs written in all versions of the Java language >+ * up to and including J2SE 7 (aka JDK 1.7). >+ * >+ * @since 3.7 >+ */ >+ public static final int JLS4 = 4; >+ >+ /** > * The binding resolver for this AST. Initially a binding resolver that > * does not resolve names at all. > */ >@@ -206,9 +220,14 @@ > * @since 3.0 > */ > private AST(int level) { >- if ((level != AST.JLS2) >- && (level != AST.JLS3)) { >- throw new IllegalArgumentException(); >+ switch(level) { >+ case AST.JLS2 : >+ case AST.JLS3 : >+ case AST.JLS4 : >+ // legal values >+ break; >+ default: >+ throw new IllegalArgumentException(); > } > this.apiLevel = level; > // initialize a scanner >@@ -216,8 +235,8 @@ > true /*comment*/, > true /*whitespace*/, > false /*nls*/, >- ClassFileConstants.JDK1_3 /*sourceLevel*/, >- ClassFileConstants.JDK1_5 /*complianceLevel*/, >+ level == AST.JLS4 ? ClassFileConstants.JDK1_7 : ClassFileConstants.JDK1_3 /*sourceLevel*/, >+ level == AST.JLS4 ? ClassFileConstants.JDK1_7 : ClassFileConstants.JDK1_5 /*complianceLevel*/, > null/*taskTag*/, > null/*taskPriorities*/, > true/*taskCaseSensitive*/); >@@ -370,8 +389,8 @@ > * Creates a new Java abstract syntax tree > * (AST) following the specified set of API rules. > * <p> >- * Clients should use this method specifing {@link #JLS3} as the >- * AST level in all cases, even when dealing with JDK 1.3 or 1.4.. >+ * Clients should use this method specifying {@link #JLS3} as the >+ * AST level in all cases, even when dealing with JDK 1.3 or 1.4. > * </p> > * > * @param level the API level; one of the LEVEL constants >@@ -383,11 +402,14 @@ > * @since 3.0 > */ > public static AST newAST(int level) { >- if ((level != AST.JLS2) >- && (level != AST.JLS3)) { >- throw new IllegalArgumentException(); >+ switch(level) { >+ case AST.JLS2 : >+ case AST.JLS3 : >+ case AST.JLS4 : >+ return new AST(level); >+ default: >+ throw new IllegalArgumentException(); > } >- return new AST(level); > } > > /** >Index: dom/org/eclipse/jdt/core/dom/ASTParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java,v >retrieving revision 1.102 >diff -u -r1.102 ASTParser.java >--- dom/org/eclipse/jdt/core/dom/ASTParser.java 1 Jun 2010 15:15:32 -0000 1.102 >+++ dom/org/eclipse/jdt/core/dom/ASTParser.java 20 Jan 2011 21:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2010 IBM Corporation and others. >+ * Copyright (c) 2004, 2011 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 >@@ -217,9 +217,13 @@ > * declared on <code>AST</code> > */ > ASTParser(int level) { >- if ((level != AST.JLS2_INTERNAL) >- && (level != AST.JLS3)) { >- throw new IllegalArgumentException(); >+ switch(level) { >+ case AST.JLS2_INTERNAL : >+ case AST.JLS3 : >+ case AST.JLS4 : >+ break; >+ default: >+ throw new IllegalArgumentException(); > } > this.apiLevel = level; > initializeDefaults(); >Index: dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java,v >retrieving revision 1.10 >diff -u -r1.10 ASTRecoveryPropagator.java >--- dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java 27 Jun 2008 16:03:49 -0000 1.10 >+++ dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java 20 Jan 2011 21:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2008 IBM Corporation and others. >+ * Copyright (c) 2006, 2011 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 >@@ -126,6 +126,52 @@ > } > > public void endVisit(Block node) { >+ int level = node.getAST().apiLevel; >+ >+ List statements = node.statements(); >+ next : for (int i = 0, max = statements.size(); i < max; i++) { >+ ASTNode statement = (ASTNode) statements.get(i); >+ if (statement.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT) { >+ VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement; >+ >+ if (level == AST.JLS2_INTERNAL) { >+ if (variableDeclarationStatement.getModifiers() != Modifier.NONE) { >+ continue next; >+ } >+ } else if (level >= AST.JLS3) { >+ if (variableDeclarationStatement.modifiers().size() != 0) { >+ continue next; >+ } >+ } >+ >+ Type type = variableDeclarationStatement.getType(); >+ if (type.getNodeType() != ASTNode.SIMPLE_TYPE) { >+ continue next; >+ } >+ >+ List fragments = variableDeclarationStatement.fragments(); >+ if (fragments.size() == 1) { >+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); >+ >+ SimpleName simpleName = fragment.getName(); >+ if (CharOperation.equals(RecoveryScanner.FAKE_IDENTIFIER, simpleName.getIdentifier().toCharArray())) { >+ SimpleType simpleType = (SimpleType) type; >+ Name name = simpleType.getName(); >+ name.setParent(null, null); >+ name.setFlags(name.getFlags() | ASTNode.RECOVERED); >+ >+ final ExpressionStatement stmt = new ExpressionStatement(name.getAST()); >+ stmt.setExpression(name); >+ stmt.setSourceRange(variableDeclarationStatement.getStartPosition(), variableDeclarationStatement.getLength()); >+ stmt.setFlags(stmt.getFlags() | ASTNode.RECOVERED); >+ >+ statements.add(i, stmt); >+ statements.remove(variableDeclarationStatement); >+ } >+ } >+ } >+ } >+ > this.blockDepth--; > if(this.blockDepth <= 0) { > flagNodeWithInsertedTokens(); >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java,v >retrieving revision 1.42 >diff -u -r1.42 CodeSnippetAllocationExpression.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java 4 Jan 2010 19:20:00 -0000 1.42 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java 20 Jan 2011 21:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -46,7 +46,7 @@ > ReferenceBinding allocatedType = codegenBinding.declaringClass; > > if (codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) { >- codeStream.new_(allocatedType); >+ codeStream.new_(this.type, allocatedType); > if (valueRequired) { > codeStream.dup(); > } >@@ -83,7 +83,7 @@ > if (this.arguments != null) { > int argsLength = this.arguments.length; > codeStream.generateInlinedValue(argsLength); >- codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); >+ codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); > codeStream.dup(); > for (int i = 0; i < argsLength; i++) { > codeStream.generateInlinedValue(i); >@@ -99,7 +99,7 @@ > } > } else { > codeStream.generateInlinedValue(0); >- codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); >+ codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); > } > codeStream.invokeJavaLangReflectConstructorNewInstance(); > codeStream.checkcast(allocatedType); >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java,v >retrieving revision 1.56 >diff -u -r1.56 CodeSnippetClassFile.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java 7 Jan 2010 20:17:47 -0000 1.56 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java 20 Jan 2011 21:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -19,6 +19,7 @@ > import org.eclipse.jdt.internal.compiler.codegen.CodeStream; > import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; > import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream; >+import org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream; > import org.eclipse.jdt.internal.compiler.lookup.Binding; > import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; > import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; >@@ -115,8 +116,13 @@ > this.produceAttributes = this.referenceBinding.scope.compilerOptions().produceDebugAttributes; > this.creatingProblemType = creatingProblemType; > if (this.targetJDK >= ClassFileConstants.JDK1_6) { >- this.codeStream = new StackMapFrameCodeStream(this); > this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE; >+ if (this.targetJDK >= ClassFileConstants.JDK1_7) { >+ this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION; >+ this.codeStream = new TypeAnnotationCodeStream(this); >+ } else { >+ this.codeStream = new StackMapFrameCodeStream(this); >+ } > } else if (this.targetJDK == ClassFileConstants.CLDC_1_1) { > this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3 > this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP; >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java,v >retrieving revision 1.63 >diff -u -r1.63 CodeSnippetMessageSend.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 5 Feb 2009 09:38:11 -0000 1.63 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 20 Jan 2011 21:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -111,7 +111,7 @@ > if (this.arguments != null) { > int argsLength = this.arguments.length; > codeStream.generateInlinedValue(argsLength); >- codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); >+ codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); > codeStream.dup(); > for (int i = 0; i < argsLength; i++) { > codeStream.generateInlinedValue(i); >@@ -127,7 +127,7 @@ > } > } else { > codeStream.generateInlinedValue(0); >- codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); >+ codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1)); > } > codeStream.invokeJavaLangReflectMethodInvoke(); > >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java,v >retrieving revision 1.72 >diff -u -r1.72 CodeSnippetParser.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java 29 Jan 2010 15:51:49 -0000 1.72 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java 20 Jan 2011 21:55:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -790,6 +790,9 @@ > > // reset stacks in consistent state > this.expressionPtr = -1; >+ this.unattachedAnnotationPtr = -1; >+ this.typeAnnotationLengthPtr = -1; >+ this.typeAnnotationPtr = -1; > this.identifierPtr = -1; > this.identifierLengthPtr = -1; > >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java,v >retrieving revision 1.36 >diff -u -r1.36 CodeSnippetReturnStatement.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java 5 Feb 2009 09:38:11 -0000 1.36 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java 20 Jan 2011 21:55:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -63,7 +63,7 @@ > codeStream.aconst_null(); > > // void.class >- codeStream.generateClassLiteralAccessForType(TypeBinding.VOID, null); >+ codeStream.generateClassLiteralAccessForType(null, TypeBinding.VOID, null); > } else { > // swap with expression > int valueTypeID = this.expression.resolvedType.id; >@@ -80,7 +80,7 @@ > } > > // generate the expression type >- codeStream.generateClassLiteralAccessForType(this.expression.resolvedType, null); >+ codeStream.generateClassLiteralAccessForType(null, this.expression.resolvedType, null); > } > > // generate the invoke virtual to "setResult(Object,Class)" >Index: grammar/java.g >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/grammar/java.g,v >retrieving revision 1.11 >diff -u -r1.11 java.g >--- grammar/java.g 7 Jul 2010 05:56:10 -0000 1.11 >+++ grammar/java.g 20 Jan 2011 21:55:30 -0000 >@@ -177,9 +177,8 @@ > Goal ::= '>>' StaticInitializer > Goal ::= '>>' Initializer > -- error recovery >--- Modifiersopt is used to properly consume a header and exit the rule reduction at the end of the parse() method >-Goal ::= '>>>' Header1 Modifiersopt >-Goal ::= '!' Header2 Modifiersopt >+Goal ::= '>>>' Header1 RecoveryExitHeader >+Goal ::= '!' Header2 RecoveryExitHeader > Goal ::= '*' BlockStatements > Goal ::= '*' CatchHeader > -- JDOM >@@ -200,6 +199,9 @@ > Goal ::= '?' AnnotationTypeMemberDeclaration > /:$readableName Goal:/ > >+RecoveryExitHeader ::= $empty >+RecoveryExitHeader ::= '...' >+ > Literal -> IntegerLiteral > Literal -> LongLiteral > Literal -> FloatingPointLiteral >@@ -213,9 +215,37 @@ > BooleanLiteral -> false > /:$readableName BooleanLiteral:/ > >-Type ::= PrimitiveType >+-- Type is a wrapper that automatically allows for jsr308 style >+-- annotations to prefix a (Java5/6) Type. If type annotations >+-- are illegal in a certain place, use TypeInternal instead. >+-- If type annotations are legal, but so are java5/6 style >+-- declaration annotations, use Type0 instead. >+ >+Type ::= TypeInternal >+-- consumeUnannotatedType inserts 0 at the suitable place in the type >+-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right >+-- length of the type annotations 0 or otherwise. >+/.$putCase consumeUnannotatedType(); $break ./ >+Type ::= TypeAnnotations TypeInternal >+/:$compliance 1.7:/ >+/:$readableName Type:/ >+ >+-- Type0 is to be used in places where type annotations are legal >+-- but are not consumed as TypeAnnotations, but as modifiers. This >+-- is because from the parser's point of view there are places where >+-- java5/6 style declarations annotations can occur in the same place >+-- and it is too early to tell which is which. >+Type0 ::= TypeInternal >+-- consumeUnannotatedType inserts 0 at the suitable place in the type >+-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right >+-- length of the type annotations 0 or otherwise. >+/.$putCase consumeUnannotatedType(); $break ./ >+/:$readableName Type:/ >+ >+-- TypeInternal is the Java5/6 Type >+TypeInternal ::= PrimitiveType > /.$putCase consumePrimitiveType(); $break ./ >-Type -> ReferenceType >+TypeInternal -> ReferenceType0 > /:$readableName Type:/ > > PrimitiveType -> NumericType >@@ -236,28 +266,73 @@ > FloatingPointType -> 'double' > /:$readableName FloatingPointType:/ > >-ReferenceType ::= ClassOrInterfaceType >+---------------------------- JSR308------------------------------------------- >+-- ReferenceType has been wrapped now, so that it can be used by itself without >+-- having to spell out the rule once with Modifiers & once without. >+-- If type annotations are not legal prefixes to ReferenceType at some point, use >+-- ReferenceType0 instead. Otherwise reject the annotations in the parser. >+ >+ReferenceType ::= ReferenceType0 >+-- consumeUnannotatedType inserts 0 at the suitable place in the type >+-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right >+-- length of the type annotations 0 or otherwise. >+/.$putCase consumeUnannotatedType(); $break ./ >+ReferenceType ::= Modifiers ReferenceType0 >+/.$putCase consumeAnnotatedType(); $break ./ >+/:$compliance 1.7:/ >+/:$readableName ReferenceType:/ >+ >+ReferenceType0 ::= ClassOrInterfaceType0 > /.$putCase consumeReferenceType(); $break ./ >-ReferenceType -> ArrayType >+ReferenceType0 -> ArrayType > /:$readableName ReferenceType:/ > >---------------------------------------------------------------- >--- 1.5 feature >---------------------------------------------------------------- >-ClassOrInterfaceType -> ClassOrInterface >-ClassOrInterfaceType -> GenericType >+Annotationsopt ::= $empty >+/.$putCase consumeZeroTypeAnnotations(true); $break ./ >+Annotationsopt -> TypeAnnotations >+/:$compliance 1.7:/ >+/:$readableName Annotationsopt:/ >+ >+-- ClassOrInterfaceType has now been wrapped so that it automatically includes >+-- JSR308 style optional annotations. Use ClassOrInterfaceType0 if annotations >+-- are illegal in some place - otherwise reject the annotations in the parser. >+ClassOrInterfaceType ::= Annotationsopt ClassOrInterfaceType0 >+/:$readableName Type:/ >+ >+ClassOrInterfaceType0 -> ClassOrInterface0 >+ClassOrInterfaceType0 -> GenericType > /:$readableName Type:/ >+---------------------------- JSR308------------------------------------------- >+ >+-- ClassOrInterface has been wrapped now so that it ALWAYS PUSHES >+-- A 0 IN THE TYPE ANNOTATIONS LENGTH STACK. If this behavior is >+-- not desirable, then (a) use ClassOrInterface0 if possible or (b) >+-- if that is not possible due to conflicts, then this 0 will have >+-- to be popped suitably when erroneous/extraneous. See the use of >+-- the production PopZeroTypeAnnotations for examples. > >-ClassOrInterface ::= Name >+ClassOrInterface ::= ClassOrInterface0 >+/.$putCase consumeZeroTypeAnnotations(true); $break ./ >+/:$readableName Type:/ >+ >+ClassOrInterface0 ::= Name > /.$putCase consumeClassOrInterfaceName(); $break ./ >-ClassOrInterface ::= GenericType '.' Name >-/.$putCase consumeClassOrInterface(); $break ./ >+ClassOrInterface0 ::= GenericTypeDotName > /:$readableName Type:/ > >-GenericType ::= ClassOrInterface TypeArguments >+PopZeroTypeAnnotations ::= $empty >+/.$putCase consumeZeroTypeAnnotations(false); $break ./ >+/:$readableName PopZeroTypeAnnotations:/ >+ >+GenericType ::= ClassOrInterface TypeArguments PopZeroTypeAnnotations > /.$putCase consumeGenericType(); $break ./ >+/:$compliance 1.5:/ > /:$readableName GenericType:/ > >+GenericTypeDotName ::= GenericType '.' Name >+/.$putCase consumeClassOrInterface(); $break ./ >+/:$readableName GenericTypeDotName:/ >+ > -- > -- These rules have been rewritten to avoid some conflicts introduced > -- by adding the 1.1 features >@@ -267,8 +342,7 @@ > -- ArrayType ::= ArrayType '[' ']' > -- > >-ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name >-/.$putCase consumeArrayTypeWithTypeArgumentsName(); $break ./ >+ArrayTypeWithTypeArgumentsName ::= GenericTypeDotName > /:$readableName ArrayTypeWithTypeArgumentsName:/ > > ArrayType ::= PrimitiveType Dims >@@ -347,9 +421,13 @@ > /:$readableName Header1:/ > > Header2 -> Header >-Header2 -> EnumConstantHeader >+Header2 -> EnumConstantHeader RecoveryEnumConstantSeparatoropt > /:$readableName Header2:/ > >+RecoveryEnumConstantSeparatoropt ::= $empty >+RecoveryEnumConstantSeparatoropt ::= ',' >+RecoveryEnumConstantSeparatoropt ::= ';' >+ > CatchHeader ::= 'catch' '(' FormalParameter ')' '{' > /.$putCase consumeCatchHeader(); $break ./ > /:$readableName CatchHeader:/ >@@ -548,7 +626,7 @@ > -- | 'transient' > -- | 'volatile' > >-FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';' >+FieldDeclaration ::= Modifiersopt Type0 VariableDeclarators ';' > /.$putCase consumeFieldDeclaration(); $break ./ > /:$readableName FieldDeclaration:/ > >@@ -556,6 +634,7 @@ > VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator > /.$putCase consumeVariableDeclarators(); $break ./ > /:$readableName VariableDeclarators:/ >+/:$recovery_template Identifier:/ > > VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization > VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization >@@ -619,7 +698,7 @@ > > MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' > /.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./ >-MethodHeaderName ::= Modifiersopt Type 'Identifier' '(' >+MethodHeaderName ::= Modifiersopt Type0 'Identifier' '(' > /.$putCase consumeMethodHeaderName(false); $break ./ > /:$readableName MethodHeaderName:/ > >@@ -628,7 +707,7 @@ > /:$readableName ):/ > /:$recovery_template ):/ > >-MethodHeaderExtendedDims ::= Dimsopt >+MethodHeaderExtendedDims ::= DimsoptAnnotsopt > /.$putCase consumeMethodHeaderExtendedDims(); $break ./ > /:$readableName MethodHeaderExtendedDims:/ > >@@ -636,7 +715,7 @@ > /.$putCase consumeMethodHeaderThrowsClause(); $break ./ > /:$readableName MethodHeaderThrowsClause:/ > >-ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderThrowsClauseopt >+ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen Annotationsopt MethodHeaderThrowsClauseopt > /.$putCase consumeConstructorHeader(); $break ./ > /:$readableName ConstructorDeclaration:/ > >@@ -651,10 +730,33 @@ > /.$putCase consumeFormalParameterList(); $break ./ > /:$readableName FormalParameterList:/ > >+PotentialNameArray -> $empty >+/.$putCase consumePotentialNameArrayType(); $break ./ >+/:$readableName PotentialNameArray:/ >+ > --1.1 feature >-FormalParameter ::= Modifiersopt Type VariableDeclaratorId >+--FormalParameter ::= Modifiersopt Type VariableDeclaratorId >+--FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId >+--The above rules have been rewritten by inlinng the type subgrammar >+--to avoid the conflicts resulting from jsr308 changes. >+FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt VariableDeclaratorId >+/.$putCase consumeFormalParameter(false); $break ./ >+FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt '...' VariableDeclaratorId >+/.$putCase consumeFormalParameter(true); $break ./ >+/:$compliance 1.5:/ >+FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorId >+/.$putCase consumeFormalParameter(false); $break ./ >+FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorId >+/.$putCase consumeFormalParameter(true); $break ./ >+/:$compliance 1.5:/ >+FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt VariableDeclaratorId >+/.$putCase consumeFormalParameter(false); $break ./ >+FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt '...' VariableDeclaratorId >+/.$putCase consumeFormalParameter(true); $break ./ >+/:$compliance 1.5:/ >+FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt VariableDeclaratorId > /.$putCase consumeFormalParameter(false); $break ./ >-FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId >+FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt '...' VariableDeclaratorId > /.$putCase consumeFormalParameter(true); $break ./ > /:$readableName FormalParameter:/ > /:$compliance 1.5:/ >@@ -808,7 +910,6 @@ > InvalidInitializer -> Initializer > /:$readableName InvalidInitializer:/ > >- > InterfaceMemberDeclaration -> AbstractMethodDeclaration > InterfaceMemberDeclaration -> InvalidConstructorDeclaration > InterfaceMemberDeclaration -> InvalidInitializer >@@ -872,13 +973,13 @@ > /.$putCase consumeLocalVariableDeclarationStatement(); $break ./ > /:$readableName LocalVariableDeclarationStatement:/ > >-LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators >+LocalVariableDeclaration ::= Type0 PushModifiers VariableDeclarators > /.$putCase consumeLocalVariableDeclaration(); $break ./ > -- 1.1 feature > -- The modifiers part of this rule makes the grammar more permissive. > -- The only modifier here is final. We put Modifiers to allow multiple modifiers > -- This will require to check the validity of the modifier >-LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators >+LocalVariableDeclaration ::= Modifiers Type0 PushRealModifiers VariableDeclarators > /.$putCase consumeLocalVariableDeclaration(); $break ./ > /:$readableName LocalVariableDeclaration:/ > >@@ -1115,10 +1216,27 @@ > /.$putCase consumeLeftParen(); $break ./ > /:$readableName (:/ > /:$recovery_template (:/ >+PushRPARENForUnannotatedTypeCast ::= ')' >+/.$putCase consumeRightParenForUnannotatedTypeCast(); $break ./ >+/:$readableName ):/ >+/:$recovery_template ):/ >+PushRPARENForNameUnannotatedTypeCast ::= ')' >+/.$putCase consumeRightParenForNameUnannotatedTypeCast(); $break ./ >+/:$readableName ):/ >+/:$recovery_template ):/ > PushRPAREN ::= ')' > /.$putCase consumeRightParen(); $break ./ > /:$readableName ):/ > /:$recovery_template ):/ >+PushRPARENForAnnotatedTypeCast ::= ')' >+/.$putCase consumeRightParenForAnnotatedTypeCast(); $break ./ >+/:$readableName ):/ >+/:$recovery_template ):/ >+ >+PushRPARENForNameAndAnnotatedTypeCast ::= ')' >+/.$putCase consumeRightParenForNameAndAnnotatedTypeCast(); $break ./ >+/:$readableName ):/ >+/:$recovery_template ):/ > > Primary -> PrimaryNoNewArray > Primary -> ArrayCreationWithArrayInitializer >@@ -1138,6 +1256,7 @@ > PrimaryNoNewArray -> ClassInstanceCreationExpression > PrimaryNoNewArray -> FieldAccess > --1.1 feature >+-- javac doesn't permit type annotations here. > PrimaryNoNewArray ::= Name '.' 'this' > /.$putCase consumePrimaryNoNewArrayNameThis(); $break ./ > PrimaryNoNewArray ::= Name '.' 'super' >@@ -1148,6 +1267,22 @@ > --inline Type in the previous rule in order to make the grammar LL1 instead > -- of LL2. The result is the 3 next rules. > >+PrimaryNoNewArray ::= Modifiers Name '.' 'class' >+/.$putCase consumePrimaryNoNewArrayNameWithTypeAnnotations(); $break ./ >+/:$compliance 1.7:/ >+ >+PrimaryNoNewArray ::= Modifiers Name Dims '.' 'class' >+/.$putCase consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations(); $break ./ >+/:$compliance 1.7:/ >+ >+PrimaryNoNewArray ::= Modifiers PrimitiveType Dims '.' 'class' >+/.$putCase consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations(); $break ./ >+/:$compliance 1.7:/ >+ >+PrimaryNoNewArray ::= Modifiers PrimitiveType '.' 'class' >+/.$putCase consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations(); $break ./ >+/:$compliance 1.7:/ >+ > PrimaryNoNewArray ::= Name '.' 'class' > /.$putCase consumePrimaryNoNewArrayName(); $break ./ > >@@ -1224,18 +1359,18 @@ > /.$putCase consumeArgumentList(); $break ./ > /:$readableName ArgumentList:/ > >-ArrayCreationHeader ::= 'new' PrimitiveType DimWithOrWithOutExprs >+-- ArrayCreationHeader is used only in recovery and the consume* method is a NOP. >+ArrayCreationHeader ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs > /.$putCase consumeArrayCreationHeader(); $break ./ >- > ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs > /.$putCase consumeArrayCreationHeader(); $break ./ > /:$readableName ArrayCreationHeader:/ > >-ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs >+ArrayCreationWithoutArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs > /.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./ > /:$readableName ArrayCreationWithoutArrayInitializer:/ > >-ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer >+ArrayCreationWithArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs ArrayInitializer > /.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./ > /:$readableName ArrayCreationWithArrayInitializer:/ > >@@ -1250,12 +1385,46 @@ > /.$putCase consumeDimWithOrWithOutExprs(); $break ./ > /:$readableName Dimensions:/ > >-DimWithOrWithOutExpr ::= '[' Expression ']' >-DimWithOrWithOutExpr ::= '[' ']' >+DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations Expression ']' >+DimWithOrWithOutExpr ::= TypeAnnotations '[' Expression ']' >+/:$compliance 1.7:/ >+DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations ']' > /. $putCase consumeDimWithOrWithOutExpr(); $break ./ >+DimWithOrWithOutExpr ::= TypeAnnotations '[' ']' >+/. $putCase consumeDimWithOrWithOutExpr(); $break ./ >+/:$compliance 1.7:/ > /:$readableName Dimension:/ > -- ----------------------------------------------- > >+-- jsr 308 >+ >+DimsoptAnnotsopt -> $empty >+/. $putCase consumeEmptyDimsoptAnnotsopt(); $break ./ >+/:$readableName AnnotationsDimensionsSequence:/ >+DimsoptAnnotsopt -> DimsAnnotLoop >+/. $putCase consumeDimsWithTrailingAnnotsopt(); $break ./ >+/:$readableName Dimensionsoptannotsopt:/ >+DimsAnnotLoop ::= OneDimOrAnnot >+DimsAnnotLoop ::= DimsAnnotLoop OneDimOrAnnot >+/:$readableName DimsAnnotLoop:/ >+ >+OneDimOrAnnot ::= Annotation >+/. $putCase consumeTypeAnnotation(true); $break ./ >+-- Complain if source level < 1.7 >+/:$compliance 1.7:/ >+OneDimOrAnnot -> '[' ']' >+/. $putCase consumeOneDimLoop(true); $break ./ >+-- Bump up dimensions && mark zero annotations. >+/:$readableName OneDimensionOrAnnotation:/ >+ >+TypeAnnotations ::= Annotation >+/. $putCase consumeTypeAnnotation(false); $break ./ >+/:$compliance 1.7:/ >+TypeAnnotations ::= TypeAnnotations Annotation >+/. $putCase consumeOneMoreTypeAnnotation(); $break ./ >+/:$compliance 1.7:/ >+/:$readableName TypeAnnotations:/ >+ > Dims ::= DimsLoop > /. $putCase consumeDims(); $break ./ > /:$readableName Dimensions:/ >@@ -1263,8 +1432,14 @@ > DimsLoop ::= DimsLoop OneDimLoop > /:$readableName Dimensions:/ > OneDimLoop ::= '[' ']' >-/. $putCase consumeOneDimLoop(); $break ./ >+/. $putCase consumeOneDimLoop(false); $break ./ >+-- Bump up dimensions && mark zero annotations. > /:$readableName Dimension:/ >+OneDimLoop ::= TypeAnnotations '[' ']' >+/:$compliance 1.7:/ >+/. $putCase consumeOneDimLoopWithAnnotations(); $break ./ >+-- Bump up dimensions >+/:$readableName DimensionWithAnnotations:/ > > FieldAccess ::= Primary '.' 'Identifier' > /.$putCase consumeFieldAccess(false); $break ./ >@@ -1345,16 +1520,31 @@ > UnaryExpressionNotPlusMinus -> CastExpression > /:$readableName Expression:/ > >-CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression >+CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpression > /.$putCase consumeCastExpressionWithPrimitiveType(); $break ./ >-CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus >+CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression >+/:$compliance 1.7:/ >+/.$putCase consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations(); $break ./ >+CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus > /.$putCase consumeCastExpressionWithGenericsArray(); $break ./ >-CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus >+CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus >+/:$compliance 1.7:/ >+/.$putCase consumeCastExpressionWithGenericsArrayWithTypeAnnotations(); $break ./ >+CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus > /.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./ >-CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus >+CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpressionWithAnnotatedQualifiedGenerics UnaryExpressionNotPlusMinus >+/:$compliance 1.7:/ >+/.$putCase consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations(); $break ./ >+CastExpression ::= PushLPAREN Name PushRPARENForNameUnannotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus > /.$putCase consumeCastExpressionLL1(); $break ./ >-CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus >+CastExpression ::= PushLPAREN Modifiers Name PushRPARENForNameAndAnnotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus >+/:$compliance 1.7:/ >+/.$putCase consumeCastExpressionLL1WithTypeAnnotations(); $break ./ >+CastExpression ::= PushLPAREN Name Dims PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus > /.$putCase consumeCastExpressionWithNameArray(); $break ./ >+CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus >+/:$compliance 1.7:/ >+/.$putCase consumeCastExpressionWithNameArrayWithTypeAnnotations(); $break ./ > /:$readableName CastExpression:/ > > OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments >@@ -1371,6 +1561,10 @@ > /.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./ > /:$readableName InsideCastExpression:/ > >+InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty >+/.$putCase consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); $break ./ >+/:$readableName InsideCastExpression:/ >+ > MultiplicativeExpression -> UnaryExpression > MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression > /.$putCase consumeBinaryExpression(OperatorIds.MULTIPLY); $break ./ >@@ -1673,11 +1867,11 @@ > /.$putCase consumeEnhancedForStatement(); $break ./ > /:$readableName EnhancedForStatementNoShortIf:/ > >-EnhancedForStatementHeaderInit ::= 'for' '(' Type PushModifiers Identifier Dimsopt >+EnhancedForStatementHeaderInit ::= 'for' '(' Type0 PushModifiers Identifier Dimsopt > /.$putCase consumeEnhancedForStatementHeaderInit(false); $break ./ > /:$readableName EnhancedForStatementHeaderInit:/ > >-EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type PushRealModifiers Identifier Dimsopt >+EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type0 PushRealModifiers Identifier Dimsopt > /.$putCase consumeEnhancedForStatementHeaderInit(true); $break ./ > /:$readableName EnhancedForStatementHeaderInit:/ > >@@ -1752,8 +1946,11 @@ > /:$compliance 1.5:/ > ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2 > /.$putCase consumeTypeArgumentReferenceType1(); $break ./ >-/:$readableName ReferenceType1:/ > /:$compliance 1.5:/ >+ReferenceType1 ::= Modifiers ClassOrInterface '<' TypeArgumentList2 >+/:$compliance 1.7:/ >+/.$putCase consumeTypeArgumentReferenceType1WithTypeAnnotations(); $break ./ >+/:$readableName ReferenceType1:/ > > TypeArgumentList2 -> TypeArgument2 > /:$compliance 1.5:/ >@@ -1773,8 +1970,11 @@ > /:$compliance 1.5:/ > ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3 > /.$putCase consumeTypeArgumentReferenceType2(); $break ./ >-/:$readableName ReferenceType2:/ > /:$compliance 1.5:/ >+ReferenceType2 ::= Modifiers ClassOrInterface '<' TypeArgumentList3 >+/:$compliance 1.7:/ >+/.$putCase consumeTypeArgumentReferenceType2WithTypeAnnotations(); $break ./ >+/:$readableName ReferenceType2:/ > > TypeArgumentList3 -> TypeArgument3 > TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3 >@@ -1856,10 +2056,17 @@ > /:$readableName WildcardBound3:/ > /:$compliance 1.5:/ > >-TypeParameterHeader ::= Identifier >+PushZeroTypeAnnotations ::= $empty >+/.$putCase consumeZeroTypeAnnotations(true); $break ./ >+/:$readableName ZeroTypeAnnotations:/ >+ >+TypeParameterHeader ::= PushZeroTypeAnnotations Identifier > /.$putCase consumeTypeParameterHeader(); $break ./ >-/:$readableName TypeParameter:/ > /:$compliance 1.5:/ >+TypeParameterHeader ::= TypeAnnotations Identifier >+/:$compliance 1.7:/ >+/.$putCase consumeTypeParameterHeader(); $break ./ >+/:$readableName TypeParameter:/ > > TypeParameters ::= '<' TypeParameterList1 > /.$putCase consumeTypeParameters(); $break ./ >@@ -2126,7 +2333,7 @@ > > AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' > /.$putCase consumeMethodHeaderNameWithTypeParameters(true); $break ./ >-AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '(' >+AnnotationMethodHeaderName ::= Modifiersopt Type0 'Identifier' '(' > /.$putCase consumeMethodHeaderName(true); $break ./ > /:$readableName MethodHeaderName:/ > /:$compliance 1.5:/ >@@ -2172,6 +2379,7 @@ > /.$putCase consumeAnnotationName() ; $break ./ > /:$readableName AnnotationName:/ > /:$compliance 1.5:/ >+/:$recovery_template @ Identifier:/ > > NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')' > /.$putCase consumeNormalAnnotation() ; $break ./ >@@ -2269,7 +2477,7 @@ > RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' > /.$putCase consumeRecoveryMethodHeaderNameWithTypeParameters(); $break ./ > /:$compliance 1.5:/ >-RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '(' >+RecoveryMethodHeaderName ::= Modifiersopt Type0 'Identifier' '(' > /.$putCase consumeRecoveryMethodHeaderName(); $break ./ > /:$readableName MethodHeaderName:/ > >@@ -2338,3 +2546,4 @@ > > $end > -- need a carriage return after the $end >+ >Index: model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java,v >retrieving revision 1.15 >diff -u -r1.15 IAttributeNamesConstants.java >--- model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java 27 Jun 2008 16:04:09 -0000 1.15 >+++ model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java 20 Jan 2011 21:55:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -140,4 +140,16 @@ > * @since 3.2 > */ > char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$ >+ >+ /** >+ * "RuntimeVisibleTypeAnnotations" attribute (added in jsr 308). >+ * @since 3.7 >+ */ >+ char[] RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$ >+ >+ /** >+ * "RuntimeInvisibleTypeAnnotations" attribute (added in jsr 308). >+ * @since 3.7 >+ */ >+ char[] RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$ > } >Index: model/org/eclipse/jdt/core/util/IExtendedAnnotation.java >=================================================================== >RCS file: model/org/eclipse/jdt/core/util/IExtendedAnnotation.java >diff -N model/org/eclipse/jdt/core/util/IExtendedAnnotation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/core/util/IExtendedAnnotation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,160 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.util; >+ >+/** >+ * Description of an extended annotation structure as described in the JVM specifications >+ * (added in JavaSE-1.7). >+ * >+ * This interface may be implemented by clients. >+ * >+ * @since 3.7 >+ */ >+public interface IExtendedAnnotation extends IAnnotation { >+ /** >+ * Answer back the target type as described in the JVM specifications. >+ * >+ * @return the target type >+ */ >+ int getTargetType(); >+ >+ /** >+ * Answer back the offset. >+ * >+ * For a target_type value equals to: >+ * <table border="1"> >+ * <tr> >+ * <th>target_type</th> >+ * <th>offset description</th> >+ * </tr> >+ * <tr> >+ * <td>0x00, 0x02, 0x04, 0x1E</td> >+ * <td>The offset within the bytecodes of the containing method of the <code>checkcast</code> >+ * bytecode emitted for a typecast, the <code>instanceof</code> bytecode for the type tests, >+ * the <code>new</code> bytecode emitted for the object creation expression, the <code>ldc(_w)</code> >+ * bytecode emitted for class literal, or the <code>getstatic</code> bytecode emitted for primitive >+ * class literals.</td> >+ * </tr> >+ * <tr> >+ * <td>0x18, 0x1A</td> >+ * <td>The offset within the bytecodes of the containing method of the <code>new</code> >+ * bytecode emitted for a constructor call, or the <code>invoke{interface|special|static|virtual}</code> >+ * bytecode emitted for a method invocation.</td> >+ * </tr> >+ * </table> >+ * >+ * >+ * @return the offset >+ */ >+ int getOffset(); >+ >+ /** >+ * Answer back the local variable reference info table length of this entry as specified in >+ * the JVM specifications. >+ * >+ * <p>This is defined only for annotations related a local variable.</p> >+ * >+ * @return the local variable reference info table length of this entry as specified in >+ * the JVM specifications >+ */ >+ int getLocalVariableRefenceInfoLength(); >+ >+ /** >+ * Answer back the local variable reference info table of this entry as specified in >+ * the JVM specifications. Answer an empty array if none. >+ * >+ * <p>This is defined only for annotations related a local variable.</p> >+ * >+ * @return the local variable reference info table of this entry as specified in >+ * the JVM specifications. Answer an empty array if none >+ */ >+ ILocalVariableReferenceInfo[] getLocalVariableTable(); >+ >+ /** >+ * Answer back the method parameter index. >+ * >+ * <p>The index is 0-based.</p> >+ * >+ * @return the method parameter index >+ */ >+ int getParameterIndex(); >+ >+ /** >+ * Answer back the method type parameter index. >+ * >+ * <p>The index is 0-based.</p> >+ * >+ * @return the method type parameter index >+ */ >+ int getTypeParameterIndex(); >+ >+ /** >+ * Answer back the method type parameter bound index. >+ * >+ * <p>The index is 0-based.</p> >+ * >+ * @return the method type parameter bound index >+ */ >+ int getTypeParameterBoundIndex(); >+ >+ /** >+ * Answer back the index in the given different situations. >+ * >+ * <p>The index is 0-based.</p> >+ * >+ * <table border="1"> >+ * <tr> >+ * <th>target_type</th> >+ * <th>offset description</th> >+ * </tr> >+ * <tr> >+ * <td>0x18, 0x1A</td> >+ * <td>the type argument index in the expression</td> >+ * </tr> >+ * <tr> >+ * <td>0x14</td> >+ * <td>the index of the type in the clause: <code>-1 (255)</code> is used if the annotation is on >+ * the superclass type, and the value <code>i</code> is used if the annotation is on the <code>i</code>th >+ * superinterface type (counting from zero).</td> >+ * </tr> >+ * <tr> >+ * <td>0x16</td> >+ * <td>the index of the exception type in the clause: the value <code>i</code> denotes an annotation of the >+ * <code>i</code>th exception type (counting from zero).</td> >+ * </tr> >+ * </table> >+ * @return the index in the given different situations >+ */ >+ int getAnnotationTypeIndex(); >+ >+ /** >+ * Answer back the target type of the location of the wildcard as described in the JVM specifications. >+ * >+ * @return the target type of the location of the wildcard >+ */ >+ int getWildcardLocationType(); >+ >+ /** >+ * Answer back the locations of the wildcard type as described in the JVM specifications. >+ * >+ * @return the locations of the wildcard type >+ */ >+ int[] getWildcardLocations(); >+ >+ /** >+ * Answer back the locations of the annotated type as described in the JVM specifications. >+ * >+ * <p>This is used for parameterized and array types.</p> >+ * >+ * @return the locations of the annotated type >+ */ >+ int[] getLocations(); >+} >Index: model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java >=================================================================== >RCS file: model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java >diff -N model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.util; >+ >+import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants; >+ >+/** >+ * Description of an extended annotation target types constants as described in the JVM specifications >+ * (added in JavaSE-1.7). >+ * >+ * @since 3.7 >+ * @noimplement This interface is not intended to be implemented by clients. >+ * @noextend This interface is not intended to be extended by clients. >+ */ >+public interface IExtendedAnnotationConstants { >+ int METHOD_RECEIVER = AnnotationTargetTypeConstants.METHOD_RECEIVER; >+ int METHOD_RECEIVER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY; >+ int METHOD_RETURN_TYPE = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE; >+ int METHOD_RETURN_TYPE_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY; >+ int METHOD_PARAMETER = AnnotationTargetTypeConstants.METHOD_PARAMETER; >+ int METHOD_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY; >+ int FIELD = AnnotationTargetTypeConstants.FIELD; >+ int FIELD_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY; >+ int CLASS_TYPE_PARAMETER_BOUND = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND; >+ int CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY; >+ int METHOD_TYPE_PARAMETER_BOUND = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND; >+ int METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY; >+ int CLASS_EXTENDS_IMPLEMENTS = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS; >+ int CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY; >+ int THROWS = AnnotationTargetTypeConstants.THROWS; >+ int THROWS_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY; >+ int WILDCARD_BOUND = AnnotationTargetTypeConstants.WILDCARD_BOUND; >+ int WILDCARD_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY; >+ int METHOD_TYPE_PARAMETER = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER; >+ int METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY; >+ int CLASS_TYPE_PARAMETER = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER; >+ int CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY; >+ int TYPE_CAST = AnnotationTargetTypeConstants.TYPE_CAST; >+ int TYPE_CAST_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY; >+ int TYPE_INSTANCEOF = AnnotationTargetTypeConstants.TYPE_INSTANCEOF; >+ int TYPE_INSTANCEOF_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY; >+ int OBJECT_CREATION = AnnotationTargetTypeConstants.OBJECT_CREATION; >+ int OBJECT_CREATION_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY; >+ int LOCAL_VARIABLE = AnnotationTargetTypeConstants.LOCAL_VARIABLE; >+ int LOCAL_VARIABLE_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY; >+ int TYPE_ARGUMENT_CONSTRUCTOR_CALL = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL; >+ int TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY; >+ int TYPE_ARGUMENT_METHOD_CALL = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL; >+ int TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY; >+ int CLASS_LITERAL = AnnotationTargetTypeConstants.CLASS_LITERAL; >+ int CLASS_LITERAL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY; >+} >Index: model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java >=================================================================== >RCS file: model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java >diff -N model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.util; >+ >+/** >+ * Description of a local variable reference info table entry as specified in the JVM specifications. >+ * >+ * This interface may be implemented by clients. >+ * >+ * @since 3.7 >+ */ >+public interface ILocalVariableReferenceInfo { >+ >+ /** >+ * Answer back the start pc of this entry as specified in >+ * the JVM specifications. >+ * >+ * @return the start pc of this entry as specified in >+ * the JVM specifications >+ */ >+ int getStartPC(); >+ >+ /** >+ * Answer back the length of this entry as specified in >+ * the JVM specifications. >+ * >+ * @return the length of this entry as specified in >+ * the JVM specifications >+ */ >+ int getLength(); >+ >+ /** >+ * Answer back the resolved position of the local variable as specified in >+ * the JVM specifications. >+ * >+ * @return the resolved position of the local variable as specified in >+ * the JVM specifications >+ */ >+ int getIndex(); >+} >Index: model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java >=================================================================== >RCS file: model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java >diff -N model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.util; >+ >+/** >+ * Description of a runtime invisible type annotations attribute as described in the JVM specifications >+ * (added in JavaSE-1.7). >+ * >+ * This interface may be implemented by clients. >+ * >+ * @since 3.7 >+ */ >+public interface IRuntimeInvisibleTypeAnnotationsAttribute extends IClassFileAttribute { >+ >+ /** >+ * Answer back the number of extended annotations as described in the JVM specifications. >+ * >+ * @return the number of extended annotations >+ */ >+ int getExtendedAnnotationsNumber(); >+ >+ /** >+ * Answer back the extended annotations. Answers an empty collection if none. >+ * >+ * @return the extended annotations >+ */ >+ IExtendedAnnotation[] getExtendedAnnotations(); >+} >Index: model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java >=================================================================== >RCS file: model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java >diff -N model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.util; >+ >+/** >+ * Description of a runtime visible type annotations attribute as described in the JVM specifications >+ * (added in J2SE 1.5). >+ * >+ * This interface may be implemented by clients. >+ * >+ * @since 3.7 >+ */ >+public interface IRuntimeVisibleTypeAnnotationsAttribute extends IClassFileAttribute { >+ >+ /** >+ * Answer back the number of annotations as described in the JVM specifications. >+ * >+ * @return the number of annotations >+ */ >+ int getExtendedAnnotationsNumber(); >+ >+ /** >+ * Answer back the extended annotations. Answers an empty collection if none. >+ * >+ * @return the extended annotations. Answers an empty collection if none. >+ */ >+ IExtendedAnnotation[] getExtendedAnnotations(); >+} >Index: model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java,v >retrieving revision 1.31 >diff -u -r1.31 DocumentElementParser.java >--- model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java 23 Apr 2009 14:53:48 -0000 1.31 >+++ model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java 20 Jan 2011 21:55:32 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -18,6 +18,7 @@ > import org.eclipse.jdt.internal.compiler.ast.*; > import org.eclipse.jdt.internal.compiler.parser.*; > import org.eclipse.jdt.internal.compiler.problem.*; >+import org.eclipse.jdt.internal.compiler.util.Util; > > public class DocumentElementParser extends Parser { > IDocumentElementRequestor requestor; >@@ -411,6 +412,9 @@ > char[] varName = this.identifierStack[this.identifierPtr]; > long namePosition = this.identifierPositionStack[this.identifierPtr--]; > int extendedTypeDimension = this.intStack[this.intPtr--]; >+ // pop any annotations on extended dimensions now, so they don't pollute the base dimensions. >+ Annotation [][] annotationsOnExtendedDimensions = extendedTypeDimension == 0 ? null : getAnnotationsOnDimensions(extendedTypeDimension); >+ > > AbstractVariableDeclaration declaration; > if (this.nestedMethod[this.nestedType] != 0) { >@@ -474,7 +478,12 @@ > declaration.type = type; > } else { > int dimension = typeDim + extendedTypeDimension; >- declaration.type = copyDims(type, dimension); >+ Annotation [][] annotationsOnAllDimensions = null; >+ Annotation[][] annotationsOnDimensions = type.getAnnotationsOnDimensions(); >+ if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) { >+ annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(typeDim, annotationsOnDimensions, extendedTypeDimension, annotationsOnExtendedDimensions); >+ } >+ declaration.type = copyDims(type, dimension, annotationsOnAllDimensions); > } > this.variablesCounter[this.nestedType]++; > this.nestedMethod[this.nestedType]++; >@@ -499,6 +508,126 @@ > extendedTypeDimension == 0 ? -1 : this.endPosition); > } > } >+protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) { >+ TypeReference type; >+ >+ char[] identifierName = this.identifierStack[this.identifierPtr]; >+ long namePosition = this.identifierPositionStack[this.identifierPtr]; >+ >+ LocalDeclaration localDeclaration = createLocalDeclaration(identifierName, (int) (namePosition >>> 32), (int) namePosition); >+ localDeclaration.declarationSourceEnd = localDeclaration.declarationEnd; >+ >+ int extraDims = this.intStack[this.intPtr--]; >+ this.identifierPtr--; >+ this.identifierLengthPtr--; >+ // remove fake modifiers/modifiers start >+ int declarationSourceStart1 = 0; >+ int modifiersSourceStart1 = 0; >+ int modifiersValue = 0; >+ if (hasModifiers) { >+ declarationSourceStart1 = this.intStack[this.intPtr--]; >+ modifiersSourceStart1 = this.intStack[this.intPtr--]; >+ modifiersValue = this.intStack[this.intPtr--]; >+ } else { >+ this.intPtr-=3; >+ } >+ >+ type = getTypeReference(this.intStack[this.intPtr--] + extraDims); // type dimension >+ >+ // consume annotations >+ int length; >+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--])!= 0) { >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ localDeclaration.annotations = new Annotation[length], >+ 0, >+ length); >+ } >+ if (hasModifiers) { >+ localDeclaration.declarationSourceStart = declarationSourceStart1; >+ localDeclaration.modifiersSourceStart = modifiersSourceStart1; >+ localDeclaration.modifiers = modifiersValue; >+ } else { >+ localDeclaration.declarationSourceStart = type.sourceStart; >+ } >+ localDeclaration.type = type; >+ >+ ForeachStatement iteratorForStatement = >+ new ForeachStatement( >+ localDeclaration, >+ this.intStack[this.intPtr--]); >+ pushOnAstStack(iteratorForStatement); >+ >+ iteratorForStatement.sourceEnd = localDeclaration.declarationSourceEnd; >+} >+protected void consumeMethodHeaderNameWithTypeParameters(boolean isAnnotationMethod) { >+ // MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' >+ // AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' >+ // RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' >+ MethodDeclaration md = null; >+ if(isAnnotationMethod) { >+ md = new AnnotationMethodDeclaration(this.compilationUnit.compilationResult); >+ this.recordStringLiterals = false; >+ } else { >+ md = new MethodDeclaration(this.compilationUnit.compilationResult); >+ } >+ >+ //name >+ md.selector = this.identifierStack[this.identifierPtr]; >+ long selectorSource = this.identifierPositionStack[this.identifierPtr--]; >+ this.identifierLengthPtr--; >+ //type >+ md.returnType = getTypeReference(this.intStack[this.intPtr--]); >+ >+ // consume type parameters >+ int length = this.genericsLengthStack[this.genericsLengthPtr--]; >+ this.genericsPtr -= length; >+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, md.typeParameters = new TypeParameter[length], 0, length); >+ >+ //modifiers >+ md.declarationSourceStart = this.intStack[this.intPtr--]; >+ md.modifiersSourceStart = this.intStack[this.intPtr--]; >+ md.modifiers = this.intStack[this.intPtr--]; >+ // consume annotations >+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ md.annotations = new Annotation[length], >+ 0, >+ length); >+ } >+ // javadoc >+ md.javadoc = this.javadoc; >+ this.javadoc = null; >+ >+ //highlight starts at selector start >+ md.sourceStart = (int) (selectorSource >>> 32); >+ pushOnAstStack(md); >+ md.sourceEnd = this.lParenPos; >+ md.bodyStart = this.lParenPos+1; >+ this.listLength = 0; // initialize this.listLength before reading parameters/throws >+ >+ // recovery >+ if (this.currentElement != null){ >+ boolean isType; >+ if ((isType = this.currentElement instanceof RecoveredType) >+ //|| md.modifiers != 0 >+ || (Util.getLineNumber(md.returnType.sourceStart, this.scanner.lineEnds, 0, this.scanner.linePtr) >+ == Util.getLineNumber(md.sourceStart, this.scanner.lineEnds, 0, this.scanner.linePtr))){ >+ if(isType) { >+ ((RecoveredType) this.currentElement).pendingTypeParameters = null; >+ } >+ this.lastCheckPoint = md.bodyStart; >+ this.currentElement = this.currentElement.add(md, 0); >+ this.lastIgnoredToken = -1; >+ } else { >+ this.lastCheckPoint = md.sourceStart; >+ this.restartRecovery = true; >+ } >+ } >+} > /* > * > * INTERNAL USE-ONLY >@@ -559,10 +688,31 @@ > 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; > } >@@ -576,7 +726,6 @@ > type, > this.intStack[this.intPtr + 1]);// modifiers > // consume annotations >- int length; > if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { > System.arraycopy( > this.expressionStack, >@@ -830,13 +979,31 @@ > // MethodHeaderExtendedDims ::= Dimsopt > // now we update the returnType of the method > MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr]; >+ // jsr308 -- consume receiver annotations >+ md.receiverAnnotations = null; >+ int length; >+ if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.typeAnnotationStack, >+ (this.typeAnnotationPtr -= length) + 1, >+ md.receiverAnnotations = new Annotation[length], >+ 0, >+ length); >+ } > int extendedDims = this.intStack[this.intPtr--]; > this.extendsDim = extendedDims; > if (extendedDims != 0) { > 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; > } >@@ -1357,7 +1524,7 @@ > * This variable is a type reference and dim will be its dimensions. > * We don't have any side effect on the stacks' pointers. > */ >- >+ Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim); > int length; > TypeReference ref; > if ((length = this.identifierLengthStack[localIdentifierLengthPtr]) == 1) { >@@ -1372,12 +1539,13 @@ > new ArrayTypeReference( > this.identifierStack[localIdentifierPtr], > dim, >+ annotationsOnDimensions, > this.identifierPositionStack[localIdentifierPtr--]); > ref.sourceEnd = this.endPosition; > } > } else { > if (length < 0) { //flag for precompiled type reference on base types >- ref = TypeReference.baseTypeReference(-length, dim); >+ ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions); > ref.sourceStart = this.intStack[this.localIntPtr--]; > if (dim == 0) { > ref.sourceEnd = this.intStack[this.localIntPtr--]; >@@ -1399,7 +1567,7 @@ > if (dim == 0) > ref = new QualifiedTypeReference(tokens, positions); > else >- ref = new ArrayQualifiedTypeReference(tokens, dim, positions); >+ ref = new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions); > } > } > return ref; >Index: model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java,v >retrieving revision 1.91 >diff -u -r1.91 SourceElementParser.java >--- model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 28 Jul 2010 16:17:03 -0000 1.91 >+++ model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 20 Jan 2011 21:55:32 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -721,13 +721,16 @@ > return null; > } > } >-public TypeReference getTypeReference(int dim) { >+public 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 > */ >+ Annotation [][] annotationsOnDimensions = null; >+ TypeReference ref; > int length = this.identifierLengthStack[this.identifierLengthPtr--]; > if (length < 0) { //flag for precompiled type reference on base types >- TypeReference ref = TypeReference.baseTypeReference(-length, dim); >+ annotationsOnDimensions = getAnnotationsOnDimensions(dim); >+ ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions); > ref.sourceStart = this.intStack[this.intPtr--]; > if (dim == 0) { > ref.sourceEnd = this.intStack[this.intPtr--]; >@@ -738,12 +741,11 @@ > if (this.reportReferenceInfo){ > this.requestor.acceptTypeReference(ref.getParameterizedTypeName(), ref.sourceStart, ref.sourceEnd); > } >- return ref; > } else { > int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--]; > if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) { > // generic type >- TypeReference ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers); >+ ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers); > if (this.reportReferenceInfo) { > if (length == 1 && numberOfIdentifiers == 1) { > ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) ref; >@@ -753,30 +755,29 @@ > this.requestor.acceptTypeReference(parameterizedQualifiedTypeReference.tokens, parameterizedQualifiedTypeReference.sourceStart, parameterizedQualifiedTypeReference.sourceEnd); > } > } >- return ref; > } else if (length == 1) { > // single variable reference > this.genericsLengthPtr--; // pop the 0 > if (dim == 0) { >- SingleTypeReference ref = >+ ref = > new SingleTypeReference( > this.identifierStack[this.identifierPtr], > this.identifierPositionStack[this.identifierPtr--]); > if (this.reportReferenceInfo) { >- this.requestor.acceptTypeReference(ref.token, ref.sourceStart); >+ this.requestor.acceptTypeReference(((SingleTypeReference)ref).token, ref.sourceStart); > } >- return ref; > } else { >- ArrayTypeReference ref = >+ annotationsOnDimensions = getAnnotationsOnDimensions(dim); >+ ref = > new ArrayTypeReference( > this.identifierStack[this.identifierPtr], > dim, >+ annotationsOnDimensions, > this.identifierPositionStack[this.identifierPtr--]); > ref.sourceEnd = this.endPosition; > if (this.reportReferenceInfo) { >- this.requestor.acceptTypeReference(ref.token, ref.sourceStart); >+ this.requestor.acceptTypeReference(((ArrayTypeReference)ref).token, ref.sourceStart); > } >- return ref; > } > } else {//Qualified variable reference > this.genericsLengthPtr--; >@@ -791,22 +792,22 @@ > 0, > length); > if (dim == 0) { >- QualifiedTypeReference ref = new QualifiedTypeReference(tokens, positions); >+ ref = new QualifiedTypeReference(tokens, positions); > if (this.reportReferenceInfo) { >- this.requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd); >+ this.requestor.acceptTypeReference(((QualifiedTypeReference)ref).tokens, ref.sourceStart, ref.sourceEnd); > } >- return ref; > } else { >- ArrayQualifiedTypeReference ref = >- new ArrayQualifiedTypeReference(tokens, dim, positions); >+ annotationsOnDimensions = getAnnotationsOnDimensions(dim); >+ ref = >+ new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions); > ref.sourceEnd = this.endPosition; > if (this.reportReferenceInfo) { >- this.requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd); >+ this.requestor.acceptTypeReference(((ArrayQualifiedTypeReference)ref).tokens, ref.sourceStart, ref.sourceEnd); > } >- return ref; > } > } > } >+ return ref; > } > public NameReference getUnspecifiedReference() { > /* build a (unspecified) NameReference which may be qualified*/ >Index: model/org/eclipse/jdt/internal/core/util/ClassFileReader.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java,v >retrieving revision 1.26 >diff -u -r1.26 ClassFileReader.java >--- model/org/eclipse/jdt/internal/core/util/ClassFileReader.java 27 Jun 2008 16:03:57 -0000 1.26 >+++ model/org/eclipse/jdt/internal/core/util/ClassFileReader.java 20 Jan 2011 21:55:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -261,6 +261,10 @@ > this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset); > } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) { > this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset); >+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) { >+ this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, this.constantPool, readOffset); >+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) { >+ this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, this.constantPool, readOffset); > } else { > this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset); > } >Index: model/org/eclipse/jdt/internal/core/util/Disassembler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java,v >retrieving revision 1.100 >diff -u -r1.100 Disassembler.java >--- model/org/eclipse/jdt/internal/core/util/Disassembler.java 27 Aug 2009 15:27:02 -0000 1.100 >+++ model/org/eclipse/jdt/internal/core/util/Disassembler.java 20 Jan 2011 21:55:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -259,6 +259,412 @@ > buffer.append(Messages.disassembler_annotationentryend); > } > >+ private void disassemble(IExtendedAnnotation extendedAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { >+ writeNewLine(buffer, lineSeparator, tabNumber + 1); >+ final int typeIndex = extendedAnnotation.getTypeIndex(); >+ final char[] typeName = CharOperation.replaceOnCopy(extendedAnnotation.getTypeName(), '/', '.'); >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotationentrystart, new String[] { >+ Integer.toString(typeIndex), >+ new String(returnClassName(Signature.toCharArray(typeName), '.', mode)) >+ })); >+ final IAnnotationComponent[] components = extendedAnnotation.getComponents(); >+ for (int i = 0, max = components.length; i < max; i++) { >+ disassemble(components[i], buffer, lineSeparator, tabNumber + 1, mode); >+ } >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ int targetType = extendedAnnotation.getTargetType(); >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_targetType, new String[] { >+ Integer.toHexString(targetType), >+ getTargetType(targetType), >+ })); >+ switch(targetType) { >+ case IExtendedAnnotationConstants.METHOD_RECEIVER : >+ case IExtendedAnnotationConstants.METHOD_RETURN_TYPE : >+ case IExtendedAnnotationConstants.FIELD : >+ break; >+ default: >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ } >+ >+ switch(targetType) { >+ case IExtendedAnnotationConstants.WILDCARD_BOUND : >+ int wildcardLocationType = extendedAnnotation.getWildcardLocationType(); >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocationtype, new String[] { >+ Integer.toString(wildcardLocationType), >+ getTargetType(wildcardLocationType), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 3); >+ disassembleTargetTypeContents(true, wildcardLocationType, extendedAnnotation, buffer, lineSeparator, tabNumber + 3, mode); >+ break; >+ case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY : >+ wildcardLocationType = extendedAnnotation.getWildcardLocationType(); >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocationtype, new String[] { >+ Integer.toString(wildcardLocationType), >+ getTargetType(wildcardLocationType), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 3); >+ disassembleTargetTypeContents(true, wildcardLocationType, extendedAnnotation, buffer, lineSeparator, tabNumber + 3, mode); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ break; >+ default: >+ disassembleTargetTypeContents(false, targetType, extendedAnnotation, buffer, lineSeparator, tabNumber, mode); >+ } >+ writeNewLine(buffer, lineSeparator, tabNumber + 1); >+ buffer.append(Messages.disassembler_extendedannotationentryend); >+ } >+ >+ private void disassembleTargetTypeContents(boolean insideWildcard, int targetType, IExtendedAnnotation extendedAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { >+ switch(targetType) { >+ case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_classextendsimplements, new String[] { >+ Integer.toString(extendedAnnotation.getAnnotationTypeIndex()), >+ })); >+ break; >+ case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_classextendsimplements, new String[] { >+ Integer.toString(extendedAnnotation.getAnnotationTypeIndex()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.TYPE_CAST : >+ case IExtendedAnnotationConstants.TYPE_INSTANCEOF : >+ case IExtendedAnnotationConstants.OBJECT_CREATION : >+ case IExtendedAnnotationConstants.CLASS_LITERAL : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] { >+ Integer.toString(extendedAnnotation.getOffset()), >+ })); >+ break; >+ case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] { >+ Integer.toString(extendedAnnotation.getOffset()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER : >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_type_parameter, new String[] { >+ Integer.toString(extendedAnnotation.getTypeParameterIndex()), >+ })); >+ break; >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_type_parameter, new String[] { >+ Integer.toString(extendedAnnotation.getTypeParameterIndex()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND : >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_type_parameter_with_bound, new String[] { >+ Integer.toString(extendedAnnotation.getTypeParameterIndex()), >+ Integer.toString(extendedAnnotation.getTypeParameterBoundIndex()), >+ })); >+ break; >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_type_parameter_with_bound, new String[] { >+ Integer.toString(extendedAnnotation.getTypeParameterIndex()), >+ Integer.toString(extendedAnnotation.getTypeParameterBoundIndex()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.LOCAL_VARIABLE : >+ buffer.append(Messages.disassembler_localvariabletargetheader); >+ writeNewLine(buffer, lineSeparator, tabNumber + 3); >+ int localVariableTableSize = extendedAnnotation.getLocalVariableRefenceInfoLength(); >+ ILocalVariableReferenceInfo[] localVariableTable = extendedAnnotation.getLocalVariableTable(); >+ for (int i = 0; i < localVariableTableSize; i++) { >+ if (i != 0) { >+ writeNewLine(buffer, lineSeparator, tabNumber + 3); >+ } >+ ILocalVariableReferenceInfo info = localVariableTable[i]; >+ int index= info.getIndex(); >+ int startPC = info.getStartPC(); >+ int length = info.getLength(); >+ buffer.append(Messages.bind(Messages.classfileformat_localvariablereferenceinfoentry, >+ new String[] { >+ Integer.toString(startPC), >+ Integer.toString(startPC + length), >+ Integer.toString(index), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY : >+ buffer.append(Messages.disassembler_localvariabletargetheader); >+ writeNewLine(buffer, lineSeparator, tabNumber + 3); >+ localVariableTableSize = extendedAnnotation.getLocalVariableRefenceInfoLength(); >+ localVariableTable = extendedAnnotation.getLocalVariableTable(); >+ for (int i = 0; i < localVariableTableSize; i++) { >+ if (i != 0) { >+ writeNewLine(buffer, lineSeparator, tabNumber + 3); >+ } >+ ILocalVariableReferenceInfo info = localVariableTable[i]; >+ int index= info.getIndex(); >+ int startPC = info.getStartPC(); >+ int length = info.getLength(); >+ buffer.append(Messages.bind(Messages.classfileformat_localvariablereferenceinfoentry, >+ new String[] { >+ Integer.toString(startPC), >+ Integer.toString(startPC + length), >+ Integer.toString(index), >+ })); >+ } >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.METHOD_PARAMETER : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_method_parameter, new String[] { >+ Integer.toString(extendedAnnotation.getTypeParameterIndex()), >+ })); >+ break; >+ case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_method_parameter, new String[] { >+ Integer.toString(extendedAnnotation.getTypeParameterIndex()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY : >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] { >+ Integer.toString(extendedAnnotation.getOffset()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_type_argument, new String[] { >+ Integer.toString(extendedAnnotation.getAnnotationTypeIndex()), >+ })); >+ break; >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] { >+ Integer.toString(extendedAnnotation.getOffset()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_type_argument, new String[] { >+ Integer.toString(extendedAnnotation.getAnnotationTypeIndex()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ case IExtendedAnnotationConstants.THROWS : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_throws, new String[] { >+ Integer.toString(extendedAnnotation.getAnnotationTypeIndex()), >+ })); >+ break; >+ case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY : >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_throws, new String[] { >+ Integer.toString(extendedAnnotation.getAnnotationTypeIndex()), >+ })); >+ writeNewLine(buffer, lineSeparator, tabNumber + 2); >+ if (insideWildcard) { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] { >+ toString(extendedAnnotation.getWildcardLocations()), >+ })); >+ } else { >+ buffer.append( >+ Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] { >+ toString(extendedAnnotation.getLocations()), >+ })); >+ } >+ break; >+ } >+ } >+ private String getTargetType(int targetType) { >+ switch(targetType) { >+ case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS : >+ return "CLASS_EXTENDS_IMPLEMENTS"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY : >+ return "CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_CAST : >+ return "TYPE_CAST"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_INSTANCEOF : >+ return "TYPE_INSTANCEOF"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.OBJECT_CREATION : >+ return "OBJECT_CREATION"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.CLASS_LITERAL : >+ return "CLASS_LITERAL"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY : >+ return "TYPE_CAST_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY : >+ return "TYPE_INSTANCEOF_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY : >+ return "OBJECT_CREATION_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY : >+ return "CLASS_LITERAL_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER : >+ return "CLASS_TYPE_PARAMETER"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER : >+ return "METHOD_TYPE_PARAMETER"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY : >+ return "CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY : >+ return "METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND : >+ return "METHOD_TYPE_PARAMETER_BOUND"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND : >+ return "CLASS_TYPE_PARAMETER_BOUND"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ return "METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ return "CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.LOCAL_VARIABLE : >+ return "LOCAL_VARIABLE"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY : >+ return "LOCAL_VARIABLE_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_PARAMETER : >+ return "METHOD_PARAMETER"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY : >+ return "METHOD_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY : >+ return "METHOD_RECEIVER_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY : >+ return "METHOD_RETURN_TYPE_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_RECEIVER : >+ return "METHOD_RECEIVER"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.METHOD_RETURN_TYPE : >+ return "METHOD_RETURN_TYPE"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.FIELD : >+ return "FIELD"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY : >+ return "FIELD_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : >+ return "TYPE_ARGUMENT_CONSTRUCTOR_CALL"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL : >+ return "TYPE_ARGUMENT_METHOD_CALL"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY : >+ return "TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY : >+ return "TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.THROWS : >+ return "THROWS"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY : >+ return "THROWS_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.WILDCARD_BOUND : >+ return "WILDCARD_BOUND"; //$NON-NLS-1$ >+ case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY : >+ return "WILDCARD_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$ >+ default: >+ return "UNKNOWN"; //$NON-NLS-1$ >+ } >+ } >+ > private void disassemble(IAnnotationComponent annotationComponent, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { > writeNewLine(buffer, lineSeparator, tabNumber + 1); > buffer.append( >@@ -465,6 +871,8 @@ > final ISignatureAttribute signatureAttribute = (ISignatureAttribute) Util.getAttribute(methodInfo, IAttributeNamesConstants.SIGNATURE); > final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS); > final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS); >+ final IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS); >+ final IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS); > final IClassFileAttribute runtimeVisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS); > final IClassFileAttribute runtimeInvisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS); > final IClassFileAttribute annotationDefaultAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.ANNOTATION_DEFAULT); >@@ -671,6 +1079,8 @@ > && attribute != annotationDefaultAttribute > && attribute != runtimeInvisibleAnnotationsAttribute > && attribute != runtimeVisibleAnnotationsAttribute >+ && attribute != runtimeInvisibleTypeAnnotationsAttribute >+ && attribute != runtimeVisibleTypeAnnotationsAttribute > && attribute != runtimeInvisibleParameterAnnotationsAttribute > && attribute != runtimeVisibleParameterAnnotationsAttribute > && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) >@@ -695,6 +1105,12 @@ > if (runtimeInvisibleParameterAnnotationsAttribute != null) { > disassemble((IRuntimeInvisibleParameterAnnotationsAttribute) runtimeInvisibleParameterAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode); > } >+ if (runtimeVisibleTypeAnnotationsAttribute != null) { >+ disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode); >+ } >+ if (runtimeInvisibleTypeAnnotationsAttribute != null) { >+ disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode); >+ } > } > } > >@@ -786,6 +1202,8 @@ > IInnerClassesAttribute innerClassesAttribute = classFileReader.getInnerClassesAttribute(); > IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS); > IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS); >+ IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS); >+ IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS); > > if (checkMode(mode, DETAILED)) { > // disassemble compact version of annotations >@@ -919,17 +1337,25 @@ > if (runtimeInvisibleAnnotationsAttribute != null) { > disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode); > } >+ if (runtimeVisibleTypeAnnotationsAttribute != null) { >+ disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, 0, mode); >+ } >+ if (runtimeInvisibleTypeAnnotationsAttribute != null) { >+ disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, 0, mode); >+ } > if (length != 0) { > for (int i = 0; i < length; i++) { > IClassFileAttribute attribute = attributes[i]; > if (attribute != innerClassesAttribute >- && attribute != sourceAttribute >- && attribute != signatureAttribute >- && attribute != enclosingMethodAttribute >- && attribute != runtimeInvisibleAnnotationsAttribute >- && attribute != runtimeVisibleAnnotationsAttribute >- && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) >- && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) { >+ && attribute != sourceAttribute >+ && attribute != signatureAttribute >+ && attribute != enclosingMethodAttribute >+ && attribute != runtimeInvisibleAnnotationsAttribute >+ && attribute != runtimeVisibleAnnotationsAttribute >+ && attribute != runtimeInvisibleTypeAnnotationsAttribute >+ && attribute != runtimeVisibleTypeAnnotationsAttribute >+ && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) >+ && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) { > disassemble(attribute, buffer, lineSeparator, 0, mode); > } > } >@@ -1491,6 +1917,8 @@ > } > final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS); > final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS); >+ final IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS); >+ final IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS); > if (checkMode(mode, DETAILED)) { > // disassemble compact version of annotations > if (runtimeInvisibleAnnotationsAttribute != null) { >@@ -1577,6 +2005,8 @@ > && attribute != signatureAttribute > && attribute != runtimeInvisibleAnnotationsAttribute > && attribute != runtimeVisibleAnnotationsAttribute >+ && attribute != runtimeInvisibleTypeAnnotationsAttribute >+ && attribute != runtimeVisibleTypeAnnotationsAttribute > && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) > && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) { > disassemble(attribute, buffer, lineSeparator, tabNumber, mode); >@@ -1589,6 +2019,12 @@ > if (runtimeInvisibleAnnotationsAttribute != null) { > disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode); > } >+ if (runtimeVisibleTypeAnnotationsAttribute != null) { >+ disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode); >+ } >+ if (runtimeInvisibleTypeAnnotationsAttribute != null) { >+ disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode); >+ } > } > } > >@@ -1692,6 +2128,24 @@ > } > } > >+ private void disassemble(IRuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { >+ writeNewLine(buffer, lineSeparator, tabNumber + 1); >+ buffer.append(Messages.disassembler_runtimeinvisibletypeannotationsattributeheader); >+ IExtendedAnnotation[] extendedAnnotations = runtimeInvisibleTypeAnnotationsAttribute.getExtendedAnnotations(); >+ for (int i = 0, max = extendedAnnotations.length; i < max; i++) { >+ disassemble(extendedAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode); >+ } >+ } >+ >+ private void disassemble(IRuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { >+ writeNewLine(buffer, lineSeparator, tabNumber + 1); >+ buffer.append(Messages.disassembler_runtimevisibletypeannotationsattributeheader); >+ IExtendedAnnotation[] extendedAnnotations = runtimeVisibleTypeAnnotationsAttribute.getExtendedAnnotations(); >+ for (int i = 0, max = extendedAnnotations.length; i < max; i++) { >+ disassemble(extendedAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode); >+ } >+ } >+ > private void disassemble(IRuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { > writeNewLine(buffer, lineSeparator, tabNumber + 1); > buffer.append(Messages.disassembler_runtimevisibleparameterannotationsattributeheader); >@@ -2141,4 +2595,17 @@ > buffer.append(lineSeparator); > dumpTab(tabNumber, buffer); > } >+ >+ private String toString(int[] tab) { >+ StringBuffer buffer = new StringBuffer(); >+ buffer.append('{'); >+ for (int i = 0, max = tab.length; i < max; i++) { >+ if (i > 0) { >+ buffer.append(','); >+ } >+ buffer.append(tab[i]); >+ } >+ buffer.append('}'); >+ return String.valueOf(buffer); >+ } > } >Index: model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java >=================================================================== >RCS file: model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java >diff -N model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,358 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.core.util; >+ >+import org.eclipse.jdt.core.util.ClassFormatException; >+import org.eclipse.jdt.core.util.IAnnotationComponent; >+import org.eclipse.jdt.core.util.IConstantPool; >+import org.eclipse.jdt.core.util.IConstantPoolConstant; >+import org.eclipse.jdt.core.util.IConstantPoolEntry; >+import org.eclipse.jdt.core.util.IExtendedAnnotation; >+import org.eclipse.jdt.core.util.IExtendedAnnotationConstants; >+import org.eclipse.jdt.core.util.ILocalVariableReferenceInfo; >+ >+/** >+ * Default implementation of IAnnotation >+ */ >+public class ExtendedAnnotation extends ClassFileStruct implements IExtendedAnnotation { >+ >+ private static final IAnnotationComponent[] NO_ENTRIES = new IAnnotationComponent[0]; >+ >+ private int typeIndex; >+ private char[] typeName; >+ private int componentsNumber; >+ private IAnnotationComponent[] components; >+ private int readOffset; >+ private int targetType; >+ private int annotationTypeIndex; >+ private int offset; >+ private int typeParameterIndex; >+ private int typeParameterBoundIndex; >+ private int parameterIndex; >+ private int wildcardLocationType; >+ private ILocalVariableReferenceInfo[] localVariableTable; >+ private int[] locations; >+ private int[] wildcardLocations; >+ /** >+ * Constructor for Annotation. >+ * >+ * @param classFileBytes >+ * @param constantPool >+ * @param offset >+ * @throws ClassFormatException >+ */ >+ public ExtendedAnnotation( >+ byte[] classFileBytes, >+ IConstantPool constantPool, >+ int offset) throws ClassFormatException { >+ >+ int index = u2At(classFileBytes, 0, offset); >+ this.typeIndex = index; >+ if (index != 0) { >+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index); >+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) { >+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY); >+ } >+ this.typeName = constantPoolEntry.getUtf8Value(); >+ } else { >+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY); >+ } >+ final int length = u2At(classFileBytes, 2, offset); >+ this.componentsNumber = length; >+ this.readOffset = 4; >+ if (length != 0) { >+ this.components = new IAnnotationComponent[length]; >+ for (int i = 0; i < length; i++) { >+ AnnotationComponent component = new AnnotationComponent(classFileBytes, constantPool, offset + this.readOffset); >+ this.components[i] = component; >+ this.readOffset += component.sizeInBytes(); >+ } >+ } else { >+ this.components = NO_ENTRIES; >+ } >+ index = u1At(classFileBytes, this.readOffset, offset); >+ this.readOffset++; >+ this.targetType = index; >+ switch(index) { >+ case IExtendedAnnotationConstants.WILDCARD_BOUND : >+ this.wildcardLocationType = u1At(classFileBytes, this.readOffset, offset); >+ this.readOffset++; >+ internalDecoding(this.wildcardLocationType, classFileBytes, constantPool, offset); >+ // copy the location back into the wildcard location >+ int size = this.locations.length; >+ System.arraycopy(this.locations, 0, (this.wildcardLocations = new int[size]), 0, size); >+ this.locations = null; >+ break; >+ case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY : >+ this.wildcardLocationType = u1At(classFileBytes, this.readOffset, offset); >+ this.readOffset++; >+ internalDecoding(this.wildcardLocationType, classFileBytes, constantPool, offset); >+ size = this.locations.length; >+ System.arraycopy(this.locations, 0, (this.wildcardLocations = new int[size]), 0, size); >+ int locationLength = u2At(classFileBytes, this.readOffset, offset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, offset); >+ this.readOffset++; >+ } >+ break; >+ default: >+ internalDecoding(index, classFileBytes, constantPool, offset); >+ } >+ if (this.annotationTypeIndex == 0xFFFF) { >+ this.annotationTypeIndex = -1; >+ } >+ } >+ >+ private void internalDecoding( >+ int localTargetType, >+ byte[] classFileBytes, >+ IConstantPool constantPool, >+ int localOffset) throws ClassFormatException { >+ switch(localTargetType) { >+ case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS : >+ this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset+=2; >+ break; >+ case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY : >+ this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset+=2; >+ int locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.TYPE_CAST : >+ case IExtendedAnnotationConstants.TYPE_INSTANCEOF : >+ case IExtendedAnnotationConstants.OBJECT_CREATION : >+ case IExtendedAnnotationConstants.CLASS_LITERAL : >+ this.offset = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ break; >+ case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY : >+ this.offset = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER : >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER : >+ this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ break; >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY : >+ this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND : >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND : >+ this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ this.typeParameterBoundIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ break; >+ case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY : >+ this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ this.typeParameterBoundIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.LOCAL_VARIABLE : >+ int tableLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.localVariableTable = new LocalVariableReferenceInfo[tableLength]; >+ for (int i = 0; i < tableLength; i++) { >+ this.localVariableTable[i] = new LocalVariableReferenceInfo(classFileBytes, constantPool, this.readOffset + localOffset); >+ this.readOffset += 6; >+ } >+ break; >+ case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY : >+ tableLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.localVariableTable = new LocalVariableReferenceInfo[tableLength]; >+ for (int i = 0; i < tableLength; i++) { >+ this.localVariableTable[i] = new LocalVariableReferenceInfo(classFileBytes, constantPool, this.readOffset + localOffset); >+ this.readOffset += 6; >+ } >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.METHOD_PARAMETER : >+ this.parameterIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ break; >+ case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY : >+ this.parameterIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY : >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL : >+ this.offset = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ break; >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY : >+ case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY : >+ this.offset = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ case IExtendedAnnotationConstants.THROWS : >+ this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset+=2; >+ break; >+ case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY : >+ this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset+=2; >+ locationLength = u2At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset += 2; >+ this.locations = new int[locationLength]; >+ for (int i = 0; i < locationLength; i++) { >+ this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset); >+ this.readOffset++; >+ } >+ break; >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IAnnotation#getTypeIndex() >+ */ >+ public int getTypeIndex() { >+ return this.typeIndex; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IAnnotation#getComponentsNumber() >+ */ >+ public int getComponentsNumber() { >+ return this.componentsNumber; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IAnnotation#getComponents() >+ */ >+ public IAnnotationComponent[] getComponents() { >+ return this.components; >+ } >+ >+ int sizeInBytes() { >+ return this.readOffset; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IAnnotation#getTypeName() >+ */ >+ public char[] getTypeName() { >+ return this.typeName; >+ } >+ >+ public int getTargetType() { >+ return this.targetType; >+ } >+ >+ public int getOffset() { >+ return this.offset; >+ } >+ >+ public int getLocalVariableRefenceInfoLength() { >+ return this.localVariableTable != null ? this.localVariableTable.length : 0; >+ } >+ >+ public ILocalVariableReferenceInfo[] getLocalVariableTable() { >+ return this.localVariableTable; >+ } >+ >+ public int getParameterIndex() { >+ return this.parameterIndex; >+ } >+ >+ public int getTypeParameterIndex() { >+ return this.typeParameterIndex; >+ } >+ >+ public int getTypeParameterBoundIndex() { >+ return this.typeParameterBoundIndex; >+ } >+ >+ public int getWildcardLocationType() { >+ return this.wildcardLocationType; >+ } >+ >+ public int[] getWildcardLocations() { >+ return this.wildcardLocations; >+ } >+ >+ public int[] getLocations() { >+ return this.locations; >+ } >+ >+ public int getAnnotationTypeIndex() { >+ return this.annotationTypeIndex; >+ } >+} >Index: model/org/eclipse/jdt/internal/core/util/FieldInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java,v >retrieving revision 1.16 >diff -u -r1.16 FieldInfo.java >--- model/org/eclipse/jdt/internal/core/util/FieldInfo.java 7 Mar 2009 01:08:05 -0000 1.16 >+++ model/org/eclipse/jdt/internal/core/util/FieldInfo.java 20 Jan 2011 21:55:34 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -90,6 +90,10 @@ > this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset); > } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) { > this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset); >+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) { >+ this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset); >+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) { >+ this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset); > } else { > this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset); > } >Index: model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java >=================================================================== >RCS file: model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java >diff -N model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,63 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.core.util; >+ >+import org.eclipse.jdt.core.util.ClassFormatException; >+import org.eclipse.jdt.core.util.IConstantPool; >+import org.eclipse.jdt.core.util.ILocalVariableReferenceInfo; >+ >+/** >+ * Default implementation of ILocalVariableTableEntry >+ */ >+public class LocalVariableReferenceInfo extends ClassFileStruct implements ILocalVariableReferenceInfo { >+ >+ private int startPC; >+ private int length; >+ private int index; >+ >+ /** >+ * Constructor for LocalVariableTableEntry. >+ * >+ * @param classFileBytes >+ * @param constantPool >+ * @param offset >+ * @throws ClassFormatException >+ */ >+ public LocalVariableReferenceInfo( >+ byte[] classFileBytes, >+ IConstantPool constantPool, >+ int offset) throws ClassFormatException { >+ this.startPC = u2At(classFileBytes, 0, offset); >+ this.length = u2At(classFileBytes, 2, offset); >+ this.index = u2At(classFileBytes, 4, offset); >+ } >+ >+ /** >+ * @see ILocalVariableReferenceInfo#getStartPC() >+ */ >+ public int getStartPC() { >+ return this.startPC; >+ } >+ >+ /** >+ * @see ILocalVariableReferenceInfo#getLength() >+ */ >+ public int getLength() { >+ return this.length; >+ } >+ >+ /** >+ * @see ILocalVariableReferenceInfo#getIndex() >+ */ >+ public int getIndex() { >+ return this.index; >+ } >+} >Index: model/org/eclipse/jdt/internal/core/util/Messages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java,v >retrieving revision 1.32 >diff -u -r1.32 Messages.java >--- model/org/eclipse/jdt/internal/core/util/Messages.java 18 Jan 2011 05:42:02 -0000 1.32 >+++ model/org/eclipse/jdt/internal/core/util/Messages.java 20 Jan 2011 21:55:34 -0000 >@@ -288,6 +288,25 @@ > public static String disassembler_annotationentrystart; > public static String disassembler_annotationentryend; > public static String disassembler_annotationcomponent; >+ // jsr308 >+ public static String disassembler_extendedannotationentrystart; >+ public static String disassembler_extendedannotationentryend; >+ public static String disassembler_runtimevisibletypeannotationsattributeheader; >+ public static String disassembler_runtimeinvisibletypeannotationsattributeheader; >+ public static String disassembler_extendedannotation_classextendsimplements; >+ public static String disassembler_extendedannotation_locations; >+ public static String disassembler_extendedannotation_method_parameter; >+ public static String disassembler_extendedannotation_offset; >+ public static String disassembler_extendedannotation_throws; >+ public static String disassembler_extendedannotation_type_argument; >+ public static String disassembler_extendedannotation_type_parameter; >+ public static String disassembler_extendedannotation_type_parameter_with_bound; >+ public static String disassembler_extendedannotation_wildcardlocationtype; >+ public static String disassembler_extendedannotation_targetType; >+ public static String disassembler_extendedannotation_wildcardlocations; >+ public static String disassembler_localvariabletargetheader; >+ public static String classfileformat_localvariablereferenceinfoentry; >+ > public static String disassembler_runtimevisibleannotationsattributeheader; > public static String disassembler_runtimeinvisibleannotationsattributeheader; > public static String disassembler_runtimevisibleparameterannotationsattributeheader; >Index: model/org/eclipse/jdt/internal/core/util/MethodInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java,v >retrieving revision 1.17 >diff -u -r1.17 MethodInfo.java >--- model/org/eclipse/jdt/internal/core/util/MethodInfo.java 7 Mar 2009 01:08:05 -0000 1.17 >+++ model/org/eclipse/jdt/internal/core/util/MethodInfo.java 20 Jan 2011 21:55:34 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -114,6 +114,10 @@ > this.attributes[attributesIndex++] = new RuntimeInvisibleParameterAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset); > } else if (equals(attributeName, IAttributeNamesConstants.ANNOTATION_DEFAULT)) { > this.attributes[attributesIndex++] = new AnnotationDefaultAttribute(classFileBytes, constantPool, offset + readOffset); >+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) { >+ this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset); >+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) { >+ this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset); > } else { > this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset); > } >Index: model/org/eclipse/jdt/internal/core/util/PublicScanner.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java,v >retrieving revision 1.114 >diff -u -r1.114 PublicScanner.java >--- model/org/eclipse/jdt/internal/core/util/PublicScanner.java 15 Nov 2010 16:22:29 -0000 1.114 >+++ model/org/eclipse/jdt/internal/core/util/PublicScanner.java 20 Jan 2011 21:55:36 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -106,11 +106,22 @@ > > public static final String NULL_SOURCE_STRING = "Null_Source_String"; //$NON-NLS-1$ > public static final String UNTERMINATED_STRING = "Unterminated_String"; //$NON-NLS-1$ >+ public static final String UNTERMINATED_EXOTIC_IDENTIFIER = "Unterminated_Exotic_Identifier"; //$NON-NLS-1$ > public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"; //$NON-NLS-1$ > public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"; //$NON-NLS-1$ >+ public static final String INVALID_CHAR_IN_EXOTIC_IDENTIFIER = "Invalid_Char_In_Exotic_Identifier"; //$NON-NLS-1$ >+ public static final String INVALID_EMPTY_EXOTIC_IDENTIFIER = "Invalid_Empty_Exotic_Identifier"; //$NON-NLS-1$ > public static final String INVALID_DIGIT = "Invalid_Digit"; //$NON-NLS-1$ > private static final int[] EMPTY_LINE_ENDS = Util.EMPTY_INT_ARRAY; > >+ public static final String INVALID_BINARY = "Invalid_Binary_Literal"; //$NON-NLS-1$ >+ public static final String ILLEGAL_BINARY_LITERAL = "Illegal_Binary_Literal"; //$NON-NLS-1$ >+ public static final String ILLEGAL_HEXA_LITERAL = "Illegal_Hexa_Literal"; //$NON-NLS-1$ >+ public static final String INVALID_UNDERSCORE = "Invalid_Underscore"; //$NON-NLS-1$ >+ public static final String INVALID_USAGE_OF_UNDERSCORE = "Invalid_Usage_Of_Underscore"; //$NON-NLS-1$` >+ public static final String ILLEGAL_DANGEROUS_CHARACTER = "Illegal_Dangerous_Character"; //$NON-NLS-1$ >+ public static final String ILLEGAL_EXOTIC_IDENTIFIER = "Illegal_Exotic_Identifier"; //$NON-NLS-1$ >+ > //----------------optimized identifier managment------------------ > static final char[] charArray_a = new char[] {'a'}, > charArray_b = new char[] {'b'}, >@@ -208,20 +219,30 @@ > this.complianceLevel = complianceLevel; > this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals; > if (taskTags != null) { >- int length = taskTags.length; >+ int taskTagsLength = taskTags.length; >+ int length = taskTagsLength; > if (taskPriorities != null) { >+ int taskPrioritiesLength = taskPriorities.length; >+ if (taskPrioritiesLength != taskTagsLength) { >+ if (taskPrioritiesLength > taskTagsLength) { >+ System.arraycopy(taskPriorities, 0, (taskPriorities = new char[taskTagsLength][]), 0, taskTagsLength); >+ } else { >+ System.arraycopy(taskTags, 0, (taskTags = new char[taskPrioritiesLength][]), 0, taskPrioritiesLength); >+ length = taskPrioritiesLength; >+ } >+ } > int[] initialIndexes = new int[length]; > for (int i = 0; i < length; i++) { > initialIndexes[i] = i; > } >- Util.reverseQuickSort(taskTags, 0, taskTags.length - 1, initialIndexes); >+ Util.reverseQuickSort(taskTags, 0, length - 1, initialIndexes); > char[][] temp = new char[length][]; > for (int i = 0; i < length; i++) { > temp[i] = taskPriorities[initialIndexes[i]]; > } > this.taskPriorities = temp; > } else { >- Util.reverseQuickSort(taskTags, 0, taskTags.length - 1); >+ Util.reverseQuickSort(taskTags, 0, length - 1); > } > this.taskTags = taskTags; > this.isTaskCaseSensitive = isTaskCaseSensitive; >@@ -395,7 +416,22 @@ > //return the token REAL source (aka unicodes are precomputed) > > char[] result; >- if (this.withoutUnicodePtr != 0) { >+ if (this.source[this.startPosition] == '#') { >+ // 1.7 exotic identifier >+ if (this.withoutUnicodePtr != 0) { >+ // unicode were used inside the string >+ int length = this.withoutUnicodePtr - 3; >+ System.arraycopy( >+ this.withoutUnicodeBuffer, >+ 3, >+ result = new char[length], >+ 0, >+ length); >+ } else { >+ int length = this.currentPosition - this.startPosition - 3; >+ System.arraycopy(this.source, this.startPosition + 2, result = new char[length], 0, length); >+ } >+ } else if (this.withoutUnicodePtr != 0) { > //0 is used as a fast test flag so the real first char is in position 1 > System.arraycopy( > this.withoutUnicodeBuffer, >@@ -718,6 +754,54 @@ > return -1; > } > } >+/* >+ * This method consumes digits as well as underscores if underscores are located between digits >+ * @throws InvalidInputException if underscores are not located between digits or if underscores are used in source < 1.7 >+ */ >+private final void consumeDigits(int radix) throws InvalidInputException { >+ consumeDigits(radix, false); >+} >+/* >+ * This method consumes digits as well as underscores if underscores are located between digits >+ * @throws InvalidInputException if underscores are not located between digits or if underscores are used in source < 1.7 >+ */ >+private final void consumeDigits(int radix, boolean expectingDigitFirst) throws InvalidInputException { >+ final int USING_UNDERSCORE = 1; >+ final int INVALID_POSITION = 2; >+ switch(consumeDigits0(radix, USING_UNDERSCORE, INVALID_POSITION, expectingDigitFirst)) { >+ case USING_UNDERSCORE : >+ if (this.sourceLevel < ClassFileConstants.JDK1_7) { >+ throw new InvalidInputException(INVALID_USAGE_OF_UNDERSCORE); >+ } >+ break; >+ case INVALID_POSITION : >+ if (this.sourceLevel < ClassFileConstants.JDK1_7) { >+ throw new InvalidInputException(INVALID_USAGE_OF_UNDERSCORE); >+ } >+ throw new InvalidInputException(INVALID_UNDERSCORE); >+ } >+} >+private final int consumeDigits0(int radix, int usingUnderscore, int invalidPosition, boolean expectingDigitFirst) throws InvalidInputException { >+ int kind = 0; >+ if (getNextChar('_')) { >+ if (expectingDigitFirst) { >+ return invalidPosition; >+ } >+ kind = usingUnderscore; >+ while (getNextChar('_')) {/*empty */} >+ } >+ if (getNextCharAsDigit(radix)) { >+ // continue to read digits or underscore >+ while (getNextCharAsDigit(radix)) {/*empty */} >+ int kind2 = consumeDigits0(radix, usingUnderscore, invalidPosition, false); >+ if (kind2 == 0) { >+ return kind; >+ } >+ return kind2; >+ } >+ if (kind == usingUnderscore) return invalidPosition; >+ return kind; >+} > public final boolean getNextCharAsDigit() throws InvalidInputException { > //BOOLEAN > //handle the case of unicode. >@@ -1673,6 +1757,12 @@ > return TokenNameEOF; > //the atEnd may not be <currentPosition == source.length> if source is only some part of a real (external) stream > throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$ >+ case '#' : >+ if (getNextChar('"')) { >+ // new exotic identifier >+ return scanExoticIdentifier(); >+ } >+ return TokenNameERROR; > default : > char c = this.currentCharacter; > if (c < ScannerHelper.MAX_OBVIOUS) { >@@ -2626,7 +2716,7 @@ > this.foundTaskCount = 0; > } > >-public final void scanEscapeCharacter() throws InvalidInputException { >+protected final void scanEscapeCharacter() throws InvalidInputException { > // the string with "\\u" is a legal string of two chars \ and u > //thus we use a direct access to the source (for regular cases). > switch (this.currentCharacter) { >@@ -2694,6 +2784,51 @@ > throw new InvalidInputException(INVALID_ESCAPE); > } > } >+protected final void scanEscapeExoticCharacter() throws InvalidInputException { >+ // the string with "\\u" is a legal string of two chars \ and u >+ //thus we use a direct access to the source (for regular cases). >+ switch (this.currentCharacter) { >+ case '!' : >+ case '#' : >+ case '$' : >+ case '%' : >+ case '&' : >+ case '(' : >+ case ')' : >+ case '*' : >+ case '+' : >+ case ',' : >+ case '-' : >+ case ':' : >+ case '=' : >+ case '?' : >+ case '@' : >+ case '^' : >+ case '_' : >+ case '`' : >+ case '{' : >+ case '|' : >+ case '}' : >+ case '~' : >+ unicodeStore('\\'); >+ unicodeStore(); >+ break; >+ case '/' : >+ case '.' : >+ case ';' : >+ case '<' : >+ case '>' : >+ case '[' : >+ case ']' : >+ unicodeStore(); >+ break; >+ default : >+ scanEscapeCharacter(); >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ } >+} > public int scanIdentifierOrKeywordWithBoundCheck() { > //test keywords > >@@ -2715,7 +2850,7 @@ > if (c < ScannerHelper.MAX_OBVIOUS) { > if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & > (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_IDENT_PART | ScannerHelper.C_DIGIT)) != 0) { >- if (this.withoutUnicodePtr != 0) { >+ if (this.withoutUnicodePtr != 0) { > this.currentCharacter = c; > unicodeStore(); > } >@@ -2761,7 +2896,7 @@ > > //first dispatch on the first char. > //then the length. If there are several >- //keywors with the same length AND the same first char, then do another >+ //keywords with the same length AND the same first char, then do another > //dispatch on the second char > this.useAssertAsAnIndentifier = false; > this.useEnumAsAnIndentifier = false; >@@ -2777,7 +2912,7 @@ > if (c < ScannerHelper.MAX_OBVIOUS) { > if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & > (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_IDENT_PART | ScannerHelper.C_DIGIT)) != 0) { >- if (this.withoutUnicodePtr != 0) { >+ if (this.withoutUnicodePtr != 0) { > this.currentCharacter = c; > unicodeStore(); > } >@@ -2818,7 +2953,135 @@ > > return internalScanIdentifierOrKeyword(index, length, data); > } >+private int scanExoticIdentifier() throws InvalidInputException { >+ try { >+ // consume next character >+ this.unicodeAsBackSlash = false; >+ boolean isUnicode = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >+ && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ } else { >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ } > >+ int exoticIdentifierStart = this.currentPosition; >+ while (this.currentCharacter != '"') { >+ if (this.currentPosition >= this.eofPosition) { >+ throw new InvalidInputException(UNTERMINATED_EXOTIC_IDENTIFIER); >+ } >+ switch(this.currentCharacter) { >+ case '/' : >+ case '.' : >+ case ';' : >+ case '<' : >+ case '>' : >+ case '[' : >+ case ']' : >+ throw new InvalidInputException(ILLEGAL_DANGEROUS_CHARACTER); >+ case '\n' : >+ case '\r' : >+ /**** \r and \n are not valid in exotic identifier ****/ >+ // relocate if finding another quote fairly close: thus >+ // unicode '/u000D' will be fully consumed >+ if (isUnicode) { >+ int start = this.currentPosition; >+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) { >+ if (this.currentPosition >= this.eofPosition) { >+ this.currentPosition = start; >+ break; >+ } >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >+ && (this.source[this.currentPosition] == 'u')) { >+ isUnicode = true; >+ getNextUnicodeChar(); >+ } else { >+ isUnicode = false; >+ } >+ if (!isUnicode && this.currentCharacter == '\n') { >+ this.currentPosition--; // set current position >+ // on new line character >+ break; >+ } >+ if (this.currentCharacter == '\"') { >+ throw new InvalidInputException( >+ INVALID_CHAR_IN_EXOTIC_IDENTIFIER); >+ } >+ } >+ } else { >+ this.currentPosition--; // set current position on new >+ // line character >+ } >+ throw new InvalidInputException(INVALID_CHAR_IN_EXOTIC_IDENTIFIER); >+ case '\\' : >+ if (this.unicodeAsBackSlash) { >+ this.withoutUnicodePtr--; >+ // consume next character >+ this.unicodeAsBackSlash = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >+ && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ this.withoutUnicodePtr--; >+ } else { >+ isUnicode = false; >+ } >+ } else { >+ if (this.withoutUnicodePtr == 0) { >+ unicodeInitializeBuffer(this.currentPosition >+ - this.startPosition); >+ } >+ this.withoutUnicodePtr--; >+ this.currentCharacter = this.source[this.currentPosition++]; >+ } >+ // we need to compute the escape character in a separate >+ // buffer >+ scanEscapeExoticCharacter(); >+ } >+ this.unicodeAsBackSlash = false; >+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >+ && (this.source[this.currentPosition] == 'u')) { >+ getNextUnicodeChar(); >+ isUnicode = true; >+ } else { >+ isUnicode = false; >+ if (this.withoutUnicodePtr != 0) { >+ unicodeStore(); >+ } >+ } >+ } >+ if ((this.currentPosition - exoticIdentifierStart) == 0) { >+ throw new InvalidInputException(INVALID_EMPTY_EXOTIC_IDENTIFIER); >+ } >+ } catch (IndexOutOfBoundsException e) { >+ this.currentPosition--; >+ throw new InvalidInputException(UNTERMINATED_EXOTIC_IDENTIFIER); >+ } catch (InvalidInputException e) { >+ if (e.getMessage().equals(INVALID_ESCAPE)) { >+ // relocate if finding another quote fairly close: thus unicode >+ // '/u000D' will be fully consumed >+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) { >+ if (this.currentPosition + lookAhead == this.eofPosition) >+ break; >+ if (this.source[this.currentPosition + lookAhead] == '\n') >+ break; >+ if (this.source[this.currentPosition + lookAhead] == '\"') { >+ this.currentPosition += lookAhead + 1; >+ break; >+ } >+ } >+ >+ } >+ throw e; // rethrow >+ } >+ if (this.complianceLevel <= ClassFileConstants.JDK1_6) { >+ throw new InvalidInputException(ILLEGAL_EXOTIC_IDENTIFIER); >+ } >+ return TokenNameIdentifier; >+} > private int internalScanIdentifierOrKeyword(int index, int length, char[] data) { > switch (data[index]) { > case 'a' : >@@ -3380,10 +3643,10 @@ > //dotPrefix is true > > boolean floating = dotPrefix; >- if ((!dotPrefix) && (this.currentCharacter == '0')) { >+ if (!dotPrefix && (this.currentCharacter == '0')) { > if (getNextChar('x', 'X') >= 0) { //----------hexa----------------- > int start = this.currentPosition; >- while (getNextCharAsDigit(16)){/*empty*/} >+ consumeDigits(16, true); > int end = this.currentPosition; > if (getNextChar('l', 'L') >= 0) { > if (end == start) { >@@ -3391,27 +3654,23 @@ > } > return TokenNameLongLiteral; > } else if (getNextChar('.')) { >- if (this.sourceLevel < ClassFileConstants.JDK1_5) { >- if (end == start) { >- throw new InvalidInputException(INVALID_HEXA); >- } >- this.currentPosition = end; >- return TokenNameIntegerLiteral; >- } > // hexadecimal floating point literal > // read decimal part > boolean hasNoDigitsBeforeDot = end == start; > start = this.currentPosition; >- while (getNextCharAsDigit(16)){/*empty*/} >+ consumeDigits(16, true); > end = this.currentPosition; > if (hasNoDigitsBeforeDot && end == start) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > throw new InvalidInputException(INVALID_HEXA); > } > > if (getNextChar('p', 'P') >= 0) { // consume next character > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3420,10 +3679,10 @@ > } > > if ((this.currentCharacter == '-') >- || (this.currentCharacter == '+')) { // consume next character >+ || (this.currentCharacter == '+')) { // consume next character > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3432,31 +3691,49 @@ > } > } > if (!ScannerHelper.isDigit(this.currentCharacter)) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } >+ if (this.currentCharacter == '_') { >+ // wrongly place '_' >+ consumeDigits(10); >+ throw new InvalidInputException(INVALID_UNDERSCORE); >+ } > throw new InvalidInputException(INVALID_HEXA); > } >- while (getNextCharAsDigit()){/*empty*/} >+ consumeDigits(10, true); > if (getNextChar('f', 'F') >= 0) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > return TokenNameFloatingPointLiteral; > } > if (getNextChar('d', 'D') >= 0) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > return TokenNameDoubleLiteral; > } > if (getNextChar('l', 'L') >= 0) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > throw new InvalidInputException(INVALID_HEXA); > } >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > return TokenNameDoubleLiteral; > } else { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > throw new InvalidInputException(INVALID_HEXA); > } > } else if (getNextChar('p', 'P') >= 0) { // consume next character >- if (this.sourceLevel < ClassFileConstants.JDK1_5) { >- // if we are in source level < 1.5 we report an integer literal >- this.currentPosition = end; >- return TokenNameIntegerLiteral; >- } > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3465,10 +3742,10 @@ > } > > if ((this.currentCharacter == '-') >- || (this.currentCharacter == '+')) { // consume next character >+ || (this.currentCharacter == '+')) { // consume next character > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3476,28 +3753,71 @@ > } > } > } >- if (!ScannerHelper.isDigit(this.currentCharacter)) >+ if (!ScannerHelper.isDigit(this.currentCharacter)) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } >+ if (this.currentCharacter == '_') { >+ // wrongly place '_' >+ consumeDigits(10); >+ throw new InvalidInputException(INVALID_UNDERSCORE); >+ } > throw new InvalidInputException(INVALID_FLOAT); >- while (getNextCharAsDigit()){/*empty*/} >- if (getNextChar('f', 'F') >= 0) >+ } >+ consumeDigits(10, true); >+ if (getNextChar('f', 'F') >= 0) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > return TokenNameFloatingPointLiteral; >- if (getNextChar('d', 'D') >= 0) >+ } >+ if (getNextChar('d', 'D') >= 0) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > return TokenNameDoubleLiteral; >+ } > if (getNextChar('l', 'L') >= 0) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > throw new InvalidInputException(INVALID_HEXA); > } >+ if (this.sourceLevel < ClassFileConstants.JDK1_5) { >+ throw new InvalidInputException(ILLEGAL_HEXA_LITERAL); >+ } > return TokenNameDoubleLiteral; > } else { > if (end == start) > throw new InvalidInputException(INVALID_HEXA); > return TokenNameIntegerLiteral; > } >+ } else if (getNextChar('b', 'B') >= 0) { //----------binary----------------- >+ int start = this.currentPosition; >+ consumeDigits(2, true); >+ int end = this.currentPosition; >+ if (end == start) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_7) { >+ throw new InvalidInputException(ILLEGAL_BINARY_LITERAL); >+ } >+ throw new InvalidInputException(INVALID_BINARY); >+ } >+ if (getNextChar('l', 'L') >= 0) { >+ if (this.sourceLevel < ClassFileConstants.JDK1_7) { >+ throw new InvalidInputException(ILLEGAL_BINARY_LITERAL); >+ } >+ return TokenNameLongLiteral; >+ } >+ if (this.sourceLevel < ClassFileConstants.JDK1_7) { >+ throw new InvalidInputException(ILLEGAL_BINARY_LITERAL); >+ } >+ return TokenNameIntegerLiteral; > } > >- //there is x or X in the number >- //potential octal ! ... some one may write 000099.0 ! thus 00100 < 00078.0 is true !!!!! crazy language >+ //there is no x or X nor b or B in the number >+ //potential octal > if (getNextCharAsDigit()) { //-------------potential octal----------------- >- while (getNextCharAsDigit()){/*empty*/} >+ consumeDigits(10); > > if (getNextChar('l', 'L') >= 0) { > return TokenNameLongLiteral; >@@ -3513,13 +3833,13 @@ > boolean isInteger = true; > if (getNextChar('.')) { > isInteger = false; >- while (getNextCharAsDigit()){/*empty*/} >+ consumeDigits(10); > } > if (getNextChar('e', 'E') >= 0) { // consume next character > isInteger = false; > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3528,10 +3848,10 @@ > } > > if ((this.currentCharacter == '-') >- || (this.currentCharacter == '+')) { // consume next character >+ || (this.currentCharacter == '+')) { // consume next character > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3539,9 +3859,15 @@ > } > } > } >- if (!ScannerHelper.isDigit(this.currentCharacter)) >+ if (!ScannerHelper.isDigit(this.currentCharacter)) { >+ if (this.currentCharacter == '_') { >+ // wrongly place '_' >+ consumeDigits(10); >+ throw new InvalidInputException(INVALID_UNDERSCORE); >+ } > throw new InvalidInputException(INVALID_FLOAT); >- while (getNextCharAsDigit()){/*empty*/} >+ } >+ consumeDigits(10, true); > } > if (getNextChar('f', 'F') >= 0) > return TokenNameFloatingPointLiteral; >@@ -3554,13 +3880,13 @@ > } > } > >- while (getNextCharAsDigit()){/*empty*/} >+ consumeDigits(10); > > if ((!dotPrefix) && (getNextChar('l', 'L') >= 0)) > return TokenNameLongLiteral; > > if ((!dotPrefix) && (getNextChar('.'))) { //decimal part that can be empty >- while (getNextCharAsDigit()){/*empty*/} >+ consumeDigits(10, true); > floating = true; > } > >@@ -3571,7 +3897,7 @@ > // consume next character > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3580,10 +3906,10 @@ > } > > if ((this.currentCharacter == '-') >- || (this.currentCharacter == '+')) { // consume next character >+ || (this.currentCharacter == '+')) { // consume next character > this.unicodeAsBackSlash = false; > if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') >- && (this.source[this.currentPosition] == 'u')) { >+ && (this.source[this.currentPosition] == 'u')) { > getNextUnicodeChar(); > } else { > if (this.withoutUnicodePtr != 0) { >@@ -3591,9 +3917,15 @@ > } > } > } >- if (!ScannerHelper.isDigit(this.currentCharacter)) >+ if (!ScannerHelper.isDigit(this.currentCharacter)) { >+ if (this.currentCharacter == '_') { >+ // wrongly place '_' >+ consumeDigits(10); >+ throw new InvalidInputException(INVALID_UNDERSCORE); >+ } > throw new InvalidInputException(INVALID_FLOAT); >- while (getNextCharAsDigit()){/*empty*/} >+ } >+ consumeDigits(10, true); > } > > if (getNextChar('d', 'D') >= 0) >@@ -3668,7 +4000,7 @@ > buffer.append(this.source, 0, this.startPosition); > } else { > buffer.append("<source beginning>\n...\n"); //$NON-NLS-1$ >- int line = Util.getLineNumber(this.startPosition-1000, this.lineEnds, 0, this.linePtr); >+ int line = Util.getLineNumber(this.startPosition-1000, this.lineEnds, 0, this.lineEnds.length); > int lineStart = getLineStart(line); > buffer.append(this.source, lineStart, this.startPosition-lineStart); > } >@@ -3900,20 +4232,29 @@ > } > public void unicodeInitializeBuffer(int length) { > this.withoutUnicodePtr = length; >- if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[length+(1+10)]; >- int bLength = this.withoutUnicodeBuffer.length; >- if (1+length >= bLength) { >- System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length + (1+10)], 0, bLength); >- } >+ if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[length+(1+10)]; >+ int bLength = this.withoutUnicodeBuffer.length; >+ if (1+length >= bLength) { >+ System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length + (1+10)], 0, bLength); >+ } > System.arraycopy(this.source, this.startPosition, this.withoutUnicodeBuffer, 1, length); > } > public void unicodeStore() { > int pos = ++this.withoutUnicodePtr; >- if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[10]; >- int length = this.withoutUnicodeBuffer.length; >- if (pos == length) { >- System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length * 2], 0, length); >- } >+ if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[10]; >+ int length = this.withoutUnicodeBuffer.length; >+ if (pos == length) { >+ System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length * 2], 0, length); >+ } > this.withoutUnicodeBuffer[pos] = this.currentCharacter; > } >+public void unicodeStore(char character) { >+ int pos = ++this.withoutUnicodePtr; >+ if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[10]; >+ int length = this.withoutUnicodeBuffer.length; >+ if (pos == length) { >+ System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length * 2], 0, length); >+ } >+ this.withoutUnicodeBuffer[pos] = character; >+} > } >Index: model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java >=================================================================== >RCS file: model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java >diff -N model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,70 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.core.util; >+ >+import org.eclipse.jdt.core.util.ClassFormatException; >+import org.eclipse.jdt.core.util.IConstantPool; >+import org.eclipse.jdt.core.util.IExtendedAnnotation; >+import org.eclipse.jdt.core.util.IRuntimeInvisibleTypeAnnotationsAttribute; >+ >+/** >+ * Default implementation of IRuntimeInvisibleTypeAnnotations >+ */ >+public class RuntimeInvisibleTypeAnnotationsAttribute >+ extends ClassFileAttribute >+ implements IRuntimeInvisibleTypeAnnotationsAttribute { >+ >+ private static final IExtendedAnnotation[] NO_ENTRIES = new IExtendedAnnotation[0]; >+ private int extendedAnnotationsNumber; >+ private IExtendedAnnotation[] extendedAnnotations; >+ >+ /** >+ * Constructor for RuntimeInvisibleTypeAnnotations. >+ * @param classFileBytes >+ * @param constantPool >+ * @param offset >+ * @throws ClassFormatException >+ */ >+ public RuntimeInvisibleTypeAnnotationsAttribute( >+ byte[] classFileBytes, >+ IConstantPool constantPool, >+ int offset) >+ throws ClassFormatException { >+ super(classFileBytes, constantPool, offset); >+ // read extended annotations >+ final int length = u2At(classFileBytes, 6, offset); >+ this.extendedAnnotationsNumber = length; >+ if (length != 0) { >+ int readOffset = 8; >+ this.extendedAnnotations = new IExtendedAnnotation[length]; >+ for (int i = 0; i < length; i++) { >+ ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset); >+ this.extendedAnnotations[i] = extendedAnnotation; >+ readOffset += extendedAnnotation.sizeInBytes(); >+ } >+ } else { >+ this.extendedAnnotations = NO_ENTRIES; >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotations() >+ */ >+ public IExtendedAnnotation[] getExtendedAnnotations() { >+ return this.extendedAnnotations; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotationsNumber() >+ */ >+ public int getExtendedAnnotationsNumber() { >+ return this.extendedAnnotationsNumber; >+ } >+} >Index: model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java >=================================================================== >RCS file: model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java >diff -N model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,67 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.core.util; >+ >+import org.eclipse.jdt.core.util.ClassFormatException; >+import org.eclipse.jdt.core.util.IConstantPool; >+import org.eclipse.jdt.core.util.IExtendedAnnotation; >+import org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotationsAttribute; >+ >+/** >+ * Default implementation of IRuntimeVisibleTypeAnnotations >+ */ >+public class RuntimeVisibleTypeAnnotationsAttribute >+ extends ClassFileAttribute >+ implements IRuntimeVisibleTypeAnnotationsAttribute { >+ >+ private static final IExtendedAnnotation[] NO_ENTRIES = new IExtendedAnnotation[0]; >+ private int extendedAnnotationsNumber; >+ private IExtendedAnnotation[] extendedAnnotations; >+ >+ /** >+ * Constructor for RuntimeVisibleTypeAnnotations. >+ * @param classFileBytes >+ * @param constantPool >+ * @param offset >+ * @throws ClassFormatException >+ */ >+ public RuntimeVisibleTypeAnnotationsAttribute( >+ byte[] classFileBytes, >+ IConstantPool constantPool, >+ int offset) throws ClassFormatException { >+ super(classFileBytes, constantPool, offset); >+ final int length = u2At(classFileBytes, 6, offset); >+ this.extendedAnnotationsNumber = length; >+ if (length != 0) { >+ int readOffset = 8; >+ this.extendedAnnotations = new IExtendedAnnotation[length]; >+ for (int i = 0; i < length; i++) { >+ ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset); >+ this.extendedAnnotations[i] = extendedAnnotation; >+ readOffset += extendedAnnotation.sizeInBytes(); >+ } >+ } else { >+ this.extendedAnnotations = NO_ENTRIES; >+ } >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotations#getAnnotations() >+ */ >+ public IExtendedAnnotation[] getExtendedAnnotations() { >+ return this.extendedAnnotations; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotations#getAnnotationsNumber() >+ */ >+ public int getExtendedAnnotationsNumber() { >+ return this.extendedAnnotationsNumber; >+ } >+} >Index: model/org/eclipse/jdt/internal/core/util/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties,v >retrieving revision 1.83 >diff -u -r1.83 messages.properties >--- model/org/eclipse/jdt/internal/core/util/messages.properties 18 Jan 2011 05:42:02 -0000 1.83 >+++ model/org/eclipse/jdt/internal/core/util/messages.properties 20 Jan 2011 21:55:36 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2010 IBM Corporation and others. >+# Copyright (c) 2000, 2011 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 >@@ -313,9 +313,14 @@ > disassembler_annotationarrayvalueend = ] > disassembler_annotationentrystart = #{0} @{1}( > disassembler_annotationentryend = ) >+# jsr308 >+disassembler_extendedannotationentrystart=#{0} @{1}( >+disassembler_extendedannotationentryend= ) > disassembler_annotationcomponent = #{0} {1}= > disassembler_runtimevisibleannotationsattributeheader= RuntimeVisibleAnnotations:\ > disassembler_runtimeinvisibleannotationsattributeheader= RuntimeInvisibleAnnotations:\ >+disassembler_runtimevisibletypeannotationsattributeheader= RuntimeVisibleTypeAnnotations:\ >+disassembler_runtimeinvisibletypeannotationsattributeheader= RuntimeInvisibleTypeAnnotations:\ > disassembler_runtimevisibleparameterannotationsattributeheader= RuntimeVisibleParameterAnnotations:\ > disassembler_runtimeinvisibleparameterannotationsattributeheader= RuntimeInvisibleParameterAnnotations:\ > disassembler_parameterannotationentrystart=Number of annotations for parameter {0}: {1} >@@ -332,6 +337,21 @@ > disassembler_frame_full_frame=[pc: {0}, full, stack: {4}, locals: {2}] > disassembler_frame_same_frame=[pc: {0}, same] > disassembler_frame_same_locals_1_stack_item=[pc: {0}, same_locals_1_stack_item, stack: {1}] >+ >+# jsr 308 >+disassembler_extendedannotation_targetType=target type = 0x{0} {1} >+disassembler_extendedannotation_classextendsimplements=type index = {0} >+disassembler_extendedannotation_locations=locations = {0} >+disassembler_extendedannotation_method_parameter=method parameter index = {0} >+disassembler_extendedannotation_offset=offset = {0} >+disassembler_extendedannotation_throws=throws index = {0} >+disassembler_extendedannotation_type_argument=type argument index = {0} >+disassembler_extendedannotation_type_parameter=type parameter index = {0} >+disassembler_extendedannotation_type_parameter_with_bound=type parameter index = {0} type parameter bound index = {1} >+disassembler_extendedannotation_wildcardlocationtype=wildcard location type = 0x{0} {1} >+disassembler_extendedannotation_wildcardlocations=wildcard locations = {0} >+disassembler_localvariabletargetheader=local variable entries: >+ > ### classfileformat decoding > classfileformat_versiondetails =\ (version {0} : {1}.{2}, {3}) > classfileformat_methoddescriptor = // Method descriptor #{0} {1} >@@ -379,6 +399,8 @@ > classfileformat_exceptiontableentry = [pc: {0}, pc: {1}] -> {2} when : {3} > classfileformat_linenumbertableentry = [pc: {0}, line: {1}] > classfileformat_localvariabletableentry = [pc: {0}, pc: {1}] local: {2} index: {3} type: {4} >+# jsr 308 >+classfileformat_localvariablereferenceinfoentry=[pc: {0}, pc: {1}] index: {2} > > ### Eclipse Java Core completion messages. > engine_completing = Computing proposals... >Index: notes/TODO.txt >=================================================================== >RCS file: notes/TODO.txt >diff -N notes/TODO.txt >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ notes/TODO.txt 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+To be done: >+- check that all wrong usages of modifiers are properly reported >+- implement recovery, code assist and selection parsers >+- code generation >+- disassembler >+- formatter >+- search (indexer) >+- DOM/AST >+- type parameter generic or array ? >+ >+Javac issues to double-check: >+- some locals are missing ranges see test25 >+- wrong offset for annotations on method calls >+ >+- wrong locations for I in: >+ @A Map<@B String, @C List<@H String @E[] [] @G[]>> @I[] [] @J[] field; >+ @A Map<@B String, @C List<@H String @E[] [] @G[]>> [] @I[] @J[] field; >+I has the same location in both cases >+ >+- Initialize allTypeAnnotationContexts for TypeAnnotationCodStream only if needed >+- check synthetic methods >+ >+- need to decide if "0x11aa.aap-3333f" should be seen as one token regardless of the scanner compliance >+I think we should always report one token and then report an error if the token is illegal for the given source version >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java,v >retrieving revision 1.88 >diff -u -r1.88 MatchLocatorParser.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java 7 Sep 2010 08:16:19 -0000 1.88 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java 20 Jan 2011 21:55:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -213,45 +213,35 @@ > super.consumeCastExpressionLL1(); > if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { > CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; >- if (castExpression.type instanceof TypeReference) { >- this.patternLocator.match((TypeReference) castExpression.type, this.nodeSet); >- } >+ this.patternLocator.match(castExpression.type, this.nodeSet); > } > } > protected void consumeCastExpressionWithGenericsArray() { > super.consumeCastExpressionWithGenericsArray(); > if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { > CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; >- if (castExpression.type instanceof Reference) { >- this.patternLocator.match((Reference) castExpression.type, this.nodeSet); >- } >+ this.patternLocator.match(castExpression.type, this.nodeSet); > } > } > protected void consumeCastExpressionWithNameArray() { > super.consumeCastExpressionWithNameArray(); > if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { > CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; >- if (castExpression.type instanceof Reference) { >- this.patternLocator.match((Reference) castExpression.type, this.nodeSet); >- } >- } >+ this.patternLocator.match(castExpression.type, this.nodeSet); >+ } > } > protected void consumeCastExpressionWithPrimitiveType() { > super.consumeCastExpressionWithPrimitiveType(); > if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { > CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; >- if (castExpression.type instanceof Reference) { >- this.patternLocator.match((Reference) castExpression.type, this.nodeSet); >- } >+ this.patternLocator.match(castExpression.type, this.nodeSet); > } > } > protected void consumeCastExpressionWithQualifiedGenericsArray() { > super.consumeCastExpressionWithQualifiedGenericsArray(); > if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { > CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; >- if (castExpression.type instanceof Reference) { >- this.patternLocator.match((Reference) castExpression.type, this.nodeSet); >- } >+ this.patternLocator.match(castExpression.type, this.nodeSet); > } > } > >@@ -739,8 +729,16 @@ > this.nodeSet.addTrustedMatch(result, true); > return result; > } >-protected TypeReference getTypeReference(int dim) { >- TypeReference typeRef = super.getTypeReference(dim); >+protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation [][] annotationsOnDimensions) { >+ TypeReference result = super.copyDims(typeRef, dim, annotationsOnDimensions); >+ if (this.nodeSet.removePossibleMatch(typeRef) != null) >+ this.nodeSet.addPossibleMatch(result); >+ else if (this.nodeSet.removeTrustedMatch(typeRef) != null) >+ this.nodeSet.addTrustedMatch(result, true); >+ return result; >+} >+protected TypeReference getUnannotatedTypeReference(int dim) { >+ TypeReference typeRef = super.getUnannotatedTypeReference(dim); > if (this.patternFineGrain == 0) { > this.patternLocator.match(typeRef, this.nodeSet); // NB: Don't check container since type reference can happen anywhere > } >#P org.eclipse.jdt.core.tests >Index: Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java >=================================================================== >RCS file: /home/cvs/numbat/org.eclipse.jdt.core.tests/Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java,v >retrieving revision 1.343 >diff -u -r1.343 NegativeTest.java >--- Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 23 Oct 2010 00:18:44 -0000 1.343 >+++ Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 20 Jan 2011 21:55:46 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2010 IBM Corporation and others. >+ * Copyright (c) 2005, 2011 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 >@@ -2172,11 +2172,16 @@ > " public static final x;\n" + > "}", > }, >- "----------\n" + >- "1. ERROR in p\\X.java (at line 3)\n" + >- " public static final x;\n" + >- " ^^^^^\n" + >- "Syntax error on token \"final\", invalid Type\n" + >+ "----------\n" + >+ "1. ERROR in p\\X.java (at line 3)\n" + >+ " public static final x;\n" + >+ " ^\n" + >+ "Syntax error, insert \"Identifier (\" to complete MethodHeaderName\n" + >+ "----------\n" + >+ "2. ERROR in p\\X.java (at line 3)\n" + >+ " public static final x;\n" + >+ " ^\n" + >+ "Syntax error, insert \")\" to complete MethodDeclaration\n" + > "----------\n" > ); > } >@@ -4812,21 +4817,21 @@ > " }\n" + > "}", > }, >- "----------\n" + >- "1. ERROR in p\\NA.java (at line 7)\n" + >- " (new Class1).run();\n" + >- " ^^^\n" + >- "Syntax error on token \"new\", delete this token\n" + >- "----------\n" + >- "2. ERROR in p\\NA.java (at line 8)\n" + >- " (new Class2).run();\n" + >- " ^^^\n" + >- "Syntax error on token \"new\", delete this token\n" + >- "----------\n" + >- "3. ERROR in p\\NA.java (at line 9)\n" + >- " (new Class3).run();\n" + >- " ^^^\n" + >- "Syntax error on token \"new\", delete this token\n" + >+ "----------\n" + >+ "1. ERROR in p\\NA.java (at line 7)\n" + >+ " (new Class1).run();\n" + >+ " ^^^^^^\n" + >+ "Syntax error, insert \"Dimensions\" to complete Expression\n" + >+ "----------\n" + >+ "2. ERROR in p\\NA.java (at line 8)\n" + >+ " (new Class2).run();\n" + >+ " ^^^^^^\n" + >+ "Syntax error, insert \"Dimensions\" to complete Expression\n" + >+ "----------\n" + >+ "3. ERROR in p\\NA.java (at line 9)\n" + >+ " (new Class3).run();\n" + >+ " ^^^^^^\n" + >+ "Syntax error, insert \"Dimensions\" to complete Expression\n" + > "----------\n" > ); > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java >diff -N src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,643 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.parser; >+ >+import java.io.BufferedReader; >+import java.io.File; >+import java.io.FileInputStream; >+import java.io.FileOutputStream; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.io.OutputStreamWriter; >+import java.util.HashMap; >+import java.util.Locale; >+import java.util.Map; >+ >+import org.eclipse.jdt.core.compiler.CategorizedProblem; >+import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; >+import org.eclipse.jdt.core.tests.util.CompilerTestSetup; >+import org.eclipse.jdt.core.tests.util.Util; >+import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; >+import org.eclipse.jdt.internal.codeassist.select.SelectionParser; >+import org.eclipse.jdt.internal.compiler.ASTVisitor; >+import org.eclipse.jdt.internal.compiler.CompilationResult; >+import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; >+import org.eclipse.jdt.internal.compiler.DocumentElementParser; >+import org.eclipse.jdt.internal.compiler.IDocumentElementRequestor; >+import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; >+import org.eclipse.jdt.internal.compiler.SourceElementParser; >+import org.eclipse.jdt.internal.compiler.ast.Annotation; >+import org.eclipse.jdt.internal.compiler.ast.Argument; >+import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.Expression; >+import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.ImportReference; >+import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation; >+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation; >+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation; >+import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; >+import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; >+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; >+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >+import org.eclipse.jdt.internal.compiler.lookup.BlockScope; >+import org.eclipse.jdt.internal.compiler.lookup.ClassScope; >+import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; >+import org.eclipse.jdt.internal.compiler.lookup.MethodScope; >+import org.eclipse.jdt.internal.compiler.parser.Parser; >+import org.eclipse.jdt.internal.compiler.problem.DefaultProblem; >+import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; >+import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; >+import org.eclipse.jdt.internal.core.search.indexing.IndexingParser; >+import org.eclipse.jdt.internal.core.util.CommentRecorderParser; >+ >+public abstract class AbstractTypeAnnotationSyntaxTest extends AbstractCompilerTest implements IDocumentElementRequestor, ISourceElementRequestor { >+ static final class LocationPrinterVisitor extends ASTVisitor { >+ Annotation[] primaryAnnotations; >+ TypeReference enclosingReference; >+ Map locations; >+ >+ public LocationPrinterVisitor() { >+ this.locations = new HashMap(); >+ } >+ >+ public Map getLocations() { >+ return this.locations; >+ } >+ public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) { >+ Annotation[] annotations = fieldDeclaration.annotations; >+ this.enclosingReference = fieldDeclaration.type; >+ this.primaryAnnotations = annotations; >+ return true; >+ } >+ public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { >+ this.primaryAnnotations = methodDeclaration.annotations; >+ TypeReference returnType = methodDeclaration.returnType; >+ if (returnType != null) { >+ this.enclosingReference = returnType; >+ returnType.traverse(this, scope); >+ } >+ if (methodDeclaration.thrownExceptions != null) { >+ int thrownExceptionsLength = methodDeclaration.thrownExceptions.length; >+ for (int i = 0; i < thrownExceptionsLength; i++) { >+ TypeReference typeReference = methodDeclaration.thrownExceptions[i]; >+ this.enclosingReference = typeReference; >+ this.primaryAnnotations = null; >+ typeReference.traverse(this, scope); >+ } >+ } >+ return false; >+ } >+ public boolean visit(Argument argument, ClassScope scope) { >+ Annotation[] annotations = argument.annotations; >+ this.enclosingReference = argument.type; >+ this.primaryAnnotations = annotations; >+ return true; >+ } >+ public boolean visit(Argument argument, BlockScope scope) { >+ Annotation[] annotations = argument.annotations; >+ this.enclosingReference = argument.type; >+ this.primaryAnnotations = annotations; >+ return true; >+ } >+ public boolean visit(MarkerAnnotation annotation, BlockScope scope) { >+ if (this.enclosingReference != null) { >+ storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null)); >+ } >+ return false; >+ } >+ public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) { >+ if (this.enclosingReference != null) { >+ storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null)); >+ } >+ return false; >+ } >+ public boolean visit(NormalAnnotation annotation, BlockScope scope) { >+ if (this.enclosingReference != null) { >+ storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null)); >+ } >+ return false; >+ } >+ public void storeLocations(Annotation annotation, int[] tab) { >+ String key = String.valueOf(annotation); >+ if (this.locations.get(key) != null) { >+ return; >+ } >+ if (tab == null) { >+ this.locations.put(key, null); >+ return; >+ } >+ StringBuffer buffer = new StringBuffer("{"); >+ for (int i = 0, max = tab.length; i < max; i++) { >+ if (i > 0) { >+ buffer.append(','); >+ } >+ buffer.append(tab[i]); >+ } >+ buffer.append('}'); >+ this.locations.put(key, String.valueOf(buffer)); >+ } >+ >+ public boolean visit(ArrayTypeReference arrayReference, BlockScope scope) { >+ if (this.enclosingReference == null) return false; >+ return true; >+ } >+ public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) { >+ if (this.enclosingReference == null) return false; >+ return true; >+ } >+ public boolean visit(SingleTypeReference typeReference, BlockScope scope) { >+ if (this.enclosingReference == null) return false; >+ return true; >+ } >+ } >+ protected static String jsr308TestScratchArea = "c:\\Jsr308TestScratchArea"; >+ protected static final int CHECK_PARSER = 0x1; >+ protected static final int CHECK_COMPLETION_PARSER = 0x2; >+ protected static final int CHECK_SELECTION_PARSER = 0x4; >+ protected static final int CHECK_DOCUMENT_ELEMENT_PARSER = 0x8; >+ protected static final int CHECK_COMMENT_RECORDER_PARSER = 0x10; >+ protected static final int CHECK_SOURCE_ELEMENT_PARSER = 0x20; >+ protected static final int CHECK_INDEXING_PARSER = 0x40; >+ protected static final int CHECK_JAVAC_PARSER = 0x80; >+ protected static int CHECK_ALL = (CHECK_PARSER | CHECK_COMPLETION_PARSER | CHECK_SELECTION_PARSER | >+ CHECK_DOCUMENT_ELEMENT_PARSER | CHECK_COMMENT_RECORDER_PARSER | >+ CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER); >+ public static final String compiler = "C:\\jdk-7-ea-bin-b75-windows-i586-30_oct_2009\\jdk7\\bin\\javac.exe"; >+ public static boolean optimizeStringLiterals = false; >+ >+ >+ >+public void initialize(CompilerTestSetup setUp) { >+ super.initialize(setUp); >+} >+public AbstractTypeAnnotationSyntaxTest(String testName){ >+ super(testName); >+ if ((new File(compiler).exists())) { >+ File f = new File(jsr308TestScratchArea); >+ if (!f.exists()) { >+ f.mkdir(); >+ } >+ if (f.exists()) { >+ try { >+ OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Marker.java"))); >+ w.write("@interface Marker {}\n".toCharArray()); >+ w.close(); >+ w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Normal.java"))); >+ w.write("@interface Normal {\n\tint value() default 10;\n}\n".toCharArray()); >+ w.close(); >+ w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "SingleMember.java"))); >+ w.write("@interface SingleMember {\n\tint value() default 10;\n}\n".toCharArray()); >+ w.close(); >+ w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Positive.java"))); >+ w.write("@interface Positive {}\n".toCharArray()); >+ w.close(); >+ w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Negative.java"))); >+ w.write("@interface Negative{}\n".toCharArray()); >+ w.close(); >+ w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Readonly.java"))); >+ w.write("@interface Readonly {}\n".toCharArray()); >+ w.close(); >+ w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "NonNull.java"))); >+ w.write("@interface NonNull {}\n".toCharArray()); >+ w.close(); >+ w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "HashMap.java"))); >+ w.write("class HashMap<X,Y> {\n class Iterator {}; \n}\n".toCharArray()); >+ w.close(); >+ CHECK_ALL |= CHECK_JAVAC_PARSER; >+ } catch (IOException e) { >+ // ignore >+ } >+ } >+ } >+} >+public void checkParse( >+ int parserToCheck, >+ char[] source, >+ String expectedSyntaxErrorDiagnosis, >+ String testName, String expectedUnitToString, >+ ASTVisitor visitor) throws IOException { >+ >+ CompilerOptions options = new CompilerOptions(getCompilerOptions()); >+ options.complianceLevel = ClassFileConstants.JDK1_7; >+ options.sourceLevel = ClassFileConstants.JDK1_7; >+ options.targetJDK = ClassFileConstants.JDK1_7; >+ >+ ICompilationUnit sourceUnit = null; >+ CompilationResult compilationResult = null; >+ CompilationUnitDeclaration unit = null; >+ >+ if ((parserToCheck & CHECK_JAVAC_PARSER) != 0) { >+ String javaFilePath = jsr308TestScratchArea + "\\Xyz.java"; >+ File f = new File(javaFilePath); >+ FileOutputStream o = new FileOutputStream(f); >+ OutputStreamWriter w = new OutputStreamWriter(o); >+ w.write(source); >+ w.close(); >+ Process p = Runtime.getRuntime().exec (new String[] { compiler, "-sourcepath", jsr308TestScratchArea, javaFilePath }, null, new File(jsr308TestScratchArea)); >+ try { >+ BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); >+ BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream())); >+ String line; >+ while ((line = stderr.readLine())!= null) >+ System.out.println(line); >+ while ((line = stdout.readLine())!= null) >+ System.out.println(line); >+ assertTrue("javac unhappy", p.waitFor() == 0); >+ } catch (InterruptedException e) { >+ System.err.println("Skipped javac behavior check due to interrupt..."); >+ } >+ } >+ if ((parserToCheck & CHECK_PARSER) != 0) { >+ Parser parser1 = >+ new Parser( >+ new ProblemReporter( >+ DefaultErrorHandlingPolicies.proceedWithAllProblems(), >+ options, >+ new DefaultProblemFactory(Locale.getDefault())), >+ optimizeStringLiterals); >+ sourceUnit = new CompilationUnit(source, testName, null); >+ compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); >+ unit = parser1.parse(sourceUnit, compilationResult); >+ parser1.getMethodBodies(unit); >+ assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); >+ assertParseTreeEquals(expectedUnitToString, unit.toString()); >+ if (visitor != null) { >+ unit.traverse(visitor, (CompilationUnitScope) null); >+ } >+ parser1 = null; >+ } >+ >+ if ((parserToCheck & CHECK_COMPLETION_PARSER) != 0) { >+ CompletionParser parser2 = new CompletionParser( >+ new ProblemReporter( >+ DefaultErrorHandlingPolicies.proceedWithAllProblems(), >+ options, >+ new DefaultProblemFactory(Locale.getDefault())), >+ false); >+ compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); >+ unit = parser2.parse(sourceUnit, compilationResult, Integer.MAX_VALUE); >+ parser2.getMethodBodies(unit); >+ assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); >+ assertParseTreeEquals(expectedUnitToString, unit.toString()); >+ parser2 = null; >+ } >+ if ((parserToCheck & CHECK_SELECTION_PARSER) != 0) { >+ SelectionParser parser3 = new SelectionParser( >+ new ProblemReporter( >+ DefaultErrorHandlingPolicies.proceedWithAllProblems(), >+ options, >+ new DefaultProblemFactory(Locale.getDefault()))); >+ compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); >+ unit = parser3.parse(sourceUnit, compilationResult, Integer.MAX_VALUE, Integer.MAX_VALUE); >+ parser3.getMethodBodies(unit); >+ assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); >+ assertParseTreeEquals(expectedUnitToString, unit.toString()); >+ parser3 = null; >+ } >+ if ((parserToCheck & CHECK_DOCUMENT_ELEMENT_PARSER) != 0) { >+ DocumentElementParser parser4 = new DocumentElementParser( >+ this, >+ new DefaultProblemFactory(Locale.getDefault()), >+ options); >+ compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); >+ unit = parser4.parse(sourceUnit, compilationResult); >+ parser4.getMethodBodies(unit); >+ assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); >+ assertParseTreeEquals(expectedUnitToString, unit.toString()); >+ parser4 = null; >+ } >+ if ((parserToCheck & CHECK_COMMENT_RECORDER_PARSER) != 0) { >+ CommentRecorderParser parser5 = new CommentRecorderParser( >+ new ProblemReporter( >+ DefaultErrorHandlingPolicies.proceedWithAllProblems(), >+ options, >+ new DefaultProblemFactory(Locale.getDefault())), >+ optimizeStringLiterals); >+ compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); >+ unit = parser5.parse(sourceUnit, compilationResult); >+ parser5.getMethodBodies(unit); >+ assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); >+ assertParseTreeEquals(expectedUnitToString, unit.toString()); >+ parser5 = null; >+ } >+ if ((parserToCheck & CHECK_SOURCE_ELEMENT_PARSER) != 0) { >+ SourceElementParser parser6 = new SourceElementParser(this, >+ new DefaultProblemFactory(Locale.getDefault()), >+ options, >+ true, >+ optimizeStringLiterals); >+ compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); >+ unit = parser6.parse(sourceUnit, compilationResult); >+ parser6.getMethodBodies(unit); >+ assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); >+ assertParseTreeEquals(expectedUnitToString, unit.toString()); >+ parser6 = null; >+ } >+ if ((parserToCheck & CHECK_INDEXING_PARSER) != 0) { >+ IndexingParser parser7 = new IndexingParser(this, >+ new DefaultProblemFactory(Locale.getDefault()), >+ options, >+ true, >+ optimizeStringLiterals, false); >+ compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); >+ unit = parser7.parse(sourceUnit, compilationResult); >+ parser7.getMethodBodies(unit); >+ assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); >+ assertParseTreeEquals(expectedUnitToString, unit.toString()); >+ parser7 = null; >+ } >+} >+public void checkParse( >+ int parserToCheck, >+ char[] source, >+ String expectedSyntaxErrorDiagnosis, >+ String testName, >+ String expectedUnitToString) throws IOException { >+ checkParse(parserToCheck, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, null); >+} >+public void checkParse( >+ char[] source, >+ String expectedSyntaxErrorDiagnosis, >+ String testName, String expectedUnitToString) throws IOException { >+ checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString); >+} >+public void checkParse( >+ char[] source, >+ String expectedSyntaxErrorDiagnosis, >+ String testName, String expectedUnitToString, >+ ASTVisitor visitor) throws IOException { >+ checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, visitor); >+} >+private void assertParseTreeEquals(String expectedUnitToString, String computedUnitToString) { >+ if (expectedUnitToString == null) { // just checking that we are able to digest. >+ return; >+ } >+ if (!expectedUnitToString.equals(computedUnitToString)) { >+ System.out.println(Util.displayString(computedUnitToString)); >+ } >+ assertEquals("Parse Tree is wrong", >+ Util.convertToIndependantLineDelimiter(expectedUnitToString), >+ Util.convertToIndependantLineDelimiter(computedUnitToString)); >+} >+private void assertDianosticEquals(String expectedSyntaxErrorDiagnosis, >+ String testName, CompilationResult compilationResult) { >+ String computedSyntaxErrorDiagnosis = getCompilerMessages(compilationResult); >+ assertEquals( >+ "Invalid syntax error diagnosis" + testName, >+ Util.convertToIndependantLineDelimiter(expectedSyntaxErrorDiagnosis), >+ Util.convertToIndependantLineDelimiter(computedSyntaxErrorDiagnosis)); >+} >+private String getCompilerMessages(CompilationResult compilationResult) { >+ StringBuffer buffer = new StringBuffer(100); >+ if (compilationResult.hasProblems() || compilationResult.hasTasks()) { >+ CategorizedProblem[] problems = compilationResult.getAllProblems(); >+ int count = problems.length; >+ int problemCount = 0; >+ char[] unitSource = compilationResult.compilationUnit.getContents(); >+ for (int i = 0; i < count; i++) { >+ if (problems[i] != null) { >+ if (problemCount == 0) >+ buffer.append("----------\n"); >+ problemCount++; >+ buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING")); >+ buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\')); >+ try { >+ buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource)); >+ buffer.append("\n"); >+ buffer.append(problems[i].getMessage()); >+ buffer.append("\n"); >+ } catch (Exception e) { >+ } >+ buffer.append("----------\n"); >+ } >+ } >+ } >+ String computedSyntaxErrorDiagnosis = buffer.toString(); >+ return computedSyntaxErrorDiagnosis; >+} >+ >+void traverse (File f) throws IOException { >+if (f.isDirectory()) { >+ File [] files = f.listFiles(); >+ for (int i = 0; i < files.length; i++) { >+ traverse(files[i]); >+ } >+} else { >+ if (f.getName().endsWith(".java")) { >+ System.out.println(f.getCanonicalPath()); >+ char [] contents = new char[(int) f.length()]; >+ FileInputStream fs = new FileInputStream(f); >+ InputStreamReader isr = new InputStreamReader(fs); >+ isr.read(contents); >+ checkParse(contents, null, f.getCanonicalPath(), null); >+ } >+} >+} >+public void _test000() throws IOException { >+traverse(new File("C:\\jsr308tests")); >+} >+ >+public void acceptImport(int declarationStart, int declarationEnd, >+ int[] javaDocPositions, char[] name, int nameStartPosition, >+ boolean onDemand, int modifiers) { >+ >+ >+} >+public void acceptInitializer(int declarationStart, int declarationEnd, >+ int[] javaDocPositions, int modifiers, int modifiersStart, >+ int bodyStart, int bodyEnd) { >+ >+ >+} >+public void acceptLineSeparatorPositions(int[] positions) { >+ >+ >+} >+public void acceptPackage(int declarationStart, int declarationEnd, >+ int[] javaDocPositions, char[] name, int nameStartPosition) { >+ >+ >+} >+public void acceptProblem(CategorizedProblem problem) { >+ >+ >+} >+public void enterClass(int declarationStart, int[] javaDocPositions, >+ int modifiers, int modifiersStart, int classStart, char[] name, >+ int nameStart, int nameEnd, char[] superclass, int superclassStart, >+ int superclassEnd, char[][] superinterfaces, >+ int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) { >+ >+ >+} >+public void enterCompilationUnit() { >+ >+ >+} >+public void enterConstructor(int declarationStart, int[] javaDocPositions, >+ int modifiers, int modifiersStart, char[] name, int nameStart, >+ int nameEnd, char[][] parameterTypes, int[] parameterTypeStarts, >+ int[] parameterTypeEnds, char[][] parameterNames, >+ int[] parameterNameStarts, int[] parameterNameEnds, int parametersEnd, >+ char[][] exceptionTypes, int[] exceptionTypeStarts, >+ int[] exceptionTypeEnds, int bodyStart) { >+ >+ >+} >+public void enterField(int declarationStart, int[] javaDocPositions, >+ int modifiers, int modifiersStart, char[] type, int typeStart, >+ int typeEnd, int typeDimensionCount, char[] name, int nameStart, >+ int nameEnd, int extendedTypeDimensionCount, >+ int extendedTypeDimensionEnd) { >+ >+ >+} >+public void enterInterface(int declarationStart, int[] javaDocPositions, >+ int modifiers, int modifiersStart, int interfaceStart, char[] name, >+ int nameStart, int nameEnd, char[][] superinterfaces, >+ int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) { >+ >+ >+} >+public void enterMethod(int declarationStart, int[] javaDocPositions, >+ int modifiers, int modifiersStart, char[] returnType, >+ int returnTypeStart, int returnTypeEnd, int returnTypeDimensionCount, >+ char[] name, int nameStart, int nameEnd, char[][] parameterTypes, >+ int[] parameterTypeStarts, int[] parameterTypeEnds, >+ char[][] parameterNames, int[] parameterNameStarts, >+ int[] parameterNameEnds, int parametersEnd, >+ int extendedReturnTypeDimensionCount, >+ int extendedReturnTypeDimensionEnd, char[][] exceptionTypes, >+ int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart) { >+ >+ >+} >+public void exitClass(int bodyEnd, int declarationEnd) { >+ >+ >+} >+public void exitCompilationUnit(int declarationEnd) { >+ >+ >+} >+public void exitConstructor(int bodyEnd, int declarationEnd) { >+ >+ >+} >+public void exitField(int bodyEnd, int declarationEnd) { >+ >+ >+} >+public void exitInterface(int bodyEnd, int declarationEnd) { >+ >+ >+} >+public void exitMethod(int bodyEnd, int declarationEnd) { >+ >+ >+} >+public void acceptAnnotationTypeReference(char[][] annotation, int sourceStart, >+ int sourceEnd) { >+ >+ >+} >+public void acceptAnnotationTypeReference(char[] annotation, int sourcePosition) { >+ >+ >+} >+public void acceptConstructorReference(char[] typeName, int argCount, >+ int sourcePosition) { >+ >+ >+} >+public void acceptFieldReference(char[] fieldName, int sourcePosition) { >+ >+ >+} >+public void acceptImport(int declarationStart, int declarationEnd, >+ int nameStart, int nameEnd, >+ char[][] tokens, boolean onDemand, int modifiers) { >+ >+ >+} >+public void acceptMethodReference(char[] methodName, int argCount, >+ int sourcePosition) { >+ >+ >+} >+public void acceptPackage(ImportReference importReference) { >+ >+ >+} >+public void acceptTypeReference(char[][] typeName, int sourceStart, >+ int sourceEnd) { >+ >+ >+} >+public void acceptTypeReference(char[] typeName, int sourcePosition) { >+ >+ >+} >+public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) { >+ >+ >+} >+public void acceptUnknownReference(char[] name, int sourcePosition) { >+ >+ >+} >+public void enterConstructor(MethodInfo methodInfo) { >+ >+ >+} >+public void enterField(FieldInfo fieldInfo) { >+ >+ >+} >+public void enterInitializer(int declarationStart, int modifiers) { >+ >+ >+} >+public void enterMethod(MethodInfo methodInfo) { >+ >+ >+} >+public void enterType(TypeInfo typeInfo) { >+ >+ >+} >+public void exitConstructor(int declarationEnd) { >+ >+ >+} >+public void exitField(int initializationStart, int declarationEnd, >+ int declarationSourceEnd) { >+ >+ >+} >+public void exitInitializer(int declarationEnd) { >+ >+ >+} >+public void exitMethod(int declarationEnd, Expression defaultValue) { >+ >+ >+} >+public void exitType(int declarationEnd) { >+ >+ >+} >+} >Index: src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java,v >retrieving revision 1.46 >diff -u -r1.46 ComplianceDiagnoseTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java 14 Jan 2011 17:02:23 -0000 1.46 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java 20 Jan 2011 21:55:46 -0000 >@@ -33,16 +33,35 @@ > return ComplianceDiagnoseTest.class; > } > public void runComplianceParserTest( >- String[] testFiles, >- String expected13ProblemLog, >- String expected14ProblemLog, >- String expected15ProblemLog){ >+ String[] testFiles, >+ String expected13ProblemLog, >+ String expected14ProblemLog, >+ String expected15ProblemLog){ >+ runComplianceParserTest( >+ testFiles, >+ expected13ProblemLog, >+ expected14ProblemLog, >+ expected15ProblemLog, >+ expected15ProblemLog, >+ expected15ProblemLog); >+} >+public void runComplianceParserTest( >+ String[] testFiles, >+ String expected13ProblemLog, >+ String expected14ProblemLog, >+ String expected15ProblemLog, >+ String expected16ProblemLog, >+ String expected17ProblemLog){ > if(this.complianceLevel == ClassFileConstants.JDK1_3) { > this.runNegativeTest(testFiles, expected13ProblemLog); > } else if(this.complianceLevel == ClassFileConstants.JDK1_4) { > this.runNegativeTest(testFiles, expected14ProblemLog); >- } else if(this.complianceLevel >= ClassFileConstants.JDK1_5) { >+ } else if(this.complianceLevel == ClassFileConstants.JDK1_5) { > this.runNegativeTest(testFiles, expected15ProblemLog); >+ } else if(this.complianceLevel == ClassFileConstants.JDK1_6) { >+ this.runNegativeTest(testFiles, expected16ProblemLog); >+ } else if(this.complianceLevel >= ClassFileConstants.JDK1_7) { >+ this.runNegativeTest(testFiles, expected17ProblemLog); > } > } > public void test0001() { >@@ -1461,21 +1480,21 @@ > expected13ProblemLog; > > String expected15ProblemLog = >- "----------\n" + >- "1. WARNING in X.java (at line 1)\n" + >- " public class X <T1 extends String, T2 extends Y {\n" + >- " ^^^^^^\n" + >- "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 1)\n" + >- " public class X <T1 extends String, T2 extends Y {\n" + >- " ^\n" + >- "Syntax error, insert \">\" to complete ReferenceType1\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 1)\n" + >- " public class X <T1 extends String, T2 extends Y {\n" + >- " ^\n" + >- "Y cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 1)\n" + >+ " public class X <T1 extends String, T2 extends Y {\n" + >+ " ^^^^^^\n" + >+ "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X <T1 extends String, T2 extends Y {\n" + >+ " ^\n" + >+ "Syntax error, insert \"AdditionalBoundList1\" to complete TypeParameter1\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 1)\n" + >+ " public class X <T1 extends String, T2 extends Y {\n" + >+ " ^\n" + >+ "Y cannot be resolved to a type\n" + > "----------\n"; > > runComplianceParserTest( >@@ -1738,12 +1757,25 @@ > " ^^\n" + > "Syntax error on token \"T2\", delete this token\n" + > "----------\n"; >+ >+ String expected16ProblemLog = >+ expected15ProblemLog; >+ >+ String expected17ProblemLog = >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " public <T1 extends String T2> int foo(){\n" + >+ " ^^^^^^\n" + >+ "Syntax error on token \"String\", strictfp expected\n" + >+ "----------\n"; > > runComplianceParserTest( > testFiles, > expected13ProblemLog, > expected14ProblemLog, >- expected15ProblemLog >+ expected15ProblemLog, >+ expected16ProblemLog, >+ expected17ProblemLog > ); > } > public void test0039() { >@@ -1801,7 +1833,7 @@ > "----------\n" + > "1. ERROR in X.java (at line 2)\n" + > " Z <Y1, Y2 var;\n" + >- " ^^^^^^^\n" + >+ " ^^^^^^\n" + > "Syntax error on token(s), misplaced construct(s)\n" + > "----------\n" + > "2. ERROR in X.java (at line 2)\n" + >@@ -1844,8 +1876,8 @@ > "----------\n" + > "1. ERROR in X.java (at line 2)\n" + > " Z <Y1, for Y2> var;\n" + >- " ^^^^^^^^^^^^\n" + >- "Syntax error on tokens, delete these tokens\n" + >+ " ^^^^^^^^^^^^^^\n" + >+ "Syntax error on tokens, Type expected instead\n" + > "----------\n"; > String expected14ProblemLog = > expected13ProblemLog; >@@ -1857,12 +1889,25 @@ > " ^^^\n" + > "Syntax error on token \"for\", delete this token\n" + > "----------\n"; >- >+ >+ String expected16ProblemLog = >+ expected15ProblemLog; >+ >+ String expected17ProblemLog = >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " Z <Y1, for Y2> var;\n" + >+ " ^^^\n" + >+ "Syntax error on token \"for\", final expected\n" + >+ "----------\n"; >+ > runComplianceParserTest( > testFiles, > expected13ProblemLog, > expected14ProblemLog, >- expected15ProblemLog >+ expected15ProblemLog, >+ expected16ProblemLog, >+ expected17ProblemLog > ); > } > public void test0042() { >@@ -2238,7 +2283,7 @@ > "2. ERROR in X.java (at line 6)\n" + > " public @MyAnn(\"\",\"\") class Test { \n" + > " ^\n" + >- "Syntax error on token \",\", < expected\n" + >+ "Syntax error on token \",\", > expected\n" + > "----------\n" + > "3. ERROR in X.java (at line 6)\n" + > " public @MyAnn(\"\",\"\") class Test { \n" + >Index: src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java,v >retrieving revision 1.63 >diff -u -r1.63 DietRecoveryTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 22 Apr 2010 04:39:01 -0000 1.63 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 20 Jan 2011 21:55:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -2527,20 +2527,17 @@ > "}\n"; > > String expectedDietPlusBodyPlusStatementsRecoveryUnitToString; >- if (this.complianceLevel <= ClassFileConstants.JDK1_4) { >- expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >+ >+ expectedDietPlusBodyPlusStatementsRecoveryUnitToString = > "public class WB2 {\n" + > " public WB2() {\n" + > " super();\n" + > " }\n" + > " public void foo() {\n" + >- " java.util.Locale.java.util.Vector $missing$;\n" + >+ " java.util.Locale $missing$;\n" + >+ " java.util.Locale java;\n" + > " }\n" + > "}\n"; >- } else { >- expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >- expectedDietPlusBodyUnitToString; >- } > > String expectedFullUnitToString = expectedDietUnitToString; > >@@ -4642,14 +4639,14 @@ > " super();\n" + > " }\n" + > " int hello() {\n" + >- " fo = $missing$;\n" + >+ " fo $missing$;\n" + > " }\n" + > " int world() {\n" + > " }\n" + > " void foo() {\n" + > " }\n" + > " }\n" + >- " ba = $missing$;\n" + >+ " ba $missing$;\n" + > " }\n" + > "}\n"; > >@@ -4831,15 +4828,15 @@ > " public Hanoi(int numberOfDisks) {\n" + > " }\n" + > " private void solve(int depth, Post start, Post free, Post end) {\n" + >- " if ((depth == 1))\n" + >- " moveDisk(start, end);\n" + >- " else\n" + >- " if ((depth > 1))\n" + >- " {\n" + >- " sol = $missing$;\n" + >- " }\n" + >- " else\n" + >- " ;\n" + >+ " if ((depth == 1))\n" + >+ " moveDisk(start, end);\n" + >+ " else\n" + >+ " if ((depth > 1))\n" + >+ " {\n" + >+ " sol $missing$;\n" + >+ " }\n" + >+ " else\n" + >+ " ;\n" + > " }\n" + > "}\n"; > >@@ -5991,7 +5988,7 @@ > " restricts breakpoint;\n" + > " given thread;\n" + > " any other;\n" + >- " specified = $missing$;\n" + >+ " specified $missing$;\n" + > " }\n" + > " public void removeThreadFilter(IJavaThread thread) {\n" + > " removes the;\n" + >@@ -6000,7 +5997,7 @@ > " request as;\n" + > " does not;\n" + > " the removal;\n" + >- " thread = $missing$;\n" + >+ " thread $missing$;\n" + > " }\n" + > " public IJavaThread[] getThreadFilters() {\n" + > " return the;\n" + >@@ -7598,18 +7595,20 @@ > "}\n"; > > String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null; >- if(this.complianceLevel <= ClassFileConstants.JDK1_4) { >+ if(this.complianceLevel <= ClassFileConstants.JDK1_6) { > expectedDietPlusBodyPlusStatementsRecoveryUnitToString = > "public class Test {\n" + > " public Test() {\n" + > " super();\n" + > " }\n" + > " void aMethod() {\n" + >+ " public static void $missing$;\n" + > " m1();\n" + > " {\n" + > " int a;\n" + > " int b;\n" + > " }\n" + >+ " public static void $missing$;\n" + > " m2();\n" + > " {\n" + > " int c;\n" + >@@ -7619,22 +7618,25 @@ > "}\n"; > } else { > expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >- "public class Test {\n" + >- " public Test() {\n" + >- " super();\n" + >- " }\n" + >- " void aMethod() {\n" + >- " public static @m1() enum $missing$ {\n" + >- " public $missing$() {\n" + >- " super();\n" + >- " }\n" + >- " <clinit>() {\n" + >- " }\n" + >- " }\n" + >- " }\n" + >+ "public class Test {\n" + >+ " public Test() {\n" + >+ " super();\n" + >+ " }\n" + >+ " void aMethod() {\n" + >+ " public static void @$missing$() [] m1;\n" + >+ " {\n" + >+ " int a;\n" + >+ " int b;\n" + >+ " }\n" + >+ " public static void @$missing$() [] m2;\n" + >+ " {\n" + >+ " int c;\n" + >+ " int d;\n" + >+ " }\n" + >+ " }\n" + > "}\n"; > } >- >+ > String expectedFullUnitToString = > "public class Test {\n" + > " public Test() {\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java,v >retrieving revision 1.27 >diff -u -r1.27 ParserTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java 14 Jan 2011 17:02:23 -0000 1.27 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java 20 Jan 2011 21:55:47 -0000 >@@ -71,16 +71,21 @@ > " }\n" + > "}\n" > }, >- "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " throws new X\n" + >- " ^^^^^^\n" + >- "Syntax error on token \"throws\", throw expected\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >- " throws new X\n" + >- " ^\n" + >- "Syntax error, unexpected end of method\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " throws new X\n" + >+ " ^^^^^^\n" + >+ "Syntax error on token \"throws\", throw expected\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 3)\n" + >+ " throws new X\n" + >+ " ^\n" + >+ "Syntax error, insert \"Dimensions\" to complete Expression\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 3)\n" + >+ " throws new X\n" + >+ " ^\n" + >+ "Syntax error, insert \";\" to complete BlockStatements\n" + > "----------\n" > ); > } >@@ -130,16 +135,21 @@ > " }\n" + > "}\n" > }, >- "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " throws new X\n" + >- " ^^^^^^\n" + >- "Syntax error on token \"throws\", throw expected\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >- " throws new X\n" + >- " ^\n" + >- "Syntax error, unexpected end of initializer\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " throws new X\n" + >+ " ^^^^^^\n" + >+ "Syntax error on token \"throws\", throw expected\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 3)\n" + >+ " throws new X\n" + >+ " ^\n" + >+ "Syntax error, insert \"Dimensions\" to complete Expression\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 3)\n" + >+ " throws new X\n" + >+ " ^\n" + >+ "Syntax error, insert \";\" to complete BlockStatements\n" + > "----------\n" > ); > } >@@ -238,11 +248,11 @@ > " public void bar(){}\n" + > "}\n" > }, >- "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " public void foo(X, Object o, String s) {\n" + >- " ^\n" + >- "Syntax error on token \",\", . expected\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " public void foo(X, Object o, String s) {\n" + >+ " ^\n" + >+ "Syntax error, insert \"VariableDeclaratorId\" to complete FormalParameterList\n" + > "----------\n" > ); > } >Index: src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java,v >retrieving revision 1.30 >diff -u -r1.30 SyntaxErrorTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java 14 Jan 2011 17:02:23 -0000 1.30 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java 20 Jan 2011 21:55:47 -0000 >@@ -166,17 +166,17 @@ > "1. ERROR in <parenthesis mismatch> (at line 3)\n" + > " [ arg1, \n" + > " ^\n" + >- "Syntax error on token \"[\", invalid Type\n" + >+ "Syntax error on token \"[\", float expected\n" + > "----------\n" + > "2. ERROR in <parenthesis mismatch> (at line 4)\n" + > " { arg2, ] \n" + > " ^\n" + >- "Syntax error on token \"{\", invalid Type\n" + >+ "Syntax error on token \"{\", float expected\n" + > "----------\n" + > "3. ERROR in <parenthesis mismatch> (at line 4)\n" + > " { arg2, ] \n" + > " ^\n" + >- "Syntax error on token \"]\", invalid Type\n" + >+ "Syntax error on token \"]\", float expected\n" + > "----------\n" + > "4. ERROR in <parenthesis mismatch> (at line 5)\n" + > " arg3, \n" + >@@ -273,7 +273,7 @@ > "1. ERROR in <test> (at line 3)\n"+ > " i; \n"+ > " ^\n"+ >- "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression\n"+ >+ "Syntax error, insert \"VariableDeclarators\" to complete LocalVariableDeclaration\n" + > "----------\n"; > > String testName = "<test>"; >@@ -399,7 +399,6 @@ > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339 > public void test12() { >- > String s = > "package a; \n"+ > "public interface Test { \n"+ >@@ -407,18 +406,24 @@ > " System.out.println(); \n"+ > "} \n"; > >- String expectedSyntaxErrorDiagnosis = >- "----------\n"+ >- "1. ERROR in <test> (at line 3)\n"+ >- " public void myMethod() \n"+ >- " ^\n"+ >- "Syntax error on token \")\", { expected after this token\n"+ >- "----------\n"+ >- "2. ERROR in <test> (at line 5)\n"+ >- " } \n"+ >- " ^\n"+ >- "Syntax error, insert \"}\" to complete InterfaceBody\n"+ >- "----------\n"; >+ String expectedSyntaxErrorDiagnosis = this.complianceLevel < ClassFileConstants.JDK1_7 >+ ? "----------\n"+ >+ "1. ERROR in <test> (at line 3)\n"+ >+ " public void myMethod() \n"+ >+ " ^\n"+ >+ "Syntax error on token \")\", { expected after this token\n"+ >+ "----------\n"+ >+ "2. ERROR in <test> (at line 5)\n"+ >+ " } \n"+ >+ " ^\n"+ >+ "Syntax error, insert \"}\" to complete InterfaceBody\n"+ >+ "----------\n" >+ : "----------\n" + >+ "1. ERROR in <test> (at line 3)\n"+ >+ " public void myMethod() \n"+ >+ " ^\n"+ >+ "Syntax error on token \")\", @ expected after this token\n"+ >+ "----------\n"; > > String testName = "<test>"; > checkParse( >Index: src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java >diff -N src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3629 @@ >+/******************************************************************************* >+ * Copyright (c) 2009, 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.parser; >+ >+import java.io.IOException; >+import java.util.Map; >+import junit.framework.Test; >+import org.eclipse.jdt.core.tests.util.CompilerTestSetup; >+ >+public class TypeAnnotationSyntaxTest extends AbstractTypeAnnotationSyntaxTest { >+ >+ public static Class testClass() { >+ return TypeAnnotationSyntaxTest.class; >+ } >+ public void initialize(CompilerTestSetup setUp) { >+ super.initialize(setUp); >+ } >+ public static Test suite() { >+ return buildMinimalComplianceTestSuite(testClass(), F_1_7); >+ } >+public TypeAnnotationSyntaxTest(String testName){ >+ super(testName); >+} >+ >+static { >+// TESTS_NAMES = new String[] { "test0038", "test0039", "test0040a" }; >+// TESTS_NUMBERS = new int[] { 133, 134, 135 }; >+} >+ >+public void test0001() throws IOException { >+ String source = "@Marker class A extends String {}\n;" + >+ "@Marker class B extends @Marker String {}\n" + >+ "@Marker class C extends @Marker @SingleMember(0) String {}\n" + >+ "@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" + >+ "@Marker class E extends String {}\n;"; >+ >+ String expectedUnitToString = >+ "@Marker class A extends String {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class B extends @Marker String {\n" + >+ " B() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class C extends @Marker @SingleMember(0) String {\n" + >+ " C() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + >+ " D() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class E extends String {\n" + >+ " E() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0001", expectedUnitToString); >+} >+public void test0002() throws IOException { >+ String source = "class A extends String {}\n;" + >+ "class B extends @Marker String {}\n" + >+ "class C extends @Marker @SingleMember(0) String {}\n" + >+ "class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" + >+ "class E extends String {}\n;"; >+ >+ String expectedUnitToString = >+ "class A extends String {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "class B extends @Marker String {\n" + >+ " B() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "class C extends @Marker @SingleMember(0) String {\n" + >+ " C() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + >+ " D() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "class E extends String {\n" + >+ " E() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0002", expectedUnitToString); >+} >+public void test0003() throws IOException { >+ String source = "@Marker class A implements Comparable, " + >+ " @Marker Serializable," + >+ " Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A implements Comparable, @Marker Serializable, Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0003", expectedUnitToString); >+} >+public void test0004() throws IOException { >+ String source = "@Marker class A implements Comparable, " + >+ " @Marker @SingleMember(0) Serializable," + >+ " Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A implements Comparable, @Marker @SingleMember(0) Serializable, Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0004", expectedUnitToString); >+} >+public void test0005() throws IOException { >+ String source = "@Marker class A implements Comparable, " + >+ " @Marker @SingleMember(0) @Normal(Value=0) Serializable," + >+ " Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0005", expectedUnitToString); >+} >+public void test0006() throws IOException { >+ String source = "@Marker class A implements @Marker Comparable, " + >+ " @Marker @SingleMember(0) @Normal(Value=0) Serializable," + >+ " @Marker Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A implements @Marker Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, @Marker Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0006", expectedUnitToString); >+} >+public void test007() throws IOException { >+ String source = "@Marker class A extends Object implements Comparable, " + >+ " @Marker @SingleMember(10) @Normal(Value=0) Serializable," + >+ " Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A extends Object implements Comparable, @Marker @SingleMember(10) @Normal(Value = 0) Serializable, Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0007", expectedUnitToString); >+} >+public void test0008() throws IOException { >+ String source = "@Marker class A extends @Marker Object implements Comparable, " + >+ " @Marker @SingleMember(0) @Normal(Value=0) Serializable," + >+ " Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A extends @Marker Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0008", expectedUnitToString); >+} >+public void test0009() throws IOException { >+ String source = "@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, " + >+ " @Marker @SingleMember(0) @Normal(Value=0) Serializable," + >+ " Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0009", expectedUnitToString); >+} >+public void test0010() throws IOException { >+ String source = "@Marker class A extends @Marker @SingleMember(0) @Normal(Value=0) Object implements Comparable, " + >+ " @Marker @SingleMember(0) @Normal(Value=0) Serializable," + >+ " Cloneable {\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class A extends @Marker @SingleMember(0) @Normal(Value = 0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0010", expectedUnitToString); >+} >+public void test0011() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker String[] @Marker[][] s[] @SingleMember(0)[][] @Normal(Value = 0)[][];\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker String[] @Marker [][][] @SingleMember(0) [][] @Normal(Value = 0) [][] s;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0011", expectedUnitToString); >+} >+public void test0012() throws IOException { >+ String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[] f[];\n" + >+ " @English String[] @NonNull[] s[] @Nullable[][];\n" + >+ " float[] p[];\n" + >+ "public static void main(String args[]) {\n" + >+ " @Readonly String @Nullable[] @NonNull[] s;\n" + >+ " s = new @Readonly String @NonNull[5] @Nullable[];\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[][] f;\n" + >+ " @English String[] @NonNull [][] @Nullable [][] s;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " @Readonly String @Nullable [] @NonNull [] s;\n" + >+ " s = new @Readonly String @NonNull [5] @Nullable [];\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0012", expectedUnitToString); >+} >+public void test0013() throws IOException { >+ String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[] f[];\n" + >+ " @English String[] @NonNull[] s[] @Nullable[][];\n" + >+ " float[] p[];\n" + >+ "public static void main(String args[]) {\n" + >+ " @Readonly String s;\n" + >+ " s = new @Readonly String @NonNull[] @Nullable[] { {\"Hello\"}, {\"World\"}} [0][0];\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[][] f;\n" + >+ " @English String[] @NonNull [][] @Nullable [][] s;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " @Readonly String s;\n" + >+ " s = new @Readonly String @NonNull [] @Nullable []{{\"Hello\"}, {\"World\"}}[0][0];\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0013", expectedUnitToString); >+} >+public void test0014() throws IOException { >+ String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[] f[];\n" + >+ " @English String[] @NonNull[] s[] @Nullable[][];\n" + >+ " float[] p[];\n" + >+ "public static int main(String args[])[] @Marker[][] @Marker @SingleMember(0) @Normal(Value=0)[][] @Marker {\n" + >+ " @Readonly String @Nullable[] @NonNull[] s;\n" + >+ " s = new @Readonly String @NonNull[5] @Nullable[];\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[][] f;\n" + >+ " @English String[] @NonNull [][] @Nullable [][] s;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker {\n" + >+ " @Readonly String @Nullable [] @NonNull [] s;\n" + >+ " s = new @Readonly String @NonNull [5] @Nullable [];\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0014", expectedUnitToString); >+ >+} >+public void test0015() throws IOException { >+ String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[] f[];\n" + >+ " @English String[] @NonNull[] s[] @Nullable[][];\n" + >+ " float[] p[];\n" + >+ "public static int main(String args[])[] @Marker[][] @Marker @SingleMember(0) @Normal(Value=0)[][] @Marker {\n" + >+ " @Readonly String @Nullable[] @NonNull[] s;\n" + >+ " s = new @Readonly String @NonNull[5] @Nullable[];\n" + >+ "}\n" + >+ "@Marker public A () @Marker @SingleMember(0) @Normal(Value=10) {}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " int[][] f;\n" + >+ " @English String[] @NonNull [][] @Nullable [][] s;\n" + >+ " float[][] p;\n" + >+ " public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker {\n" + >+ " @Readonly String @Nullable [] @NonNull [] s;\n" + >+ " s = new @Readonly String @NonNull [5] @Nullable [];\n" + >+ " }\n" + >+ " public @Marker A() @Marker @SingleMember(0) @Normal(Value = 10) {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0015", expectedUnitToString); >+} >+// parameters >+public void test0016() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0016", expectedUnitToString); >+} >+public void test0017() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0017", expectedUnitToString); >+} >+public void test0018() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker[][] main(HashMap<String, Object>[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0018", expectedUnitToString); >+} >+public void test0019() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][] args[] @Normal(Value = 10) [][])[] @Marker [][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0019", expectedUnitToString); >+} >+// varargs annotation >+public void test0020() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0020", expectedUnitToString); >+} >+public void test0021() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0021", expectedUnitToString); >+} >+public void test0022() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker[][] main(HashMap<Integer,String>[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0022", expectedUnitToString); >+} >+public void test0023() throws IOException { >+ String source = "public class A {\n" + >+ "@Marker public int[] @Marker[][] main(HashMap<Integer,String>.Iterator[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>.Iterator[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0023", expectedUnitToString); >+} >+// local variables >+public void test0024() throws IOException { >+ String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ "public static void main(String args[]) {\n" + >+ " int[] f[];\n" + >+ " @English String[] @NonNull[] s[] @Nullable[][];\n" + >+ " float[] p[];\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " int[][] f;\n" + >+ " @English String[] @NonNull [][] @Nullable [][] s;\n" + >+ " float[][] p;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0024", expectedUnitToString); >+} >+// type parameter >+public void test0025() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> void foo() {\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>void foo() {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0025", expectedUnitToString); >+} >+// Type >+public void test0026() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int foo() @Marker {\n" + >+ " return 0;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> int bar() @Marker{\n" + >+ " return 0;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker int foo() @Marker {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>int bar() @Marker {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0026", expectedUnitToString); >+} >+// Type >+public void test0027() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String foo() @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> String bar () @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String foo() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>String bar() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0027", expectedUnitToString); >+} >+//Type >+public void test0028() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object> foo() @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object> bar () @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object> foo() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object> bar() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0028", expectedUnitToString); >+} >+// Type >+public void test0029() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator bar () @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator bar() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0029", expectedUnitToString); >+} >+//Type >+public void test0030() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator[] @NonEmpty[][] foo() @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator[] @NonEmpty[][] bar () @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator[] @NonEmpty [][] foo() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator[] @NonEmpty [][] bar() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0030", expectedUnitToString); >+} >+//Type >+public void test0031() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int[] @NonEmpty[][] foo() @Marker {\n" + >+ " return 0;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> int[] @NonEmpty[][] bar() @Marker{\n" + >+ " return 0;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker int[] @NonEmpty [][] foo() @Marker {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>int[] @NonEmpty [][] bar() @Marker {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0031", expectedUnitToString); >+} >+// Type >+public void test0032() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String[]@NonEmpty[][] foo() @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> String[]@NonEmpty[][] bar () @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String[] @NonEmpty [][] foo() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>String[] @NonEmpty [][] bar() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0032", expectedUnitToString); >+} >+//Type >+public void test0033() throws IOException { >+ String source = "class A {\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>[] @NonEmpty[][] foo() @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>[]@NonEmpty[][] bar () @Marker {\n" + >+ " return null;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object>[] @NonEmpty [][] foo() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>[] @NonEmpty [][] bar() @Marker {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0033", expectedUnitToString); >+} >+// Type0 field declaration. >+public void test0034() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker int k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker int k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0034", expectedUnitToString); >+} >+//Type0 field declaration. >+public void test0035() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker String k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker String k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0035", expectedUnitToString); >+} >+//Type0 field declaration. >+public void test0036() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0036", expectedUnitToString); >+} >+//Type0 field declaration. >+public void test0037() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0037", expectedUnitToString); >+} >+//Type0 field declaration. >+public void test0038() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker int[] @NonEmpty[][] k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker int[] @NonEmpty [][] k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0038", expectedUnitToString); >+} >+//Type0 field declaration. >+public void test0039() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker String[] @NonEmpty[][]k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker String[] @NonEmpty [][] k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0039", expectedUnitToString); >+} >+//Type0 field declaration. >+public void test0040() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty[][] k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0040", expectedUnitToString); >+} >+//Type0 field declaration. >+public void test0041() throws IOException { >+ String source = "public class A {\n" + >+ " int[] f[];\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] k;\n" + >+ " float[] p[];\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " int[][] f;\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] k;\n" + >+ " float[][] p;\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0041", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0042() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker int foo() { return 0; }\n" + >+ " public int bar() { return 0; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int foo() {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " public int bar() {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0042", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0043() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker String foo() { return null; }\n" + >+ " public String bar() { return null; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker String foo() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public String bar() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0043", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0044() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer> foo() { return null; }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer> bar() { return null; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer> foo() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer> bar() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0044", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0045() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() { return null; }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() { return null; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0045", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0046() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker int[] foo() @NonEmpty[][] { return 0; }\n" + >+ " public int[] @NonEmpty[][] bar() { return 0; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker int[] @NonEmpty [][] foo() {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " public int[] @NonEmpty [][] bar() {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0046", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0047() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker String[] foo() @NonEmpty[][] { return null; }\n" + >+ " public String[] @NonEmpty[][] bar() { return null; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker String[] @NonEmpty [][] foo() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public String[] @NonEmpty [][] bar() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0047", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0048() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer>[] foo() @NonEmpty[][] { return null; }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer> [] @NonEmpty[][] bar() { return null; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] foo() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] bar() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0048", expectedUnitToString); >+} >+//Type0 MethodHeaderName. >+public void test0049() throws IOException { >+ String source = "public class A {\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] foo() @NonEmpty[][] { return null; }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] bar() { return null; }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] foo() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] bar() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0049", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0050() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker int p;\n" + >+ " int q;\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker int p;\n" + >+ " int q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0050", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0051() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker String p;\n" + >+ " String q;\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker String p;\n" + >+ " String q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0051", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0052() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" + >+ " HashMap<@Positive Integer, @Negative Integer> q;\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" + >+ " HashMap<@Positive Integer, @Negative Integer> q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0052", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0053() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" + >+ " HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" + >+ " HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0053", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0054() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker int[] @NonNull[] p @NonEmpty[][];\n" + >+ " int[] @NonNull[] q @NonEmpty[][];\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker int[] @NonNull [] @NonEmpty [][] p;\n" + >+ " int[] @NonNull [] @NonEmpty [][] q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0054", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0055() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker String[] @NonNull[] p @NonEmpty[][];\n" + >+ " String[] @NonNull[] q @NonEmpty[][];\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker String[] @NonNull [] @NonEmpty [][] p;\n" + >+ " String[] @NonNull [] @NonEmpty [][] q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0055", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0056() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] p @NonEmpty[][];\n" + >+ " HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] q @NonEmpty[][];\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] p;\n" + >+ " HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0056", expectedUnitToString); >+} >+//Type0 local variable declaration >+public void test0057() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] p @NonEmpty[][];\n" + >+ " HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] @NonEmpty[][] q;\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] p;\n" + >+ " HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] q;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0057", expectedUnitToString); >+} >+//Type0 foreach >+public void test0058() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " String @NonNull[] @Marker[] s @Readonly[];\n" + >+ " for (@Readonly String @NonNull[] si @Marker[] : s) {}\n" + >+ " for (String @NonNull[] sii @Marker[] : s) {}\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " String @NonNull [] @Marker [] @Readonly [] s;\n" + >+ " for (@Readonly String @NonNull [] @Marker [] si : s) \n" + >+ " {\n" + >+ " }\n" + >+ " for (String @NonNull [] @Marker [] sii : s) \n" + >+ " {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0058", expectedUnitToString); >+} >+//Type0 foreach >+public void test0059() throws IOException { >+ String source = "public class A {\n" + >+ " public void foo() {\n" + >+ " int @NonNull[] @Marker[] s @Readonly[];\n" + >+ " for (@Readonly int @NonNull[] si @Marker[] : s) {}\n" + >+ " for (int @NonNull[] sii @Marker[] : s) {}\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class A {\n" + >+ " public A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " int @NonNull [] @Marker [] @Readonly [] s;\n" + >+ " for (@Readonly int @NonNull [] @Marker [] si : s) \n" + >+ " {\n" + >+ " }\n" + >+ " for (int @NonNull [] @Marker [] sii : s) \n" + >+ " {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0059", expectedUnitToString); >+} >+// cast expression >+public void test0060() throws IOException { >+ String source = "public class Clazz {\n" + >+ "public static void main(String[] args) {\n" + >+ "int x;\n" + >+ "x = (Integer)\n" + >+ "(@Readonly Object)\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Normal(Value=0)[][] )\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @SingleMember(0)[][] )\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Marker[][] )\n" + >+ "(@Readonly Object)\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Normal(Value=0)[][] )\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @SingleMember(0)[][] )\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Marker[][] )\n" + >+ "(@Readonly Object)\n" + >+ "(@Readonly String[] @Normal(Value=0)[][] )\n" + >+ "(@Readonly String[] @SingleMember(0)[][] )\n" + >+ "(@Readonly String[] @Marker[][] )\n" + >+ "(@Readonly Object)\n" + >+ "(@Readonly int[] @Normal(Value=0)[][] )\n" + >+ "(@Readonly int[] @SingleMember(0)[][] )\n" + >+ "(@Readonly int[] @Marker[][] )\n" + >+ "(@Readonly Object)\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator)\n" + >+ "(@Readonly Object)\n" + >+ "(@Readonly HashMap<@Positive Integer, @Negative Integer>)\n" + >+ "(@Readonly Object)\n" + >+ "(@ReadOnly String)\n" + >+ "(@Readonly Object)\n" + >+ "(@Readonly int) 10;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class Clazz {\n" + >+ " public Clazz() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " int x;\n" + >+ " x = (Integer) (@Readonly Object) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @SingleMember(0) [][]) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Marker [][]) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Normal(Value = 0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Marker [][]) (@Readonly Object) (@Readonly String[] @Normal(Value = 0) [][]) (@Readonly String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (@Readonly Object) (@Readonly int[] @Normal(Value = 0) [][]) (@Readonly int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (@Readonly Object) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>) (@Readonly Object) (@ReadOnly String) (@Readonly Object) (@Readonly int) 10;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0060", expectedUnitToString); >+} >+//cast expression >+public void test0061() throws IOException { >+ String source = "public class Clazz {\n" + >+ "public static void main(String[] args) {\n" + >+ "int x;\n" + >+ "x = (Integer)\n" + >+ "(Object)\n" + >+ "(@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Normal(Value=0)[][] )\n" + >+ "(HashMap<@Positive Integer, Integer>.Iterator[] @SingleMember(0)[][] )\n" + >+ "(@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Marker[][] )\n" + >+ "(Object)\n" + >+ "(@Readonly HashMap<@Positive Integer, Integer>[] @Normal(Value=0)[][] )\n" + >+ "(HashMap<Integer, @Negative Integer>[] @SingleMember(0)[][] )\n" + >+ "(@Readonly HashMap<@Positive Integer, Integer>[] @Marker[][] )\n" + >+ "(Object)\n" + >+ "(@Readonly String[] @Normal(Value=0)[][] )\n" + >+ "(String[] @SingleMember(0)[][] )\n" + >+ "(@Readonly String[] @Marker[][] )\n" + >+ "(Object)\n" + >+ "(@Readonly int[] @Normal(Value=0)[][] )\n" + >+ "(int[] @SingleMember(0)[][] )\n" + >+ "(@Readonly int[] @Marker[][] )\n" + >+ "(Object)\n" + >+ "(@Readonly HashMap<Integer, @Negative Integer>.Iterator)\n" + >+ "(Object)\n" + >+ "(@Readonly HashMap<@Positive Integer, Integer>)\n" + >+ "(Object)\n" + >+ "(@ReadOnly String)\n" + >+ "(Object)\n" + >+ "(@Readonly int) 10;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class Clazz {\n" + >+ " public Clazz() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " int x;\n" + >+ " x = (Integer) (Object) ( @Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) (HashMap<@Positive Integer, Integer>.Iterator[] @SingleMember(0) [][]) ( @Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Marker [][]) (Object) (@Readonly HashMap<@Positive Integer, Integer>[] @Normal(Value = 0) [][]) (HashMap<Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, Integer>[] @Marker [][]) (Object) (@Readonly String[] @Normal(Value = 0) [][]) (String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (Object) (@Readonly int[] @Normal(Value = 0) [][]) (int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (Object) ( @Readonly HashMap<Integer, @Negative Integer>.Iterator) (Object) (@Readonly HashMap<@Positive Integer, Integer>) (Object) (@ReadOnly String) (Object) (@Readonly int) 10;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0061", expectedUnitToString); >+} >+// instanceof checks >+public void test0062() throws IOException { >+ String source = "public class Clazz {\n" + >+ "public static void main(Object o) {\n" + >+ "if (o instanceof @Readonly String) {\n" + >+ "} else if (o instanceof @Readonly int[] @NonEmpty[][] ) {\n" + >+ "} else if (o instanceof @Readonly String[] @NonEmpty[][] ) {\n" + >+ "} else if (o instanceof @Readonly HashMap<?,?>[] @NonEmpty[][] ) {\n" + >+ "} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] ) {\n" + >+ "} else if (o instanceof @Readonly HashMap<?,?>) {\n" + >+ "} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) {\n" + >+ "}\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class Clazz {\n" + >+ " public Clazz() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(Object o) {\n" + >+ " if ((o instanceof @Readonly String))\n" + >+ " {\n" + >+ " }\n" + >+ " else\n" + >+ " if ((o instanceof @Readonly int[] @NonEmpty [][]))\n" + >+ " {\n" + >+ " }\n" + >+ " else\n" + >+ " if ((o instanceof @Readonly String[] @NonEmpty [][]))\n" + >+ " {\n" + >+ " }\n" + >+ " else\n" + >+ " if ((o instanceof @Readonly HashMap<?, ?>[] @NonEmpty [][]))\n" + >+ " {\n" + >+ " }\n" + >+ " else\n" + >+ " if ((o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][]))\n" + >+ " {\n" + >+ " }\n" + >+ " else\n" + >+ " if ((o instanceof @Readonly HashMap<?, ?>))\n" + >+ " {\n" + >+ " }\n" + >+ " else\n" + >+ " if ((o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator))\n" + >+ " {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0062", expectedUnitToString); >+} >+// assorted unclassified >+public void test0063() throws IOException { >+ String source = "import java.util.HashMap;\n" + >+ "import java.util.Map; \n" + >+ "\n" + >+ "public class Clazz <@A M extends @B String, @C N extends @D Comparable> extends\n" + >+ " @E Object implements @F Comparable <@G Object> {\n" + >+ " \n" + >+ " Clazz(char[] ...args) @H { \n" + >+ " }\n" + >+ " \n" + >+ " int @I[] f @J[], g, h[], i@K[];\n" + >+ " int @L[][]@M[] f2; \n" + >+ " \n" + >+ " Clazz (int @N[] @O... a) @Q {}\n" + >+ " int @R[]@S[] aa() {}\n" + >+ " \n" + >+ " int @T[]@U[]@V[] a () @W[]@X[]@Y[] @Z { return null; }\n" + >+ " \n" + >+ " public void main(String @A[] @B ... args) @C throws @D Exception {\n" + >+ " \n" + >+ " HashMap<@E String, @F String> b1;\n" + >+ " \n" + >+ " int b; b = (@G int) 10;\n" + >+ " \n" + >+ " char @H[]@I[] ch; ch = (@K char @L[]@M[])(@N char @O[]@P[]) null;\n" + >+ " \n" + >+ " int[] i; i = new @Q int @R[10];\n" + >+ " \n" + >+ " \n" + >+ " Integer w; w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" + >+ " throw new @V Exception(\"test\");\n" + >+ " boolean c; c = null instanceof @W String;\n" + >+ " } \n" + >+ " public <@X X, @Y Y> void foo(X x, Y @Z... y) { \n" + >+ " \n" + >+ "}\n" + >+ " \n" + >+ " void foo(Map<? super @A Object, ? extends @B String> m){}\n" + >+ " public int compareTo(Object arg0) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "\n" + >+ "}\n" + >+ "class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" + >+ " \n" + >+ " public Integer get(Integer integer) {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ >+ >+ String expectedUnitToString = "import java.util.HashMap;\n" + >+ "import java.util.Map;\n" + >+ "public class Clazz<@A M extends @B String, @C N extends @D Comparable> extends @E Object implements @F Comparable<@G Object> {\n" + >+ " int @I [] @J [] f;\n" + >+ " int @I [] g;\n" + >+ " int @I [][] h;\n" + >+ " int @I [] @K [] i;\n" + >+ " int @L [][] @M [] f2;\n" + >+ " Clazz(char[]... args) @H {\n" + >+ " super();\n" + >+ " }\n" + >+ " Clazz(int @N [] @O ... a) @Q {\n" + >+ " super();\n" + >+ " }\n" + >+ " int @R [] @S [] aa() {\n" + >+ " }\n" + >+ " int @T [] @U [] @V [] @W [] @X [] @Y [] a() @Z {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public void main(String @A [] @B ... args) @C throws @D Exception {\n" + >+ " HashMap<@E String, @F String> b1;\n" + >+ " int b;\n" + >+ " b = (@G int) 10;\n" + >+ " char @H [] @I [] ch;\n" + >+ " ch = (@K char @L [] @M []) (@N char @O [] @P []) null;\n" + >+ " int[] i;\n" + >+ " i = new @Q int @R [10];\n" + >+ " Integer w;\n" + >+ " w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" + >+ " throw new @V Exception(\"test\");\n" + >+ " boolean c;\n" + >+ " c = (null instanceof @W String);\n" + >+ " }\n" + >+ " public <@X X, @Y Y>void foo(X x, Y @Z ... y) {\n" + >+ " }\n" + >+ " void foo(Map<? super @A Object, ? extends @B String> m) {\n" + >+ " }\n" + >+ " public int compareTo(Object arg0) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n" + >+ "class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public Integer get(Integer integer) {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n"; >+ // indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly. >+ // this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long) >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0063", expectedUnitToString); >+} >+//assorted unclassified >+public void test0064() throws IOException { >+ String source = "class X<T extends @E Object & @F Comparable<? super T>> {}\n"; >+ String expectedUnitToString = "class X<T extends @E Object & @F Comparable<? super T>> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ // indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly. >+ // this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long) >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test064", expectedUnitToString); >+} >+//type class literal expression >+public void test0065() throws IOException { >+ String source = "public class Clazz {\n" + >+ "public static void main(String[] args) {\n" + >+ "Class x;\n" + >+ "x = Integer.class;\n" + >+ "x = @Readonly Object.class;\n" + >+ "x = HashMap.Iterator[] @Normal(Value=0)[][].class;\n" + >+ "x = @Readonly HashMap.Iterator[] @SingleMember(0)[][].class;\n" + >+ "x = @Readonly HashMap.Iterator @Normal(Value=1)[] @Marker[] @Normal(Value=2)[].class;\n" + >+ "x = @Readonly Object.class;\n" + >+ "x = @Readonly String[] @Normal(Value=0)[][].class;\n" + >+ "x = @Readonly String[] @SingleMember(0)[][].class;\n" + >+ "x = @Readonly String[] @Marker[][].class;\n" + >+ "x = @Readonly Object.class;\n" + >+ "x = @Readonly int[][] @Normal(Value=0)[].class;\n" + >+ "x = @Readonly int @SingleMember(0)[][][].class;\n" + >+ "x = @Readonly int[] @Marker[][].class;\n" + >+ "x = @Readonly int.class;\n" + >+ "}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class Clazz {\n" + >+ " public Clazz() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " Class x;\n" + >+ " x = Integer.class;\n" + >+ " x = @Readonly Object.class;\n" + >+ " x = HashMap.Iterator[] @Normal(Value = 0) [][].class;\n" + >+ " x = @Readonly HashMap.Iterator[] @SingleMember(0) [][].class;\n" + >+ " x = @Readonly HashMap.Iterator @Normal(Value = 1) [] @Marker [] @Normal(Value = 2) [].class;\n" + >+ " x = @Readonly Object.class;\n" + >+ " x = @Readonly String[] @Normal(Value = 0) [][].class;\n" + >+ " x = @Readonly String[] @SingleMember(0) [][].class;\n" + >+ " x = @Readonly String[] @Marker [][].class;\n" + >+ " x = @Readonly Object.class;\n" + >+ " x = @Readonly int[][] @Normal(Value = 0) [].class;\n" + >+ " x = @Readonly int @SingleMember(0) [][][].class;\n" + >+ " x = @Readonly int[] @Marker [][].class;\n" + >+ " x = @Readonly int.class;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0065", expectedUnitToString); >+} >+//type class literal expression >+public void test0066() throws IOException { >+ String source = "public class X {\n" + >+ " <T extends Y<@A String @C[][]@B[]> & Cloneable> void foo(T t) {}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " <T extends Y<@A String @C [][] @B []> & Cloneable>void foo(T t) {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0066", expectedUnitToString); >+} >+//check locations >+public void test0067() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @H String @E [] @F [] @G [] field;\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0067", expectedUnitToString); >+} >+//check locations >+public void test0068() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @H String @E [] @F [] @G [] field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0068", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 4, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@E")); >+ assertEquals("Wrong location", "{0}", locations.get("@F")); >+ assertEquals("Wrong location", "{1}", locations.get("@G")); >+ assertEquals("Wrong location", "{2}", locations.get("@H")); >+} >+//check locations >+public void test0069() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B String, @H String> field3;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B String, @H String> field3;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0069", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 3, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@A")); >+ assertEquals("Wrong location", "{0}", locations.get("@B")); >+ assertEquals("Wrong location", "{1}", locations.get("@H")); >+} >+//check locations >+public void test0070() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0070", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 6, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@A")); >+ assertEquals("Wrong location", "{0}", locations.get("@B")); >+ assertEquals("Wrong location", "{1}", locations.get("@E")); >+ assertEquals("Wrong location", "{1,0}", locations.get("@F")); >+ assertEquals("Wrong location", "{1,1}", locations.get("@G")); >+ assertEquals("Wrong location", "{1,2}", locations.get("@H")); >+} >+//check locations >+public void test0071() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@H String @E[][] @G[]>> field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@H String @E [][] @G []>> field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0071", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 6, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@A")); >+ assertEquals("Wrong location", "{0}", locations.get("@B")); >+ assertEquals("Wrong location", "{1}", locations.get("@C")); >+ assertEquals("Wrong location", "{1,0,2}", locations.get("@H")); >+ assertEquals("Wrong location", "{1,0}", locations.get("@E")); >+ assertEquals("Wrong location", "{1,0,1}", locations.get("@G")); >+} >+//check locations >+public void test0072() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@H String @E[][] @G[]>>[] @I[] @J[] field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@H String @E [][] @G []>>[] @I [] @J [] field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0072", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 8, locations.size()); >+ assertEquals("Wrong location", "{0}", locations.get("@I")); >+ assertEquals("Wrong location", "{1}", locations.get("@J")); >+ assertEquals("Wrong location", "{2}", locations.get("@A")); >+ assertEquals("Wrong location", "{2,0}", locations.get("@B")); >+ assertEquals("Wrong location", "{2,1}", locations.get("@C")); >+ assertEquals("Wrong location", "{2,1,0,2}", locations.get("@H")); >+ assertEquals("Wrong location", "{2,1,0}", locations.get("@E")); >+ assertEquals("Wrong location", "{2,1,0,1}", locations.get("@G")); >+} >+//check locations >+public void test0073() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@H String @E[][] @G[]>> @I[][] @J[] field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@H String @E [][] @G []>> @I [][] @J [] field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0073", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 8, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@I")); >+ assertEquals("Wrong location", "{1}", locations.get("@J")); >+ assertEquals("Wrong location", "{2}", locations.get("@A")); >+ assertEquals("Wrong location", "{2,0}", locations.get("@B")); >+ assertEquals("Wrong location", "{2,1}", locations.get("@C")); >+ assertEquals("Wrong location", "{2,1,0,2}", locations.get("@H")); >+ assertEquals("Wrong location", "{2,1,0}", locations.get("@E")); >+ assertEquals("Wrong location", "{2,1,0,1}", locations.get("@G")); >+} >+//check locations >+public void test0074() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@C List<@H String @E[][] @G[]>, String @B[] @D[]> @I[] @F[] @J[] field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@C List<@H String @E [][] @G []>, String @B [] @D []> @I [] @F [] @J [] field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0074", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 10, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@I")); >+ assertEquals("Wrong location", "{0}", locations.get("@F")); >+ assertEquals("Wrong location", "{1}", locations.get("@J")); >+ assertEquals("Wrong location", "{2}", locations.get("@A")); >+ assertEquals("Wrong location", "{2,0}", locations.get("@C")); >+ assertEquals("Wrong location", "{2,0,0}", locations.get("@E")); >+ assertEquals("Wrong location", "{2,0,0,1}", locations.get("@G")); >+ assertEquals("Wrong location", "{2,0,0,2}", locations.get("@H")); >+ assertEquals("Wrong location", "{2,1,0}", locations.get("@D")); >+ assertEquals("Wrong location", "{2,1}", locations.get("@B")); >+} >+//check locations >+public void test0075() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@C List<@H String @E[][] @G[]>, @B List<String [] @D[]>> [] @I[] @F[] @J[] field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@C List<@H String @E [][] @G []>, @B List<String[] @D []>>[] @I [] @F [] @J [] field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0075", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 10, locations.size()); >+ assertEquals("Wrong location", "{0}", locations.get("@I")); >+ assertEquals("Wrong location", "{1}", locations.get("@F")); >+ assertEquals("Wrong location", "{2}", locations.get("@J")); >+ assertEquals("Wrong location", "{3}", locations.get("@A")); >+ assertEquals("Wrong location", "{3,0}", locations.get("@C")); >+ assertEquals("Wrong location", "{3,0,0}", locations.get("@E")); >+ assertEquals("Wrong location", "{3,0,0,1}", locations.get("@G")); >+ assertEquals("Wrong location", "{3,0,0,2}", locations.get("@H")); >+ assertEquals("Wrong location", "{3,1}", locations.get("@B")); >+ assertEquals("Wrong location", "{3,1,0,0}", locations.get("@D")); >+} >+//check locations >+public void test0076() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@D Object>> field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B String, @C List<@D Object>> field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0076", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 4, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@A")); >+ assertEquals("Wrong location", "{0}", locations.get("@B")); >+ assertEquals("Wrong location", "{1}", locations.get("@C")); >+ assertEquals("Wrong location", "{1,0}", locations.get("@D")); >+} >+//check locations >+public void test0077() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @H String @E [] @F [] @G [] field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0077", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 4, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@E")); >+ assertEquals("Wrong location", "{0}", locations.get("@F")); >+ assertEquals("Wrong location", "{1}", locations.get("@G")); >+ assertEquals("Wrong location", "{2}", locations.get("@H")); >+} >+//check locations >+public void test0078() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0078", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 8, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@A")); >+ assertEquals("Wrong location", "{0}", locations.get("@B")); >+ assertEquals("Wrong location", "{0,0,2}", locations.get("@C")); >+ assertEquals("Wrong location", "{0,0}", locations.get("@D")); >+ assertEquals("Wrong location", "{0,0,0}", locations.get("@E")); >+ assertEquals("Wrong location", "{0,0,1}", locations.get("@F")); >+ assertEquals("Wrong location", "{1}", locations.get("@G")); >+ assertEquals("Wrong location", "{1,0}", locations.get("@H")); >+} >+//check locations >+public void test0079() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A java.util.Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A java.util.Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0079", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 8, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@A")); >+ assertEquals("Wrong location", "{0}", locations.get("@B")); >+ assertEquals("Wrong location", "{0,0,2}", locations.get("@C")); >+ assertEquals("Wrong location", "{0,0}", locations.get("@D")); >+ assertEquals("Wrong location", "{0,0,0}", locations.get("@E")); >+ assertEquals("Wrong location", "{0,0,1}", locations.get("@F")); >+ assertEquals("Wrong location", "{1}", locations.get("@G")); >+ assertEquals("Wrong location", "{1,0}", locations.get("@H")); >+} >+//check locations >+public void test0080() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @B Map<? extends Z, ? extends @A Z> field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @B Map<? extends Z, ? extends @A Z> field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0080", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 2, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@B")); >+ assertEquals("Wrong location", "{1}", locations.get("@A")); >+} >+//check locations >+public void test0081() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @H java.lang.String @E[] @F[] @G[] field;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @H java.lang.String @E [] @F [] @G [] field;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0081", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 4, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@E")); >+ assertEquals("Wrong location", "{0}", locations.get("@F")); >+ assertEquals("Wrong location", "{1}", locations.get("@G")); >+ assertEquals("Wrong location", "{2}", locations.get("@H")); >+} >+//check locations >+public void test0082() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A Map<@B java.lang.String, @H java.lang.String @E[] @F[] @G[]> field3;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A Map<@B java.lang.String, @H java.lang.String @E [] @F [] @G []> field3;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ LocationPrinterVisitor visitor = new LocationPrinterVisitor(); >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0082", expectedUnitToString, visitor); >+ Map locations = visitor.getLocations(); >+ assertEquals("Wrong size", 6, locations.size()); >+ assertEquals("Wrong location", null, locations.get("@A")); >+ assertEquals("Wrong location", "{0}", locations.get("@B")); >+ assertEquals("Wrong location", "{1}", locations.get("@E")); >+ assertEquals("Wrong location", "{1,0}", locations.get("@F")); >+ assertEquals("Wrong location", "{1,1}", locations.get("@G")); >+ assertEquals("Wrong location", "{1,2}", locations.get("@H")); >+} >+public void test0083() throws IOException { >+ String source = >+ "@Marker class A {}\n;" + >+ "@Marker class B extends @Marker A {}\n" + >+ "@Marker class C extends @Marker @SingleMember(0) A {}\n" + >+ "@Marker class D extends @Marker @SingleMember(0) @Normal(value = 0) A {}\n" + >+ "@Marker class E extends B {}\n;"; >+ >+ String expectedUnitToString = >+ "@Marker class A {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class B extends @Marker A {\n" + >+ " B() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class C extends @Marker @SingleMember(0) A {\n" + >+ " C() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class D extends @Marker @SingleMember(0) @Normal(value = 0) A {\n" + >+ " D() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class E extends B {\n" + >+ " E() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0083", expectedUnitToString); >+} >+ >+// To test Parser.consumeAdditionalBound() with Type annotations >+public void test0084() throws IOException { >+ String source = >+ "@Marker interface I<@Negative T> {}\n" + >+ "@SingleMember(0) interface J<@Positive T> {}\n" + >+ "@Marker class A implements I<@SingleMember(0) A>, J<@Marker A> {}\n" + >+ "@Normal(value = 1) class X<E extends @Positive A & @Marker I<A> & @Marker @SingleMember(1) J<@Readonly A>> {\n" + >+ "}"; >+ String expectedUnitToString = >+ "@Marker interface I<@Negative T> {\n" + >+ "}\n" + >+ "@SingleMember(0) interface J<@Positive T> {\n" + >+ "}\n" + >+ "@Marker class A implements I<@SingleMember(0) A>, J<@Marker A> {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Normal(value = 1) class X<E extends @Positive A & @Marker I<A> & @Marker @SingleMember(1) J<@Readonly A>> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0084", expectedUnitToString ); >+} >+ >+// To test Parser.consumeAdditionalBound() with Type annotations >+public void test0085() throws IOException { >+ String source = >+ "import java.io.Serializable;\n" + >+ "\n" + >+ "@SingleMember(10) class X<T extends @Marker Serializable & @Normal(value = 10) Runnable, V extends @Marker T> {\n" + >+ " @Negative T t;\n" + >+ " @Marker X(@Readonly T t) {\n" + >+ " this.t = t;\n" + >+ " }\n" + >+ " void foo() @Marker {\n" + >+ " (this == null ? t : t).run();\n" + >+ " ((@Marker V) t).run();\n" + >+ " }\n" + >+ " public static void main(@Readonly String @Marker [] args) {\n" + >+ " new @Marker X<@Marker A, @Negative A>(new @Marker A()).foo();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class A implements @Marker Serializable, @SingleMember(1) Runnable {\n" + >+ " public void run() {\n" + >+ " System.out.print(\"AA\");\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "import java.io.Serializable;\n" + >+ "@SingleMember(10) class X<T extends @Marker Serializable & @Normal(value = 10) Runnable, V extends @Marker T> {\n" + >+ " @Negative T t;\n" + >+ " @Marker X(@Readonly T t) {\n" + >+ " super();\n" + >+ " this.t = t;\n" + >+ " }\n" + >+ " void foo() @Marker {\n" + >+ " ((this == null) ? t : t).run();\n" + >+ " (@Marker V) t.run();\n" + >+ " }\n" + >+ " public static void main(@Readonly String @Marker [] args) {\n" + >+ " new @Marker X<@Marker A, @Negative A>(new @Marker A()).foo();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class A implements @Marker Serializable, @SingleMember(1) Runnable {\n" + >+ " A() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void run() {\n" + >+ " System.out.print(\"AA\");\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0085", expectedUnitToString ); >+} >+ >+// To test Parser.classInstanceCreation() with type annotations >+public void test0086() throws IOException { >+ String source = >+ "class X {\n" + >+ " @Marker X() {\n" + >+ " System.out.print(\"new X created\");\n" + >+ " }\n" + >+ " void f() throws @Marker InstantiationException {\n" + >+ " X testX;\n" + >+ " testX = new @Readonly @Negative X();\n" + >+ " Double d;\n" + >+ " d = new @Marker @Positive Double(1.1);\n" + >+ " throw new @Positive @Normal(value = 10) InstantiationException(\"test\");\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " @Marker X() {\n" + >+ " super();\n" + >+ " System.out.print(\"new X created\");\n" + >+ " }\n" + >+ " void f() throws @Marker InstantiationException {\n" + >+ " X testX;\n" + >+ " testX = new @Readonly @Negative X();\n" + >+ " Double d;\n" + >+ " d = new @Marker @Positive Double(1.1);\n" + >+ " throw new @Positive @Normal(value = 10) InstantiationException(\"test\");\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0086", expectedUnitToString ); >+} >+ >+// To test Parser.classInstanceCreation() with type annotations >+public void test0087() throws IOException { >+ String source = >+ "class X {\n" + >+ " @Marker X() {\n" + >+ " System.out.print(\"new X created\");\n" + >+ " }\n" + >+ " @Marker class Inner {\n" + >+ " @Normal(value = 10) Inner(){\n" + >+ " System.out.print(\"X.Inner created\");\n" + >+ " }\n" + >+ " }\n" + >+ " public String getString(){\n" + >+ " return \"hello\";\n" + >+ " }\n" + >+ " void f() @Marker {\n" + >+ " String testString;\n" + >+ " testString = new @Readonly @Negative X().getString();\n" + >+ " X.Inner testInner;\n" + >+ " testInner = new @Readonly X.Inner();\n" + >+ " int i;\n" + >+ " for(i = 0; i < 10; i++)\n" + >+ " System.out.print(\"test\");\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " @Marker class Inner {\n" + >+ " @Normal(value = 10) Inner() {\n" + >+ " super();\n" + >+ " System.out.print(\"X.Inner created\");\n" + >+ " }\n" + >+ " }\n" + >+ " @Marker X() {\n" + >+ " super();\n" + >+ " System.out.print(\"new X created\");\n" + >+ " }\n" + >+ " public String getString() {\n" + >+ " return \"hello\";\n" + >+ " }\n" + >+ " void f() @Marker {\n" + >+ " String testString;\n" + >+ " testString = new @Readonly @Negative X().getString();\n" + >+ " X.Inner testInner;\n" + >+ " testInner = new @Readonly X.Inner();\n" + >+ " int i;\n" + >+ " for (i = 0; (i < 10); i ++) \n" + >+ " System.out.print(\"test\");\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0087", expectedUnitToString ); >+} >+ >+// To test Parser.classInstanceCreation() with type annotations >+public void test0088() throws IOException { >+ String source = >+ "import java.io.Serializable;\n" + >+ "class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker Serializable() {\n" + >+ " };\n" + >+ " new @Positive @Marker Serializable() {\n" + >+ " public long serialVersion;\n" + >+ " };\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "import java.io.Serializable;\n" + >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker Serializable() {\n" + >+ " };\n" + >+ " new @Positive @Marker Serializable() {\n" + >+ " public long serialVersion;\n" + >+ " };\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0088", expectedUnitToString ); >+} >+ >+// To test Parser.classInstanceCreation() with type annotations >+public void test0089() throws IOException { >+ String source = >+ "import java.io.Serializable;\n" + >+ "class X<T>{\n" + >+ " public void f() {\n" + >+ " X testX;\n" + >+ " testX = new @Marker @SingleMember(10) X<@Negative Integer>();\n" + >+ " System.out.print(\"object created\");\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "import java.io.Serializable;\n" + >+ "class X<T> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void f() {\n" + >+ " X testX;\n" + >+ " testX = new @Marker @SingleMember(10) X<@Negative Integer>();\n" + >+ " System.out.print(\"object created\");\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0089", expectedUnitToString ); >+} >+ >+// To test Parser.classInstanceCreation() with type annotations >+public void test0090() throws IOException { >+ String source = >+ "class X <@Marker T extends @Readonly String> {\n" + >+ " T foo(T t) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Readonly X<String>().baz(\"SUCCESS\");\n" + // Parser.classInstanceCreation called >+ " }\n" + >+ " void baz(final T t) {\n" + >+ " new @Readonly @Marker Object() {\n" + // Parser.classInstanceCreation called >+ " void print() {\n" + >+ " }\n" + >+ " }.print();\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X<@Marker T extends @Readonly String> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " T foo(T t) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Readonly X<String>().baz(\"SUCCESS\");\n" + >+ " }\n" + >+ " void baz(final T t) {\n" + >+ " new @Readonly @Marker Object() {\n" + >+ " void print() {\n" + >+ " }\n" + >+ "}.print();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0090", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations >+public void test0091() throws IOException { >+ String source = >+ "class X <@Marker T extends @Readonly String> {\n" + >+ " public static void main(String[] args) {\n" + >+ " int [] x1;\n" + >+ " x1 = new int @Marker @SingleMember(2) [] {-1, -2};\n" + >+ " Integer [][] x2;\n" + >+ " x2 = new @Positive Integer @Marker @SingleMember(3) [] @SingleMember(3) [] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X<@Marker T extends @Readonly String> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " int[] x1;\n" + >+ " x1 = new int @Marker @SingleMember(2) []{(- 1), (- 2)};\n" + >+ " Integer[][] x2;\n" + >+ " x2 = new @Positive Integer @Marker @SingleMember(3) [] @SingleMember(3) []{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0091", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations >+public void test0092() throws IOException { >+ String source = >+ "class X {\n" + >+ " static class T {\n" + >+ " public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" + >+ " return new @Readonly Object @Normal(value = 10) [] {this, T.this};\n" + >+ " }\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " static class T {\n" + >+ " T() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" + >+ " return new @Readonly Object @Normal(value = 10) []{this, T.this};\n" + >+ " }\n" + >+ " }\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0092", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations >+public void test0093() throws IOException { >+ String source = >+ "class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " java.util.Arrays.asList(new @Readonly Object @SingleMember(1) [] {\"1\"});\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " java.util.Arrays.asList(new @Readonly Object @SingleMember(1) []{\"1\"});\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0093", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations >+public void test0094() throws IOException { >+ String source = >+ "class X {\n" + >+ " public boolean test() {\n" + >+ " String[] s;\n" + >+ " s = foo(new @Marker String @SingleMember(1) []{\"hello\"});\n" + >+ " return s != null;\n" + >+ " }\n" + >+ " public <@Marker F> F @SingleMember(1) [] foo(F[] f) {\n" + >+ " return f;\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public boolean test() {\n" + >+ " String[] s;\n" + >+ " s = foo(new @Marker String @SingleMember(1) []{\"hello\"});\n" + >+ " return (s != null);\n" + >+ " }\n" + >+ " public <@Marker F>F @SingleMember(1) [] foo(F[] f) {\n" + >+ " return f;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0094", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations >+public void test0095() throws IOException { >+ String source = >+ "import java.util.Arrays;\n" + >+ "import java.util.List;\n" + >+ "@Marker class Deejay {\n" + >+ " @Marker class Counter<@Marker T> {}\n" + >+ " public void f(String[] args) {\n" + >+ " Counter<@Positive Integer> songCounter;\n" + >+ " songCounter = new Counter<@Positive Integer>();\n" + >+ " Counter<@Readonly String> genre;\n" + >+ " genre = new Counter<@Readonly String>();\n" + >+ " List<@Marker Counter<?>> list1;\n" + >+ " list1 = Arrays.asList(new @Marker Counter<?> @Normal(value = 2) @Marker [] {songCounter, genre});\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "import java.util.Arrays;\n" + >+ "import java.util.List;\n" + >+ "@Marker class Deejay {\n" + >+ " @Marker class Counter<@Marker T> {\n" + >+ " Counter() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " Deejay() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void f(String[] args) {\n" + >+ " Counter<@Positive Integer> songCounter;\n" + >+ " songCounter = new Counter<@Positive Integer>();\n" + >+ " Counter<@Readonly String> genre;\n" + >+ " genre = new Counter<@Readonly String>();\n" + >+ " List<@Marker Counter<?>> list1;\n" + >+ " list1 = Arrays.asList(new @Marker Counter<?> @Normal(value = 2) @Marker []{songCounter, genre});\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0095", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations >+public void test0096() throws IOException { >+ String source = >+ "class X <@Marker T extends @Readonly String> {\n" + >+ " public static void main(String[] args) {\n" + >+ " int [] x1;\n" + >+ " x1 = new int @Marker @SingleMember(10) [10];\n" + >+ " Integer [][] x2;\n" + >+ " x2 = new @Positive Integer @Marker [10] @Normal(value = 10) [10];\n" + >+ " char[][] tokens;\n" + >+ " tokens = new char @SingleMember(0) [0] @Normal(value = 10) @Marker [];\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X<@Marker T extends @Readonly String> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " int[] x1;\n" + >+ " x1 = new int @Marker @SingleMember(10) [10];\n" + >+ " Integer[][] x2;\n" + >+ " x2 = new @Positive Integer @Marker [10] @Normal(value = 10) [10];\n" + >+ " char[][] tokens;\n" + >+ " tokens = new char @SingleMember(0) [0] @Normal(value = 10) @Marker [];\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0096", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations >+public void test0097() throws IOException { >+ String source = >+ "class X {\n" + >+ " public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" + >+ " return new @Readonly Object @Normal(value = 10) [10];\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" + >+ " return new @Readonly Object @Normal(value = 10) [10];\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0097", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations >+public void test0098() throws IOException { >+ String source = >+ "class X {\n" + >+ " public boolean test() {\n" + >+ " String[] s;\n" + >+ " s = foo(new @Marker String @SingleMember(1) [10]);\n" + >+ " return s != null;\n" + >+ " }\n" + >+ " public <@Marker F> F @SingleMember(1) [] foo(F[] f) {\n" + >+ " return f;\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public boolean test() {\n" + >+ " String[] s;\n" + >+ " s = foo(new @Marker String @SingleMember(1) [10]);\n" + >+ " return (s != null);\n" + >+ " }\n" + >+ " public <@Marker F>F @SingleMember(1) [] foo(F[] f) {\n" + >+ " return f;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0098", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations >+public void test0099() throws IOException { >+ String source = >+ "import java.util.Arrays;\n" + >+ "import java.util.List;\n" + >+ "class X<@Marker T> {\n" + >+ " public void test() {\n" + >+ " List<@Marker X<?>> a;\n" + >+ " a = Arrays.asList(new @Marker X<?> @SingleMember(0) [0]);\n" + >+ " String @Marker [] @SingleMember(1) [] x;\n" + >+ " x = new @Readonly String @Normal(value = 5) [5] @SingleMember(1) [1];\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "import java.util.Arrays;\n" + >+ "import java.util.List;\n" + >+ "class X<@Marker T> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void test() {\n" + >+ " List<@Marker X<?>> a;\n" + >+ " a = Arrays.asList(new @Marker X<?> @SingleMember(0) [0]);\n" + >+ " String @Marker [] @SingleMember(1) [] x;\n" + >+ " x = new @Readonly String @Normal(value = 5) [5] @SingleMember(1) [1];\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0099", expectedUnitToString ); >+} >+ >+// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations >+public void test0100() throws IOException { >+ String source = >+ "import java.util.*;\n" + >+ "class X {\n" + >+ " public Integer[] getTypes() {\n" + >+ " List<@Positive Integer> list;\n" + >+ " list = new ArrayList<@Positive Integer>();\n" + >+ " return list == null \n" + >+ " ? new @Positive Integer @SingleMember(0) [0] \n" + >+ " : list.toArray(new @Positive Integer @Marker [list.size()]);\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "import java.util.*;\n" + >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public Integer[] getTypes() {\n" + >+ " List<@Positive Integer> list;\n" + >+ " list = new ArrayList<@Positive Integer>();\n" + >+ " return ((list == null) ? new @Positive Integer @SingleMember(0) [0] : list.toArray(new @Positive Integer @Marker [list.size()]));\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0100", expectedUnitToString ); >+} >+ >+// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations >+public void test0101() throws IOException { >+ String source = >+ "import java.util.*;\n" + >+ "\n" + >+ "@Marker class X {\n" + >+ " Vector<Object> data;\n" + >+ " public void t() {\n" + >+ " Vector<@Readonly Object> v;\n" + >+ " v = (@Marker @SingleMember(0) Vector<@Readonly Object>) data.elementAt(0);\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "import java.util.*;\n" + >+ "@Marker class X {\n" + >+ " Vector<Object> data;\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void t() {\n" + >+ " Vector<@Readonly Object> v;\n" + >+ " v = (@Marker @SingleMember(0) Vector<@Readonly Object>) data.elementAt(0);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0101", expectedUnitToString ); >+} >+ >+// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations >+// To test Parser.consumeClassHeaderExtends() with Type Annotations >+public void test0102() throws IOException { >+ String source = >+ "class X<E> {\n" + >+ " X<@Readonly String> bar() {\n" + >+ " return (@Marker AX<@Readonly String>) new X<@Readonly String>();\n" + >+ " }\n" + >+ " X<@Readonly String> bar(Object o) {\n" + >+ " return (@Marker AX<@Readonly String>) o;\n" + >+ " }\n" + >+ " X<@Negative E> foo(Object o) {\n" + >+ " return (@Marker @Normal(value = 10) AX<@Negative E>) o;\n" + >+ " } \n" + >+ " X<E> baz(Object o) {\n" + >+ " return (@Marker AX<E>) null;\n" + >+ " }\n" + >+ " X<String> baz2(BX bx) {\n" + >+ " return (@Marker @SingleMember(10) X<String>) bx;\n" + >+ " }\n" + >+ "}\n" + >+ "@Normal(value = 1) class AX<@Marker F> extends @Marker X<@SingleMember(10)F> {}\n" + >+ "@Normal(value = 2) class BX extends @Marker @SingleMember(1) AX<@Readonly String> {}\n"; >+ String expectedUnitToString = >+ "class X<E> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " X<@Readonly String> bar() {\n" + >+ " return (@Marker AX<@Readonly String>) new X<@Readonly String>();\n" + >+ " }\n" + >+ " X<@Readonly String> bar(Object o) {\n" + >+ " return (@Marker AX<@Readonly String>) o;\n" + >+ " }\n" + >+ " X<@Negative E> foo(Object o) {\n" + >+ " return (@Marker @Normal(value = 10) AX<@Negative E>) o;\n" + >+ " }\n" + >+ " X<E> baz(Object o) {\n" + >+ " return (@Marker AX<E>) null;\n" + >+ " }\n" + >+ " X<String> baz2(BX bx) {\n" + >+ " return (@Marker @SingleMember(10) X<String>) bx;\n" + >+ " }\n" + >+ "}\n" + >+ "@Normal(value = 1) class AX<@Marker F> extends @Marker X<@SingleMember(10) F> {\n" + >+ " AX() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Normal(value = 2) class BX extends @Marker @SingleMember(1) AX<@Readonly String> {\n" + >+ " BX() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0102", expectedUnitToString ); >+} >+ >+// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations >+public void test0103() throws IOException { >+ String source = >+ "import java.lang.reflect.Array;\n" + >+ "@Marker class X<@Readonly T> {\n" + >+ " T @SingleMember(0) [] theArray;\n" + >+ " public X(Class<T> clazz) {\n" + >+ " theArray = (@Marker @SingleMember(0) T @Normal(value = 10) []) Array.newInstance(clazz, 10); // Compiler warning\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "import java.lang.reflect.Array;\n" + >+ "@Marker class X<@Readonly T> {\n" + >+ " T @SingleMember(0) [] theArray;\n" + >+ " public X(Class<T> clazz) {\n" + >+ " super();\n" + >+ " theArray = (@Marker @SingleMember(0) T @Normal(value = 10) []) Array.newInstance(clazz, 10);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0103", expectedUnitToString ); >+} >+ >+// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations >+public void test0104() throws IOException { >+ String source = >+ "import java.util.*;\n" + >+ "class X {\n" + >+ " void method(Object o) {\n" + >+ " if (o instanceof String[]){\n" + >+ " String[] s;\n" + >+ " s = (@Marker @Readonly String @Marker []) o;\n" + >+ " }\n" + >+ " if (o instanceof @Readonly List<?>[]) {\n" + >+ " List<?>[] es;\n" + >+ " es = (@Marker List<?> @SingleMember(0) []) o;\n" + >+ " }\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "import java.util.*;\n" + >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " void method(Object o) {\n" + >+ " if ((o instanceof String[]))\n" + >+ " {\n" + >+ " String[] s;\n" + >+ " s = (@Marker @Readonly String @Marker []) o;\n" + >+ " }\n" + >+ " if ((o instanceof @Readonly List<?>[]))\n" + >+ " {\n" + >+ " List<?>[] es;\n" + >+ " es = (@Marker List<?> @SingleMember(0) []) o;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0104", expectedUnitToString ); >+} >+ >+ >+// To test Parser.consumeCastExpressionWithPrimitiveType() with Type Annotations >+public void test0105() throws IOException { >+ String source = >+ "import java.util.HashMap;\n" + >+ "class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " HashMap<Byte, Byte> subst;\n" + >+ " subst = new HashMap<Byte, Byte>();\n" + >+ " subst.put((@Marker byte)1, (@Positive byte)1);\n" + >+ " if (1 + subst.get((@Positive @Normal(value = 10) byte)1) > 0.f) {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " } \n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "import java.util.HashMap;\n" + >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " HashMap<Byte, Byte> subst;\n" + >+ " subst = new HashMap<Byte, Byte>();\n" + >+ " subst.put((@Marker byte) 1, (@Positive byte) 1);\n" + >+ " if (((1 + subst.get((@Positive @Normal(value = 10) byte) 1)) > 0.f))\n" + >+ " {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0105", expectedUnitToString ); >+} >+ >+// To test Parser.consumeCastExpressionWithPrimitiveType() with Type Annotations >+public void test0106() throws IOException { >+ String source = >+ "class X{\n" + >+ " private float x, y, z;\n" + >+ " float magnitude () {\n" + >+ " return (@Marker @Positive float) Math.sqrt((x*x) + (y*y) + (z*z));\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " private float x;\n" + >+ " private float y;\n" + >+ " private float z;\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " float magnitude() {\n" + >+ " return (@Marker @Positive float) Math.sqrt((((x * x) + (y * y)) + (z * z)));\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0106", expectedUnitToString ); >+} >+ >+// To test Parser.consumeCastExpressionWithQualifiedGenericsArray() with Type Annotations >+// Javac version b76 crashes on type annotations on type arguments to parameterized classes >+// in a qualified generic reference >+public void test0107() throws IOException { >+ String source = >+ "class C1<T> {\n" + >+ " class C11 { }\n" + >+ " @Marker class C12 {\n" + >+ " T t;\n" + >+ " C1<@Readonly T>.C11 m() {\n" + >+ " C1<@Readonly T>.C11[] ts;\n" + >+ " ts = (@Marker C1<@Readonly T>.C11[]) new @Marker C1<?>.C11 @Normal(value = 5) [5];\n" + >+ " return ts;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class C1<T> {\n" + >+ " class C11 {\n" + >+ " C11() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " @Marker class C12 {\n" + >+ " T t;\n" + >+ " C12() {\n" + >+ " super();\n" + >+ " }\n" + >+ " C1<@Readonly T>.C11 m() {\n" + >+ " C1<@Readonly T>.C11[] ts;\n" + >+ " ts = ( @Marker C1<@Readonly T>.C11[]) new @Marker C1<?>.C11 @Normal(value = 5) [5];\n" + >+ " return ts;\n" + >+ " }\n" + >+ " }\n" + >+ " C1() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0107", expectedUnitToString ); >+} >+ >+// To test Parser.consumeFormalParameter() with Type Annotations >+public void test0108() throws IOException { >+ String source = >+ "class X {\n" + >+ " int field;" + >+ " public void test(@Marker X x,@Positive int i){\n" + >+ " x.field = i;\n" + >+ " }\n" + >+ " public static void main(@Readonly String args @Normal(10) []){" + >+ " System.exit(0);\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " int field;\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void test(@Marker X x, @Positive int i) {\n" + >+ " x.field = i;\n" + >+ " }\n" + >+ " public static void main(@Readonly String @Normal(10) [] args) {\n" + >+ " System.exit(0);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0108", expectedUnitToString ); >+} >+ >+// To test Parser.consumeFormalParameter() with Type Annotations >+public void test0109() throws IOException { >+ String source = >+ "class X<@Marker T> {\n" + >+ " T field;" + >+ " public void test(@Marker @SingleMember(1) X<? extends @Marker Object> x,@Positive T i){\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X<@Marker T> {\n" + >+ " T field;\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void test(@Marker @SingleMember(1) X<? extends @Marker Object> x, @Positive T i) {\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0109", expectedUnitToString ); >+} >+ >+// To test Parser.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() >+// with Type Annotations >+// Javac b76 crashes with type annotations in qualified class instance creation expression >+public void test0110() throws IOException { >+ String source = >+ "class X {\n" + >+ " class MX {\n" + >+ " @Marker <T> MX(T t){\n" + >+ " System.out.println(t);\n" + >+ " }\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker @SingleMember(10) X().new <@Readonly String> @Marker MX(\"SUCCESS\");\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " class MX {\n" + >+ " @Marker <T>MX(T t) {\n" + >+ " super();\n" + >+ " System.out.println(t);\n" + >+ " }\n" + >+ " }\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker @SingleMember(10) X().new <@Readonly String>@Marker MX(\"SUCCESS\");\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0110", expectedUnitToString ); >+} >+ >+// To test Parser.consumeClassInstanceCreationExpressionWithTypeArguments() >+// with Type Annotations >+public void test0111() throws IOException { >+ String source = >+ "class X {\n" + >+ " public <T> X(T t){\n" + >+ " System.out.println(t);\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new <@Readonly String> @Marker @SingleMember(0) X(\"SUCCESS\");\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " public <T>X(T t) {\n" + >+ " super();\n" + >+ " System.out.println(t);\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new <@Readonly String>@Marker @SingleMember(0) X(\"SUCCESS\");\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0111", expectedUnitToString ); >+} >+ >+// To test Parser.consumeEnhancedForStatementHeaderInit() with Type Annotations >+public void test0112() throws IOException { >+ String source = >+ "import java.util.*;\n" + >+ "class X {\n" + >+ " List list() { return null; }\n" + >+ " void m2() { for (@SingleMember(10) Iterator<@Marker X> i = list().iterator(); i.hasNext();); }\n" + >+ " void m3() {\n" + >+ " Integer [] array;\n" + >+ " array = new Integer [] {1, 2, 3};\n" + >+ " List<List<X>> xList;\n" + >+ " xList = null;\n" + >+ " for(@Positive @SingleMember(10) Integer i: array) {}\n" + >+ " for(@Marker @Normal(value = 5) List<@Readonly X> x: xList) {}\n" + >+ " }" + >+ "}\n"; >+ String expectedUnitToString = >+ "import java.util.*;\n" + >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " List list() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " void m2() {\n" + >+ " for (@SingleMember(10) Iterator<@Marker X> i = list().iterator();; i.hasNext(); ) \n" + >+ " ;\n" + >+ " }\n" + >+ " void m3() {\n" + >+ " Integer[] array;\n" + >+ " array = new Integer[]{1, 2, 3};\n" + >+ " List<List<X>> xList;\n" + >+ " xList = null;\n" + >+ " for (@Positive @SingleMember(10) Integer i : array) \n" + >+ " {\n" + >+ " }\n" + >+ " for (@Marker @Normal(value = 5) List<@Readonly X> x : xList) \n" + >+ " {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_COMPLETION_PARSER & ~CHECK_SELECTION_PARSER & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0112", expectedUnitToString ); >+ expectedUnitToString = >+ "import java.util.*;\n" + >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " List list() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " void m2() {\n" + >+ " for (@SingleMember(10) Iterator<@Marker X> i;; i.hasNext(); ) \n" + >+ " ;\n" + >+ " }\n" + >+ " void m3() {\n" + >+ " Integer[] array;\n" + >+ " array = new Integer[]{1, 2, 3};\n" + >+ " List<List<X>> xList;\n" + >+ " xList = null;\n" + >+ " for (@Positive @SingleMember(10) Integer i : array) \n" + >+ " {\n" + >+ " }\n" + >+ " for (@Marker @Normal(value = 5) List<@Readonly X> x : xList) \n" + >+ " {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_COMPLETION_PARSER & CHECK_SELECTION_PARSER, source.toCharArray(), null, "test0112", expectedUnitToString ); >+} >+ >+// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations >+public void test0113() throws IOException { >+ String source = >+ "@Marker class X {\n" + >+ " void f() @Normal(value = 5) {\n" + >+ " new @Marker @SingleMember(10) Object() {\n" + >+ " void foo(){\n" + >+ " System.out.println(\"test\");\n" + >+ " }\n" + >+ " }.foo();\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "@Marker class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " void f() @Normal(value = 5) {\n" + >+ " new @Marker @SingleMember(10) Object() {\n" + >+ " void foo() {\n" + >+ " System.out.println(\"test\");\n" + >+ " }\n" + >+ "}.foo();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0113", expectedUnitToString ); >+} >+ >+// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations >+public void test0114() throws IOException { >+ String source = >+ "class Toplevel2{\n" + >+ " public boolean foo(){\n" + >+ " Toplevel2 o;\n" + >+ " o = new @Marker @Normal(value = 5) Toplevel2() { \n" + >+ " public boolean foo() { return false; } // no copy in fact\n" + >+ " };\n" + >+ " return o.foo();\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class Toplevel2 {\n" + >+ " Toplevel2() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public boolean foo() {\n" + >+ " Toplevel2 o;\n" + >+ " o = new @Marker @Normal(value = 5) Toplevel2() {\n" + >+ " public boolean foo() {\n" + >+ " return false;\n" + >+ " }\n" + >+ "};\n" + >+ " return o.foo();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0114", expectedUnitToString ); >+} >+ >+// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations >+public void test0115() throws IOException { >+ String source = >+ "class X <T> {\n" + >+ " T foo(T t) {\n" + >+ " System.out.println(t);\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String @Normal(value = 5) [] args) {\n" + >+ " new @Marker X<@SingleMember(10) @Normal(value = 5) XY>() {\n" + >+ " void run() {\n" + >+ " foo(new @Marker XY());\n" + >+ " }\n" + >+ " }.run();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class XY {\n" + >+ " public String toString() {\n" + >+ " return \"SUCCESS\";\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X<T> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " T foo(T t) {\n" + >+ " System.out.println(t);\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String @Normal(value = 5) [] args) {\n" + >+ " new @Marker X<@SingleMember(10) @Normal(value = 5) XY>() {\n" + >+ " void run() {\n" + >+ " foo(new @Marker XY());\n" + >+ " }\n" + >+ "}.run();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class XY {\n" + >+ " XY() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public String toString() {\n" + >+ " return \"SUCCESS\";\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0115", expectedUnitToString ); >+} >+ >+// To test Parser.consumeInsideCastExpressionLL1() with Type Annotations >+public void test0116() throws IOException { >+ String source = >+ "class X{\n" + >+ " public void test1(){\n" + >+ " throw (@Marker Error) null; \n" + >+ " } \n" + >+ " public void test2(){\n" + >+ " String s;\n" + >+ " s = (@Marker @SingleMember(10) String) null;\n" + >+ " byte b;\n" + >+ " b = 0;\n" + >+ " Byte i;\n" + >+ " i = (@Positive Byte) b;\n" + >+ " } \n" + >+ " public void test3(java.io.Serializable name) {\n" + >+ " Object temp;\n" + >+ " temp = (Object)name;\n" + >+ " System.out.println( (String)temp );\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class X {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void test1() {\n" + >+ " throw (@Marker Error) null;\n" + >+ " }\n" + >+ " public void test2() {\n" + >+ " String s;\n" + >+ " s = (@Marker @SingleMember(10) String) null;\n" + >+ " byte b;\n" + >+ " b = 0;\n" + >+ " Byte i;\n" + >+ " i = (@Positive Byte) b;\n" + >+ " }\n" + >+ " public void test3(java.io.Serializable name) {\n" + >+ " Object temp;\n" + >+ " temp = (Object) name;\n" + >+ " System.out.println((String) temp);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0116", expectedUnitToString ); >+} >+ >+// To test Parser.consumeInstanceOfExpression() with Type Annotations >+public void test0117() throws IOException { >+ String source = >+ "import java.util.*;\n" + >+ "class X <@NonNull T>{\n" + >+ " public void test1(Object obj) @Marker {\n" + >+ " if(obj instanceof @Marker @NonNull X) {\n" + >+ " X newX;\n" + >+ " newX = (@NonNull X) obj;\n" + >+ " }\n" + >+ " }\n" + >+ " @NonNull T foo(@NonNull T t) @Marker {\n" + >+ " if (t instanceof @NonNull @Marker List<?> @Normal(value = 10) []) {\n" + >+ " List<?> @SingleMember (10) [] es;\n" + >+ " es = (@Marker List<?> @SingleMember(10) []) t;\n" + >+ " }\n" + >+ " if (t instanceof @Marker @Normal(value = 5) X<?>) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " return t;\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "import java.util.*;\n" + >+ "class X<@NonNull T> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void test1(Object obj) @Marker {\n" + >+ " if ((obj instanceof @Marker @NonNull X))\n" + >+ " {\n" + >+ " X newX;\n" + >+ " newX = (@NonNull X) obj;\n" + >+ " }\n" + >+ " }\n" + >+ " @NonNull T foo(@NonNull T t) @Marker {\n" + >+ " if ((t instanceof @NonNull @Marker List<?> @Normal(value = 10) []))\n" + >+ " {\n" + >+ " List<?> @SingleMember(10) [] es;\n" + >+ " es = (@Marker List<?> @SingleMember(10) []) t;\n" + >+ " }\n" + >+ " if ((t instanceof @Marker @Normal(value = 5) X<?>))\n" + >+ " {\n" + >+ " return t;\n" + >+ " }\n" + >+ " return t;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER , source.toCharArray(), null, "test0117", expectedUnitToString ); >+} >+ >+// To test Parser.consumeInstanceOfExpressionWithName() with Type Annotations >+public void test0118() throws IOException { >+ String source = >+ "class Outer<E> {\n" + >+ " Inner inner;\n" + >+ " class Inner {\n" + >+ " E e;\n" + >+ " @NonNull E getOtherElement(Object other) @Marker {\n" + >+ " if (!(other instanceof @Marker @SingleMember(10) Outer<?>.Inner))\n" + >+ " throw new @Marker IllegalArgumentException(String.valueOf(other));\n" + >+ " Inner that;\n" + >+ " that = (@Marker Inner) other;\n" + >+ " return that.e;\n" + >+ " }\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "class Outer<E> {\n" + >+ " class Inner {\n" + >+ " E e;\n" + >+ " Inner() {\n" + >+ " super();\n" + >+ " }\n" + >+ " @NonNull E getOtherElement(Object other) @Marker {\n" + >+ " if ((! (other instanceof @Marker @SingleMember(10) Outer<?>.Inner)))\n" + >+ " throw new @Marker IllegalArgumentException(String.valueOf(other));\n" + >+ " Inner that;\n" + >+ " that = (@Marker Inner) other;\n" + >+ " return that.e;\n" + >+ " }\n" + >+ " }\n" + >+ " Inner inner;\n" + >+ " Outer() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER , source.toCharArray(), null, "test0118", expectedUnitToString ); >+} >+ >+// To test Parser.consumeTypeArgument() with Type Annotations >+public void test0119() throws IOException { >+ String source = >+ "class X<@SingleMember(1) Xp1 extends @Readonly String, @NonNull Xp2 extends @NonNull Comparable> extends @Marker XS<@SingleMember(10) Xp2> {\n" + >+ "\n" + >+ " public static void main(String @Marker [] args) {\n" + >+ " Integer w;\n" + >+ " w = new @Marker X<@Readonly @SingleMember(10) String,@Positive Integer>().get(new @Positive Integer(12));\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ " Xp2 get(Xp2 t) @Marker {\n" + >+ " System.out.print(\"{X::get}\");\n" + >+ " return super.get(t);\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class XS <@NonNull XSp1> {\n" + >+ " XSp1 get(XSp1 t) @Marker {\n" + >+ " @NonNull @SingleMember(10) Y.M mObject;\n" + >+ " mObject = new @SingleMember(10) @NonNull Y.M();\n" + >+ " System.out.print(\"{XS::get}\");\n" + >+ " return t;\n" + >+ " }\n" + >+ "}\n" + >+ "class X2<T,E>{}\n" + >+ "@Marker class Y extends @Marker X2<@NonNull Y.M, @NonNull @SingleMember(1) Y.N> {\n" + >+ " static class M{}\n" + >+ " static class N extends M{}\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X<@SingleMember(1) Xp1 extends @Readonly String, @NonNull Xp2 extends @NonNull Comparable> extends @Marker XS<@SingleMember(10) Xp2> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String @Marker [] args) {\n" + >+ " Integer w;\n" + >+ " w = new @Marker X<@Readonly @SingleMember(10) String, @Positive Integer>().get(new @Positive Integer(12));\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ " Xp2 get(Xp2 t) @Marker {\n" + >+ " System.out.print(\"{X::get}\");\n" + >+ " return super.get(t);\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class XS<@NonNull XSp1> {\n" + >+ " XS() {\n" + >+ " super();\n" + >+ " }\n" + >+ " XSp1 get(XSp1 t) @Marker {\n" + >+ " @NonNull @SingleMember(10) Y.M mObject;\n" + >+ " mObject = new @SingleMember(10) @NonNull Y.M();\n" + >+ " System.out.print(\"{XS::get}\");\n" + >+ " return t;\n" + >+ " }\n" + >+ "}\n" + >+ "class X2<T, E> {\n" + >+ " X2() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class Y extends @Marker X2<@NonNull Y.M, @NonNull @SingleMember(1) Y.N> {\n" + >+ " static class M {\n" + >+ " M() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " static class N extends M {\n" + >+ " N() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " Y() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0119", expectedUnitToString ); >+} >+ >+// To test Parser.consumeTypeArgument() with Type Annotations >+public void test0120() throws IOException { >+ String source = >+ "class X<A1, A2, A3, A4, A5, A6, A7, A8> {\n" + >+ "}\n" + >+ "class Y {\n" + >+ " @Marker X<int @Marker [], short @SingleMember(1) [] @Marker [], long[] @NonNull [][], float[] @Marker [] @Normal(value = 5) [][], double[][]@Marker [] @SingleMember(10) [][], boolean[][][][][][], char[] @Marker [][][][][][], Object[][]@Marker [] @SingleMember(10) [] @Normal(value = 5) [][][][][]> x;\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "class X<A1, A2, A3, A4, A5, A6, A7, A8> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "class Y {\n" + >+ " @Marker X<int @Marker [], short @SingleMember(1) [] @Marker [], long[] @NonNull [][], float[] @Marker [] @Normal(value = 5) [][], double[][] @Marker [] @SingleMember(10) [][], boolean[][][][][][], char[] @Marker [][][][][][], Object[][] @Marker [] @SingleMember(10) [] @Normal(value = 5) [][][][][]> x;\n" + >+ " Y() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0120", expectedUnitToString ); >+} >+ >+// To test Parser.consumeTypeArgumentReferenceType1() with Type Annotations >+public void test0121() throws IOException { >+ String source = >+ "@Marker class X <@NonNull T> {\n" + >+ " protected T t;\n" + >+ " @Marker X(@NonNull T t) {\n" + >+ " this.t = t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<@Marker X<@Readonly @NonNull String>> xs;\n" + >+ " xs = new @Marker X<@Marker X<@Readonly @NonNull String>>(new @Marker X<@Readonly @NonNull @SingleMember(10) String>(\"SUCCESS\"));\n" + >+ " System.out.println(xs.t.t);\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class X<@NonNull T> {\n" + >+ " protected T t;\n" + >+ " @Marker X(@NonNull T t) {\n" + >+ " super();\n" + >+ " this.t = t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<@Marker X<@Readonly @NonNull String>> xs;\n" + >+ " xs = new @Marker X<@Marker X<@Readonly @NonNull String>>(new @Marker X<@Readonly @NonNull @SingleMember(10) String>(\"SUCCESS\"));\n" + >+ " System.out.println(xs.t.t);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0121", expectedUnitToString ); >+} >+ >+// To test Parser.consumeTypeParameter1WithExtendsAndBounds() and Parser.consumeWildcardBoundsSuper() with >+// Type Annotations >+public void test0122() throws IOException { >+ String source = >+ "@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable<@Marker Foo1> {\n" + >+ " public int compareTo(Foo1 arg0) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n" + >+ "class Foo1 {}\n" + >+ "@Marker class X<@NonNull T extends @NonNull @Normal (value = 5) Object & @Marker Comparable<? super @NonNull T>> {\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker @SingleMember(10) X<@Marker Foo>();\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable<@Marker Foo1> {\n" + >+ " Foo() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public int compareTo(Foo1 arg0) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n" + >+ "class Foo1 {\n" + >+ " Foo1() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class X<@NonNull T extends @NonNull @Normal(value = 5) Object & @Marker Comparable<? super @NonNull T>> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker @SingleMember(10) X<@Marker Foo>();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0122", expectedUnitToString ); >+} >+ >+// To test Parser.consumeTypeParameter1WithExtendsAndBounds() with Type Annotations >+public void test0123() throws IOException { >+ String source = >+ "@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable {\n" + >+ " public int compareTo(Object arg0) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n" + >+ "class Foo1 {}\n" + >+ "@Marker class X<@NonNull T extends @NonNull @Normal (value = 5) Object & @Marker Comparable, @NonNull V extends @Readonly Object> {\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker @SingleMember(10) X<@Marker Foo, @SingleMember(0) Foo1>();\n" + >+ " Class <@NonNull Foo> c;\n" + >+ " c = @Readonly @NonNull Foo.class;\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable {\n" + >+ " Foo() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public int compareTo(Object arg0) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ "}\n" + >+ "class Foo1 {\n" + >+ " Foo1() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n" + >+ "@Marker class X<@NonNull T extends @NonNull @Normal(value = 5) Object & @Marker Comparable, @NonNull V extends @Readonly Object> {\n" + >+ " X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new @Marker @SingleMember(10) X<@Marker Foo, @SingleMember(0) Foo1>();\n" + >+ " Class<@NonNull Foo> c;\n" + >+ " c = @Readonly @NonNull Foo.class;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(source.toCharArray(), null, "test0123", expectedUnitToString ); >+} >+ >+// To test type annotations on static class member access in a declaration >+public void test0124() throws IOException { >+ String source = >+ "@Marker class Foo {\n" + >+ " static @Marker @SingleMember(0) class Foo1 {}\n" + >+ " public static void main(String[] args) {\n" + >+ " @Marker @Normal(value = 5) Foo.Foo1 foo1Object;\n" + >+ " foo1Object = new @Marker @Normal(value = 5) Foo.Foo1();\n" + >+ " Class <@NonNull Foo.Foo1> c;\n" + >+ " c = @Readonly @NonNull Foo.Foo1.class;\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "@Marker class Foo {\n" + >+ " static @Marker @SingleMember(0) class Foo1 {\n" + >+ " Foo1() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " Foo() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " @Marker @Normal(value = 5) Foo.Foo1 foo1Object;\n" + >+ " foo1Object = new @Marker @Normal(value = 5) Foo.Foo1();\n" + >+ " Class<@NonNull Foo.Foo1> c;\n" + >+ " c = @Readonly @NonNull Foo.Foo1.class;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0124", expectedUnitToString ); >+} >+//To test type annotations on static class member access in a declaration >+public void test0125() throws IOException { >+ String source = >+ "public class X extends @A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> {}"; >+ String expectedUnitToString = >+ "public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0125", expectedUnitToString ); >+} >+//To test type annotations on static class member access in a declaration >+public void test0126() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A(\"Hello, World!\") @B @C('(') String@E[] @D[] f;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A(\"Hello, World!\") @B @C(\'(\') String @E [] @D [] f;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0126", expectedUnitToString ); >+} >+//To test type annotations on static class member access in a declaration >+public void test0127() throws IOException { >+ String source = >+ "public class X {\n" + >+ " @A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> f;\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> f;\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0127", expectedUnitToString ); >+} >+//type class literal expression >+public void test0128() throws IOException { >+ String source = >+ "public class X {\n" + >+ " public boolean foo(String s) {\n" + >+ " return (s instanceof @C('_') Object[]);\n" + >+ " }\n" + >+ " public Object foo1(String s) {\n" + >+ " return new @B(3) @A(\"new Object\") Object[] {};\n" + >+ " }\n" + >+ " public Class foo2(String s) {\n" + >+ " return @B(4) Object[].class;\n" + >+ " }\n" + >+ " public Class foo3(String s) {\n" + >+ " return @A(\"int class literal\") @B(5) int[].class;\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public boolean foo(String s) {\n" + >+ " return (s instanceof @C(\'_\') Object[]);\n" + >+ " }\n" + >+ " public Object foo1(String s) {\n" + >+ " return new @B(3) @A(\"new Object\") Object[]{};\n" + >+ " }\n" + >+ " public Class foo2(String s) {\n" + >+ " return @B(4) Object[].class;\n" + >+ " }\n" + >+ " public Class foo3(String s) {\n" + >+ " return @A(\"int class literal\") @B(5) int[].class;\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0128", expectedUnitToString ); >+} >+//instanceof checks >+public void test0129() throws IOException { >+ String source = "public class Clazz {\n" + >+ "public static void main(Object o) {\n" + >+ "if (o instanceof @Readonly String) {\n" + >+ "}\n" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class Clazz {\n" + >+ " public Clazz() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(Object o) {\n" + >+ " if ((o instanceof @Readonly String))\n" + >+ " {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0129", expectedUnitToString); >+} >+//instanceof checks >+public void test0130() throws IOException { >+ String source = "public class Clazz {\n" + >+ "public static void foo() {\n" + >+ " if (o instanceof @Readonly String[]) {}" + >+ "}\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class Clazz {\n" + >+ " public Clazz() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void foo() {\n" + >+ " if ((o instanceof @Readonly String[]))\n" + >+ " {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString); >+} >+//cast >+public void test0131() throws IOException { >+ String source = >+ "public class X {\n" + >+ " public void foo(Object o) {\n" + >+ " if (o instanceof String[][]) {\n" + >+ " String[][] tab = (@C('_') @B(3) String[] @A[]) o;\n" + >+ " System.out.println(tab.length);\n" + >+ " }\n" + >+ " System.out.println(o);\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo(Object o) {\n" + >+ " if ((o instanceof String[][]))\n" + >+ " {\n" + >+ " String[][] tab = (@C(\'_\') @B(3) String[] @A []) o;\n" + >+ " System.out.println(tab.length);\n" + >+ " }\n" + >+ " System.out.println(o);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString); >+} >+//cast >+public void test0132() throws IOException { >+ String source = >+ "public class X {\n" + >+ " public void foo(Object o) {\n" + >+ " if (o instanceof String[][]) {\n" + >+ " String[][] tab = (@C('_') @B(3) String@D[] @A[]) o;\n" + >+ " System.out.println(tab.length);\n" + >+ " }\n" + >+ " System.out.println(o);\n" + >+ " }\n" + >+ "}"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " public void foo(Object o) {\n" + >+ " if ((o instanceof String[][]))\n" + >+ " {\n" + >+ " String[][] tab = (@C(\'_\') @B(3) String @D [] @A []) o;\n" + >+ " System.out.println(tab.length);\n" + >+ " }\n" + >+ " System.out.println(o);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString); >+} >+//generic type arguments in a generic method invocation >+public void test0133() throws IOException { >+ String source = >+ "public class X {\n" + >+ " static <T, U> T foo(T t, U u) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " static <T, U>T foo(T t, U u) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString); >+} >+//generic type arguments in a generic method invocation >+public void test0134() throws IOException { >+ String source = >+ "public class X {\n" + >+ "\n" + >+ " <T, U> T foo(T t, U u) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new X();\n" + >+ " System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " <T, U>T foo(T t, U u) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new X();\n" + >+ " System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString); >+} >+//generic type arguments in a generic constructor invocation >+public void test0135() throws IOException { >+ String source = >+ "public class X {\n" + >+ " <T, U> X(T t, U u) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new <@D() @A(value = \"hello\") String, @B X> X();\n" + >+ " System.out.println(x);\n" + >+ " }\n" + >+ "}\n"; >+ String expectedUnitToString = >+ "public class X {\n" + >+ " <T, U>X(T t, U u) {\n" + >+ " super();\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new <@D() @A(value = \"hello\") String, @B X>X();\n" + >+ " System.out.println(x);\n" + >+ " }\n" + >+ "}\n"; >+ checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString); >+} >+} >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java,v >retrieving revision 1.30 >diff -u -r1.30 ArrayTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java 6 Dec 2010 18:43:53 -0000 1.30 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java 20 Jan 2011 21:55:48 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -551,7 +551,7 @@ > > // https://bugs.eclipse.org/331872 - [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter > public void test018() throws Exception { >- if (this.complianceLevel < ClassFileConstants.JDK1_5) >+ if (new CompilerOptions(getCompilerOptions()).complianceLevel < ClassFileConstants.JDK1_5) > return; > this.runNegativeTest( > new String[] { >Index: src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java,v >retrieving revision 1.40 >diff -u -r1.40 CompilerInvocationTests.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 16 Jan 2011 22:43:57 -0000 1.40 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 20 Jan 2011 21:55:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2010 IBM Corporation and others. >+ * Copyright (c) 2006, 2011 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 >@@ -13,6 +13,8 @@ > package org.eclipse.jdt.core.tests.compiler.regression; > > import java.lang.reflect.Field; >+import java.util.Arrays; >+import java.util.Comparator; > import java.util.HashMap; > import java.util.Map; > >@@ -44,7 +46,7 @@ > // Only the highest compliance level is run; add the VM argument > // -Dcompliance=1.4 (for example) to lower it if needed > static { >-// TESTS_NAMES = new String[] { "test001" }; >+// TESTS_NAMES = new String[] { "test003_task_tags_options" }; > // TESTS_NUMBERS = new int[] { 1 }; > // TESTS_RANGE = new int[] { 1, -1 }; > // TESTS_RANGE = new int[] { 1, 2049 }; >@@ -456,13 +458,17 @@ > expectedProblemAttributes.put("HierarchyHasProblems", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("IllegalAccessFromTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >+ expectedProblemAttributes.put("IllegalBinaryLiteral", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("IllegalCast", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("IllegalClassLiteralForTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >+ expectedProblemAttributes.put("IllegalDangerousCharacter", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("IllegalDimension", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("IllegalEnclosingInstanceSpecification", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >+ expectedProblemAttributes.put("IllegalExoticIdentifier", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("IllegalExtendedDimensions", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("IllegalExtendedDimensionsForVarArgs", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("IllegalGenericArray", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >+ expectedProblemAttributes.put("IllegalHexaLiteral", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("IllegalInstanceofParameterizedType", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("IllegalInstanceofTypeParameter", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >@@ -493,7 +499,10 @@ > expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("IllegalStaticModifierForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("IllegalTypeVariableSuperReference", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >+ expectedProblemAttributes.put("IllegalUnderscorePosition", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("IllegalUsageOfUnderscore", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("IllegalVararg", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >@@ -537,12 +546,14 @@ > expectedProblemAttributes.put("InterfaceNotVisible", DEPRECATED); > expectedProblemAttributes.put("InternalTypeNameProvided", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("InvalidAnnotationMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >+ expectedProblemAttributes.put("InvalidBinary", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidBreak", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("InvalidCatchBlockSequence", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("InvalidCharacterConstant", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidClassInstantiation", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("InvalidContinue", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("InvalidDigit", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("InvalidEmptyExoticIdentifier", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidEncoding", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("InvalidEscape", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidExplicitConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >@@ -553,6 +564,7 @@ > expectedProblemAttributes.put("InvalidHighSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidInput", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidLowSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("InvalidLocationForModifiers", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidNullToSynchronized", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("InvalidOctal", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidOperator", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >@@ -570,7 +582,9 @@ > expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("InvalidUsageOfReceiverAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("InvalidUsageOfTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfTypeArguments", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfTypeParameters", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >@@ -665,6 +679,7 @@ > expectedProblemAttributes.put("MethodRequiresBody", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("MethodReturnsVoid", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); >+ expectedProblemAttributes.put("MisplacedTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("MissingEnclosingInstance", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >@@ -842,6 +857,7 @@ > expectedProblemAttributes.put("UnsafeReturnTypeOverride", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW)); > expectedProblemAttributes.put("UnsafeTypeConversion", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW)); > expectedProblemAttributes.put("UnterminatedComment", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("UnterminatedExoticIdentifier", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("UnterminatedString", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); > expectedProblemAttributes.put("UnusedImport", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); >@@ -871,6 +887,13 @@ > StringBuffer failures = new StringBuffer(); > StringBuffer correctResult = new StringBuffer(70000); > Field[] fields = (iProblemClass = IProblem.class).getFields(); >+ Arrays.sort(fields, new Comparator() { >+ public int compare(Object o1, Object o2) { >+ Field field1 = (Field) o1; >+ Field field2 = (Field) o2; >+ return field1.getName().compareTo(field2.getName()); >+ } >+ }); > boolean watchInternalCategory = false, printHeader = true; > for (int i = 0, length = fields.length; i < length; i++) { > Field field = fields[i]; >@@ -1093,13 +1116,17 @@ > expectedProblemAttributes.put("HierarchyHasProblems", SKIP); > expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", SKIP); > expectedProblemAttributes.put("IllegalAccessFromTypeVariable", SKIP); >+ expectedProblemAttributes.put("IllegalBinaryLiteral", SKIP); > expectedProblemAttributes.put("IllegalCast", SKIP); > expectedProblemAttributes.put("IllegalClassLiteralForTypeVariable", SKIP); >+ expectedProblemAttributes.put("IllegalDangerousCharacter", SKIP); > expectedProblemAttributes.put("IllegalDimension", SKIP); > expectedProblemAttributes.put("IllegalEnclosingInstanceSpecification", SKIP); >+ expectedProblemAttributes.put("IllegalExoticIdentifier", SKIP); > expectedProblemAttributes.put("IllegalExtendedDimensions", SKIP); > expectedProblemAttributes.put("IllegalExtendedDimensionsForVarArgs", SKIP); > expectedProblemAttributes.put("IllegalGenericArray", SKIP); >+ expectedProblemAttributes.put("IllegalHexaLiteral", SKIP); > expectedProblemAttributes.put("IllegalInstanceofParameterizedType", SKIP); > expectedProblemAttributes.put("IllegalInstanceofTypeParameter", SKIP); > expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", SKIP); >@@ -1130,7 +1157,10 @@ > expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", SKIP); > expectedProblemAttributes.put("IllegalStaticModifierForMemberType", SKIP); > expectedProblemAttributes.put("IllegalTypeVariableSuperReference", SKIP); >+ expectedProblemAttributes.put("IllegalUnderscorePosition", SKIP); > expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", SKIP); >+ expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", SKIP); >+ expectedProblemAttributes.put("IllegalUsageOfUnderscore", SKIP); > expectedProblemAttributes.put("IllegalVararg", SKIP); > expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", SKIP); > expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", SKIP); >@@ -1174,12 +1204,14 @@ > expectedProblemAttributes.put("InterfaceNotVisible", SKIP); > expectedProblemAttributes.put("InternalTypeNameProvided", SKIP); > expectedProblemAttributes.put("InvalidAnnotationMemberType", SKIP); >+ expectedProblemAttributes.put("InvalidBinary", SKIP); > expectedProblemAttributes.put("InvalidBreak", SKIP); > expectedProblemAttributes.put("InvalidCatchBlockSequence", SKIP); > expectedProblemAttributes.put("InvalidCharacterConstant", SKIP); > expectedProblemAttributes.put("InvalidClassInstantiation", SKIP); > expectedProblemAttributes.put("InvalidContinue", SKIP); > expectedProblemAttributes.put("InvalidDigit", SKIP); >+ expectedProblemAttributes.put("InvalidEmptyExoticIdentifier", SKIP); > expectedProblemAttributes.put("InvalidEncoding", SKIP); > expectedProblemAttributes.put("InvalidEscape", SKIP); > expectedProblemAttributes.put("InvalidExplicitConstructorCall", SKIP); >@@ -1190,6 +1222,7 @@ > expectedProblemAttributes.put("InvalidHighSurrogate", SKIP); > expectedProblemAttributes.put("InvalidInput", SKIP); > expectedProblemAttributes.put("InvalidLowSurrogate", SKIP); >+ expectedProblemAttributes.put("InvalidLocationForModifiers", SKIP); > expectedProblemAttributes.put("InvalidNullToSynchronized", SKIP); > expectedProblemAttributes.put("InvalidOctal", SKIP); > expectedProblemAttributes.put("InvalidOperator", SKIP); >@@ -1207,7 +1240,9 @@ > expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP); > expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP); > expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP); >+ expectedProblemAttributes.put("InvalidUsageOfReceiverAnnotations", SKIP); > expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP); >+ expectedProblemAttributes.put("InvalidUsageOfTypeAnnotations", SKIP); > expectedProblemAttributes.put("InvalidUsageOfTypeArguments", SKIP); > expectedProblemAttributes.put("InvalidUsageOfTypeParameters", SKIP); > expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", SKIP); >@@ -1302,6 +1337,7 @@ > expectedProblemAttributes.put("MethodRequiresBody", SKIP); > expectedProblemAttributes.put("MethodReturnsVoid", SKIP); > expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST)); >+ expectedProblemAttributes.put("MisplacedTypeAnnotations", SKIP); > expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", SKIP); > expectedProblemAttributes.put("MissingEnclosingInstance", SKIP); > expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", SKIP); >@@ -1478,6 +1514,7 @@ > expectedProblemAttributes.put("UnsafeReturnTypeOverride", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION)); > expectedProblemAttributes.put("UnsafeTypeConversion", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION)); > expectedProblemAttributes.put("UnterminatedComment", SKIP); >+ expectedProblemAttributes.put("UnterminatedExoticIdentifier", SKIP); > expectedProblemAttributes.put("UnterminatedString", SKIP); > expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING)); > expectedProblemAttributes.put("UnusedImport", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_IMPORT)); >@@ -1516,6 +1553,13 @@ > fields = IProblem.class.getFields(); > StringBuffer failures = new StringBuffer(); > StringBuffer correctResult = new StringBuffer(70000); >+ Arrays.sort(fields, new Comparator() { >+ public int compare(Object o1, Object o2) { >+ Field field1 = (Field) o1; >+ Field field2 = (Field) o2; >+ return field1.getName().compareTo(field2.getName()); >+ } >+ }); > for (int i = 0, length = fields.length; i < length; i++) { > Field field = fields[i]; > if (field.getType() == Integer.TYPE) { >Index: src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java >diff -N src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,923 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.regression; >+ >+import junit.framework.Test; >+ >+public class NegativeTypeAnnotationTest extends AbstractRegressionTest { >+ >+ static { >+// TESTS_NUMBERS = new int [] { 35 }; >+ } >+ public static Class testClass() { >+ return NegativeTypeAnnotationTest.class; >+ } >+ public static Test suite() { >+ return buildMinimalComplianceTestSuite(testClass(), F_1_7); >+ } >+ public NegativeTypeAnnotationTest(String testName){ >+ super(testName); >+ } >+ public void test001() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends @Marker2 Object {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X extends @Marker2 Object {}\n" + >+ " ^^^^^^^\n" + >+ "Marker2 cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test002() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.io.Serializable;\n" + >+ "public class X implements @Marker2 Serializable {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " public class X implements @Marker2 Serializable {\n" + >+ " ^^^^^^^\n" + >+ "Marker2 cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test003() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends @Marker Object {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X extends @Marker Object {}\n" + >+ " ^^^^^^\n" + >+ "Marker cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test004() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<@Marker T> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X<@Marker T> {}\n" + >+ " ^^^^^^\n" + >+ "Marker cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test005() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<@Marker T> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X<@Marker T> {}\n" + >+ " ^^^^^^\n" + >+ "Marker cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test006() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Y.java", >+ "class Y {}\n", >+ "X.java", >+ "public class X extends @A(id=\"Hello, World!\") @B @C('(') Y {\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 1)\n" + >+ " public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test007() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "I.java", >+ "interface I {}\n", >+ "J.java", >+ "interface J {}\n", >+ "X.java", >+ "public class X implements @A(id=\"Hello, World!\") I, @B @C('(') J {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 1)\n" + >+ " public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // class literal >+ public void test008() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "I.java", >+ "interface I {}\n", >+ "J.java", >+ "interface J {}\n", >+ "X.java", >+ "public class X {\n" + >+ " public boolean foo(String s) {\n" + >+ " return (s instanceof @C('_') Object);\n" + >+ " }\n" + >+ " public Object foo1(String s) {\n" + >+ " return new @B(3) @A(\"new Object\") Object();\n" + >+ " }\n" + >+ " public Class<?> foo2(String s) {\n" + >+ " return @B(4) Object.class;\n" + >+ " }\n" + >+ " public Class<?> foo3(String s) {\n" + >+ " return @A(\"int class literal\") @B(5) int.class;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " return (s instanceof @C(\'_\') Object);\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 6)\n" + >+ " return new @B(3) @A(\"new Object\") Object();\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 6)\n" + >+ " return new @B(3) @A(\"new Object\") Object();\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 9)\n" + >+ " return @B(4) Object.class;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 12)\n" + >+ " return @A(\"int class literal\") @B(5) int.class;\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 12)\n" + >+ " return @A(\"int class literal\") @B(5) int.class;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // class literal generic and array >+ public void test009() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "I.java", >+ "interface I {}\n", >+ "J.java", >+ "interface J {}\n", >+ "X.java", >+ "public class X {\n" + >+ " public boolean foo(Object o) {\n" + >+ " return (o instanceof @C('_') Object[]);\n" + >+ " }\n" + >+ " public Object foo1(String s) {\n" + >+ " return new @B(3) @A(\"new Object\") Object[] {};\n" + >+ " }\n" + >+ " public Class<?> foo2(String s) {\n" + >+ " return @B(4) Object[].class;\n" + >+ " }\n" + >+ " public Class<?> foo3(String s) {\n" + >+ " return @A(\"int class literal\") @B(5) int[].class;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " return (o instanceof @C(\'_\') Object[]);\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 6)\n" + >+ " return new @B(3) @A(\"new Object\") Object[] {};\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 6)\n" + >+ " return new @B(3) @A(\"new Object\") Object[] {};\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 9)\n" + >+ " return @B(4) Object[].class;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 12)\n" + >+ " return @A(\"int class literal\") @B(5) int[].class;\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 12)\n" + >+ " return @A(\"int class literal\") @B(5) int[].class;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test010() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Y.java", >+ "class Y<T> {}\n", >+ "X.java", >+ "public class X extends @A(\"Hello, World!\") Y<@B @C('(') String> {\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 1)\n" + >+ " public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test011() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "I.java", >+ "interface I<T> {}\n", >+ "J.java", >+ "interface J<T> {}\n", >+ "X.java", >+ "public class X implements I<@A(\"Hello, World!\") String>, @B J<@C('(') Integer> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X implements I<@A(\"Hello, World!\") String>, @B J<@C(\'(\') Integer> {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X implements I<@A(\"Hello, World!\") String>, @B J<@C(\'(\') Integer> {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 1)\n" + >+ " public class X implements I<@A(\"Hello, World!\") String>, @B J<@C(\'(\') Integer> {}\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // throws >+ public void test012() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "E.java", >+ "class E extends RuntimeException {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}\n", >+ "E1.java", >+ "class E1 extends RuntimeException {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}\n", >+ "E2.java", >+ "class E2 extends RuntimeException {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}\n", >+ "X.java", >+ "public class X {\n" + >+ " void foo() throws @A(\"Hello, World!\") E, E1, @B @C('(') E2 {}\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 2)\n" + >+ " void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 2)\n" + >+ " void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // method receiver >+ public void test013() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " void foo() @B(3) {}\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " void foo() @B(3) {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // method return type >+ public void test014() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " @B(3) int foo() {\n" + >+ " return 1;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " @B(3) int foo() {\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // field type >+ public void test015() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " @B(3) int field;\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " @B(3) int field;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // method parameter >+ public void test016() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " int foo(@B(3) String s) {\n" + >+ " return s.length();\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " int foo(@B(3) String s) {\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // method parameter generic or array >+ public void test017() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " int foo(String @B(3) [] s) {\n" + >+ " return s.length;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " int foo(String @B(3) [] s) {\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // field type generic or array >+ public void test018() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " int @B(3) [] field;\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " int @B(3) [] field;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // class type parameter >+ public void test019() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<@A @B(3) T> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X<@A @B(3) T> {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X<@A @B(3) T> {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // method type parameter >+ public void test020() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " <@A @B(3) T> void foo(T t) {}\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " <@A @B(3) T> void foo(T t) {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 2)\n" + >+ " <@A @B(3) T> void foo(T t) {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // class type parameter bound >+ public void test021() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Z.java", >+ "public class Z {}", >+ "X.java", >+ "public class X<T extends @A Z & @B(3) Cloneable> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X<T extends @A Z & @B(3) Cloneable> {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X<T extends @A Z & @B(3) Cloneable> {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // class type parameter bound generic or array >+ public void test022() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Y.java", >+ "public class Y<T> {}", >+ "X.java", >+ "public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 1)\n" + >+ " public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 1)\n" + >+ " public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 1)\n" + >+ " public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // method type parameter bound >+ public void test023() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Z.java", >+ "public class Z {}", >+ "X.java", >+ "public class X {\n" + >+ " <T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " <T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 2)\n" + >+ " <T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // class type parameter bound generic or array >+ public void test024() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Z.java", >+ "public class Z {}", >+ "Y.java", >+ "public class Y<T> {}", >+ "X.java", >+ "public class X {\n" + >+ " <T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " <T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 2)\n" + >+ " <T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 2)\n" + >+ " <T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 2)\n" + >+ " <T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // local variable + generic or array >+ public void test025() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " void foo(String s) {\n" + >+ " @C int i;\n" + >+ " @A String [] @B(3)[] tab = new String[][] {};\n" + >+ " if (tab != null) {\n" + >+ " i = 0;\n" + >+ " System.out.println(i + tab.length);\n" + >+ " } else {\n" + >+ " System.out.println(tab.length);\n" + >+ " }\n" + >+ " i = 4;\n" + >+ " System.out.println(-i + tab.length);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " @C int i;\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " @A String [] @B(3)[] tab = new String[][] {};\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 4)\n" + >+ " @A String [] @B(3)[] tab = new String[][] {};\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // type argument constructor call >+ public void test026() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " <T> X(T t) {\n" + >+ " }\n" + >+ " public Object foo() {\n" + >+ " X x = new <@A @B(1) String>X(null);\n" + >+ " return x;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " X x = new <@A @B(1) String>X(null);\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " X x = new <@A @B(1) String>X(null);\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // type argument constructor call generic or array >+ public void test027() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " <T> X(T t) {\n" + >+ " }\n" + >+ " public Object foo() {\n" + >+ " X x = new <@A @B(1) String>X(null);\n" + >+ " return x;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " X x = new <@A @B(1) String>X(null);\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " X x = new <@A @B(1) String>X(null);\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // type argument method call and generic or array >+ public void test028() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ "\n" + >+ " static <T, U> T foo(T t, U u) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " System.out.println(X.<@A @B(1) String[], @C('-') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + >+ " }\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 7)\n" + >+ " System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test029() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends @Marker2 Object {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X extends @Marker2 Object {}\n" + >+ " ^^^^^^^\n" + >+ "Marker2 cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test030() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.io.Serializable;\n" + >+ "public class X implements @Marker2 Serializable {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " public class X implements @Marker2 Serializable {\n" + >+ " ^^^^^^^\n" + >+ "Marker2 cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void test031() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Marker.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@interface Marker {}", >+ "X.java", >+ "public class X<@Marker T> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X<@Marker T> {}\n" + >+ " ^^^^^^^\n" + >+ "The annotation @Marker is disallowed for this location\n" + >+ "----------\n"); >+ } >+ public void test032() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Marker.java", >+ "@interface Marker {}", >+ "X.java", >+ "public class X<@Marker T> {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X<@Marker T> {}\n" + >+ " ^^^^^^^\n" + >+ "The annotation @Marker is disallowed for this location\n" + >+ "----------\n"); >+ } >+ public void test033() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Marker.java", >+ "@interface Marker {}", >+ "Y.java", >+ "public class Y {}", >+ "X.java", >+ "public class X extends @Marker Y {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X extends @Marker Y {}\n" + >+ " ^^^^^^^\n" + >+ "The annotation @Marker is disallowed for this location\n" + >+ "----------\n"); >+ } >+ // check locations >+ public void test034() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.util.Map;\n" + >+ "import java.util.List;\n" + >+ "public class X {\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "H cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "E cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 4)\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "F cannot be resolved to a type\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 4)\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "G cannot be resolved to a type\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 5)\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 5)\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "7. ERROR in X.java (at line 5)\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "8. ERROR in X.java (at line 5)\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " ^\n" + >+ "D cannot be resolved to a type\n" + >+ "----------\n" + >+ "9. ERROR in X.java (at line 6)\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ " ^\n" + >+ "A cannot be resolved to a type\n" + >+ "----------\n" + >+ "10. ERROR in X.java (at line 6)\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "11. ERROR in X.java (at line 6)\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ " ^\n" + >+ "H cannot be resolved to a type\n" + >+ "----------\n" + >+ "12. ERROR in X.java (at line 6)\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ " ^\n" + >+ "E cannot be resolved to a type\n" + >+ "----------\n" + >+ "13. ERROR in X.java (at line 6)\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ " ^\n" + >+ "F cannot be resolved to a type\n" + >+ "----------\n" + >+ "14. ERROR in X.java (at line 6)\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ " ^\n" + >+ "G cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ // check locations >+ public void test035() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.util.Map;\n" + >+ "import java.util.List;\n" + >+ "public class X {\n" + >+ " @H java.lang.String @E[] @F[] @G[] field;\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " @H java.lang.String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "H cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " @H java.lang.String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "E cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 4)\n" + >+ " @H java.lang.String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "F cannot be resolved to a type\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 4)\n" + >+ " @H java.lang.String @E[] @F[] @G[] field;\n" + >+ " ^\n" + >+ "G cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+} >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java,v >retrieving revision 1.35 >diff -u -r1.35 ScannerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java 15 Nov 2010 16:22:29 -0000 1.35 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java 20 Jan 2011 21:55:50 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -31,7 +31,7 @@ > // All specified tests which does not belong to the class are skipped... > static { > // TESTS_NAMES = new String[] { "test000" }; >-// TESTS_NUMBERS = new int[] { 53 }; >+// TESTS_NUMBERS = new int[] { 9 }; > // TESTS_RANGE = new int[] { 11, -1 }; > } > >@@ -196,10 +196,10 @@ > while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) { > counter++; > } >- } catch (InvalidInputException e) { > assertTrue(false); >+ } catch (InvalidInputException e) { > } >- assertEquals("Wrong number of tokens", 5, counter); >+ assertEquals("Wrong number of tokens", 0, counter); > } > > /* >@@ -269,7 +269,7 @@ > scanner.resetTo(0, source.length - 1); > try { > while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) { >- // ignore >+ // do nothing > } > } catch (InvalidInputException e) { > assertTrue(true); >@@ -288,7 +288,7 @@ > scanner.resetTo(0, source.length - 1); > try { > while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) { >- // ignore >+ // do nothing > } > } catch (InvalidInputException e) { > assertTrue(true); >@@ -383,7 +383,7 @@ > scanner.resetTo(0, source.length - 1); > try { > while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) { >- // ignore >+ // do nothing > } > } catch (InvalidInputException e) { > assertTrue(true); >@@ -402,7 +402,7 @@ > scanner.resetTo(0, source.length - 1); > try { > while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) { >- // ignore >+ // do nothing > } > } catch (InvalidInputException e) { > assertTrue(true); >@@ -1105,26 +1105,136 @@ > assertEquals("Wrong source", "\"a co\\", new String(scanner.getCurrentTokenSource())); > } > } >- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=294529 >- public void test052() { >+ // Exotic identifier >+ public void test053() { > IScanner scanner = ToolFactory.createScanner( > true, > true, > true, >- JavaCore.getOption(JavaCore.COMPILER_SOURCE), >- JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE)); >- final char[] source = "\"\\u00E9mment, longer\\n than the\\noffset \"".toCharArray(); >+ "1.5", >+ "1.7"); >+ final char[] source = "#\"this is an exotic identifier\"".toCharArray(); > scanner.setSource(source); >- scanner.resetTo(0, 5); > try { >- assertEquals("Wrong token", ITerminalSymbols.TokenNameStringLiteral, scanner.getNextToken()); >- assertTrue("Should fail with InvalidInputException", false); >+ assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken()); >+ } catch (InvalidInputException e) { >+ assertTrue("Should not happen", false); >+ } >+ } >+ // Exotic identifier >+ public void test054() { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ "1.7", >+ "1.7"); >+ final char[] source = "#\"\"".toCharArray(); >+ scanner.setSource(source); >+ try { >+ scanner.getNextToken(); >+ assertTrue("Should not happen", false); >+ } catch (InvalidInputException e) { >+ } >+ } >+ // Exotic identifier >+ public void test055() { >+ char[] dangerousCharacters = new char[] {'/', '.', ';', '<', '>', '[', ']'}; >+ for (int i = 0, max = dangerousCharacters.length; i < max; i++) { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ "1.7", >+ "1.7"); >+ final char[] source = ("#\""+ dangerousCharacters[i] + "\"").toCharArray(); >+ scanner.setSource(source); >+ try { >+ scanner.getNextToken(); >+ assertTrue("Should not happen", false); >+ } catch (InvalidInputException e) { >+ } >+ } >+ } >+ // Exotic identifier >+ public void test056() { >+ char[] dangerousCharacters = new char[] {'/', '.', ';', '<', '>', '[', ']'}; >+ for (int i = 0, max = dangerousCharacters.length; i < max; i++) { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ "1.7", >+ "1.7"); >+ final char[] source = ("#\"\\"+ dangerousCharacters[i] + "\"").toCharArray(); >+ scanner.setSource(source); >+ try { >+ assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken()); >+ assertEquals("Wrong contents", "#\"" + dangerousCharacters[i] + "\"", new String(scanner.getCurrentTokenSource())); >+ assertEquals("Wrong contents", "#\"\\" + dangerousCharacters[i] + "\"", new String(scanner.getRawTokenSource())); >+ } catch (InvalidInputException e) { >+ assertTrue("Should not happen", false); >+ } >+ } >+ } >+ // Exotic identifier >+ public void test057() { >+ char[] exoticEscapeCharacters = new char[] {'!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', ':', '?', >+ '@', '^', '_', '`', '{', '|', '}', '~'}; >+ for (int i = 0, max = exoticEscapeCharacters.length; i < max; i++) { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ "1.7", >+ "1.7"); >+ final char[] source = ("#\"\\"+ exoticEscapeCharacters[i] + "\"").toCharArray(); >+ scanner.setSource(source); >+ try { >+ assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken()); >+ assertEquals("Wrong contents", "#\"\\" + exoticEscapeCharacters[i] + "\"", new String(scanner.getCurrentTokenSource())); >+ assertEquals("Wrong contents", "#\"\\" + exoticEscapeCharacters[i] + "\"", new String(scanner.getRawTokenSource())); >+ } catch (InvalidInputException e) { >+ assertTrue("Should not happen", false); >+ } >+ } >+ } >+ // Exotic identifier >+ public void test058() { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ "1.5", >+ "1.6"); >+ final char[] source = "#\"this is an exotic identifier\"".toCharArray(); >+ scanner.setSource(source); >+ try { >+ scanner.getNextToken(); >+ assertTrue("Should not happen", false); > } catch (InvalidInputException e) { >- assertEquals("Wrong source", "\"\\u00E", new String(scanner.getCurrentTokenSource())); >+ } >+ } >+ // Exotic identifier >+ public void test059() { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ "1.5", >+ "1.7"); >+ final char[] source = "#\"this \\u0037\"".toCharArray(); >+ scanner.setSource(source); >+ try { >+ assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken()); >+ assertEquals("Wrong contents", "#\"this 7\"", new String(scanner.getCurrentTokenSource())); >+ assertEquals("Wrong contents", "#\"this \\u0037\"", new String(scanner.getRawTokenSource())); >+ } catch (InvalidInputException e) { >+ assertTrue("Should not happen", false); > } > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330081 >- public void test053() { >+ public void test060() { > IScanner scanner = ToolFactory.createScanner( > true, > true, >Index: src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java,v >retrieving revision 1.27 >diff -u -r1.27 SwitchTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java 18 Jun 2010 16:28:26 -0000 1.27 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java 20 Jan 2011 21:55:50 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2010 IBM Corporation and others. >+ * Copyright (c) 2005, 2011 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 >@@ -25,6 +25,9 @@ > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > > public class SwitchTest extends AbstractRegressionTest { >+ >+ private static final long JDKLevelSupportingStringSwitch = ClassFileConstants.JDK1_7; >+ > static { > // TESTS_NUMBERS = new int[] { 22 }; > } >@@ -829,6 +832,1178 @@ > }, > "SUCCESS"); > } >+ >+// JDK7: Strings in Switch. >+public void testStringSwitchAtJDK6() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " default: return args;\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Void methods cannot return a value\n" + >+ "----------\n"; >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " default: return args;\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Void methods cannot return a value\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String [] args) {\n" + >+ " switch(args[0]) {\n" + >+ " default: return args;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+ >+//JDK7: Strings in Switch. >+public void testCaseTypeMismatch() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " case 123: break;\n" + >+ " ^^^\n" + >+ "Type mismatch: cannot convert from int to String\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " case (byte) 1: break;\n" + >+ " ^^^^^^^^\n" + >+ "Type mismatch: cannot convert from byte to String\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 6)\n" + >+ " case (char) 2: break;\n" + >+ " ^^^^^^^^\n" + >+ "Type mismatch: cannot convert from char to String\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 7)\n" + >+ " case (short)3: break;\n" + >+ " ^^^^^^^^\n" + >+ "Type mismatch: cannot convert from short to String\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 8)\n" + >+ " case (int) 4: break;\n" + >+ " ^^^^^^^\n" + >+ "Type mismatch: cannot convert from int to String\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 9)\n" + >+ " case (long) 5: break;\n" + >+ " ^^^^^^^^\n" + >+ "Type mismatch: cannot convert from long to String\n" + >+ "----------\n" + >+ "7. ERROR in X.java (at line 10)\n" + >+ " case (float) 6: break;\n" + >+ " ^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from float to String\n" + >+ "----------\n" + >+ "8. ERROR in X.java (at line 11)\n" + >+ " case (double) 7: break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from double to String\n" + >+ "----------\n" + >+ "9. ERROR in X.java (at line 12)\n" + >+ " case (boolean) 8: break;\n" + >+ " ^^^^^^^^^^^\n" + >+ "Cannot cast from int to boolean\n" + >+ "----------\n" + >+ "10. ERROR in X.java (at line 12)\n" + >+ " case (boolean) 8: break;\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from boolean to String\n" + >+ "----------\n"; >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 12)\n" + >+ " case (boolean) 8: break;\n" + >+ " ^^^^^^^^^^^\n" + >+ "Cannot cast from int to boolean\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String [] args) {\n" + >+ " switch(args[0]) {\n" + >+ " case 123: break;\n" + >+ " case (byte) 1: break;\n" + >+ " case (char) 2: break;\n" + >+ " case (short)3: break;\n" + >+ " case (int) 4: break;\n" + >+ " case (long) 5: break;\n" + >+ " case (float) 6: break;\n" + >+ " case (double) 7: break;\n" + >+ " case (boolean) 8: break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+// JDK7: Strings in Switch. >+public void testCaseTypeMismatch2() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) { >+ return; >+ } >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " case Days.Sunday: break;\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Days to String\n" + >+ "----------\n"; >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " switch (\"Sunday\") {\n" + >+ " ^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "enum Days { Sunday, Monday, Tuesday, Wednesday, Thuresday, Friday, Satuday };\n" + >+ "\n" + >+ "public class X {\n" + >+ "\n" + >+ " public static void main(String argv[]) {\n" + >+ " switch (\"Sunday\") {\n" + >+ " case Days.Sunday: break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+// JDK7: Strings in Switch. >+public void testCaseTypeMismatch3() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) { >+ return; >+ } >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " case \"0\": break;\n" + >+ " ^^^\n" + >+ "Type mismatch: cannot convert from String to int\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 10)\n" + >+ " case \"Sunday\": break;\n" + >+ " ^^^^^^^^\n" + >+ "Type mismatch: cannot convert from String to Days\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 13)\n" + >+ " case \"0\": break;\n" + >+ " ^^^\n" + >+ "Type mismatch: cannot convert from String to Integer\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "enum Days { Sunday, Monday, Tuesday, Wednesday, Thuresday, Friday, Satuday };\n" + >+ "\n" + >+ "public class X {\n" + >+ "\n" + >+ " public static void main(String argv[]) {\n" + >+ " switch (argv.length) {\n" + >+ " case \"0\": break;\n" + >+ " }\n" + >+ " switch(Days.Sunday) {\n" + >+ " case \"Sunday\": break;\n" + >+ " }\n" + >+ " switch (new Integer(argv.length)) {\n" + >+ " case \"0\": break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }, >+ newMessage); >+} >+// JDK7: Strings in Switch. >+public void testDuplicateCase() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " case \"123\": break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " case \"123\": break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 6)\n" + >+ " default: return args;\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Void methods cannot return a value\n" + >+ "----------\n"; >+ >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 6)\n" + >+ " default: return args;\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Void methods cannot return a value\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String [] args) {\n" + >+ " switch(args[0]) {\n" + >+ " case \"123\": break;\n" + >+ " case \"123\": break;\n" + >+ " default: return args;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+ >+// JDK7: Strings in Switch. >+public void testDuplicateCase2() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 9)\n" + >+ " case \"123\": break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 10)\n" + >+ " case \"123\": break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 11)\n" + >+ " case \"1\" + \"2\" + \"3\": break;\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 13)\n" + >+ " case local: break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 14)\n" + >+ " case field: break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 15)\n" + >+ " case ifield: break;\n" + >+ " ^^^^^^\n" + >+ "Cannot make a static reference to the non-static field ifield\n" + >+ "----------\n" + >+ "7. ERROR in X.java (at line 16)\n" + >+ " case inffield: break;\n" + >+ " ^^^^^^^^\n" + >+ "Cannot make a static reference to the non-static field inffield\n" + >+ "----------\n" + >+ "8. ERROR in X.java (at line 19)\n" + >+ " default: break;\n" + >+ " ^^^^^^^\n" + >+ "The default case is already defined\n" + >+ "----------\n"; >+ >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 15)\n" + >+ " case ifield: break;\n" + >+ " ^^^^^^\n" + >+ "Cannot make a static reference to the non-static field ifield\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 16)\n" + >+ " case inffield: break;\n" + >+ " ^^^^^^^^\n" + >+ "Cannot make a static reference to the non-static field inffield\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 19)\n" + >+ " default: break;\n" + >+ " ^^^^^^^\n" + >+ "The default case is already defined\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " static final String field = \"123\";\n" + >+ " final String ifield = \"123\";\n" + >+ " String inffield = \"123\";\n" + >+ " static String nffield = \"123\";\n" + >+ " public static void main(String [] args, final String argument) {\n" + >+ " final String local = \"123\";\n" + >+ " switch(args[0]) {\n" + >+ " case \"123\": break;\n" + >+ " case \"\u0031\u0032\u0033\": break;\n" + >+ " case \"1\" + \"2\" + \"3\": break;\n" + >+ " default: break;\n" + >+ " case local: break;\n" + >+ " case field: break;\n" + >+ " case ifield: break;\n" + >+ " case inffield: break;\n" + >+ " case nffield: break;\n" + >+ " case argument: break;\n" + >+ " default: break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+// JDK7: Strings in Switch. >+public void testVariableCase() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " case local: break;\n" + >+ " ^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 8)\n" + >+ " case argument: break;\n" + >+ " ^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 9)\n" + >+ " case inffield: break;\n" + >+ " ^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 10)\n" + >+ " case nffield: break;\n" + >+ " ^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 11)\n" + >+ " case argument: break;\n" + >+ " ^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n"; >+ >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " String inffield = \"123\";\n" + >+ " static String nffield = \"123\";\n" + >+ " public void main(String [] args, final String argument) {\n" + >+ " String local = \"123\";\n" + >+ " switch(args[0]) {\n" + >+ " case local: break;\n" + >+ " case argument: break;\n" + >+ " case inffield: break;\n" + >+ " case nffield: break;\n" + >+ " case argument: break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+// JDK7: Strings in Switch. >+public void testVariableCaseFinal() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\n" + >+ " case argument: break;\n" + >+ " ^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 11)\n" + >+ " case argument: break;\n" + >+ " ^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n"; >+ >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " final String inffield = \"12312\";\n" + >+ " final static String nffield = \"123123\";\n" + >+ " public void main(String [] args, final String argument) {\n" + >+ " final String local = \"1233\";\n" + >+ " switch(args[0]) {\n" + >+ " case local: break;\n" + >+ " case argument: break;\n" + >+ " case inffield: break;\n" + >+ " case nffield: break;\n" + >+ " case argument: break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+//JDK7: Strings in Switch. >+public void testNullCase() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " case local: break;\n" + >+ " ^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 8)\n" + >+ " case argument: break;\n" + >+ " ^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 9)\n" + >+ " case inffield: break;\n" + >+ " ^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 10)\n" + >+ " case nffield: break;\n" + >+ " ^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 11)\n" + >+ " case (String) null: break;\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 12)\n" + >+ " case true ? (String) null : (String) null : break;\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "case expressions must be constant expressions\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 12)\n" + >+ " case true ? (String) null : (String) null : break;\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Dead code\n" + >+ "----------\n"; >+ >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " final String inffield = null;\n" + >+ " final static String nffield = null;\n" + >+ " public void main(String [] args, final String argument) {\n" + >+ " final String local = null;\n" + >+ " switch(args[0]) {\n" + >+ " case local: break;\n" + >+ " case argument: break;\n" + >+ " case inffield: break;\n" + >+ " case nffield: break;\n" + >+ " case (String) null: break;\n" + >+ " case true ? (String) null : (String) null : break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+// JDK7: Strings in Switch. >+public void testDuplicateCase3() { >+ String newMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 9)\n" + >+ " case \"123\": break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 10)\n" + >+ " case \"1\" + \"2\" + \"3\": break;\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 12)\n" + >+ " case local: break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 13)\n" + >+ " case field: break;\n" + >+ " ^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 14)\n" + >+ " case ifield: break;\n" + >+ " ^^^^^^^^^^^\n" + >+ "Duplicate case\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 18)\n" + >+ " default: break;\n" + >+ " ^^^^^^^\n" + >+ "The default case is already defined\n" + >+ "----------\n"; >+ >+ String oldMessage = >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\n" + >+ " switch(args[0]) {\n" + >+ " ^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 18)\n" + >+ " default: break;\n" + >+ " ^^^^^^^\n" + >+ "The default case is already defined\n" + >+ "----------\n"; >+ >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " static final String field = \"123\";\n" + >+ " final String ifield = \"123\";\n" + >+ " String inffield = \"123\";\n" + >+ " static String nffield = \"123\";\n" + >+ " public void main(String [] args, final String argument) {\n" + >+ " final String local = \"123\";\n" + >+ " switch(args[0]) {\n" + >+ " case \"123\": break;\n" + >+ " case \"1\" + \"2\" + \"3\": break;\n" + >+ " default: break;\n" + >+ " case local: break;\n" + >+ " case field: break;\n" + >+ " case ifield: break;\n" + >+ " case inffield: break;\n" + >+ " case nffield: break;\n" + >+ " case argument: break;\n" + >+ " default: break;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ }, >+ this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage); >+} >+ >+public void testDuplicateHashCode() { >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testDuplicateHashCode.java (at line 5)\n" + >+ " switch (dispatcher) {\n" + >+ " ^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testDuplicateHashCode.java", >+ "public class testDuplicateHashCode {\n" + >+ " public static void main(String[] argv) {\n" + >+ " String dispatcher = \"\u0000\";\n" + >+ " for (int i = 0; i < 100; i++) {\n" + >+ " switch (dispatcher) {\n" + >+ " case \"\u0000\":\n" + >+ " System.out.print(\"1 \");\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\":\n" + >+ " System.out.print(\"2 \");\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"3 \");\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"4 \");\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"5 \");\n" + >+ " break;\n" + >+ " default:\n" + >+ " System.out.println(\"Default\");\n" + >+ " System.exit(0);\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"8 \");\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"7 \");\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"6 \");\n" + >+ " break;\n" + >+ " }\n" + >+ " dispatcher += \"\u0000\";\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "1 2 3 4 5 6 7 8 Default"); >+ } >+} >+public void testDuplicateHashCode2() { >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testDuplicateHashCode.java (at line 5)\n" + >+ " switch (dispatcher) {\n" + >+ " ^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testDuplicateHashCode.java", >+ "public class testDuplicateHashCode {\n" + >+ " public static void main(String[] argv) {\n" + >+ " String dispatcher = \"\u0000\";\n" + >+ " while(true) {\n" + >+ " switch (dispatcher) {\n" + >+ " case \"\u0000\":\n" + >+ " System.out.print(\"1 \");\n" + >+ " dispatcher += \"\u0000\u0000\";\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\":\n" + >+ " System.out.print(\"2 \");\n" + >+ " dispatcher = \"\";\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"3 \");\n" + >+ " dispatcher += \"\u0000\u0000\";\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"4 \");\n" + >+ " dispatcher = \"\u0000\u0000\";\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"5 \");\n" + >+ " dispatcher += \"\u0000\u0000\";\n" + >+ " break;\n" + >+ " default:\n" + >+ " System.out.println(\"Default\");\n" + >+ " System.exit(0);\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"8 \");\n" + >+ " dispatcher = \"\u0000\u0000\u0000\u0000\u0000\u0000\";\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"7 \");\n" + >+ " dispatcher += \"\u0000\";\n" + >+ " break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\u0000\":\n" + >+ " System.out.print(\"6 \");\n" + >+ " dispatcher = \"\u0000\u0000\u0000\u0000\";\n" + >+ " break;\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "1 3 5 7 8 6 4 2 Default"); >+ } >+} >+public void testSwitchOnNull() { >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testSwitchOnNull.java (at line 13)\n" + >+ " switch (s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in testSwitchOnNull.java (at line 23)\n" + >+ " switch ((String) null) {\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "3. ERROR in testSwitchOnNull.java (at line 33)\n" + >+ " switch (someMethod()) {\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "4. ERROR in testSwitchOnNull.java (at line 40)\n" + >+ " switch (nullString) {\n" + >+ " ^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "5. ERROR in testSwitchOnNull.java (at line 47)\n" + >+ " switch (someMethod()) {\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testSwitchOnNull.java", >+ "public class testSwitchOnNull {\n" + >+ "\n" + >+ " private static String someMethod() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "\n" + >+ " static String nullString = null;\n" + >+ " public static void main(String [] args) {\n" + >+ "\n" + >+ " String s = null;\n" + >+ "\n" + >+ " try {\n" + >+ " switch (s) {\n" + >+ " default: \n" + >+ " System.out.println(\"OOPS\");\n" + >+ " break;\n" + >+ " }\n" + >+ " System.out.println(\"OOPS\");\n" + >+ " } catch (NullPointerException e) {\n" + >+ " System.out.print(\"NPE1\");\n" + >+ " }\n" + >+ " try {\n" + >+ " switch ((String) null) {\n" + >+ " default: \n" + >+ " System.out.println(\"OOPS\");\n" + >+ " break;\n" + >+ " }\n" + >+ " System.out.println(\"OOPS\");\n" + >+ " } catch (NullPointerException e) {\n" + >+ " System.out.print(\"NPE2\");\n" + >+ " }\n" + >+ " try {\n" + >+ " switch (someMethod()) {\n" + >+ " }\n" + >+ " System.out.println(\"OOPS\");\n" + >+ " } catch (NullPointerException e) {\n" + >+ " System.out.print(\"NPE3\");\n" + >+ " }\n" + >+ " try {\n" + >+ " switch (nullString) {\n" + >+ " }\n" + >+ " System.out.println(\"OOPS\");\n" + >+ " } catch (NullPointerException e) {\n" + >+ " System.out.print(\"NPE4\");\n" + >+ " }\n" + >+ " try {\n" + >+ " switch (someMethod()) {\n" + >+ " default: \n" + >+ " System.out.println(\"OOPS\");\n" + >+ " break;\n" + >+ " }\n" + >+ " System.out.println(\"OOPS\");\n" + >+ " } catch (NullPointerException e) {\n" + >+ " System.out.print(\"NPE5\");\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "NPE1NPE2NPE3NPE4NPE5"); >+ } >+} >+public void testSideEffect() { >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testSideEffect.java (at line 11)\n" + >+ " switch(dispatcher()) {\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testSideEffect.java", >+ "public class testSideEffect {\n" + >+ " static boolean firstTime = true;\n" + >+ " private static String dispatcher() {\n" + >+ " if (!firstTime) {\n" + >+ " System.out.print(\"OOPS\");\n" + >+ " }\n" + >+ " firstTime = false;\n" + >+ " return \"\u0000\";\n" + >+ " }\n" + >+ " public static void main(String [] args) {\n" + >+ " switch(dispatcher()) {\n" + >+ " case \"\u0000\u0000\": break;\n" + >+ " case \"\u0000\u0000\u0000\": break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\": break;\n" + >+ " case \"\u0000\u0000\u0000\u0000\u0000\": break;\n" + >+ " default: System.out.println(\"DONE\");\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "DONE"); >+ } >+} >+public void testFallThrough() { >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testFallThrough.java (at line 11)\n" + >+ " switch(s = dispatcher()) {\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testFallThrough.java", >+ "public class testFallThrough {\n" + >+ " static int index = -1;\n" + >+ " static String string = \"0123456789*\";\n" + >+ " private static String dispatcher() {\n" + >+ " index++;\n" + >+ " return string.substring(index,index + 1);\n" + >+ " }\n" + >+ " public static void main(String [] args) {\n" + >+ " while (true) {\n" + >+ " String s = null;\n" + >+ " switch(s = dispatcher()) {\n" + >+ " case \"2\":\n" + >+ " case \"0\":\n" + >+ " case \"4\":\n" + >+ " case \"8\":\n" + >+ " case \"6\":\n" + >+ " System.out.print(s + \"(even) \");\n" + >+ " break;\n" + >+ " case \"1\":\n" + >+ " case \"3\":\n" + >+ " case \"9\":\n" + >+ " case \"5\":\n" + >+ " case \"7\":\n" + >+ " System.out.print(s + \"(odd) \");\n" + >+ " break;\n" + >+ " default: System.out.print(\"DONE\");\n" + >+ " System.exit(0);\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "0(even) 1(odd) 2(even) 3(odd) 4(even) 5(odd) 6(even) 7(odd) 8(even) 9(odd) DONE"); >+ } >+} >+public void testFallThrough2() { >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testFallThrough.java (at line 11)\n" + >+ " switch(s = dispatcher()) {\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testFallThrough.java", >+ "public class testFallThrough {\n" + >+ " static int index = -1;\n" + >+ " static String string = \"0123456789*\";\n" + >+ " private static String dispatcher() {\n" + >+ " index++;\n" + >+ " return string.substring(index,index + 1);\n" + >+ " }\n" + >+ " public static void main(String [] args) {\n" + >+ " while (true) {\n" + >+ " String s = null;\n" + >+ " switch(s = dispatcher()) {\n" + >+ " case \"4\": System.out.print(s);\n" + >+ " case \"3\": System.out.print(s);\n" + >+ " case \"2\": System.out.print(s);\n" + >+ " case \"1\": System.out.print(s + \" \");\n" + >+ " case \"0\": break;\n" + >+ " default: System.out.print(\"DONE\");\n" + >+ " System.exit(0);\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "1 22 333 4444 DONE"); >+ } >+} >+public void testMarysLamb() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) { >+ return; >+ } >+ >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testMarysLamb.java (at line 4)\n" + >+ " switch(s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testMarysLamb.java", >+ "public class testMarysLamb {\n" + >+ " public static void main(String [] args) {\n" + >+ " for (String s : new String [] { \"Mary\", \"Had\", \"A\", \"Little\", \"Lamb\" }) {\n" + >+ " switch(s) {\n" + >+ " default: System.out.print(s + \" \");\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "Mary Had A Little Lamb"); >+ } >+} >+public void testBreakOut() { >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in testBreakOut.java (at line 5)\n" + >+ " switch(s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "testBreakOut.java", >+ "public class testBreakOut {\n" + >+ " public static void main(String [] args) {\n" + >+ " junk: while (true) {\n" + >+ " String s = \"\";\n" + >+ " switch(s) {\n" + >+ " case \"7\":\n" + >+ " System.out.print(s + \"(odd) \");\n" + >+ " break;\n" + >+ " default: System.out.print(\"DONE\");\n" + >+ " System.exit(0);\n" + >+ " break junk;\n" + >+ " }\n" + >+ " }\n" + >+ " System.out.println(\"Broken\");\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "DONE"); >+ } >+} >+public void testMultipleSwitches() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) { >+ return; >+ } >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " switch (s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 35)\n" + >+ " switch (s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 51)\n" + >+ " switch (s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ "\n" + >+ " public static void main(String[] args) {\n" + >+ " \n" + >+ " for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" + >+ " switch (s) {\n" + >+ " case \"Sunday\" : \n" + >+ " System.out.print(\"Sunday\");\n" + >+ " break;\n" + >+ " case \"Monday\" :\n" + >+ " System.out.print(\"Monday\");\n" + >+ " break;\n" + >+ " case \"Tuesday\" :\n" + >+ " System.out.print(\"Tuesday\");\n" + >+ " break;\n" + >+ " case \"Wednesday\":\n" + >+ " System.out.print(\"Wednesday\");\n" + >+ " break;\n" + >+ " case \"Thursday\":\n" + >+ " System.out.print(\"Thursday\");\n" + >+ " break;\n" + >+ " case \"Friday\":\n" + >+ " System.out.print(\"Friday\");\n" + >+ " break;\n" + >+ " case \"Saturday\":\n" + >+ " System.out.print(\"Saturday\");\n" + >+ " break;\n" + >+ " default:\n" + >+ " System.out.print(\" ---- \");\n" + >+ " break;\n" + >+ " }\n" + >+ " }\n" + >+ " \n" + >+ " for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" + >+ " switch (s) {\n" + >+ " case \"Sunday\" : \n" + >+ " case \"Monday\" :\n" + >+ " case \"Tuesday\" :\n" + >+ " case \"Wednesday\":\n" + >+ " case \"Thursday\":\n" + >+ " case \"Friday\":\n" + >+ " case \"Saturday\":\n" + >+ " System.out.print(s);\n" + >+ " break;\n" + >+ " default:\n" + >+ " System.out.print(\" ---- \");\n" + >+ " break;\n" + >+ " } \n" + >+ " }\n" + >+ " for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" + >+ " switch (s) {\n" + >+ " case \"Saturday\":\n" + >+ " case \"Sunday\" : \n" + >+ " System.out.print(\"Holiday\");\n" + >+ " break;\n" + >+ " case \"Monday\" :\n" + >+ " case \"Tuesday\" :\n" + >+ " case \"Wednesday\":\n" + >+ " case \"Thursday\":\n" + >+ " case \"Friday\":\n" + >+ " System.out.print(\"Workday\");\n" + >+ " break;\n" + >+ " default:\n" + >+ " System.out.print(\" DONE\");\n" + >+ " break;\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "SundayMondayTuesdayWednesdayThursdayFridaySaturday ---- SundayMondayTuesdayWednesdayThursdayFridaySaturday ---- HolidayWorkdayWorkdayWorkdayWorkdayWorkdayHoliday DONE"); >+ } >+} >+public void testNestedSwitches() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) { >+ return; >+ } >+ String errorMsg = >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " switch (s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " switch (s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 18)\n" + >+ " switch (s) {\n" + >+ " ^\n" + >+ "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + >+ "----------\n"; >+ >+ String [] sourceFiles = >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" + >+ " switch (s) {\n" + >+ " case \"Saturday\":\n" + >+ " case \"Sunday\" : \n" + >+ " switch (s) {\n" + >+ " case \"Saturday\" : System.out.println (\"Saturday is a holiday\"); break;\n" + >+ " case \"Sunday\" : System.out.println (\"Sunday is a holiday\"); break;\n" + >+ " default: System.out.println(\"Broken\");\n" + >+ " }\n" + >+ " break;\n" + >+ " case \"Monday\" :\n" + >+ " case \"Tuesday\" :\n" + >+ " case \"Wednesday\":\n" + >+ " case \"Thursday\":\n" + >+ " case \"Friday\":\n" + >+ " switch (s) {\n" + >+ " case \"Monday\" : System.out.println (\"Monday is a workday\"); break;\n" + >+ " case \"Tuesday\" : System.out.println (\"Tuesday is a workday\"); break;\n" + >+ " case \"Wednesday\": System.out.println (\"Wednesday is a workday\"); break;\n" + >+ " case \"Thursday\": System.out.println (\"Thursday is a workday\"); break;\n" + >+ " case \"Friday\":System.out.println (\"Friday is a workday\"); break;\n" + >+ " default: System.out.println(\"Broken\");\n" + >+ " }\n" + >+ " break;\n" + >+ " default:\n" + >+ " System.out.println(\"DONE\");\n" + >+ " break;\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", >+ }; >+ if (this.complianceLevel < JDKLevelSupportingStringSwitch) { >+ this.runNegativeTest(sourceFiles, errorMsg); >+ } else { >+ this.runConformTest(sourceFiles, "Sunday is a holiday\n" + >+ "Monday is a workday\n" + >+ "Tuesday is a workday\n" + >+ "Wednesday is a workday\n" + >+ "Thursday is a workday\n" + >+ "Friday is a workday\n" + >+ "Saturday is a holiday\n" + >+ "DONE"); >+ } >+} > public static Class testClass() { > return SwitchTest.class; > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java >diff -N src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2288 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.regression; >+ >+import java.io.File; >+ >+import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; >+ >+import junit.framework.Test; >+ >+public class TypeAnnotationTest extends AbstractRegressionTest { >+ >+ static { >+// TESTS_NUMBERS = new int [] { 40 }; >+ } >+ public static Class testClass() { >+ return TypeAnnotationTest.class; >+ } >+ public static Test suite() { >+ return buildMinimalComplianceTestSuite(testClass(), F_1_7); >+ } >+ public TypeAnnotationTest(String testName){ >+ super(testName); >+ } >+ // superclass >+ public void test001() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "Marker.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@interface Marker {}", >+ "X.java", >+ "public class X extends @Marker Object {}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #17 @Marker(\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = -1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // type parameter >+ public void test002() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "Marker.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "@Target(TYPE_PARAMETER)\n" + >+ "@interface Marker {}", >+ "X.java", >+ "public class X<@Marker T> {}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #21 @Marker(\n" + >+ " target type = 0x22 CLASS_TYPE_PARAMETER\n" + >+ " type parameter index = 0\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // superclass >+ public void test003() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String id() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "Y.java", >+ "class Y {}\n", >+ "X.java", >+ "public class X extends @A(id=\"Hello, World!\") @B @C('(') Y {\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #19 @A(\n" + >+ " #20 id=\"Hello, World!\" (constant type)\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = -1\n" + >+ " )\n" + >+ " #22 @C(\n" + >+ " #23 value=\'(\' (constant type)\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = -1\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #17 @B(\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = -1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // super interfaces >+ public void test004() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String id() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "I.java", >+ "interface I {}\n", >+ "J.java", >+ "interface J {}\n", >+ "X.java", >+ "public class X implements @A(id=\"Hello, World!\") I, @B @C('(') J {}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #23 @A(\n" + >+ " #24 id=\"Hello, World!\" (constant type)\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = 0\n" + >+ " )\n" + >+ " #26 @C(\n" + >+ " #27 value=\'(\' (constant type)\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = 1\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #21 @B(\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = 1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // class literal >+ public void test005() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "I.java", >+ "interface I {}\n", >+ "J.java", >+ "interface J {}\n", >+ "X.java", >+ "public class X {\n" + >+ " public boolean foo(String s) {\n" + >+ " boolean b = (s instanceof @C('_') Object);\n" + >+ " Object o = new @B(3) @A(\"new Object\") Object();\n" + >+ " Class<?> c = @B(4) Object.class;\n" + >+ " Class<?> c2 = @A(\"int class literal\") @B(5) int.class;\n" + >+ " System.out.println(o.toString() + c.toString() + c2.toString());\n" + >+ " return b;\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #73 @C(\n" + >+ " #68 value=\'_\' (constant type)\n" + >+ " target type = 0x2 TYPE_INSTANCEOF\n" + >+ " offset = 1\n" + >+ " )\n" + >+ " #75 @A(\n" + >+ " #68 value=\"new Object\" (constant type)\n" + >+ " target type = 0x4 OBJECT_CREATION\n" + >+ " offset = 5\n" + >+ " )\n" + >+ " #75 @A(\n" + >+ " #68 value=\"int class literal\" (constant type)\n" + >+ " target type = 0x1e CLASS_LITERAL\n" + >+ " offset = 17\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #67 @B(\n" + >+ " #68 value=(int) 3 (constant type)\n" + >+ " target type = 0x4 OBJECT_CREATION\n" + >+ " offset = 5\n" + >+ " )\n" + >+ " #67 @B(\n" + >+ " #68 value=(int) 4 (constant type)\n" + >+ " target type = 0x1e CLASS_LITERAL\n" + >+ " offset = 13\n" + >+ " )\n" + >+ " #67 @B(\n" + >+ " #68 value=(int) 5 (constant type)\n" + >+ " target type = 0x1e CLASS_LITERAL\n" + >+ " offset = 17\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // class literal generic and array >+ public void test006() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "I.java", >+ "interface I {}\n", >+ "J.java", >+ "interface J {}\n", >+ "X.java", >+ "public class X {\n" + >+ " public boolean foo(Object o) {\n" + >+ " boolean b = (o instanceof @C('_') Object[]);\n" + >+ " Object o1 = new @B(3) @A(\"new Object\") Object[] {};\n" + >+ " Class<?> c = @B(4) Object[].class;\n" + >+ " Class<?> c2 = @A(\"int class literal\") @B(5) int[].class;\n" + >+ " System.out.println(o1.toString() + c.toString() + c2.toString());\n" + >+ " return b;\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #70 @C(\n" + >+ " #66 value=\'_\' (constant type)\n" + >+ " target type = 0x2 TYPE_INSTANCEOF\n" + >+ " offset = 1\n" + >+ " )\n" + >+ " #72 @A(\n" + >+ " #66 value=\"int class literal\" (constant type)\n" + >+ " target type = 0x1e CLASS_LITERAL\n" + >+ " offset = 14\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #65 @B(\n" + >+ " #66 value=(int) 4 (constant type)\n" + >+ " target type = 0x1e CLASS_LITERAL\n" + >+ " offset = 10\n" + >+ " )\n" + >+ " #65 @B(\n" + >+ " #66 value=(int) 5 (constant type)\n" + >+ " target type = 0x1e CLASS_LITERAL\n" + >+ " offset = 14\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // parameterized superclass >+ public void test007() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "Y.java", >+ "class Y<T> {}\n", >+ "X.java", >+ "public class X extends @A(\"Hello, World!\") Y<@B @C('(') String> {\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #21 @A(\n" + >+ " #22 value=\"Hello, World!\" (constant type)\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = -1\n" + >+ " )\n" + >+ " #24 @C(\n" + >+ " #22 value=\'(\' (constant type)\n" + >+ " target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + >+ " type index = -1\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #19 @B(\n" + >+ " target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + >+ " type index = -1\n" + >+ " locations = {0}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ public void test008() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "I.java", >+ "interface I<T> {}\n", >+ "J.java", >+ "interface J<U,T> {}\n", >+ "X.java", >+ "public class X implements I<@A(\"Hello, World!\") String>, @B J<String, @C('(') Integer> {}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #25 @A(\n" + >+ " #26 value=\"Hello, World!\" (constant type)\n" + >+ " target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + >+ " type index = 0\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " #28 @C(\n" + >+ " #26 value=\'(\' (constant type)\n" + >+ " target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + >+ " type index = 1\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #23 @B(\n" + >+ " target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + >+ " type index = 1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // throws >+ public void test009() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "E.java", >+ "class E extends RuntimeException {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}\n", >+ "E1.java", >+ "class E1 extends RuntimeException {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}\n", >+ "E2.java", >+ "class E2 extends RuntimeException {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ "}\n", >+ "X.java", >+ "public class X {\n" + >+ " void foo() throws @A(\"Hello, World!\") E, E1, @B @C('(') E2 {}\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #25 @A(\n" + >+ " #26 value=\"Hello, World!\" (constant type)\n" + >+ " target type = 0x16 THROWS\n" + >+ " throws index = 0\n" + >+ " )\n" + >+ " #28 @C(\n" + >+ " #26 value=\'(\' (constant type)\n" + >+ " target type = 0x16 THROWS\n" + >+ " throws index = 2\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #23 @B(\n" + >+ " target type = 0x16 THROWS\n" + >+ " throws index = 2\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // method receiver >+ public void test010() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " void foo() @B(3) {}\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #16 @B(\n" + >+ " #17 value=(int) 3 (constant type)\n" + >+ " target type = 0x6 METHOD_RECEIVER\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // method return type >+ public void test011() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " @B(3) @A(value=\"test\") int foo() {\n" + >+ " return 1;\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #21 @A(\n" + >+ " #18 value=\"test\" (constant type)\n" + >+ " target type = 0xa METHOD_RETURN_TYPE\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #17 @B(\n" + >+ " #18 value=(int) 3 (constant type)\n" + >+ " target type = 0xa METHOD_RETURN_TYPE\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // field type >+ public void test012() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " @B(3) @A int field;\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #12 @A(\n" + >+ " target type = 0xe FIELD\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #8 @B(\n" + >+ " #9 value=(int) 3 (constant type)\n" + >+ " target type = 0xe FIELD\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // method parameter >+ public void test013() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " int foo(@B(3) String s) {\n" + >+ " return s.length();\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #25 @B(\n" + >+ " #26 value=(int) 3 (constant type)\n" + >+ " target type = 0xc METHOD_PARAMETER\n" + >+ " method parameter index = 0\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // method parameter generic or array >+ public void test014() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " int foo(String @A [] @B(3) [] s) {\n" + >+ " return s.length;\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #23 @A(\n" + >+ " target type = 0xc METHOD_PARAMETER\n" + >+ " method parameter index = 0\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #19 @B(\n" + >+ " #20 value=(int) 3 (constant type)\n" + >+ " target type = 0xd METHOD_PARAMETER_GENERIC_OR_ARRAY\n" + >+ " method parameter index = 0\n" + >+ " locations = {0}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // field type generic or array >+ public void test015() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " @A int [] @B(3) [] field;\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #12 @A(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #8 @B(\n" + >+ " #9 value=(int) 3 (constant type)\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {0}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // class type parameter >+ public void test016() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_PARAMETER)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_PARAMETER)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X<@A @B(3) T> {}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #25 @A(\n" + >+ " target type = 0x22 CLASS_TYPE_PARAMETER\n" + >+ " type parameter index = 0\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #21 @B(\n" + >+ " #22 value=(int) 3 (constant type)\n" + >+ " target type = 0x22 CLASS_TYPE_PARAMETER\n" + >+ " type parameter index = 0\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // method type parameter >+ public void test017() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_PARAMETER)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_PARAMETER)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " <@A @B(3) T> void foo(T t) {}\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #27 @A(\n" + >+ " target type = 0x20 METHOD_TYPE_PARAMETER\n" + >+ " type parameter index = 0\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #23 @B(\n" + >+ " #24 value=(int) 3 (constant type)\n" + >+ " target type = 0x20 METHOD_TYPE_PARAMETER\n" + >+ " type parameter index = 0\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // class type parameter bound >+ public void test018() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X<T extends @A String & @B(3) Cloneable> {}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #25 @A(\n" + >+ " target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + >+ " type parameter index = 0 type parameter bound index = 0\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #21 @B(\n" + >+ " #22 value=(int) 3 (constant type)\n" + >+ " target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + >+ " type parameter index = 0 type parameter bound index = 1\n" + >+ " )\n" ; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // class type parameter bound generic or array >+ public void test019() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "Y.java", >+ "public class Y<T> {}", >+ "X.java", >+ "public class X<U, T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #25 @A(\n" + >+ " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 1 type parameter bound index = 0\n" + >+ " locations = {0,2}\n" + >+ " )\n" + >+ " #26 @C(\n" + >+ " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 1 type parameter bound index = 0\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #21 @B(\n" + >+ " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 1 type parameter bound index = 0\n" + >+ " locations = {0,1}\n" + >+ " )\n" + >+ " #21 @B(\n" + >+ " #22 value=(int) 3 (constant type)\n" + >+ " target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + >+ " type parameter index = 1 type parameter bound index = 1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // method type parameter bound >+ public void test020() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "Z.java", >+ "public class Z {}", >+ "X.java", >+ "public class X {\n" + >+ " <T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #27 @A(\n" + >+ " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + >+ " type parameter index = 0 type parameter bound index = 0\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #23 @B(\n" + >+ " #24 value=(int) 3 (constant type)\n" + >+ " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + >+ " type parameter index = 0 type parameter bound index = 1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // class type parameter bound generic or array >+ public void test021() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "Z.java", >+ "public class Z {}", >+ "Y.java", >+ "public class Y<T> {}", >+ "X.java", >+ "public class X {\n" + >+ " <T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #27 @A(\n" + >+ " target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 0 type parameter bound index = 0\n" + >+ " locations = {0,2}\n" + >+ " )\n" + >+ " #28 @C(\n" + >+ " target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 0 type parameter bound index = 0\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #23 @B(\n" + >+ " target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 0 type parameter bound index = 0\n" + >+ " locations = {0,1}\n" + >+ " )\n" + >+ " #23 @B(\n" + >+ " #24 value=(int) 3 (constant type)\n" + >+ " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + >+ " type parameter index = 0 type parameter bound index = 1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // local variable + generic or array >+ public void test022() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "X.java", >+ "public class X {\n" + >+ " String[][] bar() {\n" + >+ " return new String[][] {};" + >+ " }\n" + >+ " void foo(String s) {\n" + >+ " @C int i;\n" + >+ " @A String [] @B(3)[] tab = bar();\n" + >+ " if (tab != null) {\n" + >+ " i = 0;\n" + >+ " System.out.println(i + tab.length);\n" + >+ " } else {\n" + >+ " System.out.println(tab.length);\n" + >+ " }\n" + >+ " i = 4;\n" + >+ " System.out.println(-i + tab.length);\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #49 @C(\n" + >+ " target type = 0x8 LOCAL_VARIABLE\n" + >+ " local variable entries:\n" + >+ " [pc: 11, pc: 24] index: 2\n" + >+ " [pc: 34, pc: 46] index: 2\n" + >+ " )\n" + >+ " #50 @A(\n" + >+ " target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + >+ " local variable entries:\n" + >+ " [pc: 5, pc: 46] index: 3\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #45 @B(\n" + >+ " #46 value=(int) 3 (constant type)\n" + >+ " target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + >+ " local variable entries:\n" + >+ " [pc: 5, pc: 46] index: 3\n" + >+ " locations = {0}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // type argument constructor call >+ public void test023() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " <T> X(T t) {\n" + >+ " }\n" + >+ " public Object foo() {\n" + >+ " X x = new <@A @B(1) String>X(null);\n" + >+ " return x;\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #31 @A(\n" + >+ " target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + >+ " offset = 5\n" + >+ " type argument index = 0\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #27 @B(\n" + >+ " #28 value=(int) 1 (constant type)\n" + >+ " target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + >+ " offset = 5\n" + >+ " type argument index = 0\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // type argument constructor call generic or array >+ public void test024() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "X.java", >+ "public class X {\n" + >+ " <T, U> X(T t, U u) {\n" + >+ " }\n" + >+ " public Object foo() {\n" + >+ " X x = new <@A Integer, @A String @C [] @B(1)[]>X(null, null);\n" + >+ " return x;\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #33 @A(\n" + >+ " target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + >+ " offset = 6\n" + >+ " type argument index = 0\n" + >+ " )\n" + >+ " #33 @A(\n" + >+ " target type = 0x19 TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY\n" + >+ " offset = 6\n" + >+ " type argument index = 1\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " #34 @C(\n" + >+ " target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + >+ " offset = 6\n" + >+ " type argument index = 1\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #29 @B(\n" + >+ " #30 value=(int) 1 (constant type)\n" + >+ " target type = 0x19 TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY\n" + >+ " offset = 6\n" + >+ " type argument index = 1\n" + >+ " locations = {0}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // type argument method call >+ public void test025() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ "\n" + >+ " static <T, U> T foo(T t, U u) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " System.out.println(X.<@A @B(1) String[], @C('-') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + >+ " }\n" + >+ "}\n", >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ }, >+ "SUCCESS"); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #52 @A(\n" + >+ " target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + >+ " offset = 13\n" + >+ " type argument index = 0\n" + >+ " )\n" + >+ " #53 @C(\n" + >+ " #49 value=\'-\' (constant type)\n" + >+ " target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + >+ " offset = 13\n" + >+ " type argument index = 1\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #48 @B(\n" + >+ " #49 value=(int) 1 (constant type)\n" + >+ " target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + >+ " offset = 13\n" + >+ " type argument index = 0\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // check locations >+ public void test026() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.util.Map;\n" + >+ "import java.util.List;\n" + >+ "public class X {\n" + >+ " @H String @E[] @F[] @G[] field;\n" + >+ " @A Map<@B String, @C List<@D Object>> field2;\n" + >+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + >+ "}", >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "D.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface D {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "E.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface E {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "F.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface F {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "G.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface G {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "H.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface H {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ }, >+ ""); >+ String expectedOutput = >+ " // Field descriptor #6 [[[Ljava/lang/String;\n" + >+ " java.lang.String[][][] field;\n" + >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #11 @H(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {2}\n" + >+ " )\n" + >+ " #12 @F(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #8 @E(\n" + >+ " target type = 0xe FIELD\n" + >+ " )\n" + >+ " #9 @G(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " \n" + >+ " // Field descriptor #14 Ljava/util/Map;\n" + >+ " // Signature: Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/Object;>;>;\n" + >+ " java.util.Map field2;\n" + >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #18 @A(\n" + >+ " target type = 0xe FIELD\n" + >+ " )\n" + >+ " #19 @C(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " #20 @D(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1,0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #17 @B(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " \n" + >+ " // Field descriptor #14 Ljava/util/Map;\n" + >+ " // Signature: Ljava/util/Map<Ljava/lang/String;[[[Ljava/lang/String;>;\n" + >+ " java.util.Map field3;\n" + >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #18 @A(\n" + >+ " target type = 0xe FIELD\n" + >+ " )\n" + >+ " #11 @H(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1,2}\n" + >+ " )\n" + >+ " #12 @F(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1,0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #17 @B(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " #8 @E(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " #9 @G(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1,1}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // check locations >+ public void test027() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " @H java.lang.String @E[] @F[] @G[] field;\n" + >+ "}", >+ "E.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface E {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "F.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface F {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "G.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface G {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "H.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface H {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #11 @H(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {2}\n" + >+ " )\n" + >+ " #12 @F(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #8 @E(\n" + >+ " target type = 0xe FIELD\n" + >+ " )\n" + >+ " #9 @G(\n" + >+ " target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + >+ " locations = {1}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // cast >+ public void test028() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "I.java", >+ "interface I {}\n", >+ "J.java", >+ "interface J {}\n", >+ "X.java", >+ "public class X {\n" + >+ " public void foo(Object o) {\n" + >+ " if (o instanceof String[][]) {\n" + >+ " String[][] tab = (@C('_') @B(3) String[] @A[]) o;\n" + >+ " System.out.println(tab.length);\n" + >+ " }\n" + >+ " System.out.println(o);\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #41 @C(\n" + >+ " #38 value=\'_\' (constant type)\n" + >+ " target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + >+ " offset = 8\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " #43 @A(\n" + >+ " target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + >+ " offset = 8\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #37 @B(\n" + >+ " #38 value=(int) 3 (constant type)\n" + >+ " target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + >+ " offset = 8\n" + >+ " locations = {1}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // qualified allocation expression with type arguments >+ public void test029() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "D.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface D {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "X.java", >+ "public class X {\n" + >+ " class Y {\n" + >+ " <T, U> Y(T t, U u) {}\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " Y y = new X().new <@D() @A(value = \"hello\") String, @B X> Y(\"SUCCESS\", null);\n" + >+ " System.out.println(y);\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #47 @D(\n" + >+ " target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + >+ " offset = 19\n" + >+ " type argument index = 0\n" + >+ " )\n" + >+ " #48 @A(\n" + >+ " #49 value=\"hello\" (constant type)\n" + >+ " target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + >+ " offset = 19\n" + >+ " type argument index = 0\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #45 @B(\n" + >+ " target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + >+ " offset = 19\n" + >+ " type argument index = 1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // local + wildcard >+ // qualified allocation expression with type arguments >+ public void test030() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "D.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface D {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ "X.java", >+ "import java.util.Map;\n" + >+ "import java.util.HashMap;\n" + >+ "@SuppressWarnings({\"unchecked\",\"rawtypes\"})\n" + >+ "public class X {\n" + >+ " Object newMap(Object o) {\n" + >+ " Map<@A Object, ? super @C Map<@B String, @D Comparable>> map;\n" + >+ " if (o == null) {\n" + >+ " map = null;\n" + >+ " System.out.println(map);\n" + >+ " } else {\n" + >+ " System.out.println(\"No map yet\");\n" + >+ " }\n" + >+ " map = new HashMap();\n" + >+ " return map;\n" + >+ " } \n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #46 @A(\n" + >+ " target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + >+ " local variable entries:\n" + >+ " [pc: 6, pc: 16] index: 2\n" + >+ " [pc: 32, pc: 34] index: 2\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " #47 @C(\n" + >+ " target type = 0x1c WILDCARD_BOUND\n" + >+ " wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + >+ " local variable entries:\n" + >+ " [pc: 6, pc: 16] index: 2\n" + >+ " [pc: 32, pc: 34] index: 2\n" + >+ " wildcard locations = {1}\n" + >+ " )\n" + >+ " #48 @D(\n" + >+ " target type = 0x1d WILDCARD_BOUND_GENERIC_OR_ARRAY\n" + >+ " wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + >+ " local variable entries:\n" + >+ " [pc: 6, pc: 16] index: 2\n" + >+ " [pc: 32, pc: 34] index: 2\n" + >+ " wildcard locations = {1}\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #44 @B(\n" + >+ " target type = 0x1d WILDCARD_BOUND_GENERIC_OR_ARRAY\n" + >+ " wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + >+ " local variable entries:\n" + >+ " [pc: 6, pc: 16] index: 2\n" + >+ " [pc: 32, pc: 34] index: 2\n" + >+ " wildcard locations = {1}\n" + >+ " locations = {0}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // method type parameter bound generic or array >+ public void test031() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface C {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "D.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_PARAMETER)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface D {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "Z.java", >+ "public class Z<T> {}", >+ "X.java", >+ "public class X {\n" + >+ " <@D U, T extends Z<@A String @C[][]@B[]> & @B(3) Cloneable> void foo(U u, T t) {}\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #31 @D(\n" + >+ " target type = 0x20 METHOD_TYPE_PARAMETER\n" + >+ " type parameter index = 0\n" + >+ " )\n" + >+ " #32 @A(\n" + >+ " target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 1 type parameter bound index = 0\n" + >+ " locations = {0,2}\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #26 @C(\n" + >+ " target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 1 type parameter bound index = 0\n" + >+ " locations = {0}\n" + >+ " )\n" + >+ " #27 @B(\n" + >+ " target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + >+ " type parameter index = 1 type parameter bound index = 0\n" + >+ " locations = {0,1}\n" + >+ " )\n" + >+ " #27 @B(\n" + >+ " #28 value=(int) 3 (constant type)\n" + >+ " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + >+ " type parameter index = 1 type parameter bound index = 1\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // type argument method call and generic or array >+ public void test032() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ "\n" + >+ " static <T, U> T foo(T t, U u) {\n" + >+ " return t;\n" + >+ " }\n" + >+ " public static void bar() {\n" + >+ " System.out.println(X.<@A String[] @B(1) [], @C('-') X>foo(new String[][]{{\"SUCCESS\"}}, null)[0]);\n" + >+ " }\n" + >+ "}\n", >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " int value() default -1;\n" + >+ "}", >+ "C.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface C {\n" + >+ " char value() default '-';\n" + >+ "}\n", >+ }, >+ ""); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #52 @A(\n" + >+ " target type = 0x1b TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY\n" + >+ " offset = 20\n" + >+ " type argument index = 0\n" + >+ " locations = {1}\n" + >+ " )\n" + >+ " #53 @C(\n" + >+ " #49 value=\'-\' (constant type)\n" + >+ " target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + >+ " offset = 20\n" + >+ " type argument index = 1\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #48 @B(\n" + >+ " #49 value=(int) 1 (constant type)\n" + >+ " target type = 0x1b TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY\n" + >+ " offset = 20\n" + >+ " type argument index = 0\n" + >+ " locations = {0}\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // superclass >+ public void test033() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "Marker.java", >+ "@interface Marker {}", >+ "X.java", >+ "public class X extends @Marker Object {}", >+ }, >+ ""); >+ } >+ // superclass >+ public void test034() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "Marker.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "@Target(TYPE_PARAMETER)\n" + >+ "@interface Marker {}", >+ "X.java", >+ "public class X extends @Marker Object {}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " public class X extends @Marker Object {}\n" + >+ " ^^^^^^^\n" + >+ "The annotation @Marker is disallowed for this location\n" + >+ "----------\n"); >+ } >+ // annotation on catch variable >+ public void test035() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.lang.annotation.Target;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " @A Exception test = new Exception() {\n" + >+ " private static final long serialVersionUID = 1L;\n" + >+ " @Override\n" + >+ " public String toString() {\n" + >+ " return \"SUCCESS\";\n" + >+ " }\n" + >+ " };\n" + >+ " try {\n" + >+ " System.out.println(test);\n" + >+ " } catch(@A Exception e) {\n" + >+ " e.printStackTrace();\n" + >+ " }\n" + >+ " }\n" + >+ "}", >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ }, >+ "SUCCESS"); >+ String expectedOutput = >+ " RuntimeVisibleTypeAnnotations: \n" + >+ " #44 @A(\n" + >+ " target type = 0x8 LOCAL_VARIABLE\n" + >+ " local variable entries:\n" + >+ " [pc: 8, pc: 24] index: 1\n" + >+ " )\n" + >+ " #44 @A(\n" + >+ " target type = 0x8 LOCAL_VARIABLE\n" + >+ " local variable entries:\n" + >+ " [pc: 19, pc: 23] index: 2\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // annotation on catch variable >+ public void test036() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.lang.annotation.Target;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " @B int j = 9;\n" + >+ " try {\n" + >+ " System.out.print(\"SUCCESS\" + j);\n" + >+ " } catch(@A Exception e) {\n" + >+ " }\n" + >+ " @B int k = 3;\n" + >+ " System.out.println(k);\n" + >+ " }\n" + >+ "}", >+ "A.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(RUNTIME)\n" + >+ "@interface A {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ "B.java", >+ "import java.lang.annotation.Target;\n" + >+ "import static java.lang.annotation.ElementType.*;\n" + >+ "import java.lang.annotation.Retention;\n" + >+ "import static java.lang.annotation.RetentionPolicy.*;\n" + >+ "@Target(TYPE_USE)\n" + >+ "@Retention(CLASS)\n" + >+ "@interface B {\n" + >+ " String value() default \"default\";\n" + >+ "}\n", >+ }, >+ "SUCCESS93"); >+ String expectedOutput = >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #56 @B(\n" + >+ " target type = 0x8 LOCAL_VARIABLE\n" + >+ " local variable entries:\n" + >+ " [pc: 3, pc: 39] index: 1\n" + >+ " )\n" + >+ " #56 @B(\n" + >+ " target type = 0x8 LOCAL_VARIABLE\n" + >+ " local variable entries:\n" + >+ " [pc: 31, pc: 39] index: 2\n" + >+ " )\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // make sure annotation without target appears twice when set on a method declaration >+ public void test037() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.lang.annotation.Target;\r\n" + >+ "import static java.lang.annotation.ElementType.*;\r\n" + >+ "\r\n" + >+ "@Target(METHOD)\r\n" + >+ "@interface Annot {\r\n" + >+ " int value() default 0;\r\n" + >+ "}\r\n" + >+ "public class X {\r\n" + >+ " @Annot(4)\r\n" + >+ " public void foo() {\r\n" + >+ " }\r\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " public void foo();\n" + >+ " 0 return\n" + >+ " Line numbers:\n" + >+ " [pc: 0, line: 11]\n" + >+ " Local variable table:\n" + >+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" + >+ " RuntimeInvisibleAnnotations: \n" + >+ " #16 @Annot(\n" + >+ " #17 value=(int) 4 (constant type)\n" + >+ " )\n" + >+ "}"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // make sure annotation without target appears twice when set on a method declaration >+ public void test038() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "@interface Annot {\r\n" + >+ " int value() default 0;\r\n" + >+ "}\r\n" + >+ "public class X {\r\n" + >+ " @Annot(4)\r\n" + >+ " public void foo() {\r\n" + >+ " }\r\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " // Method descriptor #6 ()V\n" + >+ " // Stack: 0, Locals: 1\n" + >+ " public void foo();\n" + >+ " 0 return\n" + >+ " Line numbers:\n" + >+ " [pc: 0, line: 7]\n" + >+ " Local variable table:\n" + >+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" + >+ " RuntimeInvisibleAnnotations: \n" + >+ " #16 @Annot(\n" + >+ " #17 value=(int) 4 (constant type)\n" + >+ " )\n" + >+ "}"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // make sure annotation without target appears twice when set on a method declaration >+ public void test039() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "@interface Annot {\r\n" + >+ " int value() default 0;\r\n" + >+ "}\r\n" + >+ "public class X {\r\n" + >+ " @Annot(4)\r\n" + >+ " public int foo() {\r\n" + >+ " return 0;\r\n" + >+ " }\r\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " public int foo();\n" + >+ " 0 iconst_0\n" + >+ " 1 ireturn\n" + >+ " Line numbers:\n" + >+ " [pc: 0, line: 7]\n" + >+ " Local variable table:\n" + >+ " [pc: 0, pc: 2] local: this index: 0 type: X\n" + >+ " RuntimeInvisibleAnnotations: \n" + >+ " #17 @Annot(\n" + >+ " #18 value=(int) 4 (constant type)\n" + >+ " )\n" + >+ " RuntimeInvisibleTypeAnnotations: \n" + >+ " #17 @Annot(\n" + >+ " #18 value=(int) 4 (constant type)\n" + >+ " target type = 0xa METHOD_RETURN_TYPE\n" + >+ " )\n" + >+ "}"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+ // make sure annotation without target appears twice when set on a method declaration >+ public void test040() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.lang.annotation.Target;\r\n" + >+ "import static java.lang.annotation.ElementType.*;\r\n" + >+ "\r\n" + >+ "@Target(METHOD)\r\n" + >+ "@interface Annot {\r\n" + >+ " int value() default 0;\r\n" + >+ "}\r\n" + >+ "public class X {\r\n" + >+ " @Annot(4)\r\n" + >+ " public int foo() {\r\n" + >+ " return 0;\r\n" + >+ " }\r\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " public int foo();\n" + >+ " 0 iconst_0\n" + >+ " 1 ireturn\n" + >+ " Line numbers:\n" + >+ " [pc: 0, line: 11]\n" + >+ " Local variable table:\n" + >+ " [pc: 0, pc: 2] local: this index: 0 type: X\n" + >+ " RuntimeInvisibleAnnotations: \n" + >+ " #17 @Annot(\n" + >+ " #18 value=(int) 4 (constant type)\n" + >+ " )\n" + >+ "}"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 287648
:
145655
|
145779
|
145880
|
146186
|
146401
|
146602
|
148041
|
148087
|
149501
|
149970
|
150486
| 187248 |
217341
|
217581
|
217668
|
217685
|
217786