Released patch to fixed bug 71767: Semantic highlighting does not update scanners on property changes
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
index 02d602e..e45f277 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
@@ -215,7 +215,6 @@
 import org.eclipse.jdt.internal.ui.text.IJavaPartitions;
 import org.eclipse.jdt.internal.ui.text.JavaChangeHover;
 import org.eclipse.jdt.internal.ui.text.JavaPairMatcher;
-import org.eclipse.jdt.internal.ui.text.JavaPresentationReconciler;
 import org.eclipse.jdt.internal.ui.text.JavaWordIterator;
 import org.eclipse.jdt.internal.ui.text.PreferencesAdapter;
 import org.eclipse.jdt.internal.ui.text.java.hover.JavaExpandHover;
@@ -3848,8 +3847,7 @@
 	private void installSemanticHighlighting() {
 		if (fSemanticManager == null) {
 			fSemanticManager= new SemanticHighlightingManager();
-			JavaPresentationReconciler backgroundPresentationReconciler= (JavaPresentationReconciler) new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), getPreferenceStore(), this, IJavaPartitions.JAVA_PARTITIONING).getPresentationReconciler(getSourceViewer());
-			fSemanticManager.install(this, (JavaSourceViewer) getSourceViewer(), JavaPlugin.getDefault().getJavaTextTools().getColorManager(), getPreferenceStore(), backgroundPresentationReconciler);
+			fSemanticManager.install(this, (JavaSourceViewer) getSourceViewer(), JavaPlugin.getDefault().getJavaTextTools().getColorManager(), getPreferenceStore());
 		}
 	}
 	
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java
index bb3ee21..c7a6a68 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java
@@ -31,7 +31,9 @@
 import org.eclipse.jdt.ui.PreferenceConstants;
 import org.eclipse.jdt.ui.text.IColorManager;
 import org.eclipse.jdt.ui.text.IColorManagerExtension;
+import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
 
+import org.eclipse.jdt.internal.ui.text.IJavaPartitions;
 import org.eclipse.jdt.internal.ui.text.JavaPresentationReconciler;
 
 /**
@@ -262,6 +264,8 @@
 	private IColorManager fColorManager;
 	/** The preference store */
 	private IPreferenceStore fPreferenceStore;
+	/** The source viewer configuration */
+	private JavaSourceViewerConfiguration fConfiguration;
 	/** The presentation reconciler */
 	private JavaPresentationReconciler fPresentationReconciler;
 	
@@ -277,12 +281,42 @@
 	 * @param preferenceStore The preference store
 	 * @param backgroundPresentationReconciler the background presentation reconciler
 	 */
+	public void install(JavaEditor editor, JavaSourceViewer sourceViewer, IColorManager colorManager, IPreferenceStore preferenceStore) {
+		fEditor= editor;
+		fSourceViewer= sourceViewer;
+		fColorManager= colorManager;
+		fPreferenceStore= preferenceStore;
+		if (fEditor != null) {
+			fConfiguration= new JavaSourceViewerConfiguration(colorManager, preferenceStore, editor, IJavaPartitions.JAVA_PARTITIONING);
+			fPresentationReconciler= (JavaPresentationReconciler) fConfiguration.getPresentationReconciler(sourceViewer);
+		} else {
+			fConfiguration= null;
+			fPresentationReconciler= null;
+		}
+		
+		fPreferenceStore.addPropertyChangeListener(this);
+
+		if (isEnabled())
+			enable();
+	}
+	
+	/**
+	 * Install the semantic highlighting on the given editor infrastructure
+	 * 
+	 * @param editor The Java editor
+	 * @param sourceViewer The source viewer 
+	 * @param colorManager The color manager
+	 * @param preferenceStore The preference store
+	 * @param backgroundPresentationReconciler the background presentation reconciler
+	 * @deprecated As of 3.0.1, use {@link SemanticHighlightingManager#install(JavaEditor, JavaSourceViewer, IColorManager, IPreferenceStore) instead
+	 */
 	public void install(JavaEditor editor, JavaSourceViewer sourceViewer, IColorManager colorManager, IPreferenceStore preferenceStore, JavaPresentationReconciler backgroundPresentationReconciler) {
 		fEditor= editor;
 		fSourceViewer= sourceViewer;
 		fColorManager= colorManager;
 		fPreferenceStore= preferenceStore;
 		fPresentationReconciler= backgroundPresentationReconciler;
+		fConfiguration= null;
 		
 		fPreferenceStore.addPropertyChangeListener(this);
 
@@ -300,7 +334,7 @@
 	 */
 	public void install(JavaSourceViewer sourceViewer, IColorManager colorManager, IPreferenceStore preferenceStore, HighlightedRange[][] hardcodedRanges) {
 		fHardcodedRanges= hardcodedRanges;
-		install(null, sourceViewer, colorManager, preferenceStore, null);
+		install(null, sourceViewer, colorManager, preferenceStore);
 	}
 	
 	/**
@@ -373,6 +407,7 @@
 		fEditor= null;
 		fSourceViewer= null;
 		fColorManager= null;
+		fConfiguration= null;
 		fPresentationReconciler= null;
 	}
 
@@ -453,6 +488,9 @@
 		if (fPreferenceStore == null)
 			return; // Uninstalled during event notification
 		
+		if (fConfiguration != null)
+			fConfiguration.handlePropertyChangeEvent(event);
+		
 		if (PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED.equals(event.getProperty())) {
 			if (isEnabled())
 				enable();
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaCommentScanner.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaCommentScanner.java
index 23674d5..bc321c3 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaCommentScanner.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaCommentScanner.java
@@ -78,12 +78,12 @@
 		 * @see org.eclipse.jdt.internal.ui.text.CombinedWordRule.WordMatcher#clearWords()
 		 * @since 3.0
 		 */
-		public void clearWords() {
+		public synchronized void clearWords() {
 			super.clearWords();
 			fUppercaseWords.clear();
 		}
 	
-		public void addTaskTags(String value) {
+		public synchronized void addTaskTags(String value) {
 			String[] tasks= split(value, ","); //$NON-NLS-1$
 			for (int i= 0; i < tasks.length; i++) {
 				if (tasks[i].length() > 0) {
@@ -106,7 +106,7 @@
 		 * @see org.eclipse.jdt.internal.ui.text.CombinedWordRule.WordMatcher#addWord(java.lang.String, org.eclipse.jface.text.rules.IToken)
 		 * @since 3.0
 		 */
-		public void addWord(String word, IToken token) {
+		public synchronized void addWord(String word, IToken token) {
 			Assert.isNotNull(word);
 			Assert.isNotNull(token);		
 		
@@ -118,7 +118,7 @@
 		 * @see org.eclipse.jdt.internal.ui.text.CombinedWordRule.WordMatcher#evaluate(org.eclipse.jface.text.rules.ICharacterScanner, org.eclipse.jdt.internal.ui.text.CombinedWordRule.CharacterBuffer)
 		 * @since 3.0
 		 */
-		public IToken evaluate(ICharacterScanner scanner, CombinedWordRule.CharacterBuffer word) {
+		public synchronized IToken evaluate(ICharacterScanner scanner, CombinedWordRule.CharacterBuffer word) {
 			if (fCaseSensitive)
 				return super.evaluate(scanner, word);
 			
@@ -274,8 +274,10 @@
 		if (fTaskTagMatcher != null && event.getProperty().equals(COMPILER_TASK_TAGS)) {
 			Object value= event.getNewValue();
 			if (value instanceof String) {
-				fTaskTagMatcher.clearWords();
-				fTaskTagMatcher.addTaskTags((String) value);
+				synchronized (fTaskTagMatcher) {
+					fTaskTagMatcher.clearWords();
+					fTaskTagMatcher.addTaskTags((String) value);
+				}
 			}
 		} else if (fTaskTagMatcher != null && event.getProperty().equals(COMPILER_TASK_CASE_SENSITIVE)) {
 			Object value= event.getNewValue();