Bug 345569 - FUP of bug 345334: CodeSnippetTest has lot of failures
Summary: FUP of bug 345334: CodeSnippetTest has lot of failures
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: 3.7 RC1   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-12 06:34 EDT by Ayushman Jain CLA
Modified: 2011-05-15 23:17 EDT (History)
3 users (show)

See Also:
jarthana: review+


Attachments
proposed fix + tests (2.81 KB, patch)
2011-05-12 07:42 EDT, Ayushman Jain CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2011-05-12 06:34:38 EDT
After the fix for bug 345334, tests in CodeSnippetTest have started to fail because they all get the error "The method run() should be tagged with @Override annotation.."

There might be some deficiency in the fix. I'm investigating
Comment 1 Ayushman Jain CLA 2011-05-12 07:16:30 EDT
(In reply to comment #0)
> There might be some deficiency in the fix. I'm investigating

I understood the problem. The tests fail in 1.5 mode because we're adding the @Override annotation in 1.6 and above only, whereas in the CodeSnippetTest.getCompilerOptions() method, we have configured the detection of @Override annotations with CompilerOptions.OPTION_ReportMissingOverrideAnnotation (which works for 1.5 as well) to ERROR. 

This becomes relevant in 1.5 scenario because the dummy class we build for the code snippet has the form 
public class CodeSnippet_3 extends GlobalVariables_3

So, basically not just the tests fail for 1.5 mode, but even the original bug has not been fixed in 1.5
Comment 2 Ayushman Jain CLA 2011-05-12 07:26:51 EDT
(In reply to comment #1)

Another problem: Configuring the 2 override detection options to ERROR is not a good idea since some code snippets may have methods that they are overriding from java.lang.Object. Eg: testFreeReturnAnonymous().

Its better to just have a separate regression test for this which tests the fix.

Patch upcoming
Comment 3 Ayushman Jain CLA 2011-05-12 07:42:49 EDT
Created attachment 195489 [details]
proposed fix + tests

The fix has 2 parts:
1) Add @override for 1.5 also, so that whatever the user configuration is, the code snippet runs.
2) Add separate test for the fix
Comment 4 Jay Arthanareeswaran CLA 2011-05-12 08:32:56 EDT
+1 for the patch. 
The patch also fixes the bug #345569 in 1.5 compliance mode.
Comment 5 Srikanth Sankaran CLA 2011-05-12 08:41:47 EDT
Patch looks good. Ayush, Jay see if we have a chance to release this for
RC1, after all tests are found to be green.

Ayush, your initiative in resolving this is much appreciated.
Comment 6 Olivier Thomann CLA 2011-05-12 09:46:56 EDT
+1.
Thanks, Ayushman. I made the mistake of using -Dcompliance=1.6 when running all the tests.

Please release. We will recontribute.
Comment 7 Ayushman Jain CLA 2011-05-12 11:16:20 EDT
Released in HEAD for 3.7RC1
Comment 8 Jay Arthanareeswaran CLA 2011-05-15 23:17:49 EDT
Verified for 3.7RC1 with build I20110514-0800.
Also verified that the reported tests are passing now.