Bug 90400 - [quick fix] Quick fix generates code with syntax error
Summary: [quick fix] Quick fix generates code with syntax error
Status: RESOLVED DUPLICATE of bug 69471
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-05 21:17 EDT by Ed Burnette CLA
Modified: 2005-05-24 05:19 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Burnette CLA 2005-04-05 21:17:23 EDT
3.1M6. Start with this unit test:

package org.eclipseguide;
import junit.framework.TestCase;
public class FuzzyTest extends TestCase {
	void testFuzzyEq() {
	}
}

Inside the function start typing "asserttr". Hit Ctrl-Space, first proposal is
assertTrue(boolean). Hit return to accept. Type variable name "condition", tab,
semicolon. You should now have:

	void testFuzzyEq() {
		assertTrue(condition);
	}

with a red squiggle under "condition". Press Ctrl+1, accept quick fix "Create
local variable 'condition'". Now you have:

	void testFuzzyEq() {
		String condition;
		assertTrue(condition);
	}

which is a syntax error because there is no assertTrue(String) method. It should
have created a boolean variable instead.
Comment 1 Ed Burnette CLA 2005-04-05 21:22:11 EDT
If you want another test case try:

		assertEquals(true, condition);

Quick-fix creates this local variable:

		Object condition;

which makes another syntax error because there is no assertEquals(boolean,
Object) method.

If it matters, I do have the java source attachment properly configured for
junit.jar.
Comment 2 Martin Aeschlimann CLA 2005-05-24 05:19:23 EDT

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