Questions tagged [jsr305]

(Dormant JSR) Annotations for Software Defect Detection

JSR 305

34 questions
103
votes
5 answers

What is the status of JSR 305?

I have seen the question JSR305 vs. JSR308 (Java Type Anotations) - Which is going to be the standard? and I understand the difference between JSR 308 and JSR 305. I also understand that, at this time, 308 is slated for Java 7, and 305 is not, and…
Charlie Collins
  • 8,506
  • 4
  • 29
  • 41
33
votes
1 answer

JSR-305 annotations replacement for Java 9

So far we have been using the Findbugs JSR-305 annotations (com.google.code.findbugs:jsr305) and everything including tool support (Sonar, Eclipse, Findbugs, …) has been working fine. However it is our understanding that Jigsaw in Java 9 is going to…
25
votes
1 answer

How to indicate that member fields are @Nonnull by default?

My question is a follow-up to this one. In past versions of FindBugs, it was possible to use @DefaultAnnotation(Nonnull.class) or @DefaultAnnotationForFields(Nonnull.class) to indicate that all fields in a package should be treated as @Nonnull. In…
jqno
  • 13,931
  • 7
  • 52
  • 76
18
votes
3 answers

JSR305 vs. JSR308 (Java Type Anotations) - Which is going to be the standard?

There seem to be two different JSRs for annotations. JSR-305: Annotations for Software Defect Detection (additional resource) JSR-308: Annotations on Java Types (additional resource) Both seem to be oriented towards static code analysis. Do you…
ivan_ivanovich_ivanoff
  • 18,003
  • 24
  • 78
  • 100
14
votes
4 answers

@Nullable/@NotNull with IntelliJ IDEA, Maven & JSR 305

I really like the code inspection functionalities which are now able with either JSR 305 or Jetbrains' proprietary annotations for IntelliJ. Unfortunately both implementations (JSR 305 and Jetbrains') do not mix well: IntelliJ obviously only…
Thomas
  • 1,049
  • 9
  • 24
8
votes
2 answers

Is @ParametersAreNonnullByDefault applies to method return values too?

The documentation for @ParametersAreNonnullByDefault says, that: This annotation can be applied to a package, class or method to indicate that the method parameters in that element are nonnull by default unless ... I don't consider a method's…
Kohányi Róbert
  • 8,681
  • 3
  • 46
  • 74
7
votes
1 answer

Why do I need adding artifact JSR305 to use Guava 14+?

While looking for informations on stackoverflow, I have seen a question similar to mine, but with no real answer here. I need migrating my maven project from guava 11.0.2 to guava 14 or higher (I need RangeSet). I updated my maven pom with the…
Rémi Doolaeghe
  • 2,034
  • 3
  • 26
  • 45
6
votes
2 answers

Findbugs + JSR305: Possibility to specify default behavior?

Note: those annotations, I'm talking about, are specified by JSR305. I have the latest Findbugs (1.3.9) and it finds errors correctly when some field, annotated with @Nonnull, is assigned to null. But, in my project, the "non-null logic" is the…
ivan_ivanovich_ivanoff
  • 18,003
  • 24
  • 78
  • 100
5
votes
2 answers

@Nonnull with different IDEs - warn about unnecessary null checks

I'm working in an environment where developers use different IDEs - Eclipse, Netbeans and IntelliJ. I'm using the @Nonnull annotation (javax.annotation.Nonnull) to indicate that a method will never return null: @Nonnull public List getBars() { …
Lauri Harpf
  • 1,117
  • 8
  • 23
4
votes
4 answers

Is there a good Eclipse plugin for checking @Nonnull and @Nullable annotations?

The checking of the @Nonnull and @Nullable annotations in Eclipse is an early beta. The largest problem is that there it no knowing over the null behavior of the Java API. Are there any other plugins that are better currently?
Horcrux7
  • 21,867
  • 21
  • 85
  • 134
4
votes
0 answers

How do I apply null annotations to a Java method that is exposed in an API?

Say I have a class with an invariant that a certain instance variable is never null. I also want to use jsr305 null annotations correctly. The class is exposed as an API, so I cannot rely on the annotations to prevent nulls; I also need to check…
user2917747
  • 173
  • 6
4
votes
0 answers

Javadoc linking to split package

When using the javadoc tool (Which I do through the Maven Javadoc Plugin, not with javadoc directly), there is the -link option to link to external sources. The problem now is that my project makes use of JSR-305 annotations, and I have configured…
Kelvin Chung
  • 1,111
  • 10
  • 20
3
votes
1 answer

Automatically generating equals and hashCode in Eclipse that is aware of @NonNull annotations

Is there a way to configure Eclipse to automatically generate hashCode and equals with awareness of @NonNull annotations? Currently my Eclipse generates the code with unnecessary null checks, even on fields that are marked @NonNull. Note that…
polygenelubricants
  • 348,637
  • 121
  • 546
  • 611
3
votes
2 answers

@Nullable vs. Generics (Eclipse)

I want to bring a utility method to Java 8. The method named max is defined as follows: @SafeVarargs public static final > E max(final E... elements) { E result = null; // error for(final E e : elements) { …
llogiq
  • 11,855
  • 3
  • 36
  • 65
3
votes
1 answer

Findbugs using jsr305 annotations in eclipse is not finding bugs

I've been experimenting with the jsr 305 annotations for use with Findbugs, specifically the @CheckForNull annotation which would have avoided a bug I just found making it out to customers. I've added jsr305.jar and annotations.jar to my build path…
Robin
  • 2,578
  • 21
  • 29
1
2 3