Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-dev] Null analysis in practice

Hi devs,

I am trying to start with null analysis on an eclipse project which
raised some questions:

1) How to add the dependency to o.e.jdt.annotation

As far as I understand how this works the annotations are required at
compile time, but not at runtime. Therefore I do not want to introduce
a hard dependency to the o.e.jdt.annotation plugin.

Currently I add an optional package dependency to "o.e.jdt.annotation".
Is this a valid approach or what is the intended way?


2) For a smooth integration I chose to add @NonNullByDefault on a class
by class basis, allowing to have small changesets until the code is
ready to set this on the package level.

Once my code compiles, is there anything adopters of my plugins &
classes need to take care of? Will the annotation be considered as an
interface change? Any runtime implications?


3) With @NonNull set for method parameters I do get dead
code/unnecessary null check warnings.

As these checks are done at compile time, adopters can still set
parameters to null when they call a library method. So my assumption
would be that these kind of warnings should be ignored for my project
type. Correct?

thanks for your clarifications
Christian



Back to the top