Bug 405883 - [extract local][content assist] no proper inference for bounded generic type parameter simplified as <?>
Summary: [extract local][content assist] no proper inference for bounded generic type ...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-17 09:09 EDT by Gabor Bergmann CLA
Modified: 2022-08-09 18:03 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 Gabor Bergmann CLA 2013-04-17 09:09:36 EDT
If an upper-bounded type parameter (say, <T extends Foo>) of a generic class is bound in a reference to <?>, it should not be interpreted as <? extends Object>, but as <? extends Foo>. The JDT compiler behaves correctly. However, the "content assist" feature and "extract local variable" both infer Object as the type parameter for methods called on this reference.

How to reproduce:

 class Noop<T extends Collection> {
  T value;
  T get() {return value;} 
 }
 Noop<?> noop = // IMPORTANT! <?> here really means <? extends Collection>
   new Noop<Set>() {{ value = new HashSet(); }};
 noop.get().size(); // this compiles, as should be
 noop.get(); // extract local variable believes get() returns an Object, and there is no hover
 noop.<<CTRL+SPACE>>  // content assist also thinks that get() returns an Object

Forgive me if there are any duplicates of this.
Comment 1 Jay Arthanareeswaran CLA 2013-04-22 00:57:31 EDT
Anirban, please take a look at this.
Comment 2 Eclipse Genie CLA 2020-07-10 15:06:45 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 3 Eclipse Genie CLA 2022-08-09 18:03:46 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.