Eclipse 4 Context behaviour handling own @Creatable objects changed? [message #1729674] |
Sun, 17 April 2016 17:42 |
Stefan Häusler Messages: 23 Registered: May 2013 |
Junior Member |
|
|
Hello all
we recently start evaluating switching from 4.5.0 to a 4.5.2 platform due to some waiting bugfixes. After doing this for our products, we observe some changes in the context how own objects annotated with @Creatable are created/reused for injection.
Lets assume we have a Wizard for which we also have a controller and a model. Both the controller and the model is annotated with @Creatable and injected into the wizard.
- We create the wizard with new Wizard()
- then using ContextInjectionFactory.inject
Before 4.5.2 it seems that the model was created each time team on injection. After going to 4.5.2, the first created object for @Creatable annotation is kept in the context and is reused when reopening the wizard what is a problem as the model still has state from previous session.
Is this intended? Is there some complete change log for the 4.5.2 where i can see the change explained? Are we doing something wrong here?
Actually we were already curious whether we do this correct in 4.5.0, as the context then starts to get bigger and bigger each time we reopened the wizard.
The use case here is actually, just to use the E4 Injection Framework for simple putting together the different objects. No need to hold references for the @Creatable. Of course the framework can not guess this, so the question was here already, what a pattern would be to work with the Context like this.
Maybe its more correct to annotate the wizard itself also with @Creatable and using constructor injection (maybe even a chid context that is disposed afterwards).
But i would like to understand the error here, because i start new things.
Thank you very much for an answer,
Stefan
[Updated on: Sun, 17 April 2016 18:54] Report message to a moderator
|
|
|
Re: Eclipse 4 Context behaviour handling own @Creatable objects changed? [message #1729715 is a reply to message #1729674] |
Mon, 18 April 2016 12:31 |
Eclipse User |
|
|
|
I don't see any changes that seem relevant. Your classes aren't annotated with @Singleton, correct?
Put the following trace switch into a file (say debug.options):
org.eclipse.e4.core.di/debug/injector = true
And then launch your Eclipse instance with -debug path/to/your/debug.options and you should get a bit of debug output from the DI. Something may be helpful.
Since it seems your model object is being recorded in the context, put a breakpoint on EclipseContext#set() for when 'name' is your model class name, and see what turns up.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03988 seconds