Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » C++ reversing not working(No model created, returns NullPointerException)
C++ reversing not working [message #1815391] Wed, 02 October 2019 07:52 Go to next message
Jozsef Klespitz is currently offline Jozsef KlespitzFriend
Messages: 33
Registered: September 2019
Member
Hello everyone,

I am getting familiar with Papyrus and right after the beginnig I am stucked.
I tried to reverse a C++ class with papyrus and all my attempts have failed:
Right-click on folder->Reverse->To new UML model: happens nothing (literally, not even an error message)
Right-click on header file->Reverse->To new UML model: happens nothing
Right-click on footer file->Reverse->To new UML model: happens nothing
Open class header->rigtht-click on code->Reverse->To new UML model: results NullpointerException (log at the end of message), but an empty folder "reverse_model" is created
Open class footer->rigtht-click on code->Reverse->To new UML model: results NullpointerException , but an empty folder "reverse_model" is created
Drag and drop header file to a class diagram: reverse java dialog opens, cannot access reverse C++ feature

I appreciate any suggestions. Thank you for your kind help.

eclipse.buildId=4.13.0.I20190916-1045
java.version=1.8.0_222
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.cpp.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.cpp.product
Papyrus C++ profile, view and code generation (Incubation) v1.1.0
Papyrus Designer Transformation, develop and deploy... v0.8.0
Papyrus Java profile, library, ... v1.1.0

java.lang.NullPointerException
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.getContainerPackage(ReverseCpp2Uml.java:3477)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.getOrCreateClassifier(ReverseCpp2Uml.java:728)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.reverseHeader(ReverseCpp2Uml.java:636)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.access$4(ReverseCpp2Uml.java:633)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$10.accept(ReverseCpp2Uml.java:564)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$10.accept(ReverseCpp2Uml.java:1)
	at com.google.common.collect.Iterables$4.lambda$forEach$0(Iterables.java:568)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at com.google.common.collect.Iterables$4.forEach(Iterables.java:565)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.reverseProject(ReverseCpp2Uml.java:567)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.access$2(ReverseCpp2Uml.java:553)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$11.accept(ReverseCpp2Uml.java:573)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$11.accept(ReverseCpp2Uml.java:1)
	at com.google.common.collect.Iterables$4.lambda$forEach$0(Iterables.java:568)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at com.google.common.collect.Iterables$4.forEach(Iterables.java:565)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.reverseProject(ReverseCpp2Uml.java:576)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.access$2(ReverseCpp2Uml.java:553)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$11.accept(ReverseCpp2Uml.java:573)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$11.accept(ReverseCpp2Uml.java:1)
	at com.google.common.collect.Iterables$4.lambda$forEach$0(Iterables.java:568)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at com.google.common.collect.Iterables$4.forEach(Iterables.java:565)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.reverseProject(ReverseCpp2Uml.java:576)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.access$2(ReverseCpp2Uml.java:553)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$11.accept(ReverseCpp2Uml.java:573)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$11.accept(ReverseCpp2Uml.java:1)
	at com.google.common.collect.Iterables$4.lambda$forEach$0(Iterables.java:568)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at com.google.common.collect.Iterables$4.forEach(Iterables.java:565)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.reverseProject(ReverseCpp2Uml.java:576)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.access$2(ReverseCpp2Uml.java:553)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$5.accept(ReverseCpp2Uml.java:423)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml$5.accept(ReverseCpp2Uml.java:1)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.reverse.ReverseCpp2Uml.reverseProject(ReverseCpp2Uml.java:426)
	at org.eclipse.papyrus.designer.languages.cpp.reverse.ui.handler.ReverseToNewUmlModel$1.run(ReverseToNewUmlModel.java:101)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Re: C++ reversing not working [message #1815740 is a reply to message #1815391] Wed, 09 October 2019 15:01 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi,

I can't reproduce the issue on my machine. Can you please upgrade to the nightly build and check whether the problem persist?
nightly update site: https://hudson.eclipse.org/papyrus/job/papyrus-designer-2019-06/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.designer.p2/target/repository/

Best

Ansgar
Re: C++ reversing not working [message #1815822 is a reply to message #1815740] Fri, 11 October 2019 12:48 Go to previous messageGo to next message
Jozsef Klespitz is currently offline Jozsef KlespitzFriend
Messages: 33
Registered: September 2019
Member
Thank you for the feedback!
I have tried it with the nightly build and I have experienced the following:

I tried to reverse a C++ class with papyrus and all my attempts have failed:
Right-click on folder->Reverse->To new UML model: happens nothing Same
Right-click on header file->Reverse->To new UML model: happens nothing Same
Right-click on footer file->Reverse->To new UML model: happens nothing Same
Open class header->rigtht-click on code->Reverse->To new UML model: results NullpointerException (log at the end of message), but an empty folder "reverse_model" is created Same
Open class header->rigtht-click on code->Reverse->To existing UML model: overwrites the model and it become corrupted
Open class footer->rigtht-click on code->Reverse->To new UML model: results NullpointerException , but an empty folder "reverse_model" is created Same
Drag and drop header file to a class diagram: reverse java dialog opens, cannot access reverse C++ feature Same

So the situation is basically the same.
Does Papyrus maybe have some requirements/dependencies which are not solved automatically during installation?
I am using it from Eclipse CDT 2019-09.
Re: C++ reversing not working [message #1815874 is a reply to message #1815822] Mon, 14 October 2019 07:32 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Is the C++ file that you want to reverse already in a CDT project? This is required, as the reverse uses information from the CDT indexer/model.
Re: C++ reversing not working [message #1815876 is a reply to message #1815874] Mon, 14 October 2019 08:11 Go to previous messageGo to next message
Jozsef Klespitz is currently offline Jozsef KlespitzFriend
Messages: 33
Registered: September 2019
Member
Yes, the C++ file (and project) was imported into the workspace, and the indexer has run on it.

What might be interesting for you is, that I have Java Code Generation and Java Code Reverse options in preferences, but I have only C++ Code generation and no any C++ Code Reverse option.

[Updated on: Mon, 14 October 2019 08:47]

Report message to a moderator

Re: C++ reversing not working [message #1816127 is a reply to message #1815876] Mon, 21 October 2019 15:39 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Which OS are you using? I'm using Linux and can imagine that path names, eventual spaces in it and their separation could be a problem. I quote the code of getContainerPackage below. Can you please import the source of plugin org.eclipse.papyrus.designer.languages.cpp.reverse (available on git) into your workspace, place a breakpoint at the beginning and then try the reverse operation in the 2nd Eclipse instance. Is unit already null in the first place? Is the model returned by the function "correspondingModel" null? Is there a problem to split the path using "/"?

Thanks

Ansgar


private def getContainerPackage(ITranslationUnit unit) {
	var model = unit.correspondingModel
	var unitPath = unit.file.projectRelativePath.toString
	if (unitPath === null || unitPath.equals("")) {
		unitPath = unit.location.toString
	}
	val arrayNames = unitPath.split("/" + model.name + "/").last.split("/")
	val names = new ArrayList<String>
	arrayNames.forEach[names.add(it)]
	// names.remove(0)
	var Package parentPack = model
	for (name : names) {
		if (!name.equals(unit.elementName)) {
			if (parentPack.getNestedPackage(name) === null) {
				parentPack.createNestedPackage(name)
			}
			parentPack = parentPack.getNestedPackage(name)
		}
	}
	parentPack
} 
Previous Topic:How do I get the FMI 2.0 Profile?
Next Topic:How to hide the element between << >> on diagrams?
Goto Forum:
  


Current Time: Mon Dec 16 03:19:00 GMT 2019

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

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

Back to the top