This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 230214 - Reformat code should not split empty anonymous inner classes
Summary: Reformat code should not split empty anonymous inner classes
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.2.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-24 06:31 UTC by _ tboudreau
Modified: 2013-05-24 06:31 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2013-05-24 06:31:05 UTC
There is a common pattern with libraries which use anonymous inner classes to create an object like a Class object but with generic types attached to it, for use as keys with Lookup-like services:

bind(new TypeLiteral<List<MockUser>>() {}).toProvider(users);

This pattern is used by Guice's TypeLiteral and Jackson's TypeReference - and it is the way anything that needs this sort of thing will have to do it.

Reformat code in NetBeans always splits this idiom in a way which makes it much less readable:

            bind(new TypeLiteral<List<MockUser>>() {
            }).toProvider(users);

It would be better if there were a special case for anonymous inner classes with no members.