Bug 160337

Summary: Empty block not detected inside anonymous class
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: philippe_mulet
Version: 3.2   
Target Milestone: 3.3 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Regression tests none

Description Olivier Thomann CLA 2006-10-10 11:57:43 EDT
Compile this code with -warn:+emptyBlock.

public class X {
	
	static class Y {
		public void foo(int i) {} // this block is reported as empty
	}

	static Y FakeInvocationSite = new Y(){
		public void foo(int i) {} // this block is not reported as empty
	};
}
Comment 1 Olivier Thomann CLA 2006-10-11 13:53:51 EDT
The problem is not detected for method inside anonymous declaration that are initializing a field declaration, because this is parsed when the diet mode is true and the problem is not reported during the diet parse.
I'll investigate how to fix it.
Comment 2 Olivier Thomann CLA 2006-10-19 22:06:33 EDT
Created attachment 52364 [details]
Proposed fix
Comment 3 Olivier Thomann CLA 2006-10-19 22:06:55 EDT
Created attachment 52365 [details]
Regression tests
Comment 4 Olivier Thomann CLA 2006-10-19 23:04:53 EDT
Released for 3.3M3.
Comment 5 Olivier Thomann CLA 2006-10-19 23:06:13 EDT
Added regression tests org.eclipse.jdt.core.tests.compiler.parser.ParserTest#test025/26
Comment 6 David Audel CLA 2006-10-30 05:57:05 EST
Verified for 3.3 M3 using build I20061030-0010