Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » problem with IntroductionToUML2Profiles
problem with IntroductionToUML2Profiles [message #1790789] Sun, 17 June 2018 19:17 Go to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 88
Registered: July 2009
Member
I have been trying to get uml2 profiles to work programmatically and downloaded uml2.articles_200607181325.zip from https://www.eclipse.org/modeling/mdt/uml2/docs/articles/Introduction_to_UML2_Profiles/article.html

I made a project and ran the code but i am getting an exception

Exception in thread "main" java.lang.IllegalArgumentException: [email][email][email][email]org.eclipse.uml2.uml.internal.impl.ClassImpl@faa3fed[/email][/email][/email][/email] (name: Property, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
at org.eclipse.uml2.uml.internal.operations.StereotypeOperations.createExtension(StereotypeOperations.java:358)
at org.eclipse.uml2.uml.internal.impl.StereotypeImpl.createExtension(StereotypeImpl.java:270)
at org.eclipse.uml2.articles.IntroductionToUML2Profiles.createExtension(IntroductionToUML2Profiles.java:86)
at org.eclipse.uml2.articles.IntroductionToUML2Profiles.main(IntroductionToUML2Profiles.java:254)


when it calls Stereotype.createExtension

any help would be gratefully recieved

regards
gary

[Updated on: Sun, 17 June 2018 21:04]

Report message to a moderator

Re: problem with IntroductionToUML2Profiles [message #1790794 is a reply to message #1790789] Mon, 18 June 2018 05:28 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6937
Registered: July 2009
Senior Member
Hi

You've probably done something wrong, but without a repro there are too many things for me to guess at. You can single step the tutorial example in the debugger to see why your code fails and the example succeeds.

Regards

Ed Willink
Re: problem with IntroductionToUML2Profiles [message #1790842 is a reply to message #1790794] Mon, 18 June 2018 21:36 Go to previous messageGo to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 88
Registered: July 2009
Member
Hi Ed

sorry you misunderstood me, sorry if I wasn't clear. The example code fails with the error. I haven't modified the code except for changing the package it lives in (I can revert this if you wan't but I presume it should n't make any difference).

the error occurs the first time it tries to create an extension

 createExtension(propertyMetaclass, eAttributeStereotype, false);


and calls this method

protected static Extension createExtension(
			org.eclipse.uml2.uml.Class metaclass, Stereotype stereotype,
			boolean required) {
		Extension extension = stereotype.createExtension(metaclass, required);

		out((required
			? "Required extension '"
			: "Extension '") + extension.getQualifiedName() + "' created.");

		return extension;
	}


I can try running it on another computer and eclipse installation at work if you want.....

I can also roll up the complete eclipse project and attach [its very small]

The rest of the Getting Started with uml2 code works

its using org.eclipse.uml2.uml.resources_5.2.0.v20170227-0935.jar for resources

and the following libraries are included in the project

org.eclipse.emf.ecore_2.12.0.v20160420-0247.jar
org.eclipse.emf.common_2.12.0.v20160420-0247.jar
org.eclipse.emf.ecore.xmi_2.12.0.v20160420-0247.jar
org.eclipse.uml2.common_2.1.0.v20170227-0935.jar
org.eclipse.uml2.types_2.0.0.v20170227-0935.jar
org.eclipse.emf.mapping.ecore2xml_2.9.0.v20160526-0356.jar
org.eclipse.uml2.uml.resources_5.2.0.v20170227-0935.jar
org.eclipse.uml2.uml.profile.standard_1.0.100.v20170227-0935.jar

other than that its a copy of the uml2.examples.gettingstarted project in eclipse Neon.3 Release (4.6.3)

regards
gary

  • Attachment: articles.tgz
    (Size: 5.09KB, Downloaded 58 times)
Re: problem with IntroductionToUML2Profiles [message #1790851 is a reply to message #1790842] Tue, 19 June 2018 05:50 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6937
Registered: July 2009
Senior Member
Hi

" except for changing the package" has to be the first thing to look at. The example works for me.

Regards

Ed Willink
Re: problem with IntroductionToUML2Profiles [message #1790859 is a reply to message #1790851] Tue, 19 June 2018 07:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6937
Registered: July 2009
Senior Member
Hi

I've found that the stereotype diagnostics are not helpful, so I tried to reproduce your refactoring. But failed.

The IllegalArgumentException message could be much improved, but realistically if you are skilled enough to invoke Stereotype.createExtension, you are skilled enough to read the lines immediately preceding the IAE throw. I don't feel inclined to raise a Bugzilla.

Regards

Ed Willink
Re: problem with IntroductionToUML2Profiles [message #1794537 is a reply to message #1790859] Sat, 01 September 2018 12:08 Go to previous messageGo to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 88
Registered: July 2009
Member
ok so i have now had time to come back to this. The failure is at the test

!metaclass.isMetaclass() in org.eclipse.uml2.uml.internal.operations.StereotypeOperations.createExtension(StereotypeOperations.java:358) which gives false to the metaclass being a metaclass

I have looked further back in the example code and found the metaclass referred to is created as follows

	protected static org.eclipse.uml2.uml.Class referenceMetaclass(
			Profile profile, String name) {
		Model umlMetamodel = (Model) load(URI
			.createURI(UMLResource.UML_METAMODEL_URI));

		org.eclipse.uml2.uml.Class metaclass = (org.eclipse.uml2.uml.Class) umlMetamodel
			.getOwnedType(name);

		profile.createMetaclassReference(metaclass);

		out("Metaclass '" + metaclass.getQualifiedName() + "' referenced.");

		return metaclass;
	}



which is called as follows

org.eclipse.uml2.uml.Class propertyMetaclass = referenceMetaclass(
			ecoreProfile, UMLPackage.Literals.PROPERTY.getName());


at this point I am sorry I am stumped as I don't have enough understanding of the workings of uml2 to understand what is going wrong, the code appears to be exactly the same as that in the article....

if you have a working copy of the example code could you end me yours because the one I sent to you is what I am using. Otherwise it must be a misconfiguration in my uml2/eclipse installation which is even more of a nightmare

regards
Gary

[Updated on: Sat, 01 September 2018 12:09]

Report message to a moderator

Re: problem with IntroductionToUML2Profiles [message #1794538 is a reply to message #1794537] Sat, 01 September 2018 13:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6937
Registered: July 2009
Senior Member
Hi

Your analysis no doubt means something to you since you have been struggling with it, but I doubt it means anything to anyone else.

I suggest you wrap up your problem as a JUnit test case whose failure demonstrates your concern. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=455572 for an example.

Regards

Ed Willink

Re: problem with IntroductionToUML2Profiles [message #1800646 is a reply to message #1794538] Fri, 04 January 2019 11:01 Go to previous messageGo to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 88
Registered: July 2009
Member
Hi

I though I would update on where I got with this

I now have it working having followed the code in the example project org.eclipse.uml2.examples.introprofiles

this can be created by selecting new -> examples and searching for profile which brings up Introduction to UML2 profiles, this project works. Examining the downloaded zip file described above and the project there are distinct differences in the code. I haven't had the time to see what the trigger for the failure with the zip file is, but this is a solution...


regards
Gary
Re: problem with IntroductionToUML2Profiles [message #1800652 is a reply to message #1800646] Fri, 04 January 2019 13:26 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6937
Registered: July 2009
Senior Member
Hi

As Eclipse projects get older and Eclipse/project improves, old documentation can become very embarrassing.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=543170 raised.

Regards

Ed Willink
Previous Topic:[solved] getApplicableStereotypes() is empty
Next Topic:Ecore to UML
Goto Forum:
  


Current Time: Wed Dec 02 22:37:20 GMT 2020

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

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

Back to the top