Skip to content

fix: fix a bad exception in DJPP #1903

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

Merged
merged 1 commit into from
Mar 10, 2018
Merged

Conversation

monperrus
Copy link
Collaborator

fix bad exception in DJPP after heavy transformation, no way to reproduce in a test case.

@pvojtechovsky
Copy link
Collaborator

This PR looks like a workaround of some deeper problem. So I would say it is not good idea to merge it.

It looks like that heavy transformation produced an inconsistent spoon model, where an element (parent) has some children, but these children doesn't point back to that parent. Their parent is uninitialized.

May be

  1. run a spoon model consistency check
  2. found which element is invalid and which code made it
  3. fix the spoon code which allows producing such inconsistencies

WDYT?

@monperrus
Copy link
Collaborator Author

The transformation code was working very well with previous versions of Spoon, so it can be considered as a regression. As for all regressions, I prefer to fix it in Spoon's core and not in the client code.

It's a semi-workaround, the alternative fix would be to identify the intercession method that did not set the parent, but I cannot find it.

This PR fixes the regression.

@pvojtechovsky
Copy link
Collaborator

this PR is fixing secondary problem.

to identify the intercession method that did not set the parent,

that would be fix of the primary problem

@pvojtechovsky pvojtechovsky merged commit 7549e25 into INRIA:master Mar 10, 2018
@monperrus
Copy link
Collaborator Author

agree, hope we'll find the primary problem at some point!

(actually, I'm surprised because we have a strong test on whether setters set the parent)

@monperrus
Copy link
Collaborator Author

Found the bug:

ctBlock.getStatements().add

Impossible to fix in Spoon...

unless getStatements() returns a super-list similar to those you have in the role part. WDYT?

@pvojtechovsky
Copy link
Collaborator

unless getStatements() returns a super-list similar to those you have in the role part.

yes, that would make sense.
In future I would like to refactor whole Spoon model by way all the multivalue properties are read/write and automatically binds new items with parent and sends change events - like "in the role part"

@monperrus
Copy link
Collaborator Author

monperrus commented Mar 15, 2018 via email

@surli surli mentioned this pull request Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants