Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Iteration over the metamodel: annotatedMembers throws some execptions #5225

Closed
CeylonMigrationBot opened this issue Nov 15, 2013 · 4 comments

Comments

@CeylonMigrationBot
Copy link

[@redrezo] 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

[Migrated from ceylon/ceylon.language#347]
[Closed at 2014-04-10 11:24:24]

@CeylonMigrationBot
Copy link
Author

[@FroMage] 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?

@CeylonMigrationBot
Copy link
Author

[@redrezo] 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)

@CeylonMigrationBot
Copy link
Author

[@FroMage] 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.

@CeylonMigrationBot
Copy link
Author

[@FroMage] Fixed!

@CeylonMigrationBot CeylonMigrationBot added this to the 1.1 milestone Nov 14, 2015
FroMage added a commit that referenced this issue Nov 14, 2015
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 that referenced this issue Nov 14, 2015
FroMage added a commit that referenced this issue Nov 14, 2015
quintesse pushed a commit that referenced this issue Nov 14, 2015
FroMage added a commit that referenced this issue Nov 14, 2015
…pend on optional imports

This one depends on javax.servlet
FroMage added a commit that referenced this issue Nov 14, 2015
… mark them #5225

Otherwise the metamodel will not know what to do with them and throw
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants