-
-
Notifications
You must be signed in to change notification settings - Fork 355
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 #2899 does not work for shadowed String constants #2977
Comments
Thanks a lot for the super detailed bug report. It seems that the test case and the patch is super easy to write based on your extensive analysis. Would you give it a try in a pull-request? That would be awesome. |
mictaege
pushed a commit
to mictaege/spoon
that referenced
this issue
May 17, 2019
…tElementToRuntimeObject (INRIA#2977)
mictaege
added a commit
to mictaege/spoon
that referenced
this issue
May 17, 2019
…tElementToRuntimeObject (INRIA#2977)
Thanks a lot for for your prompt reply! As you suggested I tried to make a pull-request to fix this issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Upgrading from spoon 7.0.0 to 7.4.0. I faced problems that has been caused by the behavior described in the issues:
Both issues has been fixed with
but the fix does not work for String constants and I still get
"not possible to transform to expression ..."
errors.Debugging the application I could see the following behavior:
With #2899
EvalHelper#getCorrespondingRuntimeObject
has been extendend with this additional conditionBut if the shadowed field is a String constant
getDefaultExpression()
returnsnull
and therefore theException
below will still be raised.This is because the default expression has never been set in
JavaReflectionTreeBuilder#visitField(Field)
:For String constants
field.getType().isPrimitive()
is nottrue
and so the whole if-condition turns tofalse
and the default expression will not be set into theCtField
.Changing the if-condition to something like that
in the debugger would make the whole condition
true
and then the default expression will be set correctly.The text was updated successfully, but these errors were encountered: