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 217341 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]
Up to date patch
patch.txt (text/plain), 885.08 KB, created by
Srikanth Sankaran
on 2012-06-14 04:15:52 EDT
(
hide
)
Description:
Up to date patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2012-06-14 04:15:52 EDT
Size:
885.08 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java >new file mode 100644 >index 0000000..f97f497 >--- /dev/null >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java >@@ -0,0 +1,647 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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) { >+ >+ >+} >+} >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java >index 8a4416c..d8ab158 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -1477,21 +1481,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( >@@ -1755,11 +1759,20 @@ > "Syntax error on token \"T2\", delete this token\n" + > "----------\n"; > >+ 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, >+ expected17ProblemLog > ); > } > public void test0039() { >@@ -1817,7 +1830,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" + >@@ -1860,8 +1873,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; >@@ -1874,11 +1887,20 @@ > "Syntax error on token \"for\", delete this token\n" + > "----------\n"; > >+ 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, >+ expected17ProblemLog > ); > } > public void test0042() { >@@ -2254,7 +2276,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" + >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java >index 94f09db..58f11be 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -2527,20 +2531,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 +4643,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"; > >@@ -4839,15 +4840,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"; > >@@ -5999,7 +6000,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" + >@@ -6008,7 +6009,7 @@ > " request as;\n" + > " does not;\n" + > " the removal;\n" + >- " thread = $missing$;\n" + >+ " thread $missing$;\n" + > " }\n" + > " public IJavaThread[] getThreadFilters() {\n" + > " return the;\n" + >@@ -7612,18 +7613,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" + >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java >index 75d26ea..ab15b83 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -71,16 +75,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 +139,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 +252,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" > ); > } >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java >index c5136c3..63c4255 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -166,17 +170,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 +277,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 +403,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 +410,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( >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java >new file mode 100644 >index 0000000..595b656 >--- /dev/null >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java >@@ -0,0 +1,3633 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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); >+} >+} >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java >index 0b0e640..e5e4024 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for Bug 331872 - [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter >@@ -551,7 +555,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[] { >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java >new file mode 100644 >index 0000000..5b8138e >--- /dev/null >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java >@@ -0,0 +1,927 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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"); >+ } >+} >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java >index 6e782c5..3c2a86a 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -1136,6 +1140,7 @@ > assertTrue("Should not fail with InvalidInputException", false); > } > } >+ > /* > * https://bugs.eclipse.org/bugs/show_bug.cgi?id=340513 > */ >@@ -1306,4 +1311,149 @@ > "Invalid unicode\n" + > "----------\n"); > } >+ // Exotic identifier >+ public void test061() { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ "1.5", >+ "1.7"); >+ final char[] source = "#\"this is an exotic identifier\"".toCharArray(); >+ scanner.setSource(source); >+ try { >+ assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken()); >+ } catch (InvalidInputException e) { >+ assertTrue("Should not happen", false); >+ } >+ } >+ // Exotic identifier >+ public void test062() { >+ 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 test063() { >+ 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 test064() { >+ 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 test065() { >+ 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 test066() { >+ 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) { >+ } >+ } >+ // Exotic identifier >+ public void test067() { >+ 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 test068() { >+ IScanner scanner = ToolFactory.createScanner( >+ true, >+ true, >+ true, >+ JavaCore.VERSION_1_4, >+ JavaCore.VERSION_1_4); >+ final char[] source = "elnu".toCharArray(); >+ scanner.setSource(source); >+ scanner.resetTo(0, source.length - 1); >+ try { >+ assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken()); >+ } catch (InvalidInputException e) { >+ assertTrue("Should not fail with InvalidInputException", false); >+ } >+ } > } >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java >new file mode 100644 >index 0000000..e7e534c >--- /dev/null >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java >@@ -0,0 +1,2292 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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); >+ } >+} >diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java >index f584192..09948e1 100644 >--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java >+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -55,6 +59,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 >diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java >index ad76643..8a133f4 100644 >--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java >+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -55,6 +59,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); >diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >index 3b6f9e1..a28d127 100644 >--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -1156,9 +1160,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); >@@ -1360,7 +1367,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--]; >@@ -2589,6 +2597,10 @@ > } > } > protected void consumeFormalParameter(boolean isVarArgs) { >+ >+ this.invocationType = NO_RECEIVER; >+ this.qualifier = -1; >+ > if (this.indexOfAssistIdentifier() < 0) { > super.consumeFormalParameter(isVarArgs); > if (this.pendingAnnotation != null) { >@@ -2606,10 +2618,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; > } >@@ -2623,7 +2656,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, >@@ -2725,6 +2757,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); > >@@ -2732,7 +2782,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--; >@@ -4384,6 +4434,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; >@@ -4491,7 +4551,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 { >@@ -4794,7 +4854,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 { >@@ -5006,4 +5066,4 @@ > } > return false; > } >-} >\ No newline at end of file >+} >diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java >index 10f68d5..4087b20 100644 >--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java >+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -897,13 +901,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; >@@ -1627,6 +1631,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; >diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java >index 0be1b54..7276284 100644 >--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java >+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -606,10 +610,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; > } >@@ -626,7 +651,6 @@ > arg.declarationSourceStart = modifierPositions; > > // consume annotations >- int length; > if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { > System.arraycopy( > this.expressionStack, >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java >index cb1d6de..90d9469 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java >@@ -8,7 +8,7 @@ > * This is an implementation of an early-draft specification developed under the Java > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. >- * >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * IBM Corporation - added the following constants >@@ -502,7 +502,7 @@ > int IncorrectSwitchType = TypeRelated + 169; > int DuplicateCase = FieldRelated + 170; > >- // labelled >+ // labeled > int DuplicateLabel = Internal + 171; > int InvalidBreak = Internal + 172; > int InvalidContinue = Internal + 173; >@@ -1291,7 +1291,16 @@ > int UnusedWarningToken = Internal + 635; > /** @since 3.6 */ > int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + 636; >- >+ /** @since 3.8 */ >+ int InvalidUsageOfTypeAnnotations = Syntax + Internal + 637; >+ /** @since 3.8 */ >+ int InvalidUsageOfReceiverAnnotations = Syntax + Internal + 638; >+ /** @since 3.8 */ >+ int MisplacedTypeAnnotations = Syntax + Internal + 639; >+ /** @since 3.8 */ >+ int InvalidLocationForModifiers = Syntax + Internal + 640; >+ /** @since 3.8*/ >+ int IllegalUsageOfTypeAnnotations = Internal + Syntax + 641; > /** > * More problems in generics > */ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java >index 04c9835..f01b85b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -44,11 +48,14 @@ > // 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( >@@ -271,10 +278,25 @@ > // 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) { >@@ -292,6 +314,9 @@ > * @since 3.1 > */ > 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) { >@@ -372,6 +397,14 @@ > * @since 3.1 > */ > 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( >@@ -491,6 +524,9 @@ > return true; // do nothing by default, keep traversing > } > 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( >@@ -713,11 +749,27 @@ > 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 > */ > 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) { >@@ -737,6 +789,14 @@ > * @since 3.1 > */ > 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) { >@@ -819,6 +879,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) { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java >index b2b2f9c..55f8d0d 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java >@@ -8,7 +8,7 @@ > * This is an implementation of an early-draft specification developed under the Java > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. >- * >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -21,6 +21,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; >@@ -34,14 +35,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; >@@ -49,14 +58,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; >@@ -231,6 +242,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. >@@ -249,7 +329,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; >@@ -367,6 +452,8 @@ > generateMissingTypesAttribute(); > attributesNumber++; > } >+ >+ attributesNumber += generateTypeAnnotationAttributeForTypeDeclaration(); > // update the number of attributes > if (attributeOffset + 2 >= this.contents.length) { > resizeContents(2); >@@ -421,8 +508,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); > } > } > } >@@ -1843,10 +1963,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.IsUnionType) == 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 >@@ -3133,6 +3443,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; >@@ -3733,6 +4149,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; > /* >@@ -4157,6 +4795,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; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >index fdc9823..ed0d221 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >@@ -8,7 +8,7 @@ > * This is an implementation of an early-draft specification developed under the Java > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. >- * >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Matt McCutchen - partial fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=122995 >@@ -61,7 +61,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) > >@@ -253,6 +262,9 @@ > public static final int INVOCATION_ARGUMENT_UNCHECKED = 1; > public static final int INVOCATION_ARGUMENT_WILDCARD = 2; > >+ // for all declarations that can contain type references that have type annotations >+ public static final int HasTypeAnnotations = Bit21; >+ > // for type reference (diamond case) - Java 7 > public static final int IsUnionType = Bit30; > // Used to tag ParameterizedSingleTypeReference or ParameterizedQualifiedTypeReference when they are >@@ -528,8 +540,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; > } >@@ -712,6 +731,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, scope); >+ } >+ break; >+ default : >+ return; >+ } >+ } >+ if (sourceAnnotations == null) >+ return; >+ for (int i = 0; i < length; i++) { >+ Annotation annotation = sourceAnnotations[i]; >+ final Binding annotationRecipient = annotation.recipient; >+ if (annotationRecipient != null && recipient != null) { >+ // only local and field can share annnotations >+ switch (recipient.kind()) { >+ case Binding.FIELD : >+ FieldBinding field = (FieldBinding) recipient; >+ field.tagBits = ((FieldBinding) annotationRecipient).tagBits; >+ break; >+ case Binding.LOCAL : >+ LocalVariableBinding local = (LocalVariableBinding) recipient; >+ local.tagBits = ((LocalVariableBinding) annotationRecipient).tagBits; >+ break; >+ } >+ if (annotations != null) { >+ // need to fill the instances array >+ annotations[0] = annotation.getCompilerAnnotation(); >+ for (int j = 1; j < length; j++) { >+ Annotation annot = sourceAnnotations[j]; >+ annotations[j] = annot.getCompilerAnnotation(); >+ } >+ } >+ return; >+ } else { >+ annotation.recipient = recipient; >+ annotation.resolveType(scope); >+ // null if receiver is a package binding >+ if (annotations != null) { >+ annotations[i] = annotation.getCompilerAnnotation(); >+ } >+ } >+ } >+ // check duplicate annotations >+ if (annotations != null) { >+ AnnotationBinding[] distinctAnnotations = annotations; // only copy after 1st duplicate is detected >+ for (int i = 0; i < length; i++) { >+ AnnotationBinding annotation = distinctAnnotations[i]; >+ if (annotation == null) continue; >+ TypeBinding annotationType = annotation.getAnnotationType(); >+ boolean foundDuplicate = false; >+ for (int j = i+1; j < length; j++) { >+ AnnotationBinding otherAnnotation = distinctAnnotations[j]; >+ if (otherAnnotation == null) continue; >+ if (otherAnnotation.getAnnotationType() == annotationType) { >+ foundDuplicate = true; >+ if (distinctAnnotations == annotations) { >+ System.arraycopy(distinctAnnotations, 0, distinctAnnotations = new AnnotationBinding[length], 0, length); >+ } >+ distinctAnnotations[j] = null; // report it only once >+ scope.problemReporter().duplicateAnnotation(sourceAnnotations[j]); >+ } >+ } >+ if (foundDuplicate) { >+ scope.problemReporter().duplicateAnnotation(sourceAnnotations[i]); >+ } >+ } >+ } >+ } > /** > * Figures if @Deprecated annotation is specified, do not resolve entire annotations. > */ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >index d4f065e..7af292e 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -14,6 +18,8 @@ > * bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; >+ >+import java.util.List; > > import org.eclipse.jdt.core.compiler.*; > import org.eclipse.jdt.internal.compiler.*; >@@ -39,6 +45,8 @@ > public int modifiers; > public int modifiersSourceStart; > public Annotation[] annotations; >+ // jsr 308 >+ public Annotation[] receiverAnnotations; > public Argument[] arguments; > public TypeReference[] thrownExceptions; > public Statement[] statements; >@@ -301,9 +309,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 : >@@ -396,7 +408,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) { >@@ -418,6 +433,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++) { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java >index ab66d39..e1e4f61 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -87,7 +91,10 @@ > public StringBuffer printAsExpression(int indent, StringBuffer output) { > printIndent(indent, output); > printModifiers(this.modifiers, output); >- if (this.annotations != null) printAnnotations(this.annotations, output); >+ if (this.annotations != null) { >+ printAnnotations(this.annotations, output); >+ output.append(' '); >+ } > > if (this.type != null) { > this.type.print(0, output).append(' '); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java >index 613003b..636bb66 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -127,7 +131,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(); >@@ -160,7 +164,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, >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >index 1331b11..6283ce5 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -12,6 +16,8 @@ > * bug 365662 - [compiler][null] warn on contradictory and redundant null annotations > *******************************************************************************/ > 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; >@@ -25,6 +31,329 @@ > * Annotation > */ > public abstract class Annotation extends Expression { >+ >+ /** >+ * Return the location for the corresponding annotation inside the type reference, <code>null</code> if none. >+ */ >+ public static int[] getLocations( >+ final TypeReference reference, >+ final Annotation[] primaryAnnotation, >+ final Annotation annotation, >+ final Annotation[][] annotationsOnDimensionsOnExpression) { >+ class LocationCollector extends ASTVisitor { >+ Stack currentIndexes; >+ Annotation currentAnnotation; >+ boolean search = true; >+ >+ public LocationCollector(Annotation currentAnnotation) { >+ this.currentIndexes = new Stack(); >+ this.currentAnnotation = currentAnnotation; >+ } >+ public boolean visit(ArrayTypeReference typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; >+ if (annotationsOnDimensions != null) { >+ // check if the annotation is located on the first dimension >+ Annotation[] annotations = annotationsOnDimensions[0]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ >+ this.currentIndexes.push(new Integer(0)); >+ for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { >+ annotations = annotationsOnDimensions[i]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); >+ } >+ } >+ Annotation[] annotations = typeReference.annotations; >+ if (annotations == null) { >+ annotations = primaryAnnotation; >+ } >+ if (annotations != null) { >+ for (int i = 0; i < annotations.length; i++) { >+ Annotation current = annotations[i]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ this.currentIndexes.pop(); >+ return true; >+ } >+ public boolean visit(ArrayQualifiedTypeReference typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; >+ if (annotationsOnDimensions != null) { >+ // check if the annotation is located on the first dimension >+ Annotation[] annotations = annotationsOnDimensions[0]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ >+ this.currentIndexes.push(new Integer(0)); >+ for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { >+ annotations = annotationsOnDimensions[i]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); >+ } >+ } >+ Annotation[] annotations = typeReference.annotations; >+ if (annotations == null) { >+ annotations = primaryAnnotation; >+ } >+ if (annotations != null) { >+ for (int i = 0; i < annotations.length; i++) { >+ Annotation current = annotations[i]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ this.currentIndexes.pop(); >+ return true; >+ } >+ public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; >+ if (annotationsOnDimensions != null) { >+ // check if the annotation is located on the first dimension >+ Annotation[] annotations = annotationsOnDimensions[0]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ >+ this.currentIndexes.push(new Integer(0)); >+ for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { >+ annotations = annotationsOnDimensions[i]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); >+ } >+ } >+ Annotation[] annotations = typeReference.annotations; >+ if (annotations == null) { >+ annotations = primaryAnnotation; >+ } >+ if (annotations != null) { >+ for (int i = 0; i < annotations.length; i++) { >+ Annotation current = annotations[i]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ TypeReference[] typeReferences = typeReference.typeArguments; >+ this.currentIndexes.push(new Integer(0)); >+ for (int i = 0, max = typeReferences.length; i < max; i++) { >+ typeReferences[i].traverse(this, scope); >+ if (!this.search) return false; >+ this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); >+ } >+ this.currentIndexes.pop(); >+ return true; >+ } >+ public boolean visit(ParameterizedQualifiedTypeReference typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions; >+ if (annotationsOnDimensions != null) { >+ // check if the annotation is located on the first dimension >+ Annotation[] annotations = annotationsOnDimensions[0]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ >+ this.currentIndexes.push(new Integer(0)); >+ for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { >+ annotations = annotationsOnDimensions[i]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); >+ } >+ } >+ Annotation[] annotations = typeReference.annotations; >+ if (annotations == null) { >+ annotations = primaryAnnotation; >+ } >+ if (annotations != null) { >+ for (int i = 0; i < annotations.length; i++) { >+ Annotation current = annotations[i]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ //TODO it is unclear how to manage annotations located in the first type arguments >+ TypeReference[] typeReferences = typeReference.typeArguments[typeReference.typeArguments.length - 1]; >+ this.currentIndexes.push(new Integer(0)); >+ for (int i = 0, max = typeReferences.length; i < max; i++) { >+ typeReferences[i].traverse(this, scope); >+ if (!this.search) return false; >+ this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); >+ } >+ this.currentIndexes.pop(); >+ return true; >+ } >+ public boolean visit(SingleTypeReference typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ Annotation[][] annotationsOnDimensions = annotationsOnDimensionsOnExpression; >+ if (annotationsOnDimensions != null) { >+ // check if the annotation is located on the first dimension >+ Annotation[] annotations = annotationsOnDimensions[0]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ >+ this.currentIndexes.push(new Integer(0)); >+ for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) { >+ annotations = annotationsOnDimensions[i]; >+ if (annotations != null) { >+ for (int j = 0, max2 = annotations.length; j < max2; j++) { >+ Annotation current = annotations[j]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1)); >+ } >+ } >+ Annotation[] annotations = typeReference.annotations; >+ if (annotations != null) { >+ for (int i = 0; i < annotations.length; i++) { >+ Annotation current = annotations[i]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ return false; >+ } >+ public boolean visit(Wildcard typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ TypeReference bound = typeReference.bound; >+ bound.traverse(this, scope); >+ return true; >+ } >+ public boolean visit(QualifiedTypeReference typeReference, BlockScope scope) { >+ if (!this.search) return false; >+ Annotation[] annotations = typeReference.annotations; >+ if (annotations != null) { >+ for (int i = 0; i < annotations.length; i++) { >+ Annotation current = annotations[i]; >+ if (current == this.currentAnnotation) { >+ this.search = false; >+ return false; >+ } >+ } >+ } >+ return true; >+ } >+ public String toString() { >+ StringBuffer buffer = new StringBuffer(); >+ buffer >+ .append("search location for ") //$NON-NLS-1$ >+ .append(this.currentAnnotation) >+ .append("\ncurrent indexes : ") //$NON-NLS-1$ >+ .append(this.currentIndexes); >+ return String.valueOf(buffer); >+ } >+ } >+ if (reference == null) return null; >+ LocationCollector collector = new LocationCollector(annotation); >+ reference.traverse(collector, (BlockScope) null); >+ if (collector.currentIndexes.isEmpty()) { >+ return null; >+ } >+ int size = collector.currentIndexes.size(); >+ int[] result = new int[size]; >+ for (int i = 0; i < size; i++) { >+ result[size - i - 1] = ((Integer) collector.currentIndexes.pop()).intValue(); >+ } >+ return result; >+ } >+ >+ // jsr 308 >+ public static class TypeUseBinding extends ReferenceBinding { >+ private int kind; >+ public TypeUseBinding(int kind) { >+ this.tagBits = 0L; >+ this.kind = kind; >+ } >+ public int kind() { >+ return this.kind; >+ } >+ public boolean hasTypeBit(int bit) { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ } > > final static MemberValuePair[] NoValuePairs = new MemberValuePair[0]; > private static final long TAGBITS_NULLABLE_OR_NONNULL = TagBits.AnnotationNullable|TagBits.AnnotationNonNull; >@@ -91,6 +420,10 @@ > case 'T' : > if (CharOperation.equals(elementName, TypeConstants.TYPE)) > return TagBits.AnnotationForType; >+ if (CharOperation.equals(elementName, TypeConstants.TYPE_USE_TARGET)) >+ return TagBits.AnnotationForTypeUse; >+ if (CharOperation.equals(elementName, TypeConstants.TYPE_PARAMETER_TARGET)) >+ return TagBits.AnnotationForTypeParameter; > break; > } > return 0; // unknown >@@ -202,10 +535,51 @@ > 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() { >@@ -214,6 +588,9 @@ > 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 > >@@ -291,7 +668,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 >@@ -341,16 +717,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 > } > } >@@ -421,19 +800,32 @@ > } > // check (meta)target compatibility > checkTargetCompatibility: { >- long metaTagBits = annotationType.getAnnotationTagBits(); // could be forward reference >- if ((metaTagBits & TagBits.AnnotationTargetMASK) == 0) // does not specify any target restriction >+ 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 - all locations are possible including type annotations >+ break checkTargetCompatibility; >+ } > > switch (this.recipient.kind()) { > case Binding.PACKAGE : > if ((metaTagBits & TagBits.AnnotationForPackage) != 0) > break checkTargetCompatibility; > break; >+ case Binding.TYPE_USE : >+ if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { >+ // jsr 308 >+ break checkTargetCompatibility; >+ } >+ break; > case Binding.TYPE : > case Binding.GENERIC_TYPE : > if (((ReferenceBinding)this.recipient).isAnnotationType()) { >- if ((metaTagBits & (TagBits.AnnotationForAnnotationType|TagBits.AnnotationForType)) != 0) >+ if ((metaTagBits & (TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType)) != 0) > break checkTargetCompatibility; > } else if ((metaTagBits & TagBits.AnnotationForType) != 0) { > break checkTargetCompatibility; >@@ -443,24 +835,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 ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0) >+ } else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { >+ // jsr 308 - annotation on method parameter type >+ break checkTargetCompatibility; >+ } >+ } else if ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0) { > break checkTargetCompatibility; >+ } else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) { >+ // jsr 308 - annotation on local type >+ break checkTargetCompatibility; >+ } > break; >- } >+ case Binding.TYPE_PARAMETER : // jsr308 >+ if ((metaTagBits & TagBits.AnnotationForTypeParameter) != 0) { >+ break checkTargetCompatibility; >+ } >+ } > scope.problemReporter().disallowedTargetForAnnotation(this); > } > } >@@ -469,4 +885,5 @@ > > public abstract void traverse(ASTVisitor visitor, BlockScope scope); > >+ public abstract void traverse(ASTVisitor visitor, ClassScope scope); > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java >index 8860ec6..c323d47 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -55,7 +59,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) { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java >index 0eaad4a..8755951 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java >@@ -8,7 +8,7 @@ > * This is an implementation of an early-draft specification developed under the Java > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. >- * >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -105,7 +105,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$ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java >index a7af188..7198221 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java >@@ -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; > } > >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java >index 41027f8..8f9763d 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -56,7 +60,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; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java >index 803966a..797a6fb 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -17,16 +21,28 @@ > > 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; > } > > /** >@@ -70,16 +86,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 +134,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)); >+ } >+ } >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java >index fa6c8d5..87c3622 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -12,6 +16,7 @@ > > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.compiler.ASTVisitor; >+import org.eclipse.jdt.internal.compiler.lookup.Binding; > import org.eclipse.jdt.internal.compiler.lookup.BlockScope; > import org.eclipse.jdt.internal.compiler.lookup.ClassScope; > import org.eclipse.jdt.internal.compiler.lookup.Scope; >@@ -19,6 +24,7 @@ > > public class ArrayTypeReference extends SingleTypeReference { > public int dimensions; >+ public Annotation[][] annotationsOnDimensions; // jsr308 style type annotations on dimensions. > public int originalSourceEnd; > > /** >@@ -32,11 +38,24 @@ > super(source, pos); > this.originalSourceEnd = this.sourceEnd; > this.dimensions = dimensions ; >+ this.annotationsOnDimensions = null; >+ } >+ >+ public ArrayTypeReference(char[] source, int dimensions, Annotation[][] annotationsOnDimensions, long pos) { >+ this(source, dimensions, pos); >+ if (annotationsOnDimensions != null) { >+ this.bits |= ASTNode.HasTypeAnnotations; >+ } >+ this.annotationsOnDimensions = annotationsOnDimensions; > } > > public int dimensions() { > > return this.dimensions; >+ } >+ >+ public Annotation[][] getAnnotationsOnDimensions() { >+ return this.annotationsOnDimensions; > } > /** > * @return char[][] >@@ -69,11 +88,26 @@ > super.printExpression(indent, output); > if ((this.bits & IsVarArgs) != 0) { > for (int i= 0 ; i < this.dimensions - 1; i++) { >+ if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { >+ output.append(' '); >+ printAnnotations(this.annotationsOnDimensions[i], output); >+ output.append(' '); >+ } > output.append("[]"); //$NON-NLS-1$ >+ } >+ if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) { >+ output.append(' '); >+ printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output); >+ output.append(' '); > } > output.append("..."); //$NON-NLS-1$ > } else { > for (int i= 0 ; i < this.dimensions; i++) { >+ if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) { >+ output.append(" "); //$NON-NLS-1$ >+ printAnnotations(this.annotationsOnDimensions[i], output); >+ output.append(" "); //$NON-NLS-1$ >+ } > output.append("[]"); //$NON-NLS-1$ > } > } >@@ -81,14 +115,71 @@ > } > > public void traverse(ASTVisitor visitor, BlockScope scope) { >- >- visitor.visit(this, scope); >+ if (visitor.visit(this, scope)) { >+ if (this.annotations != null) { >+ int annotationsLength = this.annotations.length; >+ for (int i = 0; i < annotationsLength; i++) >+ this.annotations[i].traverse(visitor, scope); >+ } >+ if (this.annotationsOnDimensions != null) { >+ for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { >+ Annotation[] annotations2 = this.annotationsOnDimensions[i]; >+ if (annotations2 != null) { >+ for (int j = 0, max2 = annotations2.length; j < max2; j++) { >+ Annotation annotation = annotations2[j]; >+ annotation.traverse(visitor, scope); >+ } >+ } >+ } >+ } >+ } > visitor.endVisit(this, scope); > } > > public void traverse(ASTVisitor visitor, ClassScope scope) { >- >- visitor.visit(this, scope); >+ if (visitor.visit(this, scope)) { >+ if (this.annotations != null) { >+ int annotationsLength = this.annotations.length; >+ for (int i = 0; i < annotationsLength; i++) >+ this.annotations[i].traverse(visitor, scope); >+ } >+ if (this.annotationsOnDimensions != null) { >+ for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { >+ Annotation[] annotations2 = this.annotationsOnDimensions[i]; >+ if (annotations2 != null) { >+ for (int j = 0, max2 = annotations2.length; j < max2; j++) { >+ Annotation annotation = annotations2[j]; >+ annotation.traverse(visitor, scope); >+ } >+ } >+ } >+ } >+ } > visitor.endVisit(this, scope); > } >+ >+ protected TypeBinding internalResolveType(Scope scope) { >+ TypeBinding internalResolveType = super.internalResolveType(scope); >+ if (this.annotationsOnDimensions != null) { >+ switch(scope.kind) { >+ case Scope.BLOCK_SCOPE : >+ case Scope.METHOD_SCOPE : >+ for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { >+ Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i]; >+ resolveAnnotations((BlockScope) scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE)); >+ } >+ break; >+ } >+ } >+ return internalResolveType; >+ } >+ protected void resolveAnnotations(BlockScope scope) { >+ super.resolveAnnotations(scope); >+ if (this.annotationsOnDimensions != null) { >+ for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) { >+ Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i]; >+ resolveAnnotations(scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE)); >+ } >+ } >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java >index 5c1fd91..ef0c011 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752) >@@ -408,7 +412,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 >@@ -420,7 +424,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); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java >index eefb1c2..b39dea1 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -61,7 +65,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); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java >index 2dd5580..e053061 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -171,6 +175,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(); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java >index f081f32..d70d6a7 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -169,7 +173,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 { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >index 17d5ffa..70b71f7 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >@@ -5,14 +5,21 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >+import java.util.List; >+ > import org.eclipse.jdt.core.compiler.IProblem; > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.impl.*; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.codegen.*; > import org.eclipse.jdt.internal.compiler.flow.*; >@@ -41,7 +48,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 +116,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() > */ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java >index 6cb2c16..3796302 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java >@@ -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); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java >index 92a05a1..c8bf08c 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -56,7 +60,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 { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java >index 696a693..09ee5f0 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -30,6 +34,10 @@ > public TypeReference copyDims(int dim) { > return null; > } >+ >+ public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) { >+ return null; >+ } > > /* (non-Javadoc) > * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope) >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java >index 48723a6..ddf11b0 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for >@@ -19,8 +23,11 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >+import java.util.List; >+ > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.impl.*; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.codegen.*; > import org.eclipse.jdt.internal.compiler.flow.*; >@@ -189,11 +196,25 @@ > 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) { >@@ -239,7 +260,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() >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java >index 2a48484..b4d19a8 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -42,4 +46,12 @@ > } > visitor.endVisit(this, scope); > } >+ public void traverse(ASTVisitor visitor, ClassScope scope) { >+ if (visitor.visit(this, scope)) { >+ if (this.type != null) { >+ this.type.traverse(visitor, scope); >+ } >+ } >+ visitor.endVisit(this, scope); >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java >index e0f7cfb..53c7b16 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -17,6 +21,7 @@ > import org.eclipse.jdt.internal.compiler.impl.Constant; > import org.eclipse.jdt.internal.compiler.lookup.Binding; > import org.eclipse.jdt.internal.compiler.lookup.BlockScope; >+import org.eclipse.jdt.internal.compiler.lookup.ClassScope; > import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair; > import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; > import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; >@@ -241,4 +246,12 @@ > } > visitor.endVisit(this, scope); > } >+ public void traverse(ASTVisitor visitor, ClassScope scope) { >+ if (visitor.visit(this, scope)) { >+ if (this.value != null) { >+ this.value.traverse(visitor, scope); >+ } >+ } >+ visitor.endVisit(this, scope); >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >index 44f5bc4..a032c08 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752) >@@ -230,13 +234,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 */); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java >index a488177..095c9d3 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -15,6 +19,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >+import java.util.List; >+ > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.CompilationResult; >@@ -24,6 +30,7 @@ > import org.eclipse.jdt.internal.compiler.flow.FlowInfo; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.lookup.Binding; >+import org.eclipse.jdt.internal.compiler.lookup.BlockScope; > import org.eclipse.jdt.internal.compiler.lookup.ClassScope; > import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; > import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; >@@ -35,6 +42,7 @@ > import org.eclipse.jdt.internal.compiler.parser.Parser; > import org.eclipse.jdt.internal.compiler.problem.AbortMethod; > import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; > > public class MethodDeclaration extends AbstractMethodDeclaration { > >@@ -101,6 +109,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; >@@ -146,6 +155,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; > } >@@ -163,6 +180,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 > } >@@ -175,9 +193,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; > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java >index a1d1bd1..46038bb 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -71,4 +75,17 @@ > } > visitor.endVisit(this, scope); > } >+ public void traverse(ASTVisitor visitor, ClassScope scope) { >+ if (visitor.visit(this, scope)) { >+ if (this.type != null) { >+ this.type.traverse(visitor, scope); >+ } >+ if (this.memberValuePairs != null) { >+ int memberValuePairsLength = this.memberValuePairs.length; >+ for (int i = 0; i < memberValuePairsLength; i++) >+ this.memberValuePairs[i].traverse(visitor, scope); >+ } >+ } >+ visitor.endVisit(this, scope); >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java >index e1cd52e..859974b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contribution for Bug 342671 - ClassCastException: org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ArrayBinding >@@ -35,6 +39,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 +70,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; > } > > /** >@@ -166,18 +188,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; > } >@@ -234,7 +256,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); >@@ -300,6 +322,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]); >@@ -336,11 +363,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$ > } > } >@@ -355,6 +397,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++) { >@@ -368,6 +424,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++) { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >index 40bdc86..5a991d3 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contribution for Bug 342671 - ClassCastException: org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ArrayBinding >@@ -30,6 +34,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 +59,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; > } > > /** >@@ -81,6 +100,10 @@ > */ > protected TypeBinding getTypeBinding(Scope scope) { > return null; // not supported here - combined with resolveType(...) >+ } >+ >+ public boolean isParameterizedTypeReference() { >+ return true; > } > > /* >@@ -175,32 +198,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; > } >@@ -277,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$ > } > } >@@ -302,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); > } >@@ -311,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); > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java >index e593ad0..5d4d0a0 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -140,7 +144,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(); >@@ -173,7 +177,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, >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java >index f6d5e3e..69c787b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -32,6 +36,17 @@ > //return a type reference copy of me with some dimensions > //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) { >@@ -122,7 +137,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 +149,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); > } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java >index e64bf0c..8c0a9af 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -62,4 +66,16 @@ > } > visitor.endVisit(this, scope); > } >+ >+ public void traverse(ASTVisitor visitor, ClassScope scope) { >+ if (visitor.visit(this, scope)) { >+ if (this.type != null) { >+ this.type.traverse(visitor, scope); >+ } >+ if (this.memberValue != null) { >+ this.memberValue.traverse(visitor, scope); >+ } >+ } >+ visitor.endVisit(this, scope); >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java >index 9d3b703..b7e68a2 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -33,6 +37,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 +69,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 +103,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); > } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java >index c4b035b..c8ce224 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -172,7 +176,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); >@@ -191,7 +195,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); >@@ -201,7 +205,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++) >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java >index 7a3401b..0740c3d 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -215,7 +219,9 @@ > } > > // catch var is always set >- LocalVariableBinding catchArg = this.catchArguments[i].binding; >+ Argument catchVariable = this.catchArguments[i]; >+ catchVariable.bits |= ASTNode.IsUnionType; >+ LocalVariableBinding catchArg = catchVariable.binding; > catchInfo.markAsDefinitelyAssigned(catchArg); > catchInfo.markAsDefinitelyNonNull(catchArg); > /* >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >index a694c1a..a0ae6ca 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contribution for Bug 360328 - [compiler][null] detect null problems in nested code (local class inside a loop) >@@ -906,7 +910,10 @@ > > public StringBuffer 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 : >@@ -958,8 +965,6 @@ > return print(tab, output); > } > >- >- > public void resolve() { > SourceTypeBinding sourceType = this.binding; > if (sourceType == null) { >@@ -971,9 +976,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 >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java >index 37edacc..24a20d4 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java >@@ -1,16 +1,24 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >+import java.util.List; >+ > import org.eclipse.jdt.internal.compiler.ASTVisitor; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; >+import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants; > import org.eclipse.jdt.internal.compiler.codegen.CodeStream; > import org.eclipse.jdt.internal.compiler.lookup.Binding; > import org.eclipse.jdt.internal.compiler.lookup.BlockScope; >@@ -20,7 +28,7 @@ > > public class TypeParameter extends AbstractVariableDeclaration { > >- public TypeVariableBinding binding; >+ public TypeVariableBinding binding; > public TypeReference[] bounds; > > /** >@@ -42,8 +50,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 +101,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 +137,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 +162,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); > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java >index 7b07cb3..1faf242 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java >@@ -5,19 +5,30 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >+import java.util.ArrayList; >+import java.util.List; >+ > import org.eclipse.jdt.internal.compiler.ASTVisitor; >+import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext; >+import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants; > import org.eclipse.jdt.internal.compiler.flow.FlowContext; > import org.eclipse.jdt.internal.compiler.flow.FlowInfo; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.impl.Constant; > import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; >+import org.eclipse.jdt.internal.compiler.lookup.Binding; > import org.eclipse.jdt.internal.compiler.lookup.BlockScope; > import org.eclipse.jdt.internal.compiler.lookup.ClassScope; >+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; > import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; > import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; > import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; >@@ -28,12 +39,210 @@ > import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; > > public abstract class TypeReference extends Expression { >- > public static final TypeReference[] NO_TYPE_ARGUMENTS = new TypeReference[0]; >+static class AnnotationCollector extends ASTVisitor { >+ List annotationContexts; >+ TypeReference typeReference; >+ int targetType; >+ Annotation[] primaryAnnotations; >+ int info = -1; >+ int info2 = -1; >+ LocalVariableBinding localVariable; >+ Annotation[][] annotationsOnDimensions; >+ Wildcard currentWildcard; >+ >+ public AnnotationCollector( >+ TypeParameter typeParameter, >+ int targetType, >+ int typeParameterIndex, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = typeParameter.type; >+ this.targetType = targetType; >+ this.primaryAnnotations = typeParameter.annotations; >+ this.info = typeParameterIndex; >+ } >+ >+ public AnnotationCollector( >+ LocalDeclaration localDeclaration, >+ int targetType, >+ LocalVariableBinding localVariable, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = localDeclaration.type; >+ this.targetType = targetType; >+ this.primaryAnnotations = localDeclaration.annotations; >+ this.localVariable = localVariable; >+ } >+ >+ public AnnotationCollector( >+ LocalDeclaration localDeclaration, >+ int targetType, >+ int parameterIndex, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = localDeclaration.type; >+ this.targetType = targetType; >+ this.primaryAnnotations = localDeclaration.annotations; >+ this.info = parameterIndex; >+ } >+ >+ public AnnotationCollector( >+ MethodDeclaration methodDeclaration, >+ int targetType, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = methodDeclaration.returnType; >+ this.targetType = targetType; >+ this.primaryAnnotations = methodDeclaration.annotations; >+ } >+ >+ public AnnotationCollector( >+ FieldDeclaration fieldDeclaration, >+ int targetType, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = fieldDeclaration.type; >+ this.targetType = targetType; >+ this.primaryAnnotations = fieldDeclaration.annotations; >+ } >+ public AnnotationCollector( >+ TypeReference typeReference, >+ int targetType, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = typeReference; >+ this.targetType = targetType; >+ } >+ public AnnotationCollector( >+ TypeReference typeReference, >+ int targetType, >+ int info, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = typeReference; >+ this.info = info; >+ this.targetType = targetType; >+ } >+ public AnnotationCollector( >+ TypeReference typeReference, >+ int targetType, >+ int info, >+ int typeIndex, >+ List annotationContexts) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = typeReference; >+ this.info = info; >+ this.targetType = targetType; >+ this.info2 = typeIndex; >+ } >+ public AnnotationCollector( >+ TypeReference typeReference, >+ int targetType, >+ int info, >+ List annotationContexts, >+ Annotation[][] annotationsOnDimensions) { >+ this.annotationContexts = annotationContexts; >+ this.typeReference = typeReference; >+ this.info = info; >+ this.targetType = targetType; >+ this.annotationsOnDimensions = annotationsOnDimensions; >+ } >+ private boolean internalVisit(Annotation annotation) { >+ AnnotationContext annotationContext = null; >+ if (annotation.isRuntimeTypeInvisible()) { >+ annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.INVISIBLE, this.annotationsOnDimensions); >+ } else if (annotation.isRuntimeTypeVisible()) { >+ annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.VISIBLE, this.annotationsOnDimensions); >+ } >+ if (annotationContext != null) { >+ annotationContext.wildcard = this.currentWildcard; >+ switch(this.targetType) { >+ case AnnotationTargetTypeConstants.THROWS : >+ case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER : >+ case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER : >+ case AnnotationTargetTypeConstants.METHOD_PARAMETER : >+ case AnnotationTargetTypeConstants.TYPE_CAST : >+ case AnnotationTargetTypeConstants.TYPE_INSTANCEOF : >+ case AnnotationTargetTypeConstants.OBJECT_CREATION : >+ case AnnotationTargetTypeConstants.CLASS_LITERAL : >+ case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS: >+ annotationContext.info = this.info; >+ break; >+ case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND : >+ case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND : >+ annotationContext.info2 = this.info2; >+ annotationContext.info = this.info; >+ break; >+ case AnnotationTargetTypeConstants.LOCAL_VARIABLE : >+ annotationContext.variableBinding = this.localVariable; >+ break; >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL : >+ case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL : >+ annotationContext.info2 = this.info2; >+ annotationContext.info = this.info; >+ } >+ this.annotationContexts.add(annotationContext); >+ } >+ return true; >+ } >+ public boolean visit(MarkerAnnotation annotation, BlockScope scope) { >+ return internalVisit(annotation); >+ } >+ public boolean visit(NormalAnnotation annotation, BlockScope scope) { >+ return internalVisit(annotation); >+ } >+ public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) { >+ return internalVisit(annotation); >+ } >+ public boolean visit(Wildcard wildcard, BlockScope scope) { >+ this.currentWildcard = wildcard; >+ return true; >+ } >+ public boolean visit(Argument argument, BlockScope scope) { >+ if ((argument.bits & ASTNode.IsUnionType) == 0) { >+ return true; >+ } >+ for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) { >+ int startPC = this.localVariable.initializationPCs[i << 1]; >+ int endPC = this.localVariable.initializationPCs[(i << 1) + 1]; >+ if (startPC != endPC) { // only entries for non zero length >+ return true; >+ } >+ } >+ return false; >+ } >+ public boolean visit(Argument argument, ClassScope scope) { >+ if ((argument.bits & ASTNode.IsUnionType) == 0) { >+ return true; >+ } >+ for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) { >+ int startPC = this.localVariable.initializationPCs[i << 1]; >+ int endPC = this.localVariable.initializationPCs[(i << 1) + 1]; >+ if (startPC != endPC) { // only entries for non zero length >+ return true; >+ } >+ } >+ return false; >+ } >+ public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) { >+ for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) { >+ int startPC = this.localVariable.initializationPCs[i << 1]; >+ int endPC = this.localVariable.initializationPCs[(i << 1) + 1]; >+ if (startPC != endPC) { // only entries for non zero length >+ return true; >+ } >+ } >+ return false; >+ } >+ public void endVisit(Wildcard wildcard, BlockScope scope) { >+ this.currentWildcard = null; >+ } >+} > /* > * Answer a base type reference (can be an array of base type). > */ >-public static final TypeReference baseTypeReference(int baseType, int dim) { >+public static final TypeReference baseTypeReference(int baseType, int dim, Annotation [][] dimAnnotations) { > > if (dim == 0) { > switch (baseType) { >@@ -59,25 +268,28 @@ > } > 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) { >@@ -90,8 +302,56 @@ > // only parameterized type references have bounds > } > public abstract TypeReference copyDims(int dim); >+public abstract TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions); > public int dimensions() { > return 0; >+} >+public AnnotationContext[] getAllAnnotationContexts(int targetType) { >+ List allAnnotationContexts = new ArrayList(); >+ AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts); >+ this.traverse(collector, (BlockScope) null); >+ return (AnnotationContext[]) allAnnotationContexts.toArray(new AnnotationContext[allAnnotationContexts.size()]); >+} >+/** >+ * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode >+ * @param targetType >+ * @param info >+ * @param allAnnotationContexts >+ */ >+public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts) { >+ AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts); >+ this.traverse(collector, (BlockScope) null); >+} >+/** >+ * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode >+ * @param targetType >+ * @param info >+ * @param allAnnotationContexts >+ */ >+public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts, Annotation[][] annotationsOnDimensions) { >+ AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts, annotationsOnDimensions); >+ this.traverse(collector, (BlockScope) null); >+ if (annotationsOnDimensions != null) { >+ for (int i = 0, max = annotationsOnDimensions.length; i < max; i++) { >+ Annotation[] annotationsOnDimension = annotationsOnDimensions[i]; >+ if (annotationsOnDimension != null) { >+ for (int j = 0, max2 = annotationsOnDimension.length; j< max2; j++) { >+ annotationsOnDimension[j].traverse(collector, (BlockScope) null); >+ } >+ } >+ } >+ } >+} >+public void getAllAnnotationContexts(int targetType, int info, int typeIndex, List allAnnotationContexts) { >+ AnnotationCollector collector = new AnnotationCollector(this, targetType, info, typeIndex, allAnnotationContexts); >+ this.traverse(collector, (BlockScope) null); >+} >+public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) { >+ AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts); >+ this.traverse(collector, (BlockScope) null); >+} >+public Annotation[][] getAnnotationsOnDimensions() { >+ return null; > } > > public abstract char[] getLastToken(); >@@ -159,6 +419,15 @@ > && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) { > scope.problemReporter().rawTypeReference(this, type); > } >+ if (this.annotations != null) { >+ switch(scope.kind) { >+ case Scope.BLOCK_SCOPE : >+ case Scope.METHOD_SCOPE : >+ resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE)); >+ break; >+ } >+ } >+ > if (hasError) { > // do not store the computed type, keep the problem type instead > return type; >@@ -169,6 +438,9 @@ > return true; > } > >+public boolean isParameterizedTypeReference() { >+ return false; >+} > protected void reportDeprecatedType(TypeBinding type, Scope scope, int index) { > scope.problemReporter().deprecatedType(type, this, index); > } >@@ -209,13 +481,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 { >@@ -223,7 +495,7 @@ > ref.tagBits |= TagBits.PauseHierarchyCheck; > pauseHierarchyCheck = true; > } >- return resolveType(classScope); >+ return resolveType(classScope); > } finally { > if (pauseHierarchyCheck) { > ref.tagBits &= ~TagBits.PauseHierarchyCheck; >@@ -234,4 +506,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)); >+ } >+} > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java >index f1d7415..bbf7806 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -156,4 +160,9 @@ > return output; > } > >+ public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java >index 73b985d..42cb5e0 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 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 > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -59,7 +63,7 @@ > boundType = scope.kind == Scope.CLASS_SCOPE > ? this.bound.resolveType((ClassScope)scope) > : this.bound.resolveType((BlockScope)scope, true /* check bounds*/); >- >+ this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations); > if (boundType == null) { > return null; > } >@@ -89,6 +93,7 @@ > public TypeBinding resolveType(BlockScope scope, boolean checkBounds) { > if (this.bound != null) { > this.bound.resolveType(scope, checkBounds); >+ this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations); > } > return null; > } >@@ -96,6 +101,7 @@ > public TypeBinding resolveType(ClassScope scope) { > if (this.bound != null) { > this.bound.resolveType(scope); >+ this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations); > } > return null; > } >@@ -104,7 +110,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) { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java >index 0a91ea8..31694c6 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java >@@ -8,7 +8,7 @@ > * This is an implementation of an early-draft specification developed under the Java > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. >- * >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -132,4 +132,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) > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java >new file mode 100644 >index 0000000..7820176 >--- /dev/null >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java >@@ -0,0 +1,64 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.compiler.codegen; >+ >+import org.eclipse.jdt.internal.compiler.ast.Annotation; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; >+import org.eclipse.jdt.internal.compiler.ast.Wildcard; >+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; >+ >+public class AnnotationContext { >+ public static final int VISIBLE = 0x1; >+ public static final int INVISIBLE = 0x2; >+ public Annotation annotation; >+ public TypeReference typeReference; >+ public int targetType; >+ public int info; >+ public int info2; >+ public int visibility; >+ public Annotation[] primaryAnnotations; >+ public LocalVariableBinding variableBinding; >+ public Annotation[][] annotationsOnDimensions; >+ public Wildcard wildcard; >+ >+ public AnnotationContext( >+ Annotation annotation, >+ TypeReference typeReference, >+ int targetType, >+ Annotation[] primaryAnnotations, >+ int visibility, >+ Annotation[][] annotationsOnDimensions) { >+ this.annotation = annotation; >+ this.typeReference = typeReference; >+ this.targetType = targetType; >+ this.primaryAnnotations = primaryAnnotations; >+ this.visibility = visibility; >+ this.annotationsOnDimensions = annotationsOnDimensions; >+ } >+ >+ public String toString() { >+ return "AnnotationContext [annotation=" //$NON-NLS-1$ >+ + this.annotation >+ + ", typeReference=" //$NON-NLS-1$ >+ + this.typeReference >+ + ", targetType=" //$NON-NLS-1$ >+ + this.targetType >+ + ", info =" //$NON-NLS-1$ >+ + this.info >+ + ", boundIndex=" //$NON-NLS-1$ >+ + this.info2 >+ + "]"; //$NON-NLS-1$ >+ } >+} >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java >new file mode 100644 >index 0000000..d0449d5 >--- /dev/null >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.compiler.codegen; >+ >+public interface AnnotationTargetTypeConstants { >+ int METHOD_RECEIVER = 0x06; >+ int METHOD_RECEIVER_GENERIC_OR_ARRAY = 0x07; >+ int METHOD_RETURN_TYPE = 0x0A; >+ int METHOD_RETURN_TYPE_GENERIC_OR_ARRAY = 0x0B; >+ int METHOD_PARAMETER = 0x0C; >+ int METHOD_PARAMETER_GENERIC_OR_ARRAY = 0x0D; >+ int FIELD = 0x0E; >+ int FIELD_GENERIC_OR_ARRAY = 0x0F; >+ int CLASS_TYPE_PARAMETER_BOUND = 0x10; >+ int CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x11; >+ int METHOD_TYPE_PARAMETER_BOUND = 0x12; >+ int METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x13; >+ int CLASS_EXTENDS_IMPLEMENTS = 0x14; >+ int CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY = 0x15; >+ int THROWS = 0x16; >+ int THROWS_GENERIC_OR_ARRAY = 0x17; >+ int WILDCARD_BOUND = 0x1C; >+ int WILDCARD_BOUND_GENERIC_OR_ARRAY = 0x1D; >+ int METHOD_TYPE_PARAMETER = 0x20; >+ int METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x21; >+ int CLASS_TYPE_PARAMETER = 0x22; >+ int CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x23; >+ int TYPE_CAST = 0x00; >+ int TYPE_CAST_GENERIC_OR_ARRAY = 0x01; >+ int TYPE_INSTANCEOF = 0x02; >+ int TYPE_INSTANCEOF_GENERIC_OR_ARRAY = 0x03; >+ int OBJECT_CREATION = 0x04; >+ int OBJECT_CREATION_GENERIC_OR_ARRAY = 0x05; >+ int LOCAL_VARIABLE = 0x08; >+ int LOCAL_VARIABLE_GENERIC_OR_ARRAY = 0x09; >+ int TYPE_ARGUMENT_CONSTRUCTOR_CALL = 0x18; >+ int TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY = 0x19; >+ int TYPE_ARGUMENT_METHOD_CALL = 0x1A; >+ int TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY = 0x1B; >+ int CLASS_LITERAL = 0x1E; >+ int CLASS_LITERAL_GENERIC_OR_ARRAY = 0x1F; >+} >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java >index 51a4e83..dc03a11 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -33,4 +37,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$ > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java >index 402d644..eb5645b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -17,11 +21,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 +637,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 +649,6 @@ > this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_checkcast; > writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding)); > } >- > public void d2f() { > this.countLabels = 0; > this.stackDepth--; >@@ -1690,11 +1697,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 +1856,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 +1912,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++) { >@@ -2429,7 +2438,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); >@@ -2455,7 +2464,7 @@ > arraylength(); > dup(); > istore_1(); >- newArray((ArrayBinding) enumArray); >+ newArray(null, (ArrayBinding) enumArray); > dup(); > astore_2(); > iconst_0(); >@@ -3826,12 +3835,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(); >@@ -3869,8 +3880,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); >@@ -3904,7 +3914,7 @@ > default: > receiverAndArgsSize++; > break; >- } >+ } > } > } > } >@@ -3950,6 +3960,9 @@ > declaringClass.constantPoolName(), > methodBinding.selector, > methodBinding.signature(this.classFile)); >+} >+public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) { >+ this.invoke(opcode, methodBinding, declaringClass, null); > } > > protected void invokeAccessibleObjectSetAccessible() { >@@ -5577,8 +5590,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) { >@@ -5589,9 +5608,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) >@@ -5613,8 +5634,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 : >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java >index e61cde3..bbe11ea 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -20,6 +24,7 @@ > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.compiler.ClassFile; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.lookup.Binding; > import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; >@@ -272,7 +277,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; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java >new file mode 100644 >index 0000000..e13774d >--- /dev/null >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java >@@ -0,0 +1,116 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.compiler.codegen; >+ >+import 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); >+ } >+} >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java >index cd163a2..8d0573d 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contribution for >@@ -32,6 +36,8 @@ > public static final int GENERIC_TYPE = TYPE | ASTNode.Bit12; > public static final int TYPE_PARAMETER = TYPE | ASTNode.Bit13; > public static final int INTERSECTION_TYPE = TYPE | ASTNode.Bit14; >+ // jsr 308 >+ public static final int TYPE_USE = TYPE | ASTNode.Bit15; > > // Shared binding collections > public static final TypeBinding[] NO_TYPES = new TypeBinding[0]; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >index 25fee09..10d611f 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contribution for bug 186342 [compiler][null] Using annotations for null checking >@@ -783,6 +787,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]; >@@ -1011,8 +1034,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); > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >index 901769c..676fc8b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for >@@ -1451,10 +1455,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()) >@@ -1602,6 +1602,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 >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >index 21b1c11..ccc0064 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contribution for bug 186342 - [compiler][null] Using annotations for null checking >@@ -109,11 +113,14 @@ > long AnnotationForLocalVariable = ASTNode.Bit42L; > long AnnotationForAnnotationType = ASTNode.Bit43L; > long AnnotationForPackage = ASTNode.Bit44L; >+ long AnnotationForTypeUse = ASTNode.Bit54L; >+ long AnnotationForTypeParameter = ASTNode.Bit55L; > long AnnotationTargetMASK = AnnotationTarget > | AnnotationForType | AnnotationForField > | AnnotationForMethod | AnnotationForParameter > | AnnotationForConstructor | AnnotationForLocalVariable >- | AnnotationForAnnotationType | AnnotationForPackage; >+ | AnnotationForAnnotationType | AnnotationForPackage >+ | AnnotationForTypeUse | AnnotationForTypeParameter; > // 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention > long AnnotationSourceRetention = ASTNode.Bit45L; > long AnnotationClassRetention = ASTNode.Bit46L; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >index 95ebdc3..ae8d049 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann - Contributions for >@@ -45,14 +49,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$ >@@ -64,22 +68,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}; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >index c199de5..38af356 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >@@ -64,13 +64,16 @@ > > public static short check_table[] = null; > public static final int CurlyBracket = 2; >- private static final boolean DEBUG = false; >- private static final boolean DEBUG_AUTOMATON = false; >+ private static final boolean DEBUG = true; >+ private static final boolean DEBUG_AUTOMATON = true; > private static final String EOF_TOKEN = "$eof" ; //$NON-NLS-1$ > 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$ >@@ -788,7 +791,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]; >@@ -884,6 +905,7 @@ > this.parsingJava8Plus = this.options.sourceLevel >= ClassFileConstants.JDK1_8; > this.astLengthStack = new int[50]; > this.expressionLengthStack = new int[30]; >+ this.typeAnnotationLengthStack = new int[30]; > this.intStack = new int[50]; > this.identifierStack = new char[30][]; > this.identifierLengthStack = new int[30]; >@@ -1232,6 +1254,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) { >@@ -1287,7 +1310,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]++; >@@ -1630,8 +1665,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( >@@ -1640,6 +1673,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; >@@ -1654,8 +1695,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( >@@ -1664,6 +1703,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; >@@ -2059,7 +2105,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 >@@ -2074,6 +2120,44 @@ > 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 >@@ -2092,6 +2176,44 @@ > castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; > cast.sourceEnd = exp.sourceEnd; > } >+protected void consumeCastExpressionWithGenericsArrayWithTypeAnnotations() { >+ // CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus >+ int end = this.intStack[this.intPtr--]; >+ int dim = this.intStack[this.intPtr--]; >+ >+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); >+ TypeReference typeReference = getTypeReference(dim); >+ >+ // pop expression >+ Expression expression = this.expressionStack[this.expressionPtr--]; >+ this.expressionLengthPtr--; >+ >+ int length; >+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ typeReference.annotations = new Annotation[length], >+ 0, >+ length); >+ int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; >+ if (this.modifiersSourceStart < typeReferenceSourceStart) { >+ typeReferenceSourceStart = this.modifiersSourceStart; >+ } >+ typeReference.bits |= ASTNode.HasTypeAnnotations; >+ typeReference.sourceStart = typeReferenceSourceStart; >+ } >+ Expression cast; >+ pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); >+ this.intPtr--; >+ typeReference.sourceEnd = end - 1; >+ typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; >+ cast.sourceEnd = expression.sourceEnd; >+ if (this.modifiers != ClassFileConstants.AccDefault) { >+ problemReporter().invalidLocationForModifiers(typeReference); >+ } >+ resetModifiers(); >+} > protected void consumeCastExpressionWithNameArray() { > // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus > >@@ -2109,6 +2231,45 @@ > castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; > cast.sourceEnd = exp.sourceEnd; > } >+protected void consumeCastExpressionWithNameArrayWithTypeAnnotations() { >+ // CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus >+ >+ int end = this.intStack[this.intPtr--]; >+ >+ // handle type arguments >+ pushOnGenericsLengthStack(0); >+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); >+ >+ // pop expression >+ Expression expression = this.expressionStack[this.expressionPtr--]; >+ this.expressionLengthPtr--; >+ TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]); >+ >+ int length; >+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ typeReference.annotations = new Annotation[length], >+ 0, >+ length); >+ int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; >+ if (this.modifiersSourceStart < typeReferenceSourceStart) { >+ typeReferenceSourceStart = this.modifiersSourceStart; >+ } >+ typeReference.bits |= ASTNode.HasTypeAnnotations; >+ typeReference.sourceStart = typeReferenceSourceStart; >+ } >+ Expression cast; >+ pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); >+ typeReference.sourceEnd = end - 1; >+ typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; >+ cast.sourceEnd = expression.sourceEnd; >+ if (this.modifiers != ClassFileConstants.AccDefault) { >+ problemReporter().invalidLocationForModifiers(typeReference); >+ } >+ resetModifiers(); >+} > protected void consumeCastExpressionWithPrimitiveType() { > // CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression > >@@ -2125,6 +2286,44 @@ > castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; > cast.sourceEnd = exp.sourceEnd; > } >+protected void consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations() { >+ // CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression >+ >+ //this.intStack : posOfLeftParen dim posOfRightParen >+ int end = this.intStack[this.intPtr--]; >+ >+ // pop expression >+ Expression expression = this.expressionStack[this.expressionPtr--]; >+ this.expressionLengthPtr--; >+ >+ TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]); >+ int length; >+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ typeReference.annotations = new Annotation[length], >+ 0, >+ length); >+ int typeReferenceSourceStart = typeReference.annotations[0].sourceStart; >+ if (this.modifiersSourceStart < typeReferenceSourceStart) { >+ typeReferenceSourceStart = this.modifiersSourceStart; >+ } >+ typeReference.bits |= ASTNode.HasTypeAnnotations; >+ typeReference.sourceStart = typeReferenceSourceStart; >+ } >+ >+ Expression cast; >+ pushOnExpressionStack(cast = new CastExpression(expression, typeReference)); >+ >+ typeReference.sourceEnd = end - 1; >+ typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1; >+ cast.sourceEnd = expression.sourceEnd; >+ if (this.modifiers != ClassFileConstants.AccDefault) { >+ problemReporter().invalidLocationForModifiers(typeReference); >+ } >+ resetModifiers(); >+} > protected void consumeCastExpressionWithQualifiedGenericsArray() { > // CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus > Expression exp; >@@ -2133,7 +2332,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. > > ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(rightSide, dim); > this.intPtr--; >@@ -2141,6 +2340,44 @@ > 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 >@@ -2334,6 +2571,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; >@@ -2355,8 +2593,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 >@@ -2690,9 +2931,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(); >+ } > } > } > >@@ -2724,6 +2967,19 @@ > // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt > > 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; >@@ -2888,6 +3144,7 @@ > } > protected void consumeDimWithOrWithOutExpr() { > // DimWithOrWithOutExpr ::= '[' ']' >+ // DimWithOrWithOutExpr ::= OneOrMoreAnnotations '[' ']' > pushOnExpressionStack(null); > > if(this.currentElement != null && this.currentToken == TokenNameLBRACE) { >@@ -3097,6 +3354,7 @@ > localDeclaration.annotations = new Annotation[length], > 0, > length); >+ localDeclaration.bits |= ASTNode.HasTypeAnnotations; > } > if (hasModifiers) { > localDeclaration.declarationSourceStart = declarationSourceStart; >@@ -3105,6 +3363,7 @@ > localDeclaration.declarationSourceStart = type.sourceStart; > } > localDeclaration.type = type; >+ localDeclaration.bits |= (type.bits & ASTNode.HasTypeAnnotations); > > ForeachStatement iteratorForStatement = > new ForeachStatement( >@@ -3195,6 +3454,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; >@@ -3227,6 +3488,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) { >@@ -3248,6 +3510,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; >@@ -3265,14 +3528,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); >@@ -3298,6 +3569,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 >@@ -3409,6 +3704,7 @@ > enumConstant.annotations = new Annotation[length], > 0, > length); >+ enumConstant.bits |= ASTNode.HasTypeAnnotations; > } > pushOnAstStack(enumConstant); > if (this.currentElement != null){ >@@ -3928,10 +4224,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; > } >@@ -3946,8 +4264,8 @@ > type, > this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers > arg.declarationSourceStart = modifierPositions; >+ arg.bits |= (type.bits & ASTNode.HasTypeAnnotations); > // consume annotations >- int length; > if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { > System.arraycopy( > this.expressionStack, >@@ -3955,6 +4273,7 @@ > arg.annotations = new Annotation[length], > 0, > length); >+ arg.bits |= ASTNode.HasTypeAnnotations; > RecoveredType currentRecoveryType = this.currentRecoveryType(); > if (currentRecoveryType != null) > currentRecoveryType.annotationsConsumed(arg.annotations); >@@ -3974,7 +4293,37 @@ > 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 >@@ -4036,6 +4385,9 @@ > } > protected void consumeInsideCastExpressionWithQualifiedGenerics() { > // InsideCastExpressionWithQualifiedGenerics ::= $empty >+} >+protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() { >+ // InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty > } > protected void consumeInstanceOfExpression() { > // RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType >@@ -4133,8 +4485,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 >@@ -4494,8 +4849,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, >@@ -4503,9 +4860,6 @@ > 0, > length); > } >- } else { >- length = this.astLengthStack[this.astLengthPtr--]; >- this.astPtr -= length; > } > } > >@@ -4590,6 +4944,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; >@@ -4598,7 +4964,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; > } >@@ -4682,7 +5054,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--]; >@@ -4908,6 +5282,28 @@ > // Resources ::= Resources ';' Resource > concatNodeLists(); > } >+protected void consumeOneMoreTypeAnnotation() { >+ // OneOrMoreAnnotations ::= OneOrMoreAnnotations Annotation >+ this.expressionLengthPtr --; >+ Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--]; >+ pushOnTypeAnnotationStack(annotation); >+ this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++; >+ if(!this.statementRecoveryActivated && >+ this.options.sourceLevel < ClassFileConstants.JDK1_7 && >+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { >+ problemReporter().invalidUsageOfTypeAnnotations(annotation); >+} >+} >+protected void consumePotentialNameArrayType () { >+ >+ // FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorId >+ // FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorId >+ // PotentialNameArray -> $empty >+ // Dimensions including lack of have been pushed appropriately by action attached to DimsoptAnnotsopt >+ pushOnGenericsLengthStack(0); // handle type arguments >+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); >+} >+ > protected void consumeNameArrayType() { > pushOnGenericsLengthStack(0); // handle type arguments > pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); >@@ -4971,9 +5367,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' >@@ -5143,7 +5551,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' >@@ -5152,16 +5590,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( >@@ -5175,7 +5644,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( >@@ -5188,13 +5657,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' >@@ -5325,1812 +5846,2111 @@ > // PushRPAREN ::= ')' > pushOnIntStack(this.rParenPos); > } >+protected void consumeUnannotatedType() { >+ /* We go through some song & dance here to get the type annotations stacks >+ to reflect the fact that this type was unannotated. Using a dummy non-terminal >+ with an empty rhs leads to conflicts in many places :-( >+ */ >+ pushOnTypeAnnotationLengthStack(0); // either done or else made room. >+ int dims = this.intStack[this.intPtr]; >+ if (dims != 0) { >+ System.arraycopy( >+ this.typeAnnotationLengthStack, >+ this.typeAnnotationLengthPtr - dims, >+ this.typeAnnotationLengthStack, >+ this.typeAnnotationLengthPtr - dims + 1, >+ dims); >+ this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims] = 0; // tag type as unannotated >+ } >+} >+protected void consumeAnnotatedType() { >+ /* We go through some song & dance here to get the type annotations stacks >+ to reflect the fact that this type was unannotated. Using a dummy non-terminal >+ with an empty rhs leads to conflicts in many places :-( >+ */ >+ int dims = this.intStack[this.intPtr]; >+ if (dims != 0) { >+ int counter = 0; >+ for (int i = 0; i < dims; i++) { >+ // we count existing dimensions with annotations >+ counter += this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1 + i]; >+ } >+ System.arraycopy( >+ this.typeAnnotationLengthStack, >+ this.typeAnnotationLengthPtr - dims + 1, >+ this.typeAnnotationLengthStack, >+ this.typeAnnotationLengthPtr - dims + 2, >+ dims); >+ int length = this.expressionLengthStack[this.expressionLengthPtr--]; >+ this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1] = length; >+ int typeAnnotationStackLength = this.typeAnnotationStack.length; >+ if (this.typeAnnotationPtr + counter + length >= typeAnnotationStackLength) { >+ System.arraycopy( >+ this.typeAnnotationStack, >+ 0, >+ this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement], >+ 0, >+ typeAnnotationStackLength); >+ } >+ System.arraycopy( >+ this.typeAnnotationStack, >+ this.typeAnnotationPtr - counter + 1, >+ this.typeAnnotationStack, >+ this.typeAnnotationPtr - counter + 1 + length, >+ counter); >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ this.typeAnnotationStack, >+ this.typeAnnotationPtr - counter + 1, >+ length); >+ this.typeAnnotationPtr += length; >+ this.typeAnnotationLengthPtr++; >+ } else { >+ int length = this.expressionLengthStack[this.expressionLengthPtr--]; >+ int typeAnnotationStackLength = this.typeAnnotationStack.length; >+ if (this.typeAnnotationPtr + length >= typeAnnotationStackLength) { >+ System.arraycopy( >+ this.typeAnnotationStack, >+ 0, >+ this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement], >+ 0, >+ typeAnnotationStackLength); >+ } >+ System.arraycopy( >+ this.expressionStack, >+ (this.expressionPtr -= length) + 1, >+ this.typeAnnotationStack, >+ this.typeAnnotationPtr + 1, >+ length); >+ this.typeAnnotationPtr += length; >+ pushOnTypeAnnotationLengthStack(length); >+ } >+// if (this.modifiers != ClassFileConstants.AccDefault) { >+// problemReporter().invalidLocationForModifiers(typeReference); >+// } >+// resetModifiers(); >+} >+protected void consumeTypeAnnotation (boolean markAsUnattached) { >+ if(!this.statementRecoveryActivated && >+ this.options.sourceLevel < ClassFileConstants.JDK1_7 && >+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { >+ problemReporter().invalidUsageOfTypeAnnotations((Annotation) this.expressionStack[this.expressionPtr]); >+ } >+ this.expressionLengthPtr --; >+ Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--]; >+ pushOnTypeAnnotationStack(annotation); >+ if (markAsUnattached) { >+ if (this.unattachedAnnotationPtr == -1) { >+ this.unattachedAnnotationPtr = this.typeAnnotationPtr; >+ } else { >+ this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++; >+ } >+ } >+} >+protected void consumeDimsWithTrailingAnnotsopt() { >+ // DimsoptAnnotsopt -> DimsAnnotLoop >+ pushOnIntStack(this.dimensions); >+ this.dimensions = 0; >+ if (this.unattachedAnnotationPtr == -1) { >+ pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg) >+ } else { >+ this.unattachedAnnotationPtr = -1; // reset this and leave the annotation stacks as they are. >+ } >+} >+protected void consumeZeroTypeAnnotations(boolean shouldPush) { >+ if (shouldPush) { >+ pushOnTypeAnnotationLengthStack(0); >+ } else { >+ this.typeAnnotationLengthPtr --; // pop the 0 from the length stack >+ } >+} >+protected void consumeEmptyDimsoptAnnotsopt() { >+ // DimsoptAnnotsopt ::= $empty >+ pushOnIntStack(0); // signal a non array >+ pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg) >+} >+protected void consumeRightParenForUnannotatedTypeCast() { >+ consumeUnannotatedType(); >+ // PushRPAREN ::= ')' >+ pushOnIntStack(this.rParenPos); >+} >+protected void consumeRightParenForNameUnannotatedTypeCast() { >+ pushOnIntStack(0); // signal a non array >+ consumeUnannotatedType(); >+ // remove the fake dimension >+ this.intPtr--; >+ // PushRPAREN ::= ')' >+ pushOnIntStack(this.rParenPos); >+} >+protected void consumeRightParenForAnnotatedTypeCast() { >+ consumeUnannotatedType(); >+ // PushRPAREN ::= ')' >+ pushOnIntStack(this.rParenPos); >+} >+protected void consumeRightParenForNameAndAnnotatedTypeCast() { >+ // push a zero for dimensions >+ pushOnIntStack(0); >+ consumeUnannotatedType(); >+ // remove the fake dimension >+ this.intPtr--; >+ // PushRPAREN ::= ')' >+ pushOnIntStack(this.rParenPos); >+} > // This method is part of an automatic generation : do NOT edit-modify > protected void consumeRule(int act) { > switch ( act ) { >- case 30 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); } //$NON-NLS-1$ >+ case 32 : if (DEBUG) { System.out.println("Type ::= TypeInternal"); } //$NON-NLS-1$ >+ consumeUnannotatedType(); >+ break; >+ >+ case 34 : if (DEBUG) { System.out.println("Type0 ::= TypeInternal"); } //$NON-NLS-1$ >+ consumeUnannotatedType(); >+ break; >+ >+ case 35 : if (DEBUG) { System.out.println("TypeInternal ::= PrimitiveType"); } //$NON-NLS-1$ > consumePrimitiveType(); > break; > >- case 44 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ >- consumeReferenceType(); >+ case 49 : if (DEBUG) { System.out.println("ReferenceType ::= ReferenceType0"); } //$NON-NLS-1$ >+ consumeUnannotatedType(); > break; > >- case 48 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$ >- consumeClassOrInterfaceName(); >+ case 50 : if (DEBUG) { System.out.println("ReferenceType ::= Modifiers ReferenceType0"); } //$NON-NLS-1$ >+ consumeAnnotatedType(); > break; > >- case 49 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); } //$NON-NLS-1$ >- consumeClassOrInterface(); >+ case 51 : if (DEBUG) { System.out.println("ReferenceType0 ::= ClassOrInterfaceType0"); } //$NON-NLS-1$ >+ consumeReferenceType(); > break; > >- case 50 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); } //$NON-NLS-1$ >- consumeGenericType(); >+ case 53 : if (DEBUG) { System.out.println("Annotationsopt ::="); } //$NON-NLS-1$ >+ consumeZeroTypeAnnotations(true); > break; > >- case 51 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$ >+ case 58 : if (DEBUG) { System.out.println("ClassOrInterface ::= ClassOrInterface0"); } //$NON-NLS-1$ >+ consumeZeroTypeAnnotations(true); >+ break; >+ >+ case 59 : if (DEBUG) { System.out.println("ClassOrInterface0 ::= Name"); } //$NON-NLS-1$ >+ consumeClassOrInterfaceName(); >+ break; >+ >+ case 61 : if (DEBUG) { System.out.println("PopZeroTypeAnnotations ::="); } //$NON-NLS-1$ >+ consumeZeroTypeAnnotations(false); >+ break; >+ >+ case 62 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments..."); } //$NON-NLS-1$ >+ consumeGenericType(); >+ break; >+ >+ case 63 : if (DEBUG) { System.out.println("GenericTypeDotName ::= GenericType DOT Name"); } //$NON-NLS-1$ >+ consumeClassOrInterface(); >+ break; >+ >+ case 64 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$ > consumeGenericTypeWithDiamond(); > break; > >- case 52 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); } //$NON-NLS-1$ >- consumeArrayTypeWithTypeArgumentsName(); >- break; >- >- case 53 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$ >+ case 66 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$ > consumePrimitiveArrayType(); > break; > >- case 54 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$ >+ case 67 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$ > consumeNameArrayType(); > break; > >- case 55 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$ >+ case 68 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$ > consumeGenericTypeNameArrayType(); > break; > >- case 56 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$ >+ case 69 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$ > consumeGenericTypeArrayType(); > break; > >- case 61 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$ >+ case 74 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$ > consumeQualifiedName(); > break; > >- case 62 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$ >+ case 75 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$ > consumeCompilationUnit(); > break; > >- case 63 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$ >+ case 76 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$ > consumeInternalCompilationUnit(); > break; > >- case 64 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ >+ case 77 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ > consumeInternalCompilationUnit(); > break; > >- case 65 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ >+ case 78 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ > consumeInternalCompilationUnitWithTypes(); > break; > >- case 66 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ >+ case 79 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$ > consumeInternalCompilationUnitWithTypes(); > break; > >- case 67 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ >+ case 80 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ > consumeInternalCompilationUnit(); > break; > >- case 68 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$ >+ case 81 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$ > consumeInternalCompilationUnitWithTypes(); > break; > >- case 69 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ >+ case 82 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$ > consumeInternalCompilationUnitWithTypes(); > break; > >- case 70 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$ >+ case 83 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$ > consumeEmptyInternalCompilationUnit(); > break; > >- case 71 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$ >+ case 84 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$ > consumeReduceImports(); > break; > >- case 72 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$ >+ case 85 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$ > consumeEnterCompilationUnit(); > break; > >- case 88 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ >+ case 104 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ > consumeCatchHeader(); > break; > >- case 90 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$ >+ case 106 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$ > consumeImportDeclarations(); > break; > >- case 92 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$ >+ case 108 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$ > consumeTypeDeclarations(); > break; > >- case 93 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$ >+ case 109 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$ > consumePackageDeclaration(); > break; > >- case 94 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$ >+ case 110 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$ > consumePackageDeclarationNameWithModifiers(); > break; > >- case 95 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$ >- consumePackageDeclarationName(); >+ case 111 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$ >+ consumePackageDeclarationName(); > break; > >- case 96 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$ >+ case 112 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$ > consumePackageComment(); > break; > >- case 101 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$ >+ case 117 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 102 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); } //$NON-NLS-1$ >+ case 118 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); } //$NON-NLS-1$ > consumeSingleTypeImportDeclarationName(); > break; > >- case 103 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ >+ case 119 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 104 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$ >+ case 120 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$ > consumeTypeImportOnDemandDeclarationName(); > break; > >- case 107 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 123 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyTypeDeclaration(); > break; > >- case 111 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$ >+ case 127 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$ > consumeModifiers2(); > break; > >- case 123 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$ >+ case 139 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$ > consumeAnnotationAsModifier(); > break; > >- case 124 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$ >+ case 140 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$ > consumeClassDeclaration(); > break; > >- case 125 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$ >+ case 141 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$ > consumeClassHeader(); > break; > >- case 126 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$ >+ case 142 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$ > consumeTypeHeaderNameWithTypeParameters(); > break; > >- case 128 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$ >+ case 144 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$ > consumeClassHeaderName1(); > break; > >- case 129 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$ >+ case 145 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$ > consumeClassHeaderExtends(); > break; > >- case 130 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$ >+ case 146 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$ > consumeClassHeaderImplements(); > break; > >- case 132 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$ >+ case 148 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$ > consumeInterfaceTypeList(); > break; > >- case 133 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ >+ case 149 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$ > consumeInterfaceType(); > break; > >- case 136 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$ >+ case 152 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$ > consumeClassBodyDeclarations(); > break; > >- case 140 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$ >+ case 156 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$ > consumeClassBodyDeclaration(); > break; > >- case 141 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$ >+ case 157 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$ > consumeDiet(); > break; > >- case 142 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$ >+ case 158 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$ > consumeClassBodyDeclaration(); > break; > >- case 143 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$ >+ case 159 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$ > consumeCreateInitializer(); > break; > >- case 150 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 166 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyTypeDeclaration(); > break; > >- case 153 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 169 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type0..."); } //$NON-NLS-1$ > consumeFieldDeclaration(); > break; > >- case 155 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$ >+ case 171 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$ > consumeVariableDeclarators(); > break; > >- case 158 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$ >+ case 174 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$ > consumeEnterVariable(); > break; > >- case 159 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$ >+ case 175 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$ > consumeExitVariableWithInitialization(); > break; > >- case 160 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$ >+ case 176 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$ > consumeExitVariableWithoutInitialization(); > break; > >- case 161 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$ >+ case 177 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$ > consumeForceNoDiet(); > break; > >- case 162 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$ >+ case 178 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$ > consumeRestoreDiet(); > break; > >- case 167 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ >+ case 183 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ > // set to true to consume a method with a body > consumeMethodDeclaration(true); > break; > >- case 168 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$ >+ case 184 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$ > // set to false to consume a method without body > consumeMethodDeclaration(false); > break; > >- case 169 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$ >+ case 185 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >- case 170 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$ >+ case 186 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$ > consumeMethodHeaderNameWithTypeParameters(false); > break; > >- case 171 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$ >+ case 187 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type0 Identifier..."); } //$NON-NLS-1$ > consumeMethodHeaderName(false); > break; > >- case 172 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$ >+ case 188 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$ > consumeMethodHeaderRightParen(); > break; > >- case 173 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$ >+ case 189 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= DimsoptAnnotsopt"); } //$NON-NLS-1$ > consumeMethodHeaderExtendedDims(); > break; > >- case 174 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$ >+ case 190 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$ > consumeMethodHeaderThrowsClause(); > break; > >- case 175 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$ >+ case 191 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$ > consumeConstructorHeader(); > break; > >- case 176 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$ >+ case 192 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$ > consumeConstructorHeaderNameWithTypeParameters(); > break; > >- case 177 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$ >+ case 193 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$ > consumeConstructorHeaderName(); > break; > >- case 179 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$ >+ case 195 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$ > consumeFormalParameterList(); > break; > >- case 180 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 196 : if (DEBUG) { System.out.println("PotentialNameArray ::="); } //$NON-NLS-1$ >+ consumePotentialNameArrayType(); >+ break; >+ >+ case 197 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); } //$NON-NLS-1$ > consumeFormalParameter(false); > break; > >- case 181 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type ELLIPSIS..."); } //$NON-NLS-1$ >+ case 198 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); } //$NON-NLS-1$ > consumeFormalParameter(true); > break; > >- case 182 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$ >+ case 199 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); } //$NON-NLS-1$ >+ consumeFormalParameter(false); >+ break; >+ >+ case 200 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); } //$NON-NLS-1$ >+ consumeFormalParameter(true); >+ break; >+ >+ case 201 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); } //$NON-NLS-1$ >+ consumeFormalParameter(false); >+ break; >+ >+ case 202 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); } //$NON-NLS-1$ >+ consumeFormalParameter(true); >+ break; >+ >+ case 203 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); } //$NON-NLS-1$ >+ consumeFormalParameter(false); >+ break; >+ >+ case 204 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); } //$NON-NLS-1$ >+ consumeFormalParameter(true); >+ break; >+ >+ case 205 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$ > consumeCatchFormalParameter(); > break; > >- case 183 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$ >+ case 206 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$ > consumeCatchType(); > break; > >- case 184 : if (DEBUG) { System.out.println("UnionType ::= Type"); } //$NON-NLS-1$ >+ case 207 : if (DEBUG) { System.out.println("UnionType ::= TypeInternal"); } //$NON-NLS-1$ > consumeUnionTypeAsClassType(); > break; > >- case 185 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$ >+ case 208 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$ > consumeUnionType(); > break; > >- case 187 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$ >+ case 210 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$ > consumeClassTypeList(); > break; > >- case 188 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$ >+ case 211 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$ > consumeClassTypeElt(); > break; > >- case 189 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$ >+ case 212 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$ > consumeMethodBody(); > break; > >- case 190 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$ >+ case 213 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$ > consumeNestedMethod(); > break; > >- case 191 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$ >+ case 214 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$ > consumeStaticInitializer(); > break; > >- case 192 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$ >+ case 215 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$ > consumeStaticOnly(); > break; > >- case 193 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$ >+ case 216 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$ > consumeConstructorDeclaration() ; > break; > >- case 194 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$ >+ case 217 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$ > consumeInvalidConstructorDeclaration() ; > break; > >- case 195 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$ >+ case 218 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(0, THIS_CALL); > break; > >- case 196 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$ >+ case 219 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL); > break; > >- case 197 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$ >+ case 220 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(0,SUPER_CALL); > break; > >- case 198 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 221 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL); > break; > >- case 199 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$ >+ case 222 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(1, SUPER_CALL); > break; > >- case 200 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ >+ case 223 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL); > break; > >- case 201 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$ >+ case 224 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(2, SUPER_CALL); > break; > >- case 202 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ >+ case 225 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL); > break; > >- case 203 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$ >+ case 226 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(1, THIS_CALL); > break; > >- case 204 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ >+ case 227 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL); > break; > >- case 205 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$ >+ case 228 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$ > consumeExplicitConstructorInvocation(2, THIS_CALL); > break; > >- case 206 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ >+ case 229 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$ > consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL); > break; > >- case 207 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$ >+ case 230 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$ > consumeInterfaceDeclaration(); > break; > >- case 208 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$ >+ case 231 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$ > consumeInterfaceHeader(); > break; > >- case 209 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$ >+ case 232 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$ > consumeTypeHeaderNameWithTypeParameters(); > break; > >- case 211 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$ >+ case 234 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$ > consumeInterfaceHeaderName1(); > break; > >- case 212 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$ >+ case 235 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$ > consumeInterfaceHeaderExtends(); > break; > >- case 215 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$ >+ case 238 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$ > consumeInterfaceMemberDeclarations(); > break; > >- case 216 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 239 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyTypeDeclaration(); > break; > >- case 217 : if (DEBUG) { System.out.println("PushDefault ::="); } //$NON-NLS-1$ >+ case 240 : if (DEBUG) { System.out.println("PushDefault ::="); } //$NON-NLS-1$ > consumeInterfaceMethodDefault(); > break; > >- case 219 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader default..."); } //$NON-NLS-1$ >+ case 242 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader default..."); } //$NON-NLS-1$ > consumeInterfaceMethodDeclaration(true); > break; > >- case 220 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ >+ case 243 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$ > consumeInterfaceMethodDeclaration(false); > break; > >- case 221 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ >+ case 244 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ > consumeInvalidConstructorDeclaration(true); > break; > >- case 222 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ >+ case 245 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$ > consumeInvalidConstructorDeclaration(false); > break; > >- case 233 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ >+ case 256 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ > consumePushLeftBrace(); > break; > >- case 234 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ >+ case 257 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ > consumeEmptyArrayInitializer(); > break; > >- case 235 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ >+ case 258 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ > consumeArrayInitializer(); > break; > >- case 236 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ >+ case 259 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ > consumeArrayInitializer(); > break; > >- case 238 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ >+ case 261 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ > consumeVariableInitializers(); > break; > >- case 239 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ >+ case 262 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ > consumeBlock(); > break; > >- case 240 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ >+ case 263 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ > consumeOpenBlock() ; > break; > >- case 242 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ >+ case 265 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ > consumeBlockStatements() ; > break; > >- case 246 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ >+ case 269 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ > consumeInvalidInterfaceDeclaration(); > break; > >- case 247 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ >+ case 270 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ > consumeInvalidAnnotationTypeDeclaration(); > break; > >- case 248 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ >+ case 271 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ > consumeInvalidEnumDeclaration(); > break; > >- case 249 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ >+ case 272 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ > consumeLocalVariableDeclarationStatement(); > break; > >- case 250 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$ >+ case 273 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type0 PushModifiers..."); } //$NON-NLS-1$ > consumeLocalVariableDeclaration(); > break; > >- case 251 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$ >+ case 274 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type0..."); } //$NON-NLS-1$ > consumeLocalVariableDeclaration(); > break; > >- case 252 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ >+ case 275 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ > consumePushModifiers(); > break; > >- case 253 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ >+ case 276 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ > consumePushModifiersForHeader(); > break; > >- case 254 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ >+ case 277 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ > consumePushRealModifiers(); > break; > >- case 281 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 304 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ > consumeEmptyStatement(); > break; > >- case 282 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ >+ case 305 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ > consumeStatementLabel() ; > break; > >- case 283 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ >+ case 306 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ > consumeStatementLabel() ; > break; > >- case 284 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ >- consumeLabel() ; >+ case 307 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ >+ consumeLabel(); > break; > >- case 285 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ >+ case 308 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ > consumeExpressionStatement(); > break; > >- case 294 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 317 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementIfNoElse(); > break; > >- case 295 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 318 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementIfWithElse(); > break; > >- case 296 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ >+ case 319 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ > consumeStatementIfWithElse(); > break; > >- case 297 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 320 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementSwitch() ; > break; > >- case 298 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ >+ case 321 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ > consumeEmptySwitchBlock() ; > break; > >- case 301 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ >+ case 324 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ > consumeSwitchBlock() ; > break; > >- case 303 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ >+ case 326 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ > consumeSwitchBlockStatements() ; > break; > >- case 304 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ >+ case 327 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ > consumeSwitchBlockStatement() ; > break; > >- case 306 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ >+ case 329 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ > consumeSwitchLabels() ; > break; > >- case 307 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ >+ case 330 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ > consumeCaseLabel(); > break; > >- case 308 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ >+ case 331 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ > consumeDefaultLabel(); > break; > >- case 309 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ >+ case 332 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ > consumeStatementWhile() ; > break; > >- case 310 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ >+ case 333 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ > consumeStatementWhile() ; > break; > >- case 311 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ >+ case 334 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ > consumeStatementDo() ; > break; > >- case 312 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ >+ case 335 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ > consumeStatementFor() ; > break; > >- case 313 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ >+ case 336 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ > consumeStatementFor() ; > break; > >- case 314 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ >+ case 337 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ > consumeForInit() ; > break; > >- case 318 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ >+ case 341 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ > consumeStatementExpressionList() ; > break; > >- case 319 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ >+ case 342 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ > consumeSimpleAssertStatement() ; > break; > >- case 320 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ >+ case 343 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ > consumeAssertStatement() ; > break; > >- case 321 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ >+ case 344 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ > consumeStatementBreak() ; > break; > >- case 322 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ >+ case 345 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ > consumeStatementBreakWithLabel() ; > break; > >- case 323 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ >+ case 346 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ > consumeStatementContinue() ; > break; > >- case 324 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ >+ case 347 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ > consumeStatementContinueWithLabel() ; > break; > >- case 325 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ >+ case 348 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ > consumeStatementReturn() ; > break; > >- case 326 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ >+ case 349 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ > consumeStatementThrow(); > break; > >- case 327 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ >+ case 350 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ > consumeStatementSynchronized(); > break; > >- case 328 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ >+ case 351 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ > consumeOnlySynchronized(); > break; > >- case 329 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ >+ case 352 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ > consumeStatementTry(false, false); > break; > >- case 330 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ >+ case 353 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ > consumeStatementTry(true, false); > break; > >- case 331 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ >+ case 354 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ > consumeStatementTry(false, true); > break; > >- case 332 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ >+ case 355 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ > consumeStatementTry(true, true); > break; > >- case 333 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$ >+ case 356 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$ > consumeResourceSpecification(); > break; > >- case 334 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$ >+ case 357 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$ > consumeResourceOptionalTrailingSemiColon(false); > break; > >- case 335 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 358 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$ > consumeResourceOptionalTrailingSemiColon(true); > break; > >- case 336 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$ >+ case 359 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$ > consumeSingleResource(); > break; > >- case 337 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$ >+ case 360 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$ > consumeMultipleResources(); > break; > >- case 338 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$ >+ case 361 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$ > consumeResourceOptionalTrailingSemiColon(true); > break; > >- case 339 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); } //$NON-NLS-1$ >+ case 362 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); } //$NON-NLS-1$ > consumeResourceAsLocalVariableDeclaration(); > break; > >- case 340 : if (DEBUG) { System.out.println("Resource ::= Modifiers Type PushRealModifiers..."); } //$NON-NLS-1$ >- consumeResourceAsLocalVariableDeclaration(); >- break; >- >- case 342 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ >+ case 364 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ > consumeExitTryBlock(); > break; > >- case 344 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ >+ case 366 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ > consumeCatches(); > break; > >- case 345 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ >+ case 367 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$ > consumeStatementCatch() ; > break; > >- case 347 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ >+ case 369 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ > consumeLeftParen(); > break; > >- case 348 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ >+ case 370 : if (DEBUG) { System.out.println("PushRPARENForUnannotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForUnannotatedTypeCast(); >+ break; >+ >+ case 371 : if (DEBUG) { System.out.println("PushRPARENForNameUnannotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForNameUnannotatedTypeCast(); >+ break; >+ >+ case 372 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ > consumeRightParen(); > break; > >- case 353 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ >+ case 373 : if (DEBUG) { System.out.println("PushRPARENForAnnotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForAnnotatedTypeCast(); >+ break; >+ >+ case 374 : if (DEBUG) { System.out.println("PushRPARENForNameAndAnnotatedTypeCast ::= RPAREN"); } //$NON-NLS-1$ >+ consumeRightParenForNameAndAnnotatedTypeCast(); >+ break; >+ >+ case 379 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayThis(); > break; > >- case 354 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ >+ case 380 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ > consumePrimaryNoNewArray(); > break; > >- case 355 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ >+ case 381 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayWithName(); > break; > >- case 358 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ >+ case 384 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayNameThis(); > break; > >- case 359 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ >+ case 385 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayNameSuper(); > break; > >- case 360 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ >+ case 386 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name DOT class"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayNameWithTypeAnnotations(); >+ break; >+ >+ case 387 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name Dims DOT class"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations(); >+ break; >+ >+ case 388 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType Dims DOT"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations(); >+ break; >+ >+ case 389 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType DOT class"); } //$NON-NLS-1$ >+ consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations(); >+ break; >+ >+ case 390 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayName(); > break; > >- case 361 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ >+ case 391 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayArrayType(); > break; > >- case 362 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ >+ case 392 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayPrimitiveArrayType(); > break; > >- case 363 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ >+ case 393 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ > consumePrimaryNoNewArrayPrimitiveType(); > break; > >- case 369 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name COLON_COLON..."); } //$NON-NLS-1$ >+ case 399 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name COLON_COLON..."); } //$NON-NLS-1$ > consumeReferenceExpressionNameForm(); > break; > >- case 370 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ >+ case 400 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ > consumeReferenceExpressionTypeForm(false); > break; > >- case 371 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ >+ case 401 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); } //$NON-NLS-1$ > consumeReferenceExpressionTypeForm(true); > break; > >- case 372 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$ >+ case 402 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$ > consumeReferenceExpressionPrimaryForm(); > break; > >- case 373 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); } //$NON-NLS-1$ >- consumeReferenceExpressionSuperForm(); >- break; >- >- case 374 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$ >+ case 403 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$ > consumeEmptyTypeArguments(); > break; > >- case 376 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$ >+ case 405 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$ > consumeIdentifierOrNew(false); > break; > >- case 377 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$ >+ case 406 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$ > consumeIdentifierOrNew(true); > break; > >- case 378 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); } //$NON-NLS-1$ >+ case 407 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); } //$NON-NLS-1$ > consumeLambdaExpression(); > break; > >- case 379 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier"); } //$NON-NLS-1$ >+ case 408 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier"); } //$NON-NLS-1$ > consumeTypeElidedLambdaParameter(false); > break; > >- case 383 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$ >+ case 412 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$ > consumeFormalParameterList(); > break; > >- case 384 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$ >+ case 413 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$ > consumeTypeElidedLambdaParameter(true); > break; > >- case 387 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$ >+ case 416 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$ > consumeElidedLeftBraceAndReturn(); > break; > >- case 388 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ >+ case 417 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ > consumeAllocationHeader(); > break; > >- case 389 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ >+ case 418 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionWithTypeArguments(); > break; > >- case 390 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$ >+ case 419 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpression(); > break; > >- case 391 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ >+ case 420 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; > break; > >- case 392 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ >+ case 421 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualified() ; > break; > >- case 393 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ >+ case 422 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualified() ; > break; > >- case 394 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ >+ case 423 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; > break; > >- case 395 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$ >+ case 424 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$ > consumeEnterInstanceCreationArgumentList(); > break; > >- case 396 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ >+ case 425 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ > consumeClassInstanceCreationExpressionName() ; > break; > >- case 397 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ >+ case 426 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ > consumeClassBodyopt(); > break; > >- case 399 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ >+ case 428 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ > consumeEnterAnonymousClassBody(false); > break; > >- case 400 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ >+ case 429 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ > consumeClassBodyopt(); > break; > >- case 402 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ >+ case 431 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ > consumeEnterAnonymousClassBody(true); > break; > >- case 404 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ >+ case 433 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ > consumeArgumentList(); > break; > >- case 405 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$ >+ case 434 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new Annotationsopt PrimitiveType"); } //$NON-NLS-1$ > consumeArrayCreationHeader(); > break; > >- case 406 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ >+ case 435 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ > consumeArrayCreationHeader(); > break; > >- case 407 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ >+ case 436 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithoutInitializer(); > break; > >- case 408 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$ >+ case 437 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new Annotationsopt"); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithInitializer(); > break; > >- case 409 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ >+ case 438 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithoutInitializer(); > break; > >- case 410 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ >+ case 439 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ > consumeArrayCreationExpressionWithInitializer(); > break; > >- case 412 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ >+ case 441 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ > consumeDimWithOrWithOutExprs(); > break; > >- case 414 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ case 444 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET..."); } //$NON-NLS-1$ > consumeDimWithOrWithOutExpr(); > break; > >- case 415 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ >+ case 445 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotations LBRACKET..."); } //$NON-NLS-1$ >+ consumeDimWithOrWithOutExpr(); >+ break; >+ >+ case 446 : if (DEBUG) { System.out.println("DimsoptAnnotsopt ::="); } //$NON-NLS-1$ >+ consumeEmptyDimsoptAnnotsopt(); >+ break; >+ >+ case 447 : if (DEBUG) { System.out.println("DimsoptAnnotsopt -> DimsAnnotLoop"); } //$NON-NLS-1$ >+ consumeDimsWithTrailingAnnotsopt(); >+ break; >+ >+ case 450 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= Annotation"); } //$NON-NLS-1$ >+ consumeTypeAnnotation(true); >+ break; >+ >+ case 451 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ consumeOneDimLoop(true); >+ break; >+ >+ case 452 : if (DEBUG) { System.out.println("TypeAnnotations ::= Annotation"); } //$NON-NLS-1$ >+ consumeTypeAnnotation(false); >+ break; >+ >+ case 453 : if (DEBUG) { System.out.println("TypeAnnotations ::= TypeAnnotations Annotation"); } //$NON-NLS-1$ >+ consumeOneMoreTypeAnnotation(); >+ break; >+ >+ case 454 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ > consumeDims(); > break; > >- case 418 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >- consumeOneDimLoop(); >+ case 457 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ consumeOneDimLoop(false); > break; > >- case 419 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ >+ case 458 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); } //$NON-NLS-1$ >+ consumeOneDimLoopWithAnnotations(); >+ break; >+ >+ case 459 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ > consumeFieldAccess(false); > break; > >- case 420 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ >+ case 460 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ > consumeFieldAccess(true); > break; > >- case 421 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ >+ case 461 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ > consumeMethodInvocationName(); > break; > >- case 422 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 462 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeMethodInvocationNameWithTypeArguments(); > break; > >- case 423 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 463 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeMethodInvocationPrimaryWithTypeArguments(); > break; > >- case 424 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ >+ case 464 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ > consumeMethodInvocationPrimary(); > break; > >- case 425 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ >+ case 465 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ > consumeMethodInvocationSuperWithTypeArguments(); > break; > >- case 426 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ >+ case 466 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ > consumeMethodInvocationSuper(); > break; > >- case 427 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ >+ case 467 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ > consumeArrayAccess(true); > break; > >- case 428 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ >+ case 468 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ > consumeArrayAccess(false); > break; > >- case 429 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ >+ case 469 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ > consumeArrayAccess(false); > break; > >- case 431 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ >+ case 471 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ > consumePostfixExpression(); > break; > >- case 434 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ >+ case 474 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS,true); > break; > >- case 435 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ >+ case 475 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS,true); > break; > >- case 436 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ >+ case 476 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ > consumePushPosition(); > break; > >- case 439 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ >+ case 479 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS); > break; > >- case 440 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ >+ case 480 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS); > break; > >- case 442 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ >+ case 482 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS,false); > break; > >- case 443 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ >+ case 483 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS,false); > break; > >- case 445 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ >+ case 485 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.TWIDDLE); > break; > >- case 446 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ >+ case 486 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.NOT); > break; > >- case 448 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ >+ case 488 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ > consumeCastExpressionWithPrimitiveType(); > break; > >- case 449 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ >+ case 489 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers PrimitiveType..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations(); >+ break; >+ >+ case 490 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ > consumeCastExpressionWithGenericsArray(); > break; > >- case 450 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ >+ case 491 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithGenericsArrayWithTypeAnnotations(); >+ break; >+ >+ case 492 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ > consumeCastExpressionWithQualifiedGenericsArray(); > break; > >- case 451 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$ >+ case 493 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations(); >+ break; >+ >+ case 494 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ > consumeCastExpressionLL1(); > break; > >- case 452 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); } //$NON-NLS-1$ >+ case 495 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); } //$NON-NLS-1$ >+ consumeCastExpressionLL1WithTypeAnnotations(); >+ break; >+ >+ case 496 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); } //$NON-NLS-1$ > consumeCastExpressionWithNameArray(); > break; > >- case 453 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ >+ case 497 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name Dims..."); } //$NON-NLS-1$ >+ consumeCastExpressionWithNameArrayWithTypeAnnotations(); >+ break; >+ >+ case 498 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ > consumeOnlyTypeArgumentsForCastExpression(); > break; > >- case 454 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ >+ case 499 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ > consumeInsideCastExpression(); > break; > >- case 455 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ >+ case 500 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ > consumeInsideCastExpressionLL1(); > break; > >- case 456 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ >+ case 501 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ > consumeInsideCastExpressionWithQualifiedGenerics(); > break; > >- case 458 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ >+ case 502 : if (DEBUG) { System.out.println("InsideCastExpressionWithAnnotatedQualifiedGenerics ::="); } //$NON-NLS-1$ >+ consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); >+ break; >+ >+ case 504 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MULTIPLY); > break; > >- case 459 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ >+ case 505 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.DIVIDE); > break; > >- case 460 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ >+ case 506 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.REMAINDER); > break; > >- case 462 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ >+ case 508 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.PLUS); > break; > >- case 463 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ >+ case 509 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MINUS); > break; > >- case 465 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ >+ case 511 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LEFT_SHIFT); > break; > >- case 466 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ >+ case 512 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); > break; > >- case 467 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 513 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); > break; > >- case 469 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ >+ case 515 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS); > break; > >- case 470 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ >+ case 516 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER); > break; > >- case 471 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ >+ case 517 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS_EQUAL); > break; > >- case 472 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ >+ case 518 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER_EQUAL); > break; > >- case 474 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ >+ case 520 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ > consumeInstanceOfExpression(); > break; > >- case 476 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ >+ case 522 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); > break; > >- case 477 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ >+ case 523 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.NOT_EQUAL); > break; > >- case 479 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ >+ case 525 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND); > break; > >- case 481 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ >+ case 527 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.XOR); > break; > >- case 483 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ >+ case 529 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR); > break; > >- case 485 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ >+ case 531 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND_AND); > break; > >- case 487 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ >+ case 533 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR_OR); > break; > >- case 489 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ >+ case 535 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ > consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; > break; > >- case 492 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ >+ case 538 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ > consumeAssignment(); > break; > >- case 494 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ >+ case 540 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ > ignoreExpressionAssignment(); > break; > >- case 495 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ >+ case 541 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(EQUAL); > break; > >- case 496 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ >+ case 542 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(MULTIPLY); > break; > >- case 497 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ >+ case 543 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(DIVIDE); > break; > >- case 498 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ >+ case 544 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(REMAINDER); > break; > >- case 499 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ >+ case 545 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(PLUS); > break; > >- case 500 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ >+ case 546 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(MINUS); > break; > >- case 501 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ >+ case 547 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(LEFT_SHIFT); > break; > >- case 502 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ >+ case 548 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(RIGHT_SHIFT); > break; > >- case 503 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ >+ case 549 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT); > break; > >- case 504 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ >+ case 550 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(AND); > break; > >- case 505 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ >+ case 551 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(XOR); > break; > >- case 506 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ >+ case 552 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ > consumeAssignmentOperator(OR); > break; > >- case 507 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$ >+ case 553 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$ > consumeExpression(); > break; > >- case 510 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ >+ case 556 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ > consumeEmptyExpression(); > break; > >- case 515 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 561 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyClassBodyDeclarationsopt(); > break; > >- case 516 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ >+ case 562 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ > consumeClassBodyDeclarationsopt(); > break; > >- case 517 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ >+ case 563 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ > consumeDefaultModifiers(); > break; > >- case 518 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ >+ case 564 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ > consumeModifiers(); > break; > >- case 519 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ >+ case 565 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ > consumeEmptyBlockStatementsopt(); > break; > >- case 521 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ >+ case 567 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ > consumeEmptyDimsopt(); > break; > >- case 523 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ >+ case 569 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ > consumeEmptyArgumentListopt(); > break; > >- case 527 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ >+ case 573 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ > consumeFormalParameterListopt(); > break; > >- case 531 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 577 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyInterfaceMemberDeclarationsopt(); > break; > >- case 532 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ >+ case 578 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ > consumeInterfaceMemberDeclarationsopt(); > break; > >- case 533 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ >+ case 579 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ > consumeNestedType(); > break; > >- case 534 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ >+ case 580 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ > consumeEmptyForInitopt(); > break; > >- case 536 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ >+ case 582 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ > consumeEmptyForUpdateopt(); > break; > >- case 540 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ >+ case 586 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ > consumeEmptyCatchesopt(); > break; > >- case 542 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ >+ case 588 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ > consumeEnumDeclaration(); > break; > >- case 543 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ >+ case 589 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ > consumeEnumHeader(); > break; > >- case 544 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ >+ case 590 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ > consumeEnumHeaderName(); > break; > >- case 545 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ >+ case 591 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ > consumeEnumHeaderNameWithTypeParameters(); > break; > >- case 546 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ >+ case 592 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ > consumeEnumBodyNoConstants(); > break; > >- case 547 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ >+ case 593 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ > consumeEnumBodyNoConstants(); > break; > >- case 548 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ >+ case 594 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ > consumeEnumBodyWithConstants(); > break; > >- case 549 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ >+ case 595 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ > consumeEnumBodyWithConstants(); > break; > >- case 551 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ >+ case 597 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ > consumeEnumConstants(); > break; > >- case 552 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ >+ case 598 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ > consumeEnumConstantHeaderName(); > break; > >- case 553 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ >+ case 599 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ > consumeEnumConstantHeader(); > break; > >- case 554 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ >+ case 600 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ > consumeEnumConstantWithClassBody(); > break; > >- case 555 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ >+ case 601 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ > consumeEnumConstantNoClassBody(); > break; > >- case 556 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ >+ case 602 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ > consumeArguments(); > break; > >- case 557 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ >+ case 603 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ > consumeEmptyArguments(); > break; > >- case 559 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ >+ case 605 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ > consumeEnumDeclarations(); > break; > >- case 560 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 606 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyEnumDeclarations(); > break; > >- case 562 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ >+ case 608 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ > consumeEnhancedForStatement(); > break; > >- case 563 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ >+ case 609 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ > consumeEnhancedForStatement(); > break; > >- case 564 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$ >+ case 610 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type0..."); } //$NON-NLS-1$ > consumeEnhancedForStatementHeaderInit(false); > break; > >- case 565 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ >+ case 611 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ > consumeEnhancedForStatementHeaderInit(true); > break; > >- case 566 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ >+ case 612 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ > consumeEnhancedForStatementHeader(); > break; > >- case 567 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ >+ case 613 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 568 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ >+ case 614 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ > consumeSingleStaticImportDeclarationName(); > break; > >- case 569 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ >+ case 615 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ > consumeImportDeclaration(); > break; > >- case 570 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ >+ case 616 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ > consumeStaticImportOnDemandDeclarationName(); > break; > >- case 571 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ >+ case 617 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ > consumeTypeArguments(); > break; > >- case 572 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ >+ case 618 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ > consumeOnlyTypeArguments(); > break; > >- case 574 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ >+ case 620 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ > consumeTypeArgumentList1(); > break; > >- case 576 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ >+ case 622 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ > consumeTypeArgumentList(); > break; > >- case 577 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ >+ case 623 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ > consumeTypeArgument(); > break; > >- case 581 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ >+ case 627 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ > consumeReferenceType1(); > break; > >- case 582 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ case 628 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ > consumeTypeArgumentReferenceType1(); > break; > >- case 584 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ >+ case 629 : if (DEBUG) { System.out.println("ReferenceType1 ::= Modifiers ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ consumeTypeArgumentReferenceType1WithTypeAnnotations(); >+ break; >+ >+ case 631 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ > consumeTypeArgumentList2(); > break; > >- case 587 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 634 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeReferenceType2(); > break; > >- case 588 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ case 635 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ > consumeTypeArgumentReferenceType2(); > break; > >- case 590 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ >+ case 636 : if (DEBUG) { System.out.println("ReferenceType2 ::= Modifiers ClassOrInterface LESS..."); } //$NON-NLS-1$ >+ consumeTypeArgumentReferenceType2WithTypeAnnotations(); >+ break; >+ >+ case 638 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ > consumeTypeArgumentList3(); > break; > >- case 593 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 641 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeReferenceType3(); > break; > >- case 594 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ >+ case 642 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ > consumeWildcard(); > break; > >- case 595 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ >+ case 643 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ > consumeWildcardWithBounds(); > break; > >- case 596 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ >+ case 644 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ > consumeWildcardBoundsExtends(); > break; > >- case 597 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ >+ case 645 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ > consumeWildcardBoundsSuper(); > break; > >- case 598 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ >+ case 646 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ > consumeWildcard1(); > break; > >- case 599 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ >+ case 647 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ > consumeWildcard1WithBounds(); > break; > >- case 600 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ >+ case 648 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ > consumeWildcardBounds1Extends(); > break; > >- case 601 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ >+ case 649 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ > consumeWildcardBounds1Super(); > break; > >- case 602 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 650 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeWildcard2(); > break; > >- case 603 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ >+ case 651 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ > consumeWildcard2WithBounds(); > break; > >- case 604 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ >+ case 652 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ > consumeWildcardBounds2Extends(); > break; > >- case 605 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ >+ case 653 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ > consumeWildcardBounds2Super(); > break; > >- case 606 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ >+ case 654 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ > consumeWildcard3(); > break; > >- case 607 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ >+ case 655 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ > consumeWildcard3WithBounds(); > break; > >- case 608 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ >+ case 656 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ > consumeWildcardBounds3Extends(); > break; > >- case 609 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ >+ case 657 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ > consumeWildcardBounds3Super(); > break; > >- case 610 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); } //$NON-NLS-1$ >+ case 658 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); } //$NON-NLS-1$ >+ consumeZeroTypeAnnotations(true); >+ break; >+ >+ case 659 : if (DEBUG) { System.out.println("TypeParameterHeader ::= PushZeroTypeAnnotations..."); } //$NON-NLS-1$ > consumeTypeParameterHeader(); > break; > >- case 611 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ >+ case 660 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotations Identifier"); } //$NON-NLS-1$ >+ consumeTypeParameterHeader(); >+ break; >+ >+ case 661 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ > consumeTypeParameters(); > break; > >- case 613 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ >+ case 663 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ > consumeTypeParameterList(); > break; > >- case 615 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 665 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameterWithExtends(); > break; > >- case 616 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 666 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameterWithExtendsAndBounds(); > break; > >- case 618 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ >+ case 668 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ > consumeAdditionalBoundList(); > break; > >- case 619 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ >+ case 669 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ > consumeAdditionalBound(); > break; > >- case 621 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ >+ case 671 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ > consumeTypeParameterList1(); > break; > >- case 622 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ >+ case 672 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ > consumeTypeParameter1(); > break; > >- case 623 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 673 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameter1WithExtends(); > break; > >- case 624 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ >+ case 674 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ > consumeTypeParameter1WithExtendsAndBounds(); > break; > >- case 626 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ >+ case 676 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ > consumeAdditionalBoundList1(); > break; > >- case 627 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ >+ case 677 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ > consumeAdditionalBound1(); > break; > >- case 633 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ >+ case 683 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.PLUS); > break; > >- case 634 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ >+ case 684 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.MINUS); > break; > >- case 637 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ >+ case 687 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.TWIDDLE); > break; > >- case 638 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ >+ case 688 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ > consumeUnaryExpression(OperatorIds.NOT); > break; > >- case 641 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 691 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MULTIPLY); > break; > >- case 642 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ >+ case 692 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.MULTIPLY); > break; > >- case 643 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 693 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.DIVIDE); > break; > >- case 644 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ >+ case 694 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.DIVIDE); > break; > >- case 645 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 695 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.REMAINDER); > break; > >- case 646 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ >+ case 696 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.REMAINDER); > break; > >- case 648 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 698 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.PLUS); > break; > >- case 649 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ >+ case 699 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.PLUS); > break; > >- case 650 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 700 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.MINUS); > break; > >- case 651 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ >+ case 701 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.MINUS); > break; > >- case 653 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ >+ case 703 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LEFT_SHIFT); > break; > >- case 654 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ >+ case 704 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT); > break; > >- case 655 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ >+ case 705 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); > break; > >- case 656 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ >+ case 706 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT); > break; > >- case 657 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ >+ case 707 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); > break; > >- case 658 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ >+ case 708 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT); > break; > >- case 660 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ >+ case 710 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS); > break; > >- case 661 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ >+ case 711 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.LESS); > break; > >- case 662 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ >+ case 712 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER); > break; > >- case 663 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ >+ case 713 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.GREATER); > break; > >- case 664 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 714 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.LESS_EQUAL); > break; > >- case 665 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ >+ case 715 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL); > break; > >- case 666 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 716 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.GREATER_EQUAL); > break; > >- case 667 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ >+ case 717 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL); > break; > >- case 669 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ >+ case 719 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ > consumeInstanceOfExpressionWithName(); > break; > >- case 670 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 720 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeInstanceOfExpression(); > break; > >- case 672 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 722 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); > break; > >- case 673 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ >+ case 723 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL); > break; > >- case 674 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 724 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeEqualityExpression(OperatorIds.NOT_EQUAL); > break; > >- case 675 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ >+ case 725 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ > consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL); > break; > >- case 677 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ >+ case 727 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND); > break; > >- case 678 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ >+ case 728 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.AND); > break; > >- case 680 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 730 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.XOR); > break; > >- case 681 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ >+ case 731 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.XOR); > break; > >- case 683 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 733 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR); > break; > >- case 684 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ >+ case 734 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.OR); > break; > >- case 686 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 736 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.AND_AND); > break; > >- case 687 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ >+ case 737 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.AND_AND); > break; > >- case 689 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 739 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeBinaryExpression(OperatorIds.OR_OR); > break; > >- case 690 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ >+ case 740 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ > consumeBinaryExpressionWithName(OperatorIds.OR_OR); > break; > >- case 692 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ >+ case 742 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ > consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; > break; > >- case 693 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ >+ case 743 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ > consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ; > break; > >- case 697 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ >+ case 747 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderName() ; > break; > >- case 698 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ >+ case 748 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; > break; > >- case 699 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ >+ case 749 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; > break; > >- case 700 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ >+ case 750 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeaderName() ; > break; > >- case 701 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ >+ case 751 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclarationHeader() ; > break; > >- case 702 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ >+ case 752 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeDeclaration() ; > break; > >- case 704 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ >+ case 754 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ > consumeEmptyAnnotationTypeMemberDeclarationsopt() ; > break; > >- case 705 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ >+ case 755 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ > consumeAnnotationTypeMemberDeclarationsopt() ; > break; > >- case 707 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ >+ case 757 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeMemberDeclarations() ; > break; > >- case 708 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ >+ case 758 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ > consumeMethodHeaderNameWithTypeParameters(true); > break; > >- case 709 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 759 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type0..."); } //$NON-NLS-1$ > consumeMethodHeaderName(true); > break; > >- case 710 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ >+ case 760 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ > consumeEmptyMethodHeaderDefaultValue() ; > break; > >- case 711 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ >+ case 761 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ > consumeMethodHeaderDefaultValue(); > break; > >- case 712 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ >+ case 762 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >- case 713 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ >+ case 763 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ > consumeAnnotationTypeMemberDeclaration() ; > break; > >- case 721 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ >+ case 771 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ > consumeAnnotationName() ; > break; > >- case 722 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ >+ case 772 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ > consumeNormalAnnotation() ; > break; > >- case 723 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ >+ case 773 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ > consumeEmptyMemberValuePairsopt() ; > break; > >- case 726 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ >+ case 776 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ > consumeMemberValuePairs() ; > break; > >- case 727 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ >+ case 777 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ > consumeMemberValuePair() ; > break; > >- case 728 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ >+ case 778 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ > consumeEnterMemberValue() ; > break; > >- case 729 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ >+ case 779 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ > consumeExitMemberValue() ; > break; > >- case 731 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ >+ case 781 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ > consumeMemberValueAsName() ; > break; > >- case 734 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 784 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeMemberValueArrayInitializer() ; > break; > >- case 735 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 785 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeMemberValueArrayInitializer() ; > break; > >- case 736 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 786 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeEmptyMemberValueArrayInitializer() ; > break; > >- case 737 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ >+ case 787 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ > consumeEmptyMemberValueArrayInitializer() ; > break; > >- case 738 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ >+ case 788 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ > consumeEnterMemberValueArrayInitializer() ; > break; > >- case 740 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ >+ case 790 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ > consumeMemberValues() ; > break; > >- case 741 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ >+ case 791 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ > consumeMarkerAnnotation() ; > break; > >- case 742 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ >+ case 792 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ > consumeSingleMemberAnnotationMemberValue() ; > break; > >- case 743 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ >+ case 793 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ > consumeSingleMemberAnnotation() ; > break; > >- case 744 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ >+ case 794 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ > consumeRecoveryMethodHeaderNameWithTypeParameters(); > break; > >- case 745 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ >+ case 795 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type0..."); } //$NON-NLS-1$ > consumeRecoveryMethodHeaderName(); > break; > >- case 746 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ >+ case 796 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >- case 747 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ >+ case 797 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ > consumeMethodHeader(); > break; > >@@ -8276,10 +9096,64 @@ > 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(); >@@ -8369,6 +9243,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() { >@@ -8381,15 +9256,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; >@@ -8441,6 +9329,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() { >@@ -8452,11 +9341,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) { >@@ -8694,12 +9586,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); > } >@@ -9181,13 +10079,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--]; >@@ -9209,12 +10129,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--; >@@ -9232,14 +10157,17 @@ > if (dim == 0) { > ref = new QualifiedTypeReference(tokens, positions); > } else { >- ref = new ArrayQualifiedTypeReference(tokens, dim, positions); >+ annotationsOnDimensions = getAnnotationsOnDimensions(dim); >+ ref = new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions); > ref.sourceEnd = this.endPosition; >+ ref.bits |= ASTNode.HasTypeAnnotations; > } > } > } > return ref; > } > protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) { >+ Annotation[][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim); > if (identifierLength == 1 && numberOfIdentifiers == 1) { > int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--]; > TypeReference[] typeArguments = null; >@@ -9250,7 +10178,7 @@ > 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; > } >@@ -9292,7 +10220,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; > } >@@ -9524,6 +10452,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; >@@ -10744,6 +11675,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; >@@ -11167,6 +12129,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; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java >index b91aafb..e819f6c 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java >@@ -9,6 +9,10 @@ > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -19,21 +23,21 @@ > public interface ParserBasicInformation { > > int ERROR_SYMBOL = 115, >- MAX_NAME_LENGTH = 41, >- NUM_STATES = 1029, >+ MAX_NAME_LENGTH = 50, >+ NUM_STATES = 1100, > > NT_OFFSET = 115, >- SCOPE_UBOUND = 143, >- SCOPE_SIZE = 144, >- LA_STATE_OFFSET = 13860, >+ SCOPE_UBOUND = 241, >+ SCOPE_SIZE = 242, >+ LA_STATE_OFFSET = 16124, > MAX_LA = 1, >- NUM_RULES = 747, >+ NUM_RULES = 797, > NUM_TERMINALS = 115, >- NUM_NON_TERMINALS = 335, >- NUM_SYMBOLS = 450, >- START_STATE = 905, >+ NUM_NON_TERMINALS = 356, >+ NUM_SYMBOLS = 471, >+ START_STATE = 1143, > EOFT_SYMBOL = 67, > EOLT_SYMBOL = 67, >- ACCEPT_ACTION = 13859, >- ERROR_ACTION = 13860; >+ ACCEPT_ACTION = 16123, >+ ERROR_ACTION = 16124; > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java >index cc25135..8762fc1 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java >@@ -10,6 +10,10 @@ > * only. The code is not compatible with any specification of the JCP. > * > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -39,118 +43,118 @@ > TokenNameCOMMENT_BLOCK = 1002, > TokenNameCOMMENT_JAVADOC = 1003; > >- int TokenNameIdentifier = 22, >- TokenNameabstract = 58, >- TokenNameassert = 89, >- TokenNameboolean = 33, >- TokenNamebreak = 90, >- TokenNamebyte = 34, >- TokenNamecase = 106, >+ int TokenNameIdentifier = 20, >+ TokenNameabstract = 33, >+ TokenNameassert = 79, >+ TokenNameboolean = 43, >+ TokenNamebreak = 80, >+ TokenNamebyte = 44, >+ TokenNamecase = 107, > TokenNamecatch = 104, >- TokenNamechar = 35, >- TokenNameclass = 76, >- TokenNamecontinue = 91, >+ TokenNamechar = 45, >+ TokenNameclass = 74, >+ TokenNamecontinue = 81, > TokenNameconst = 113, >- TokenNamedefault = 100, >- TokenNamedo = 92, >- TokenNamedouble = 36, >- TokenNameelse = 108, >- TokenNameenum = 102, >+ TokenNamedefault = 89, >+ TokenNamedo = 82, >+ TokenNamedouble = 46, >+ TokenNameelse = 109, >+ TokenNameenum = 105, > TokenNameextends = 103, >- TokenNamefalse = 46, >- TokenNamefinal = 59, >- TokenNamefinally = 107, >- TokenNamefloat = 37, >- TokenNamefor = 93, >+ TokenNamefalse = 57, >+ TokenNamefinal = 34, >+ TokenNamefinally = 108, >+ TokenNamefloat = 47, >+ TokenNamefor = 83, > TokenNamegoto = 114, >- TokenNameif = 94, >- TokenNameimplements = 111, >- TokenNameimport = 105, >- TokenNameinstanceof = 17, >- TokenNameint = 38, >- TokenNameinterface = 99, >- TokenNamelong = 39, >- TokenNamenative = 60, >- TokenNamenew = 44, >- TokenNamenull = 47, >- TokenNamepackage = 101, >- TokenNameprivate = 61, >- TokenNameprotected = 62, >- TokenNamepublic = 63, >- TokenNamereturn = 95, >- TokenNameshort = 40, >- TokenNamestatic = 56, >- TokenNamestrictfp = 64, >- TokenNamesuper = 42, >- TokenNameswitch = 96, >- TokenNamesynchronized = 57, >- TokenNamethis = 43, >- TokenNamethrow = 97, >- TokenNamethrows = 110, >- TokenNametransient = 65, >- TokenNametrue = 48, >- TokenNametry = 98, >- TokenNamevoid = 41, >- TokenNamevolatile = 66, >- TokenNamewhile = 77, >- TokenNameIntegerLiteral = 49, >- TokenNameLongLiteral = 50, >- TokenNameFloatingPointLiteral = 51, >- TokenNameDoubleLiteral = 52, >- TokenNameCharacterLiteral = 53, >- TokenNameStringLiteral = 54, >+ TokenNameif = 84, >+ TokenNameimplements = 112, >+ TokenNameimport = 106, >+ TokenNameinstanceof = 18, >+ TokenNameint = 48, >+ TokenNameinterface = 90, >+ TokenNamelong = 49, >+ TokenNamenative = 35, >+ TokenNamenew = 56, >+ TokenNamenull = 58, >+ TokenNamepackage = 91, >+ TokenNameprivate = 36, >+ TokenNameprotected = 37, >+ TokenNamepublic = 38, >+ TokenNamereturn = 85, >+ TokenNameshort = 50, >+ TokenNamestatic = 32, >+ TokenNamestrictfp = 39, >+ TokenNamesuper = 54, >+ TokenNameswitch = 86, >+ TokenNamesynchronized = 40, >+ TokenNamethis = 55, >+ TokenNamethrow = 87, >+ TokenNamethrows = 111, >+ TokenNametransient = 41, >+ TokenNametrue = 59, >+ TokenNametry = 88, >+ TokenNamevoid = 51, >+ TokenNamevolatile = 42, >+ TokenNamewhile = 78, >+ TokenNameIntegerLiteral = 60, >+ TokenNameLongLiteral = 61, >+ TokenNameFloatingPointLiteral = 62, >+ TokenNameDoubleLiteral = 63, >+ TokenNameCharacterLiteral = 64, >+ TokenNameStringLiteral = 65, > TokenNamePLUS_PLUS = 2, > TokenNameMINUS_MINUS = 3, >- TokenNameEQUAL_EQUAL = 19, >+ TokenNameEQUAL_EQUAL = 21, > TokenNameLESS_EQUAL = 13, > TokenNameGREATER_EQUAL = 14, >- TokenNameNOT_EQUAL = 20, >- TokenNameLEFT_SHIFT = 18, >+ TokenNameNOT_EQUAL = 22, >+ TokenNameLEFT_SHIFT = 19, > TokenNameRIGHT_SHIFT = 15, >- TokenNameUNSIGNED_RIGHT_SHIFT = 16, >- TokenNamePLUS_EQUAL = 78, >- TokenNameMINUS_EQUAL = 79, >- TokenNameMULTIPLY_EQUAL = 80, >- TokenNameDIVIDE_EQUAL = 81, >- TokenNameAND_EQUAL = 82, >- TokenNameOR_EQUAL = 83, >- TokenNameXOR_EQUAL = 84, >- TokenNameREMAINDER_EQUAL = 85, >- TokenNameLEFT_SHIFT_EQUAL = 86, >- TokenNameRIGHT_SHIFT_EQUAL = 87, >- TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 88, >- TokenNameOR_OR = 30, >- TokenNameAND_AND = 29, >+ TokenNameUNSIGNED_RIGHT_SHIFT = 17, >+ TokenNamePLUS_EQUAL = 92, >+ TokenNameMINUS_EQUAL = 93, >+ TokenNameMULTIPLY_EQUAL = 94, >+ TokenNameDIVIDE_EQUAL = 95, >+ TokenNameAND_EQUAL = 96, >+ TokenNameOR_EQUAL = 97, >+ TokenNameXOR_EQUAL = 98, >+ TokenNameREMAINDER_EQUAL = 99, >+ TokenNameLEFT_SHIFT_EQUAL = 100, >+ TokenNameRIGHT_SHIFT_EQUAL = 101, >+ TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 102, >+ TokenNameOR_OR = 31, >+ TokenNameAND_AND = 30, > TokenNamePLUS = 4, > TokenNameMINUS = 5, >- TokenNameNOT = 70, >+ TokenNameNOT = 69, > TokenNameREMAINDER = 8, >- TokenNameXOR = 23, >- TokenNameAND = 21, >+ TokenNameXOR = 24, >+ TokenNameAND = 23, > TokenNameMULTIPLY = 7, >- TokenNameOR = 25, >- TokenNameTWIDDLE = 71, >+ TokenNameOR = 26, >+ TokenNameTWIDDLE = 70, > TokenNameDIVIDE = 9, > TokenNameGREATER = 12, >- TokenNameLESS = 11, >- TokenNameLPAREN = 24, >- TokenNameRPAREN = 26, >+ TokenNameLESS = 10, >+ TokenNameLPAREN = 27, >+ TokenNameRPAREN = 25, > TokenNameLBRACE = 68, >- TokenNameRBRACE = 32, >+ TokenNameRBRACE = 53, > TokenNameLBRACKET = 6, > TokenNameRBRACKET = 72, > TokenNameSEMICOLON = 28, >- TokenNameQUESTION = 27, >- TokenNameCOLON = 69, >- TokenNameCOMMA = 31, >+ TokenNameQUESTION = 29, >+ TokenNameCOLON = 71, >+ TokenNameCOMMA = 52, > TokenNameDOT = 1, >- TokenNameEQUAL = 74, >- TokenNameAT = 45, >- TokenNameELLIPSIS = 112, >- TokenNameARROW = 109, >- TokenNameCOLON_COLON = 10, >- TokenNameBeginLambda = 55, >- TokenNameBeginTypeArguments = 75, >+ TokenNameEQUAL = 77, >+ TokenNameAT = 16, >+ TokenNameELLIPSIS = 75, >+ TokenNameARROW = 110, >+ TokenNameCOLON_COLON = 11, >+ TokenNameBeginLambda = 66, >+ TokenNameBeginTypeArguments = 76, > TokenNameElidedSemicolonAndRightBrace = 73, > TokenNameEOF = 67, > TokenNameERROR = 115; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java >index a25da20..657a869 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -15,6 +19,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 +785,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 +802,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; >+ } > } > > // >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc >index 3d3bed5..72d2b4a 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc >index 66fd849..dd89428 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc >index 8810efe..24aa63e 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc >index 920b6c6..3ca6a1d 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc >index 338fc84..995994b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc >index 05d790c..a459366 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc >index 836e823..d27ef29 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc >index ea5fda3..eb72589 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc >index dad33fd..31e7fed 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc >index 3d4062a..517db5d 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc >index efb419a..f33cb48 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc >@@ -1 +1,8 @@ >-ll k HHHDDk EEE" HIhE jEMDYYD"DDfJJmc""L"Ef"d"""--" >\ No newline at end of file >+mm55Dl4KM55HHHHHDl5555GGG4KKK,776655IhG5555 >+ >+,k,4,G,,NDOOD,DD,g44 >+4 >+4iMMnZ,J,gGi,,Y, >+,, >+,, >+67 >\ No newline at end of file >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc >index aae9c5e..014e70b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc >index 0c2cd8f..50302c6 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc >index fcc8c55..8644dae 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc >index 402c52d..8c12bee 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc >index 7378156..efe37dd 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc >index 9a8b7e8..189d0d3 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc >index 4e06dd5..ddbd2bf 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc >index 7a3e53f..89a1462 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc >index 250c010..ccdf99a 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc >index 73474b5..5fef366 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc >index 9590181..8de3740 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc >index c3cc0d5..e3ef418 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc >index c3879ca..d845416 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc >Binary files differ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props >index 814820d..85f0c5c 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props >@@ -1,17 +1,3 @@ >-############################################################################### >-# Copyright (c) 2012 IBM Corporation and others. >-# All rights reserved. This program and the accompanying materials >-# are made available under the terms of the Eclipse Public License v1.0 >-# which accompanies this distribution, and is available at >-# http://www.eclipse.org/legal/epl-v10.html >-# >-# This is an implementation of an early-draft specification developed under the Java >-# Community Process (JCP) and is made available for testing and evaluation purposes >-# only. The code is not compatible with any specification of the JCP. >-# >-# Contributors: >-# IBM Corporation - initial API and implementation >-############################################################################### > ,opt=, > ;opt=; > AbstractMethodDeclaration=MethodDeclaration >@@ -36,6 +22,7 @@ > AnnotationTypeMemberDeclaration=AnnotationTypeMemberDeclaration > AnnotationTypeMemberDeclarations=AnnotationTypeMemberDeclarations > AnnotationTypeMemberDeclarationsopt=AnnotationTypeMemberDeclarations >+Annotationsopt=Annotationsopt > ArgumentList=ArgumentList > ArgumentListopt=ArgumentList > Arguments=Arguments >@@ -80,7 +67,9 @@ > ClassInstanceCreationExpression=ClassInstanceCreationExpression > ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName > ClassMemberDeclaration=ClassMemberDeclaration >+ClassOrInterface0=Type > ClassOrInterface=Type >+ClassOrInterfaceType0=Type > ClassOrInterfaceType=Type > ClassType=ClassType > ClassTypeElt=ClassType >@@ -104,8 +93,10 @@ > DimWithOrWithOutExpr=Dimension > DimWithOrWithOutExprs=Dimensions > Dims=Dimensions >+DimsAnnotLoop=DimsAnnotLoop > DimsLoop=Dimensions > Dimsopt=Dimensions >+DimsoptAnnotsopt=AnnotationsDimensionsSequence > DoStatement=DoStatement > ElidedLeftBraceAndReturn=ElidedLeftBraceAndReturn > EmptyStatement=EmptyStatement >@@ -157,6 +148,7 @@ > FormalParameterListopt=FormalParameterList > GenericMethodDeclaration=GenericMethodDeclaration > GenericType=GenericType >+GenericTypeDotName=GenericTypeDotName > Goal=Goal > Header1=Header1 > Header2=Header2 >@@ -172,6 +164,7 @@ > Initializer=Initializer > InsideCastExpression=InsideCastExpression > InsideCastExpressionLL1=InsideCastExpression >+InsideCastExpressionWithAnnotatedQualifiedGenerics=InsideCastExpression > InsideCastExpressionWithQualifiedGenerics=InsideCastExpression > InstanceofExpression=Expression > InstanceofExpression_NotName=Expression >@@ -229,6 +222,7 @@ > NormalAnnotation=NormalAnnotation > NumericType=NumericType > OneDimLoop=Dimension >+OneDimOrAnnot=OneDimensionOrAnnotation > OnlySynchronized=OnlySynchronized > OnlyTypeArguments=TypeArguments > OnlyTypeArgumentsForCastExpression=TypeArguments >@@ -237,10 +231,12 @@ > PackageComment=PackageComment > PackageDeclaration=PackageDeclaration > PackageDeclarationName=PackageDeclarationName >+PopZeroTypeAnnotations=PopZeroTypeAnnotations > PostDecrementExpression=PostDecrementExpression > PostIncrementExpression=PostIncrementExpression > PostfixExpression=Expression > PostfixExpression_NotName=Expression >+PotentialNameArray=PotentialNameArray > PreDecrementExpression=PreDecrementExpression > PreIncrementExpression=PreIncrementExpression > Primary=Expression >@@ -253,7 +249,12 @@ > PushModifiersForHeader=PushModifiersForHeader > PushPosition=PushPosition > PushRPAREN=) >+PushRPARENForAnnotatedTypeCast=) >+PushRPARENForNameAndAnnotatedTypeCast=) >+PushRPARENForNameUnannotatedTypeCast=) >+PushRPARENForUnannotatedTypeCast=) > PushRealModifiers=PushRealModifiers >+PushZeroTypeAnnotations=ZeroTypeAnnotations > QualifiedClassBodyopt=ClassBody > QualifiedEnterAnonymousClassBody=EnterAnonymousClassBody > QualifiedName=QualifiedName >@@ -261,6 +262,7 @@ > RecoveryMethodHeaderName=MethodHeaderName > ReduceImports=ReduceImports > ReferenceExpression=ReferenceExpression >+ReferenceType0=ReferenceType > ReferenceType1=ReferenceType1 > ReferenceType2=ReferenceType2 > ReferenceType3=ReferenceType3 >@@ -302,7 +304,9 @@ > TryBlock=Block > TryStatement=TryStatement > TryStatementWithResources=TryStatementWithResources >+Type0=Type > Type=Type >+TypeAnnotations=TypeAnnotations > TypeArgument1=TypeArgument1 > TypeArgument2=TypeArgument2 > TypeArgument3=TypeArgument3 >@@ -318,6 +322,7 @@ > TypeElidedFormalParameterList=TypeElidedFormalParameterList > TypeImportOnDemandDeclaration=TypeImportOnDemandDeclaration > TypeImportOnDemandDeclarationName=TypeImportOnDemandDeclarationName >+TypeInternal=Type > TypeParameter1=TypeParameter1 > TypeParameter=TypeParameter > TypeParameterHeader=TypeParameter >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >index 9ebf5e7..84976fa 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >@@ -9,6 +9,10 @@ > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > * Benjamin Muskalla - Contribution for bug 239066 >@@ -2573,6 +2577,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( >@@ -4148,6 +4160,41 @@ > argument.type.sourceStart, > argument.sourceEnd); > } >+ >+public void invalidUsageOfTypeAnnotations(Annotation annotation) { >+ this.handle( >+ IProblem.InvalidUsageOfTypeAnnotations, >+ NoArgument, >+ NoArgument, >+ annotation.sourceStart, >+ annotation.sourceEnd); >+} >+ >+public void illegalReceiverAnnotations(Annotation first, Annotation last) { >+ this.handle( >+ IProblem.InvalidUsageOfReceiverAnnotations, >+ NoArgument, >+ NoArgument, >+ first.sourceStart, >+ last.sourceEnd); >+} >+ >+public void misplacedTypeAnnotations(Annotation first, Annotation last) { >+ this.handle( >+ IProblem.MisplacedTypeAnnotations, >+ NoArgument, >+ NoArgument, >+ first.sourceStart, >+ last.sourceEnd); >+} >+public void illegalUsageOfTypeAnnotations(Annotation annotation) { >+ this.handle( >+ IProblem.IllegalUsageOfTypeAnnotations, >+ NoArgument, >+ NoArgument, >+ annotation.sourceStart, >+ annotation.sourceEnd); >+} > public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl, Object location) { > this.referenceContext = compUnitDecl; > String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)}; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >index 62774eb..19a44b4 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >@@ -8,8 +8,7 @@ > # This is an implementation of an early-draft specification developed under the Java > # Community Process (JCP) and is made available for testing and evaluation purposes > # only. The code is not compatible with any specification of the JCP. >-# >-# >+# > # Contributors: > # IBM Corporation - initial API and implementation > # Benjamin Muskalla - Contribution for bug 239066 >@@ -225,7 +224,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 \\" \\' \\\\ ) >@@ -586,7 +585,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}> > >diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java >index 28371d6..f41d069 100644 >--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java >+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -126,6 +130,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(); >diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java >index 55d47f4..2d1a5de 100644 >--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java >+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -48,7 +52,7 @@ > ReferenceBinding allocatedType = codegenBinding.declaringClass; > > if (codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) { >- codeStream.new_(allocatedType); >+ codeStream.new_(this.type, allocatedType); > if (valueRequired) { > codeStream.dup(); > } >@@ -85,7 +89,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); >@@ -101,7 +105,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); >diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java >index 52a8c7d..134082e 100644 >--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java >+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java >@@ -8,7 +8,7 @@ > * This is an implementation of an early-draft specification developed under the Java > * Community Process (JCP) and is made available for testing and evaluation purposes > * only. The code is not compatible with any specification of the JCP. >- * >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -23,6 +23,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; >@@ -125,8 +126,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; >diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java >index fa30c00..d11047a 100644 >--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java >+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -111,7 +115,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 +131,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(); > >diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java >index 0b4e059..efe4aff 100644 >--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java >+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -792,6 +796,9 @@ > > // reset stacks in consistent state > this.expressionPtr = -1; >+ this.unattachedAnnotationPtr = -1; >+ this.typeAnnotationLengthPtr = -1; >+ this.typeAnnotationPtr = -1; > this.identifierPtr = -1; > this.identifierLengthPtr = -1; > >diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java >index 6daf04e..85bedaf 100644 >--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java >+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -63,7 +67,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 +84,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)" >diff --git a/org.eclipse.jdt.core/grammar/java.g b/org.eclipse.jdt.core/grammar/java.g >index afe2231..dfb3169 100644 >--- a/org.eclipse.jdt.core/grammar/java.g >+++ b/org.eclipse.jdt.core/grammar/java.g >@@ -182,9 +182,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 >@@ -205,6 +204,9 @@ > Goal ::= '?' AnnotationTypeMemberDeclaration > /:$readableName Goal:/ > >+RecoveryExitHeader ::= $empty >+RecoveryExitHeader ::= '...' >+ > Literal -> IntegerLiteral > Literal -> LongLiteral > Literal -> FloatingPointLiteral >@@ -218,9 +220,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 >@@ -241,27 +271,72 @@ > FloatingPointType -> 'double' > /:$readableName FloatingPointType:/ > >-ReferenceType ::= ClassOrInterfaceType >-/.$putCase consumeReferenceType(); $break ./ >-ReferenceType -> ArrayType >+---------------------------- JSR308------------------------------------------- >+-- ReferenceType has been wrapped now, so that it can be used by itself without >+-- having to spell out the rule once with Modifiers & once without. >+-- If type annotations are not legal prefixes to ReferenceType at some point, use >+-- ReferenceType0 instead. Otherwise reject the annotations in the parser. >+ >+ReferenceType ::= ReferenceType0 >+-- consumeUnannotatedType inserts 0 at the suitable place in the type >+-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right >+-- length of the type annotations 0 or otherwise. >+/.$putCase consumeUnannotatedType(); $break ./ >+ReferenceType ::= Modifiers ReferenceType0 >+/.$putCase consumeAnnotatedType(); $break ./ >+/:$compliance 1.7:/ > /:$readableName ReferenceType:/ > >---------------------------------------------------------------- >--- 1.5 feature >---------------------------------------------------------------- >-ClassOrInterfaceType -> ClassOrInterface >-ClassOrInterfaceType -> GenericType >+ReferenceType0 ::= ClassOrInterfaceType0 >+/.$putCase consumeReferenceType(); $break ./ >+ReferenceType0 -> ArrayType >+/:$readableName ReferenceType:/ >+ >+Annotationsopt ::= $empty >+/.$putCase consumeZeroTypeAnnotations(true); $break ./ >+Annotationsopt -> TypeAnnotations >+/:$compliance 1.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:/ > >-ClassOrInterface ::= Name >-/.$putCase consumeClassOrInterfaceName(); $break ./ >-ClassOrInterface ::= GenericType '.' Name >-/.$putCase consumeClassOrInterface(); $break ./ >+ClassOrInterfaceType0 -> ClassOrInterface0 >+ClassOrInterfaceType0 -> GenericType >+/:$readableName Type:/ >+---------------------------- JSR308------------------------------------------- >+ >+-- ClassOrInterface has been wrapped now so that it ALWAYS PUSHES >+-- A 0 IN THE TYPE ANNOTATIONS LENGTH STACK. If this behavior is >+-- not desirable, then (a) use ClassOrInterface0 if possible or (b) >+-- if that is not possible due to conflicts, then this 0 will have >+-- to be popped suitably when erroneous/extraneous. See the use of >+-- the production PopZeroTypeAnnotations for examples. >+ >+ClassOrInterface ::= ClassOrInterface0 >+/.$putCase consumeZeroTypeAnnotations(true); $break ./ > /:$readableName Type:/ > >-GenericType ::= ClassOrInterface TypeArguments >-/.$putCase consumeGenericType(); $break ./ >+ClassOrInterface0 ::= Name >+/.$putCase consumeClassOrInterfaceName(); $break ./ >+ClassOrInterface0 ::= GenericTypeDotName >+/:$readableName Type:/ >+ >+PopZeroTypeAnnotations ::= $empty >+/.$putCase consumeZeroTypeAnnotations(false); $break ./ >+/:$readableName PopZeroTypeAnnotations:/ >+ >+GenericType ::= ClassOrInterface TypeArguments PopZeroTypeAnnotations >+/.$putCase consumeGenericType(); $break ./ >+/:$compliance 1.5:/ > /:$readableName GenericType:/ >+ >+GenericTypeDotName ::= GenericType '.' Name >+/.$putCase consumeClassOrInterface(); $break ./ >+/:$readableName GenericTypeDotName:/ > > GenericType ::= ClassOrInterface '<' '>' > /.$putCase consumeGenericTypeWithDiamond(); $break ./ >@@ -277,8 +352,7 @@ > -- ArrayType ::= ArrayType '[' ']' > -- > >-ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name >-/.$putCase consumeArrayTypeWithTypeArgumentsName(); $break ./ >+ArrayTypeWithTypeArgumentsName ::= GenericTypeDotName > /:$readableName ArrayTypeWithTypeArgumentsName:/ > > ArrayType ::= PrimitiveType Dims >@@ -357,8 +431,12 @@ > /:$readableName Header1:/ > > Header2 -> Header >-Header2 -> EnumConstantHeader >+Header2 -> EnumConstantHeader RecoveryEnumConstantSeparatoropt > /:$readableName Header2:/ >+ >+RecoveryEnumConstantSeparatoropt ::= $empty >+RecoveryEnumConstantSeparatoropt ::= ',' >+RecoveryEnumConstantSeparatoropt ::= ';' > > CatchHeader ::= 'catch' '(' CatchFormalParameter ')' '{' > /.$putCase consumeCatchHeader(); $break ./ >@@ -384,7 +462,7 @@ > /:$compliance 1.5:/ > > PackageDeclarationName ::= PackageComment 'package' Name >-/.$putCase consumePackageDeclarationName(); $break ./ >+/.$putCase consumePackageDeclarationName(); $break ./ > /:$readableName PackageDeclarationName:/ > > PackageComment ::= $empty >@@ -558,7 +636,7 @@ > -- | 'transient' > -- | 'volatile' > >-FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';' >+FieldDeclaration ::= Modifiersopt Type0 VariableDeclarators ';' > /.$putCase consumeFieldDeclaration(); $break ./ > /:$readableName FieldDeclaration:/ > >@@ -566,6 +644,7 @@ > VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator > /.$putCase consumeVariableDeclarators(); $break ./ > /:$readableName VariableDeclarators:/ >+/:$recovery_template Identifier:/ > > VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization > VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization >@@ -629,7 +708,7 @@ > > MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' > /.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./ >-MethodHeaderName ::= Modifiersopt Type 'Identifier' '(' >+MethodHeaderName ::= Modifiersopt Type0 'Identifier' '(' > /.$putCase consumeMethodHeaderName(false); $break ./ > /:$readableName MethodHeaderName:/ > >@@ -638,7 +717,7 @@ > /:$readableName ):/ > /:$recovery_template ):/ > >-MethodHeaderExtendedDims ::= Dimsopt >+MethodHeaderExtendedDims ::= DimsoptAnnotsopt > /.$putCase consumeMethodHeaderExtendedDims(); $break ./ > /:$readableName MethodHeaderExtendedDims:/ > >@@ -646,7 +725,7 @@ > /.$putCase consumeMethodHeaderThrowsClause(); $break ./ > /:$readableName MethodHeaderThrowsClause:/ > >-ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderThrowsClauseopt >+ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen Annotationsopt MethodHeaderThrowsClauseopt > /.$putCase consumeConstructorHeader(); $break ./ > /:$readableName ConstructorDeclaration:/ > >@@ -661,10 +740,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 Type '...' VariableDeclaratorId >+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 GenericTypeDotName DimsoptAnnotsopt '...' VariableDeclaratorId > /.$putCase consumeFormalParameter(true); $break ./ > /:$readableName FormalParameter:/ > /:$compliance 1.5:/ >@@ -679,7 +781,7 @@ > /.$putCase consumeCatchType(); $break ./ > /:$readableName CatchType:/ > >-UnionType ::= Type >+UnionType ::= TypeInternal > /.$putCase consumeUnionTypeAsClassType(); $break ./ > UnionType ::= UnionType '|' Type > /.$putCase consumeUnionType(); $break ./ >@@ -706,7 +808,7 @@ > > --18.8.4 Productions from 8.5: Static Initializers > >-StaticInitializer ::= StaticOnly Block >+StaticInitializer ::= StaticOnly Block > /.$putCase consumeStaticInitializer(); $break./ > /:$readableName StaticInitializer:/ > >@@ -842,7 +944,6 @@ > InvalidInitializer -> Initializer > /:$readableName InvalidInitializer:/ > >- > InterfaceMemberDeclaration -> AbstractMethodDeclaration > InterfaceMemberDeclaration -> InvalidConstructorDeclaration > InterfaceMemberDeclaration -> InvalidInitializer >@@ -906,13 +1007,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:/ > >@@ -980,7 +1081,7 @@ > /:$readableName LabeledStatement:/ > > Label ::= 'Identifier' >-/.$putCase consumeLabel() ; $break ./ >+/.$putCase consumeLabel(); $break ./ > /:$readableName Label:/ > > ExpressionStatement ::= StatementExpression ';' >@@ -1159,10 +1260,10 @@ > /:$readableName Resource:/ > /:$compliance 1.7:/ > >-Resource ::= Modifiers Type PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization >-/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./ >-/:$readableName Resource:/ >-/:$compliance 1.7:/ >+--Resource ::= Modifiers Type PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization >+--/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./ >+--/:$readableName Resource:/ >+--/:$compliance 1.7:/ > > TryBlock ::= Block ExitTryBlock > /:$readableName Block:/ >@@ -1180,7 +1281,7 @@ > /.$putCase consumeStatementCatch() ; $break ./ > /:$readableName CatchClause:/ > >-Finally ::= 'finally' Block >+Finally ::= 'finally' Block > /:$readableName Finally:/ > /:$recovery_template finally { }:/ > >@@ -1191,8 +1292,25 @@ > /.$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 ):/ > >@@ -1214,6 +1332,7 @@ > PrimaryNoNewArray -> ClassInstanceCreationExpression > PrimaryNoNewArray -> FieldAccess > --1.1 feature >+-- javac doesn't permit type annotations here. > PrimaryNoNewArray ::= Name '.' 'this' > /.$putCase consumePrimaryNoNewArrayNameThis(); $break ./ > PrimaryNoNewArray ::= Name '.' 'super' >@@ -1223,6 +1342,22 @@ > --PrimaryNoNewArray ::= Type '.' 'class' > --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 ./ >@@ -1387,18 +1522,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:/ > >@@ -1413,11 +1548,45 @@ > /.$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 ./ >@@ -1426,8 +1595,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 ./ >@@ -1508,16 +1683,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 >@@ -1532,6 +1722,10 @@ > /:$readableName InsideCastExpression:/ > InsideCastExpressionWithQualifiedGenerics ::= $empty > /.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./ >+/:$readableName InsideCastExpression:/ >+ >+InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty >+/.$putCase consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); $break ./ > /:$readableName InsideCastExpression:/ > > MultiplicativeExpression -> UnaryExpression >@@ -1839,11 +2033,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:/ > >@@ -1918,8 +2112,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:/ >@@ -1939,8 +2136,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 >@@ -2022,10 +2222,17 @@ > /:$readableName WildcardBound3:/ > /:$compliance 1.5:/ > >-TypeParameterHeader ::= Identifier >+PushZeroTypeAnnotations ::= $empty >+/.$putCase consumeZeroTypeAnnotations(true); $break ./ >+/:$readableName ZeroTypeAnnotations:/ >+ >+TypeParameterHeader ::= PushZeroTypeAnnotations Identifier >+/.$putCase consumeTypeParameterHeader(); $break ./ >+/:$compliance 1.5:/ >+TypeParameterHeader ::= TypeAnnotations Identifier >+/:$compliance 1.7:/ > /.$putCase consumeTypeParameterHeader(); $break ./ > /:$readableName TypeParameter:/ >-/:$compliance 1.5:/ > > TypeParameters ::= '<' TypeParameterList1 > /.$putCase consumeTypeParameters(); $break ./ >@@ -2292,7 +2499,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:/ >@@ -2338,6 +2545,7 @@ > /.$putCase consumeAnnotationName() ; $break ./ > /:$readableName AnnotationName:/ > /:$compliance 1.5:/ >+/:$recovery_template @ Identifier:/ > > NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')' > /.$putCase consumeNormalAnnotation() ; $break ./ >@@ -2435,7 +2643,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:/ > >@@ -2504,3 +2712,4 @@ > > $end > -- need a carriage return after the $end >+ >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java >index da838ec..c511e55 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -142,6 +146,18 @@ > char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$ > > /** >+ * "RuntimeVisibleTypeAnnotations" attribute (added in jsr 308). >+ * @since 3.8 >+ */ >+ char[] RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$ >+ >+ /** >+ * "RuntimeInvisibleTypeAnnotations" attribute (added in jsr 308). >+ * @since 3.8 >+ */ >+ char[] RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$ >+ >+ /** > * "BootstrapMethods" attribute (added in cldc1.0). > * @since 3.8 > */ >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java >new file mode 100644 >index 0000000..00dcd1b >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java >@@ -0,0 +1,164 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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.8 >+ */ >+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(); >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java >new file mode 100644 >index 0000000..e1ba8b5 >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java >@@ -0,0 +1,64 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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.8 >+ * @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; >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java >new file mode 100644 >index 0000000..ec362d8 >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java >@@ -0,0 +1,52 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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.8 >+ */ >+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(); >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java >new file mode 100644 >index 0000000..c469b1c >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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.8 >+ */ >+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(); >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java >new file mode 100644 >index 0000000..d8fda62 >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.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.8 >+ */ >+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(); >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java >index 597b56c..33c5e1f 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -18,6 +22,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; >@@ -450,6 +455,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) { >@@ -513,7 +521,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]++; >@@ -536,6 +549,126 @@ > (int) namePosition, > extendedTypeDimension, > 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; >+ } > } > } > /* >@@ -598,10 +731,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; > } >@@ -615,7 +769,6 @@ > type, > this.intStack[this.intPtr + 1]);// modifiers > // consume annotations >- int length; > if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { > System.arraycopy( > this.expressionStack, >@@ -872,13 +1025,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; > } >@@ -1399,7 +1570,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) { >@@ -1414,12 +1585,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--]; >@@ -1441,7 +1613,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; >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >index 58e476b..097a37a 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -730,13 +734,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--]; >@@ -747,12 +754,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; >@@ -762,30 +768,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--; >@@ -800,22 +805,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*/ >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java >index 067a219..2ab4612 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -259,6 +263,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 +875,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); >@@ -685,6 +1097,8 @@ > && attribute != annotationDefaultAttribute > && attribute != runtimeInvisibleAnnotationsAttribute > && attribute != runtimeVisibleAnnotationsAttribute >+ && attribute != runtimeInvisibleTypeAnnotationsAttribute >+ && attribute != runtimeVisibleTypeAnnotationsAttribute > && attribute != runtimeInvisibleParameterAnnotationsAttribute > && attribute != runtimeVisibleParameterAnnotationsAttribute > && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) >@@ -708,6 +1122,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); > } > } > } >@@ -1584,6 +2004,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) { >@@ -1670,6 +2092,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); >@@ -1681,6 +2105,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); > } > } > } >@@ -1822,6 +2252,24 @@ > IAnnotation[] annotations = runtimeVisibleAnnotationsAttribute.getAnnotations(); > for (int i = 0, max = annotations.length; i < max; i++) { > disassemble(annotations[i], buffer, lineSeparator, tabNumber + 1, mode); >+ } >+ } >+ >+ 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); > } > } > >@@ -2267,4 +2715,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); >+ } > } >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java >new file mode 100644 >index 0000000..cd8ea5f >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java >@@ -0,0 +1,362 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.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; >+ } >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java >index e02f8c7..027a0b0 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -90,6 +94,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); > } >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java >new file mode 100644 >index 0000000..68e4fc5 >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java >@@ -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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.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; >+ } >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java >index ff1cf83..1edfa5f 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -294,6 +298,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; >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java >index c0d3aa3..c9fd928 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java >@@ -1,10 +1,14 @@ > /******************************************************************************* >- * 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 > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -114,6 +118,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); > } >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java >index 92cc37e..7783943 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -117,6 +121,12 @@ > 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 UNDERSCORES_IN_LITERALS_NOT_BELOW_17 = "Underscores_In_Literals_Not_Below_17"; //$NON-NLS-1$` >+ >+ public static final String UNTERMINATED_EXOTIC_IDENTIFIER = "Unterminated_Exotic_Identifier"; //$NON-NLS-1$ >+ public static final String ILLEGAL_EXOTIC_IDENTIFIER = "Illegal_Exotic_Identifier"; //$NON-NLS-1$ >+ public static final String ILLEGAL_DANGEROUS_CHARACTER = "Illegal_Dangerous_Character"; //$NON-NLS-1$ >+ public static final String INVALID_CHAR_IN_EXOTIC_IDENTIFIER = "Illegal_Exotic_Identifier"; //$NON-NLS-1$ >+ public static final String INVALID_EMPTY_EXOTIC_IDENTIFIER = "Invalid_Empty_Exotic_Identifier"; //$NON-NLS-1$ > > //----------------optimized identifier managment------------------ > static final char[] charArray_a = new char[] {'a'}, >@@ -1736,6 +1746,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) { >@@ -2757,12 +2773,57 @@ > 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 > > //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; >@@ -3434,7 +3495,135 @@ > } > } > >+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; >+} > public int scanNumber(boolean dotPrefix) throws InvalidInputException { > > //when entering this method the currentCharacter is the first >@@ -3800,7 +3989,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); > } >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java >new file mode 100644 >index 0000000..afc0650 >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java >@@ -0,0 +1,74 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.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; >+ } >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java >new file mode 100644 >index 0000000..e0194e7 >--- /dev/null >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java >@@ -0,0 +1,71 @@ >+/******************************************************************************* >+ * 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 >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.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; >+ } >+} >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties >index 5af88db..748f5c1 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties >@@ -5,6 +5,10 @@ > # which accompanies this distribution, and is available at > # http://www.eclipse.org/legal/epl-v10.html > # >+# This is an implementation of an early-draft specification developed under the Java >+# Community Process (JCP) and is made available for testing and evaluation purposes >+# only. The code is not compatible with any specification of the JCP. >+# > # Contributors: > # IBM Corporation - initial API and implementation > ############################################################################### >@@ -319,9 +323,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} >@@ -347,6 +356,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} >@@ -394,6 +418,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... >diff --git a/org.eclipse.jdt.core/notes/TODO.txt b/org.eclipse.jdt.core/notes/TODO.txt >new file mode 100644 >index 0000000..2956ddd >--- /dev/null >+++ b/org.eclipse.jdt.core/notes/TODO.txt >@@ -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 >diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java >index e627215..60e683c 100644 >--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java >+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -740,8 +744,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 > }
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