aboutsummaryrefslogtreecommitdiffstats
path: root/org.jacoco.report/src/org/jacoco
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-05-19 22:01:33 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-05-19 22:01:33 -0700
commit8e37ff147009b16f4dd904bcc32714990e5cf22a (patch)
tree4378ac3ee1730f6cfbe0b9120f3d54e7570c86a0 /org.jacoco.report/src/org/jacoco
parent93068ff728a7916816e7bbf832b05c717a106c26 (diff)
parent0f0b5ebf8685e3b0544afa451e39e3fd3fbc304b (diff)
downloadplatform_external_jacoco-android10-mainline-networking-release.tar.gz
platform_external_jacoco-android10-mainline-networking-release.tar.bz2
platform_external_jacoco-android10-mainline-networking-release.zip
am: 0f0b5ebf86 Change-Id: Ice1512bc21409270a58b7542bce06745db99af6c
Diffstat (limited to 'org.jacoco.report/src/org/jacoco')
-rw-r--r--org.jacoco.report/src/org/jacoco/report/DirectorySourceFileLocator.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/FileMultiReportOutput.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/ILanguageNames.java18
-rw-r--r--org.jacoco.report/src/org/jacoco/report/IMultiReportOutput.java6
-rw-r--r--org.jacoco.report/src/org/jacoco/report/IReportGroupVisitor.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/IReportVisitor.java6
-rw-r--r--org.jacoco.report/src/org/jacoco/report/ISourceFileLocator.java6
-rw-r--r--org.jacoco.report/src/org/jacoco/report/InputStreamSourceFileLocator.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/JavaNames.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/MultiReportVisitor.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/MultiSourceFileLocator.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/ZipMultiReportOutput.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/check/BundleChecker.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/check/IViolationsOutput.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/check/Limit.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/check/Rule.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/check/RulesChecker.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/check/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/csv/CSVFormatter.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/csv/CSVGroupHandler.java6
-rw-r--r--org.jacoco.report/src/org/jacoco/report/csv/ClassRowWriter.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/csv/DelimitedWriter.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/csv/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/html/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/NormalizedFileNames.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/ReportOutputFolder.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/HTMLDocument.java97
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/HTMLElement.java120
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/HTMLGroupVisitor.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java20
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/ILinkable.java8
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/index/ElementIndex.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/index/IIndexUpdate.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/index/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/BundlePage.java18
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/ClassPage.java34
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/GroupPage.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/MethodItem.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/NodePage.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/PackagePage.java5
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/PackageSourcePage.java5
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/ReportPage.java20
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/SessionsPage.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFileItem.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java14
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceHighlighter.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/TablePage.java8
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/resources/Resources.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/resources/Styles.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/resources/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java7
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/IColumnRenderer.java12
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/ITableItem.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/LabelColumn.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/PercentageColumn.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/SortIndex.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/Table.java2
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/TableItemComparator.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/xml/ReportElement.java203
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/xml/XMLCoverageWriter.java68
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/xml/XMLDocument.java111
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/xml/XMLElement.java196
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/xml/XMLGroupVisitor.java14
-rw-r--r--org.jacoco.report/src/org/jacoco/report/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/xml/XMLFormatter.java56
-rw-r--r--org.jacoco.report/src/org/jacoco/report/xml/package-info.java4
-rw-r--r--org.jacoco.report/src/org/jacoco/report/xml/report.dtd8
71 files changed, 615 insertions, 565 deletions
diff --git a/org.jacoco.report/src/org/jacoco/report/DirectorySourceFileLocator.java b/org.jacoco.report/src/org/jacoco/report/DirectorySourceFileLocator.java
index cb8cc2b3..79881a72 100644
--- a/org.jacoco.report/src/org/jacoco/report/DirectorySourceFileLocator.java
+++ b/org.jacoco.report/src/org/jacoco/report/DirectorySourceFileLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/FileMultiReportOutput.java b/org.jacoco.report/src/org/jacoco/report/FileMultiReportOutput.java
index 74b504cb..436db743 100644
--- a/org.jacoco.report/src/org/jacoco/report/FileMultiReportOutput.java
+++ b/org.jacoco.report/src/org/jacoco/report/FileMultiReportOutput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/ILanguageNames.java b/org.jacoco.report/src/org/jacoco/report/ILanguageNames.java
index 0e669bbe..68a51b5a 100644
--- a/org.jacoco.report/src/org/jacoco/report/ILanguageNames.java
+++ b/org.jacoco.report/src/org/jacoco/report/ILanguageNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -23,7 +23,7 @@ public interface ILanguageNames {
* vm name of a package
* @return language specific notation for the package
*/
- public String getPackageName(String vmname);
+ String getPackageName(String vmname);
/**
* Calculates the language specific name of a class.
@@ -39,8 +39,8 @@ public interface ILanguageNames {
* vm names of interfaces of the class (may be <code>null</code>)
* @return language specific notation of the class
*/
- public String getClassName(String vmname, String vmsignature,
- String vmsuperclass, String[] vminterfaces);
+ String getClassName(String vmname, String vmsignature, String vmsuperclass,
+ String[] vminterfaces);
/**
* Calculates the language specific qualified name of a class.
@@ -49,7 +49,7 @@ public interface ILanguageNames {
* vm name of a class
* @return language specific qualified notation of the class
*/
- public String getQualifiedClassName(String vmname);
+ String getQualifiedClassName(String vmname);
/**
* Calculates the language specific name of a method.
@@ -64,8 +64,8 @@ public interface ILanguageNames {
* vm signature of the method (may be <code>null</code>)
* @return language specific notation for the method
*/
- public String getMethodName(String vmclassname, String vmmethodname,
- String vmdesc, String vmsignature);
+ String getMethodName(String vmclassname, String vmmethodname, String vmdesc,
+ String vmsignature);
/**
* Calculates the language specific fully qualified name of a method.
@@ -80,7 +80,7 @@ public interface ILanguageNames {
* vm signature of the method (may be <code>null</code>)
* @return language specific notation for the method
*/
- public String getQualifiedMethodName(String vmclassname,
- String vmmethodname, String vmdesc, String vmsignature);
+ String getQualifiedMethodName(String vmclassname, String vmmethodname,
+ String vmdesc, String vmsignature);
}
diff --git a/org.jacoco.report/src/org/jacoco/report/IMultiReportOutput.java b/org.jacoco.report/src/org/jacoco/report/IMultiReportOutput.java
index c249ea96..e40d36bd 100644
--- a/org.jacoco.report/src/org/jacoco/report/IMultiReportOutput.java
+++ b/org.jacoco.report/src/org/jacoco/report/IMultiReportOutput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -29,7 +29,7 @@ public interface IMultiReportOutput {
* @throws IOException
* if the creation fails
*/
- public OutputStream createFile(String path) throws IOException;
+ OutputStream createFile(String path) throws IOException;
/**
* Closes the underlying resource container.
@@ -37,6 +37,6 @@ public interface IMultiReportOutput {
* @throws IOException
* if closing fails
*/
- public void close() throws IOException;
+ void close() throws IOException;
}
diff --git a/org.jacoco.report/src/org/jacoco/report/IReportGroupVisitor.java b/org.jacoco.report/src/org/jacoco/report/IReportGroupVisitor.java
index 9efb246c..96867e03 100644
--- a/org.jacoco.report/src/org/jacoco/report/IReportGroupVisitor.java
+++ b/org.jacoco.report/src/org/jacoco/report/IReportGroupVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/IReportVisitor.java b/org.jacoco.report/src/org/jacoco/report/IReportVisitor.java
index 6b145cff..db36796d 100644
--- a/org.jacoco.report/src/org/jacoco/report/IReportVisitor.java
+++ b/org.jacoco.report/src/org/jacoco/report/IReportVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -38,7 +38,7 @@ public interface IReportVisitor extends IReportGroupVisitor {
* @throws IOException
* in case of IO problems with the report writer
*/
- public void visitInfo(List<SessionInfo> sessionInfos,
+ void visitInfo(List<SessionInfo> sessionInfos,
Collection<ExecutionData> executionData) throws IOException;
/**
@@ -47,6 +47,6 @@ public interface IReportVisitor extends IReportGroupVisitor {
* @throws IOException
* in case of IO problems with the report writer
*/
- public void visitEnd() throws IOException;
+ void visitEnd() throws IOException;
}
diff --git a/org.jacoco.report/src/org/jacoco/report/ISourceFileLocator.java b/org.jacoco.report/src/org/jacoco/report/ISourceFileLocator.java
index ed5809ed..e32cbbf2 100644
--- a/org.jacoco.report/src/org/jacoco/report/ISourceFileLocator.java
+++ b/org.jacoco.report/src/org/jacoco/report/ISourceFileLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -31,7 +31,7 @@ public interface ISourceFileLocator {
* @throws IOException
* in case of problems while opening the file
*/
- public Reader getSourceFile(String packageName, String fileName)
+ Reader getSourceFile(String packageName, String fileName)
throws IOException;
/**
@@ -39,6 +39,6 @@ public interface ISourceFileLocator {
*
* @return tab width as number of blanks
*/
- public int getTabWidth();
+ int getTabWidth();
}
diff --git a/org.jacoco.report/src/org/jacoco/report/InputStreamSourceFileLocator.java b/org.jacoco.report/src/org/jacoco/report/InputStreamSourceFileLocator.java
index af1d143c..0d1b3812 100644
--- a/org.jacoco.report/src/org/jacoco/report/InputStreamSourceFileLocator.java
+++ b/org.jacoco.report/src/org/jacoco/report/InputStreamSourceFileLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/JavaNames.java b/org.jacoco.report/src/org/jacoco/report/JavaNames.java
index daa301b3..1ef1baed 100644
--- a/org.jacoco.report/src/org/jacoco/report/JavaNames.java
+++ b/org.jacoco.report/src/org/jacoco/report/JavaNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/MultiReportVisitor.java b/org.jacoco.report/src/org/jacoco/report/MultiReportVisitor.java
index 0d81d14c..3cd5e558 100644
--- a/org.jacoco.report/src/org/jacoco/report/MultiReportVisitor.java
+++ b/org.jacoco.report/src/org/jacoco/report/MultiReportVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/MultiSourceFileLocator.java b/org.jacoco.report/src/org/jacoco/report/MultiSourceFileLocator.java
index 2ac55e8f..90677d5c 100644
--- a/org.jacoco.report/src/org/jacoco/report/MultiSourceFileLocator.java
+++ b/org.jacoco.report/src/org/jacoco/report/MultiSourceFileLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/ZipMultiReportOutput.java b/org.jacoco.report/src/org/jacoco/report/ZipMultiReportOutput.java
index 9c745cd5..8138cee4 100644
--- a/org.jacoco.report/src/org/jacoco/report/ZipMultiReportOutput.java
+++ b/org.jacoco.report/src/org/jacoco/report/ZipMultiReportOutput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/check/BundleChecker.java b/org.jacoco.report/src/org/jacoco/report/check/BundleChecker.java
index 911fdd79..c6cd8885 100644
--- a/org.jacoco.report/src/org/jacoco/report/check/BundleChecker.java
+++ b/org.jacoco.report/src/org/jacoco/report/check/BundleChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/check/IViolationsOutput.java b/org.jacoco.report/src/org/jacoco/report/check/IViolationsOutput.java
index 0dfac3a3..36c96bb2 100644
--- a/org.jacoco.report/src/org/jacoco/report/check/IViolationsOutput.java
+++ b/org.jacoco.report/src/org/jacoco/report/check/IViolationsOutput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/check/Limit.java b/org.jacoco.report/src/org/jacoco/report/check/Limit.java
index 8881ddb7..5a24b454 100644
--- a/org.jacoco.report/src/org/jacoco/report/check/Limit.java
+++ b/org.jacoco.report/src/org/jacoco/report/check/Limit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/check/Rule.java b/org.jacoco.report/src/org/jacoco/report/check/Rule.java
index 949d3b56..b247285d 100644
--- a/org.jacoco.report/src/org/jacoco/report/check/Rule.java
+++ b/org.jacoco.report/src/org/jacoco/report/check/Rule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/check/RulesChecker.java b/org.jacoco.report/src/org/jacoco/report/check/RulesChecker.java
index fe6715ee..cc6acf04 100644
--- a/org.jacoco.report/src/org/jacoco/report/check/RulesChecker.java
+++ b/org.jacoco.report/src/org/jacoco/report/check/RulesChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/check/package-info.java b/org.jacoco.report/src/org/jacoco/report/check/package-info.java
index 35e547a8..d3bee1e5 100644
--- a/org.jacoco.report/src/org/jacoco/report/check/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/check/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* Rules check implementation.
*/
-package org.jacoco.report.check; \ No newline at end of file
+package org.jacoco.report.check;
diff --git a/org.jacoco.report/src/org/jacoco/report/csv/CSVFormatter.java b/org.jacoco.report/src/org/jacoco/report/csv/CSVFormatter.java
index cb3f03ca..793e2153 100644
--- a/org.jacoco.report/src/org/jacoco/report/csv/CSVFormatter.java
+++ b/org.jacoco.report/src/org/jacoco/report/csv/CSVFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/csv/CSVGroupHandler.java b/org.jacoco.report/src/org/jacoco/report/csv/CSVGroupHandler.java
index 0f50ffe0..594feb4a 100644
--- a/org.jacoco.report/src/org/jacoco/report/csv/CSVGroupHandler.java
+++ b/org.jacoco.report/src/org/jacoco/report/csv/CSVGroupHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -43,7 +43,9 @@ class CSVGroupHandler implements IReportGroupVisitor {
for (final IPackageCoverage p : bundle.getPackages()) {
final String packageName = p.getName();
for (final IClassCoverage c : p.getClasses()) {
- writer.writeRow(name, packageName, c);
+ if (c.containsCode()) {
+ writer.writeRow(name, packageName, c);
+ }
}
}
}
diff --git a/org.jacoco.report/src/org/jacoco/report/csv/ClassRowWriter.java b/org.jacoco.report/src/org/jacoco/report/csv/ClassRowWriter.java
index a9f7ee95..ef9a05c4 100644
--- a/org.jacoco.report/src/org/jacoco/report/csv/ClassRowWriter.java
+++ b/org.jacoco.report/src/org/jacoco/report/csv/ClassRowWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/csv/DelimitedWriter.java b/org.jacoco.report/src/org/jacoco/report/csv/DelimitedWriter.java
index 0d37fc0c..deadeecd 100644
--- a/org.jacoco.report/src/org/jacoco/report/csv/DelimitedWriter.java
+++ b/org.jacoco.report/src/org/jacoco/report/csv/DelimitedWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/csv/package-info.java b/org.jacoco.report/src/org/jacoco/report/csv/package-info.java
index 9e1fd911..e6194bca 100644
--- a/org.jacoco.report/src/org/jacoco/report/csv/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/csv/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* CSV report implementation.
*/
-package org.jacoco.report.csv; \ No newline at end of file
+package org.jacoco.report.csv;
diff --git a/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java b/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java
index 5c4741b2..9994ced0 100644
--- a/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java
+++ b/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/html/package-info.java b/org.jacoco.report/src/org/jacoco/report/html/package-info.java
index 5a537055..9e0014ec 100644
--- a/org.jacoco.report/src/org/jacoco/report/html/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/html/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* HTML report implementation.
*/
-package org.jacoco.report.html; \ No newline at end of file
+package org.jacoco.report.html;
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java b/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java
index 7674427f..63da569c 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/AbstractGroupVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/NormalizedFileNames.java b/org.jacoco.report/src/org/jacoco/report/internal/NormalizedFileNames.java
index 00eb0ed0..65eba09d 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/NormalizedFileNames.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/NormalizedFileNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/ReportOutputFolder.java b/org.jacoco.report/src/org/jacoco/report/internal/ReportOutputFolder.java
index a429256b..a0f05580 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/ReportOutputFolder.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/ReportOutputFolder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLDocument.java b/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLDocument.java
deleted file mode 100644
index fb461e1d..00000000
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLDocument.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2018 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.report.internal.html;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-
-import org.jacoco.report.internal.xml.XMLDocument;
-
-/**
- * {@link XMLDocument} that declares its content type to be XHTML 1.0 Strict and
- * produces {@link HTMLElement}s as children.
- */
-public class HTMLDocument extends XMLDocument {
-
- private static final String ROOT = "html";
-
- private static final String PUBID = "-//W3C//DTD XHTML 1.0 Strict//EN";
-
- private static final String SYSTEM = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
-
- private static final String XMLNS = "xmlns";
-
- private static final String XHTML_NAMESPACE_URL = "http://www.w3.org/1999/xhtml";
-
- /**
- * Creates a new HTML document based on the given writer.
- *
- * @param writer
- * writer for content output
- * @param encoding
- * document encoding
- * @throws IOException
- * in case of problems with the writer
- */
- public HTMLDocument(final Writer writer, final String encoding)
- throws IOException {
- super(ROOT, PUBID, SYSTEM, encoding, false, writer);
- attr(XMLNS, XHTML_NAMESPACE_URL);
- }
-
- /**
- * Creates a new HTML document based on the given stream.
- *
- * @param output
- * stream for content output
- * @param encoding
- * document encoding
- * @throws IOException
- * in case of problems with the stream
- */
- public HTMLDocument(final OutputStream output, final String encoding)
- throws IOException {
- super(ROOT, PUBID, SYSTEM, encoding, false, output);
- attr(XMLNS, XHTML_NAMESPACE_URL);
- }
-
- @Override
- public HTMLElement element(final String name) throws IOException {
- final HTMLElement element = new HTMLElement(writer, name);
- addChildElement(element);
- return element;
- }
-
- /**
- * Creates a 'head' element.
- *
- * @return 'head' element
- * @throws IOException
- * in case of problems with the writer
- */
- public HTMLElement head() throws IOException {
- return element("head");
- }
-
- /**
- * Creates a 'body' element.
- *
- * @return 'body' element
- * @throws IOException
- * in case of problems with the writer
- */
- public HTMLElement body() throws IOException {
- return element("body");
- }
-
-}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLElement.java b/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLElement.java
index 18f5bdd4..616b3186 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLElement.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -12,7 +12,7 @@
package org.jacoco.report.internal.html;
import java.io.IOException;
-import java.io.Writer;
+import java.io.OutputStream;
import org.jacoco.report.internal.ReportOutputFolder;
import org.jacoco.report.internal.xml.XMLElement;
@@ -23,23 +23,34 @@ import org.jacoco.report.internal.xml.XMLElement;
*/
public class HTMLElement extends XMLElement {
+ private static final String PUBID = "-//W3C//DTD XHTML 1.0 Strict//EN";
+
+ private static final String SYSTEM = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
+
/**
- * Creates a new element for a HTML document.
+ * Creates a <code>html</code> root element of a XHTML document.
*
- * @param writer
- * all output will be written directly to this
- * @param name
- * element name
+ * @param encoding
+ * character encoding used for output
+ * @param output
+ * output stream will be closed if the root element is closed
+ * @throws IOException
+ * in case of problems with the underlying output
*/
- protected HTMLElement(final Writer writer, final String name) {
- super(writer, name);
+ public HTMLElement(final OutputStream output, final String encoding)
+ throws IOException {
+ super("html", PUBID, SYSTEM, false, encoding, output);
+ attr("xmlns", "http://www.w3.org/1999/xhtml");
+ }
+
+ private HTMLElement(final String name, final HTMLElement parent)
+ throws IOException {
+ super(name, parent);
}
@Override
public HTMLElement element(final String name) throws IOException {
- final HTMLElement element = new HTMLElement(writer, name);
- addChildElement(element);
- return element;
+ return new HTMLElement(name, this);
}
private void classattr(final String classattr) throws IOException {
@@ -47,6 +58,28 @@ public class HTMLElement extends XMLElement {
}
/**
+ * Creates a 'head' element.
+ *
+ * @return 'head' element
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public HTMLElement head() throws IOException {
+ return element("head");
+ }
+
+ /**
+ * Creates a 'body' element.
+ *
+ * @return 'body' element
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public HTMLElement body() throws IOException {
+ return element("body");
+ }
+
+ /**
* Creates a 'meta' element.
*
* @param httpequivattr
@@ -55,10 +88,10 @@ public class HTMLElement extends XMLElement {
* value for the content attribute
* @return 'meta' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
- public HTMLElement meta(final String httpequivattr, final String contentattr)
- throws IOException {
+ public HTMLElement meta(final String httpequivattr,
+ final String contentattr) throws IOException {
final HTMLElement meta = element("meta");
meta.attr("http-equiv", httpequivattr);
meta.attr("content", contentattr);
@@ -76,7 +109,7 @@ public class HTMLElement extends XMLElement {
* value for the type attribute
* @return 'link' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement link(final String relattr, final String hrefattr,
final String typeattr) throws IOException {
@@ -92,7 +125,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'title' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement title() throws IOException {
return element("title");
@@ -103,7 +136,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'h1' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement h1() throws IOException {
return element("h1");
@@ -114,7 +147,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'p' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement p() throws IOException {
return element("p");
@@ -125,7 +158,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'span' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement span() throws IOException {
return element("span");
@@ -138,7 +171,7 @@ public class HTMLElement extends XMLElement {
* value of the class attribute
* @return 'span' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement span(final String classattr) throws IOException {
final HTMLElement span = span();
@@ -155,7 +188,7 @@ public class HTMLElement extends XMLElement {
* value of the id attribute
* @return 'span' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement span(final String classattr, final String idattr)
throws IOException {
@@ -171,7 +204,7 @@ public class HTMLElement extends XMLElement {
* value of the class attribute
* @return 'div' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement div(final String classattr) throws IOException {
final HTMLElement div = element("div");
@@ -184,7 +217,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'code' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement code() throws IOException {
return element("code");
@@ -197,7 +230,7 @@ public class HTMLElement extends XMLElement {
* value of the class attribute
* @return 'pre' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement pre(final String classattr) throws IOException {
final HTMLElement pre = element("pre");
@@ -212,7 +245,7 @@ public class HTMLElement extends XMLElement {
* value of the href attribute
* @return 'a' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement a(final String hrefattr) throws IOException {
final HTMLElement a = element("a");
@@ -229,7 +262,7 @@ public class HTMLElement extends XMLElement {
* value of the class attribute
* @return 'a' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement a(final String hrefattr, final String classattr)
throws IOException {
@@ -247,10 +280,10 @@ public class HTMLElement extends XMLElement {
* base folder where the link should be placed
* @return 'a' element or 'span' element, if the link target does not exist
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
- public HTMLElement a(final ILinkable linkable, final ReportOutputFolder base)
- throws IOException {
+ public HTMLElement a(final ILinkable linkable,
+ final ReportOutputFolder base) throws IOException {
final HTMLElement a;
final String link = linkable.getLink(base);
if (link == null) {
@@ -269,7 +302,7 @@ public class HTMLElement extends XMLElement {
* value of the class attribute
* @return 'table' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement table(final String classattr) throws IOException {
final HTMLElement table = element("table");
@@ -283,7 +316,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'thead' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement thead() throws IOException {
return element("thead");
@@ -294,7 +327,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'tfoot' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement tfoot() throws IOException {
return element("tfoot");
@@ -305,7 +338,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'tbody' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement tbody() throws IOException {
return element("tbody");
@@ -316,7 +349,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'tr' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement tr() throws IOException {
return element("tr");
@@ -327,7 +360,7 @@ public class HTMLElement extends XMLElement {
*
* @return 'td' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement td() throws IOException {
return element("td");
@@ -340,7 +373,7 @@ public class HTMLElement extends XMLElement {
* value of the class attribute
* @return 'td' element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public HTMLElement td(final String classattr) throws IOException {
final HTMLElement td = td();
@@ -360,7 +393,7 @@ public class HTMLElement extends XMLElement {
* @param titleattr
* value of the title and alt attribute
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public void img(final String srcattr, final int widthattr,
final int heightattr, final String titleattr) throws IOException {
@@ -374,19 +407,16 @@ public class HTMLElement extends XMLElement {
}
/**
- * Creates a 'script' element.
+ * Creates a JavaScript 'script' element.
*
- * @param typeattr
- * value of the type attribute
* @param srcattr
* value of the src attribute
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
- public void script(final String typeattr, final String srcattr)
- throws IOException {
+ public void script(final String srcattr) throws IOException {
final HTMLElement script = element("script");
- script.attr("type", typeattr);
+ script.attr("type", "text/javascript");
script.attr("src", srcattr);
// Enforce open and closing tag otherwise it won't work in browsers:
script.text("");
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLGroupVisitor.java b/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLGroupVisitor.java
index c2991f0f..e690efe9 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLGroupVisitor.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/HTMLGroupVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java b/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java
index 49499deb..5ce47b6f 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -28,55 +28,55 @@ public interface IHTMLReportContext {
*
* @return static resources
*/
- public Resources getResources();
+ Resources getResources();
/**
* Returns the language names call-back used in this report.
*
* @return language names
*/
- public ILanguageNames getLanguageNames();
+ ILanguageNames getLanguageNames();
/**
* Returns a table for rendering coverage nodes.
*
* @return table for rendering
*/
- public Table getTable();
+ Table getTable();
/**
* Returns a string of textual information to include in every page footer.
*
* @return footer text or empty string
*/
- public String getFooterText();
+ String getFooterText();
/**
* Returns the link to the sessions page.
*
* @return sessions page link
*/
- public ILinkable getSessionsPage();
+ ILinkable getSessionsPage();
/**
* Returns the encoding of the generated HTML documents.
*
* @return encoding for generated HTML documents
*/
- public String getOutputEncoding();
+ String getOutputEncoding();
/**
* Returns the service for index updates.
*
* @return sevice for indes updates
*/
- public IIndexUpdate getIndexUpdate();
+ IIndexUpdate getIndexUpdate();
/**
* Returns the locale used to format numbers and dates.
*
* @return locale for numbers and dates
*/
- public Locale getLocale();
+ Locale getLocale();
-} \ No newline at end of file
+}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/ILinkable.java b/org.jacoco.report/src/org/jacoco/report/internal/html/ILinkable.java
index 900e4955..bfec938a 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/ILinkable.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/ILinkable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -26,20 +26,20 @@ public interface ILinkable {
* folder where the link should be inserted
* @return relative link or <code>null</code> if the target does not exist
*/
- public String getLink(final ReportOutputFolder base);
+ String getLink(ReportOutputFolder base);
/**
* Returns the display label used for the link.
*
* @return display label
*/
- public String getLinkLabel();
+ String getLinkLabel();
/**
* Optional style class to be associated with the link.
*
* @return link style class or <code>null</code>
*/
- public String getLinkStyle();
+ String getLinkStyle();
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/index/ElementIndex.java b/org.jacoco.report/src/org/jacoco/report/internal/html/index/ElementIndex.java
index 3f2b8215..08fba90c 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/index/ElementIndex.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/index/ElementIndex.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/index/IIndexUpdate.java b/org.jacoco.report/src/org/jacoco/report/internal/html/index/IIndexUpdate.java
index b6910fc1..ce8d8aba 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/index/IIndexUpdate.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/index/IIndexUpdate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -27,6 +27,6 @@ public interface IIndexUpdate {
* @param classid
* identifier of the class
*/
- public void addClass(ILinkable link, long classid);
+ void addClass(ILinkable link, long classid);
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/index/package-info.java b/org.jacoco.report/src/org/jacoco/report/internal/html/index/package-info.java
index 0d3edb53..e6760bbe 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/index/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/index/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* Internal: Index generation for HTML reports.
*/
-package org.jacoco.report.internal.html.index; \ No newline at end of file
+package org.jacoco.report.internal.html.index;
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/BundlePage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/BundlePage.java
index 3189faa1..4caeb67e 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/BundlePage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/BundlePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -18,6 +18,7 @@ import org.jacoco.core.analysis.ICoverageNode;
import org.jacoco.core.analysis.IPackageCoverage;
import org.jacoco.report.ISourceFileLocator;
import org.jacoco.report.internal.ReportOutputFolder;
+import org.jacoco.report.internal.html.HTMLElement;
import org.jacoco.report.internal.html.IHTMLReportContext;
/**
@@ -62,6 +63,9 @@ public class BundlePage extends TablePage<ICoverageNode> {
private void renderPackages() throws IOException {
for (final IPackageCoverage p : bundle.getPackages()) {
+ if (!p.containsCode()) {
+ continue;
+ }
final String packagename = p.getName();
final String foldername = packagename.length() == 0 ? "default"
: packagename.replace('/', '.');
@@ -82,4 +86,16 @@ public class BundlePage extends TablePage<ICoverageNode> {
return "index.html";
}
+ @Override
+ protected void content(HTMLElement body) throws IOException {
+ if (bundle.getPackages().isEmpty()) {
+ body.p().text("No class files specified.");
+ } else if (!bundle.containsCode()) {
+ body.p().text(
+ "None of the analyzed classes contain code relevant for code coverage.");
+ } else {
+ super.content(body);
+ }
+ }
+
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/ClassPage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/ClassPage.java
index 2fab2c21..8a759a31 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/ClassPage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/ClassPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -16,6 +16,7 @@ import java.io.IOException;
import org.jacoco.core.analysis.IClassCoverage;
import org.jacoco.core.analysis.IMethodCoverage;
import org.jacoco.report.internal.ReportOutputFolder;
+import org.jacoco.report.internal.html.HTMLElement;
import org.jacoco.report.internal.html.IHTMLReportContext;
import org.jacoco.report.internal.html.ILinkable;
@@ -80,4 +81,35 @@ public class ClassPage extends TablePage<IClassCoverage> {
getNode().getInterfaceNames());
}
+ @Override
+ protected void content(HTMLElement body) throws IOException {
+ if (getNode().isNoMatch()) {
+ body.p().text(
+ "A different version of class was executed at runtime.");
+ }
+
+ if (getNode().getLineCounter().getTotalCount() == 0) {
+ body.p().text(
+ "Class files must be compiled with debug information to show line coverage.");
+ }
+
+ final String sourceFileName = getNode().getSourceFileName();
+ if (sourceFileName == null) {
+ body.p().text(
+ "Class files must be compiled with debug information to link with source files.");
+
+ } else if (sourcePage == null) {
+ final String sourcePath;
+ if (getNode().getPackageName().length() != 0) {
+ sourcePath = getNode().getPackageName() + "/" + sourceFileName;
+ } else {
+ sourcePath = sourceFileName;
+ }
+ body.p().text("Source file \"" + sourcePath
+ + "\" was not found during generation of report.");
+ }
+
+ super.content(body);
+ }
+
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/GroupPage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/GroupPage.java
index 8ecb5de1..9e646058 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/GroupPage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/GroupPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/MethodItem.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/MethodItem.java
index ecdf02ad..601c7112 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/MethodItem.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/MethodItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/NodePage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/NodePage.java
index 8f1dbdda..6dbb37f4 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/NodePage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/NodePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackagePage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackagePage.java
index f473850a..3d5e24dc 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackagePage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackagePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -65,6 +65,9 @@ public class PackagePage extends TablePage<IPackageCoverage> {
private void renderClasses() throws IOException {
for (final IClassCoverage c : getNode().getClasses()) {
+ if (!c.containsCode()) {
+ continue;
+ }
final ILinkable sourceFilePage = packageSourcePage
.getSourceFilePage(c.getSourceFileName());
final ClassPage page = new ClassPage(c, this, sourceFilePage,
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackageSourcePage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackageSourcePage.java
index cfe7f792..988033d0 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackageSourcePage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/PackageSourcePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -79,6 +79,9 @@ public class PackageSourcePage extends TablePage<IPackageCoverage> {
private final void renderSourceFilePages() throws IOException {
final String packagename = getNode().getName();
for (final ISourceFileCoverage s : getNode().getSourceFiles()) {
+ if (!s.containsCode()) {
+ continue;
+ }
final String sourcename = s.getName();
final Reader reader = locator
.getSourceFile(packagename, sourcename);
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/ReportPage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/ReportPage.java
index 7dfec534..9660bdf8 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/ReportPage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/ReportPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -15,7 +15,6 @@ import java.io.IOException;
import org.jacoco.core.JaCoCo;
import org.jacoco.report.internal.ReportOutputFolder;
-import org.jacoco.report.internal.html.HTMLDocument;
import org.jacoco.report.internal.html.HTMLElement;
import org.jacoco.report.internal.html.IHTMLReportContext;
import org.jacoco.report.internal.html.ILinkable;
@@ -71,12 +70,12 @@ public abstract class ReportPage implements ILinkable {
* if the page can't be written
*/
public void render() throws IOException {
- final HTMLDocument doc = new HTMLDocument(
+ final HTMLElement html = new HTMLElement(
folder.createFile(getFileName()), context.getOutputEncoding());
- doc.attr("lang", context.getLocale().getLanguage());
- head(doc.head());
- body(doc.body());
- doc.close();
+ html.attr("lang", context.getLocale().getLanguage());
+ head(html.head());
+ body(html.body());
+ html.close();
}
/**
@@ -130,8 +129,8 @@ public abstract class ReportPage implements ILinkable {
span.a(context.getSessionsPage(), folder);
}
- private void breadcrumb(final HTMLElement div, final ReportOutputFolder base)
- throws IOException {
+ private void breadcrumb(final HTMLElement div,
+ final ReportOutputFolder base) throws IOException {
breadcrumbParent(parent, div, base);
div.span(getLinkStyle()).text(getLinkLabel());
}
@@ -151,7 +150,8 @@ public abstract class ReportPage implements ILinkable {
final HTMLElement versioninfo = footer.span(Styles.RIGHT);
versioninfo.text("Created with ");
versioninfo.a(JaCoCo.HOMEURL).text("JaCoCo");
- versioninfo.text(" ").text(JaCoCo.VERSION);
+ versioninfo.text(" ");
+ versioninfo.text(JaCoCo.VERSION);
footer.text(context.getFooterText());
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SessionsPage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SessionsPage.java
index d01d5895..67de4941 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SessionsPage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SessionsPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFileItem.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFileItem.java
index 27df8bbc..70628ae2 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFileItem.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFileItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java
index 8658d602..d4fe243c 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -67,14 +67,10 @@ public class SourceFilePage extends NodePage<ISourceNode> {
@Override
protected void head(final HTMLElement head) throws IOException {
super.head(head);
- head.link(
- "stylesheet",
- context.getResources().getLink(folder,
- Resources.PRETTIFY_STYLESHEET), "text/css");
- head.script(
- "text/javascript",
- context.getResources().getLink(folder,
- Resources.PRETTIFY_SCRIPT));
+ head.link("stylesheet", context.getResources().getLink(folder,
+ Resources.PRETTIFY_STYLESHEET), "text/css");
+ head.script(context.getResources().getLink(folder,
+ Resources.PRETTIFY_SCRIPT));
}
@Override
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceHighlighter.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceHighlighter.java
index fea5b611..5cb8eb04 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceHighlighter.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceHighlighter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/TablePage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/TablePage.java
index 30c4cdcc..c8cd0c1d 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/TablePage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/TablePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -28,8 +28,8 @@ import org.jacoco.report.internal.html.table.ITableItem;
* @param <NodeType>
* type of the node represented by this page
*/
-public abstract class TablePage<NodeType extends ICoverageNode> extends
- NodePage<NodeType> {
+public abstract class TablePage<NodeType extends ICoverageNode>
+ extends NodePage<NodeType> {
private final List<ITableItem> items = new ArrayList<ITableItem>();
@@ -64,7 +64,7 @@ public abstract class TablePage<NodeType extends ICoverageNode> extends
@Override
protected void head(final HTMLElement head) throws IOException {
super.head(head);
- head.script("text/javascript",
+ head.script(
context.getResources().getLink(folder, Resources.SORT_SCRIPT));
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Resources.java b/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Resources.java
index bfb6a566..29fab0fd 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Resources.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Resources.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Styles.java b/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Styles.java
index 0d76887a..0d0d6cbf 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Styles.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/resources/Styles.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/resources/package-info.java b/org.jacoco.report/src/org/jacoco/report/internal/html/resources/package-info.java
index 6ccc5e52..ba6339a6 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/resources/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/resources/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* Internal: Resources for HTML reports.
*/
-package org.jacoco.report.internal.html.resources; \ No newline at end of file
+package org.jacoco.report.internal.html.resources;
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java
index de5cad29..ecbcd719 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -76,8 +76,9 @@ public class BarColumn implements IColumnRenderer {
final Resources resources, final ReportOutputFolder base)
throws IOException {
final ICounter counter = total.getCounter(entity);
- td.text(integerFormat.format(counter.getMissedCount())).text(" of ")
- .text(integerFormat.format(counter.getTotalCount()));
+ td.text(integerFormat.format(counter.getMissedCount()));
+ td.text(" of ");
+ td.text(integerFormat.format(counter.getTotalCount()));
}
public void item(final HTMLElement td, final ITableItem item,
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java
index 957827d2..823c5da9 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/IColumnRenderer.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/IColumnRenderer.java
index 76724eab..dab38da5 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/IColumnRenderer.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/IColumnRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -36,7 +36,7 @@ public interface IColumnRenderer {
* the summary of all coverage data items in the table
* @return <code>true</code> if the column should be visible
*/
- public boolean init(List<? extends ITableItem> items, ICoverageNode total);
+ boolean init(List<? extends ITableItem> items, ICoverageNode total);
/**
* Renders the footer for this column.
@@ -52,8 +52,8 @@ public interface IColumnRenderer {
* @throws IOException
* in case of IO problems with the element output
*/
- public void footer(HTMLElement td, ICoverageNode total,
- Resources resources, ReportOutputFolder base) throws IOException;
+ void footer(HTMLElement td, ICoverageNode total, Resources resources,
+ ReportOutputFolder base) throws IOException;
/**
* Renders a single item in this column.
@@ -69,7 +69,7 @@ public interface IColumnRenderer {
* @throws IOException
* in case of IO problems with the element output
*/
- public void item(HTMLElement td, ITableItem item, Resources resources,
+ void item(HTMLElement td, ITableItem item, Resources resources,
ReportOutputFolder base) throws IOException;
/**
@@ -77,6 +77,6 @@ public interface IColumnRenderer {
*
* @return comparator for this column
*/
- public Comparator<ITableItem> getComparator();
+ Comparator<ITableItem> getComparator();
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/ITableItem.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/ITableItem.java
index dbed41f0..0c0b2ca6 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/ITableItem.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/ITableItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -24,6 +24,6 @@ public interface ITableItem extends ILinkable {
*
* @return node data
*/
- public ICoverageNode getNode();
+ ICoverageNode getNode();
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/LabelColumn.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/LabelColumn.java
index 9ee258bc..27347fe9 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/LabelColumn.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/LabelColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/PercentageColumn.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/PercentageColumn.java
index f7b003f7..fa3f9c1c 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/PercentageColumn.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/PercentageColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/SortIndex.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/SortIndex.java
index 735628e1..e2d0324d 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/SortIndex.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/SortIndex.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/Table.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/Table.java
index f68917fc..f594dc0a 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/Table.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/Table.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/TableItemComparator.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/TableItemComparator.java
index 97e7af47..4912fb1d 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/TableItemComparator.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/TableItemComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -30,4 +30,4 @@ class TableItemComparator implements Comparator<ITableItem> {
return comparator.compare(i1.getNode(), i2.getNode());
}
-} \ No newline at end of file
+}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/package-info.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/package-info.java
index c784f360..9208e472 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* Internal: Sortable HTML table for coverage node elements.
*/
-package org.jacoco.report.internal.html.table; \ No newline at end of file
+package org.jacoco.report.internal.html.table;
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/xml/ReportElement.java b/org.jacoco.report/src/org/jacoco/report/internal/xml/ReportElement.java
new file mode 100644
index 00000000..65782d97
--- /dev/null
+++ b/org.jacoco.report/src/org/jacoco/report/internal/xml/ReportElement.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.report.internal.xml;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.jacoco.core.analysis.IClassCoverage;
+import org.jacoco.core.analysis.ICounter;
+import org.jacoco.core.analysis.ICoverageNode.CounterEntity;
+import org.jacoco.core.analysis.ILine;
+import org.jacoco.core.analysis.IMethodCoverage;
+import org.jacoco.core.data.SessionInfo;
+
+/**
+ * A {@link XMLElement} with utility methods to create JaCoCo XML reports.
+ */
+public class ReportElement extends XMLElement {
+
+ private static final String PUBID = "-//JACOCO//DTD Report 1.1//EN";
+
+ private static final String SYSTEM = "report.dtd";
+
+ /**
+ * Creates a <code>report</code> root element for a XML report.
+ *
+ * @param name
+ * value for the name attribute
+ * @param encoding
+ * character encoding used for output
+ * @param output
+ * output stream will be closed if the root element is closed
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public ReportElement(final String name, final OutputStream output,
+ final String encoding) throws IOException {
+ super("report", PUBID, SYSTEM, true, encoding, output);
+ attr("name", name);
+ }
+
+ private ReportElement(final String name, final ReportElement parent)
+ throws IOException {
+ super(name, parent);
+ }
+
+ @Override
+ public ReportElement element(final String name) throws IOException {
+ return new ReportElement(name, this);
+ }
+
+ private ReportElement namedElement(final String elementName,
+ final String name) throws IOException {
+ final ReportElement element = element(elementName);
+ element.attr("name", name);
+ return element;
+ }
+
+ /**
+ * Creates a 'sessioninfo' element.
+ *
+ * @param info
+ * info object to write out
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public void sessioninfo(final SessionInfo info) throws IOException {
+ final ReportElement sessioninfo = element("sessioninfo");
+ sessioninfo.attr("id", info.getId());
+ sessioninfo.attr("start", info.getStartTimeStamp());
+ sessioninfo.attr("dump", info.getDumpTimeStamp());
+ }
+
+ /**
+ * Creates a 'group' element.
+ *
+ * @param name
+ * value for the name attribute
+ * @return 'group' element
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public ReportElement group(final String name) throws IOException {
+ return namedElement("group", name);
+ }
+
+ /**
+ * Creates a 'package' element.
+ *
+ * @param name
+ * value for the name attribute
+ * @return 'package' element
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public ReportElement packageElement(final String name) throws IOException {
+ return namedElement("package", name);
+ }
+
+ /**
+ * Creates a 'class' element.
+ *
+ * @param coverage
+ * class coverage node to write out
+ * @return 'class' element
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public ReportElement classElement(final IClassCoverage coverage)
+ throws IOException {
+ final ReportElement element = namedElement("class", coverage.getName());
+ element.attr("sourcefilename", coverage.getSourceFileName());
+ return element;
+ }
+
+ /**
+ * Creates a 'method' element.
+ *
+ * @param coverage
+ * method coverage node to write out
+ * @return 'method' element
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public ReportElement method(final IMethodCoverage coverage)
+ throws IOException {
+ final ReportElement element = namedElement("method",
+ coverage.getName());
+ element.attr("desc", coverage.getDesc());
+ final int line = coverage.getFirstLine();
+ if (line != -1) {
+ element.attr("line", line);
+ }
+ return element;
+ }
+
+ /**
+ * Creates a 'sourcefile' element.
+ *
+ * @param name
+ * value for the name attribute
+ * @return 'sourcefile' element
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public ReportElement sourcefile(final String name) throws IOException {
+ return namedElement("sourcefile", name);
+ }
+
+ /**
+ * Creates a 'line' element.
+ *
+ * @param nr
+ * line number
+ * @param line
+ * line object to write out
+ *
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public void line(final int nr, final ILine line) throws IOException {
+ final ReportElement element = element("line");
+ element.attr("nr", nr);
+ counterAttributes(element, "mi", "ci", line.getInstructionCounter());
+ counterAttributes(element, "mb", "cb", line.getBranchCounter());
+ }
+
+ /**
+ * Creates a 'counter' element.
+ *
+ * @param counterEntity
+ * entity of this counter
+ *
+ * @param counter
+ * counter object to write out
+ *
+ * @throws IOException
+ * in case of problems with the underlying output
+ */
+ public void counter(final CounterEntity counterEntity,
+ final ICounter counter) throws IOException {
+ final ReportElement counterNode = element("counter");
+ counterNode.attr("type", counterEntity.name());
+ counterAttributes(counterNode, "missed", "covered", counter);
+ }
+
+ private static void counterAttributes(final XMLElement element,
+ final String missedattr, final String coveredattr,
+ final ICounter counter) throws IOException {
+ element.attr(missedattr, counter.getMissedCount());
+ element.attr(coveredattr, counter.getCoveredCount());
+ }
+
+}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLCoverageWriter.java b/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLCoverageWriter.java
index be326eca..7bf95af6 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLCoverageWriter.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLCoverageWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -30,27 +30,6 @@ import org.jacoco.core.analysis.ISourceNode;
public final class XMLCoverageWriter {
/**
- * Creates a child element with a name attribute.
- *
- * @param parent
- * parent element
- * @param tagname
- * name of the child tag
- * @param name
- * value of the name attribute
- * @return child element
- * @throws IOException
- * if XML can't be written to the underlying output
- *
- */
- public static XMLElement createChild(final XMLElement parent,
- final String tagname, final String name) throws IOException {
- final XMLElement child = parent.element(tagname);
- child.attr("name", name);
- return child;
- }
-
- /**
* Writes the structure of a given bundle.
*
* @param bundle
@@ -61,7 +40,7 @@ public final class XMLCoverageWriter {
* if XML can't be written to the underlying output
*/
public static void writeBundle(final IBundleCoverage bundle,
- final XMLElement element) throws IOException {
+ final ReportElement element) throws IOException {
for (final IPackageCoverage p : bundle.getPackages()) {
writePackage(p, element);
}
@@ -69,8 +48,8 @@ public final class XMLCoverageWriter {
}
private static void writePackage(final IPackageCoverage p,
- final XMLElement parent) throws IOException {
- final XMLElement element = createChild(parent, "package", p.getName());
+ final ReportElement parent) throws IOException {
+ final ReportElement element = parent.packageElement(p.getName());
for (final IClassCoverage c : p.getClasses()) {
writeClass(c, element);
}
@@ -81,8 +60,8 @@ public final class XMLCoverageWriter {
}
private static void writeClass(final IClassCoverage c,
- final XMLElement parent) throws IOException {
- final XMLElement element = createChild(parent, "class", c.getName());
+ final ReportElement parent) throws IOException {
+ final ReportElement element = parent.classElement(c);
for (final IMethodCoverage m : c.getMethods()) {
writeMethod(m, element);
}
@@ -90,20 +69,14 @@ public final class XMLCoverageWriter {
}
private static void writeMethod(final IMethodCoverage m,
- final XMLElement parent) throws IOException {
- final XMLElement element = createChild(parent, "method", m.getName());
- element.attr("desc", m.getDesc());
- final int line = m.getFirstLine();
- if (line != -1) {
- element.attr("line", line);
- }
+ final ReportElement parent) throws IOException {
+ final ReportElement element = parent.method(m);
writeCounters(m, element);
}
private static void writeSourceFile(final ISourceFileCoverage s,
- final XMLElement parent) throws IOException {
- final XMLElement element = createChild(parent, "sourcefile",
- s.getName());
+ final ReportElement parent) throws IOException {
+ final ReportElement element = parent.sourcefile(s.getName());
writeLines(s, element);
writeCounters(s, element);
}
@@ -119,39 +92,26 @@ public final class XMLCoverageWriter {
* if XML can't be written to the underlying output
*/
public static void writeCounters(final ICoverageNode node,
- final XMLElement parent) throws IOException {
+ final ReportElement parent) throws IOException {
for (final CounterEntity counterEntity : CounterEntity.values()) {
final ICounter counter = node.getCounter(counterEntity);
if (counter.getTotalCount() > 0) {
- final XMLElement counterNode = parent.element("counter");
- counterNode.attr("type", counterEntity.name());
- writeCounter(counterNode, "missed", "covered", counter);
- counterNode.close();
+ parent.counter(counterEntity, counter);
}
}
}
private static void writeLines(final ISourceNode source,
- final XMLElement parent) throws IOException {
+ final ReportElement parent) throws IOException {
final int last = source.getLastLine();
for (int nr = source.getFirstLine(); nr <= last; nr++) {
final ILine line = source.getLine(nr);
if (line.getStatus() != ICounter.EMPTY) {
- final XMLElement element = parent.element("line");
- element.attr("nr", nr);
- writeCounter(element, "mi", "ci", line.getInstructionCounter());
- writeCounter(element, "mb", "cb", line.getBranchCounter());
+ parent.line(nr, line);
}
}
}
- private static void writeCounter(final XMLElement element,
- final String missedattr, final String coveredattr,
- final ICounter counter) throws IOException {
- element.attr(missedattr, counter.getMissedCount());
- element.attr(coveredattr, counter.getCoveredCount());
- }
-
private XMLCoverageWriter() {
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLDocument.java b/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLDocument.java
deleted file mode 100644
index 99cae7e0..00000000
--- a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLDocument.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2018 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.report.internal.xml;
-
-import static java.lang.String.format;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-/**
- * Root element of an XML document. Each instance represents a separate output
- * document.
- *
- * @see XMLElement
- */
-public class XMLDocument extends XMLElement {
-
- /** XML header template */
- private static final String HEADER = "<?xml version=\"1.0\" encoding=\"%s\"?>";
-
- /** XML header template for standalone documents */
- private static final String HEADER_STANDALONE = "<?xml version=\"1.0\" encoding=\"%s\" standalone=\"yes\"?>";
-
- /** DOCTYPE declaration template */
- private static final String DOCTYPE = "<!DOCTYPE %s PUBLIC \"%s\" \"%s\">";
-
- /**
- * Writes a new document to the given writer. The document might contain a
- * document type declaration.
- *
- * @param rootnode
- * name of the root node
- * @param pubId
- * optional doctype identifier or <code>null</code>
- * @param system
- * system reference, required if doctype is given
- * @param encoding
- * encoding that will be specified in the header
- * @param standalone
- * <code>true</code> if this is a standalone document
- * @param writer
- * writer for content output
- * @throws IOException
- * in case of problems with the writer
- */
- public XMLDocument(final String rootnode, final String pubId,
- final String system, final String encoding,
- final boolean standalone, final Writer writer) throws IOException {
- super(writer, rootnode);
- writeHeader(rootnode, pubId, system, encoding, standalone, writer);
- beginOpenTag();
- }
-
- /**
- * Writes a new document to the given binary stream. The document might
- * contain a document type declaration.
- *
- * @param rootnode
- * name of the root node
- * @param pubId
- * optional doctype identifier or <code>null</code>
- * @param system
- * system reference, required if doctype is given
- * @param encoding
- * encoding of the XML document
- * @param standalone
- * <code>true</code> if this is a standalone document
- * @param output
- * output for content output
- * @throws IOException
- * in case of problems with the writer
- */
- public XMLDocument(final String rootnode, final String pubId,
- final String system, final String encoding,
- final boolean standalone, final OutputStream output)
- throws IOException {
- this(rootnode, pubId, system, encoding, standalone,
- new OutputStreamWriter(output, encoding));
- }
-
- @Override
- public void close() throws IOException {
- super.close();
- writer.close();
- }
-
- private static void writeHeader(final String rootnode, final String pubId,
- final String system, final String encoding,
- final boolean standalone, final Writer writer) throws IOException {
- if (standalone) {
- writer.write(format(HEADER_STANDALONE, encoding));
- } else {
- writer.write(format(HEADER, encoding));
- }
- if (pubId != null) {
- writer.write(format(DOCTYPE, rootnode, pubId, system));
- }
- }
-
-}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLElement.java b/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLElement.java
index 3b60a04e..c2da6bb5 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLElement.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -14,29 +14,26 @@ package org.jacoco.report.internal.xml;
import static java.lang.String.format;
import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
import java.io.Writer;
/**
- * Simple API to create well formed XML streams. A {@link XMLElement} instance
- * represents a single element in a XML document.
- *
- * @see XMLDocument
+ * Simple API to create well formed XML streams with minimal memory overhead. A
+ * {@link XMLElement} instance represents a single element in a XML document.
+ * {@link XMLElement} can be used directly or might be subclassed for schema
+ * specific convenience methods.
*/
public class XMLElement {
- private static final char SPACE = ' ';
+ /** XML header template */
+ private static final String HEADER = "<?xml version=\"1.0\" encoding=\"%s\"?>";
- private static final char EQ = '=';
+ /** XML header template for standalone documents */
+ private static final String HEADER_STANDALONE = "<?xml version=\"1.0\" encoding=\"%s\" standalone=\"yes\"?>";
- private static final char LT = '<';
-
- private static final char GT = '>';
-
- private static final char QUOT = '"';
-
- private static final char AMP = '&';
-
- private static final char SLASH = '/';
+ /** DOCTYPE declaration template */
+ private static final String DOCTYPE = "<!DOCTYPE %s PUBLIC \"%s\" \"%s\">";
/** Writer for content output */
protected final Writer writer;
@@ -49,51 +46,74 @@ public class XMLElement {
private XMLElement lastchild;
- /**
- * Creates a new element for a XML document.
- *
- * @param writer
- * all output will be written directly to this
- * @param name
- * element name
- */
- protected XMLElement(final Writer writer, final String name) {
+ private final boolean root;
+
+ private XMLElement(final Writer writer, final String name,
+ final boolean root) throws IOException {
this.writer = writer;
this.name = name;
this.openTagDone = false;
this.closed = false;
this.lastchild = null;
+ this.root = root;
}
/**
- * Emits the beginning of the open tag. This method has to be called before
- * other other methods are called on this element.
+ * Creates a root element of a XML document.
*
+ * @param name
+ * element name
+ * @param pubId
+ * optional schema public identifier
+ * @param system
+ * optional schema system identifier
+ * @param standalone
+ * if <code>true</code> the document is declared as standalone
+ * @param encoding
+ * character encoding used for output
+ * @param output
+ * output stream will be closed if the root element is closed
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
- protected void beginOpenTag() throws IOException {
- writer.write(LT);
- writer.write(name);
- }
-
- private void finishOpenTag() throws IOException {
- if (!openTagDone) {
- writer.append(GT);
- openTagDone = true;
+ public XMLElement(final String name, final String pubId,
+ final String system, final boolean standalone,
+ final String encoding, final OutputStream output)
+ throws IOException {
+ this(new OutputStreamWriter(output, encoding), name, true);
+ if (standalone) {
+ writer.write(format(HEADER_STANDALONE, encoding));
+ } else {
+ writer.write(format(HEADER, encoding));
}
+ if (pubId != null) {
+ writer.write(format(DOCTYPE, name, pubId, system));
+ }
+ writer.write('<');
+ writer.write(name);
}
/**
- * Adds the given child to this element. This will close all previous child
- * elements.
+ * Creates a new child element within a XML document. May only be called
+ * before the parent element has been closed.
*
- * @param child
- * child element to add
+ * @param name
+ * element name
+ * @param parent
+ * parent of this element
* @throws IOException
- * in case of invalid nesting or problems with the writer
+ * in case of problems with the underlying output or if the
+ * parent element is already closed
*/
- protected void addChildElement(final XMLElement child) throws IOException {
+ protected XMLElement(final String name, final XMLElement parent)
+ throws IOException {
+ this(parent.writer, name, false);
+ parent.addChildElement(this);
+ writer.write('<');
+ writer.write(name);
+ }
+
+ private void addChildElement(final XMLElement child) throws IOException {
if (closed) {
throw new IOException(format("Element %s already closed.", name));
}
@@ -101,25 +121,31 @@ public class XMLElement {
if (lastchild != null) {
lastchild.close();
}
- child.beginOpenTag();
lastchild = child;
}
+ private void finishOpenTag() throws IOException {
+ if (!openTagDone) {
+ writer.append('>');
+ openTagDone = true;
+ }
+ }
+
private void quote(final String text) throws IOException {
final int len = text.length();
for (int i = 0; i < len; i++) {
final char c = text.charAt(i);
switch (c) {
- case LT:
+ case '<':
writer.write("&lt;");
break;
- case GT:
+ case '>':
writer.write("&gt;");
break;
- case QUOT:
+ case '"':
writer.write("&quot;");
break;
- case AMP:
+ case '&':
writer.write("&amp;");
break;
default:
@@ -139,27 +165,25 @@ public class XMLElement {
* attribute name
* @param value
* attribute value or <code>null</code>
- *
- * @return this element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output or if the
+ * element is already closed.
*/
- public XMLElement attr(final String name, final String value)
+ public final void attr(final String name, final String value)
throws IOException {
if (value == null) {
- return this;
+ return;
}
if (closed || openTagDone) {
- throw new IOException(format("Element %s already closed.",
- this.name));
+ throw new IOException(
+ format("Element %s already closed.", this.name));
}
- writer.write(SPACE);
+ writer.write(' ');
writer.write(name);
- writer.write(EQ);
- writer.write(QUOT);
+ writer.write('=');
+ writer.write('"');
quote(value);
- writer.write(QUOT);
- return this;
+ writer.write('"');
}
/**
@@ -171,14 +195,13 @@ public class XMLElement {
* attribute name
* @param value
* attribute value
- *
- * @return this element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output or if the
+ * element is already closed.
*/
- public XMLElement attr(final String name, final int value)
+ public final void attr(final String name, final int value)
throws IOException {
- return attr(name, String.valueOf(value));
+ attr(name, String.valueOf(value));
}
/**
@@ -190,26 +213,26 @@ public class XMLElement {
* attribute name
* @param value
* attribute value
- *
- * @return this element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output or if the
+ * element is already closed.
*/
- public XMLElement attr(final String name, final long value)
+ public final void attr(final String name, final long value)
throws IOException {
- return attr(name, String.valueOf(value));
+ attr(name, String.valueOf(value));
}
/**
- * Adds the given text as a child to this node. The text will be quoted.
+ * Adds the given text as a child to this node. The text will be quoted. May
+ * only be called before this element has been closed.
*
* @param text
* text to add
- * @return this element
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output or if the
+ * element is already closed.
*/
- public XMLElement text(final String text) throws IOException {
+ public final void text(final String text) throws IOException {
if (closed) {
throw new IOException(format("Element %s already closed.", name));
}
@@ -218,45 +241,46 @@ public class XMLElement {
lastchild.close();
}
quote(text);
- return this;
}
/**
- * Creates a new child element for this element,
+ * Creates a new child element for this element. Might be overridden in
+ * subclasses to return a instance of the subclass.
*
* @param name
* name of the child element
* @return child element instance
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
public XMLElement element(final String name) throws IOException {
- final XMLElement element = new XMLElement(writer, name);
- addChildElement(element);
- return element;
+ return new XMLElement(name, this);
}
/**
* Closes this element if it has not been closed before.
*
* @throws IOException
- * in case of problems with the writer
+ * in case of problems with the underlying output
*/
- public void close() throws IOException {
+ public final void close() throws IOException {
if (!closed) {
if (lastchild != null) {
lastchild.close();
}
if (openTagDone) {
- writer.write(LT);
- writer.write(SLASH);
+ writer.write('<');
+ writer.write('/');
writer.write(name);
} else {
- writer.write(SLASH);
+ writer.write('/');
}
- writer.write(GT);
+ writer.write('>');
closed = true;
openTagDone = true;
+ if (root) {
+ writer.close();
+ }
}
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLGroupVisitor.java b/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLGroupVisitor.java
index e6795b7f..7f2b7d3f 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLGroupVisitor.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/xml/XMLGroupVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -25,7 +25,7 @@ import org.jacoco.report.internal.AbstractGroupVisitor;
public class XMLGroupVisitor extends AbstractGroupVisitor {
/** XML element of this group */
- protected final XMLElement element;
+ protected final ReportElement element;
/**
* New handler for a group with the given name.
@@ -38,7 +38,7 @@ public class XMLGroupVisitor extends AbstractGroupVisitor {
* @throws IOException
* in case of problems with the underlying writer
*/
- public XMLGroupVisitor(final XMLElement element, final String name)
+ public XMLGroupVisitor(final ReportElement element, final String name)
throws IOException {
super(name);
this.element = element;
@@ -47,14 +47,14 @@ public class XMLGroupVisitor extends AbstractGroupVisitor {
@Override
protected void handleBundle(final IBundleCoverage bundle,
final ISourceFileLocator locator) throws IOException {
- final XMLElement child = createChild(bundle.getName());
+ final ReportElement child = element.group(bundle.getName());
XMLCoverageWriter.writeBundle(bundle, child);
}
@Override
protected AbstractGroupVisitor handleGroup(final String name)
throws IOException {
- final XMLElement child = createChild(name);
+ final ReportElement child = element.group(name);
return new XMLGroupVisitor(child, name);
}
@@ -63,8 +63,4 @@ public class XMLGroupVisitor extends AbstractGroupVisitor {
XMLCoverageWriter.writeCounters(total, element);
}
- private XMLElement createChild(final String name) throws IOException {
- return XMLCoverageWriter.createChild(element, "group", name);
- }
-
}
diff --git a/org.jacoco.report/src/org/jacoco/report/package-info.java b/org.jacoco.report/src/org/jacoco/report/package-info.java
index b80a41de..64ed4dde 100644
--- a/org.jacoco.report/src/org/jacoco/report/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* Common interfaces and utilities for report generation.
*/
-package org.jacoco.report; \ No newline at end of file
+package org.jacoco.report;
diff --git a/org.jacoco.report/src/org/jacoco/report/xml/XMLFormatter.java b/org.jacoco.report/src/org/jacoco/report/xml/XMLFormatter.java
index baeba88c..a1fee86e 100644
--- a/org.jacoco.report/src/org/jacoco/report/xml/XMLFormatter.java
+++ b/org.jacoco.report/src/org/jacoco/report/xml/XMLFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -19,12 +19,11 @@ import java.util.List;
import org.jacoco.core.analysis.IBundleCoverage;
import org.jacoco.core.data.ExecutionData;
import org.jacoco.core.data.SessionInfo;
+import org.jacoco.report.IReportGroupVisitor;
import org.jacoco.report.IReportVisitor;
import org.jacoco.report.ISourceFileLocator;
-import org.jacoco.report.internal.AbstractGroupVisitor;
+import org.jacoco.report.internal.xml.ReportElement;
import org.jacoco.report.internal.xml.XMLCoverageWriter;
-import org.jacoco.report.internal.xml.XMLDocument;
-import org.jacoco.report.internal.xml.XMLElement;
import org.jacoco.report.internal.xml.XMLGroupVisitor;
/**
@@ -32,10 +31,6 @@ import org.jacoco.report.internal.xml.XMLGroupVisitor;
*/
public class XMLFormatter {
- private static final String PUBID = "-//JACOCO//DTD Report 1.0//EN";
-
- private static final String SYSTEM = "report.dtd";
-
private String outputEncoding = "UTF-8";
/**
@@ -59,15 +54,11 @@ public class XMLFormatter {
*/
public IReportVisitor createVisitor(final OutputStream output)
throws IOException {
- final XMLElement root = new XMLDocument("report", PUBID, SYSTEM,
- outputEncoding, true, output);
- class RootVisitor extends XMLGroupVisitor implements IReportVisitor {
-
- RootVisitor(final XMLElement element) throws IOException {
- super(element, null);
- }
+ class RootVisitor implements IReportVisitor {
+ private ReportElement report;
private List<SessionInfo> sessionInfos;
+ private XMLGroupVisitor groupVisitor;
public void visitInfo(final List<SessionInfo> sessionInfos,
final Collection<ExecutionData> executionData)
@@ -75,36 +66,35 @@ public class XMLFormatter {
this.sessionInfos = sessionInfos;
}
- @Override
- protected void handleBundle(final IBundleCoverage bundle,
+ public void visitBundle(final IBundleCoverage bundle,
final ISourceFileLocator locator) throws IOException {
- writeHeader(bundle.getName());
- XMLCoverageWriter.writeBundle(bundle, element);
+ createRootElement(bundle.getName());
+ XMLCoverageWriter.writeBundle(bundle, report);
}
- @Override
- protected AbstractGroupVisitor handleGroup(final String name)
+ public IReportGroupVisitor visitGroup(final String name)
throws IOException {
- writeHeader(name);
- return new XMLGroupVisitor(element, name);
+ createRootElement(name);
+ groupVisitor = new XMLGroupVisitor(report, name);
+ return groupVisitor;
}
- private void writeHeader(final String name) throws IOException {
- element.attr("name", name);
+ private void createRootElement(final String name)
+ throws IOException {
+ report = new ReportElement(name, output, outputEncoding);
for (final SessionInfo i : sessionInfos) {
- final XMLElement sessioninfo = root.element("sessioninfo");
- sessioninfo.attr("id", i.getId());
- sessioninfo.attr("start", i.getStartTimeStamp());
- sessioninfo.attr("dump", i.getDumpTimeStamp());
+ report.sessioninfo(i);
}
}
- @Override
- protected void handleEnd() throws IOException {
- element.close();
+ public void visitEnd() throws IOException {
+ if (groupVisitor != null) {
+ groupVisitor.visitEnd();
+ }
+ report.close();
}
}
- return new RootVisitor(root);
+ return new RootVisitor();
}
}
diff --git a/org.jacoco.report/src/org/jacoco/report/xml/package-info.java b/org.jacoco.report/src/org/jacoco/report/xml/package-info.java
index 92905ed7..9d9236aa 100644
--- a/org.jacoco.report/src/org/jacoco/report/xml/package-info.java
+++ b/org.jacoco.report/src/org/jacoco/report/xml/package-info.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * Copyright (c) 2009, 2019 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
@@ -13,4 +13,4 @@
/**
* XML report implementation.
*/
-package org.jacoco.report.xml; \ No newline at end of file
+package org.jacoco.report.xml;
diff --git a/org.jacoco.report/src/org/jacoco/report/xml/report.dtd b/org.jacoco.report/src/org/jacoco/report/xml/report.dtd
index 6ceab8b1..0e84bdf8 100644
--- a/org.jacoco.report/src/org/jacoco/report/xml/report.dtd
+++ b/org.jacoco.report/src/org/jacoco/report/xml/report.dtd
@@ -1,5 +1,5 @@
<!--
- Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ Copyright (c) 2009, 2019 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
@@ -13,7 +13,7 @@
<!-- This DTD describes the JaCoCo XML report format. It is identified by the
following identifiers:
- PUBID = "-//JACOCO//DTD Report 1.0//EN"
+ PUBID = "-//JACOCO//DTD Report 1.1//EN"
SYSTEM = "report.dtd"
-->
@@ -44,6 +44,8 @@
<!ELEMENT class (method*, counter*)>
<!-- fully qualified VM name -->
<!ATTLIST class name CDATA #REQUIRED>
+ <!-- name of the corresponding source file -->
+ <!ATTLIST class sourcefilename CDATA #IMPLIED>
<!-- representation of a method -->
<!ELEMENT method (counter*)>
@@ -79,4 +81,4 @@
<!-- number of missed items -->
<!ATTLIST counter missed CDATA #REQUIRED>
<!-- number of covered items -->
- <!ATTLIST counter covered CDATA #REQUIRED> \ No newline at end of file
+ <!ATTLIST counter covered CDATA #REQUIRED>