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 2017/07/18 20:23:00 UTC

[jira] [Created] (NETBEANS-41) Copy & paste suggests redundant static import for inherited members

Niklas Matthies created NETBEANS-41:
---------------------------------------

             Summary: Copy & paste suggests redundant static import for inherited members
                 Key: NETBEANS-41
                 URL: https://issues.apache.org/jira/browse/NETBEANS-41
             Project: NetBeans
          Issue Type: Bug
          Components: java - Editor
            Reporter: Niklas Matthies


Example:
{code:java}
// A.java:
package example;
public class A { public static final int FOO = 42; }

// B.java:
package example;
public class B extends A { }

// B.java:
package example;
import static example.B.FOO;
public class C {
        { System.out.println(FOO); }
}
{code}
When copying and pasting the println() line in class C (e.g. to duplicate the line), NetBeans wants to add an import for A.FOO, although it already is imported via B. When clicking OK in the Import Classes dialog, NetBeans doesn't actually add the import (in dev build 201707050001 -- NetBeans 8.2 does add the import).

In addition, if class A has a second static member BAR, and if the code is copied from elsewhere and references both FOO and BAR, then when pasting into class C, both imports for FOO and BAR are suggested (where the import for FOO is redundant as above), but when clicking OK in the Import Classes dialog, NetBeans doesn't add an import for either FOO and BAR, although the import for BAR is necessary.

This is especially inconenient if the copied code



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)