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

NPE in ExplicitConstructorCall of JDT #908

Closed
arturbosch opened this issue Oct 27, 2016 · 7 comments
Closed

NPE in ExplicitConstructorCall of JDT #908

arturbosch opened this issue Oct 27, 2016 · 7 comments

Comments

@arturbosch
Copy link
Contributor

When running newest spoon on argouml in noClasspathMode we get a strange NP in the attached file
npe.zip

Line 266 in code says if (Dbg.on) Dbg.__assert__(i >= 0 && i < _npoints, "point not found");
but JDT interprets it as if (Dbg.on) Dbg.__super__(i >= 0 && i < _npoints, "point not found");

Best way to observe this behaviour is to set a conditional breakpoint in JDTTreeBuilder in Line 1027 with the condition inv.getExecutable() == null

@tdurieux
Copy link
Collaborator

tdurieux commented Oct 28, 2016

The bug is already present in 5.2.0

@tdurieux
Copy link
Collaborator

The method name assert is not present in the jdt data, I don't know how to fix this bug.
May be there is an option in JDT to prevent this change.
I did not yet look the JDT code to understand what going on.

@surli
Copy link
Collaborator

surli commented Dec 16, 2016

I just investigate and assert is a keyword for Java since version 1.4, then you're not allowed to create a method name assert which means JDT considers it is a keyword and failed on the token.

Then the fix is really simple: you have to force the compliance level of Spoon to version 3, to accept the keyword.
Just tested on the attached file and it works fine for me.

@surli
Copy link
Collaborator

surli commented Dec 16, 2016

Thanks for the bug report. The problem is fixed to me as shown in my commit.

@surli surli closed this as completed Dec 16, 2016
@msteinbeck
Copy link
Contributor

Thank you @surli for your work. Does setting the compliance level also fix #925?

@surli
Copy link
Collaborator

surli commented Dec 16, 2016

As explained in #925 I did not manage to reproduce the bug there. Do you have more inputs about it?

@msteinbeck
Copy link
Contributor

Oh, didn't notice, sorry. I'll test latest Spoon and see if the error has gone. Will give you feedback the next days.

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

No branches or pull requests

4 participants