KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the simple code below for testing the FindBugs @NonNull annotation with Maven. I execute mvn clean install And it correctly fails to build because print(null) violates the non-null condition. You can set NonNull as default for all method parameters inside a class using the class annotation @DefaultAnnotation(NonNull.class) How can I set NonNull as default for all method parameters inside all classes under a given package (and sub-packages)? src/main/java/test/Hello.java package test; import edu.umd.cs.findbugs.annotations.NonNull; public class Hello { static public void print(@NonNull Object value) { System.out.println("value: " + value.toString()); } static public void main(String[] args) { if (args.length > 0) { print(args[0]); } else { print(null); } } } pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>hello</groupId> <artifactId>hello</artifactId> <version>1.0</version> <dependencies> <dependency> <groupId>net.sourceforge.findbugs</groupId> <artifactId>annotations</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>net.sourceforge.findbugs</groupId> <artifactId>jsr305</artifactId> <version>1.3.7</version> </dependency> </depende
Tags (comma-separated)
Save Edits
Cancel