Bug 384992 - [java8] adopt grammar changes for Java 8 from JDT/Core
- fix AIOOBE in RepeatableAnnotationTest.testVariousSites()
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 301d17e..23bf630 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
@@ -14632,9 +14632,10 @@
 			stackLength);
 	}
 //{ObjectTeams: at the sentinal situation we merge this new annotation into the previous list:
-  if (atSentinel)
+  if (atSentinel) {
 	this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr-1]++;
-  else
+	this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = 0; // clear any previous data to start an empty list
+  } else
 // SH}
 	this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = 1;
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 373b755..a4db5fa 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -5421,6 +5421,8 @@
 }
 //{ObjectTeams: one more variant of '@' to check: 
 protected final boolean atTypeAnchor() { // Did the '@' we saw just now herald a type anchor ?
+	// Note: if we proceed with ATOT while actually a normal type annotation is present,
+	// the erroneous TypeAnchorReference is deconstructed again in Parser.convertTypeAnchor()!
 	return this.activeParser.atConflictScenario(TokenNameATOT);
 }
 // SH}