Skip to content
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

fix: DefaultJavaPrettyPrinter prints an ERROR comment instead of failure #1797

Merged
merged 2 commits into from
Jan 1, 2018

Conversation

pvojtechovsky
Copy link
Collaborator

In case of some model inconsistency (missing field declaration) the DJPP failed before. It is much more debugging friendly if there is no failure, but if it prints the comment with error description instead.
WDYT?

@monperrus
Copy link
Collaborator

I agree that DJPP is not the most appropriate location for this check.

As error message I'd suggest something even more explicit "/* ERROR: Missing field "fieldname", please check your model. The code may not compile.".

We may move the exception raising in CtBody#addStatement directly.

@pvojtechovsky
Copy link
Collaborator Author

We may move the exception raising in CtBody#addStatement directly.

I don't think so, or I didn't understood you.

There are many ways how to break consistency of the model. And it is not good idea to introduce any kind of check, which assures that model is ALWAYS consistent, because:

  • it will have performance impact
  • in the middle of model building/refactoring the model can be temporarily inconsistent - until all the changes are done

May be we might introduce new method #checkConsistenty on some spoon model elements, so the client might call it when needed and to get the report about problems. But it would be different task.

And in all cases I already sometime needed to be able to print inconsistent model too - for debugging purposes - to understand what is the problem.

For me this PR is finished and read for merge.

@monperrus monperrus merged commit 1130453 into INRIA:master Jan 1, 2018
@pvojtechovsky pvojtechovsky deleted the fixDJPPPrintsError branch January 1, 2018 17:46
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