Bug 72460 - Code assist does not find static nested classes
Summary: Code assist does not find static nested classes
Status: RESOLVED DUPLICATE of bug 94965
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-23 15:11 EDT by Pratik Shah CLA
Modified: 2005-06-10 04:57 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pratik Shah CLA 2004-08-23 15:11:18 EDT
Define a class as follows:

public class A {	
    public static class B {}
}

Class B shows up in the "Open Type" list.  However, it does not show up for 
the code-assist list.
Comment 1 Dirk Baeumer CLA 2004-08-24 05:26:40 EDT
In which context do you activate the code assist ?
Is there anything in the log file ?

Moving to JDT/Core.
Comment 2 Randy Hudson CLA 2004-08-24 09:50:57 EDT
I think that you must type "A." and then invoke code assist and you will see B 
as a choice.  So what does java language really conside the name of a nested 
top-level class to be?  I think the prefix makes sense because it reduces the 
number of hits, and you can get help with the prefix.

Maybe it would be interesting if the wildcards available in "open type" also 
worked in code assist.  So I could type Multi*Editor<<CODEASSSIST>> or 
A*.Liste<<CODEASSIST>>.
Comment 3 Pratik Shah CLA 2004-08-24 11:38:38 EDT
I was invoking code-assist from some other class that wanted to use class B 
but not class A.

The problem with doing A.<<code-assist>> is that you will have to import A and 
then refer to B as A.B everywhere, when what one would want is for A.B to be 
imported.

It might be alright to resolve public static innner-classes for code-assist.
Comment 4 David Audel CLA 2004-08-25 07:03:19 EDT
If i understand correctly then your test case is the following

A.java : 
package p;
public class A {
  public static class B {
  }
}

X.java :
package q;
public class X {
  B //<-- do code assist here
}

The number of proposals is 532 without member classes and 642 with member 
classes. Most of the time these additionnal proposals won't be useful and risk 
to hide useful results.

This number of result can be decrease by propose only static member. But i 
think it is not a good idea.
We could add the new proposals at the end of list with low relevance index.

Another solution could be to use import statment to compute member type 
proposals.

X.java :
package q;
import p.A.*;
public class X {
  B // do code assist here
}

--------------------------
I change the severity of the bug to 'enhancement' because the current behavior 
works as expected.
Comment 5 Randy Hudson CLA 2004-08-25 11:38:15 EDT
Let's say the classes names are "Bbbb" and "Aaaa".
If you type Aaaa.B<<CODEASSIST>>, no proposals are presented.  If you import 
Aaaa, then you see proposals, but there is no way to get code assist to 
import "p.Aaaa.Bbbb". Adding imports is one of the main features of code 
assist.  What are the coding conventions on this type of import?  It is valid, 
but is such usage recommended?  I've never seen it used.

I agree that the current behavior when typeing Bb<<CODEASSIST>> is not bad, but 
your data would be more interesting if you showed only static nested classes.
Comment 6 David Audel CLA 2004-08-25 12:28:04 EDT
In my comment 4 'works as expected' means that only top level types are 
proposed.
Comment 7 Martin Aeschlimann CLA 2005-02-16 12:21:29 EST
+ 1 for having code assist showing the member types. This a long wanted request
of mine.

As soon as I type the 2nd and 3rd letter the list will get shorter. Most
important is that I can find the type in the list.
Note that quick fix also depends on the code assist infrastructure. We currently
can't offer import fixes or rename corrections code like

Inner inner= new Inner();
Comment 8 David Audel CLA 2005-06-10 04:57:19 EDT

*** This bug has been marked as a duplicate of 94965 ***