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

Bug 95796

Summary: [1.5][compiler] Incorrect position in wildcard
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P5 CC: philippe_mulet
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Olivier Thomann CLA 2005-05-18 12:39:14 EDT
Compiling this code returns an error, but the end position for the wilcard seems
wrong.

import java.util.List;
 
class Key<E, F extends Type<E, F, G, H>, G extends Key<E, F, G, H>, H extends
State<H>> {}
class State<S extends State> {}
class Type<T, U extends Type<T, U, V, W>, V extends Key<T, U, V, W>, W extends
State<W>> {}
class Store<A, B extends Type<A, B, C, D>, C extends Key<A, B, C, D>, D extends
State<D>> {}
 
public class X<K extends Key<K, ?,?,?>> {
   List<Store<K, ?, ? extends Key<K, ?, ?, ?>, ? extends State<?>>> stores;
}
Comment 1 Olivier Thomann CLA 2005-05-18 14:46:44 EDT
The problem comes from the fact that the parser doesn't remember the closing
position of the parameterized type reference.
In fact it is not trivial to do that, because in:
<K extends Key<K, ?,?,?>>

the closing angle brackets >> are read as one token. But to get the proper
position it should be rescan as two tokens.
Not sure we want to do this simply to report better error messages because that
would also penalize valid code.
Philippe, any comment?

I can simply report the error on the '?' for a wildcard.
Comment 2 Philipe Mulet CLA 2005-05-18 17:03:15 EDT
Note that in my example there was not mangled >>>. This being said, a good guess
would be fine in case of mangling (ideally it would give positions inside the
token and handling unicodes).
Now for 3.1, I could imagine not handling unicodes.

Comment 3 Eclipse Genie CLA 2020-04-30 00:39:30 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.