Cannot get property 'staticImport' on null object
priitliivak opened this issue · 6 comments
When running organizeImports on my project I get NPE
Caused by: java.lang.NullPointerException: Cannot get property 'staticImport' on null object
at org.ajoberstar.gradle.imports.OrganizeImports$_organizeFile_closure7.doCall(OrganizeImports.groovy:101)
at org.ajoberstar.gradle.imports.OrganizeImports.organizeFile(OrganizeImports.groovy:81)
at org.ajoberstar.gradle.imports.OrganizeImports$_organize_closure3.doCall(OrganizeImports.groovy:50)
at org.ajoberstar.gradle.imports.OrganizeImports.organize(OrganizeImports.groovy:49)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at ...
Must be some scenario in your source code that I didn't handle correctly. Is your project publicly accessible? I'd like to trace down which file it might be. If it's not possible to point me at the code, I'd have to get some more logging added to the code to help identify which file causes the issue.
We don't have this code open sourced (it is a test assignment so we cannot do that either).
I'll try to create a more isolated use case in parallel
To me it seems that Project Lombok has something to do with it but yet again the issue seems to occur only with this Unicorn class
You can get a very small example from: https://www.dropbox.com/s/407pwvy9iprpq61/assignment_bug.zip?dl=0
organizeImports can be run from root project.
Thanks for the test case. The issue was that when fully qualified class names only have two elements, it didn't match any of the sorting patterns. Now there's a fallback where those end up grouped at the bottom. Can you test 1.0.2-rc.1
to confirm it fixes your issue?
Yes this fixes my issue. Thank you for quick fix.
Thanks for validating. 1.0.2 is now released.