Skip to main content



      Home
Home » Modeling » Epsilon » Illegal assignment to variable package(Assignments)
Illegal assignment to variable package [message #1816242] Thu, 24 October 2019 11:09 Go to next message
Eclipse UserFriend
Hi everyone,

I was about to add some new package to my model and did like in this example:

Example: Create an OO model with EOL
https://www.eclipse.org/epsilon/examples/

This is my code:
for(cLogFunction in capellaLogFunctions){

	if(isPackageWithoutChildPackage(cLogFunction) ){
	         var package : Package = new Package; // <=Error
                 (package .name).println();
                 package.name = "p" ;		
	}
}


So this is what the error says:
"Illegal assignment to variable 'package'. Expected Package and found e2c9a1e8-e013-476e-bf10-7ba3d2f7fc4d"

What does that even mean? So I am really new to Epsilon - so is there a place where I can find all object types which could be allocated through EOL?

Many thanks!
Hans
Re: Illegal assignment to variable package [message #1816266 is a reply to message #1816242] Thu, 24 October 2019 15:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi Hans,

Could you please provide a minimal example [1] I can use to reproduce this locally?

Beyond the built-in types (Integer, String, Sequence etc.) all other types in EOL come from the metamodels of the models it is given access to.

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: Illegal assignment to variable package [message #1816289 is a reply to message #1816242] Fri, 25 October 2019 08:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dimitris,

I solved it myself :)

But I am not sure if it was a problem of assignment or some of the other errors I did.

Maybe you can help me out with some other problem I am facing right now. So the context is that I have the task to do a model2model transformation from Capella to PTC. And right now I want to add a logical function from capella as a "block" element in PTC. But the type "Block" isn't a object that I can create - in fact it looks like I cant create it. So the basic type would be class - but I don't know how to change that element to a Block!?!?

I thought I had to do this over the stereotype, but I don't have any clue how to this. Maybe you got some extra information for me on how to this task...

What I tried so far:

			var newPtcPackage = createPackage(ptcSysFuncPackage, capellaLogFunction.name);
			("2------------------------------------------------------------").println();
			var ptcStereotypeBlock = new Stereotype;
			ptcStereotypeBlock.defaultproperty = "Block";
			ptcStereotypeBlock.name = "Block";
			ptcStereotypeBlock.displayname = "Block";

			("3------------------------------------------------------------").println();
			var ptcNewBlock = new Class;
			ptcNewBlock.name = capellaLogFunction.name;
			("4------------------------------------------------------------").println();
			 ptcNewBlock.stereotype = ptcStereotypeBlock; // ERROR stuck in this wrong parameter
			
			ptcNewBlock.id = capellaLogFunction.id;
			("5------------------------------------------------------------").println();
			newPtcPackage.packageitem = ptcNewBlock;
			("6------------------------------------------------------------").println();


I would be really thankful on that and if its necessary I will provide some minimal example!

Regards,
Hans
Re: Illegal assignment to variable package [message #1816293 is a reply to message #1816289] Fri, 25 October 2019 09:15 Go to previous messageGo to next message
Eclipse UserFriend
Hi Hans,

I've forwarded this to the developers of the PTC Integrity Modeller driver.

Cheers,
Dimitris
Re: Illegal assignment to variable package [message #1816297 is a reply to message #1816293] Fri, 25 October 2019 09:49 Go to previous messageGo to next message
Eclipse UserFriend
Thank you!
Re: Illegal assignment to variable package [message #1816716 is a reply to message #1816297] Tue, 05 November 2019 08:33 Go to previous message
Eclipse UserFriend
Hi Hans,

In order for PTC to allow you to apply a stereotype to an element, you need to tell it which metatypes are valid for this stereotype. In your case, you need to define that the "Class" meta type is valid for your Block stereotype.

// Create the stereotype
var ptcStereotypeBlock = new Stereotype;
ptcStereotypeBlock.defaultproperty = "Block";
ptcStereotypeBlock.name = "Block";
ptcStereotypeBlock.displayname = "Block";

// Create the class
var myClass = new Class;
myClass.name = "TheClass";

// Find the Class meta model type in PTC IM
var classType = MetaModelType.all.selectOne(mmt | mmt.name = "Class");
//Add the Class meta type in the valid types for the stereotype
ptcStereotypeBlock.metamodeltype.add(classType);

// Apply the stereotype to the class
myClass.stereotype = ptcStereotypeBlock;

Also, the "Working with stereotypes and tag definitions (automation interface)" help topic of PTC IM provides some information on how stereotypes/tag definitions work with the automation interface and you might find it helpful.
Previous Topic:Problem declaring constraints on Eclipse Oxygen
Next Topic:Run Eclipse Epsilon code generation online
Goto Forum:
  


Current Time: Thu Jul 10 06:23:59 EDT 2025

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

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

Back to the top