Community
Participate
Working Groups
Using 3.1 RC1. Here's test case: import java.util.ArrayList; import java.util.List; public class X { public <T> List<Y<T> foo(T t) { List<Y<T>> lyt = new ArrayList<Y<T>>(); return lyt; } } class Y<T> {} I get 5 errors: - "Syntax error, insert '>' to complete ReferenceType1": expected error - 5 x "T cannot be resolved to a type": unexpected Isn't there a way to avoid these 4 unexpected errors ?
Probably a weakness in recovery
Currently, there is no recovery for type parameter. There is a syntax error in the return type, so the recovered method is "Y<T> foo(T t)">. When this recovered method is parsed, the type paramater has been already parsed and removed from Parser stack. A change in this area is too risky for now. Deferred post 3.1.
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.
(In reply to Frederic Fusier from comment #0) > - 5 x "T cannot be resolved to a type": unexpected Those are all gone in master (4.6.0.I20151028-0800). Current errors: - Syntax error, insert ">" to complete ReferenceType1 => good - At "return lyt;": Type mismatch: cannot convert from List<Y<T>> to Y<T> => bad; AST recovery for the return type dropped the "List<" and just left "Y<T>"
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.