When you develop a NetBeans platform application sometimes you like to refer to existing resource files like images.
Therefor you have to hard-code the path into your sources in a string literal. Normally you would notice a wrong path at runtime because of a FileNotFoundException – not very professional.
But wait! Use the
org.netbeans.api.annotations.common.StaticResource-annotation from the Common Annotations module (/
org.netbeans.api:org-netbeans-api-annotations-common) instead. Backed by an annotation processor NetBeans will check whether the path is correct at compile-time. This is pretty cool.
What do you get? NetBeans shows missing resources in the editor, in the “Action Items”-view and even the build will fail.