Test & fix for Bug 330304 - [compiler] AIOOBE in Scanner.internalScanIdentifierOrKeyword()
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 98c37e8..a8077b0 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
@@ -26,7 +26,7 @@
* Added keywords: base tsuper callin within playedBy precedence readonly with team as when
*
* Contextual keywords: replace after before get set
- * These are recoknized as keywords only after the corresponding symbol <- or ->.
+ * These are recognized as keywords only after the corresponding symbol <- or ->.
*
* IMPORTANT NOTE: Internal Scanner implementation. It is mirrored in
* org.eclipse.jdt.core.compiler public package where it is API.
@@ -3442,7 +3442,7 @@
switch (data[index]) {
case 'a' :
switch(length) {
-//{ObjectTeams
+//{ObjectTeams: keyword 'as':
case 2: //as
if ( this._isOTSource
&& (data[++index] == 's')) {
@@ -4079,18 +4079,22 @@
else
return TokenNameIdentifier;
case 6 :
+//{ObjectTeams: check for tsuper keyword
+/* orig:
if ((data[++index] == 'h')
&& (data[++index] == 'r')
+ :giro */
+ if ((data[++index] == 'h')) {
+ if ((data[++index] == 'r')
+// orig:
&& (data[++index] == 'o')
&& (data[++index] == 'w')
&& (data[++index] == 's'))
return TokenNamethrows;
else
-//{ObjectTeams: check for tsuper keyword
-/* @original
return TokenNameIdentifier;
- */
- {
+// :giro
+ } else {
if ( this._isOTSource
&& (data[index] == 's')
&& (data[++index] == 'u')
@@ -4100,7 +4104,7 @@
return TokenNametsuper;
else
return TokenNameIdentifier;
- }
+ }
//Markus Witte}
case 9 :
if ((data[++index] == 'r')
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 e27c1f2..1f9f5a2 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
@@ -3404,7 +3404,6 @@
default :
return TokenNameIdentifier;
}
-
case 'l' : //long
if (length == 4) {
if ((data[++index] == 'o')
@@ -3665,18 +3664,22 @@
else
return TokenNameIdentifier;
case 6 :
+//{ObjectTeams: check for tsuper keyword
+/* orig:
if ((data[++index] == 'h')
&& (data[++index] == 'r')
+ :giro */
+ if ((data[++index] == 'h')) {
+ if ((data[++index] == 'r')
+// orig:
&& (data[++index] == 'o')
&& (data[++index] == 'w')
&& (data[++index] == 's'))
return TokenNamethrows;
else
-//{ObjectTeams: check for tsuper keyword
-/* @original
return TokenNameIdentifier;
- */
- {
+// :giro
+ } else {
if ( this._isOTSource
&& (data[index] == 's')
&& (data[++index] == 'u')
@@ -3686,7 +3689,7 @@
return TokenNametsuper;
else
return TokenNameIdentifier;
- }
+ }
//Markus Witte}
case 9 :
if ((data[++index] == 'r')