You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "negora (Jira)" <ji...@apache.org> on 2020/06/15 06:40:00 UTC

[jira] [Created] (NETBEANS-4451) "Override Method..." doesn't replicate annotations on methods and types

negora created NETBEANS-4451:
--------------------------------

             Summary: "Override Method..." doesn't replicate annotations on methods and types
                 Key: NETBEANS-4451
                 URL: https://issues.apache.org/jira/browse/NETBEANS-4451
             Project: NetBeans
          Issue Type: Improvement
          Components: editor - Completion &amp; Templates
    Affects Versions: 12.0
         Environment: Debian GNU/Linux 10 (buster)
Linux my-computer 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux
OpenJDK 14.0.0+36
            Reporter: negora


When I use the feature that creates delegated methods, the editor doesn't replicate the annotations of the delegate methods and their types (i.e. the types used in the arguments). I'm referring to the feature that is accessible through the menu {{"Source → Insert Code... → Delegate Method..."}}

In my code, I use the Checker Framework a lot, which uses multiple annotations to add certain checks at compilation time. For example, consider a method like this:
{code:java}
@SideEffectFree
public @Nullable Foo createFoo (@Nullable String bar) {
  ...
} {code}
When I create a delegated method with Netbeans IDE, it creates this:
{code:java}
public Foo createFoo (String bar) {
  return delegate.createFoo (bar);
}{code}
Instead of this:
{code:java}
@SideEffectFree
public @Nullable Foo createFoo (@Nullable String bar) {
  return delegate.createFoo (bar);
}{code}
It would be really useful if the editor took these annotations into account. Maybe the wizard could add a checkbox that made this inclusion optional.

There is a case that should be treated in a special way, I guess. It's the "@Override" annotation. If the class that delegates the method isn't overriding such method, that annotation should be ignored.

Thank you.

 



--
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