Bug 49327 - formatter can return null TextEdit when parsing valid java
Summary: formatter can return null TextEdit when parsing valid java
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-23 15:20 EST by Jon Nall CLA
Modified: 2004-02-11 09:47 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Nall CLA 2003-12-23 15:20:43 EST
I've found the new (3.0-M6) code formatter choking on (what i believe to be) a
legal Java code snippet. by choke, i mean the TextEdit returned from the
format() call is null. 

===8<=======8<=========8<===========8<
class Foo
{
    public static final Foo KABOOM = new Foo();

    private Foo() {
    }

    public Foo blowup() {
        return(Foo.KABOOM);
    }
}
===8<=======8<=========8<===========8<

the null TextEdit can be avoided if:
a) the parentheses in the return statement are removed
or
b) the return statement is changed to: return(KABOOM);

however, both jikes and javac compile the snippet above, so it seems like the
formatter should handle it as well.
Comment 1 Dani Megert CLA 2004-01-12 11:48:27 EST
Can be reproduced via UI (nothing in .log)
Comment 2 Olivier Thomann CLA 2004-01-13 09:15:50 EST
I will investigate.
Comment 3 Olivier Thomann CLA 2004-01-16 12:07:36 EST
Fixed and released in HEAD.
Regression test added.
Comment 4 Frederic Fusier CLA 2004-02-11 09:47:28 EST
Verified for 3.0-M7 with build I200402102000.