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 204107

Summary: EnumSet suggestions for method arguments/fields that are Sets of an enum type
Product: java Reporter: dbell
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: Macintosh   
OS: Mac OS X   
Issue Type: ENHANCEMENT Exception Reporter:

Description dbell 2011-10-23 01:14:41 UTC
[ JDK VERSION : 1.6.26 ]

In situations when a method is being called in Java, and that method takes an
argument whose type is Set<SomeEnumType>, it would be great if the editor
suggested EnumSet.of(SomeEnumType.A_CONSTANT), and
EnumSet.allOf(SomeEnumType.class) at the top of the code completion results, as
this is quite a common idiom.

e.g.
void myMethod(Set<MyEnumType> options) {
    ...
}

void doSomething() {
    myMethod(|
}


Invoking code completion at the carat above would yield
EnumSet.allOf(MyEnumType.class) as the top result, followed by EnumSet.of(|
(whereupon code code completion is automatically invoked again, suggesting all
enum constants of the given type.