GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-930

Organize imports and static/star imports

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.1RC1
    • Fix Version/s: None
    • Component/s: Quick fix/assist
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In GRECLIPSE-929, there was discovered to be a problem with static and star imports when the organize imports operation was invoked. That is now fixed, but static and star imports are never deleted even when they are no longer referenced. Organize imports should be smart enough to remove them when appropriate and also to convert to non-star imports when appropriate.

        Activity

        Hide
        Andy Clement added a comment -

        Be careful with changes in this area, some treatment of static/star imports is already erratic. If I take this code (with junit 4 on the classpath):

        import org.junit.*
        import static Assert.assertEquals

        class Foo {
        public static void main(String[] argv)

        { assertEquals(2,2) }
        }

        and run 'organize imports' on it, I currently get:

        import static org.junit.Assert.assertEquals

        import org.junit.*

        class Foo {

        public static void main(String[] argv) { assertEquals(2,2) }

        }

        (because the Assert.assertEquals was correctly found relative to org.junit.* - whether the fact that it was eventually found using a path relative to another node is probably not recorded in the node)

        Show
        Andy Clement added a comment - Be careful with changes in this area, some treatment of static/star imports is already erratic. If I take this code (with junit 4 on the classpath): import org.junit.* import static Assert.assertEquals class Foo { public static void main(String[] argv) { assertEquals(2,2) } } and run 'organize imports' on it, I currently get: import static org.junit.Assert.assertEquals import org.junit.* class Foo { public static void main(String[] argv) { assertEquals(2,2) } } (because the Assert.assertEquals was correctly found relative to org.junit.* - whether the fact that it was eventually found using a path relative to another node is probably not recorded in the node)

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrew Eisenberg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: