Bug 230063

Summary: The move of execute() from AbstractHandler to IHandler causes compile errors in Java 1.5
Product: [Eclipse Project] JDT Reporter: Benjamin Pasero <bpasero>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: pwebster
Version: 3.4   
Target Milestone: 3.4 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Warning none

Description Benjamin Pasero CLA 2008-05-03 04:41:35 EDT
I just moved to 3.4 M7 and set the target platform to use it. I see compile errors because execute() was moved. The reason is the use of @Override annotations in Java 1.5. Setting this annotation to methods from an interface results in a compile error. They are only allowed for methods that are overridden from a class.
Comment 1 Benjamin Pasero CLA 2008-05-03 04:42:26 EDT
To be more precise: I was implementing my own Handler that extends from AbstractHandler and had the @Override annotation set on the execute() method.
Comment 2 Paul Webster CLA 2008-05-03 06:52:43 EDT
There was never an execute method on AbstractHandler ... this is probably a change in the java builder error reporting.

PW
Comment 3 Benjamin Pasero CLA 2008-05-03 07:01:47 EDT
Hm, for some reason the outline shows an execute() method for me in AbstractHandler although its not there. I also get a warning. This is with 3.3.x as target platform (see screenshot).
Comment 4 Benjamin Pasero CLA 2008-05-03 07:02:06 EDT
Created attachment 98528 [details]
Warning
Comment 5 Kent Johnson CLA 2008-05-05 14:05:08 EDT
This is the consequence for the fix for bug 225577

We had a bug and added default abstract methods without tagging them as synthetic (ie. not visible to normal searches).

If you look at AbstractHandler in a 3.3.x workspace, you'll see the default abstract method execute(ExecutionEvent) in the outliner. The compiler added this default abstract method to the abstract class AbstractHandler, since its superinterface IHandler defined it.

In a 3.4M7 workspace, the method no longer appears in the outliner since its now tagged as synthetic & the correct error appears in your source.

You can only @Override methods that are actually implemented by your superclasses.
Comment 6 Benjamin Pasero CLA 2008-05-05 17:02:21 EDT
Thanks for the explanation.
Comment 7 Maxime Daniel CLA 2008-05-13 07:04:36 EDT
Verified for 3.4 RC1 using build I20080510-2000.