Bug 160337 - Empty block not detected inside anonymous class
Summary: Empty block not detected inside anonymous class
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-10 11:57 EDT by Olivier Thomann CLA
Modified: 2006-10-30 05:57 EST (History)
1 user (show)

See Also:


Attachments
Proposed fix (1.54 KB, patch)
2006-10-19 22:06 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression tests (3.04 KB, patch)
2006-10-19 22:06 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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