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

Summary: Reformat code should not split empty anonymous inner classes
Product: java Reporter: _ tboudreau <tboudreau>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.2.1   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:

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.