Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316918 - Acceleo mustn't instanciate Java Service
Summary: Acceleo mustn't instanciate Java Service
Status: CLOSED FIXED
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Linux
: P3 major
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-15 10:57 EDT by Goulwen Le Fur CLA
Modified: 2010-12-23 07:56 EST (History)
2 users (show)

See Also:


Attachments
patch for acceleo 3.0 branch (4.47 KB, patch)
2010-12-09 10:55 EST, Bouchet Stéphane CLA
no flags Details | Diff
Patch to only instantiate when needed (42.24 KB, patch)
2010-12-22 11:08 EST, Laurent Goubet CLA
no flags Details | Diff
FIX for maintenance and HEAD (47.06 KB, patch)
2010-12-23 07:05 EST, Laurent Goubet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Goulwen Le Fur CLA 2010-06-15 10:57:36 EDT
When using invoke() service, Acceleo try to instanciate the service class. Acceleo never used this instance so shouldn't do this.
Comment 1 Laurent Goubet CLA 2010-07-30 08:05:59 EDT
Though important, this isn't a blocker
Comment 2 Bouchet Stéphane CLA 2010-12-09 10:55:14 EST
Attached a patch that removes the call to the instanciation service.
it uses the implicit object passed as first argument to invoke the correct method on it.
Comment 3 Bouchet Stéphane CLA 2010-12-09 10:55:40 EST
Created attachment 184867 [details]
patch for acceleo 3.0 branch
Comment 4 Laurent Goubet CLA 2010-12-22 11:08:21 EST
Created attachment 185722 [details]
Patch to only instantiate when needed

The attached patch takes the approach to the max and only instantiates services when needed. I couldn't test this myself and am in holidays tonight. Could you try this patch so that I can commit it when I return?
Comment 5 Bouchet Stéphane CLA 2010-12-22 11:23:30 EST
tested the patch with 3.0 branch and worked. thanks !
Comment 6 Laurent Goubet CLA 2010-12-23 07:05:56 EST
Created attachment 185763 [details]
FIX for maintenance and HEAD

The associated patch prevents Acceleo from instantiating service instances except when its really needed. This means that calling Java methods defined on the class of the receiver no longer instantiates a new "receiver.getClass()" but directly calls the method on the receiver itself. Likewise, It is now possible to call static Java methods as we no longer need to instantiate their utility Class.

Even though this changes APIs, it should be committed on both the 3.0 maintenance branch and the CVS HEAD as it solves many potential bugs with the service invocation.
Comment 7 Laurent Goubet CLA 2010-12-23 07:56:12 EST
The fix will be available in both 3.0.2 and 3.1.0M5