Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Code generated from UML with OCL
Code generated from UML with OCL [message #476644] Fri, 16 November 2007 20:22 Go to next message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 181
Registered: July 2009
Senior Member
Today I tried to generate code from a metamodel defined in UML. I ran
into a problem when I added OCL expressions that contain line breaks.
The code generator doesn't handle this well because I ended up with
invalid Java code. Here's what I get when generating code for class
Namespace from the UML metamodel.

String ...__EOCL_EXP = "result = self.member->forAll( memb |
self.member->excluding(memb)->forAll(other |
memb.isDistinguishableFrom(other, self)))";

The OCL expression is copied into the Java file as is including line
breaks, which leads to compile errors. Is this a bug, or is there a way
to get the code generator to strip line breaks from OCL expressions? If
possible, I would like to keep the OCL in my metamodel formatted for
better readability.

I use Eclipse 3.3.0, UML2 2.1.1, EMF 2.3.1.

Thanks,
Lutz
Re: Code generated from UML with OCL [message #476645 is a reply to message #476644] Mon, 19 November 2007 14:46 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Lutz,

That would indeed appear to be a bug. Please raise a defect on this and it
will be addressed.

Regards,
- James.


"Lutz Wrage" <lwrage@sei.cmu.edu> wrote in message
news:fhku6d$i7j$1@build.eclipse.org...
> Today I tried to generate code from a metamodel defined in UML. I ran into
> a problem when I added OCL expressions that contain line breaks. The code
> generator doesn't handle this well because I ended up with invalid Java
> code. Here's what I get when generating code for class Namespace from the
> UML metamodel.
>
> String ...__EOCL_EXP = "result = self.member->forAll( memb |
> self.member->excluding(memb)->forAll(other |
> memb.isDistinguishableFrom(other, self)))";
>
> The OCL expression is copied into the Java file as is including line
> breaks, which leads to compile errors. Is this a bug, or is there a way to
> get the code generator to strip line breaks from OCL expressions? If
> possible, I would like to keep the OCL in my metamodel formatted for
> better readability.
>
> I use Eclipse 3.3.0, UML2 2.1.1, EMF 2.3.1.
>
> Thanks,
> Lutz
Re: Code generated from UML with OCL [message #625545 is a reply to message #476644] Mon, 19 November 2007 14:46 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Lutz,

That would indeed appear to be a bug. Please raise a defect on this and it
will be addressed.

Regards,
- James.


"Lutz Wrage" <lwrage@sei.cmu.edu> wrote in message
news:fhku6d$i7j$1@build.eclipse.org...
> Today I tried to generate code from a metamodel defined in UML. I ran into
> a problem when I added OCL expressions that contain line breaks. The code
> generator doesn't handle this well because I ended up with invalid Java
> code. Here's what I get when generating code for class Namespace from the
> UML metamodel.
>
> String ...__EOCL_EXP = "result = self.member->forAll( memb |
> self.member->excluding(memb)->forAll(other |
> memb.isDistinguishableFrom(other, self)))";
>
> The OCL expression is copied into the Java file as is including line
> breaks, which leads to compile errors. Is this a bug, or is there a way to
> get the code generator to strip line breaks from OCL expressions? If
> possible, I would like to keep the OCL in my metamodel formatted for
> better readability.
>
> I use Eclipse 3.3.0, UML2 2.1.1, EMF 2.3.1.
>
> Thanks,
> Lutz
Previous Topic:Code generated from UML with OCL
Next Topic:create package in a eclipse plugin
Goto Forum:
  


Current Time: Tue Apr 16 04:25:12 GMT 2024

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

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

Back to the top