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

Bug 346415

Summary: [1.7][assist] No proposal inside catch statement from 3rd catch block onwards
Product: [Eclipse Project] JDT Reporter: Ayushman Jain <amj87.iitr>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, satyam.kandula, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed fix v1.0 + regression tests none

Description Ayushman Jain CLA 2011-05-19 07:10:16 EDT
BETA_JAVA7 branch.
Content assist is broken when there are more than 2 catch blocks and proposal is asked inside the catch statement

public class Abc {
	
	static void foo() throws IOException, IllegalArgumentException, OperationNotSupportedException, IndexOutOfBoundsException {
		
	}

	void bar() {		
		try {
		    Abc.foo();
		} catch (IOException e) {
			
		} catch (OperationNotSupportedException e) {
			
		} catch ([CTRL-SPACE]) {      // No proposal here
                } 
	}
}
Comment 1 Ayushman Jain CLA 2011-06-03 04:14:04 EDT
Created attachment 197291 [details]
proposed fix v1.0 + regression tests

The problem is that now the astLengthPtr points to the no. of arguments in a union type ref rather than pointing to how many catch blocks have been encountered till now, as was the case earlier. That info is captured in astLengthPtr - 1 when the CompletionParser is in buildMoreTryStatementCompletionContext(..). The above patch captures the relevant change.
Comment 2 Ayushman Jain CLA 2011-06-03 04:31:34 EDT
Released in BETA_JAVA7.
Comment 3 Srikanth Sankaran CLA 2011-06-29 02:37:34 EDT
Verified using "Eclipse Java Development Tools Patch for Java 7 Support (BETA)	1.0.0.v20110623-0900	org.eclipse.jdt.patch.feature.group	Eclipse.org"