Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 456773

Summary: [content assist] Default modifiers are not reflected in CA icons
Product: [Eclipse Project] JDT Reporter: Dennis Huebner <dennis.huebner>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact: Jay Arthanareeswaran <jarthana>
Severity: normal    
Priority: P3 CC: Holger.Schill, jarthana, markus.kell.r, shankhba
Version: 4.5   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Dennis Huebner CLA 2015-01-06 05:28:06 EST
Example Javatype:
public interface IJavaInterface {
	class Clazz {
		public Clazz(String nonDefConstructor) {}
	}
}

Modifiers for IJavaInterface.Clazz are static public by default, but in an Xtend CA popup, this inner class is decorated as non static package private.
FYI: In Xtend hover window all modifiers are correct.
Comment 1 Holger Schill CLA 2015-01-06 08:55:01 EST
We are using JDT to get the modifiers for a type through the org.eclipse.jdt.internal.core.search.BasicSearchEngine.

The very same happens in JDT, too.

package foo;
import foo.IJavaInterface.Clazz;

public class Foo {
	
	public void foo(){
		Clazz<- Invoke CA here
	}

}

Hovering over the import has the right modifiers.

So I would like to move that to JDT.
Comment 2 Jay Arthanareeswaran CLA 2015-01-06 09:33:43 EST
Shankha, please take a look. If things are broken on the model side, feel free to assign to me.
Comment 3 Jay Arthanareeswaran CLA 2015-01-06 09:50:44 EST
Actually, this is a bit of model and UI issue.

For the given case, the supplied proposals don't contain the implicit modifiers. However, looks like the UI doesn't consider those flags for types. I think it's the code at JavaElementImageProvider.getTypeImageDescriptor(boolean, boolean, int, boolean)

Moving to UI for investigation.
Comment 4 Holger Schill CLA 2015-01-06 09:57:16 EST
When I debugged the code I saw that the modifiers are 0 if the we have the given example:

public interface IJavaInterface {
	class Clazz {
		public Clazz(String nonDefConstructor) {}
	}
}

For this example it gives 9 so it is at leat not package private:

public interface IJavaInterface {
	public static class Clazz {
		public Clazz(String nonDefConstructor) {}
	}
}

I do not thing that it is a UI issue.
Comment 5 Jay Arthanareeswaran CLA 2015-01-06 20:32:55 EST
(In reply to Holger Schill from comment #4)
> For this example it gives 9 so it is at leat not package private:

In this case, the 9 represents public (1) and static (8).

> I do not thing that it is a UI issue.

What I meant was that the proposal contains the modifiers but JDT UI is not considering them.
Comment 6 Markus Keller CLA 2015-05-13 08:47:15 EDT
Note that IMember#getFlags() specifies "For source members, only flags as indicated in the source are returned". This won't be changed.

CompletionProposal#getFlags() misses such a specification, so before touching anything there, we would have to investigate how the API behaves in other cases and what the main client (JDT Text) expects.
Comment 7 Eclipse Genie CLA 2019-09-27 15:12:00 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.