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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/BinaryMethod.java (-2 / +2 lines)
Lines 302-309 Link Here
302
			return this.parameterNames = names;
302
			return this.parameterNames = names;
303
		}
303
		}
304
	}
304
	}
305
	// if still no parameter names, produce fake ones
305
	// If still no parameter names, produce fake ones, but don't cache them (https://bugs.eclipse.org/bugs/show_bug.cgi?id=329671)
306
	return this.parameterNames = getRawParameterNames(paramCount);
306
	return getRawParameterNames(paramCount);
307
}
307
}
308
private char[][] splitParameters(char[] parametersSource, int paramCount) {
308
private char[][] splitParameters(char[] parametersSource, int paramCount) {
309
	// we have generic types as one of the parameter types
309
	// we have generic types as one of the parameter types
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+50 lines)
Lines 21856-21859 Link Here
21856
			"myString1[LOCAL_VARIABLE_REF]{myString1, null, Ljava.lang.String;, myString1, null, " + (R_NON_STATIC + R_UNQUALIFIED + R_CASE + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}",
21856
			"myString1[LOCAL_VARIABLE_REF]{myString1, null, Ljava.lang.String;, myString1, null, " + (R_NON_STATIC + R_UNQUALIFIED + R_CASE + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}",
21857
			requestor.getResults());
21857
			requestor.getResults());
21858
}
21858
}
21859
public void testBug329671() throws CoreException, IOException {
21860
	System.out.println("Test testBug329671");
21861
	Map options = this.currentProject.getOptions(false);
21862
	Object timeout = options.get(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC);
21863
	options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "1"); //$NON-NLS-1$
21864
	this.currentProject.setOptions(options);
21865
21866
	try {
21867
		this.workingCopies = new ICompilationUnit[1];
21868
		this.workingCopies[0] = getWorkingCopy(
21869
			"/Completion/src/p/Test.java",
21870
			"package p;"+
21871
			"public class Test {\n" +
21872
			"  void foo(bug.X x) {\n" +
21873
			"    x.fo\n" +
21874
			"  }\n" +
21875
			"}\n");
21876
21877
		addLibrary(
21878
				"Completion",
21879
				"bug329671.jar",
21880
				null,
21881
				"bug329671_doc.zip",
21882
				false);
21883
21884
		try {
21885
			
21886
			CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
21887
			String str = this.workingCopies[0].getSource();
21888
			String completeBehind = "x.fo";
21889
			int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
21890
			this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
21891
			assertResults("foo[METHOD_REF]{foo(), Lbug.X;, (Ljava.lang.Object;)V, foo, (arg0), 35}", requestor.getResults());
21892
			//The previous attempt would have already kicked off the Javadoc fetching. Small delay to allow it to complete. 
21893
			try {
21894
				Thread.sleep(2000);
21895
			}catch (InterruptedException ie) {
21896
			}
21897
			options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "2000"); //$NON-NLS-1$
21898
			requestor = new CompletionTestsRequestor2(true);
21899
			this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
21900
			assertResults("foo[METHOD_REF]{foo(), Lbug.X;, (Ljava.lang.Object;)V, foo, (param), 35}", requestor.getResults());
21901
		} finally {
21902
			removeLibrary("Completion", "bug329671.jar");
21903
		}
21904
	} finally {
21905
		options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, timeout);
21906
		this.currentProject.setOptions(options);
21907
	}
21908
}
21859
}
21909
}

Return to bug 329671