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 170373

Summary: Errorous generation of enum fields
Product: java Reporter: Max Sauer <msauer>
Component: HintsAssignee: Max Sauer <msauer>
Status: RESOLVED FIXED    
Severity: blocker CC: dbalek
Priority: P3 Keywords: API, API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Proposed API change

Description Max Sauer 2009-08-14 13:26:46 UTC
Having

enum TestEnum {
  A, B
}

and invoking 'Add default serialVersionUID' hint produces code with error -- missing semicolon, which leads to uncompilable code.
Comment 1 Max Sauer 2009-08-14 13:41:30 UTC
I would like to propose a small change in java.source API.

For this issue and possibly also elsewhere, it would be nice to introduce a new method in org.netbeans.api.java.source.TreeUtilities to be able to recognize 
an Enum constant from tree. Similar methods are already present.

Method signature:
public boolean isEnumConstant(VariableTree tree)

I'll attach diff.
Comment 2 Max Sauer 2009-08-14 13:42:30 UTC
Created attachment 86241 [details]
Proposed API change
Comment 3 Dusan Balek 2009-08-14 14:01:57 UTC
Strange description in apichanges.xml:
"Added <code>TreeUtilities.isEnumConstant()</code> to return the TreeUtilities."

Otherwise it seems OK to me.
Comment 4 Max Sauer 2009-08-17 10:01:27 UTC
API Change:
http://hg.netbeans.org/jet-main/rev/6641456c9495

Fix of issue with enum:
http://hg.netbeans.org/jet-main/rev/7a11c1ab04ef
Comment 5 Quality Engineering 2009-08-21 06:09:09 UTC
Integrated into 'main-golden', will be available in build *200908210201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6641456c9495
User: Max Sauer <msauer@netbeans.org>
Log: #170373: Adding TreeUtilities.isEnumConstant()