diff options
Diffstat (limited to 'org.jacoco.report/src/org/jacoco/report/internal/html')
34 files changed, 203 insertions, 219 deletions
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; |