Bug 7445 - char/string concat bug
Summary: char/string concat bug
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-10 12:53 EST by Olivier Thomann CLA
Modified: 2002-02-13 13:41 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2002-01-10 12:53:52 EST
From EC:

Reproduce with build 0109:

[public class Bug {
	public static void main(String[] args) {
		String s = "4";
		s = '0' + s;
		System.out.println( "test: " + s );
	}
}]

The output is:
test: 40

With javac 1.3, the output is:
test: 04

Need investigation why the concatenation is reversed.
Comment 1 Philipe Mulet CLA 2002-01-10 13:03:11 EST
This is a code gen optimization bug: s = '0' + s --> s += '0', but in the case 
of a String concat it is not allowed.
Comment 2 Philipe Mulet CLA 2002-01-10 14:01:59 EST
There was a fix in this area already, but the fix did only look at the left 
operand instead of both operands of the + expression to check for String...

Fixed.
Comment 3 Olivier Thomann CLA 2002-01-10 16:09:07 EST
Couldn't we check that the operation implicit conversion isn't T_String instead 
of checking the left and the right?


Comment 4 Philipe Mulet CLA 2002-02-07 13:22:55 EST
Backported to 1.0 stream (rollup2)
Comment 5 Olivier Thomann CLA 2002-02-07 16:19:47 EST
Verified and added test case (see ConformTest.test109).
Comment 6 Olivier Thomann CLA 2002-02-13 13:41:15 EST
Verified in rollup2.