Bug 535948 - [content assist] Code assist does not add necessary qualifier for use of inner type in type annotation
Summary: [content assist] Code assist does not add necessary qualifier for use of inne...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.8   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-15 10:16 EDT by Eric Milles CLA
Modified: 2022-06-17 03:20 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Milles CLA 2018-06-15 10:16:37 EDT
Completion at '|' completes as Inner when C.Inner is required due to the scope of the type annotation.  (And no supporting import is added if content assist preferences specify import over qualifier.)

@a.B(In|)
public class C {
  static class Inner {}
}

package a;
import java.lang.annotation.*;
@Target(ElementType.TYPE)
public @interface B {
  Class<?> value();
}

ScopeAnalyzer.getDeclarationsInScope is returning a binding for "Inner" and other members of C when a type annotation does not have visibility to type members.
Comment 1 Eclipse Genie CLA 2020-06-13 15:38:51 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.
Comment 2 Mauro Molinari CLA 2020-06-16 11:50:51 EDT
This still applies to 4.14.

Another curious behaviour is that if I leave "Inner" and then use code assist to complete "Inner.class" (at Inner.|, or Inner.c| or Inner.cl| and so on), "javassist.runtime.Inner" is automatically imported (that's a class I have in my classpath). In other words, JDT ignores C.Inner completely and adds the import when completing the .class constant, rather than the Inner type name.
Comment 3 Eclipse Genie CLA 2022-06-17 01:53:57 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.
Comment 4 Mauro Molinari CLA 2022-06-17 03:20:49 EDT
Still applies to 4.22.