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 236182 - [introduce constant] not allowed in some constructions
Summary: [introduce constant] not allowed in some constructions
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-20 11:06 UTC by ssazonov
Modified: 2013-09-20 11:06 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ssazonov 2013-09-20 11:06:29 UTC
1. Assume following ClassE:

package simpleproject123;

public class ClassE {

    public final int MY_INT = 0;
    public final String MY_CONST = getVal(MY_INT);

    public void method() {
        String s = getVal(MY_INT);
        System.out.println(s);
    }

    public String getVal(int val) {
        return "someValue";
    }
}

2. I expected, that "public final String MY_CONST = getVal(MY_INT);" is right defined constant agreement with java documentation because no hints are presented in editor.

3. So, when I selected "getVal(MY_INT)" in method() body I expected I Could Introduce Constant by using Alt+Shift+C instead i get "Invalid Selection" Error.

>> I think there should be either hint that "public final String MY_CONST = getVal(MY_INT);" is deprecated if it is (I don't know) or option Introduce Constantn should be allowed on "getVal(MY_INT)" at method() body.

Product Version: NetBeans IDE 7.4 RC1 (Build 201309152201)
Java: 1.7.0_40; Java HotSpot(TM) Client VM 24.0-b56
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)