Bug 151931 - Java model thinks binary class declares method that is declared in superinterface
Summary: Java model thinks binary class declares method that is declared in superinter...
Status: VERIFIED WORKSFORME
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.4 RC3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-26 18:36 EDT by Markus Keller CLA
Modified: 2008-05-30 13:08 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2006-07-26 18:36:06 EDT
I20060725-0800

Import 'org.eclipse.core.commands' as binary plugin. The binary type 'org.eclipse.core.commands.AbstractHandler' shows a method 'execute(ExecutionEvent) : Object' in the Outline, but this method is not declared in the source of this class. The IMethod has no valid source range and is not marked as synthetic.

I tried to reproduce the problem outside of said plugin, but I couldn't. Something must be very special in the core.commands plugin...
Comment 1 Markus Keller CLA 2006-07-27 04:15:55 EDT
Actually, the compiled AbstractHandler.class file already contains a method declaration 'public abstract Object execute(ExecutionEvent);'.
Comment 2 Frederic Fusier CLA 2006-07-31 13:11:58 EDT
I can only get execute method in AbstractHandler.class file while importing plugin either as binary source or with source folders. If I check-out the plugin from devl.eclipse.org CVS repository, then AbstractHandler.class file does not have this abstract method...
Sounds more like a code gen issue than a model one. I'll talk about this whith Philippe or Olivier when they come back from vacations...
Comment 3 Christof Marti CLA 2008-05-28 06:25:06 EDT
FYI, AbstractHandler.execute() disappeared from the class file between 3.4M5 and RC1 (which broke the source of subclasses accidentally having @Override on the method).
Comment 4 Markus Keller CLA 2008-05-28 06:35:55 EDT
The method comes from the superinterface org.eclipse.core.commands.IHandler.

/org.eclipse.core.commands/META-INF/MANIFEST.MF contains:
---
Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
 J2SE-1.3
---

The project's "Generated .class files compatibility" is set to 1.1.

Could it be that the PDE builder changed the -target used for compiling the plug-in? Is the abstract method in the class file of AbstractHandler required in some targets but not in all?
Comment 5 Philipe Mulet CLA 2008-05-28 07:30:23 EDT
Default abstract methods are only generated if VM target is <= 1.1.
Darin - has there been any change in PDE near required exec context post 3.4M5 ?
Comment 6 Markus Keller CLA 2008-05-28 09:35:31 EDT
(In reply to comment #2)
> If I check-out the plugin from devl.eclipse.org CVS repository, then
> AbstractHandler.class file does not have this abstract method...

Not true any more in I20080527-2000: AbstractHandler.class now contains...

// Method descriptor #75 (Lorg/eclipse/core/commands/ExecutionEvent;)Ljava/lang/Object;
  public abstract synthetic java.lang.Object execute(...

... in both cases. But since the method is synthetic, the Outline does not show it by default (since synthetic members are filtered), but it really is there.

In 3.4M5, the method was not marked as synthetic (same in .jar and when compiled locally). I guess this bug can be closed as WORKSFORME, since the method is synthetic now.
Comment 7 Olivier Thomann CLA 2008-05-28 09:40:14 EDT
yes, default abstract methods are now tagged as synthetic.
Comment 8 Darin Wright CLA 2008-05-28 09:53:52 EDT
(In reply to comment #5)
> Default abstract methods are only generated if VM target is <= 1.1.
> Darin - has there been any change in PDE near required exec context post 3.4M5
> ?

Not that I know of. Chris?
Comment 9 Philipe Mulet CLA 2008-05-28 09:59:53 EDT
Ah right. Olivier did fix our default abstract methods to be marked as synthetic recently. This wasn't the case in the past, and the old behavior was no longer consistent with modern expectations (latest updates of JDKs do also mark these as synthetics).
Comment 10 Philipe Mulet CLA 2008-05-28 10:01:57 EDT
closing
Comment 11 Jerome Lanneluc CLA 2008-05-30 13:08:56 EDT
Verified for 3.4RC3 using I20080530-0100