New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong class name on PnmlExport.exportObject #1

Closed
abelgomez opened this Issue Oct 7, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@abelgomez
Collaborator

abelgomez commented Oct 7, 2015

On line 188 of PnmlExport, in the method void fr.lip6.move.pnml.framework.general.PnmlExport.exportObject(EObject object, String filepath) throws ... the following statement is used to get the "native class canonical name":

final String classname = object.getClass().getCanonicalName();

However, when this statement is executed on an instance of, for example fr.lip6.move.pnml.pnmlcoremodel.PetriNetDoc, it returns the implementation class (i.e. fr.lip6.move.pnml.pnmlcoremodel.impl.PetriNetDocImpl).

Thus, the next instruction (OfficialPNMLFileType.getByNativeClassName(classname)) fails, since it seems to expect the interface name (fr.lip6.move.pnml.pnmlcoremodel.PetriNetDoc) instead of the implementation name (fr.lip6.move.pnml.pnmlcoremodel.impl.PetriNetDocImpl).

The enumeration OfficialPNMLFileType stores the interface name as the native class name.

To get the right class name so that the instruction OfficialPNMLFileType.getByNativeClassName(classname) can find the official PNML type, the following instruction should be used instead:

final String classname = object.eClass().getInstanceClassName();
@abelgomez

This comment has been minimized.

Show comment
Hide comment
@abelgomez

abelgomez Oct 7, 2015

Collaborator

I made a pull request to fix this issue, however a test case for it is still missing. It would be nice to have some documentation about how unit tests are organized.

Collaborator

abelgomez commented Oct 7, 2015

I made a pull request to fix this issue, however a test case for it is still missing. It would be nice to have some documentation about how unit tests are organized.

@abelgomez abelgomez closed this Oct 8, 2015

@abelgomez

This comment has been minimized.

Show comment
Hide comment
@abelgomez

abelgomez Oct 8, 2015

Collaborator

Solved in #2

Collaborator

abelgomez commented Oct 8, 2015

Solved in #2

abelgomez added a commit to dice-project/DICE-Simulation-Utils that referenced this issue Oct 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment