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

Bug 339513

Summary: InjectorImpl, isOverridden: checks method with itself instead of childClass Method
Product: z_Archived Reporter: Mike Moor <pauern_daheimen>
Component: E4Assignee: Oleg Besedin <ob1.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: remy.suen
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Mike Moor CLA 2011-03-10 08:06:09 EST
Build Identifier: org.eclipse.e4.core.di_0.9.0.v20101202-1530.jar

In the isOverridden-Method of the org.eclipse.e4.internal.di.InjectorImpl class: An annotated method is checkt for a child-class-method which overrides the given method. This is done by checking for the same name and the same parameter types. when it comes to the parameter-type-check the following happens:
int methodParamsLength = method.getParameterTypes().length;// method is the annotated method
a few lines later:
Class<?>[] candidateParams = method.getParameterTypes(); // method is still the annotated method buth should be the candidate-method.
Then the two array-lenghts are compared:
if (candidateParams.length != methodParamsLength)
  continue;
This is allways true!

Reproducible: Always

Steps to Reproduce:
1. Create a abstract class X with a method buildUi annotated with @PostConstruct
2. Create a part class Y extends X with a method buildUi(Composite parent)
3. When the port Y is injected, the annotated method buildUi of X isn't called
Comment 1 Oleg Besedin CLA 2011-04-05 13:26:37 EDT
Created attachment 192580 [details]
Patch

Fix + JUnit
Comment 2 Oleg Besedin CLA 2011-04-05 13:28:52 EDT
Patch applied to CVS Head. Thanks for taking time to figure out cause of the problem!