Is it possible to use Eclipse JDT static analysis for null annotations when compiling from the command line?

20 views Asked by At

Is it possible to use Eclipse's JDT static analysis for null annotations when compiling from the command line? I have a pre-annotated codebase and want to leverage the work that has already been done without having to launch an IDE just to examine the result.

I made a small test program:

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

public class Main {
    public static void main(String[] args) {
        @Nullable Integer a = test();
        
        // NullPointerException
        a.notify();
    }
    
    public static @NonNull Integer test() {
        return null;
    }
}

And compiled from the command line:

javac -cp org.eclipse.jdt.annotation-2.2.800.jar Main.java

However, no errors are reported.

Is it possible to use these annotations outside of the Eclipse environment?

0

There are 0 answers