(Dormant JSR) Annotations for Software Defect Detection
Questions tagged [jsr305]
34 questions
2
votes
1 answer
Is it possible to combine spring boot @Value with javax.validation.constraints?
I would like to validate values in application.properties.
I use @Value to inject and @NotBlank to validate the method parameter in a class annotated with @Configuration.
createSslContext(
…

ahoffer
- 6,347
- 4
- 39
- 68
2
votes
2 answers
Create a @Stub annotation that acts as a @Deprecated in Java
I'd like to create a @Stub, @Example or @Mock annotations in Java to indicate that some classes are just for testing. Also I like to make those classes as deprecated to discourage users of my library from using them. I like to make something similar…

Chris Suszyński
- 1,494
- 17
- 23
2
votes
0 answers
Eclipse custom @NonNull annotation ignored
I would like to use the "null analysis" feature of Eclipse but I would rather use the javax.annotation.Nonnull annotation than the org.eclipse.jdt.annotation.NonNull annotation. I can't seem to get Eclipse to recognize any custom annotations I…

takteek
- 7,020
- 2
- 39
- 70
2
votes
2 answers
Guava Optional and @NonNull annotation
I'm trying different ways of getting rid of NPEs in my code. I use nullness analysis in Eclipse and I'm quite fond of @NonNullByDefault. But today I run into a problem with guava's Optional:
private static Optional bar() {
Foo foobar = new…

Tarkis
- 21
- 3
2
votes
0 answers
Static analysis of Scala locking / synchronization code using JCIP / JSR-305 annotations
Is there any way for me to statically analyze Scala code for locking / synchronization issues using the JCIP or JSR-305 annotations (e.g. @GuardedBy).
Both FindBugs and IntelliJ IDEA have excellent support for these annotations when checking Java…

Josh Rosen
- 13,511
- 6
- 58
- 70
2
votes
2 answers
jsr305_annotations Folder inside apk file
I've had reports of problems with the installation of the apk.
I tried to extract the apk as a zip file and I found the folder
jsr305_annotations in the root APK
with inside
folder: v0_r47 -> file: V0_r47.gwt.xml
File: Jsr305_annotations.gwt.xml
I…

user1719863
- 787
- 1
- 8
- 13
1
vote
1 answer
Can I make runtime validation of method parameters based on jsr-305 annotations?
Although JSR-305 is about static analysis of code. Its' run-time counterpart isn't ready yet. Following my question I want to ask if there's a suitable annotation processor which could detect that method parameters are not correct based on…

Artem Oboturov
- 4,344
- 2
- 30
- 48
1
vote
1 answer
Why does Findbugs JSR305 break OSGi package export of javax.annotations in RedHat/JBoss Fuse 6.3.0?
We need FindBugs JSR305 as a dependency and we deploy it as a wrapped OSGi bundle to Fuse 6.3.0. At first it looks like everything is fine and the components are working well. But after a restart, many bundles that depend on javax.annoation API are…

Yannick
- 663
- 1
- 10
- 33
1
vote
0 answers
Can method return value nullability be inferred from the method argument nullability in JSR-305?
Suppose I have a method to parse a number and whose return value nullability contract should be inferred from its argument:
@...
public static Integer tryParse(@Nullable final String in, @... final Integer defaultValue) {
if ( in == null ) {
…

terrorrussia-keeps-killing
- 1,533
- 1
- 5
- 17
1
vote
0 answers
What's different from the Spring lang annotations and jsr305 meta-annotations?
For example, org.springframework.lang.NonNull and javax.annotation.Nonnull. Why Spring does repeat work? What does Spring have to do it?

Loop
- 11
- 3
1
vote
1 answer
NPE checked by StringUtils.isNotBlank still causing eclipse @NotNull warning
I am using @NotNull annotation,
as you can see I am using:
StringUtils.isNotBlank()
to check NP, but I have still Eclipse warning there. If I use
oldlink != null
it wont show warning.
Does anyone know what can be problem when using apache…

To Kra
- 3,344
- 3
- 38
- 45
1
vote
0 answers
FindBugs and Nonnegative annotation (jsr 305)
Has anyone got @Nonnegative to work with FindBugs, maybe FindBugs contrib ?
Which package do you use, javax.annotation ?
Any other tool to check it (apart of IntelliJ) ?

Christophe Roussy
- 16,299
- 4
- 85
- 85
0
votes
2 answers
What does interface annotated with jsr305 ThreadSafe mean?
@ThreadSafe
public interface ServerInterceptor {
...
}
I am developing a gRPC server.
I found that the interface ServerInterceptor is annotated with @ThreadSafe. I am confused about this annotation when I want to implement ServerInterceptor.…

gzc
- 8,180
- 8
- 42
- 62
0
votes
0 answers
Package-scope non-null annotation in Java for Kotlin (built by Gradle)
I'm trying to write a Java library that has a non-nullable API, and I'd like Kotlin to properly infer this non-nullability. I'm using JSR-305 annotations and its @TypeQualifierDefault to achieve the effect for the entire package, as per Kotlin's…

Tomasz Linkowski
- 4,386
- 23
- 38
0
votes
1 answer
JSR305 OSGi Exports brave
The brave core module has added exports for javax.annotation;version="[3.0.0,4)", this causing issue when deploying OSGi applications using brave in JBoss Fuse - as the System bundle already exports javax.annotation;version="1.0".
Wondering why…

Kamesh
- 115
- 11