diff --git a/src/org/rascalmpl/uri/URIResolverRegistry.java b/src/org/rascalmpl/uri/URIResolverRegistry.java index f82292a4389..258fc34dd9c 100644 --- a/src/org/rascalmpl/uri/URIResolverRegistry.java +++ b/src/org/rascalmpl/uri/URIResolverRegistry.java @@ -972,29 +972,30 @@ public void watch(ISourceLocation loc, boolean recursive, final Consumer newCallback = !resolved.equals(loc) ? + Consumer newCallback = !resolvedLoc.equals(loc) ? // we resolved logical resolvers in order to use native watchers as much as possible // for efficiency sake, but this breaks the logical URI abstraction. We have to undo // this renaming before we trigger the callback. changes -> { - ISourceLocation relative = URIUtil.relativize(resolved, changes.getLocation()); - ISourceLocation unresolved = URIUtil.getChildLocation(loc, relative.getPath()); + ISourceLocation relative = URIUtil.relativize(resolvedLoc, changes.getLocation()); + ISourceLocation unresolved = URIUtil.getChildLocation(finalLocCopy, relative.getPath()); callback.accept(ISourceLocationWatcher.makeChange(unresolved, changes.getChangeType(), changes.getType())); } : callback; - ISourceLocationWatcher watcher = watchers.getOrDefault(resolved.getScheme(), fallbackWatcher); + ISourceLocationWatcher watcher = watchers.getOrDefault(resolvedLoc.getScheme(), fallbackWatcher); if (watcher != null) { - watcher.watch(resolved, callback); + watcher.watch(resolvedLoc, callback); } else { - watching.computeIfAbsent(resolved, k -> ConcurrentHashMap.newKeySet()).add(newCallback); + watching.computeIfAbsent(resolvedLoc, k -> ConcurrentHashMap.newKeySet()).add(newCallback); } - if (isDirectory(resolved) && recursive) { - for (ISourceLocation elem : list(resolved)) { + if (isDirectory(resolvedLoc) && recursive) { + for (ISourceLocation elem : list(resolvedLoc)) { if (isDirectory(elem)) { try { watch(elem, recursive, newCallback);