[ KMF 4.8.1 ]
If you have a class in your MM that uses enum as:
class Foo {
bar: MyEnum
}
enum MyEnum {
String
Int
}
This will throw an error (I suspect because the enum is declared after the class):
java.lang.ClassCastException: org.kevoree.modeling.ast.MModelClass cannot be cast to org.kevoree.modeling.ast.MModelEnum
at org.kevoree.modeling.generator.MMPsiVisitor.getOrAddEnum(MMPsiVisitor.java:184)
at org.kevoree.modeling.generator.MMPsiVisitor.access$000(MMPsiVisitor.java:9)
at org.kevoree.modeling.generator.MMPsiVisitor$1.visitEnumDeclaration(MMPsiVisitor.java:33)
at org.kevoree.modeling.idea.psi.impl.MetaModelEnumDeclarationImpl.accept(MetaModelEnumDeclarationImpl.java:21)
at com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:69)
at org.kevoree.modeling.generator.MMPsiVisitor.visitDeclaration(MMPsiVisitor.java:19)
at org.kevoree.modeling.idea.psi.impl.MetaModelDeclarationImpl.accept(MetaModelDeclarationImpl.java:21)
at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:194)
at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:770)
at org.kevoree.modeling.generator.Generator.execute(Generator.java:66)
at org.kevoree.modeling.generator.mavenplugin.GenModelPlugin.execute(GenModelPlugin.java:93)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
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:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
But, if you have the enum before the class definition, then it works just fine.
[ KMF 4.8.1 ] If you have a class in your MM that uses enum as:
This will throw an error (I suspect because the enum is declared after the class):
But, if you have the enum before the class definition, then it works just fine.