Questions tagged [checker-framework]

The Checker Framework is a library that enhances Java’s type system in order to detect and prevent errors in Java programs.

The Checker Framework is a library that enhances Java’s type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

Homepage: http://checkerframework.org/

80 questions
19
votes
1 answer

Does '+' in an annotation name have some special meaning?

I was looking at the bytecode of the .jar file of the custom annotated jdk-8 in the central maven repository supplied by the Checker Framework. There I noticed some invalid Java Code in Object.class and Class.class files. When I loaded the jar in…
helix
  • 1,017
  • 3
  • 12
  • 30
12
votes
1 answer

Java scoping construct cannot be annotated with type-use

I want to annotate a fully qualified class name with @Nullable-annotation (from the Java Checker Framework), e.g.: class Demo { private transient @Nullable org.apache.lucene.search.Query cached_results; // ... } However this results in the…
Kasper van den Berg
  • 8,951
  • 4
  • 48
  • 70
8
votes
2 answers

How to suppress "unknown enum constant" warnings?

The Checkers Framework references java.lang.annotation.ElementType.TYPE_USE which was added in JDK8. When I use it under JDK7, I get the following warning: unknown enum constant java.lang.annotation.ElementType.TYPE_USE This is a reasonable warning,…
Gili
  • 86,244
  • 97
  • 390
  • 689
5
votes
2 answers

checker framework, is there any way to silence/disable type.anno.before.modifier warning?

I thought I'd give checker framework a go, but I'm getting a lot of this /Users/calebcushing/IdeaProjects/ppm/scaf/src/main/java/com/xenoterracide/scaf/Config.java:22: warning: [type.anno.before.modifier] write type annotation @NonNull() immediately…
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
5
votes
1 answer

"NonNull if the function returns non-null"?

Consider a method such as ConcurrentHashMap's compute method: public V compute( K key, BiFunction remappingFunction) I would like to annotate this for nullability checking with checker…
Andy Turner
  • 137,514
  • 11
  • 162
  • 243
5
votes
1 answer

Can Checker Framework be used with Error Prone?

Can the Checker Framework be used with Error Prone? As far as I can tell they fill overlapping purpose as compile time checking, but they don't do all the same things. I use gradle, but I doubt both plugins can be used at the same time (in fact…
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
5
votes
2 answers

@Retention of Java type checker annotations

The Java 8 type annotations (JSR 308) allow type checkers to perform static code analysis. For example, The Checker Framework can check for possible nullness via @NonNull annotations. Various projects define their own NonNull annotations, for…
MyKey_
  • 837
  • 1
  • 7
  • 22
5
votes
1 answer

Avoid 'uninitialized' errors on injected fields when using the Checker Framework

The Checker Framework's Nullness Checker generates an error when it encounters an uninitialised field. [ERROR] /home/glts/src/example/src/main/java/BookRepositoryImpl.java:[39,7] error: [initialization.fields.uninitialized] the constructor does not…
glts
  • 21,808
  • 12
  • 73
  • 94
4
votes
2 answers

Checker Framework argument.type.incompatible undesired positive

So I'm getting this error from the nullness checker > Task :compileJava /Users/calebcushing/IdeaProjects/ppm/scaf/src/main/java/com/xenoterracide/scaf/PebbleTemplateProcessor.java:94: error: [argument.type.incompatible] incompatible argument for…
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
4
votes
0 answers

How to get nullability of Java types using Kotlin reflection?

When I use Kotlin reflection to get nullability of Kotlin properties like val nullableString: String? I get correct information in isMarkedNullable property of KType. It also works "inside" types like val nullableList: List? where not only…
Vojta
  • 1,583
  • 17
  • 19
4
votes
1 answer

Checker Framework, -Xlint:all and JUnit

I'm trying to keep a project with a very clean and strict setup from the outset, including: Use of the Checker Framework. Enabling all compiler warnings and treat them as errors (-Xlint:all and -Werror). Use of JUnit. Here are the relevant parts…
Paulo
  • 757
  • 8
  • 18
4
votes
1 answer

Run Checker Framework with Bazel

Consider this github repository. https://github.com/dfabulich/bazel-checker-framework-bug It includes a sample X.java file that flagrantly violates the rules of the @Nonnull annotation. import javax.annotation.Nonnull; public class X { public…
Dan Fabulich
  • 37,506
  • 41
  • 139
  • 175
4
votes
1 answer

Using custom annotation processors alongside Checker Framework

I'm working on a multi module maven based project in which one of the modules contains a few annotation processors for the custom annotations used by other modules. When I add a dependency of annotation processor module to any other module, the…
Udith Gunaratna
  • 2,091
  • 1
  • 13
  • 17
3
votes
1 answer

NullnessChecker Error: java.lang.NoSuchFieldError: RELEASE

I can't build my code with the checker framework anymore. When I comment out the checker framework annotation processor, my code compiles fine, so the problem isn't with my code. With the framework, I get this error message: [ERROR]…
MiguelMunoz
  • 4,548
  • 3
  • 34
  • 51
3
votes
1 answer

How to use Checker Framework annotations with Findbugs?

I am migrating codebase to Guava 26.0-jre from 18.0. Static code checks are processed by Findbugs (3.0.0). It turns out that Guava migrated from JSR305 to Checker Framework. Therefore, existing code like…
Dawid Pura
  • 991
  • 9
  • 32
1
2 3 4 5 6