This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
If searchClasspath parameter of @StaticResource annotation is set to true, then the annotation allows any string to pass the check, including missing and invalid paths. This behavior happens in both NetBeans Platform 8.0.2 and 8.1beta. Examples of correct behavior (with serachClasspath defaulting to false): @StaticResource public static final String MISSING_FILE1 = "missing_file"; // compile time error: cannot find resource missing_file @StaticResource public static final String MISSING_FILE2 = "\\#!#!#:::feiuesgfafwaeadawdawdaw$$"; // compile time error: java.lang.IllegalArgumentException: Invalid relative name: \#!#!#:::feiuesgfafwaeadawdawdaw$$ Examples of incorrect behavior (with serachClasspath changed to true): @StaticResource(searchClasspath = true) public static final String MISSING_FILE1 = "missing_file"; // compiles without errors or warnings @StaticResource(searchClasspath = true) public static final String MISSING_FILE2 = "\\#!#!#:::feiuesgfafwaeadawdawdaw$$"; // compiles without errors or warnings System information: Product Version: NetBeans IDE 8.1 Beta (Build 201508041349) Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Current implementation (org.netbeans.api.annotations.common.proc.StaticResourceProcessor) assumes that as long as processingEnv.getFiler().getResource(...) does not throw any exception for at least one JavaFileManager.Location, than the given file path is valid: http://hg.netbeans.org/main/file/8f9e7a4227a5/api.annotations.common/src/org/netbeans/api/annotations/common/proc/StaticResourceProcessor.java#l97 Filer.getResource() documentation seems to imply that it would indeed throw exceptions if the given file was not valid: http://docs.oracle.com/javase/7/docs/api/javax/annotation/processing/Filer.html#getResource%28javax.tools.JavaFileManager.Location,%20java.lang.CharSequence,%20java.lang.CharSequence%29 However, current implementation demonstrably does not work correctly.
This issue has nothing to do with module-system.
Fixed in profiler-main changeset: 291365:d579e368aa64 user: Tomas Hurka <thurka@netbeans.org> date: Fri Sep 11 13:36:15 2015 +0200 summary: bugfix #255193, test for resource validity fixed
Integrated into 'main-silver', will be available in build *201509160002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/d579e368aa64 User: Tomas Hurka <thurka@netbeans.org> Log: bugfix #255193, test for resource validity fixed