Bug 345334 - CodeSnippet's run method is missing @Override annotation
Summary: CodeSnippet's run method is missing @Override annotation
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-10 16:23 EDT by Gábor Bakos CLA
Modified: 2011-05-15 23:06 EDT (History)
3 users (show)

See Also:
amj87.iitr: review+


Attachments
Proposed fix + updated regression tests (10.18 KB, patch)
2011-05-11 10:11 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + updated regression tests (10.23 KB, patch)
2011-05-11 11:32 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 Gábor Bakos CLA 2011-05-10 16:23:40 EDT
Build Identifier: M20110210-1200

If you set the compiler errors/warnings on Missing '@Override' annotation to Error and also check Include implementations of interface methods (Java 1.6 or higher) and you try to execute a Java snippet you get the following error (only for the first snippet I guess):
The method run() of type CodeSnippet_1 should be tagged with @Override since it actually overrides a superclass method
string cannot be resolved to a type

I think the template should be updated. (Maybe in org.eclipse.jdt.internal.eval.CodeSnippetToCuMapper#buildCUSource(String) near the String constant "public void run() throws Throwable {". I think that should be "@Override public void run() throws Throwable {", although I have not tested.)

Reproducible: Always

Steps to Reproduce:
1. Set the Window/Preferences/Java/Compiler/Errors/Warnings 
    Missing '@Override' annotation to Error
    Check the Include implementations of interface methods (1.6 or higher)
2. Create a Scrapbook page (.jpage)
3. Try to Execute, Inspect, or Display a valid expression (for example "").

Workaround: Undo step 1 (change it for example Warning).
Comment 1 Olivier Thomann CLA 2011-05-10 17:25:48 EDT
This is a regression as the code snippet page might not work in 1.6 mode.
I'll work on a fix.
Comment 2 Olivier Thomann CLA 2011-05-11 10:11:28 EDT
Created attachment 195352 [details]
Proposed fix + updated regression tests
Comment 3 Olivier Thomann CLA 2011-05-11 10:15:13 EDT
Ayushman, please review. The fix is quite simple.
Comment 4 Ayushman Jain CLA 2011-05-11 10:45:48 EDT
Patch looks good.
Comment 5 Olivier Thomann CLA 2011-05-11 10:56:38 EDT
I'll update the patch to use the compliance instead of the source. Since this doesn't change anything for the verification, I'll release that version.
Comment 6 Olivier Thomann CLA 2011-05-11 11:32:09 EDT
Created attachment 195378 [details]
Proposed fix + updated regression tests

Version that has been released.
Comment 7 Olivier Thomann CLA 2011-05-11 11:41:28 EDT
Released for 3.7RC1.
Comment 8 Jay Arthanareeswaran CLA 2011-05-15 23:06:51 EDT
Verified for 3.7RC1 with build I20110514-0800.