netbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niklas Matthies (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (NETBEANS-41) Copy & paste problems with static imports for inherited members
Date Tue, 18 Jul 2017 20:24:00 GMT

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

Niklas Matthies updated NETBEANS-41:
------------------------------------
    Description: 
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.

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


> Copy & paste problems with static imports 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 message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message