ceylon-ide-eclipse icon indicating copy to clipboard operation
ceylon-ide-eclipse copied to clipboard

Service provider is lost when renamed

Open LisiLisenok opened this issue 7 years ago • 3 comments

steps to reproduce:

1. Code:

shared interface A {}
service(`interface A`)
shared class C() satisfies A {}

shared void run() {
	print(`module`.findServiceProviders(`A`));
}

2. Run

everything is OK

3. Rename C to C1

so code looks like:

shared interface A {}
service(`interface A`)
shared class C1() satisfies A {}

shared void run() {
	print(`module`.findServiceProviders(`A`));
}

4. Run

Exception is thrown. Looks like service provider with old name C is searched instead of new one C1.

stack trace:
Exception in thread "main" java.util.ServiceConfigurationError: herd.test.schedule.chime.A: Provider herd.test.schedule.chime.C not found at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.access$300(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ModuleImpl$1It$1.next(ModuleImpl.java:243) at ceylon.language.ChainedIterator.next(ChainedIterator.ceylon:14) at ceylon.language.Iterable$impl$4$1.elem(Iterable.ceylon:468) at ceylon.language.Iterable$impl$4$1.$next$1(Iterable.ceylon:468) at ceylon.language.Iterable$impl$4$1.next(Iterable.ceylon:468) at com.redhat.ceylon.compiler.java.language.ConstantIterable$1.next(ConstantIterable.java:51) at ceylon.language.Iterable$impl$1anonymous_10_$1anonymous_11_.next(Iterable.ceylon:1053) at ceylon.language.Array.createArrayFromIterable(Array.java:164) at ceylon.language.Array.(Array.java:112) at ceylon.language.Iterable$impl.sequence(Iterable.ceylon:286) at ceylon.language.Iterable$impl$1anonymous_10_.sequence(Iterable.ceylon) at ceylon.language.Iterable$impl.toString(Iterable.ceylon:1777) at ceylon.language.impl.BaseIterable.toString(bases.ceylon) at ceylon.language.stringify_.stringify(print.ceylon:38) at ceylon.language.print_.print(print.ceylon:14) at herd.test.schedule.chime.run_.run(run.ceylon:7) at herd.test.schedule.chime.run_.main(run.ceylon) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57) at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48) at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:68) at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:105) at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:101) at ceylon.modules.Main.execute(Main.java:69) at ceylon.modules.Main.main(Main.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.modules.Module.run(Module.java:308) at org.jboss.modules.Main.main(Main.java:487) at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:355) at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547) at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108) at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38) at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31) at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:24)

LisiLisenok avatar May 11 '17 05:05 LisiLisenok

@davidfestal could you take a look at this one please, or at least let me know where to look? Thanks

gavinking avatar May 11 '17 12:05 gavinking

@lisilisenok the workaround is to do a clean build, I suppose, right?

gavinking avatar May 12 '17 06:05 gavinking

@gavinking right, clean build helps

LisiLisenok avatar May 12 '17 14:05 LisiLisenok