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

Bug 359646

Summary: Formatter fails silently if Java source contains 0x8000000000000000L
Product: [Eclipse Project] JDT Reporter: Fernando Colombo <fernacolo>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: amj87.iitr, daniel_megert, kdevolder, marco.kaufmann, Olivier_Thomann, shiose, srikanth_sankaran
Version: 3.7.1Flags: daniel_megert: pmc_approved+
Target Milestone: 3.7.2   
Hardware: All   
OS: All   
Whiteboard:

Description Fernando Colombo CLA 2011-10-01 20:18:46 EDT
Build Identifier: 3.7.1, M20110909-1335

Try to format this code (Ctrl+Shift+F or right-click > Source > Format):

public class FormatterBug {

  public static void main(String[] args) {
   long x = 0x8000000000000000L; System. out   . println(x);
               }
}

It won't work. Now remove a zero from 0x8000000000000000L or replace it by Long.MIN_VALUE. Then format again and notice it now works.


Reproducible: Always
Comment 1 Dani Megert CLA 2011-10-02 02:43:15 EDT
Can reproduce using I20110927-0800.
Comment 2 Olivier Thomann CLA 2011-10-02 17:47:58 EDT
Fix is trivial.
Comment 3 Olivier Thomann CLA 2011-10-02 19:38:43 EDT
I think we should backport the fix to 3.7.2 as there is no workaround.
Comment 4 Olivier Thomann CLA 2011-10-02 19:59:27 EDT
Fixed for 3.8M3.
Commit 35e16686684b05bd7e21fa56e9152b82d8651f61
Comment 5 Olivier Thomann CLA 2011-10-02 19:59:41 EDT
Fixed.
Comment 6 Dani Megert CLA 2011-10-04 03:22:48 EDT
(In reply to comment #3)
> I think we should backport the fix to 3.7.2 as there is no workaround.
Yes. And it worked in 3.7.
Comment 7 Olivier Thomann CLA 2011-10-06 17:13:45 EDT
Fixed and released for 3.7.2.
Comment 8 Olivier Thomann CLA 2011-10-06 17:14:29 EDT
Commit 0ae3a6d7f76cc62f69bfafe0f0bf3e4ef6c2f3e5
Comment 9 Ayushman Jain CLA 2011-10-12 01:09:37 EDT
*** Bug 360600 has been marked as a duplicate of this bug. ***
Comment 10 Kris De Volder CLA 2011-10-12 13:46:28 EDT
It's not clear to me, from the bug description and comments that an analogous case for the contant 0x80000000 (i.e 'minimum' Integer instead of Long) has also been fixed.

If it is also covered and fixed then please just ignore my comment.
Comment 11 Ayushman Jain CLA 2011-10-14 02:53:55 EDT
(In reply to comment #10)
> It's not clear to me, from the bug description and comments that an analogous
> case for the contant 0x80000000 (i.e 'minimum' Integer instead of Long) has
> also been fixed.
> 
> If it is also covered and fixed then please just ignore my comment.

I checked that both cases are now fixed before marking dups.
Comment 12 Srikanth Sankaran CLA 2011-10-25 06:53:12 EDT
Verified for 3.8 M3 using build id: N20111022-2000
Comment 13 Srikanth Sankaran CLA 2012-01-05 21:21:36 EST
*** Bug 367913 has been marked as a duplicate of this bug. ***
Comment 14 Srikanth Sankaran CLA 2012-01-19 01:23:07 EST
Verified for 3.7.2RC2 using build M20120118-0800
Comment 15 Ayushman Jain CLA 2012-07-05 09:49:24 EDT
*** Bug 384361 has been marked as a duplicate of this bug. ***