Open MartinWitt opened 1 year ago
I am interested in this proposal. If we adopt jspecify, should we start working with version 0.3 instead of waiting for version 1.0?
We start with 0.3 and can update it later. The goal is to start annotating spoon and waiting for the 1.0 release can take years. A good starting point are methods with null documented in their javadoc for return values.
A noteworthy alternative is using https://www.jetbrains.com/help/idea/annotating-source-code.html. These annotations are at least stable and do the same. But there could be some future where everyone uses jspecify. And the qodana rule for this is: NullableProblems
.
A good starting point are methods with null documented in their javadoc for return values.
I will see what I can do about this.
I looked for the word "null" in @return
tags in Javadoc of the spoon-core
code.
Here are the counts for each package.
We may be able to start from these.
package | count |
---|---|
spoon | 1 |
spoon.compiler | 1 |
spoon.metamodel | 3 |
spoon.pattern.internal | 2 |
spoon.pattern.internal.matcher | 3 |
spoon.pattern.internal.node | 1 |
spoon.pattern.internal.parameter | 2 |
spoon.reflect.code | 3 |
spoon.reflect.declaration | 12 |
spoon.reflect.factory | 7 |
spoon.reflect.path | 1 |
spoon.reflect.reference | 8 |
spoon.reflect.visitor | 5 |
spoon.support.compiler | 1 |
spoon.support.compiler.jdt | 4 |
spoon.support.modelobs | 1 |
spoon.support.reflect.eval | 1 |
spoon.support.reflect.reference | 1 |
spoon.support.sniper.internal | 3 |
spoon.support.util | 2 |
spoon.support.util.internal | 1 |
spoon.support.visitor | 3 |
spoon.support.visitor.java | 2 |
Yes, this is a good starting point. 👍
Create a task list to add @Nullable
annotations to the classes under each package.
As I mentioned in #5424 , JavaReflectionTreeBuilderTest
fails when @Nullable
is applied to classes under some specific packages. (like spoon.reflect.code
, spoon.reflect.declaration
).
Can we remove @Nullable
and @NonNull
from the target of the test? Since these are TYPE_USE
annotations, so JavaReflectionTreeBuilder
does not build them.
Currently, spoon has non
@Nullable
annotation and we only document nullablility in the Javadoc. Why don't we adopt https://jspecify.dev/docs/start-here and migrate over the time to an annotated library? An alternative is@Contract
from JB, but these are only supported in IJ and are way harder to write.