Bug 307486

Summary: DBCS3.6: Fail to propose Ext-B labels with content assist in Java Editor
Product: [Eclipse Project] JDT Reporter: Masaihko Maedera <maedera>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: camle, daniel_megert, kitlo, Olivier_Thomann, pwebster, srikanth_sankaran
Version: 3.6   
Target Milestone: 3.6 M7   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Bug307486.java (import this with UTF-8 encoding)
none
Proposed fix + regression test none

Description Masaihko Maedera CLA 2010-03-30 03:56:38 EDT
Build Identifier: I20100313-1044

OS: Windows 7 (64bit), XP, SLES11
JRE: IBM JRE 1.6
Build:I20100313-1044

After creating a label that has Ext-B character at the top.
content assist can not propose the correct label.
It drops the first character.
For example, when the label is "U+20B9Fabc", the result is "abc".

Reproducible: Always

Steps to Reproduce:
1.Create a Java project.
2.Edit Java source code and type a label that has Ext-B character at the top.
3.Write "while(true) break " and type Ctrl+Space,
4.You see "abc" is a proposal and it drops the first character.

FYI: this is a sample source code
--------------------------------
public class Test {
	public static void main(String[] args) {
		&#134047;abc: // U+20B9F a b c
		while (true) {
			// Type "break " and Ctrl+Space,
			// It drop an Ext-B character at the top
			break &#134047;abc; // You may see "abc",
		}
	}
}
--------------------------------
Comment 1 Dani Megert CLA 2010-03-30 03:58:56 EDT
Could you please attach a sample file and mention the encoding you used to save the file. Thanks.
Comment 2 Masaihko Maedera CLA 2010-03-30 04:22:12 EDT
Created attachment 163374 [details]
Bug307486.java (import this with UTF-8 encoding)

I attached a sample code.
Comment 3 Dani Megert CLA 2010-03-30 07:27:25 EDT
The LABEL_REF proposal from JDT Core is wrong.
Comment 4 Srikanth Sankaran CLA 2010-03-30 08:05:45 EDT
Ayush, please investigate.
Comment 5 Olivier Thomann CLA 2010-04-07 15:31:59 EDT
Ayush, this is similar to the problem I fixed today with codeSelect(..) and surrogates characters.
I'll take care of this.
Comment 6 Olivier Thomann CLA 2010-04-07 15:41:07 EDT
The CompletionScanner doesn't support surrogate characters at the starting position of an identifier.
The fix is trivial.
Comment 7 Olivier Thomann CLA 2010-04-07 15:43:00 EDT
Created attachment 164120 [details]
Proposed fix + regression test
Comment 8 Olivier Thomann CLA 2010-04-07 15:43:34 EDT
Released for 3.6M7.
Added regression test in:
org.eclipse.jdt.core.tests.model.CompletionTests_1_5#testLabel
Comment 9 Dani Megert CLA 2010-04-09 08:56:26 EDT
Verified in N20100408-2000.
Comment 10 Masaihko Maedera CLA 2010-04-30 02:18:29 EDT
I also verified this bug is fixed in I20100426-0852 as the reporter.