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 204373 - Introduce constant inside anonymous class corrupts source
Summary: Introduce constant inside anonymous class corrupts source
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on: 204435
Blocks:
  Show dependency tree
 
Reported: 2011-10-28 20:29 UTC by _ rkubacki
Modified: 2012-04-03 11:13 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2011-10-28 20:29:30 UTC
NB7.1, JDK 1.6

Select an expression inside method body in anonymous class and run 'introduce constant' refactoring. 'public static final Foo FOO = ...' is created in this inner class and this is not allowed by Java specification.
Comment 1 Jesse Glick 2011-10-31 13:49:57 UTC
More generally I remember problems with introduce constant/field trying to add a static member to a nonstatic nested class (anonymous, local, or member); perhaps some of those have been fixed separately.
Comment 2 Jan Lahoda 2012-04-02 08:59:37 UTC
http://hg.netbeans.org/jet-main/rev/73c14c29e972
Comment 3 Quality Engineering 2012-04-03 11:13:08 UTC
Integrated into 'main-golden', will be available in build *201204030400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/73c14c29e972
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #204373: prevent adding static fields into non-static contexts.