Open Rohanraj123 opened 1 week ago
I'm sorry you are having trouble. Can you please provide a simpler example that does not depend on a dozen changes across 5 files? For example, can you provide a standalone example, to verify that the problem has nothing to do with your build system?
Thanks!
@mernst These are the results i found when I actually configured checker framework in one of the demo project.
It says Unsupported Command line option : Alint=trustArrayLenZero I would be favour if you could help us out configuring checker correctly if there is something wrong.
I also pushed it to github, check it out if you want : Here
@mernst, please let us know if we need to provide more details or something.
trustArrayLenZero
is only a lint option for the Nullness Checker. You are passing it to the other checkers listed in the pom file. To just pass it to the Nullness Checker use -ANullnessChecker_lint=trustArrayLenZero
.
Thanks for the help, it works !
@smillst Even after putting this -ANullnessChecker_lint=trustArrayLenZero
command line . It only recoganises the annotation when placed like this :
private static final Configuration @ArrayLen(0) [] EMPTY_CONFIGURATION_ARRAY =
new Configuration[0];
This is a not a good place to put your annotation, Also Plexus-component-metadata
doesnt generate the metadata when annotation placed here . Reference
When I place it like this ;
private static final @ArrayLen(0) Configuration[] EMPTY_CONFIGURATION_ARRAY = new Configuration[0];
It still doesnt recoganises the annotation .
@smillst Even after putting this
-ANullnessChecker_lint=trustArrayLenZero
command line . It only recoganises the annotation when placed like this :private static final Configuration @ArrayLen(0) [] EMPTY_CONFIGURATION_ARRAY = new Configuration[0];
This is a not a good place to put your annotation,
This is the expected place to put the array annotations. Here's the explanation: https://checkerframework.org/manual/#faq-array-syntax-meaning.
Also
Plexus-component-metadata
doesnt generate the metadata when annotation placed here .
Because placing annotation before []
is legal java syntax, that sounds like a bug in Plexus-component-metadata
. I'm not familiar with that tool.
-Alint=trustArrayLenZero command line option is suggested to resolve the errors created by CF for
toArray()
method. ReferenceWe have tried to resolve the error : https://github.com/checkstyle/checkstyle/blob/b16e96a757ccee5be66fabb8e666823ca3cb558a/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml#L154-L163
created due to
toArray()
method. We tried to use@ArrayLen()
annotation in Checkstyle, but even after adding the command line option in pom.xml file, It either does'nt recoganises the@ArrayLen()
or not works correctly.Link to the PR
Passed the command in
<CompilerArguments>
like this :<Alint>trustArrayZeroLen</Alint>