Fix for Bug 357029 - 'as' is not a valid identifier, breaks org.apache.xerces.dom3.as package
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java
index 1228588..a051e91 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java
@@ -42,6 +42,14 @@
private static final String PACKAGE_INFO = new String(TypeConstants.PACKAGE_INFO_NAME);
private static final Scanner SCANNER = new Scanner(false /*comment*/, true /*whitespace*/, false /*nls*/, ClassFileConstants.JDK1_3 /*sourceLevel*/, null/*taskTag*/, null/*taskPriorities*/, true /*taskCaseSensitive*/);
+//{ObjectTeams: be conservative: this class has no context so cannot distinguish OT vs. Java projects, always assume pure Java:
+ static {
+ SCANNER.forceBaseIsIdentifier();
+ SCANNER.parsePureJavaOnly = true;
+ SCANNER.parseOTJonly = false;
+ }
+//SH}
+
private JavaConventions() {
// Not instantiable
}
@@ -80,9 +88,6 @@
try {
SCANNER.setSource(id.toCharArray());
-//{ObjectTeams: recognize "base" as an identifier in plain java code:
- SCANNER.forceBaseIsIdentifier();
-// SH}
int token = SCANNER.scanIdentifier();
if (token != TerminalTokens.TokenNameIdentifier) return null;
if (SCANNER.currentPosition == SCANNER.eofPosition) { // to handle case where we had an ArrayIndexOutOfBoundsException
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java
index 168904f..e1cd51c 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java
@@ -244,6 +244,11 @@
if (this.scanner == null)
this.scanner = new Scanner(false /* comment */, true /* whitespace */, false /* nls */,
ClassFileConstants.JDK1_3/* sourceLevel */, null/* taskTag */, null/* taskPriorities */, true /* taskCaseSensitive */);
+//{ObjectTeams: don't exclude OT keywords appearing as package names:
+ this.scanner.forceBaseIsIdentifier();
+ this.scanner.parsePureJavaOnly = true;
+ this.scanner.parseOTJonly = false;
+// SH}
this.scanner.setSource(classNameArray);
this.scanner.eofPosition = classNameArray.length - SuffixConstants.SUFFIX_CLASS.length;
try {