Problems with generating Java code for static Profiles [message #1689017] |
Sun, 22 March 2015 08:16  |
Eclipse User |
|
|
|
Hello,
maybe someone could help me with a problem that I have when trying to generate Java code for static UML profiles. At the moment, I try to migrate a UML profile to Eclipse Luna. The profile defines a lot of OCL invariants and queries in the context of its stereotypes. Many constraints makes use of 'base_xxx' and 'extension_yyy' associations. My current profile implementation for Eclipse Kepler uses a customized OCL evaluation environment that makes such navigation possible. Due to performance reasons, for the Luna Edition I would like to generate native Jave code for all kind of OCL invariants and queries. But unfortunately OCLinEcore crashes during code generation for my profile with the following NPE.
java.lang.NullPointerException
at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreCodeGenerator.generate(OCLinEcoreCodeGenerator.java:128)
at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreCodeGenerator.generatePackage(OCLinEcoreCodeGenerator.java:93)
at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreGenModelGeneratorAdapter.createFeatureBodies(OCLinEcoreGenModelGeneratorAdapter.java:243)
at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreGenModelGeneratorAdapter.doPreGenerate(OCLinEcoreGenModelGeneratorAdapter.java:281)
at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.preGenerate(AbstractGeneratorAdapter.java:283)
at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:700)
at org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil$GeneratorOperation.execute(GeneratorUIUtil.java:178)
at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
I figured out that the NPE only occurs for OCL constraints that contains a 'extension_xxx' navigation. The opposite 'base_yyy' works perfect. I am wondering if this is a possible bug or if I have made a mistake during creation of the genmodel.
I have attached a small example profile containing only one stereotype called 'STypeA'. The stereotype owns the following two invariants:
- INV1: self.base_Class.extension_STypeA.attribA = true
- INV2: self.base_Class.name = 'STypeA'
The NPE described before occurs only when INV1 is contained. In contrast, if only INV2 is contained in the stereotype, the code generation for OCL works perfect.
Does someone of you have any suggestions?
Best regards,
Alexander
|
|
|
Re: Problems with generating Java code for static Profiles [message #1689452 is a reply to message #1689017] |
Mon, 23 March 2015 11:50  |
Eclipse User |
|
|
|
Hi
The Luna release has reached SR2, OCL 5.0.4, so further bug fixes, if
any, will be trivial.
The OCL CG is steadily improving and so you should find quite a few
fixes in Mars M6 (this evening) and it is not too late for bugs to be
fixed for Mars. So I recommend you use the latest code and contribute to
the debugging.
Regards
Ed Willink
On 23/03/2015 14:46, Alexander Kraas wrote:
> Hello,
>
> maybe someone could help me with a problem that I have when trying to generate Java code for static UML profiles. At the moment, I try to migrate a UML profile to Eclipse Luna. The profile defines a lot of OCL invariants and queries in the context of its stereotypes. Many constraints makes use of 'base_xxx' and 'extension_yyy' associations. My current profile implementation for Eclipse Kepler uses a customized OCL evaluation environment that makes such navigation possible. Due to performance reasons, for the Luna Edition I would like to generate native Jave code for all kind of OCL invariants and queries. But unfortunately OCLinEcore crashes during code generation for my profile with the following NPE.
>
> java.lang.NullPointerException
> at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreCodeGenerator.generate(OCLinEcoreCodeGenerator.java:128)
> at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreCodeGenerator.generatePackage(OCLinEcoreCodeGenerator.java:93)
> at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreGenModelGeneratorAdapter.createFeatureBodies(OCLinEcoreGenModelGeneratorAdapter.java:243)
> at org.eclipse.ocl.examples.codegen.oclinecore.OCLinEcoreGenModelGeneratorAdapter.doPreGenerate(OCLinEcoreGenModelGeneratorAdapter.java:281)
> at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.preGenerate(AbstractGeneratorAdapter.java:283)
> at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:700)
> at org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil$GeneratorOperation.execute(GeneratorUIUtil.java:178)
> at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
> at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
> at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
> at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
>
> I figured out that the NPE only occurs for OCL constraints that contains a 'extension_xxx' navigation. The opposite 'base_yyy' works perfect. I am wondering if this is a possible bug or if I have made a mistake during creation of the genmodel.
>
> I have attached a small example profile containing only one stereotype called 'STypeA'. The stereotype owns the following two invariants:
> - INV1: self.base_Class.extension_STypeA.attribA = true
> - INV2: self.base_Class.name = 'STypeA'
>
> The NPE described before occurs only when INV1 is contained. In contrast, if only INV2 is contained in the stereotype, the code generation for OCL works perfect.
>
> Does someone of you have any suggestions?
>
> Best regards,
> Alexander
>
|
|
|
Powered by
FUDForum. Page generated in 0.03986 seconds