Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iteration over the metamodel: annotatedMembers throws some execptions #347

Closed
redrezo opened this issue Nov 15, 2013 · 4 comments
Closed
Assignees
Milestone

Comments

@redrezo
Copy link

redrezo commented Nov 15, 2013

the following iteration over the metamodel should not throw any exception:

  for (value m in modules.list) {
    for (value member in m.members) {
      value components = member.annotatedMembers<ClassDeclaration, ComponentAnnotation>();
    }
  }

However it throws the following execptions:

java.lang.RuntimeException: Declaration type not supported yet: UnknownType
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getMetamodel(Metamodel.java:292)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeFunction.<init>(FreeFunction.java:61)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getOrCreateMetamodel(Metamodel.java:219)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassOrInterface.init(FreeClassOrInterface.java:103)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClass.init(FreeClass.java:46)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassOrInterface.checkInit(FreeClassOrInterface.java:148)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassOrInterface.$getJavaAnnotations$(FreeClassOrInterface.java:501)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.annotations(Metamodel.java:616)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.annotations(Metamodel.java:611)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Predicates$AnnotatedWith.accept(Predicates.java:328)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Predicates$AnnotatedWith.accept(Predicates.java:312)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Predicates$And.accept(Predicates.java:115)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreePackage.filteredMembers(FreePackage.java:151)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreePackage.annotatedMembers(FreePackage.java:138)
    at at.caks.ceylon.ds.ds_.resolveService(core.ceylon:19)
    at at.caks.ceylon.ds.run_.run(run.ceylon:5)
    at at.caks.ceylon.ds.run_.main(run.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:61)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:51)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:89)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:141)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:126)
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.modules.Module.run(Module.java:270)
    at org.jboss.modules.Main.main(Main.java:294)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:208)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:343)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:283)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:89)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:21)

java.lang.NullPointerException
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClass.init(FreeClass.java:50)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassOrInterface.checkInit(FreeClassOrInterface.java:148)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassOrInterface.$getJavaAnnotations$(FreeClassOrInterface.java:501)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.annotations(Metamodel.java:616)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.annotations(Metamodel.java:611)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Predicates$AnnotatedWith.accept(Predicates.java:328)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Predicates$AnnotatedWith.accept(Predicates.java:312)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Predicates$And.accept(Predicates.java:115)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreePackage.filteredMembers(FreePackage.java:151)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreePackage.annotatedMembers(FreePackage.java:138)
    at at.caks.ceylon.ds.ds_.resolveService(core.ceylon:19)
    at at.caks.ceylon.ds.run_.run(run.ceylon:5)
    at at.caks.ceylon.ds.run_.main(run.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:61)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:51)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:89)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:141)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:126)
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.modules.Module.run(Module.java:270)
    at org.jboss.modules.Main.main(Main.java:294)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:208)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:343)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:283)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:89)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:21)

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:89)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:21)
Caused by: java.lang.NoClassDefFoundError: sun/misc/ServiceConfigurationError
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
    at java.lang.Class.getDeclaredMethods(Class.java:1808)
    at com.redhat.ceylon.compiler.loader.impl.reflect.mirror.ReflectionClass.getDirectMethods(ReflectionClass.java:127)
    at com.redhat.ceylon.compiler.loader.AbstractModelLoader.getClassConstructors(AbstractModelLoader.java:818)
    at com.redhat.ceylon.compiler.loader.AbstractModelLoader.getOrCreateDeclaration(AbstractModelLoader.java:677)
    at com.redhat.ceylon.compiler.loader.AbstractModelLoader.convertToDeclaration(AbstractModelLoader.java:512)
    at com.redhat.ceylon.compiler.loader.AbstractModelLoader.convertToDeclaration(AbstractModelLoader.java:943)
    at com.redhat.ceylon.compiler.loader.impl.reflect.ReflectionModelLoader.loadPackage(ReflectionModelLoader.java:105)
    at com.redhat.ceylon.compiler.loader.model.LazyPackage.getMembers(LazyPackage.java:160)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreePackage.filteredMembers(FreePackage.java:148)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreePackage.annotatedMembers(FreePackage.java:138)
    at at.caks.ceylon.ds.ds_.resolveService(core.ceylon:19)
    at at.caks.ceylon.ds.run_.run(run.ceylon:5)
    at at.caks.ceylon.ds.run_.main(run.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:61)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:51)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:89)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:141)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:126)
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.modules.Module.run(Module.java:270)
    at org.jboss.modules.Main.main(Main.java:294)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:208)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:343)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:283)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: sun.misc.ServiceConfigurationError from [Module "com.redhat.ceylon.compiler.java:1.0.0" from local module loader @5c6647cb (roots: E:\eclipse\eclipse-ceylon\plugins\com.redhat.ceylon.eclipse.ui_1.0.0.v20131111-1241-Final\defaultRepository)]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    ... 41 more

See https://groups.google.com/forum/#!topic/ceylon-dev/Tni0XK_t0jY

@FroMage
Copy link
Member

FroMage commented Nov 25, 2013

Could you give us some code that leads to this? Apparently it's related to modules not declaring their dependencies properly. What does your module descriptor look like?

@ghost ghost assigned FroMage Nov 25, 2013
@redrezo
Copy link
Author

redrezo commented Nov 25, 2013

i prepared an example at https://github.com/redrezo/ceylon-issues/

i just execute the run method - it basically contains the same code as posted above
it dies early with a "ceylon run: Declaration type not supported yet: UnknownType" exception but if you add a try catch you will get a lot of exceptions including an uncatchable exception

i use ceylon 1.0.0 with the eclipse tooling

(i just created a project via the eclipse tooling, the module descriptor was not modified by hand)

@FroMage
Copy link
Member

FroMage commented Apr 8, 2014

Thanks, working on it now. So the first issue has to do with overloading, which we don't support ATM in the metamodel. I'll try to come up with a solution.

FroMage added a commit to ceylon/ceylon-module-resolver that referenced this issue Apr 10, 2014
We really don't need to ship ant in our repo just to satisfy ant classes in sardine
that we will never use, so I removed them
FroMage added a commit to ceylon/ceylon-runtime that referenced this issue Apr 10, 2014
FroMage added a commit to ceylon/ceylon-runtime that referenced this issue Apr 10, 2014
FroMage added a commit that referenced this issue Apr 10, 2014
FroMage added a commit that referenced this issue Apr 10, 2014
FroMage added a commit to ceylon/ceylon-compiler that referenced this issue Apr 10, 2014
… mark them ceylon/ceylon.language#347

Otherwise the metamodel will not know what to do with them and throw
@FroMage
Copy link
Member

FroMage commented Apr 10, 2014

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants