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

Bug 362003

Summary: [assist] completion is broken after <B base R> after a base guard
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M3   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
test & proposed fix none

Description Stephan Herrmann CLA 2011-10-25 16:26:33 EDT
This was observed in team CompilerAdaptation (re null annotations)
where at some point completion stopped to work.

In isolating the cause I found that the parser bails out if
1. a base guard predicate is found,
2. and then a method with <B base R> type parameter is found

When parsing (1) the scanner is put into base-is-identifier mode, but in
recovery mode the predicate itself is not recognized if the callin has no
signatures, so we never leave this mode.

Later, when parsing <B base R> while base is seen as an identifier we
create a ValueTypeParameter "B base" and still later 
AssistParser.indexOfAssistIdentifier(boolean) bails out with an AIOOBE
because an expected identifier is missing.
Comment 1 Stephan Herrmann CLA 2011-10-25 19:00:39 EDT
Created attachment 205956 [details]
test & proposed fix

This patch improves recovery parsing for method mappings in several ways:

+ update the grammar rules for RecoveryCallinHeader adding the option
  to recognized a guard predicate in this position.
  -> this way the parser properly consumes the predicate and can thus
     re-enable base as a keyword

This then broke a few tests from bug 340083 because short base specs were
dropped during recovery.

+ make sure short method specs are added to their RecoveredMethodMapping
  if syntax indicates that's where they belong.
Comment 2 Stephan Herrmann CLA 2011-10-25 19:03:25 EDT
Patch has been committed for 2.1 M3 (r2068/9)
Comment 3 Stephan Herrmann CLA 2012-09-22 12:26:56 EDT
Verified using build 2.2.1.201209182002