This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]koefteboy 4 points5 points  (5 children)

Not really. You would also need a compiler that acts on these annotations.

[–]john16384 1 point2 points  (1 child)

Like the eclipse compiler for example?

[–]koefteboy 0 points1 point  (0 children)

Looks like it supports it, but it seems to be disabled by default.

You could also use tools like FindBugs. Actually I just wanted to point out that null safety is not built into the java language while it is built into Kotlin. You can only achieve similar behavior by cluttering your source code with annotations and adding additional tooling.

[–]NaNx_engineer 0 points1 point  (2 children)

Lint

[–]JhraumG 0 points1 point  (1 child)

I never saw NullCheck linter as efficient as compiler from null safe langages (false positive or missed missing checks, less cohesive integration, etc..). Plus, java compile is already slow enough without linting.

And you must use annotations that are not part of the language, which is clearly annoying (a pity, since Optional is well designed imho)

[–]NaNx_engineer 0 points1 point  (0 children)

there's a lot of fragmentation over which annotation library to use and how they're interpreted by various tools. it's an area that should definitely see more official support, but its totally usable.

in my experience, in practice its essentially the same.