RoyalTiger
RoyalTiger

Reputation: 541

@Introspected annotation is failing with spotbugs warning

I am trying to validate a bean. I am using Micronaut 3.6.0 version with Gradle. See the code below:

import io.micronaut.core.annotation.Introspected;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

    @Getter
    @Setter
    @Introspected
    public class Event {
    
        @NotNull
        private String id;
    
        public Event(@NotNull String id) {
            this.id = id;
        }
    }

Whenever I try to build the project, the spotbug warning comes and the build fails.

spotbugs 'com.github.spotbugs:spotbugs:4.7.3'

Error:

Bug type NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE (click for details)
In class com.souravtest.$Event$Introspection
In method com.souravtest.$Event$Introspection.instantiateInternal(Object[])
Parameter $L1
In <Unknown>

I tried suppressing the warning using @SuppressFBWarning("NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"), but this did not work either.

Any help would be appreciated.

Gradle configuration used:

dependencies {
    implementation("io.micronaut:micronaut-runtime")
    implementation("io.micronaut.validation:micronaut-validation")
    implementation("javax.validation:validation-api:2.0.1.Final") 
    implementation("org.hibernate.validator:hibernate-validator:6.1.5.Final") 
}

Upvotes: 0

Views: 44

Answers (0)

Related Questions