update jdt.ui tests to v20100513-0800 for 3.6RC1.
diff --git a/testplugins/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/OpenTypePerfTest.java b/testplugins/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/OpenTypePerfTest.java
index 0b807c2..d0b14b8 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/OpenTypePerfTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/OpenTypePerfTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@
 import org.eclipse.jdt.testplugin.OrderedTestSuite;
 import org.eclipse.jdt.testplugin.util.DisplayHelper;
 import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.Performance;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Event;
@@ -95,6 +96,7 @@
 
 	public void testColdException() throws Exception {
 		//cold
+		joinBackgroudActivities();
 		try {
 			measureOpenType("*Exception");
 		} finally {
@@ -110,7 +112,7 @@
 			measureOpenType("*Exception");
 		} finally {
 			commitMeasurements();
-			assertPerformanceInRelativeBand(Dimension.ELAPSED_PROCESS, -100, +10);
+			Performance.getDefault().assertPerformanceInAbsoluteBand(fPerformanceMeter, Dimension.ELAPSED_PROCESS, 0, 500);
 		}
 	}
 
@@ -147,7 +149,7 @@
 			measureOpenType("SWT", true);
 		} finally {
 			commitMeasurements();
-			assertPerformanceInRelativeBand(Dimension.ELAPSED_PROCESS, -100, +10);
+			Performance.getDefault().assertPerformanceInAbsoluteBand(fPerformanceMeter, Dimension.ELAPSED_PROCESS, 0, 500);
 		}
 	}
 
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
index 32d0013..e38fd3d 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
@@ -6559,7 +6559,7 @@
 		ArrayList proposals= collectCorrections(cu, astRoot);
 
 		assertCorrectLabels(proposals);
-		assertNumberOfProposals(proposals, 3);
+		assertNumberOfProposals(proposals, 4);
 
 		String[] expected= new String[1];
 		buf= new StringBuffer();
@@ -6599,7 +6599,7 @@
 		ArrayList proposals= collectCorrections(cu, astRoot);
 
 		assertCorrectLabels(proposals);
-		assertNumberOfProposals(proposals, 3);
+		assertNumberOfProposals(proposals, 4);
 
 		String[] expected= new String[1];
 		buf= new StringBuffer();
@@ -6783,9 +6783,20 @@
 		ArrayList proposals= collectCorrections(cu, astRoot, 1);
 
 		assertCorrectLabels(proposals);
-		assertNumberOfProposals(proposals, 3);
+		assertNumberOfProposals(proposals, 4);
 
-		String[] expected= new String[2];
+		String[] expected= new String[3];
+
+		buf= new StringBuffer();
+		buf.append("package pack;\n");
+		buf.append("import java.util.List;\n");
+		buf.append("public class E {\n");
+		buf.append("    public void test() {\n");
+		buf.append("        @SuppressWarnings(\"rawtypes\")\n");
+		buf.append("        List l;\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
 
 		buf= new StringBuffer();
 		buf.append("package pack;\n");
@@ -6796,7 +6807,7 @@
 		buf.append("        List l;\n");
 		buf.append("    }\n");
 		buf.append("}\n");
-		expected[0]= buf.toString();
+		expected[1]= buf.toString();
 
 		buf= new StringBuffer();
 		buf.append("package pack;\n");
@@ -6806,7 +6817,7 @@
 		buf.append("        List<?> l;\n");
 		buf.append("    }\n");
 		buf.append("}\n");
-		expected[1]= buf.toString();
+		expected[2]= buf.toString();
 
 		assertExpectedExistInProposals(proposals, expected);
 	}
@@ -6831,9 +6842,20 @@
 		ArrayList proposals= collectCorrections(cu, astRoot, 1);
 
 		assertCorrectLabels(proposals);
-		assertNumberOfProposals(proposals, 3);
+		assertNumberOfProposals(proposals, 4);
 
-		String[] expected= new String[2];
+		String[] expected= new String[3];
+
+		buf= new StringBuffer();
+		buf.append("package pack;\n");
+		buf.append("public class E {\n");
+		buf.append("    private class E1<P1, P2> {}\n");
+		buf.append("    public void test() {\n");
+		buf.append("        @SuppressWarnings(\"rawtypes\")\n");
+		buf.append("        E1 e1;\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
 
 		buf= new StringBuffer();
 		buf.append("package pack;\n");
@@ -6844,7 +6866,7 @@
 		buf.append("        E1 e1;\n");
 		buf.append("    }\n");
 		buf.append("}\n");
-		expected[0]= buf.toString();
+		expected[1]= buf.toString();
 
 		buf= new StringBuffer();
 		buf.append("package pack;\n");
@@ -6854,7 +6876,7 @@
 		buf.append("        E1<?, ?> e1;\n");
 		buf.append("    }\n");
 		buf.append("}\n");
-		expected[1]= buf.toString();
+		expected[2]= buf.toString();
 
 		assertExpectedExistInProposals(proposals, expected);
 	}
@@ -7227,10 +7249,20 @@
 		CompilationUnit astRoot= getASTRoot(cu);
 		ArrayList proposals= collectCorrections(cu, astRoot);
 		
-		assertNumberOfProposals(proposals, 2);
+		assertNumberOfProposals(proposals, 3);
 		assertCorrectLabels(proposals);
 
-		String[] expected= new String[1];
+		String[] expected= new String[2];
+		buf= new StringBuffer();
+		buf.append("package test1;\n");
+		buf.append("import java.util.List;\n");
+		buf.append("\n");
+		buf.append("public class E1 {\n");
+		buf.append("    public void foo(@SuppressWarnings(\"rawtypes\") List<List> list) {\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
+
 		buf= new StringBuffer();
 		buf.append("package test1;\n");
 		buf.append("import java.util.List;\n");
@@ -7240,7 +7272,7 @@
 		buf.append("    public void foo(List<List> list) {\n");
 		buf.append("    }\n");
 		buf.append("}\n");
-		expected[0]= buf.toString();
+		expected[1]= buf.toString();
 
 		assertExpectedExistInProposals(proposals, expected);
 	}
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ModifierCorrectionsQuickFixTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ModifierCorrectionsQuickFixTest.java
index 7064df2..19af55f 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ModifierCorrectionsQuickFixTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ModifierCorrectionsQuickFixTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -2538,8 +2538,17 @@
 		CompilationUnit astRoot= getASTRoot(cu);
 
 		ArrayList proposals= collectCorrections(cu, astRoot);
-		assertNumberOfProposals(proposals, 3);
+		assertNumberOfProposals(proposals, 4);
 		assertCorrectLabels(proposals);
+		String[] expected= new String[2];
+		buf= new StringBuffer();
+		buf.append("package test1;\n");
+		buf.append("public class E {\n");
+		buf.append("    static {\n");
+		buf.append("        @SuppressWarnings({\"unused\", \"nls\"}) String str= \"foo\";");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
 
 		buf= new StringBuffer();
 		buf.append("package test1;\n");
@@ -2549,7 +2558,8 @@
 		buf.append("        @SuppressWarnings(\"unused\") String str= \"foo\";");
 		buf.append("    }\n");
 		buf.append("}\n");
-		assertExpectedExistInProposals(proposals, new String[] {buf.toString()});
+		expected[1]= buf.toString();
+		assertExpectedExistInProposals(proposals, expected);
 	}
 
 	public void testSuppressNLSWarningAnnotation2() throws Exception {
@@ -2577,8 +2587,8 @@
 		buf= new StringBuffer();
 		buf.append("package test1; \n");
 		buf.append("public class E {\n");
-		buf.append("    @SuppressWarnings(\"nls\")\n");
 		buf.append("    private class Q {\n");
+		buf.append("        @SuppressWarnings(\"nls\")\n");
 		buf.append("        String s = \"\";\n");
 		buf.append("    }\n");
 		buf.append("}\n");
@@ -2607,8 +2617,8 @@
 
 		buf= new StringBuffer();
 		buf.append("package test1; \n");
-		buf.append("@SuppressWarnings(\"nls\")\n");
 		buf.append("public class E {\n");
+		buf.append("    @SuppressWarnings(\"nls\")\n");
 		buf.append("    String s = \"\";\n");
 		buf.append("}\n");
 		assertExpectedExistInProposals(proposals, new String[] {buf.toString()});
@@ -2633,8 +2643,17 @@
 		CompilationUnit astRoot= getASTRoot(cu);
 
 		ArrayList proposals= collectCorrections(cu, astRoot);
-		assertNumberOfProposals(proposals, 3);
+		assertNumberOfProposals(proposals, 4);
 		assertCorrectLabels(proposals);
+		String[] expected= new String[2];
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("public class E {\n");
+		buf.append("    public void foo() {\n");
+		buf.append("        @SuppressWarnings({\"unused\", \"nls\"}) String s = \"\";\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
 
 		buf= new StringBuffer();
 		buf.append("package test1; \n");
@@ -2644,7 +2663,8 @@
 		buf.append("        @SuppressWarnings(\"unused\") String s = \"\";\n");
 		buf.append("    }\n");
 		buf.append("}\n");
-		assertExpectedExistInProposals(proposals, new String[] {buf.toString()});
+		expected[1]= buf.toString();
+		assertExpectedExistInProposals(proposals, expected);
 	}
 
 	public void testSuppressNLSWarningAnnotation5() throws Exception {
@@ -2688,6 +2708,329 @@
 		assertExpectedExistInProposals(proposals, expected);
 	}
 
+	public void testSuppressWarningsForLocalVariables() throws Exception {
+		Hashtable options= JavaCore.getOptions();
+		options.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.WARNING);
+		options.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.WARNING);
+		JavaCore.setOptions(options);
+
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.ArrayList;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public void foo() {\n");
+		buf.append("         @SuppressWarnings(\"unused\")\n");
+		buf.append("         ArrayList localVar= new ArrayList();");
+		buf.append("    }\n");
+		buf.append("}\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+		CompilationUnit astRoot= getASTRoot(cu);
+		ArrayList proposals= collectCorrections(cu, astRoot, 2);
+
+		assertCorrectLabels(proposals);
+		assertNumberOfProposals(proposals, 4);
+		String[] expected= new String[2];
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.ArrayList;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public void foo() {\n");
+		buf.append("         @SuppressWarnings({\"unused\", \"rawtypes\"})\n");
+		buf.append("         ArrayList localVar= new ArrayList();");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
+
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.ArrayList;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    @SuppressWarnings(\"rawtypes\")\n");
+		buf.append("    public void foo() {\n");
+		buf.append("         @SuppressWarnings(\"unused\")\n");
+		buf.append("         ArrayList localVar= new ArrayList();");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[1]= buf.toString();
+
+		assertExpectedExistInProposals(proposals, expected);
+	}
+
+	public void testSuppressWarningsForFieldVariables() throws Exception {
+		Hashtable options= JavaCore.getOptions();
+		options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.WARNING);
+		JavaCore.setOptions(options);
+
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    List<String> myList = new ArrayList();\n");
+		buf.append("}\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+		CompilationUnit astRoot= getASTRoot(cu);
+		ArrayList proposals= collectCorrections(cu, astRoot, 1);
+
+		assertCorrectLabels(proposals);
+		assertNumberOfProposals(proposals, 3);
+
+		String[] expected= new String[1];
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    @SuppressWarnings(\"unchecked\")\n");
+		buf.append("    List<String> myList = new ArrayList();\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
+
+		assertExpectedExistInProposals(proposals, expected);
+	}
+
+	public void testSuppressWarningsForFieldVariables2() throws Exception {
+		Hashtable options= JavaCore.getOptions();
+		options.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.WARNING);
+		options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.WARNING);
+		JavaCore.setOptions(options);
+
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.ArrayList;\n");
+		buf.append("\n");
+		buf.append("class A {\n");
+		buf.append("    @SuppressWarnings(\"rawtypes\")\n");
+		buf.append("    ArrayList array;\n");
+		buf.append("    boolean a= array.add(1), b= array.add(1);\n");
+		buf.append("}\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+		CompilationUnit astRoot= getASTRoot(cu);
+		ArrayList proposals= collectCorrections(cu, astRoot, 2);
+
+		assertCorrectLabels(proposals);
+		assertNumberOfProposals(proposals, 3);
+
+		String[] expected= new String[1];
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.ArrayList;\n");
+		buf.append("\n");
+		buf.append("class A {\n");
+		buf.append("    @SuppressWarnings(\"rawtypes\")\n");
+		buf.append("    ArrayList array;\n");
+		buf.append("    @SuppressWarnings(\"unchecked\")\n");
+		buf.append("    boolean a= array.add(1), b= array.add(1);\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
+
+		assertExpectedExistInProposals(proposals, expected);
+
+	}
+
+	public void testSuppressWarningsForMethodParameters() throws Exception {
+		Hashtable options= JavaCore.getOptions();
+		options.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.WARNING);
+		JavaCore.setOptions(options);
+
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public int foo(int param1, List param2) {\n");
+		buf.append("         return param1;\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+		CompilationUnit astRoot= getASTRoot(cu);
+		ArrayList proposals= collectCorrections(cu, astRoot, 1);
+
+		assertCorrectLabels(proposals);
+		assertNumberOfProposals(proposals, 4);
+		String[] expected= new String[2];
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public int foo(int param1, @SuppressWarnings(\"rawtypes\") List param2) {\n");
+		buf.append("         return param1;\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
+
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    @SuppressWarnings(\"rawtypes\")\n");
+		buf.append("    public int foo(int param1, List param2) {\n");
+		buf.append("         return param1;\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		expected[1]= buf.toString();
+		assertExpectedExistInProposals(proposals, expected);
+
+	}
+
+	public void testSuppressWarningsAnonymousClass1() throws Exception {
+		Hashtable options= JavaCore.getOptions();
+		options.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.WARNING);
+		JavaCore.setOptions(options);
+
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public void foo() {\n");
+		buf.append("        @SuppressWarnings(\"unused\")\n");
+		buf.append("        final Object object = new Object() {\n");
+		buf.append("            {\n");
+		buf.append("                for (List l = new ArrayList(), x = new Vector();;) {\n");
+		buf.append("                    if (l == x)\n");
+		buf.append("                        break;\n");
+		buf.append("                }\n");
+		buf.append("            }\n");
+		buf.append("        };\n");
+		buf.append("    };\n");
+		buf.append("};\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+		CompilationUnit astRoot= getASTRoot(cu);
+		ArrayList proposals= collectCorrections(cu, astRoot, 3);
+
+		assertCorrectLabels(proposals);
+		assertNumberOfProposals(proposals, 5);
+		String[] expected= new String[3];
+		
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public void foo() {\n");
+		buf.append("        @SuppressWarnings(\"unused\")\n");
+		buf.append("        final Object object = new Object() {\n");
+		buf.append("            {\n");
+		buf.append("                for (@SuppressWarnings(\"rawtypes\")\n");
+		buf.append("                List l = new ArrayList(), x = new Vector();;) {\n");
+		buf.append("                    if (l == x)\n");
+		buf.append("                        break;\n");
+		buf.append("                }\n");
+		buf.append("            }\n");
+		buf.append("        };\n");
+		buf.append("    };\n");
+		buf.append("};\n");
+		expected[0]= buf.toString();
+
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public void foo() {\n");
+		buf.append("        @SuppressWarnings({\"unused\", \"rawtypes\"})\n");
+		buf.append("        final Object object = new Object() {\n");
+		buf.append("            {\n");
+		buf.append("                for (List l = new ArrayList(), x = new Vector();;) {\n");
+		buf.append("                    if (l == x)\n");
+		buf.append("                        break;\n");
+		buf.append("                }\n");
+		buf.append("            }\n");
+		buf.append("        };\n");
+		buf.append("    };\n");
+		buf.append("};\n");
+		expected[1]= buf.toString();
+		
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    @SuppressWarnings(\"rawtypes\")\n");
+		buf.append("    public void foo() {\n");
+		buf.append("        @SuppressWarnings(\"unused\")\n");
+		buf.append("        final Object object = new Object() {\n");
+		buf.append("            {\n");
+		buf.append("                for (List l = new ArrayList(), x = new Vector();;) {\n");
+		buf.append("                    if (l == x)\n");
+		buf.append("                        break;\n");
+		buf.append("                }\n");
+		buf.append("            }\n");
+		buf.append("        };\n");
+		buf.append("    };\n");
+		buf.append("};\n");
+		expected[1]= buf.toString();
+
+		assertExpectedExistInProposals(proposals, expected);
+	}
+
+	public void testSuppressWarningsAnonymousClass2() throws Exception {
+		Hashtable options= JavaCore.getOptions();
+		options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.WARNING);
+		JavaCore.setOptions(options);
+
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    final Runnable r= new Runnable() {\n");
+		buf.append("        public void run() {\n");
+		buf.append("            boolean b;\n");
+		buf.append("            for (b = new ArrayList().add(1);;) {\n");
+		buf.append("                if (b)\n");
+		buf.append("                    return;\n");
+		buf.append("                        break;\n");
+		buf.append("            }\n");
+		buf.append("        }\n");
+		buf.append("    };\n");
+		buf.append("}\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+		CompilationUnit astRoot= getASTRoot(cu);
+		ArrayList proposals= collectCorrections(cu, astRoot, 1);
+
+		assertCorrectLabels(proposals);
+		assertNumberOfProposals(proposals, 2);
+		String[] expected= new String[1];
+		buf= new StringBuffer();
+		buf.append("package test1; \n");
+		buf.append("import java.util.*;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    final Runnable r= new Runnable() {\n");
+		buf.append("        @SuppressWarnings(\"unchecked\")\n");
+		buf.append("        public void run() {\n");
+		buf.append("            boolean b;\n");
+		buf.append("            for (b = new ArrayList().add(1);;) {\n");
+		buf.append("                if (b)\n");
+		buf.append("                    return;\n");
+		buf.append("                        break;\n");
+		buf.append("            }\n");
+		buf.append("        }\n");
+		buf.append("    };\n");
+		buf.append("}\n");
+		expected[0]= buf.toString();
+
+		assertExpectedExistInProposals(proposals, expected);
+	}
 	public void testMisspelledSuppressToken() throws Exception {
 		IPackageFragment pack1= fSourceFolder.createPackageFragment("a", false, null);
 		StringBuffer buf= new StringBuffer();
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java
index f2edf15..5910833 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java
@@ -554,4 +554,80 @@
 
 		NLSSearchTestHelper.assertNumberOfProblems(accessor, propertiesFile, 0);
 	}
+
+	public void testBug306168_1() throws Exception {
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("import java.util.MissingResourceException;\n");
+		buf.append("import java.util.ResourceBundle;\n");
+		buf.append("public class Accessor {\n");
+		buf.append("    private static final String BUNDLE_NAME = \"test.Accessor\"; //$NON-NLS-1$\n");
+		buf.append("    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);\n");
+		buf.append("    private Accessor() {}\n");
+		buf.append("    public static String getString(String key) {\n");
+		buf.append("        try {\n");
+		buf.append("            return RESOURCE_BUNDLE.getString(key);\n");
+		buf.append("        } catch (MissingResourceException e) {\n");
+		buf.append("            return '!' + key + '!';\n");
+		buf.append("        }\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		ICompilationUnit accessor= pack1.createCompilationUnit("Accessor.java", buf.toString(), false, null);
+
+		buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("public class Client {\n");
+		buf.append("	private static final String X =\"Main.indirect\";//$NON-NLS-1$ \n");
+		buf.append("	public static void main(String[] args) { \n");
+		buf.append("		Accessor.getString(test.Client.X); \n");
+		buf.append("	}\n");
+		buf.append("}\n");
+
+		pack1.createCompilationUnit("Client.java", buf.toString(), false, null);
+
+		buf= new StringBuffer();
+		buf.append("Main.indirect=Main.indirect\n");
+		IFile propertiesFile= write((IFolder)pack1.getCorrespondingResource(), buf.toString(), "Accessor.properties");
+
+		NLSSearchTestHelper.assertNumberOfProblems(accessor, propertiesFile, 0);
+	}
+
+	public void testBug306168_2() throws Exception {
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("import java.util.MissingResourceException;\n");
+		buf.append("import java.util.ResourceBundle;\n");
+		buf.append("public class Accessor {\n");
+		buf.append("    private static final String BUNDLE_NAME = \"test.Accessor\"; //$NON-NLS-1$\n");
+		buf.append("    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);\n");
+		buf.append("    private Accessor() {}\n");
+		buf.append("    public static String getString(String key) {\n");
+		buf.append("        try {\n");
+		buf.append("            return RESOURCE_BUNDLE.getString(key);\n");
+		buf.append("        } catch (MissingResourceException e) {\n");
+		buf.append("            return '!' + key + '!';\n");
+		buf.append("        }\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		ICompilationUnit accessor= pack1.createCompilationUnit("Accessor.java", buf.toString(), false, null);
+
+		buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("public class Client {\n");
+		buf.append("	private static final String X =\"Main.undefined\";//$NON-NLS-1$ \n");
+		buf.append("	public static void main(String[] args) { \n");
+		buf.append("		Accessor.getString(test.Client.X); \n");
+		buf.append("	}\n");
+		buf.append("}\n");
+
+		pack1.createCompilationUnit("Client.java", buf.toString(), false, null);
+
+		buf= new StringBuffer();
+		IFile propertiesFile= write((IFolder)pack1.getCorrespondingResource(), buf.toString(), "Accessor.properties");
+
+		NLSSearchTestHelper.assertNumberOfProblems(accessor, propertiesFile, 1);
+	}
+
 }