FindBugs 3.0.0 reports LocalDateFormat.java:6 Argument of type java.time.LocalDate can't be handled by format specifier %1$tm in LocalDateFormat.main(String[]) [Scary(7), High confidence] when run on the attached program
As Java8 documentation states: Date/Time - may be applied to Java types which are capable of encoding a date or time: long, Long, Calendar, Date and TemporalAccessor.
We are not handling TemporalAccessor types right now. This can be easily fixed (FormatStringChecker, line#163), but I'm not sure about committing the test case. Andrey, Bill, can we commit test cases which require Java8 to compile?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, you can, but for the bug examples project only.
Check last build.xml changes: you should add local.properties in this project and then the build will compile and execute with two different JVM's.
I have no code access right now, if you need nore details, just ask.
CU
Andrey
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There's a problem in checking Java8 code with FindBugs running on jre7: it cannot access proper JRE libraries, thus cannot build a class hierarchy. For example, Hierarchy.isSubtype('java.time.LocalDate', java.util.Date.class.getName()) causes ClassNotFoundException. For now I added an explicit check for java.time.LocalDate, just to make tests working. Probably we should consider checking Java8 code with jre8.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As Java8 documentation states: Date/Time - may be applied to Java types which are capable of encoding a date or time: long, Long, Calendar, Date and TemporalAccessor.
We are not handling TemporalAccessor types right now. This can be easily fixed (FormatStringChecker, line#163), but I'm not sure about committing the test case. Andrey, Bill, can we commit test cases which require Java8 to compile?
Yes, you can, but for the bug examples project only.
Check last build.xml changes: you should add local.properties in this project and then the build will compile and execute with two different JVM's.
I have no code access right now, if you need nore details, just ask.
CU
Andrey
There's an exception in findbugsTestCases/build.xml for test which requires JDK8:
In order not to add more exceptions I took the liberty to replace it with
And renamed Bug1295 to Bug1295jdk8. Also I added jdk8 test for Optional non-null feature
This change is committed here:
https://code.google.com/p/findbugs/source/detail?r=7b5ef3f837a335908e559d491f2b063d32cb64c8
If you can suggest better solution, feel free to comment.
https://code.google.com/p/findbugs/source/detail?r=d11314f456b67506c254f21dafa0885703e5e12c
Related
Feature Requests:
#297Last edit: Tagir Valeev 2014-11-20
Fix and test for this bug is also committed:
https://code.google.com/p/findbugs/source/detail?r=d266ad234942e23ed2e19145a68ec51a13a9ad16
There's a problem in checking Java8 code with FindBugs running on jre7: it cannot access proper JRE libraries, thus cannot build a class hierarchy. For example, Hierarchy.isSubtype('java.time.LocalDate', java.util.Date.class.getName()) causes ClassNotFoundException. For now I added an explicit check for java.time.LocalDate, just to make tests working. Probably we should consider checking Java8 code with jre8.
Thanks Tagir,
looks good.
CU
Andrey