File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/main/java/engineering/swat/watch/impl/jdk Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,17 @@ public class JDKFileWatch extends JDKBaseWatch {
5151 public JDKFileWatch (Path file , Executor exec , Consumer <WatchEvent > eventHandler ) {
5252 super (file , exec , eventHandler );
5353
54- this .parent = path .getParent ();
55- this .fileName = path .getFileName ();
54+ // Use local variables to check null before field assignments (Checker
55+ // Framework doesn't like it the other way around)
56+ var parent = path .getParent ();
57+ var fileName = path .getFileName ();
5658 if (parent == null || fileName == null ) {
5759 throw new IllegalArgumentException ("The root path is not a valid path for a file watch" );
5860 }
59-
6061 assert !parent .equals (path );
62+
63+ this .parent = parent ;
64+ this .fileName = fileName ;
6165 }
6266
6367 private void filter (WatchEvent event ) {
You can’t perform that action at this time.
0 commit comments