Comments (4)
Original comment posted by [email protected] on 2013-02-11 at 09:33 PM
We added a check for @CheckReturnValue.
Consider adding support for this subset:
@CheckForNull
@Nonnegative
@Nonnull
@Nullable
@OverridingMethodsMustInvokeSuper
@ParametersAreNonnullByDefault
@ParametersAreNullableByDefault
@RegEx
@Syntax
Status: Accepted
Owner: [email protected]
Labels: Type-Enhancement, Priority-Low
from error-prone.
See also vaguely related #891, which proposes opening up null related annotations.
from error-prone.
FYI, there's an Error Prone plugin, NullAway, that covers the stuff I most care about (@Nullable
and @Nonnull
).
https://github.com/uber/NullAway/wiki/Error-Messages
It's a bit of a hassle to hook it up with Bazel; I have a sample repository here that shows how to do it. https://github.com/dfabulich/bazel-checker-framework-bug/
WORKSPACE:
maven_jar(
name='jsr305',
artifact='com.google.code.findbugs:jsr305:3.0.2',
)
maven_jar(
name="nullaway",
artifact="com.uber.nullaway:nullaway:0.3.2"
)
maven_jar(
name="guava",
artifact="com.google.guava:guava:22.0",
)
BUILD:
java_library(
name='x',
srcs=['X.java'],
deps=['@jsr305//jar'],
plugins=['nullaway'],
javacopts=[
'-Xep:NullAway:ERROR',
'-XepOpt:NullAway:AnnotatedPackages=com.example',
],
)
java_plugin(
name='nullaway',
deps=[
'@nullaway//jar',
'@guava//jar',
],
)
com.google.code.findbugs:jsr305
provides the javax.annotation.Nullable
and Nonnull
annotation classes. The dependency on Guava is unfortunate; I've filed a bug on that.
from error-prone.
Another alternative is the Checker Framework, if you want an exhaustive null-checking type system. (AFAIK, NullAway only checks certain common cases with regards to incorrect null
usage.)
from error-prone.
Related Issues (20)
- `@Immutable` does not recognize safe array handling HOT 3
- Error-prone patching cannot be used in bazel
- Crash with annotated nested types
- NPE with nested instanceof patterns
- [IllegalAccessError] An unhandled exception was thrown by the Error Prone static analysis plugin. HOT 2
- An unhandled exception was thrown by the Error Prone static analysis plugin. HOT 1
- SystemConsoleNull should consider the case where `System.console() == null` HOT 3
- StringCharset BugPattern summary is not helpful
- An unhandled exception was thrown by the Error Prone static analysis HOT 1
- Update JDK from 11 to 21 and errorprone breaks HOT 1
- ParameterName IndexOutOfBoundsException HOT 2
- An unhandled exception was thrown by the Error Prone static analysis plugin. NoSuchMethod error HOT 3
- 2.26.1: An unhandled exception was thrown by the Error Prone static analysis plugin. BugPattern: JUnitIncompatibleType HOT 1
- class com.sun.tools.javac.code.Type$ClassType cannot be cast to class com.sun.tools.javac.code.Type$ArrayType HOT 6
- `JUnitIncompatibleType` on 2.27.0 throws `ClassCastException` for `com.sun.tools.javac.code.Type$TypeVar` around `assertArrayEquals` HOT 1
- False alarm from ClassInitializationDeadlock for inner enum implementing outer interface with default method HOT 4
- [Feature Request] Add check warning against mocking record types HOT 1
- ObjectEqualsForPrimitives should not suggest to convert boxed equals on double or float values HOT 3
- Suggest to use `Double.compare` or `Float.compare` when ObjectEqualsForPrimitives is triggered on floating point primitives
- Patching no longer works for experimental checks like StatementSwitchToExpressionSwitch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from error-prone.