regression fixes:

+ remove obsolete adjustment in DietRecoveryTest
+ improve scanner tuning OT/non-OT
  - adjust and extend ASTTest
  - adjust AbstractJavaModelTests, ASTRewritingModifyingTest
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 83ed0fd..c6a9c18 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
@@ -6017,14 +6017,10 @@
 		"    removes the;\n" +
 		"    thread restriction;\n" +
 		"    will need = (re - create);\n" +
-//{ObjectTeams our compiler recovers less than the orig
-/* orig:
 		"    request as;\n" +
 		"    does not;\n" +
 		"    the removal;\n" +
 		"    thread = $missing$;\n" +
- :giro */
-// SH}
 		"  }\n" +
 		"  public IJavaThread[] getThreadFilters() {\n" +
 		"    return the;\n" +
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
index 393646f..322c1c8 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
@@ -1474,16 +1474,7 @@
 		String[] reserved  =
 				new String[] {
 						"true", "false", "null", // literals //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-//{ObjectTeams: for Some.Team.this.anchor.Role "this" must be usable as an identifier
-/* orig:
 						"abstract", "default", "if", "private", "this", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-  :giro */
-						"abstract", "default", "if", "private", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-						// more keywords:
-						"as", "callin", "playedBy", "precedence", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-						"team", "tsuper", "with", "within", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-						// treated as identifier: "base", "when" (predicate method name)
-// SH}
 						"boolean", "do", "implements", "protected", "throw", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
 						"break", "double", "import", "public", "throws", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
 						"byte", "else", "instanceof", "return", "transient", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
@@ -1574,6 +1565,47 @@
 
 	}
 
+//{ObjectTeams: variant with ot-only-parsing:
+	public void testSimpleNameOT() {
+		HashMap options = new HashMap();
+		options.put(JavaCore.COMPILER_OPT_SCOPED_KEYWORDS, JavaCore.DISABLED);
+		AST a1 = new AST(options);
+		SimpleName x = a1.newSimpleName("foo"); //$NON-NLS-1$
+
+		// check that property cannot be set to keyword or reserved work
+		String[] reserved  =
+				new String[] {
+						"true", "false", "null", // literals //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+//{ObjectTeams: for Some.Team.this.anchor.Role "this" must be usable as an identifier
+/* orig:
+						"abstract", "default", "if", "private", "this", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+  :giro */
+						"abstract", "default", "if", "private", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+						// more keywords:
+						"as", "callin", "playedBy", "precedence", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+						"team", "tsuper", "with", "within", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						// treated as identifier: "base", "when" (predicate method name)
+// SH}
+						"boolean", "do", "implements", "protected", "throw", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"break", "double", "import", "public", "throws", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"byte", "else", "instanceof", "return", "transient", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"case", "extends", "int", "short", "try", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"catch", "final", "interface", "static", "void", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"char", "finally", "long", "strictfp", "volatile", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"class", "float", "native", "super", "while", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"const", "for", "new", "switch", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+						"continue", "goto", "package", "synchronized"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		for (int i=0; i<reserved.length; i++) {
+			try {
+				x.setIdentifier(reserved[i]);
+				assertTrue(false);
+			} catch (RuntimeException e) {
+				// pass
+			}
+		}
+	}
+// SH}
+
 	public void testQualifiedName() {
 		long previousCount = this.ast.modificationCount();
 		final QualifiedName x = this.ast.newQualifiedName(
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 260e51c..e4d9e4c 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
@@ -15523,6 +15523,9 @@
 	this.scanner.caseStartPosition = -1;
 
 	resetModifiers();
+//{ObjectTeams: allow to configure OT/J features:
+	this.scanner.setOTFlags(this.options);
+// SH}
 
 	// recovery
 	this.lastCheckPoint = -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 89c3ee2..5716bbc 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
@@ -217,6 +217,7 @@
 
     public void setOTFlags(CompilerOptions options) {
 	    this.parseOTJonly = !options.allowScopedKeywords;
+    	this._isOTSource |= this.parseOTJonly;
 	    this.parsePureJavaOnly = options.isPureJava;
     }
 
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index f6782c9..4d0a23a 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -1176,6 +1176,9 @@
 			null/*taskPriorities*/,
 			true/*taskCaseSensitive*/,
 			this.previewEnabled /* isPreviewEnabled*/);
+//{ObjectTeams:
+		this.scanner.setOTFlags(new CompilerOptions(options));
+// SH}
 	}
 
 	private static Map<String, Long> getLevelMapTable() {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java
index a6f172e..9ca52dc 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java
@@ -243,11 +243,13 @@
 			try {
 				int tokenType = scanner.scanIdentifier();
 //{ObjectTeams: treat like an Identifier:
-				switch (tokenType) {
-				case TerminalTokens.TokenNamebase:
-				case TerminalTokens.TokenNameRestrictedIdentifierWhen:
-				case TerminalTokens.TokenNamethis: // like in: T.this.anchor.Type
-					tokenType = TerminalTokens.TokenNameIdentifier;
+				if (isOTSource) {
+					switch (tokenType) {
+					case TerminalTokens.TokenNamebase:
+					case TerminalTokens.TokenNameRestrictedIdentifierWhen:
+					case TerminalTokens.TokenNamethis: // like in: T.this.anchor.Type
+						tokenType = TerminalTokens.TokenNameIdentifier;
+					}
 				}
 //SH}
 				if (tokenType != TerminalTokens.TokenNameIdentifier) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index 071b9ac..aca0f8c 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -239,6 +239,9 @@
 							this.recoveryScannerData);
 			}
 			scanner.setSource(this.content);
+//{ObjectTeams:
+			scanner.setOTFlags(compilerOptions);
+// SH}
 			this.tokenScanner= new TokenScanner(scanner);
 		}
 		return this.tokenScanner;
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/src/org/eclipse/objectteams/otdt/tests/AbstractJavaModelTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/src/org/eclipse/objectteams/otdt/tests/AbstractJavaModelTests.java
index 4c2a1fb..5054eea 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/src/org/eclipse/objectteams/otdt/tests/AbstractJavaModelTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/src/org/eclipse/objectteams/otdt/tests/AbstractJavaModelTests.java
@@ -248,6 +248,7 @@
 	 * Internal synonym for constant AST.JSL16
 	 * to alleviate deprecation warnings once AST.JLS16 is deprecated in future.
 	 */
+	@SuppressWarnings("deprecation")
 	protected static final int AST_INTERNAL_JLS16 = AST.JLS16;
 
 	/**
@@ -3192,6 +3193,7 @@
 		javaProject.setOption(JavaCore.COMPILER_COMPLIANCE, compliance);
 		javaProject.setOption(JavaCore.COMPILER_SOURCE, compliance);
 		javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, compliance);
+		javaProject.setOption(JavaCore.COMPILER_OPT_SCOPED_KEYWORDS, JavaCore.DISABLED);
 		return javaProject;
 	}
 	protected void setUpProjectCompliance(IJavaProject javaProject, String compliance) throws JavaModelException, IOException {
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/ASTRewritingModifyingTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/ASTRewritingModifyingTest.java
index c966e8a..5edd1e0 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/ASTRewritingModifyingTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/src/org/eclipse/objectteams/otdt/ui/tests/dom/rewrite/ASTRewritingModifyingTest.java
@@ -27,11 +27,14 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.dom.AST;
 import org.eclipse.jdt.core.dom.ASTNode;
 import org.eclipse.jdt.core.dom.ASTParser;
 import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+import org.eclipse.text.edits.MalformedTreeException;
 
 // replace cu creation as to use JLS3 instead of JLS2.
 public class ASTRewritingModifyingTest
@@ -42,10 +45,16 @@
 		super(name);
 	}
 
+	@Override
+	public void setUpSuite() throws Exception {
+		super.setUpSuite();
+		this.javaProject.setOption(JavaCore.COMPILER_OPT_SCOPED_KEYWORDS, JavaCore.DISABLED);
+	}
+
 	public CompilationUnit createCU(ICompilationUnit unit, boolean resolveBindings) {
 
 		try {
-			ASTParser c = ASTParser.newParser(AST.JLS4);
+			ASTParser c = ASTParser.newParser(AST.JLS19);
 			c.setSource(unit);
 			c.setResolveBindings(resolveBindings);
 			ASTNode result = c.createAST(null);
@@ -60,12 +69,19 @@
 		if (source == null) {
 			throw new IllegalArgumentException();
 		}
-		ASTParser c = ASTParser.newParser(AST.JLS4);
+		ASTParser c = ASTParser.newParser(AST.JLS19);
 		c.setSource(source);
 		ASTNode result = c.createAST(null);
 		return (CompilationUnit) result;
 	}
 
+	@Override
+	public String evaluateRewrite(String source, CompilationUnit astRoot)  throws MalformedTreeException, BadLocationException {
+		// don't use inexistent project "Rewrite"
+		IJavaProject javaProject = astRoot.getJavaElement().getJavaProject();
+		return evaluateRewrite(source, astRoot, javaProject.getOptions(true));
+	}
+
 	protected IJavaProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String output, String compliance)
 			throws CoreException
 	{