Bug 235774 - [eval] Code snippet evaluation doesn't work for message send with type arguments
Summary: [eval] Code snippet evaluation doesn't work for message send with type arguments
Status: CLOSED DUPLICATE of bug 235783
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-05 04:52 EDT by David Audel CLA
Modified: 2009-12-15 10:55 EST (History)
1 user (show)

See Also:


Attachments
DebugEvaluationTest.test066() (2.37 KB, patch)
2008-06-05 04:53 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2008-06-05 04:52:28 EDT
build I20080603-2000

1) add the following method in DebugEvaluationTest.java

public void test066() {
	if (this.complianceLevel < ClassFileConstants.JDK1_5) return;
	try {
		String sourceA66 =
			"public class A66 {\n"
				+ "\tprivate int i;\n"
				+ "\tpublic A66() {;\n"
				+ "\t}\n"
				+ "\tprivate <U> int foo(int i) {;\n"
				+ "\t\treturn i;\n"    
				+ "\t}\n"               
				+ "\tpublic void bar() {\n"
				+ "\t}\n"
				+ "}";
		compileAndDeploy15(sourceA66, "A66");

		String userCode = "new A66().bar();";
		JDIStackFrame stackFrame =
			new JDIStackFrame(this.jdiVM, this, userCode, "A66", "bar", -1);

		DebugRequestor requestor = new DebugRequestor();
		char[] snippet = "return this.<Object>foo(3);".toCharArray();
		try {
			context.evaluate(
				snippet,
				stackFrame.localVariableTypeNames(),
				stackFrame.localVariableNames(),
				stackFrame.localVariableModifiers(),
				stackFrame.declaringTypeName(),
				stackFrame.isStatic(),
				stackFrame.isConstructorCall(),
				getEnv(),
				getCompilerOptions(),
				requestor,
				getProblemFactory());
		} catch (InstallException e) {
			assertTrue("No targetException " + e.getMessage(), false);
		}
		assertTrue(
			"Should get one result but got " + (requestor.resultIndex + 1),
			requestor.resultIndex == 0);
		EvaluationResult result = requestor.results[0];
		assertTrue("Code snippet should not have problems", !result.hasProblems());
		assertTrue("Result should have a value", result.hasValue());
		assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
		assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
	} finally {
		removeTempClass("A66");
	}
}

2) run this junit test
The test fails

If '<Object>' is removed from the snippet the test does not fail.
Comment 1 David Audel CLA 2008-06-05 04:53:34 EDT
Created attachment 103708 [details]
DebugEvaluationTest.test066()
Comment 2 Olivier Thomann CLA 2009-12-15 10:55:51 EST
Closing as a duplicate of bug 235783.
235783 is a more generic bug that covers this case.

*** This bug has been marked as a duplicate of bug 235783 ***