Bug 270462 - [toString] toString wizard generates wrong code
Summary: [toString] toString wizard generates wrong code
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2009-03-30 10:51 EDT by Dani Megert CLA
Modified: 2009-04-29 05:36 EDT (History)
1 user (show)

See Also:
markus.kell.r: review+


Attachments
patch (6.77 KB, patch)
2009-04-20 21:24 EDT, Mateusz Matela CLA
markus.kell.r: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2009-03-30 10:51:23 EDT
I20090325-1135 + plug-in export.

Generating toString using MessageFormat produces wrong result:


	public String toString() {
		return MessageFormat.format("a [i={1}, j={2}, k={3}]", new Object[] {
				Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(k) });
	}

Pattern starts with 0.

Please also verify all other generated code.
Comment 1 Mateusz Matela CLA 2009-04-20 21:22:25 EDT
Using Integer.valueOf(i) is also wrong - in JDK 1.4 it must be new Integer(i).
This patch fixes both problems.
Comment 2 Mateusz Matela CLA 2009-04-20 21:24:21 EDT
Created attachment 132527 [details]
patch
Comment 3 Markus Keller CLA 2009-04-26 11:30:35 EDT
Released to HEAD.
Comment 4 Dani Megert CLA 2009-04-29 05:36:13 EDT
Verified in I20090429-0100.