Bug 25890 - code assist displays static members on non-static expressions
Summary: code assist displays static members on non-static expressions
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-08 09:43 EST by Genady Beryozkin CLA
Modified: 2002-12-17 15:01 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Genady Beryozkin CLA 2002-11-08 09:43:33 EST
I think the javac compiler complains when I try to access static fields of a 
class using a concrete object. However, eclipse proposes static fields as 
suggestions in code assist. This is very annoying. 
For example, take the org.eclipse.jdt.internal.compiler.ast.Expression class.
It inherits many static fields. But when I have

Expression exp = ....
exp.<CTRL+SPACE> 

I don't want to see them all.
Comment 1 Philipe Mulet CLA 2002-11-08 12:39:32 EST
The compiler optionally warns you that this is a bad idea. However, it is still 
legal in Java.

Such completions should though always be less relevant than the non-static ones.

David - please consider this relevance improvement (and possibly an option to 
prevent them completely too).
Comment 2 David Audel CLA 2002-11-19 09:49:01 EST
relevance improvement:
when member is non-static then relevance is higher.

In the following example 'var2' is more relevant than 'var1' ('var2' is the 
first proposal).
public class X {
   static int var1;
   int var2;
   void foo() {
      this.var<cursor>
   }
}

Fixed.
Comment 3 David Audel CLA 2002-12-17 10:07:35 EST
Verified.
Comment 4 Genady Beryozkin CLA 2002-12-17 15:01:18 EST
Great! I will check it.