Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311430 - [extract local] generates bad import for expressions returning a nested type
Summary: [extract local] generates bad import for expressions returning a nested type
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-03 16:42 EDT by Chris West (Faux) CLA
Modified: 2010-05-07 14:46 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris West (Faux) CLA 2010-05-03 16:42:59 EDT
Build Identifier: I20100413-1521

Attempting to "Extract local variable" from "Bar.b" or "Bar.class" generates an illegal import for "Scratch.Bar".  This is caught at the preview stage.  Doesn't happen with static field or method access?  

class Scratch {
  static class Bar {
    static Bar b = new Bar();
  }
  void foo() {
    System.out.println(Bar.b);
    System.out.println(Bar.class);
  }
}

Generated code is fine apart from the import. Same issue as bug 304827?

Reproducible: Always

Steps to Reproduce:
1. Create the class above.
2. Hilight "Bar.class" or "Bar.b".
3. alt+shift+l / alt+shift+t / right-click refactor -> Extract Local Variable.
4. Accept name.
5. Error detected at Preview step.
Comment 1 Dani Megert CLA 2010-05-07 06:32:51 EDT
Works for me using latest builds, e.g. N20100505-2000. Please reopen if you still see this with said build and provide more steps.
Comment 2 Markus Keller CLA 2010-05-07 06:52:38 EDT
Note that we fixed a few bug in that area recently, so it's well possible that this really failed in I20100413-1521.
Comment 3 Chris West (Faux) CLA 2010-05-07 14:46:52 EDT
Yeah, I can't reproduce in I20100506-0800.  Well played.