Inspection depending on two code points

Answered

In IntelliJ 2016.3 Ultimate (but I assume that it hits in any 2016 version).

I have a @FrameworkArtifact constructor that does no initialization (since it takes no parameters), but I want to ignore it in the InstanceVariableMayNotBeInitialized inspection.

Is there a way to annotate this?

 

Code example as follows:

@XmlAccessorType(XmlAccessType.FIELD)
public class PatientRole {
@XmlElement(name="id", required=true)
private HI7Id number;

// this is the delinquent
@FrameworkArtifact(framework = Framework.XML_PARSER_TOOL)
protected PatientRole() {}

// here everything is initialized just fine
public PatientRole(@Nonnull final String number) {
this.number= new HI7Id("1.2.276.0.76.4.8",number);
}
// more stuff contained, but no further constructors
}
class HI7Id {

public HI7Id(@Nonnull String root, @Nullable String extension) {
// more content
}
}

 

 

0
1 comment

You can only suppress it per usage, there is no way to exclude it from inspection by annotation. Request is welcome at https://youtrack.jetbrains.com/issues/IDEA.

0

Please sign in to leave a comment.