SLING-8896 - The URI Manipulation Filter should not interfere with data-sly-use parameters
diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/filter/URIManipulationFilter.java b/src/main/java/org/apache/sling/scripting/sightly/impl/filter/URIManipulationFilter.java
index 028d795..d7437aa 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/filter/URIManipulationFilter.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/filter/URIManipulationFilter.java
@@ -55,9 +55,7 @@
     private static final Set<ExpressionContext> APPLICABLE_CONTEXTS;
 
     static {
-        Set<ExpressionContext> applicableContexts = new HashSet<>(Arrays.asList(ExpressionContext.values()));
-        applicableContexts.remove(ExpressionContext.PLUGIN_DATA_SLY_TEMPLATE);
-        applicableContexts.remove(ExpressionContext.PLUGIN_DATA_SLY_CALL);
+        Set<ExpressionContext> applicableContexts = new HashSet<>(NON_PARAMETRIZABLE_CONTEXTS);
         applicableContexts.remove(ExpressionContext.PLUGIN_DATA_SLY_RESOURCE);
         applicableContexts.remove(ExpressionContext.PLUGIN_DATA_SLY_INCLUDE);
         APPLICABLE_CONTEXTS = Collections.unmodifiableSet(applicableContexts);
diff --git a/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyCompilerTest.java b/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyCompilerTest.java
index 6aff125..e144567 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyCompilerTest.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyCompilerTest.java
@@ -23,16 +23,20 @@
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.List;
-import java.util.function.Supplier;
 
 import org.apache.sling.scripting.sightly.compiler.CompilationResult;
 import org.apache.sling.scripting.sightly.compiler.CompilationUnit;
 import org.apache.sling.scripting.sightly.compiler.CompilerMessage;
 import org.apache.sling.scripting.sightly.compiler.SightlyCompiler;
+import org.apache.sling.scripting.sightly.compiler.commands.Command;
+import org.apache.sling.scripting.sightly.compiler.commands.VariableBinding;
+import org.apache.sling.scripting.sightly.compiler.expression.ExpressionNode;
+import org.apache.sling.scripting.sightly.compiler.expression.nodes.MapLiteral;
+import org.apache.sling.scripting.sightly.compiler.expression.nodes.RuntimeCall;
+import org.apache.sling.scripting.sightly.compiler.expression.nodes.StringConstant;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
 import static org.junit.Assert.assertEquals;
@@ -177,6 +181,33 @@
                 compileSource("<span data-sly-test=\"${properties}}\">if true</span>").getWarnings().size());
     }
 
+    @Test
+    public void testUriManipulationDataSlyUse() {
+        /*
+         * In the following expression 'path' should be a parameter for the 'org.example.Pojo' use object and not a uri manipulation
+         * option
+         */
+        CompilationResult compilationResult = compileSource("<span data-sly-use.object=\"${'org.example.Pojo' @ path='/a/b/c'}\"></span>");
+        assertEquals(0, compilationResult.getErrors().size());
+        assertEquals(0, compilationResult.getWarnings().size());
+        List<Command> commands = compilationResult.getCommandStream().getCommands();
+        assertEquals(2, commands.size());
+        Command firstCommand = commands.get(0);
+        assertTrue(firstCommand instanceof VariableBinding.Global);
+        VariableBinding.Global variableBinding = (VariableBinding.Global) firstCommand;
+        ExpressionNode node = variableBinding.getExpression();
+        assertTrue(node instanceof RuntimeCall);
+        RuntimeCall runtimeCall = (RuntimeCall) node;
+        assertEquals(RuntimeCall.USE, runtimeCall.getFunctionName());
+        List<ExpressionNode> arguments = runtimeCall.getArguments();
+        assertEquals(2, arguments.size());
+        ExpressionNode firstArgument = arguments.get(0);
+        assertTrue(firstArgument instanceof StringConstant);
+        assertEquals("org.example.Pojo", ((StringConstant) firstArgument).getText());
+        ExpressionNode secondArgument = arguments.get(1);
+        assertTrue(secondArgument instanceof MapLiteral);
+    }
+
     private CompilationResult compileFile(final String file) {
         InputStream stream = this.getClass().getResourceAsStream(file);
         final Reader reader = new InputStreamReader(stream);