Support for raw variables

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1736040 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java
index 19e33da..b5c1ec5 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java
@@ -76,6 +76,7 @@
     private boolean semanticJoin;
     private boolean unquote;
     private boolean asPattern;
+    private boolean rawVariable;
 
     public Expander(CharSequence text, Evaluate evaluate,
                     boolean inQuote,
@@ -113,6 +114,9 @@
     private Object expand() throws Exception
     {
         Object expanded = doExpand();
+        if (rawVariable) {
+            return expanded;
+        }
         Stream<Object> stream = expanded instanceof Collection
                 ? asCollection(expanded).stream()
                 : Stream.of(expanded);
@@ -849,6 +853,7 @@
                 {
                     String name = text.subSequence(start, index - 1).toString();
                     val = evaluate.get(name);
+                    rawVariable = true;
                 }
             }
         }
diff --git a/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java b/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
index a4b7a5f..2e2d3a9 100644
--- a/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
+++ b/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
@@ -38,7 +38,9 @@
 import org.osgi.framework.BundleContext;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
@@ -181,6 +183,16 @@
     }
 
     @Test
+    public void testRawVariable() throws Exception
+    {
+        vars.put("a1", Arrays.asList("a", 1));
+
+        assertSame(vars.get("a1"), expand("$a1"));
+        assertNotSame(vars.get("a1"), expand("${a1}"));
+        assertEquals(vars.get("a1"), expand("${a1}"));
+    }
+
+    @Test
     public void testSubscripts() throws Exception
     {
         Map<String, String> map = new LinkedHashMap<>();