aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMirko Friedenhagen <mfriedenhagen@gmail.com>2013-12-22 21:03:03 +0100
committerMirko Friedenhagen <mfriedenhagen@gmail.com>2013-12-22 21:03:03 +0100
commit78f2d42aa6b33a607e1d0f25391324cb9b06a5d5 (patch)
tree8e2bb551849e5e86e29d80bc683d917dcfed0c74
parentada287818cc82e359dfdae77a3bb45a82ecee533 (diff)
parent8426630ead77abfa3c110581dea4d43dda331430 (diff)
downloadjacoco-78f2d42aa6b33a607e1d0f25391324cb9b06a5d5.tar.gz
Merge origin/master
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java82
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java115
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/AgentITMojo.java16
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/AgentMojo.java3
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/ReportITMojo.java43
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java16
-rw-r--r--org.jacoco.build/pom.xml25
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/flow/MethodProbesAdapterTest.java5
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/instr/ClassInstrumenterTest.java6
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/instr/FrameTrackerTest.java3
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java3
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java29
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/ExplicitInitialFrameTest.java40
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java19
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target11.java33
-rw-r--r--org.jacoco.core/src/org/jacoco/core/JaCoCo.java5
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java3
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java4
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java3
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java3
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java4
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java4
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/FrameTracker.java3
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java3
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java3
-rw-r--r--org.jacoco.doc/docroot/doc/changes.html1
-rw-r--r--org.jacoco.doc/pom.xml10
27 files changed, 318 insertions, 166 deletions
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java
index bcc1de73..3c539f36 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java
@@ -14,52 +14,53 @@ package org.jacoco.maven;
import java.io.File;
import java.util.Map;
import java.util.Properties;
+
import org.apache.maven.artifact.Artifact;
import org.codehaus.plexus.util.StringUtils;
import org.jacoco.core.runtime.AgentOptions;
/**
- *
- * @author Mirko Friedenhagen
+ * Base class for preparing a property pointing to the JaCoCo runtime agent that
+ * can be passed as a VM argument to the application under test.
*/
public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
/**
* Name of the JaCoCo Agent artifact.
*/
- protected static final String AGENT_ARTIFACT_NAME = "org.jacoco:org.jacoco.agent";
+ static final String AGENT_ARTIFACT_NAME = "org.jacoco:org.jacoco.agent";
/**
* Name of the property used in maven-osgi-test-plugin.
*/
- protected static final String TYCHO_ARG_LINE = "tycho.testArgLine";
+ static final String TYCHO_ARG_LINE = "tycho.testArgLine";
/**
* Name of the property used in maven-surefire-plugin.
*/
- protected static final String SUREFIRE_ARG_LINE = "argLine";
+ static final String SUREFIRE_ARG_LINE = "argLine";
/**
* Map of plugin artifacts.
- *
+ *
* @parameter expression="${plugin.artifactMap}"
* @required
* @readonly
*/
- protected Map<String, Artifact> pluginArtifactMap;
+ Map<String, Artifact> pluginArtifactMap;
/**
* Allows to specify property which will contains settings for JaCoCo Agent.
* If not specified, then "argLine" would be used for "jar" packaging and
* "tycho.testArgLine" for "eclipse-test-plugin".
- *
+ *
* @parameter expression="${jacoco.propertyName}"
*/
- protected String propertyName;
+ String propertyName;
/**
* If set to true and the execution data file already exists, coverage data
* is appended to the existing file. If set to false, an existing execution
* data file will be replaced.
- *
+ *
* @parameter expression="${jacoco.append}"
*/
- protected Boolean append;
+ Boolean append;
/**
* A list of class loader names, that should be excluded from execution
* analysis. The list entries are separated by a colon (:) and may use
@@ -67,28 +68,27 @@ public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
* special frameworks that conflict with JaCoCo code instrumentation, in
* particular class loaders that do not have access to the Java runtime
* classes.
- *
+ *
* @parameter expression="${jacoco.exclClassLoaders}"
*/
- protected String exclClassLoaders;
+ String exclClassLoaders;
/**
* A session identifier that is written with the execution data. Without
* this parameter a random identifier is created by the agent.
- *
+ *
* @parameter expression="${jacoco.sessionId}"
*/
- protected String sessionId;
+ String sessionId;
/**
* If set to true coverage data will be written on VM shutdown.
- *
+ *
* @parameter expression="${jacoco.dumpOnExit}"
*/
- protected Boolean dumpOnExit;
+ Boolean dumpOnExit;
/**
* Output method to use for writing coverage data. Valid options are:
* <ul>
- * <li>file: At VM termination execution data is written to the file
- * specified in the {@link #destfile}.</li>
+ * <li>file: At VM termination execution data is written to a file.</li>
* <li>tcpserver: The agent listens for incoming connections on the TCP port
* specified by the {@link #address} and {@link #port}. Execution data is
* written to this TCP connection.</li>
@@ -97,42 +97,42 @@ public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
* TCP connection.</li>
* <li>none: Do not produce any output.</li>
* </ul>
- *
+ *
* @parameter expression="${jacoco.output}"
*/
- protected String output;
+ String output;
/**
* IP address or hostname to bind to when the output method is tcpserver or
* connect to when the output method is tcpclient. In tcpserver mode the
* value "*" causes the agent to accept connections on any local address.
- *
+ *
* @parameter expression="${jacoco.address}"
*/
- protected String address;
+ String address;
/**
* Port to bind to when the output method is tcpserver or connect to when
* the output method is tcpclient. In tcpserver mode the port must be
* available, which means that if multiple JaCoCo agents should run on the
* same machine, different ports have to be specified.
- *
+ *
* @parameter expression="${jacoco.port}"
*/
- protected Integer port;
+ Integer port;
/**
* If a directory is specified for this parameter the JaCoCo agent dumps all
* class files it processes to the given location. This can be useful for
* debugging purposes or in case of dynamically created classes for example
* when scripting engines are used.
- *
+ *
* @parameter expression="${jacoco.classDumpDir}"
*/
- protected File classDumpDir;
+ File classDumpDir;
/**
* If set to true the agent exposes functionality via JMX.
- *
+ *
* @parameter expression="${jacoco.jmx}"
*/
- protected Boolean jmx;
+ Boolean jmx;
@Override
public void executeMojo() {
@@ -145,26 +145,26 @@ public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
projectProperties.setProperty(name, newValue);
}
- protected File getAgentJarFile() {
- final Artifact jacocoAgentArtifact = pluginArtifactMap.get(
- AGENT_ARTIFACT_NAME);
+ File getAgentJarFile() {
+ final Artifact jacocoAgentArtifact = pluginArtifactMap
+ .get(AGENT_ARTIFACT_NAME);
return jacocoAgentArtifact.getFile();
}
- protected AgentOptions createAgentOptions() {
+ AgentOptions createAgentOptions() {
final AgentOptions agentOptions = new AgentOptions();
agentOptions.setDestfile(getDestFile().getAbsolutePath());
if (append != null) {
agentOptions.setAppend(append.booleanValue());
}
if (getIncludes() != null && !getIncludes().isEmpty()) {
- final String agentIncludes = StringUtils.join(
- getIncludes().iterator(), ":");
+ final String agentIncludes = StringUtils.join(getIncludes()
+ .iterator(), ":");
agentOptions.setIncludes(agentIncludes);
}
if (getExcludes() != null && !getExcludes().isEmpty()) {
- final String agentExcludes = StringUtils.join(
- getExcludes().iterator(), ":");
+ final String agentExcludes = StringUtils.join(getExcludes()
+ .iterator(), ":");
agentOptions.setExcludes(agentExcludes);
}
if (exclClassLoaders != null) {
@@ -194,7 +194,7 @@ public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
return agentOptions;
}
- protected String getEffectivePropertyName() {
+ String getEffectivePropertyName() {
if (isPropertyNameSpecified()) {
return propertyName;
}
@@ -204,17 +204,17 @@ public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
return SUREFIRE_ARG_LINE;
}
- protected boolean isPropertyNameSpecified() {
+ boolean isPropertyNameSpecified() {
return propertyName != null && !"".equals(propertyName);
}
- protected boolean isEclipseTestPluginPackaging() {
+ boolean isEclipseTestPluginPackaging() {
return "eclipse-test-plugin".equals(getProject().getPackaging());
}
/**
* @return the destFile
*/
- protected abstract File getDestFile();
+ abstract File getDestFile();
}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java
index df2db407..979d7fa1 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java
@@ -20,6 +20,7 @@ import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+
import org.apache.maven.doxia.siterenderer.Renderer;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
@@ -27,9 +28,9 @@ import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.jacoco.core.analysis.IBundleCoverage;
import org.jacoco.core.analysis.ICoverageNode;
-import org.jacoco.core.tools.ExecFileLoader;
import org.jacoco.core.data.ExecutionDataStore;
import org.jacoco.core.data.SessionInfoStore;
+import org.jacoco.core.tools.ExecFileLoader;
import org.jacoco.report.FileMultiReportOutput;
import org.jacoco.report.IReportGroupVisitor;
import org.jacoco.report.IReportVisitor;
@@ -40,60 +41,60 @@ import org.jacoco.report.html.HTMLFormatter;
import org.jacoco.report.xml.XMLFormatter;
/**
- *
- * @author Mirko Friedenhagen
+ * Base class for creating a code coverage report for tests of a single project
+ * in multiple formats (HTML, XML, and CSV).
*/
public abstract class AbstractReportMojo extends AbstractMavenReport {
/**
* Encoding of the generated reports.
- *
+ *
* @parameter expression="${project.reporting.outputEncoding}"
- * default-value="UTF-8"
+ * default-value="UTF-8"
*/
- protected String outputEncoding;
+ String outputEncoding;
/**
* Encoding of the source files.
- *
+ *
* @parameter expression="${project.build.sourceEncoding}"
- * default-value="UTF-8"
+ * default-value="UTF-8"
*/
- protected String sourceEncoding;
+ String sourceEncoding;
/**
* A list of class files to include in the report. May use wildcard
* characters (* and ?). When not specified everything will be included.
- *
+ *
* @parameter
*/
- protected List<String> includes;
+ List<String> includes;
/**
* A list of class files to exclude from the report. May use wildcard
* characters (* and ?). When not specified nothing will be excluded.
- *
+ *
* @parameter
*/
- protected List<String> excludes;
+ List<String> excludes;
/**
* Flag used to suppress execution.
- *
+ *
* @parameter expression="${jacoco.skip}" default-value="false"
*/
- protected boolean skip;
+ boolean skip;
/**
* Maven project.
- *
+ *
* @parameter expression="${project}"
* @readonly
*/
- protected MavenProject project;
+ MavenProject project;
/**
* Doxia Site Renderer.
- *
+ *
* @component
*/
- protected Renderer siteRenderer;
- protected SessionInfoStore sessionInfoStore;
- protected ExecutionDataStore executionDataStore;
+ Renderer siteRenderer;
+ SessionInfoStore sessionInfoStore;
+ ExecutionDataStore executionDataStore;
public abstract String getOutputName();
@@ -109,9 +110,6 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
}
@Override
- protected abstract String getOutputDirectory();
-
- @Override
protected MavenProject getProject() {
return project;
}
@@ -123,24 +121,25 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
/**
* Returns the list of class files to include in the report.
- *
+ *
* @return class files to include, may contain wildcard characters
*/
- protected List<String> getIncludes() {
+ List<String> getIncludes() {
return includes;
}
/**
* Returns the list of class files to exclude from the report.
- *
+ *
* @return class files to exclude, may contain wildcard characters
*/
- protected List<String> getExcludes() {
+ List<String> getExcludes() {
return excludes;
}
@Override
- public abstract void setReportOutputDirectory(final File reportOutputDirectory);
+ public abstract void setReportOutputDirectory(
+ final File reportOutputDirectory);
@Override
public boolean canGenerateReport() {
@@ -151,15 +150,16 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
}
if (!getDataFile().exists()) {
getLog().info(
- "Skipping JaCoCo execution due to missing execution data file:" +
- getDataFile());
+ "Skipping JaCoCo execution due to missing execution data file:"
+ + getDataFile());
return false;
}
- final File classesDirectory = new File(getProject().getBuild().getOutputDirectory());
+ final File classesDirectory = new File(getProject().getBuild()
+ .getOutputDirectory());
if (!classesDirectory.exists()) {
getLog().info(
- "Skipping JaCoCo execution due to missing classes directory:" +
- classesDirectory);
+ "Skipping JaCoCo execution due to missing classes directory:"
+ + classesDirectory);
return false;
}
return true;
@@ -177,13 +177,14 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
try {
executeReport(Locale.getDefault());
} catch (final MavenReportException e) {
- throw new MojoExecutionException("An error has occurred in " +
- getName(Locale.ENGLISH) + " report generation.", e);
+ throw new MojoExecutionException("An error has occurred in "
+ + getName(Locale.ENGLISH) + " report generation.", e);
}
}
@Override
- protected void executeReport(final Locale locale) throws MavenReportException {
+ protected void executeReport(final Locale locale)
+ throws MavenReportException {
loadExecutionData();
try {
final IReportVisitor visitor = createVisitor(locale);
@@ -192,24 +193,25 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
createReport(visitor);
visitor.visitEnd();
} catch (final IOException e) {
- throw new MavenReportException("Error while creating report: " +
- e.getMessage(), e);
+ throw new MavenReportException("Error while creating report: "
+ + e.getMessage(), e);
}
}
- protected void loadExecutionData() throws MavenReportException {
+ void loadExecutionData() throws MavenReportException {
final ExecFileLoader loader = new ExecFileLoader();
try {
loader.load(getDataFile());
} catch (final IOException e) {
- throw new MavenReportException("Unable to read execution data file " +
- getDataFile() + ": " + e.getMessage(), e);
+ throw new MavenReportException(
+ "Unable to read execution data file " + getDataFile()
+ + ": " + e.getMessage(), e);
}
sessionInfoStore = loader.getSessionInfoStore();
executionDataStore = loader.getExecutionDataStore();
}
- protected void createReport(final IReportGroupVisitor visitor) throws IOException {
+ void createReport(final IReportGroupVisitor visitor) throws IOException {
final FileFilter fileFilter = new FileFilter(this.getIncludes(),
this.getExcludes());
final BundleCreator creator = new BundleCreator(this.getProject(),
@@ -221,33 +223,34 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
visitor.visitBundle(bundle, locator);
}
- protected void checkForMissingDebugInformation(final ICoverageNode node) {
+ void checkForMissingDebugInformation(final ICoverageNode node) {
if (node.getClassCounter().getTotalCount() > 0
&& node.getLineCounter().getTotalCount() == 0) {
- getLog().warn("To enable source code annotation class files have to be compiled with debug information.");
+ getLog().warn(
+ "To enable source code annotation class files have to be compiled with debug information.");
}
}
- protected IReportVisitor createVisitor(final Locale locale) throws IOException {
+ IReportVisitor createVisitor(final Locale locale) throws IOException {
final List<IReportVisitor> visitors = new ArrayList<IReportVisitor>();
getOutputDirectoryFile().mkdirs();
final XMLFormatter xmlFormatter = new XMLFormatter();
xmlFormatter.setOutputEncoding(outputEncoding);
- visitors.add(xmlFormatter.createVisitor(new FileOutputStream(
- new File(getOutputDirectoryFile(), "jacoco.xml"))));
+ visitors.add(xmlFormatter.createVisitor(new FileOutputStream(new File(
+ getOutputDirectoryFile(), "jacoco.xml"))));
final CSVFormatter csvFormatter = new CSVFormatter();
csvFormatter.setOutputEncoding(outputEncoding);
- visitors.add(csvFormatter.createVisitor(new FileOutputStream(
- new File(getOutputDirectoryFile(), "jacoco.csv"))));
+ visitors.add(csvFormatter.createVisitor(new FileOutputStream(new File(
+ getOutputDirectoryFile(), "jacoco.csv"))));
final HTMLFormatter htmlFormatter = new HTMLFormatter();
htmlFormatter.setOutputEncoding(outputEncoding);
htmlFormatter.setLocale(locale);
- visitors.add(htmlFormatter.createVisitor(
- new FileMultiReportOutput(getOutputDirectoryFile())));
+ visitors.add(htmlFormatter.createVisitor(new FileMultiReportOutput(
+ getOutputDirectoryFile())));
return new MultiReportVisitor(visitors);
}
- protected File resolvePath(final String path) {
+ File resolvePath(final String path) {
File file = new File(path);
if (!file.isAbsolute()) {
file = new File(getProject().getBasedir(), path);
@@ -255,7 +258,7 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
return file;
}
- protected List<File> getCompileSourceRoots() {
+ List<File> getCompileSourceRoots() {
final List<File> result = new ArrayList<File>();
for (final Object path : getProject().getCompileSourceRoots()) {
result.add(resolvePath((String) path));
@@ -297,8 +300,8 @@ public abstract class AbstractReportMojo extends AbstractMavenReport {
}
}
- abstract protected File getDataFile();
+ abstract File getDataFile();
- abstract protected File getOutputDirectoryFile();
+ abstract File getOutputDirectoryFile();
}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/AgentITMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/AgentITMojo.java
index b62e0885..84133000 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/AgentITMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/AgentITMojo.java
@@ -15,14 +15,17 @@ package org.jacoco.maven;
import java.io.File;
/**
- * Prepares a property pointing to the JaCoCo runtime agent that can be passed as a VM argument to the application under test for
- * integration tests. Depending on the project packaging type by default a property with the following name is set:
+ * Prepares a property pointing to the JaCoCo runtime agent that can be passed
+ * as a VM argument to the application under test for integration tests.
+ * Depending on the project packaging type by default a property with the
+ * following name is set:
* <ul>
* <li>tycho.testArgLine for packaging type eclipse-test-plugin and</li>
* <li>argLine otherwise.</li>
* </ul>
- * Resulting coverage information is collected during execution and by default written to a file when the process terminates.
- *
+ * Resulting coverage information is collected during execution and by default
+ * written to a file when the process terminates.
+ *
* @phase pre-integration-test
* @goal prepare-agent-integration
* @requiresProject true
@@ -34,7 +37,7 @@ public class AgentITMojo extends AbstractAgentMojo {
/**
* Path to the output file for execution data.
- *
+ *
* @parameter expression="${jacoco.destFile}"
* default-value="${project.build.directory}/jacoco-it.exec"
*/
@@ -43,7 +46,8 @@ public class AgentITMojo extends AbstractAgentMojo {
/**
* @return the destFile
*/
- protected File getDestFile() {
+ @Override
+ File getDestFile() {
return destFile;
}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/AgentMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/AgentMojo.java
index 0ba0428a..659ee9e4 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/AgentMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/AgentMojo.java
@@ -60,7 +60,8 @@ public class AgentMojo extends AbstractAgentMojo {
/**
* @return the destFile
*/
- protected File getDestFile() {
+ @Override
+ File getDestFile() {
return destFile;
}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/ReportITMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/ReportITMojo.java
index 79d0186c..c5ecdc3d 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/ReportITMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/ReportITMojo.java
@@ -16,9 +16,9 @@ import java.io.File;
import java.util.Locale;
/**
- * Creates a code coverage report for integration tests of a single project in multiple formats
- * (HTML, XML, and CSV).
- *
+ * Creates a code coverage report for integration tests of a single project in
+ * multiple formats (HTML, XML, and CSV).
+ *
* @phase verify
* @goal report-integration
* @requiresProject true
@@ -33,14 +33,14 @@ public class ReportITMojo extends AbstractReportMojo {
* build lifecycle. If the goal is run indirectly as part of a site
* generation, the output directory configured in the Maven Site Plugin is
* used instead.
- *
+ *
* @parameter default-value="${project.reporting.outputDirectory}/jacoco-it"
*/
private File outputDirectory;
/**
* File with execution data.
- *
+ *
* @parameter default-value="${project.build.directory}/jacoco-it.exec"
*/
private File dataFile;
@@ -53,28 +53,31 @@ public class ReportITMojo extends AbstractReportMojo {
@Override
public void setReportOutputDirectory(final File reportOutputDirectory) {
if (reportOutputDirectory != null
- && !reportOutputDirectory.getAbsolutePath().endsWith("jacoco-it")) {
+ && !reportOutputDirectory.getAbsolutePath().endsWith(
+ "jacoco-it")) {
outputDirectory = new File(reportOutputDirectory, "jacoco-it");
} else {
outputDirectory = reportOutputDirectory;
}
}
- @Override
- protected File getDataFile() {
- return dataFile;
- }
+ @Override
+ File getDataFile() {
+ return dataFile;
+ }
- @Override
- protected File getOutputDirectoryFile() {
- return outputDirectory;
- }
+ @Override
+ File getOutputDirectoryFile() {
+ return outputDirectory;
+ }
- public String getOutputName() {
- return "jacoco-it/index";
- }
+ @Override
+ public String getOutputName() {
+ return "jacoco-it/index";
+ }
- public String getName(final Locale locale) {
- return "JaCoCo IT";
- }
+ @Override
+ public String getName(final Locale locale) {
+ return "JaCoCo IT";
+ }
}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java
index 819b1fa6..f63ce583 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java
@@ -15,9 +15,9 @@ import java.io.File;
import java.util.Locale;
/**
- * Creates a code coverage report for tests of a single project in multiple formats
- * (HTML, XML, and CSV).
- *
+ * Creates a code coverage report for tests of a single project in multiple
+ * formats (HTML, XML, and CSV).
+ *
* @phase verify
* @goal report
* @requiresProject true
@@ -32,14 +32,14 @@ public class ReportMojo extends AbstractReportMojo {
* build lifecycle. If the goal is run indirectly as part of a site
* generation, the output directory configured in the Maven Site Plugin is
* used instead.
- *
+ *
* @parameter default-value="${project.reporting.outputDirectory}/jacoco"
*/
private File outputDirectory;
/**
* File with execution data.
- *
+ *
* @parameter default-value="${project.build.directory}/jacoco.exec"
*/
private File dataFile;
@@ -60,19 +60,21 @@ public class ReportMojo extends AbstractReportMojo {
}
@Override
- protected File getDataFile() {
+ File getDataFile() {
return dataFile;
}
@Override
- protected File getOutputDirectoryFile() {
+ File getOutputDirectoryFile() {
return outputDirectory;
}
+ @Override
public String getOutputName() {
return "jacoco/index";
}
+ @Override
public String getName(final Locale locale) {
return "JaCoCo Test";
}
diff --git a/org.jacoco.build/pom.xml b/org.jacoco.build/pom.xml
index 72df8181..a158b593 100644
--- a/org.jacoco.build/pom.xml
+++ b/org.jacoco.build/pom.xml
@@ -677,6 +677,31 @@
<jvm.args>-XX:-FailOverToOldVerifier -Xverify:all</jvm.args>
</properties>
</profile>
+
+ <profile>
+ <id>jdk18</id>
+ <activation>
+ <property>
+ <name>jdk.version</name>
+ <value>1.8</value>
+ </property>
+ </activation>
+ <properties>
+ <jvm.args>-XX:-FailOverToOldVerifier -Xverify:all</jvm.args>
+ </properties>
+ <build>
+ <plugins>
+ <!-- Temporary workaround for jira.codehaus.org/browse/MPLUGIN-244 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>sign</id>
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/MethodProbesAdapterTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/MethodProbesAdapterTest.java
index 0e7bfe46..acd6485c 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/MethodProbesAdapterTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/MethodProbesAdapterTest.java
@@ -14,6 +14,7 @@ package org.jacoco.core.internal.flow;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
+import java.util.List;
import org.jacoco.core.instr.MethodRecorder;
import org.junit.After;
@@ -79,7 +80,9 @@ public class MethodProbesAdapterTest implements IProbeIdGenerator {
}
private void rec(String name, Object... args) {
- printer.text.add(name + Arrays.asList(args));
+ @SuppressWarnings("unchecked")
+ final List<Object> text = printer.text;
+ text.add(name + Arrays.asList(args));
}
}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ClassInstrumenterTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ClassInstrumenterTest.java
index a28dfcb3..fe5c2df5 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ClassInstrumenterTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ClassInstrumenterTest.java
@@ -13,13 +13,13 @@ package org.jacoco.core.internal.instr;
import static org.junit.Assert.assertNull;
+import org.jacoco.core.JaCoCo;
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.LoggerRuntime;
import org.junit.Before;
import org.junit.Test;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
/**
* Unit tests for {@link ClassInstrumenter}.
@@ -34,7 +34,7 @@ public class ClassInstrumenterTest {
public void setup() {
runtime = new LoggerRuntime();
instrumenter = new ClassInstrumenter(123, runtime, new ClassVisitor(
- Opcodes.ASM4) {
+ JaCoCo.ASM_API_VERSION) {
});
}
@@ -55,7 +55,7 @@ public class ClassInstrumenterTest {
@Test
public void testNoMethodVisitor() {
instrumenter = new ClassInstrumenter(123, runtime, new ClassVisitor(
- Opcodes.ASM4) {
+ JaCoCo.ASM_API_VERSION) {
@Override
public MethodVisitor visitMethod(int access, String name,
String desc, String signature, String[] exceptions) {
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/FrameTrackerTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/FrameTrackerTest.java
index 879e94a3..c3a89cd6 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/FrameTrackerTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/FrameTrackerTest.java
@@ -14,6 +14,7 @@ package org.jacoco.core.internal.instr;
import static org.junit.Assert.assertEquals;
import static org.objectweb.asm.Opcodes.*;
+import org.jacoco.core.JaCoCo;
import org.jacoco.core.instr.MethodRecorder;
import org.junit.After;
import org.junit.Before;
@@ -68,7 +69,7 @@ public class FrameTrackerTest {
@After
public void verify() {
MethodRecorder actual = new MethodRecorder();
- MethodVisitor noLabels = new MethodVisitor(Opcodes.ASM4,
+ MethodVisitor noLabels = new MethodVisitor(JaCoCo.ASM_API_VERSION,
actual.getVisitor()) {
@Override
public void visitLabel(Label label) {
diff --git a/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java b/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java
index 05f80432..ed07fe46 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java
@@ -16,6 +16,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import org.jacoco.core.JaCoCo;
import org.jacoco.core.internal.instr.InstrSupport;
import org.jacoco.core.test.TargetLoader;
import org.junit.After;
@@ -66,7 +67,7 @@ public abstract class RuntimeTestBase {
public void testNoLocalVariablesInDataAccessor()
throws InstantiationException, IllegalAccessException {
runtime.generateDataAccessor(1001, "Target", 5, new MethodVisitor(
- Opcodes.ASM4) {
+ JaCoCo.ASM_API_VERSION) {
@Override
public void visitVarInsn(int opcode, int var) {
fail("No usage of local variables allowed.");
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java
index 6b5d2bfc..eec18b47 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java
@@ -27,6 +27,7 @@ import static org.objectweb.asm.Opcodes.V1_7;
import java.io.IOException;
+import org.jacoco.core.JaCoCo;
import org.jacoco.core.instr.Instrumenter;
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.SystemPropertiesRuntime;
@@ -35,7 +36,6 @@ import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
/**
* Test class inserted stackmap frames for different class file versions.
@@ -89,23 +89,24 @@ public class ClassFileVersionsTest {
private void assertFrames(byte[] source, boolean expected) {
final boolean[] hasFrames = new boolean[] { false };
- new ClassReader(source).accept(new ClassVisitor(Opcodes.ASM4) {
-
- @Override
- public MethodVisitor visitMethod(int access, String name,
- String desc, String signature, String[] exceptions) {
- return new MethodVisitor(Opcodes.ASM4) {
+ new ClassReader(source).accept(
+ new ClassVisitor(JaCoCo.ASM_API_VERSION) {
@Override
- public void visitFrame(int type, int nLocal,
- Object[] local, int nStack, Object[] stack) {
- hasFrames[0] = true;
- }
+ public MethodVisitor visitMethod(int access, String name,
+ String desc, String signature, String[] exceptions) {
+ return new MethodVisitor(JaCoCo.ASM_API_VERSION) {
- };
- }
+ @Override
+ public void visitFrame(int type, int nLocal,
+ Object[] local, int nStack, Object[] stack) {
+ hasFrames[0] = true;
+ }
+
+ };
+ }
- }, 0);
+ }, 0);
assertEquals(Boolean.valueOf(expected), Boolean.valueOf(hasFrames[0]));
}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ExplicitInitialFrameTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ExplicitInitialFrameTest.java
new file mode 100644
index 00000000..301c8cbb
--- /dev/null
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ExplicitInitialFrameTest.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation;
+
+import org.jacoco.core.analysis.ICounter;
+import org.jacoco.core.test.validation.targets.Target11;
+import org.junit.Test;
+
+/**
+ * Test for a methods having a explicit initial frame.
+ */
+public class ExplicitInitialFrameTest extends ValidationTestBase {
+
+ public ExplicitInitialFrameTest() {
+ super(Target11.class);
+ }
+
+ @Override
+ protected void run(final Class<?> targetClass) throws Exception {
+ final Object instance = targetClass.newInstance();
+ ((Runnable) instance).run();
+ }
+
+ @Test
+ public void testCoverageResult() {
+
+ assertLine("dowhilebody", ICounter.FULLY_COVERED);
+
+ }
+
+}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java
index f5ac4f5e..eca8d284 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java
@@ -17,6 +17,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import org.jacoco.core.JaCoCo;
import org.jacoco.core.instr.Instrumenter;
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.SystemPropertiesRuntime;
@@ -29,7 +30,9 @@ import org.jacoco.core.test.validation.targets.Target05;
import org.jacoco.core.test.validation.targets.Target06;
import org.jacoco.core.test.validation.targets.Target07;
import org.jacoco.core.test.validation.targets.Target08;
+import org.jacoco.core.test.validation.targets.Target09;
import org.jacoco.core.test.validation.targets.Target10;
+import org.jacoco.core.test.validation.targets.Target11;
import org.junit.Test;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
@@ -51,7 +54,7 @@ public class FramesTest {
*/
private static class MaxStackEliminator extends ClassVisitor {
public MaxStackEliminator(ClassVisitor cv) {
- super(Opcodes.ASM4, cv);
+ super(JaCoCo.ASM_API_VERSION, cv);
}
@Override
@@ -59,7 +62,7 @@ public class FramesTest {
String signature, String[] exceptions) {
final MethodVisitor mv = super.visitMethod(access, name, desc,
signature, exceptions);
- return new MethodVisitor(Opcodes.ASM4, mv) {
+ return new MethodVisitor(JaCoCo.ASM_API_VERSION, mv) {
@Override
public void visitMaxs(int maxStack, int maxLocals) {
super.visitMaxs(-1, maxLocals);
@@ -87,7 +90,7 @@ public class FramesTest {
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
// Adjust Version to 1.6 to enable frames:
- rc.accept(new ClassVisitor(Opcodes.ASM4, cw) {
+ rc.accept(new ClassVisitor(JaCoCo.ASM_API_VERSION, cw) {
@Override
public void visit(int version, int access, String name,
@@ -148,8 +151,18 @@ public class FramesTest {
}
@Test
+ public void testTarget09() throws IOException {
+ testFrames(Target09.class);
+ }
+
+ @Test
public void testTarget10() throws IOException {
testFrames(Target10.class);
}
+ @Test
+ public void testTarget11() throws IOException {
+ testFrames(Target11.class);
+ }
+
}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target11.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target11.java
new file mode 100644
index 00000000..8fe7fdf2
--- /dev/null
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target11.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.targets;
+
+import static org.jacoco.core.test.validation.targets.Stubs.f;
+import static org.jacoco.core.test.validation.targets.Stubs.nop;
+
+/**
+ * This test target needs an explicit initial frame as the first instruction
+ * already is a jump target.
+ */
+public class Target11 implements Runnable {
+
+ public void run() {
+ do {
+ nop(); // $line-dowhilebody$
+ } while (f());
+ }
+
+ public static void main(String[] args) {
+ new Target11().run();
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/JaCoCo.java b/org.jacoco.core/src/org/jacoco/core/JaCoCo.java
index b51937be..d2f262ba 100644
--- a/org.jacoco.core/src/org/jacoco/core/JaCoCo.java
+++ b/org.jacoco.core/src/org/jacoco/core/JaCoCo.java
@@ -13,6 +13,8 @@ package org.jacoco.core;
import java.util.ResourceBundle;
+import org.objectweb.asm.Opcodes;
+
/**
* Static Meta information about JaCoCo.
*/
@@ -27,6 +29,9 @@ public final class JaCoCo {
/** Name of the runtime package of this build */
public static final String RUNTIMEPACKAGE;
+ /** ASM API version */
+ public static final int ASM_API_VERSION = Opcodes.ASM4;
+
static {
final ResourceBundle bundle = ResourceBundle
.getBundle("org.jacoco.core.jacoco");
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java
index 937328aa..2fe3e3d7 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.jacoco.core.internal.flow;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
@@ -80,7 +81,7 @@ public class ClassProbesAdapter extends ClassVisitor implements
* instance to delegate to
*/
public ClassProbesAdapter(final ClassProbesVisitor cv) {
- super(Opcodes.ASM4, cv);
+ super(JaCoCo.ASM_API_VERSION, cv);
this.cv = cv;
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java
index ff796edb..49a78242 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java
@@ -11,8 +11,8 @@
*******************************************************************************/
package org.jacoco.core.internal.flow;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.Opcodes;
/**
* A {@link ClassVisitor} with additional methods to get probe insertion
@@ -34,7 +34,7 @@ public abstract class ClassProbesVisitor extends ClassVisitor {
* optional next visitor in chain
*/
public ClassProbesVisitor(final ClassVisitor cv) {
- super(Opcodes.ASM4, cv);
+ super(JaCoCo.ASM_API_VERSION, cv);
}
/**
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java
index b325e8a3..7007c94c 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.jacoco.core.internal.flow;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
@@ -59,7 +60,7 @@ public final class LabelFlowAnalyzer extends MethodVisitor {
* Create new instance.
*/
public LabelFlowAnalyzer() {
- super(Opcodes.ASM4);
+ super(JaCoCo.ASM_API_VERSION);
}
@Override
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
index 60b64b66..5d681445 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.jacoco.core.internal.flow;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
@@ -35,7 +36,7 @@ public final class MethodProbesAdapter extends MethodVisitor {
*/
public MethodProbesAdapter(final MethodProbesVisitor probesVisitor,
final IProbeIdGenerator idGenerator) {
- super(Opcodes.ASM4, probesVisitor);
+ super(JaCoCo.ASM_API_VERSION, probesVisitor);
this.probesVisitor = probesVisitor;
this.idGenerator = idGenerator;
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java
index fba48122..fd4b281a 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java
@@ -11,9 +11,9 @@
*******************************************************************************/
package org.jacoco.core.internal.flow;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
/**
* A {@link MethodVisitor} with additional methods to get probe insertion
@@ -35,7 +35,7 @@ public abstract class MethodProbesVisitor extends MethodVisitor {
* optional next visitor in chain
*/
public MethodProbesVisitor(final MethodVisitor mv) {
- super(Opcodes.ASM4, mv);
+ super(JaCoCo.ASM_API_VERSION, mv);
}
/**
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java
index 81384e55..8c3f46b0 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java
@@ -11,10 +11,10 @@
*******************************************************************************/
package org.jacoco.core.internal.instr;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
/**
* Eliminates consecutive stackmap frame definitions which causes ASM to create
@@ -27,7 +27,7 @@ class DuplicateFrameEliminator extends MethodVisitor {
private boolean instruction;
public DuplicateFrameEliminator(final MethodVisitor mv) {
- super(Opcodes.ASM4, mv);
+ super(JaCoCo.ASM_API_VERSION, mv);
instruction = true;
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/FrameTracker.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/FrameTracker.java
index 1ff58b5c..ced09d26 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/FrameTracker.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/FrameTracker.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.jacoco.core.internal.instr;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
@@ -33,7 +34,7 @@ class FrameTracker extends MethodVisitor implements IFrameInserter {
public FrameTracker(final String owner, final int access,
final String name, final String desc, final MethodVisitor mv) {
- super(Opcodes.ASM4, mv);
+ super(JaCoCo.ASM_API_VERSION, mv);
this.owner = owner;
local = new Object[8];
localSize = 0;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
index 2db2d39f..95d56c7d 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.jacoco.core.internal.instr;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
@@ -47,7 +48,7 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
*/
ProbeInserter(final int access, final String desc, final MethodVisitor mv,
final IProbeArrayStrategy arrayStrategy) {
- super(Opcodes.ASM4, mv);
+ super(JaCoCo.ASM_API_VERSION, mv);
this.arrayStrategy = arrayStrategy;
int pos = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0;
for (final Type t : Type.getArgumentTypes(desc)) {
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
index a5eb37b7..d8416ec1 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
@@ -19,6 +19,7 @@ import java.lang.instrument.Instrumentation;
import java.lang.reflect.Field;
import java.security.ProtectionDomain;
+import org.jacoco.core.JaCoCo;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -155,7 +156,7 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
final String accessFieldName) {
final ClassReader reader = new ClassReader(source);
final ClassWriter writer = new ClassWriter(reader, 0);
- reader.accept(new ClassVisitor(Opcodes.ASM4, writer) {
+ reader.accept(new ClassVisitor(JaCoCo.ASM_API_VERSION, writer) {
@Override
public void visitEnd() {
diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html
index f55894ba..77642479 100644
--- a/org.jacoco.doc/docroot/doc/changes.html
+++ b/org.jacoco.doc/docroot/doc/changes.html
@@ -24,6 +24,7 @@
<ul>
<li>Skip jacoco instrumentation for mvn modules with package type ear (GitHub <a href="https://github.com/jacoco/jacoco/issues/169">#169</a>).</li>
<li>Align skip conditions and messages and give reasons (GitHub <a href="https://github.com/jacoco/jacoco/issues/171">#171</a>).</li>
+ <li>Restrict visibility of methods in abstract classes of jacoco-maven-plugin (GitHub <a href="https://github.com/jacoco/jacoco/issues/175">#175</a>).</li>
</ul>
<h2>Release 0.6.4 (2013/12/10)</h2>
diff --git a/org.jacoco.doc/pom.xml b/org.jacoco.doc/pom.xml
index 720f18ae..9716ec65 100644
--- a/org.jacoco.doc/pom.xml
+++ b/org.jacoco.doc/pom.xml
@@ -93,6 +93,7 @@
<fileset dir="../org.jacoco.agent.rt.test/target" includes="jacoco.exec"/>
<fileset dir="../org.jacoco.ant.test/target" includes="jacoco.exec"/>
<fileset dir="../org.jacoco.core.test/target" includes="jacoco.exec"/>
+ <fileset dir="../org.jacoco.examples.test/target" includes="jacoco.exec"/>
<fileset dir="../org.jacoco.report.test/target" includes="jacoco.exec"/>
<fileset dir="../jacoco-maven-plugin.test/target" includes="jacoco.exec"/>
</executiondata>
@@ -130,6 +131,14 @@
<fileset dir="../org.jacoco.core/src"/>
</sourcefiles>
</group>
+ <group name="org.jacoco.examples">
+ <classfiles>
+ <fileset dir="../org.jacoco.examples/target/classes"/>
+ </classfiles>
+ <sourcefiles>
+ <fileset dir="../org.jacoco.examples/src"/>
+ </sourcefiles>
+ </group>
<group name="org.jacoco.report">
<classfiles>
<fileset dir="../org.jacoco.report/target/classes"/>
@@ -162,6 +171,7 @@
<fileset dir="../org.jacoco.ant.test/target" includes="surefire-reports/**/*.xml"/>
<fileset dir="../org.jacoco.core.test/target" includes="surefire-reports/**/*.xml"/>
<fileset dir="../org.jacoco.report.test/target" includes="surefire-reports/**/*.xml"/>
+ <fileset dir="../org.jacoco.examples.test/target" includes="surefire-reports/**/*.xml"/>
<report format="noframes" styledir="xsl" todir="${project.build.directory}/junit">
<param name="qualified.bundle.version" expression="${qualified.bundle.version}"/>
<param name="jacoco.home.url" expression="${jacoco.home.url}"/>