Summary: | [quick assist] Ctrl+2, L or Ctrl+2, F should also import the required type to avoid a syntax error | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Lars Vogel <Lars.Vogel> | ||||
Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> | ||||
Status: | ASSIGNED --- | QA Contact: | |||||
Severity: | enhancement | ||||||
Priority: | P3 | CC: | daniel_megert, Lars.Vogel, markus.kell.r, noopur_gupta, simon.scholz, stephan.herrmann | ||||
Version: | 4.5 | ||||||
Target Milestone: | --- | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Lars Vogel
2014-09-23 14:47:00 EDT
I cannot reproduce the issue. Example: import java.util.ArrayList; class Test extends BugExample { { (new ArrayList<String>()).stream(); } } Ctrl+2, L also adds the "import java.util.stream.Stream;" by default. Please provide a stand-alone example where it does not work. Closing as WORKSFORME. Please re-open with a stand-alone example to reproduce the issue. Noopur, I have a hard time reproducing this outside of an Android project and I guess you don't want to install the ADT tools. Could you tell me the class which is triggered by this shortcut? I can try to debug it, and see why it does not work in the Android example. To find out what happens when you press a shortcut, set a breakpoint in KeyBindingDispatcher#executeCommand(..) and step through. I know this became a bit painful with E4, but maybe you could work on that? QuickAssistProcessor#getAssists(..) and ExtractTempRefactoring#checkInitialConditions(..) are potential entry points. Created attachment 257542 [details]
Animated Gif
Here is a simple code example in a standard Java program:
1.) Create the following class
public class Main {
public static void main(String[] args) {
}
}
2.) Copy and paste new ArrayList<>() into it (do not type it)
3.) Use Ctrl+2, l to assign it to a local variable
-> Import is not added. See animated Gif as example
*** Bug 479030 has been marked as a duplicate of this bug. *** |