Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2014-06-23 15:14:28 +0000
committerMarkus Keller2014-06-23 15:14:28 +0000
commitdf7fe5bb670aee8facb0cd636646bf2f102d7ae4 (patch)
tree83c4a1e826896d253cb775f889f858ed3513fb52
parent840be10ff3e2fb035347114ebd1401aa6702f41d (diff)
downloadeclipse.jdt.ui-df7fe5bb670aee8facb0cd636646bf2f102d7ae4.tar.gz
eclipse.jdt.ui-df7fe5bb670aee8facb0cd636646bf2f102d7ae4.tar.xz
eclipse.jdt.ui-df7fe5bb670aee8facb0cd636646bf2f102d7ae4.zip
Bug 434188: [quick fix] shows sign of quick fix, but says no suggestions available.
-rw-r--r--org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
index 18b143fd25..e160262681 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
@@ -33,6 +33,7 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
@@ -10109,4 +10110,38 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
assertExpectedExistInProposals(proposals, new String[] { expected1 });
}
+ // regression test for https://bugs.eclipse.org/434188 - [quick fix] shows sign of quick fix, but says no suggestions available.
+ public void testNoFixFor_ParsingErrorInsertToComplete() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.util.*;\n");
+ buf.append("class E {\n");
+ buf.append(" public class MyLayout {\n");
+ buf.append(" int indent;\n");
+ buf.append(" }\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" new MyLayout().indent // no real quick fix\n");
+ buf.append(" }\n");
+ buf.append(" \n");
+ buf.append(" private int[] fField;\n");
+ buf.append(" public void bar() {\n");
+ buf.append(" fField[0] // no quick fix\n");
+ buf.append(" }\n");
+ buf.append(" void foo(Map<String, String> map) {\n");
+ buf.append(" map..keySet(); // no quick fix\n");
+ buf.append(" }\n");
+ buf.append(" void // no quick fix\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ List proposals= collectCorrections(cu, astRoot, 8, null);
+ assertNumberOfProposals(proposals, 0);
+
+ for (IProblem problem : astRoot.getProblems()) {
+ assertEquals(IProblem.ParsingErrorInsertToComplete, problem.getID());
+ }
+ }
+
}

Back to the top