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

False positive NULL_DEREFERENCE for Airlift ConfigurationInspector #249

Open
electrum opened this issue Jan 28, 2016 · 2 comments
Open

False positive NULL_DEREFERENCE for Airlift ConfigurationInspector #249

electrum opened this issue Jan 28, 2016 · 2 comments

Comments

@electrum
Copy link

https://github.com/airlift/airlift

configuration/src/main/java/io/airlift/configuration/ConfigurationInspector.java:98: error: NULL_DEREFERENCE
  object returned by metadata.getAttributes() could be null and is dereferenced at line 98
  096.   
  097.               ImmutableSortedSet.Builder<ConfigAttribute> builder = ImmutableSortedSet.naturalOrder();
  098. >             for (AttributeMetadata attribute : metadata.getAttributes().values()) {
  099.                   String propertyName = prefix + attribute.getInjectionPoint().getProperty();
  100.                   Method getter = attribute.getGetter();

getAttributes() returns a final field which is always initialized as non-null in the constructor.

@sblackshear
Copy link
Contributor

Hi David,
Thanks for this report and your others. Unfortunately, you have run into one of the dark corners of Infer: our Java 8 support. The frontend we use to parse Java bytecodes is a third-party library that does not yet support Java 8 (we are working on encouraging the maintainers to add support or do it ourselves). As a result, some classes may parse incorrectly, and some may fail to parse altogether. I will look into this issue and see if it is something unrelated to Java 8, but just a heads-up that anything using Java 8 can lead to strange results.

@sblackshear
Copy link
Contributor

I looked into this. What is happening is not related to Java 8. Instead, the analysis times out on the constructor for AttributeMetadata, which means that it does not know the fields have been initialized to a non-null value. We will work on fixing the timeout and/or making the analysis act more angelically in such cases.

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

No branches or pull requests

3 participants