Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » NullLiteral.resolveConstantExpressionValue() gives null
NullLiteral.resolveConstantExpressionValue() gives null [message #1712343] Fri, 23 October 2015 04:16 Go to next message
Eclipse UserFriend
Hi,
I have a code like
Object returnValue = null;
return returnValue;

When I call SimpleName.resolveConstantExpressionValue() (this is returnValue), I always get null, but it's the same result when resolving was failed. How to make sure that this null is related to NullLiteral, but not just a unsucceeded result?

Thanks
Re: NullLiteral.resolveConstantExpressionValue() gives null [message #1712403 is a reply to message #1712343] Fri, 23 October 2015 11:46 Go to previous messageGo to next message
Eclipse UserFriend
I don't think you can, short of doing some sort of flow analysis that brings you back to the NullLiteral.

<microrant>Null is evil.</microrant>
Re: NullLiteral.resolveConstantExpressionValue() gives null [message #1712419 is a reply to message #1712403] Fri, 23 October 2015 19:31 Go to previous message
Eclipse UserFriend
SimpleName.resolveConstantExpressionValue() will only ever return a non-null value, if the name is a compile time constant, i.e., it must be final and the exact value is known to the compiler.
The null type is represented by an ITypeBinding answering true to #isNullType().
Previous Topic:Google Maps API v3 Code Assist
Next Topic:Why is simpleName.resolveBinding().getType() != simpleName.resolveTypeBinding()?
Goto Forum:
  


Current Time: Tue Jul 08 12:05:48 EDT 2025

Powered by FUDForum. Page generated in 0.07744 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top