-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] toString crashes due to comment handling #3381
Comments
If the comments are not needed I believe this fixes eventual problems: |
Thanks for the bug report.
What happens if you call toStringDebug instead of toString?
|
nharrand
added a commit
to santos-samuel/spoon
that referenced
this issue
May 26, 2020
|
Since the PR was merged already i'm closing this issue |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Hello,
I just came across an error.
When I add certain classes as input resources to the launcher, Spoon, when building the model, will only partially parse the class and throw an error that is shown on some fields saying:
Method threw 'spoon.SpoonException' exception. Cannot evaluate spoon.support.reflect.declaration.CtClassImpl.toString()
And when I call the toString method it says:
spoon.SpoonException: Unexpected next line after last line
It's not that I care about the toString() method, but this error is not allowing me, for instance, to get the Executable Declaration of a method based on its executable.(actually this error was coming from another place)I created a PR with two failing test cases so you can inspect it:
#3382
Thanks in advance!
EDIT1:
After some debugging I found that the error is on class
JDTCommentBuilder.java
on line 608.I believe the problem is that you are not considering line comments inside block comments, for example:
When the code sees the first '/' on the first line of the comment it will immediatly do
isLastLine = true;
. And then the second lineSecurityContextHolder.getContex (...)
will throw the error.The text was updated successfully, but these errors were encountered: