Bug 260717 - [assist] Constructors should be proposed even when the declaring type is not imported
Summary: [assist] Constructors should be proposed even when the declaring type is not ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 262605
  Show dependency tree
 
Reported: 2009-01-12 10:04 EST by David Audel CLA
Modified: 2009-01-28 06:34 EST (History)
1 user (show)

See Also:


Attachments
Proposed fix (24.61 KB, patch)
2009-01-12 10:10 EST, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2009-01-12 10:04:28 EST
build I20090106-1323
1) create missing/MissingType.java
package missing;
public class MissingType {
  public MissingType(int i) {}
}

2) create test/Test.java
package test;
public class Test{
  void foo() {
    new MissingType(| // do ctrl+space at |
  }
}

3) do ctrl+space at |

There is no proposal

The constructor of MissingType should be proposed even missing.MissinType is not imported.
Comment 1 David Audel CLA 2009-01-12 10:10:45 EST
Created attachment 122270 [details]
Proposed fix

Constructors and anonymous types are proposed with a required proposal.
This required proposal is the not imported type.
Comment 2 David Audel CLA 2009-01-19 11:34:48 EST
Released for 3.5M5.

Tests added
  CompletionWithMissingTypesTests#test0041() -> test0046()
  CompletionWithMissingTypesTests_1_5#test0015()
Comment 3 Kent Johnson CLA 2009-01-27 12:03:24 EST
Added bug 262597 since the constructor's parameters appear in the wrong place once the missing import statement is added.

I also do not get any suggestions as a result of invoking code assist. Once the missing import statement is added, I get 2 proposals (call the constructor or create an anonymous type).

Its hard to say this is fixed.
Comment 4 David Audel CLA 2009-01-27 12:49:50 EST
Constructors and anonymous types are proposed with a required proposal but currently JDTText does not support anonymous types with a required proposal so the anonymous types are not displayed.

I entered a request in JDTText to add this support: bug 262605 (i forgot to entered this request before).

As the anonymous case is not supported by jdttext only the simple constructor proposal is currently proposed. This proposal is more visible if you disable the auto insert option (Java>Editor>Content Assist>Insert single proposals automatically).
You can also verify this bug by looking the regression tests. In these tests you can see that the constructors and the anonymous types can be proposed.
Comment 5 Kent Johnson CLA 2009-01-27 13:24:10 EST
Disabled auto-completion & the behaviour is better.

Verified for 3.5M5 using I20090126-1300