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

Bug 349864

Summary: [1.7][compiler] Error message considers AutoCloseable as class
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad, Olivier_Thomann, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Proposed fix none

Description Markus Keller CLA 2011-06-20 15:03:22 EDT
BETA_JAVA7

The error message considers AutoCloseable as a class here:

public class TryWithResources3 {
	public static void main(String[] args) {
		try (Object res= 0) {
			
		} catch (Exception e) {
		}
	}
}

Error message:
    The resource type Object has to be a subclass of java.lang.AutoCloseable

Expected:
    The resource type Object must implement java.lang.AutoCloseable
Comment 1 Srikanth Sankaran CLA 2011-06-20 23:25:46 EDT
I'll fix it.
Comment 2 Srikanth Sankaran CLA 2011-06-21 00:40:05 EDT
Created attachment 198301 [details]
Proposed patch

We now issue an error message that says:

"The resource type Object does not implement java.lang.AutoCloseable"
Comment 3 Srikanth Sankaran CLA 2011-06-21 00:42:29 EDT
Released in BETA_JAVA7 branch.
Comment 4 Olivier Thomann CLA 2011-06-21 11:47:05 EDT
I think we should also renamed the corresponding IProblem.
Comment 5 Olivier Thomann CLA 2011-06-21 11:48:06 EDT
Created attachment 198345 [details]
Proposed fix

Complement of the previous patch
Comment 6 Olivier Thomann CLA 2011-06-21 11:48:21 EDT
Released in BETA_JAVA7 branch.
Comment 7 Deepak Azad CLA 2011-07-19 07:53:24 EDT
Verified with v20110714-1300.