You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Niklas Matthies (Jira)" <ji...@apache.org> on 2020/10/28 12:43:00 UTC

[jira] [Updated] (NETBEANS-4965) Field is shown as unused if only used in annotation

     [ https://issues.apache.org/jira/browse/NETBEANS-4965?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklas Matthies updated NETBEANS-4965:
--------------------------------------
    Description: 
When a private static final field is only used as an annotation parameter, the editor marks it as "not used". Example:

{code:java}
public class Example
{
    @SuppressWarnings(FOO)
    public void foo() { }
    
    private static final String FOO = "FOO";
}
{code}

Here the field {{FOO}} will be highlighted as unused in its declaration, with a tooltip "Field FOO not used".

My actual use-case is {{@JsonProperty}} annotations that occur both on constructor parameters and on getters, hence each property name string occurs multiple times, so
it is useful to define psf constants for those names. But it is irritating that they are all marked as unused by the editor.


  was:
When a private static final field is only used as an annotation parameter, the editor marks it as "not used". Example:

{code:java}
public class Example
{
    @SuppressWarnings(FOO)
    public void foo() { }
    
    private static final String FOO = "FOO";
}
{code}

Here the field {{FOO}} will be highlighted as unused in its declaration, with a tooltip "Field FOO not used".

My actual use-case is @JsonProperty annotations that occur both on constructor parameters and on getters, hence each property name string occurs multiple times, so
it is useful to define psf constants for those names. But it is irritating that they are all marked as unused by the editor.



> Field is shown as unused if only used in annotation
> ---------------------------------------------------
>
>                 Key: NETBEANS-4965
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-4965
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Editor
>    Affects Versions: 12.0
>            Reporter: Niklas Matthies
>            Priority: Major
>
> When a private static final field is only used as an annotation parameter, the editor marks it as "not used". Example:
> {code:java}
> public class Example
> {
>     @SuppressWarnings(FOO)
>     public void foo() { }
>     
>     private static final String FOO = "FOO";
> }
> {code}
> Here the field {{FOO}} will be highlighted as unused in its declaration, with a tooltip "Field FOO not used".
> My actual use-case is {{@JsonProperty}} annotations that occur both on constructor parameters and on getters, hence each property name string occurs multiple times, so
> it is useful to define psf constants for those names. But it is irritating that they are all marked as unused by the editor.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists