Trac #143: use colon as separator character in agent parameters
diff --git a/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/CoverageTransformerTest.java b/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/CoverageTransformerTest.java
index 0acd70c..3b0ea83 100644
--- a/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/CoverageTransformerTest.java
+++ b/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/CoverageTransformerTest.java
@@ -78,14 +78,14 @@
 

 	@Test

 	public void testFilterIncludedClassPositive() {

-		options.setIncludes("org.jacoco.core.*|org.jacoco.agent.rt.*");

+		options.setIncludes("org.jacoco.core.*:org.jacoco.agent.rt.*");

 		CoverageTransformer t = createTransformer();

 		assertTrue(t.filter(classLoader, "org/jacoco/core/Foo"));

 	}

 

 	@Test

 	public void testFilterIncludedClassNegative() {

-		options.setIncludes("org.jacoco.core.*|org.jacoco.agent.rt.*");

+		options.setIncludes("org.jacoco.core.*:org.jacoco.agent.rt.*");

 		CoverageTransformer t = createTransformer();

 		assertFalse(t.filter(classLoader, "org/jacoco/report/Foo"));

 	}

diff --git a/org.jacoco.agent.rt/src/org/jacoco/agent/rt/CoverageTransformer.java b/org.jacoco.agent.rt/src/org/jacoco/agent/rt/CoverageTransformer.java
index 67df84b..963c770 100644
--- a/org.jacoco.agent.rt/src/org/jacoco/agent/rt/CoverageTransformer.java
+++ b/org.jacoco.agent.rt/src/org/jacoco/agent/rt/CoverageTransformer.java
@@ -49,9 +49,9 @@
 		this.instrumenter = new Instrumenter(runtime);

 		this.logger = logger;

 		// Class names will be reported in VM notation:

-		includes = new WildcardMatcher(toVMName(options.getIncludes()));

-		excludes = new WildcardMatcher(toVMName(options.getExcludes()));

-		exclClassloader = new WildcardMatcher(options.getExclClassloader());

+		includes = new WildcardMatcher(toWildcard(toVMName(options.getIncludes())));

+		excludes = new WildcardMatcher(toWildcard(toVMName(options.getExcludes())));

+		exclClassloader = new WildcardMatcher(toWildcard(options.getExclClassloader()));

 	}

 

 	public byte[] transform(ClassLoader loader, String classname,

@@ -95,6 +95,14 @@
 		!excludes.matches(classname);

 	}

 

+	private String toWildcard(String src) {

+		if (src.indexOf('|') != -1) {

+			final IllegalArgumentException ex = new IllegalArgumentException("Usage of '|' as a list separator for JaCoCo agent options is deprecated and will not work in future versions - use ':' instead.");

+			logger.logExeption(ex);

+		}

+		return src.replace(':', '|');

+	}

+

 	private static String toVMName(String srcName) {

 		return srcName.replace('.', '/');

 	}

diff --git a/org.jacoco.build/pom.xml b/org.jacoco.build/pom.xml
index 1faf4ef..922d7cc 100644
--- a/org.jacoco.build/pom.xml
+++ b/org.jacoco.build/pom.xml
@@ -132,9 +132,9 @@
     <!-- Actually this is a dirty hack, but for now it's appropriate until we don't have jacoco-maven-plugin -->
     <jvm.args></jvm.args>
     <agent.path>${basedir}/../org.jacoco.agent.rt/target/org.jacoco.agent.rt-${project.version}-all.jar</agent.path>
-    <agent.exclclassloader>sun.reflect.DelegatingClassLoader|org.jacoco.core.test.TargetLoader</agent.exclclassloader>
+    <agent.exclclassloader>sun.reflect.DelegatingClassLoader:org.jacoco.core.test.TargetLoader</agent.exclclassloader>
     <agent.opts>destfile=${project.build.directory}/jacoco.exec,sessionid=${project.artifactId},exclclassloader=${agent.exclclassloader}</agent.opts>
-    <argLine>&quot;-javaagent:${agent.path}=${agent.opts} ${jvm.args}&quot;</argLine>
+    <argLine>-javaagent:${agent.path}=${agent.opts} ${jvm.args}</argLine>
     <tycho.testArgLine>${argLine}</tycho.testArgLine>
 
     <!-- Plugins versions -->
diff --git a/org.jacoco.doc/docroot/doc/agent.html b/org.jacoco.doc/docroot/doc/agent.html
index 7d110ca..fad164b 100644
--- a/org.jacoco.doc/docroot/doc/agent.html
+++ b/org.jacoco.doc/docroot/doc/agent.html
@@ -81,7 +81,7 @@
     <tr>

       <td><code>includes</code></td>

       <td>A list of class names that should be included in execution analysis.

-          The list entries are separated by a vertical bar (<code>|</code>) and

+          The list entries are separated by a colon (<code>:</code>) and

           may use wildcard characters (<code>*</code> and <code>?</code>).

           Except for performance optimization or technical corner cases this

           option is normally not required. 

@@ -91,7 +91,7 @@
     <tr>

       <td><code>excludes</code></td>

       <td>A list of class names that should be excluded from execution analysis.

-          The list entries are separated by a vertical bar (<code>|</code>) and

+          The list entries are separated by a colon (<code>:</code>) and

           may use wildcard characters (<code>*</code> and <code>?</code>).

           Except for performance optimization or technical corner cases this

           option is normally not required. 

@@ -101,8 +101,8 @@
     <tr>

       <td><code>exclclassloader</code></td>

       <td>A list of class loader names that should be excluded from execution

-          analysis. The list entries are separated by a vertical bar

-          (<code>|</code>) and may use wildcard characters (<code>*</code> and

+          analysis. The list entries are separated by a colon

+          (<code>:</code>) and may use wildcard characters (<code>*</code> and

           <code>?</code>). This option might be required in case of special

           frameworks that conflict with JaCoCo code instrumentation, in

           particular class loaders that do not have access to the Java runtime

diff --git a/org.jacoco.doc/docroot/doc/ant.html b/org.jacoco.doc/docroot/doc/ant.html
index 6152a45..8dd1571 100644
--- a/org.jacoco.doc/docroot/doc/ant.html
+++ b/org.jacoco.doc/docroot/doc/ant.html
@@ -166,7 +166,7 @@
     <tr>

       <td><code>includes</code></td>

       <td>A list of class names that should be included in execution analysis.

-          The list entries are separated by a vertical bar (<code>|</code>) and

+          The list entries are separated by a colon (<code>:</code>) and

           may use wildcard characters (<code>*</code> and <code>?</code>).

           Except for performance optimization or technical corner cases this

           option is normally not required. 

@@ -176,7 +176,7 @@
     <tr>

       <td><code>excludes</code></td>

       <td>A list of class names that should be excluded from execution analysis.

-          The list entries are separated by a vertical bar (<code>|</code>) and

+          The list entries are separated by a colon (<code>:</code>) and

           may use wildcard characters (<code>*</code> and <code>?</code>).

           Except for performance optimization or technical corner cases this

           option is normally not required. 

@@ -186,8 +186,8 @@
     <tr>

       <td><code>exclclassloader</code></td>

       <td>A list of class loader names, that should be excluded from execution

-          analysis. The list entries are separated by a vertical bar

-          (<code>|</code>) and may use wildcard characters (<code>*</code> and

+          analysis. The list entries are separated by a colon

+          (<code>:</code>) and may use wildcard characters (<code>*</code> and

           <code>?</code>). This option might be required in case of special

           frameworks that conflict with JaCoCo code instrumentation, in

           particular class loaders that do not have access to the Java runtime

diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html
index 14d49f2..339c0fe 100644
--- a/org.jacoco.doc/docroot/doc/changes.html
+++ b/org.jacoco.doc/docroot/doc/changes.html
@@ -36,6 +36,7 @@
 <h3>API Changes</h3>

 <ul>

   <li>Simplified reporting API (Trac #53).</li>

+  <li>Use colon as separator character in agent parameters (Trac #143).</li>

 </ul>

 

 <h2>Release 0.5.0 (2011/01/19)</h2>