Bug 97822 - [1.5][recovery] DOM/bindings should also recover base type when '>' is missing
Summary: [1.5][recovery] DOM/bindings should also recover base type when '>' is missing
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P5 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-01 08:46 EDT by Frederic Fusier CLA
Modified: 2020-03-21 13:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2005-06-01 08:46:45 EDT
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 ?
Comment 1 Philipe Mulet CLA 2005-06-01 12:31:32 EDT
Probably a weakness in recovery
Comment 2 David Audel CLA 2005-06-13 04:31:48 EDT
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.
Comment 3 Denis Roy CLA 2009-08-30 02:20:26 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 4 Markus Keller CLA 2015-10-29 11:32:40 EDT
(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>"
Comment 5 Eclipse Genie CLA 2020-03-21 13:18:15 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.