Problem loading Truffle service providers in Graal

Doug Simon doug.simon at oracle.com
Sun Feb 26 13:54:38 UTC 2017


> On 26 Feb 2017, at 14:44, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> 
> 
> On 26/02/2017 13:13, Doug Simon wrote:
>> :
>> Also, what if there's provider in jdk.internal.vm.compiler itself? Will it be loaded along with the providers on my module path?
>> 
> If it has `provides com.oracle.truffle.api.object.LayoutFactory` then it will be located too.

I assume that's because the app class loader delegates to the platform class loader?

> If the provider interface is only for overriding then you could use ServiceLoader.load(LayerFactory.class).findFirst().orElse(DefaultLayoutFactory.get()) so that it use a default/fallback implementation in your module when there isn't a provider deployed on the module path.

Ok, thanks for the tip.

-Doug


More information about the graal-dev mailing list