Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [GEF4] Adapter binding warning messages
[GEF4] Adapter binding warning messages [message #1735818] Thu, 23 June 2016 00:13 Go to next message
Colin Sharples is currently offline Colin SharplesFriend
Messages: 90
Registered: July 2009
Location: Wellington, New Zealand
Member

First of all, let me say congratulations on the GEF 4.0.0 release Cool I'd like to say huge thanks to Alexander and Matthias for all your work - particularly the outstanding effort you guys make on answering questions and providing examples on this newsgroup. I have downloaded Neon and updated my product with the official GEF 4 release, so I will be going into my final testing over the next week or so.

I notice that I'm still getting warnings about adapter bindings, like the following:
*** WARNING: The actual type of adapter org.eclipse.gef4.mvc.models.ContentModel@4eb6184b could not be inferred from the binding at org.eclipse.gef4.mvc.fx.MvcFxModule.bindContentModelAsContentViewerAdapter(MvcFxModule.java:227). The adapter will only be retrievable via key types assignable to org.eclipse.gef4.mvc.models.ContentModel, which is the actual type inferred from the instance.
             You should probably adjust your binding to provide a type key using AdapterKey.get(<type>).
*** WARNING: The actual type of adapter org.eclipse.gef4.mvc.models.GridModel@679b19ef could not be inferred from the binding at org.eclipse.gef4.mvc.fx.MvcFxModule.bindGridModelAsContentViewerAdapter(MvcFxModule.java:877). The adapter will only be retrievable via key types assignable to org.eclipse.gef4.mvc.models.GridModel, which is the actual type inferred from the instance.
             You should probably adjust your binding to provide a type key using AdapterKey.get(<type>).
*** WARNING: The actual type of adapter org.eclipse.gef4.mvc.models.FocusModel@6872c38a could not be inferred from the binding at org.eclipse.gef4.mvc.fx.MvcFxModule.bindFocusModelAsContentViewerAdapter(MvcFxModule.java:426). Therefore, the given type key org.eclipse.gef4.mvc.models.FocusModel<javafx.scene.Node> can not be confirmed.
             Make sure the provided type key org.eclipse.gef4.mvc.models.FocusModel<javafx.scene.Node> matches to the actual type of the adapter.
*** WARNING: The actual type of adapter org.eclipse.gef4.mvc.models.HoverModel@3c6db14e could not be inferred from the binding at org.eclipse.gef4.mvc.fx.MvcFxModule.bindHoverModelAsContentViewerAdapter(MvcFxModule.java:983). Therefore, the given type key org.eclipse.gef4.mvc.models.HoverModel<javafx.scene.Node> can not be confirmed.
             Make sure the provided type key org.eclipse.gef4.mvc.models.HoverModel<javafx.scene.Node> matches to the actual type of the adapter.
*** WARNING: The actual type of adapter org.eclipse.gef4.mvc.models.SelectionModel@13fe01bc could not be inferred from the binding at org.eclipse.gef4.mvc.fx.MvcFxModule.bindSelectionModelAsContentViewerAdapter(MvcFxModule.java:1110). Therefore, the given type key org.eclipse.gef4.mvc.models.SelectionModel<javafx.scene.Node> can not be confirmed.
             Make sure the provided type key org.eclipse.gef4.mvc.models.SelectionModel<javafx.scene.Node> matches to the actual type of the adapter.
*** WARNING: The actual type of adapter org.eclipse.gef4.mvc.fx.parts.FXRootPart@60ba5662 could not be inferred from the binding at org.eclipse.gef4.mvc.fx.MvcFxModule.bindFXRootPartAsContentViewerAdapter(MvcFxModule.java:705). The adapter will only be retrievable via key types assignable to org.eclipse.gef4.mvc.fx.parts.FXRootPart, which is the actual type inferred from the instance.
             You should probably adjust your binding to provide a type key using AdapterKey.get(<type>, contentViewer).


I think it's previously been mentioned that these warnings are not really a concern, and certainly all these bindings seem to be working as intended, so I'm not sure what the warning is really saying. Most of these come from the MvcFxModule rather than my code, so do I need to override the default bindings?

If there's no problem with the bindings, is there any way to disable the messages? I couldn't work out where the messages are coming from, but they appear to be written directly to syserr rather than logged.


Colin Sharples
CTG Games Ltd
Wellington, New Zealand
Re: [GEF4] Adapter binding warning messages [message #1735961 is a reply to message #1735818] Fri, 24 June 2016 04:42 Go to previous messageGo to next message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 235
Registered: July 2009
Location: L√ľnen
Senior Member
Thanks Colin. We appreciate your feedback.

The warnings indicate that the actual runtime type of an adapter instance (that is to be injected) cannot be inferred from the bindings in the Guice module (our injector evaluates the bindings and can infer the actual runtime type from it in some cases). As you might have noticed, adapter map bindings can be provided with or without type information. If the type can be inferred from the binding, no additional type information is required (bindings can then only use a role, e.g. AdapterKey.defaultRole()). If it can not be inferred, than either the runtime type information has to be passed in using an AdapterKey with a type, or the type will be inferred from the adapter instance itself (after Guice has created it). Because of type erasure, this type is not be adequate for parameterized types.

There are two kind of warnings here:
1) The adapter will only be retrievable via key types assignable to <runtime-type-inferred-from-adapter-instance>, which is the actual type inferred from the instance.
2) Therefore, the given type key <type-specified-via-AdapterKey> can not be confirmed.

Case 1) indicates that no type key was provided in the adapter key of the binding and that the runtime type (to register the adapter with) will be inferred from the adapter instance itself. As ContentModel and GridModel are raw types, the runtime type that can be inferred from their instances, so this is fine.

Case 2) indicates that a type key was provided, but it cannot be confirmed by evaluating the bindings. A type key is required in these cases, because we have parameterized types, and the respective bindings do thus provide a type key. The warnings simply emphasize that you have to be certain that the passed in type information is correct (which should be the case).

I admit that these warnings might be disturbing in production code. Currently we do not provide a means to switch them off. I think we could add a second constructor to AdapterInjectionSupport that takes a boolean argument (and forwards it via the type listener to the injector) for this purpose. Thereby you could overwrite enableAdapterMapInjection() in your module to turn the warnings off. Can you raise a bug, please?
Re: [GEF4] Adapter binding warning messages [message #1736100 is a reply to message #1735961] Sat, 25 June 2016 23:29 Go to previous message
Colin Sharples is currently offline Colin SharplesFriend
Messages: 90
Registered: July 2009
Location: Wellington, New Zealand
Member

#496777

Colin Sharples
CTG Games Ltd
Wellington, New Zealand
Previous Topic:[GEF4] Calculation of stroke outline in model
Next Topic:MvcUiModule dependency on PlatformUI
Goto Forum:
  


Current Time: Mon Nov 19 04:42:00 GMT 2018

Powered by FUDForum. Page generated in 0.04087 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top