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

Changes to SourcePosition in 5.5.0 ? #1084

Closed
arturbosch opened this issue Jan 4, 2017 · 3 comments
Closed

Changes to SourcePosition in 5.5.0 ? #1084

arturbosch opened this issue Jan 4, 2017 · 3 comments
Labels

Comments

@arturbosch
Copy link
Contributor

Hello,
according to #1081 I don't find any mentions of changes to the SourcePosition.

In our use case we want to calculate the size of constructors and methods. Which worked just fine in 5.4.
Now with the 5.5 Snapshot I want to analyze a file which has a inner private class with no constructors.
Spoon generates a default private constructor with one statement -> super(). The start line of this constructor is 1 and getPosition().getFile() returns null while the statements (super()) line is 383 and it has a file.

My method throws a NP as my method size calculation now is wrong and gets passed the threshold and I try to access the file of the generated private constructor.

I always can implement the case to ignore generated constructors, but I just want to make sure this is intented or not.

@monperrus
Copy link
Collaborator

Oh yes, you're right, there is a missing item: fix(position): improve the element position (#984)
(my bad, I removed it by mistake)

it looks like this is a bug that has to be fixed before the release

@tdurieux
Copy link
Collaborator

tdurieux commented Jan 5, 2017

The start line of this constructor is 1

The line start should be -1 in Spoon 5.5.0.

I create a PR where I set all positions of implicit elements (like implicit constructor call) to SourcePosition.NOPOSITION.
Is it ok for you?

@arturbosch
Copy link
Contributor Author

Thx, that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants