Solving missing IResourceServiceProvider.Registry.INSTANCE

6 views
Skip to first unread message

Brian Larson

unread,
Mar 15, 2024, 6:21:02 PMMar 15
to OSATE
The BLESS plugin was having trouble getting its Injector to generate code using HAMR.

In constructors, this is common code in constructors when using Google Guice dependency injection:

Injector injector = IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createFileURI("dummy.bless")).get(Injector.class);

injector.injectMembers(this);


The problem was that the "INSTANCE" was null.  When identical code was used other places it worked fine.  To fix the problem three packages were added to the manifest:

Import-Package: com.google.inject;version="1.4.0",

org.eclipse.xtext,

org.eclipse.xtext.resource,


The other places where the injector provider worked fine do not need these packages.

Please add a comment if this solved a problem for you, too.

--Brian

Reply all
Reply to author
Forward
0 new messages