Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Problems with generating Java code for static Profiles
Problems with generating Java code for static Profiles [message #1689017] Sun, 22 March 2015 12:16 Go to next message
Alexander Kraas is currently offline Alexander KraasFriend
Messages: 9
Registered: March 2015
Junior Member
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 15:50 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6109
Registered: July 2009
Senior Member
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
>
Previous Topic:Example of OCL use in a real open source projects / DSLs
Next Topic:Probable move to Java 7 classes for Eclipse OCL in Mars
Goto Forum:
  


Current Time: Wed Nov 14 06:24:57 GMT 2018

Powered by FUDForum. Page generated in 0.02447 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top