View | Details | Raw Unified | Return to bug 142303 | Differences between
and this patch

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java (+3 lines)
Lines 126-131 Link Here
126
		currentElement = currentElement.add((Statement)parentNode, 0);
126
		currentElement = currentElement.add((Statement)parentNode, 0);
127
	} else {
127
	} else {
128
		currentElement = currentElement.add((Statement)wrapWithExplicitConstructorCallIfNeeded(expression), 0);
128
		currentElement = currentElement.add((Statement)wrapWithExplicitConstructorCallIfNeeded(expression), 0);
129
		if(lastCheckPoint < expression.sourceEnd) {
130
			lastCheckPoint = expression.sourceEnd + 1;
131
		}
129
	}
132
	}
130
}
133
}
131
private boolean checkRecoveredType() {
134
private boolean checkRecoveredType() {
(-)src/org/eclipse/jdt/core/tests/model/ResolveTests.java (+36 lines)
Lines 1170-1175 Link Here
1170
			elements
1170
			elements
1171
	);
1171
	);
1172
}
1172
}
1173
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142303
1174
public void testMethodInAnonymous1() throws JavaModelException {
1175
	this.workingCopies = new ICompilationUnit[2];
1176
	this.workingCopies[0] = getWorkingCopy(
1177
			"/Resolve/src/Test2.java",
1178
			"public class Test2 {\n" +
1179
			"\n" +
1180
			"    private void foo(boolean v) {\n" +
1181
			"    }\n" +
1182
			"\n" +
1183
			"    void function(boolean v) {\n" +
1184
			"        new Object() {\n" +
1185
			"            public void run() {\n" +
1186
			"                if (false) {\n" +
1187
			"                } else {\n" +
1188
			"                    foo(false); // <-- right-click, open declaration fails\n" +
1189
			"                }\n" +
1190
			"            }\n" +
1191
			"        };\n" +
1192
			"        new Object() {  public void run() {   } };\n" +
1193
			"        if (v) {}\n" +
1194
			"    }\n" +
1195
			"}");
1196
	
1197
	String str = this.workingCopies[0].getSource();
1198
	String selectAt = "foo(false)";
1199
	String selection = "foo";
1200
	int start = str.indexOf(selectAt);
1201
	int length = selection.length();
1202
	IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner);
1203
	
1204
	assertElementsEqual(
1205
			"Unexpected elements",
1206
			"foo(boolean) [in Test2 [in [Working copy] Test2.java [in <default> [in src [in Resolve]]]]]",
1207
			elements);
1208
}
1173
/**
1209
/**
1174
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=57414
1210
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=57414
1175
 */
1211
 */

Return to bug 142303