Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorssankaran2014-03-07 12:06:09 +0000
committerssankaran2014-03-07 12:06:09 +0000
commitb6755ce2d08e0d5d352a051fea787f1496b49482 (patch)
tree8eb14ceb5e111f4b3d4a4494387a82ca05b935c0
parenta333d427a759192e6bdb5b11476a97e5401ec417 (diff)
downloadeclipse.jdt.core-b6755ce2d08e0d5d352a051fea787f1496b49482.tar.gz
eclipse.jdt.core-b6755ce2d08e0d5d352a051fea787f1496b49482.tar.xz
eclipse.jdt.core-b6755ce2d08e0d5d352a051fea787f1496b49482.zip
Fixed Bug 429845 - [1.8] CCE on hover P20140307-1600
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests18.java33
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java7
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java1
3 files changed, 40 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests18.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests18.java
index 43d7f1c125..de000532cf 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests18.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests18.java
@@ -2268,4 +2268,37 @@ public void test425064a() throws JavaModelException {
elements, true
);
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=429845, [1.8] CCE on hover
+public void test429845() throws JavaModelException {
+ this.wc = getWorkingCopy(
+ "/Resolve/src/X.java",
+ "@FunctionalInterface\n" +
+ "interface FI {\n" +
+ " int foo();\n" +
+ "}\n" +
+ "class C1 {\n" +
+ " void fun1(int x) {\n" +
+ " FI test= () -> {\n" +
+ " for (int k=0;k<1;) ;\n" +
+ " for (int k=0;k<1;) ;\n" +
+ " try {\n" +
+ " } catch (Exception ex) {\n" +
+ " }\n" +
+ " return 0;\n" +
+ " };\n" +
+ " }\n" +
+ "}\n");
+
+ String str = this.wc.getSource();
+ String selection = "ex";
+ int start = str.lastIndexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.wc.codeSelect(start, length);
+ assertElementsEqual(
+ "Unexpected elements",
+ "ex [in foo() [in Lambda(FI) [in fun1(int) [in C1 [in [Working copy] X.java [in <default> [in src [in Resolve]]]]]]]]",
+ elements, true
+ );
+}
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java
index 0484ed9ac5..516c317771 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -56,4 +56,9 @@ public class SelectionOnArgumentName extends Argument {
super.resolve(scope);
throw new SelectionNodeFound(this.binding);
}
+
+ public TypeBinding resolveForCatch(BlockScope scope) {
+ super.resolveForCatch(scope);
+ throw new SelectionNodeFound(this.binding);
+ }
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
index 5342f033c9..47a88f6b51 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
@@ -343,6 +343,7 @@ protected void consumeCatchFormalParameter() {
long namePositions = this.identifierPositionStack[this.identifierPtr--];
this.intPtr--; // dimension from the variabledeclaratorid
TypeReference type = (TypeReference) this.astStack[this.astPtr--];
+ this.astLengthPtr --;
int modifierPositions = this.intStack[this.intPtr--];
this.intPtr--;
Argument arg =

Back to the top