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 - Errorous generation of enum fields
Summary: Errorous generation of enum fields
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Max Sauer
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2009-08-14 13:26 UTC by Max Sauer
Modified: 2009-08-21 06:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed API change (3.81 KB, patch)
2009-08-14 13:42 UTC, Max Sauer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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()