Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 419654

Summary: watch and inspect for Comparing strings with == which are declared final showing wrong values.
Product: [Eclipse Project] JDT Reporter: Sumit Singh <sumitsingh_1234>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Sumit Singh CLA 2013-10-17 01:08:59 EDT
Two strings and then compares them with ==.

String str1="str";
String str2="ing";
String concat=str1+str2;

System.out.println(concat=="string");
It returns false as obvious (I understand the difference between equals() and ==).
by using watch and inspect its showing "false" which is correct.

Now When these two strings are declared final like so,

final String str1="str";
final String str2="ing";
String concat=str1+str2;

System.out.println(concat=="string");
It returns true which is correct.
but by using watch and inspect its showing "false" which is incorrect. 

Its should show "true" because "Compile-time constant expressions of type String are always 'interned' so as to share unique instances, using the method String.intern." from http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.28
Comment 1 Eclipse Genie CLA 2019-10-14 00:25:54 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.