diff --git a/.github/workflows/A-build-and-test-jdk11.yml b/.github/workflows/A-build-and-test-jdk11.yml index 32643b41..db7fc4c0 100644 --- a/.github/workflows/A-build-and-test-jdk11.yml +++ b/.github/workflows/A-build-and-test-jdk11.yml @@ -39,7 +39,6 @@ jobs: mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml - mvn --batch-mode install -Pworkspace-setup -f clover-jtreemap/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml - name: Download KTreemap fork diff --git a/.github/workflows/A-build-and-test-jdk17.yml b/.github/workflows/A-build-and-test-jdk17.yml index eb2f7c25..700455df 100644 --- a/.github/workflows/A-build-and-test-jdk17.yml +++ b/.github/workflows/A-build-and-test-jdk17.yml @@ -39,7 +39,6 @@ jobs: mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml - mvn --batch-mode install -Pworkspace-setup -f clover-jtreemap/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml - name: Download KTreemap fork diff --git a/.github/workflows/A-build-and-test-jdk21.yml b/.github/workflows/A-build-and-test-jdk21.yml index ddc66dd6..21c97491 100644 --- a/.github/workflows/A-build-and-test-jdk21.yml +++ b/.github/workflows/A-build-and-test-jdk21.yml @@ -39,7 +39,6 @@ jobs: mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml - mvn --batch-mode install -Pworkspace-setup -f clover-jtreemap/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml - name: Download KTreemap fork diff --git a/.github/workflows/A-build-and-test.yml b/.github/workflows/A-build-and-test.yml index 7fb24580..fe799d5d 100644 --- a/.github/workflows/A-build-and-test.yml +++ b/.github/workflows/A-build-and-test.yml @@ -39,7 +39,6 @@ jobs: mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml - mvn --batch-mode install -Pworkspace-setup -f clover-jtreemap/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml - name: Download KTreemap fork diff --git a/.github/workflows/B-combatibility-tests.yml b/.github/workflows/B-combatibility-tests.yml index 05afa924..3720276e 100644 --- a/.github/workflows/B-combatibility-tests.yml +++ b/.github/workflows/B-combatibility-tests.yml @@ -39,7 +39,6 @@ jobs: mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml - mvn --batch-mode install -Pworkspace-setup -f clover-jtreemap/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml - name: Download KTreemap fork diff --git a/.github/workflows/D-release-openclover.yml b/.github/workflows/D-release-openclover.yml index 9f66e132..10b269c6 100644 --- a/.github/workflows/D-release-openclover.yml +++ b/.github/workflows/D-release-openclover.yml @@ -34,7 +34,6 @@ jobs: mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml - mvn --batch-mode install -Pworkspace-setup -f clover-jtreemap/pom.xml mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml - name: Download KTreemap fork diff --git a/README.md b/README.md index bd537178..f4c66d34 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,6 @@ See also: mvn install -f clover-core-libs/jarjar/pom.xml mvn install -Pworkspace-setup -f clover-core-libs/pom.xml mvn install -Pworkspace-setup -f clover-eclipse-libs/pom.xml -mvn install -Pworkspace-setup -f clover-jtreemap/pom.xml mvn install -Pworkspace-setup -f clover-idea-libs/pom.xml ``` diff --git a/clover-all/pom.xml b/clover-all/pom.xml index 80f2ecaa..a98ce59b 100644 --- a/clover-all/pom.xml +++ b/clover-all/pom.xml @@ -61,60 +61,52 @@ - org.openclover - clover-annotations + org.jetbrains + annotations - org.openclover - clover-antlr + gnu.cajo + cajo - org.openclover - clover-cajo + commons-codec + commons-codec - org.openclover - clover-commons-codec + commons-collections + commons-collections - org.openclover - clover-commons-collections + commons-lang + commons-lang - org.openclover - clover-commons-lang + org.apache.commons + commons-lang3 - org.openclover - clover-commons-lang3 + it.unimi.dsi + fastutil - org.openclover - clover-fastutil + com.google.code.gson + gson - org.openclover - clover-gson + com.lowagie + itext - org.openclover - clover-itext + org.jfree + jcommon - org.openclover - clover-jcommon + jdom + jdom - org.openclover - clover-jdom - - - org.openclover - clover-jfreechart - - - org.openclover - clover-slf4j + org.jfree + jfreechart org.openclover @@ -130,6 +122,17 @@ + + + org.apache.maven.plugins + maven-jar-plugin + + + default-jar + none + + + @@ -220,6 +223,16 @@ junit-platform-launcher 1.9.2 + + antlr + antlr + 2.7.7 + + + org.slf4j + slf4j-api + 1.7.36 + annotations.* diff --git a/clover-all/src/assembly/clover-jar.xml b/clover-all/src/assembly/clover-jar.xml index b29bf481..c4f7c940 100644 --- a/clover-all/src/assembly/clover-jar.xml +++ b/clover-all/src/assembly/clover-jar.xml @@ -63,34 +63,6 @@ false - - . - - org.openclover:clover-annotations - org.openclover:clover-antlr - org.openclover:clover-cajo - org.openclover:clover-commons-codec - org.openclover:clover-commons-collections - org.openclover:clover-commons-lang - org.openclover:clover-commons-lang3 - org.openclover:clover-fastutil - org.openclover:clover-gson - org.openclover:clover-itext - org.openclover:clover-jcommon - org.openclover:clover-jdom - org.openclover:clover-jfreechart - org.openclover:clover-slf4j - org.openclover:clover-velocity - - true - - - licenses/*.TXT - LICENSE.txt - META-INF/MANIFEST.MF - - - diff --git a/clover-ant/pom.xml b/clover-ant/pom.xml index f2c4428d..fddde408 100644 --- a/clover-ant/pom.xml +++ b/clover-ant/pom.xml @@ -48,8 +48,8 @@ provided - org.openclover - clover-jdom + jdom + jdom test @@ -116,6 +116,46 @@ + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package-jar + package + + shade + + + + + org.apache.commons:commons-lang3 + + + + + org.apache.commons:commons-lang3 + + META-INF/LICENSE.txt + META-INF/MANIFEST.MF + META-INF/NOTICE.txt + + + + + + org.apache.commons.lang3 + clover.org.apache.commons.lang3 + + org.apache.commons.lang3.** + + + + + + + org.apache.maven.plugins diff --git a/clover-ant/src/main/java/org/openclover/ant/AntFileSetUtils.java b/clover-ant/src/main/java/org/openclover/ant/AntFileSetUtils.java index 3f13d4a3..8f9315b7 100644 --- a/clover-ant/src/main/java/org/openclover/ant/AntFileSetUtils.java +++ b/clover-ant/src/main/java/org/openclover/ant/AntFileSetUtils.java @@ -1,7 +1,7 @@ package org.openclover.ant; -import clover.org.apache.commons.lang3.ArrayUtils; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.PatternSet; diff --git a/clover-ant/src/main/java/org/openclover/ant/AntInstrUtils.java b/clover-ant/src/main/java/org/openclover/ant/AntInstrUtils.java index a8cce7ca..6f4f4c9d 100644 --- a/clover-ant/src/main/java/org/openclover/ant/AntInstrUtils.java +++ b/clover-ant/src/main/java/org/openclover/ant/AntInstrUtils.java @@ -1,6 +1,6 @@ package org.openclover.ant; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; diff --git a/clover-ant/src/main/java/org/openclover/ant/taskdefs/CloverCompilerAdapter.java b/clover-ant/src/main/java/org/openclover/ant/taskdefs/CloverCompilerAdapter.java index c337e04b..46787be2 100644 --- a/clover-ant/src/main/java/org/openclover/ant/taskdefs/CloverCompilerAdapter.java +++ b/clover-ant/src/main/java/org/openclover/ant/taskdefs/CloverCompilerAdapter.java @@ -1,6 +1,6 @@ package org.openclover.ant.taskdefs; -import clover.org.apache.commons.lang3.reflect.FieldUtils; +import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Javac; diff --git a/clover-ant/src/main/java/org/openclover/ant/tasks/AbstractInstrTask.java b/clover-ant/src/main/java/org/openclover/ant/tasks/AbstractInstrTask.java index 3304bd36..fae3a743 100644 --- a/clover-ant/src/main/java/org/openclover/ant/tasks/AbstractInstrTask.java +++ b/clover-ant/src/main/java/org/openclover/ant/tasks/AbstractInstrTask.java @@ -1,6 +1,6 @@ package org.openclover.ant.tasks; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.FileSet; import org.openclover.ant.AntCloverProfile; diff --git a/clover-ant/src/main/java/org/openclover/ci/AntIntegrator.java b/clover-ant/src/main/java/org/openclover/ci/AntIntegrator.java index 81fd1973..f87e94ab 100644 --- a/clover-ant/src/main/java/org/openclover/ci/AntIntegrator.java +++ b/clover-ant/src/main/java/org/openclover/ci/AntIntegrator.java @@ -4,8 +4,6 @@ import org.openclover.runtime.CloverNames; import org.openclover.runtime.Logger; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.List; /** @@ -73,14 +71,13 @@ private String addQuotesIfNecessary(String input) { } private static boolean isWindows() { - final String osName = AccessController.doPrivileged((PrivilegedAction) () -> { - try { - return System.getProperty("os.name"); - } catch (SecurityException ex) { - return null; - } - }); - return osName != null && osName.toLowerCase().indexOf("windows") == 0; + try { + final String osName = System.getProperty("os.name"); + return osName != null && osName.toLowerCase().indexOf("windows") == 0; + } catch (SecurityException ex) { + Logger.getInstance().debug("Unable to read os.name property"); + return false; + } } } diff --git a/clover-core-libs/cajo/pom.xml b/clover-core-libs/cajo/pom.xml new file mode 100644 index 00000000..ba1a2181 --- /dev/null +++ b/clover-core-libs/cajo/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + gnu.cajo + cajo + 1.117 + jar + + + LGPL v3 + http://java.net/projects/cajo/pages/Home + + + Cajo Library + + + + org.apache.maven.plugins + maven-resources-plugin + + true + + + + org.apache.maven.plugins + maven-jar-plugin + + true + + + + org.apache.maven.plugins + maven-install-plugin + + + default-install + none + + + install-file + install + + install-file + + + src/main/resources/cajo-1.117.jar + pom.xml + + + + + + + \ No newline at end of file diff --git a/clover-core-libs/clover-cajo/src/main/resources/cajo-1.117.jar b/clover-core-libs/cajo/src/main/resources/cajo-1.117.jar similarity index 100% rename from clover-core-libs/clover-cajo/src/main/resources/cajo-1.117.jar rename to clover-core-libs/cajo/src/main/resources/cajo-1.117.jar diff --git a/clover-core-libs/clover-cajo/src/main/resources/clover-cajo-src.jar b/clover-core-libs/cajo/src/main/resources/clover-cajo-src.jar similarity index 100% rename from clover-core-libs/clover-cajo/src/main/resources/clover-cajo-src.jar rename to clover-core-libs/cajo/src/main/resources/clover-cajo-src.jar diff --git a/clover-core-libs/clover-annotations/pom.xml b/clover-core-libs/clover-annotations/pom.xml deleted file mode 100644 index ffbe25a3..00000000 --- a/clover-core-libs/clover-annotations/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - clover-annotations - 13.0 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Note: this jar is not repackaged with 'clover.' prefix because we need original class names in order - to have code validation working in IDEA IDE. - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - IntelliJ Annotations - - - - workspace-setup - - clover-annotations-${project.version}.jar - - - - org.jetbrains - annotations - ${project.version} - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-antlr/pom.xml b/clover-core-libs/clover-antlr/pom.xml deleted file mode 100644 index 81bf0d37..00000000 --- a/clover-core-libs/clover-antlr/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - clover-antlr - 2.7.7 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - Public Domain - http://www.antlr2.org/license.html - - - OpenClover Antlr Library - - - - workspace-setup - - - antlr - antlr - ${project.version} - - - - clover-antlr-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-cajo/pom.xml b/clover-core-libs/clover-cajo/pom.xml deleted file mode 100644 index 83552777..00000000 --- a/clover-core-libs/clover-cajo/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - clover-cajo - 1.117 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - LGPL v3 - http://java.net/projects/cajo/pages/Home - - - OpenClover Cajo Library - - - - workspace-setup - - clover-cajo-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-commons-codec/pom.xml b/clover-core-libs/clover-commons-codec/pom.xml deleted file mode 100644 index 7d6e4949..00000000 --- a/clover-core-libs/clover-commons-codec/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - clover-commons-codec - 1.9 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - OpenClover Commons Codec Library - - - - workspace-setup - - - commons-codec - commons-codec - ${project.version} - - - - clover-commons-codec-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-commons-collections/pom.xml b/clover-core-libs/clover-commons-collections/pom.xml deleted file mode 100644 index b61bd66d..00000000 --- a/clover-core-libs/clover-commons-collections/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - 4.0.0 - clover-commons-collections - 3.2.2 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - OpenClover Commons Collections Library - - - - workspace-setup - - - commons-collections - commons-collections - ${project.version} - - - - clover-commons-collections-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-commons-lang/pom.xml b/clover-core-libs/clover-commons-lang/pom.xml deleted file mode 100644 index 0853df8a..00000000 --- a/clover-core-libs/clover-commons-lang/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - clover-commons-lang - 2.6 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - - - Repacked with 'clover.' prefix version of the library. - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - OpenClover Commons Lang Library - - - - workspace-setup - - - commons-lang - commons-lang - ${project.version} - - - - clover-commons-lang-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-commons-lang3/pom.xml b/clover-core-libs/clover-commons-lang3/pom.xml deleted file mode 100644 index bd3b397e..00000000 --- a/clover-core-libs/clover-commons-lang3/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - clover-commons-lang3 - 3.3.2 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - OpenClover Commons Lang3 Library - - - - workspace-setup - - - org.apache.commons - commons-lang3 - ${project.version} - - - - clover-commons-lang3-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-fastutil/pom.xml b/clover-core-libs/clover-fastutil/pom.xml deleted file mode 100644 index 202f4d46..00000000 --- a/clover-core-libs/clover-fastutil/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - clover-fastutil - 4.4.3 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - LGPL v2 - http://fastutil.dsi.unimi.it/ - - - OpenClover FastUtil Library - - - - workspace-setup - - clover-fastutil-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-gson/pom.xml b/clover-core-libs/clover-gson/pom.xml deleted file mode 100644 index 9cc902d1..00000000 --- a/clover-core-libs/clover-gson/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - clover-gson - 1.3 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - OpenClover GSON Library - - - - workspace-setup - - clover-gson-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-gson/src/main/resources/gson-1.3.jar b/clover-core-libs/clover-gson/src/main/resources/gson-1.3.jar deleted file mode 100644 index 39003fe1..00000000 Binary files a/clover-core-libs/clover-gson/src/main/resources/gson-1.3.jar and /dev/null differ diff --git a/clover-core-libs/clover-itext/pom.xml b/clover-core-libs/clover-itext/pom.xml deleted file mode 100644 index dbf8b40c..00000000 --- a/clover-core-libs/clover-itext/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - 4.0.0 - clover-itext - 2.0.1 - - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - LGPL - http://itextpdf.com - - - OpenClover iText Library - - - - workspace-setup - - - com.lowagie - itext - ${project.version} - - - - clover-itext-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-itext/readme.txt b/clover-core-libs/clover-itext/readme.txt deleted file mode 100644 index 7b143b9a..00000000 --- a/clover-core-libs/clover-itext/readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -DO NOT UPGRADE iText library to version newer than 2.1.7. - -This is the latest version which was released under LGPL license. All newer versions are released under Affero GPL v3, -which cannot be used in commercial software. - -When adding or upgrading third party libraries always check their licences. diff --git a/clover-core-libs/clover-jcommon/pom.xml b/clover-core-libs/clover-jcommon/pom.xml deleted file mode 100644 index 2be86e9f..00000000 --- a/clover-core-libs/clover-jcommon/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - 4.0.0 - clover-jcommon - 1.0.23 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - LGPL v3 - http://www.gnu.org/licenses/lgpl.html - - - OpenClover JCommon Library - - - - workspace-setup - - - org.jfree - jcommon - ${project.version} - - - - clover-jcommon-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-jdom/pom.xml b/clover-core-libs/clover-jdom/pom.xml deleted file mode 100644 index f3a176a3..00000000 --- a/clover-core-libs/clover-jdom/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - clover-jdom - 1.0 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - Apache 2.0 (with the acknowledgment clause removed) - http://www.jdom.org/docs/faq.html - - - OpenClover JDOM Library - - - - workspace-setup - - - jdom - jdom - ${project.version} - - - - clover-jdom-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-jfreechart/pom.xml b/clover-core-libs/clover-jfreechart/pom.xml deleted file mode 100644 index a13d39af..00000000 --- a/clover-core-libs/clover-jfreechart/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - 4.0.0 - clover-jfreechart - 1.0.19 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - LGPL v3 - http://www.gnu.org/licenses/lgpl.html - - - OpenClover JFreeChart Library - - - - workspace-setup - - - org.jfree - jfreechart - ${project.version} - - - - clover-jfreechart-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-slf4j/pom.xml b/clover-core-libs/clover-slf4j/pom.xml deleted file mode 100644 index 155ed4c6..00000000 --- a/clover-core-libs/clover-slf4j/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - clover-slf4j - 1.7.36 - jar - - org.openclover - clover-core-libs - 4.6.0-SNAPSHOT - ../pom.xml - - - Repacked with 'clover.' prefix version of the library. - - - - MIT - https://www.slf4j.org/license.html - - - OpenClover SLF4J Library - - - - workspace-setup - - - org.slf4j - slf4j-api - ${project.version} - - - - clover-slf4j-${project.version}.jar - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/clover-core-libs/clover-velocity/pom.xml b/clover-core-libs/clover-velocity/pom.xml index ed781bd4..72bead62 100644 --- a/clover-core-libs/clover-velocity/pom.xml +++ b/clover-core-libs/clover-velocity/pom.xml @@ -40,6 +40,15 @@ org.apache.maven.plugins maven-antrun-plugin + + + + com.tonicsystems + jarjar + 1.4 + + package @@ -75,10 +84,11 @@ - - - + + + + diff --git a/clover-core-libs/fastutil/pom.xml b/clover-core-libs/fastutil/pom.xml new file mode 100644 index 00000000..1b95fa0c --- /dev/null +++ b/clover-core-libs/fastutil/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + it.unimi.dsi + fastutil + 4.4.3 + jar + + org.openclover + clover-core-libs + 4.6.0-SNAPSHOT + ../pom.xml + + + + LGPL v2 + http://fastutil.dsi.unimi.it/ + + + FastUtil Library + + + + org.apache.maven.plugins + maven-resources-plugin + + true + + + + org.apache.maven.plugins + maven-jar-plugin + + true + + + + org.apache.maven.plugins + maven-install-plugin + + + default-install + none + + + install-file + install + + install-file + + + src/main/resources/fastutil-4.4.3.jar + pom.xml + + + + + + + \ No newline at end of file diff --git a/clover-core-libs/clover-fastutil/src/main/resources/fastutil-4.4.3.jar b/clover-core-libs/fastutil/src/main/resources/fastutil-4.4.3.jar similarity index 100% rename from clover-core-libs/clover-fastutil/src/main/resources/fastutil-4.4.3.jar rename to clover-core-libs/fastutil/src/main/resources/fastutil-4.4.3.jar diff --git a/clover-core-libs/pom.xml b/clover-core-libs/pom.xml index 6a70b9db..14e7a353 100644 --- a/clover-core-libs/pom.xml +++ b/clover-core-libs/pom.xml @@ -27,42 +27,10 @@ workspace-setup - clover-annotations - clover-antlr - clover-cajo - clover-commons-codec - clover-commons-collections - clover-commons-lang - clover-commons-lang3 - clover-fastutil - clover-gson - clover-itext - clover-jcommon - clover-jdom - clover-jfreechart - clover-slf4j + cajo + fastutil clover-velocity - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.8 - - - - com.tonicsystems - jarjar - 1.4 - - - - - - diff --git a/clover-core/pom.xml b/clover-core/pom.xml index 8c4ebe82..efda772c 100644 --- a/clover-core/pom.xml +++ b/clover-core/pom.xml @@ -51,54 +51,49 @@ - org.openclover - clover-annotations + org.jetbrains + annotations - org.openclover - clover-antlr + commons-collections + commons-collections - org.openclover - clover-commons-collections + commons-lang + commons-lang - org.openclover - clover-commons-lang + org.apache.commons + commons-lang3 - org.openclover - clover-commons-lang3 + it.unimi.dsi + fastutil - org.openclover - clover-fastutil + jdom + jdom - org.openclover - clover-gson + com.google.code.gson + gson - org.openclover - clover-itext + com.lowagie + itext - org.openclover - clover-jcommon + org.jfree + jcommon - org.openclover - clover-jfreechart + org.jfree + jfreechart org.openclover clover-velocity - - org.openclover - clover-cajo - test - edu.umd.cs.mtc @@ -228,7 +223,7 @@ java - clover.antlr.Tool + antlr.Tool -o ${project.build.directory}/src-generated/clover/org/codehaus/groovy/antlr/parser @@ -253,23 +248,23 @@ - - - - - + + - - + + - - + + - - - - - + + @@ -328,6 +323,212 @@ --> + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package-jar + package + + shade + + + + + antlr:antlr + org.jetbrains:annotations + commons-codec:commons-codec + commons-collections:commons-collections + commons-lang:commons-lang + org.apache.commons:commons-lang3 + it.unimi.dsi:fastutil + com.google.code.gson:gson + com.lowagie:itext + org.jfree:jcommon + jdom:jdom + org.jfree:jfreechart + org.openclover:clover-velocity + + + + + antlr:antlr + + META-INF/MANIFEST.MF + + + + commons-collections:commons-collections + + META-INF/LICENSE.txt + META-INF/MANIFEST.MF + META-INF/NOTICE.txt + + + + org.jetbrains:annotations + + org/jetbrains/annotations/** + + + + commons-lang:commons-lang + + META-INF/LICENSE.txt + META-INF/MANIFEST.MF + META-INF/NOTICE.txt + org/apache/commons/lang/enum/** + + + + org.apache.commons:commons-lang3 + + META-INF/LICENSE.txt + META-INF/MANIFEST.MF + META-INF/NOTICE.txt + + + + it.unimi.dsi:fastutil + + META-INF/MANIFEST.MF + **/booleans/** + **/shorts/** + **/floats/** + **/doubles/** + **/chars/**" + + + + com.lowagie:itext + + META-INF/MANIFEST.MF + build.xml + + + + com.google.code.gson:gson + + META-INF/MANIFEST.MF + **/assembly-descriptor.xml + + + + org.jfree:jcommon + + META-INF/MANIFEST.MF + + + + org.jfree:jfreechart + + META-INF/MANIFEST.MF + + + + jdom:jdom + + META-INF/MANIFEST.MF + + + + org.openclover:clover-velocity + + META-INF/MANIFEST.MF + + + + + + antlr + clover.antlr + + antlr.** + + + + com.google.gson + clover.com.google.gson + + com.google.gson.** + + + + com.lowagie + clover.com.lowagie + + com.lowagie.** + + + + + org.apache.commons.codec + clover.org.apache.commons.codec + + org.apache.commons.codec.** + + + + org.apache.commons.collections + clover.org.apache.commons.collections + + org.apache.commons.collections.** + + + + org.apache.commons.lang + clover.org.apache.commons.lang + + org.apache.commons.lang.** + + + + org.apache.commons.lang3 + clover.org.apache.commons.lang3 + + org.apache.commons.lang3.** + + + + org.jdom + clover.org.jdom + + org.jdom.** + + + + org.jfree + clover.org.jfree + + org.jfree.** + + + + it.unimi.dsi.fastutil + clover.it.unimi.dsi.fastutil + + it.unimi.dsi.fastutil.** + + + + + + + OpenClover Core + ${project.version} + OpenClover.org + ${project.version} + OpenClover.org + + + + + + + org.apache.maven.plugins diff --git a/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceAST.java b/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceAST.java index 3903b03b..31554b70 100644 --- a/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceAST.java +++ b/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceAST.java @@ -16,9 +16,9 @@ package clover.org.codehaus.groovy.antlr; -import clover.antlr.CommonAST; -import clover.antlr.Token; -import clover.antlr.collections.AST; +import antlr.CommonAST; +import antlr.Token; +import antlr.collections.AST; import java.util.List; diff --git a/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceToken.java b/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceToken.java index 622f8066..44a29df6 100644 --- a/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceToken.java +++ b/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/GroovySourceToken.java @@ -1,6 +1,6 @@ package clover.org.codehaus.groovy.antlr; -import clover.antlr.Token; +import antlr.Token; /* * Copyright 2003-2007 the original author or authors. diff --git a/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/parser/groovy.g b/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/parser/groovy.g index 544f9d1a..2c011c34 100644 --- a/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/parser/groovy.g +++ b/clover-core/src/main/java/clover/org/codehaus/groovy/antlr/parser/groovy.g @@ -7,11 +7,11 @@ import clover.org.codehaus.groovy.antlr.*; import java.util.*; import java.io.InputStream; import java.io.Reader; -import clover.antlr.InputBuffer; -import clover.antlr.LexerSharedInputState; -import clover.antlr.CommonToken; -import clover.antlr.TokenStream; -import clover.antlr.TokenStreamRecognitionException; +import antlr.InputBuffer; +import antlr.LexerSharedInputState; +import antlr.CommonToken; +import antlr.TokenStream; +import antlr.TokenStreamRecognitionException; import org.codehaus.groovy.GroovyBugError; import clover.org.codehaus.groovy.antlr.GroovySourceAST; import clover.org.codehaus.groovy.antlr.SourceBuffer; diff --git a/clover-core/src/main/java/org/openclover/core/CoverageDataCollator.java b/clover-core/src/main/java/org/openclover/core/CoverageDataCollator.java index a896b89c..7e78ed6f 100644 --- a/clover-core/src/main/java/org/openclover/core/CoverageDataCollator.java +++ b/clover-core/src/main/java/org/openclover/core/CoverageDataCollator.java @@ -1,6 +1,6 @@ package org.openclover.core; -import clover.org.apache.commons.lang3.mutable.MutableLong; +import org.apache.commons.lang3.mutable.MutableLong; import org.openclover.core.api.registry.TestCaseInfo; import org.openclover.core.recorder.GlobalCoverageRecordingTranscript; import org.openclover.core.recorder.PerTestRecordingTranscript; diff --git a/clover-core/src/main/java/org/openclover/core/PrematureLibraryLoader.java b/clover-core/src/main/java/org/openclover/core/PrematureLibraryLoader.java index b0c1dfa7..bcdb7f97 100644 --- a/clover-core/src/main/java/org/openclover/core/PrematureLibraryLoader.java +++ b/clover-core/src/main/java/org/openclover/core/PrematureLibraryLoader.java @@ -1,18 +1,16 @@ package org.openclover.core; -import clover.org.jfree.chart.ChartFactory; -import clover.org.jfree.chart.ChartUtilities; -import clover.org.jfree.chart.JFreeChart; -import clover.org.jfree.chart.plot.PlotOrientation; -import clover.org.jfree.data.xy.XYSeriesCollection; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.data.xy.XYSeriesCollection; import org.openclover.runtime.Logger; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.RandomAccessFile; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.concurrent.atomic.AtomicBoolean; /** @@ -52,32 +50,30 @@ public void write(int b) throws IOException { /*NO-OP*/ } } catch (Exception e) { //Ignore } - AccessController.doPrivileged((PrivilegedAction) () -> { + + try { + //libraries: security (secure random) + File tempFile = null; try { - //libraries: security (secure random) - File tempFile = null; - try { - Logger.getInstance().debug("Causing library \"security\" to be initialized"); - tempFile = File.createTempFile("clover", "init"); - } catch (IOException e) { - //Ignore - } - try { - //libraries: nio, net - if (tempFile != null) { - Logger.getInstance().debug("Causing libraries \"nio\" and \"net\" to be initialized"); - new RandomAccessFile(tempFile.getAbsolutePath(), "r").getChannel(); - } - } finally { - if (tempFile != null) { - tempFile.delete(); - } - } + Logger.getInstance().debug("Causing library \"security\" to be initialized"); + tempFile = File.createTempFile("clover", "init"); } catch (IOException e) { //Ignore } - return null; - }); + try { + //libraries: nio, net + if (tempFile != null) { + Logger.getInstance().debug("Causing libraries \"nio\" and \"net\" to be initialized"); + new RandomAccessFile(tempFile.getAbsolutePath(), "r").getChannel(); + } + } finally { + if (tempFile != null) { + tempFile.delete(); + } + } + } catch (IOException e) { + //Ignore + } } catch (Exception e) { Logger.getInstance().warn("Failed to prematurely load security, nio, net, awt, fontmanager, jpeg or cmm libraries", e); } @@ -88,7 +84,12 @@ public void write(int b) throws IOException { /*NO-OP*/ } } private static boolean isWindows() { - String osName = AccessController.doPrivileged((PrivilegedAction) () -> System.getProperty("os.name")); - return osName != null && osName.toLowerCase().indexOf("windows") == 0; + try { + final String osName = System.getProperty("os.name"); + return osName != null && osName.toLowerCase().indexOf("windows") == 0; + } catch (SecurityException ex) { + Logger.getInstance().debug("Unable to read os.name property"); + return false; + } } } diff --git a/clover-core/src/main/java/org/openclover/core/cmdline/CloverInstrArgProcessors.java b/clover-core/src/main/java/org/openclover/core/cmdline/CloverInstrArgProcessors.java index d6472677..bf06523f 100644 --- a/clover-core/src/main/java/org/openclover/core/cmdline/CloverInstrArgProcessors.java +++ b/clover-core/src/main/java/org/openclover/core/cmdline/CloverInstrArgProcessors.java @@ -1,6 +1,6 @@ package org.openclover.core.cmdline; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.openclover.core.api.command.ArgProcessor; import org.openclover.core.cfg.instr.MethodContextDef; import org.openclover.core.cfg.instr.StatementContextDef; diff --git a/clover-core/src/main/java/org/openclover/core/instr/java/CloverToken.java b/clover-core/src/main/java/org/openclover/core/instr/java/CloverToken.java index 1c52e308..306992eb 100644 --- a/clover-core/src/main/java/org/openclover/core/instr/java/CloverToken.java +++ b/clover-core/src/main/java/org/openclover/core/instr/java/CloverToken.java @@ -10,7 +10,7 @@ public class CloverToken - extends clover.antlr.CommonHiddenStreamToken + extends antlr.CommonHiddenStreamToken { private CloverToken next; private CloverToken prev; diff --git a/clover-core/src/main/java/org/openclover/core/instr/java/CloverTokenStreamFilter.java b/clover-core/src/main/java/org/openclover/core/instr/java/CloverTokenStreamFilter.java index 367b7114..cf3406c4 100644 --- a/clover-core/src/main/java/org/openclover/core/instr/java/CloverTokenStreamFilter.java +++ b/clover-core/src/main/java/org/openclover/core/instr/java/CloverTokenStreamFilter.java @@ -1,10 +1,10 @@ package org.openclover.core.instr.java; -import clover.antlr.CharScanner; -import clover.antlr.CommonHiddenStreamToken; -import clover.antlr.Token; -import clover.antlr.TokenStreamException; -import clover.antlr.TokenStreamHiddenTokenFilter; +import antlr.CharScanner; +import antlr.CommonHiddenStreamToken; +import antlr.Token; +import antlr.TokenStreamException; +import antlr.TokenStreamHiddenTokenFilter; import org.jetbrains.annotations.NotNull; import org.openclover.core.Contract; import org.openclover.core.api.instrumentation.InstrumentationSession; @@ -29,7 +29,7 @@ * methods to insert instrumenting tokens into that list. * * @version 1.0 - * @see clover.antlr.TokenStreamHiddenTokenFilter + * @see antlr.TokenStreamHiddenTokenFilter */ public class CloverTokenStreamFilter extends TokenStreamHiddenTokenFilter { @@ -77,7 +77,7 @@ public static void guardAgainstDoubleInstrumentation(File orig, BufferedReader b * * @param filePath path to original source, for reporting errors * @param input the CharScanner to pull tokens from - * @see clover.antlr.TokenStreamHiddenTokenFilter + * @see antlr.TokenStreamHiddenTokenFilter */ public CloverTokenStreamFilter(String filePath, CharScanner input) { super(input); diff --git a/clover-core/src/main/java/org/openclover/core/instr/java/Instrumenter.java b/clover-core/src/main/java/org/openclover/core/instr/java/Instrumenter.java index 83ba8710..259570a0 100644 --- a/clover-core/src/main/java/org/openclover/core/instr/java/Instrumenter.java +++ b/clover-core/src/main/java/org/openclover/core/instr/java/Instrumenter.java @@ -1,8 +1,8 @@ package org.openclover.core.instr.java; -import clover.antlr.RecognitionException; -import clover.antlr.TokenStreamException; -import clover.antlr.TokenStreamRecognitionException; +import antlr.RecognitionException; +import antlr.TokenStreamException; +import antlr.TokenStreamRecognitionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.openclover.core.api.instrumentation.ConcurrentInstrumentationException; diff --git a/clover-core/src/main/java/org/openclover/core/instr/java/TokenListUtil.java b/clover-core/src/main/java/org/openclover/core/instr/java/TokenListUtil.java index db2dd27f..d9312a0f 100644 --- a/clover-core/src/main/java/org/openclover/core/instr/java/TokenListUtil.java +++ b/clover-core/src/main/java/org/openclover/core/instr/java/TokenListUtil.java @@ -1,6 +1,6 @@ package org.openclover.core.instr.java; -import clover.antlr.CommonHiddenStreamToken; +import antlr.CommonHiddenStreamToken; import java.util.Collections; import java.util.List; diff --git a/clover-core/src/main/java/org/openclover/core/io/tags/TaggedIO.java b/clover-core/src/main/java/org/openclover/core/io/tags/TaggedIO.java index 284954bc..f3422bf3 100644 --- a/clover-core/src/main/java/org/openclover/core/io/tags/TaggedIO.java +++ b/clover-core/src/main/java/org/openclover/core/io/tags/TaggedIO.java @@ -11,8 +11,6 @@ import java.io.IOException; import java.nio.channels.Channels; import java.nio.channels.FileChannel; -import java.security.AccessController; -import java.security.PrivilegedAction; public class TaggedIO { private static final boolean DEBUG; @@ -21,8 +19,7 @@ public class TaggedIO { static { boolean shouldDebug = false; try { - shouldDebug = Logger.isDebug() && AccessController.doPrivileged((PrivilegedAction) () -> - Boolean.getBoolean(CloverNames.PROP_LOGGING_TAGGED_IO)); + shouldDebug = Logger.isDebug() && Boolean.getBoolean(CloverNames.PROP_LOGGING_TAGGED_IO); } catch (Exception e) { Logger.getInstance().warn("Unable to query if tagged IO should be logged", e); } diff --git a/clover-core/src/main/java/org/openclover/core/optimization/Snapshot.java b/clover-core/src/main/java/org/openclover/core/optimization/Snapshot.java index d430a6c9..7f7fbe9a 100644 --- a/clover-core/src/main/java/org/openclover/core/optimization/Snapshot.java +++ b/clover-core/src/main/java/org/openclover/core/optimization/Snapshot.java @@ -1,7 +1,7 @@ package org.openclover.core.optimization; -import clover.it.unimi.dsi.fastutil.objects.Object2LongMap; -import clover.it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2LongMap; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; import org.openclover.core.CloverDatabase; import org.openclover.core.CoverageDataSpec; import org.openclover.core.api.registry.FileInfo; diff --git a/clover-core/src/main/java/org/openclover/core/recorder/InMemPerTestCoverage.java b/clover-core/src/main/java/org/openclover/core/recorder/InMemPerTestCoverage.java index 4555bce1..98aa7a74 100644 --- a/clover-core/src/main/java/org/openclover/core/recorder/InMemPerTestCoverage.java +++ b/clover-core/src/main/java/org/openclover/core/recorder/InMemPerTestCoverage.java @@ -1,7 +1,7 @@ package org.openclover.core.recorder; -import clover.it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import clover.it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.openclover.core.api.registry.TestCaseInfo; import org.openclover.core.registry.Clover2Registry; import org.openclover.core.api.registry.CoverageDataRange; diff --git a/clover-core/src/main/java/org/openclover/core/recorder/SamplingPerTestCoverage.java b/clover-core/src/main/java/org/openclover/core/recorder/SamplingPerTestCoverage.java index 046d8fbd..dddf2f52 100644 --- a/clover-core/src/main/java/org/openclover/core/recorder/SamplingPerTestCoverage.java +++ b/clover-core/src/main/java/org/openclover/core/recorder/SamplingPerTestCoverage.java @@ -1,10 +1,10 @@ package org.openclover.core.recorder; -import clover.it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import clover.it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import clover.it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap; -import clover.it.unimi.dsi.fastutil.ints.Int2ObjectSortedMap; -import clover.it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectSortedMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; import org.openclover.core.CoverageDataSpec; import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.MethodInfo; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/ExpressionEvaluator.java b/clover-core/src/main/java/org/openclover/core/reporters/ExpressionEvaluator.java index 2dece551..75d659e0 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/ExpressionEvaluator.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/ExpressionEvaluator.java @@ -1,8 +1,8 @@ package org.openclover.core.reporters; -import clover.antlr.CommonAST; -import clover.antlr.RecognitionException; -import clover.antlr.TokenStreamException; +import antlr.CommonAST; +import antlr.RecognitionException; +import antlr.TokenStreamException; import org.openclover.core.api.registry.BlockMetrics; import org.openclover.runtime.Logger; import org.openclover.runtime.api.CloverException; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/column.g b/clover-core/src/main/java/org/openclover/core/reporters/column.g index a2a8d140..dbbe4c6a 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/column.g +++ b/clover-core/src/main/java/org/openclover/core/reporters/column.g @@ -3,6 +3,7 @@ header { package org.openclover.core.reporters; import org.openclover.core.api.registry.BlockMetrics; +import org.openclover.runtime.api.CloverException; } @@ -80,6 +81,26 @@ options { defaultErrorHandler=false; } +{ + // wrappers to hide AST class as it's being repacked + + public void validate(CalcParser calcParser) throws CloverException { + try { + validate(calcParser.getAST()); + } catch (RecognitionException ex) { + throw new CloverException(ex); + } + } + + public double expr(CalcParser calcParser, BlockMetrics metrics) throws CloverException { + try { + return expr(calcParser.getAST(), metrics); + } catch (RecognitionException ex) { + throw new CloverException(ex); + } + } +} + expr [BlockMetrics m] returns [double r] { double a,b; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlRenderingSupportImpl.java b/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlRenderingSupportImpl.java index b9f5d02b..710f25f3 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlRenderingSupportImpl.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlRenderingSupportImpl.java @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html; -import clover.org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.StringEscapeUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.openclover.core.CoverageData; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlReporter.java b/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlReporter.java index 1cce675f..776dc747 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlReporter.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/HtmlReporter.java @@ -1,10 +1,10 @@ package org.openclover.core.reporters.html; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils; import clover.org.apache.velocity.VelocityContext; -import clover.org.jfree.chart.ChartRenderingInfo; -import clover.org.jfree.chart.ChartUtilities; -import clover.org.jfree.chart.JFreeChart; +import org.jfree.chart.ChartRenderingInfo; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; import org.jetbrains.annotations.NotNull; import org.openclover.core.api.command.ArgProcessor; import org.openclover.core.api.command.HelpBuilder; @@ -36,7 +36,6 @@ import org.openclover.core.util.CloverExecutors; import org.openclover.core.util.CloverUtils; import org.openclover.core.util.FileUtils; -import org.openclover.core.util.format.HtmlFormatter; import org.openclover.runtime.Logger; import org.openclover.runtime.api.CloverException; import org_openclover_runtime.CloverVersionInfo; @@ -503,7 +502,7 @@ private void renderProjectCoverageCloudPage(TreeInfo appCloudTree, CloverExecuto private void renderProjectTreeMapPage(CloverExecutor service) throws Exception { VelocityContext context = new VelocityContext(); insertCommonPropsForCurrent(context, ""); - service.submit(new RenderTreeMapAction(context, reportConfig, basePath, getConfiguredModel())); + service.submit(new RenderTreeMapAction(context, basePath, getConfiguredModel())); } protected ProjectInfo getConfiguredModel() { diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderDashboardAction.java b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderDashboardAction.java index d547c19a..bb0beb0b 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderDashboardAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderDashboardAction.java @@ -2,9 +2,7 @@ import clover.org.apache.velocity.VelocityContext; import org.openclover.core.api.registry.ClassInfo; -import org.openclover.core.api.registry.ClassMetadata; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.registry.metrics.HasMetricsSupport; import org.openclover.core.reporters.Column; import org.openclover.core.reporters.Columns; @@ -57,7 +55,7 @@ protected File insertDashboardProperties() throws Exception { // get data required for dashboard if (Boolean.TRUE != mContext.get("skipCoverageTreeMap")) { // render the package level treemap - final RenderTreeMapAction tree = new RenderTreeMapAction(new VelocityContext(), reportConfig, mBasePath, mConfiguredInfo); + final RenderTreeMapAction tree = new RenderTreeMapAction(new VelocityContext(), mBasePath, mConfiguredInfo); tree.renderTreeMapJson("treemap-dash-json.js", "processTreeMapDashJson", false); } final List classes = mConfiguredInfo.getClasses(new TestClassCoverageThresholdFilter()); diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderFileAction.java b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderFileAction.java index 8ead773e..ba50ddff 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderFileAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderFileAction.java @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html; -import clover.antlr.TokenStreamException; +import antlr.TokenStreamException; import clover.org.apache.velocity.VelocityContext; import org.openclover.core.BitSetCoverageProvider; import org.openclover.core.CloverDatabase; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageSummaryAction.java b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageSummaryAction.java index aa3aacd4..77e00047 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageSummaryAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageSummaryAction.java @@ -4,7 +4,6 @@ import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.HasMetrics; import org.openclover.core.api.registry.PackageInfo; -import org.openclover.core.registry.entities.FullPackageInfo; import org.openclover.core.reporters.CloverReportConfig; import org.openclover.core.reporters.Column; import org.openclover.core.spi.reporters.html.source.HtmlRenderingSupport; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageTreeJsonAction.java b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageTreeJsonAction.java index 6d3a2d88..9147c194 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageTreeJsonAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderPackageTreeJsonAction.java @@ -3,7 +3,6 @@ import clover.org.apache.velocity.VelocityContext; import org.openclover.core.api.registry.PackageInfo; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.registry.metrics.HasMetricsSupport; import org.openclover.core.reporters.Current; import org.openclover.core.util.trie.PackagePrefixTree; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderProjectCoverageCloudsAction.java b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderProjectCoverageCloudsAction.java index 66837f75..b7b24915 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderProjectCoverageCloudsAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderProjectCoverageCloudsAction.java @@ -3,7 +3,6 @@ import clover.org.apache.velocity.VelocityContext; import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.registry.metrics.HasMetricsSupport; import org.openclover.core.reporters.CloverReportConfig; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderTestResultAction.java b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderTestResultAction.java index 8af9acff..a98b44db 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/RenderTestResultAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/RenderTestResultAction.java @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils; import clover.org.apache.velocity.VelocityContext; import org.openclover.core.BitSetCoverageProvider; import org.openclover.core.CloverDatabase; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/source/SourceRenderHelper.java b/clover-core/src/main/java/org/openclover/core/reporters/html/source/SourceRenderHelper.java index 4cd87f59..b5eb1100 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/source/SourceRenderHelper.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/source/SourceRenderHelper.java @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html.source; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils; import clover.org.apache.velocity.VelocityContext; import org.openclover.core.CloverDatabase; import org.openclover.core.api.registry.BranchInfo; @@ -10,7 +10,6 @@ import org.openclover.core.api.registry.SourceInfo; import org.openclover.core.api.registry.CoverageDataProvider; import org.openclover.core.api.registry.TestCaseInfo; -import org.openclover.core.registry.entities.FullFileInfo; import org.openclover.core.registry.entities.LineInfo; import org.openclover.core.reporters.Current; @@ -109,7 +108,7 @@ private void addWarning(VelocityContext context, String message) { * @param emptyCoverageChar the String to use when there is no coverage * @return each line with rendering info added * @throws java.io.IOException if an error occurs rendering this file page - * @throws clover.antlr.TokenStreamException + * @throws antlr.TokenStreamException * if an error occurs reading the source file */ public LineRenderInfo[] gatherSrcRenderInfo(VelocityContext vc, FileInfo finfo, ContextSet contextSet, diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/source/groovy/GroovySourceTraverser.java b/clover-core/src/main/java/org/openclover/core/reporters/html/source/groovy/GroovySourceTraverser.java index 966012b8..bafa176e 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/source/groovy/GroovySourceTraverser.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/source/groovy/GroovySourceTraverser.java @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html.source.groovy; -import clover.antlr.TokenStream; +import antlr.TokenStream; import clover.org.codehaus.groovy.antlr.GroovySourceToken; import clover.org.codehaus.groovy.antlr.parser.GroovyLexer; import clover.org.codehaus.groovy.antlr.parser.GroovyTokenTypes; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaHtmlSourceRenderer.java b/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaHtmlSourceRenderer.java index 6257d6ed..0c92fc65 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaHtmlSourceRenderer.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaHtmlSourceRenderer.java @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html.source.java; -import clover.org.apache.commons.collections.map.LazyMap; +import org.apache.commons.collections.map.LazyMap; import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.FileInfo; import org.openclover.core.api.registry.PackageInfo; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaTokenTraverser.java b/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaTokenTraverser.java index dd3bc584..a99050b9 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaTokenTraverser.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/html/source/java/JavaTokenTraverser.java @@ -1,7 +1,7 @@ package org.openclover.core.reporters.html.source.java; -import clover.antlr.Token; -import clover.antlr.TokenStreamException; +import antlr.Token; +import antlr.TokenStreamException; import org.openclover.core.api.registry.FileInfo; import org.openclover.core.cfg.instr.java.JavaInstrumentationConfig; import org.openclover.core.instr.java.JavaLexer; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderCloudsJSONAction.java b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderCloudsJSONAction.java index 8aabddb6..8af7b8ef 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderCloudsJSONAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderCloudsJSONAction.java @@ -4,8 +4,6 @@ import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.PackageInfo; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullPackageInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.api.registry.HasMetricsFilter; import org.openclover.core.registry.metrics.HasMetricsSupport; import org.openclover.core.reporters.CloverReportConfig; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderFileJSONAction.java b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderFileJSONAction.java index 47be64c1..55202c04 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderFileJSONAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderFileJSONAction.java @@ -4,9 +4,6 @@ import org.openclover.core.CloverDatabase; import org.openclover.core.api.registry.FileInfo; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullFileInfo; -import org.openclover.core.registry.entities.FullPackageInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.api.registry.HasMetricsFilter; import org.openclover.core.reporters.Current; import org.openclover.core.reporters.html.HtmlRenderingSupportImpl; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderMetricsJSONAction.java b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderMetricsJSONAction.java index 2da988ac..f738e1e3 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderMetricsJSONAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderMetricsJSONAction.java @@ -5,8 +5,6 @@ import org.openclover.core.api.registry.HasMetrics; import org.openclover.core.api.registry.PackageInfo; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullPackageInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.reporters.CloverReportConfig; import org.openclover.core.reporters.Columns; import org.openclover.core.reporters.html.HtmlRenderingSupportImpl; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderTreeMapAction.java b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderTreeMapAction.java index 4c2770e9..f279c0b4 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderTreeMapAction.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderTreeMapAction.java @@ -1,25 +1,11 @@ package org.openclover.core.reporters.json; -import clover.com.google.gson.Gson; -import clover.com.google.gson.GsonBuilder; import clover.org.apache.velocity.VelocityContext; -import org.openclover.core.api.registry.BlockMetrics; -import org.openclover.core.api.registry.ClassInfo; -import org.openclover.core.api.registry.HasMetrics; -import org.openclover.core.api.registry.HasMetricsFilter; -import org.openclover.core.api.registry.PackageInfo; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullClassInfo; -import org.openclover.core.reporters.CloverReportConfig; import org.openclover.core.reporters.html.HtmlRenderingSupportImpl; import org.openclover.core.reporters.html.HtmlReportUtil; import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; import java.util.concurrent.Callable; public class RenderTreeMapAction implements Callable { @@ -28,13 +14,11 @@ public class RenderTreeMapAction implements Callable { private final File outdir; private final VelocityContext mContext; private final HtmlRenderingSupportImpl renderSupport = new HtmlRenderingSupportImpl(); - private final CloverReportConfig reportConfig; - public RenderTreeMapAction(VelocityContext context, CloverReportConfig reportConfig, File outdir, ProjectInfo project) { + public RenderTreeMapAction(VelocityContext context, File outdir, ProjectInfo project) { this.project = project; this.outdir = outdir; this.mContext = context; - this.reportConfig = reportConfig; } /** @@ -63,7 +47,7 @@ public Object call() throws Exception { } public String renderTreeMapJson(String filename, String callback, boolean classLevel) throws Exception { - final String jsonStr = generateJson(classLevel); + final String jsonStr = RenderTreeMapJsonAction.generateJson(project, renderSupport, classLevel); mContext.put("callback", callback); mContext.put("json", jsonStr); HtmlReportUtil.mergeTemplateToFile(new File(outdir, filename), mContext, @@ -71,92 +55,4 @@ public String renderTreeMapJson(String filename, String callback, boolean classL return jsonStr; } - String generateJson(boolean classLevel) { - final Gson gson = new GsonBuilder().setPrettyPrinting().create(); - - final List pkgInfos = project.getAllPackages(); - - final List pkgNodes = new ArrayList<>(pkgInfos.size()); - - final Node projectNode = createNode(project.getDataIndex(), "", project, pkgNodes); - - for (final PackageInfo packageInfo : pkgInfos) { - final List classes = packageInfo.getClasses(HasMetricsFilter.ACCEPT_ALL); - // create a package node. - final List classesList = new ArrayList<>(classes.size()); - pkgNodes.add(createNode(packageInfo.getDataIndex(), packageInfo.getName(), packageInfo, classesList)); - - for (Iterator iterator = classes.iterator(); classLevel && iterator.hasNext(); ) { - final FullClassInfo classInfo = (FullClassInfo) iterator.next(); - // create a leaf node and add to the package's children list - final String path = classInfo.getContainingFile() != null ? - renderSupport.getSrcFileLink(true, true, classInfo).toString() : null; - classesList.add(createNode(classInfo.getDataIndex(), classInfo.getName(), classInfo, Collections.emptyList(), path)); // TreeMap requires the children:[] ele - } - } - - return gson.toJson(projectNode); - } - - private Node createNode(int index, String nodeName, HasMetrics hasMetrics, List children) { - return createNode(index, nodeName, hasMetrics, children, null); - } - - private Node createNode(int index, String nodeName, HasMetrics hasMetrics, List children, String path) { - final BlockMetrics metrics = hasMetrics.getMetrics(); - - final String pcStr = renderSupport.getPercentStr(metrics.getPcCoveredElements()); - final String title = String.format("%s %s Elements, %s Coverage", - nodeName, metrics.getNumElements(), pcStr); - - final Data data = new Data(metrics.getNumElements(), metrics.getPcCoveredElements() * 100f, path, title); - return new Node(hasMetrics.getName() + index , nodeName, data, children); - } - - - /** - * A class to model the json format required by Treemap-js - * - *
-     * var json = {
-     * "id": "aUniqueIdentifier",
-     * "name": "usually a nodes name",
-     * "data": {
-     *      "$area": 33, //some float value
-     *      "$color": 36, //-optional- some float value
-     *      "path": "/path/to/file.html",
-     *      "title": "ClassName NumElements, Coverage" // mouseover title.
-     *      },
-     * "children": [ 'other nodes or empty' ]
-     * };
-     * 
- * - */ - private static class Node { - final String id; - final String name; - final Data data; - final Collection children; - - private Node(String id, String name, Data data, Collection children) { - this.id = id; - this.name = name; - this.data = data; - this.children = children; - } - } - - private static class Data { - final float $area; - final float $color; - final String path; // path to src-file.html - final String title; // title for mouseover - - private Data(float area, float color, String path, String title) { - this.$area = area; - this.$color = color; - this.path = path; - this.title = title; - } - } } diff --git a/clover-core/src/main/java/org/openclover/core/reporters/json/RenderTreeMapJsonAction.java b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderTreeMapJsonAction.java new file mode 100644 index 00000000..7d81c8aa --- /dev/null +++ b/clover-core/src/main/java/org/openclover/core/reporters/json/RenderTreeMapJsonAction.java @@ -0,0 +1,112 @@ +package org.openclover.core.reporters.json; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import org.openclover.core.api.registry.BlockMetrics; +import org.openclover.core.api.registry.ClassInfo; +import org.openclover.core.api.registry.HasMetrics; +import org.openclover.core.api.registry.HasMetricsFilter; +import org.openclover.core.api.registry.PackageInfo; +import org.openclover.core.api.registry.ProjectInfo; +import org.openclover.core.registry.entities.FullClassInfo; +import org.openclover.core.reporters.html.HtmlRenderingSupportImpl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +public class RenderTreeMapJsonAction { + public static String generateJson(ProjectInfo project, HtmlRenderingSupportImpl renderSupport, boolean classLevel) { + final Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + final List pkgInfos = project.getAllPackages(); + + final List pkgNodes = new ArrayList<>(pkgInfos.size()); + + final Node projectNode = createNode(renderSupport, project.getDataIndex(), "", project, pkgNodes); + + for (final PackageInfo packageInfo : pkgInfos) { + final List classes = packageInfo.getClasses(HasMetricsFilter.ACCEPT_ALL); + // create a package node. + final List classesList = new ArrayList<>(classes.size()); + pkgNodes.add(createNode(renderSupport, packageInfo.getDataIndex(), packageInfo.getName(), packageInfo, classesList)); + + for (Iterator iterator = classes.iterator(); classLevel && iterator.hasNext(); ) { + final FullClassInfo classInfo = (FullClassInfo) iterator.next(); + // create a leaf node and add to the package's children list + final String path = classInfo.getContainingFile() != null ? + renderSupport.getSrcFileLink(true, true, classInfo).toString() : null; + classesList.add( + createNode( + renderSupport, classInfo.getDataIndex(), classInfo.getName(), classInfo, Collections.emptyList(), path)); // TreeMap requires the children:[] ele + } + } + + return gson.toJson(projectNode); + } + + private static Node createNode(HtmlRenderingSupportImpl renderSupport, int index, String nodeName, + HasMetrics hasMetrics, List children) { + return createNode(renderSupport, index, nodeName, hasMetrics, children, null); + } + + private static Node createNode(HtmlRenderingSupportImpl renderSupport, int index, String nodeName, + HasMetrics hasMetrics, List children, String path) { + final BlockMetrics metrics = hasMetrics.getMetrics(); + + final String pcStr = renderSupport.getPercentStr(metrics.getPcCoveredElements()); + final String title = String.format("%s %s Elements, %s Coverage", + nodeName, metrics.getNumElements(), pcStr); + + final Data data = new Data(metrics.getNumElements(), metrics.getPcCoveredElements() * 100f, path, title); + return new Node(hasMetrics.getName() + index , nodeName, data, children); + } + + /** + * A class to model the json format required by Treemap-js + * + *
+     * var json = {
+     * "id": "aUniqueIdentifier",
+     * "name": "usually a nodes name",
+     * "data": {
+     *      "$area": 33, //some float value
+     *      "$color": 36, //-optional- some float value
+     *      "path": "/path/to/file.html",
+     *      "title": "ClassName NumElements, Coverage" // mouseover title.
+     *      },
+     * "children": [ 'other nodes or empty' ]
+     * };
+     * 
+ * + */ + private static class Node { + final String id; + final String name; + final Data data; + final Collection children; + + private Node(String id, String name, Data data, Collection children) { + this.id = id; + this.name = name; + this.data = data; + this.children = children; + } + } + + private static class Data { + final float $area; + final float $color; + final String path; // path to src-file.html + final String title; // title for mouseover + + private Data(float area, float color, String path, String title) { + this.$area = area; + this.$color = color; + this.path = path; + this.title = title; + } + } +} diff --git a/clover-core/src/main/java/org/openclover/core/reporters/pdf/PDFReporter.java b/clover-core/src/main/java/org/openclover/core/reporters/pdf/PDFReporter.java index 4746b8c6..a4379b85 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/pdf/PDFReporter.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/pdf/PDFReporter.java @@ -1,9 +1,9 @@ package org.openclover.core.reporters.pdf; -import clover.com.lowagie.text.Document; -import clover.com.lowagie.text.DocumentException; -import clover.com.lowagie.text.Rectangle; -import clover.com.lowagie.text.pdf.PdfWriter; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfWriter; import org.openclover.core.CodeType; import org.openclover.core.api.command.ArgProcessor; import org.openclover.core.api.command.HelpBuilder; @@ -73,12 +73,12 @@ public class PDFReporter extends CloverReporter { join(mandatoryArgProcessors, optionalArgProcessors); - private static final Rectangle DEFAULT_PAGE_SIZE = clover.com.lowagie.text.PageSize.A4; + private static final Rectangle DEFAULT_PAGE_SIZE = com.lowagie.text.PageSize.A4; private static final Map SUPPORTED_PAGE_SIZES = newHashMap(); static { - SUPPORTED_PAGE_SIZES.put("A4", clover.com.lowagie.text.PageSize.A4); - SUPPORTED_PAGE_SIZES.put("LETTER", clover.com.lowagie.text.PageSize.LETTER); + SUPPORTED_PAGE_SIZES.put("A4", com.lowagie.text.PageSize.A4); + SUPPORTED_PAGE_SIZES.put("LETTER", com.lowagie.text.PageSize.LETTER); } private final Document document; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/pdf/PageFooterRenderer.java b/clover-core/src/main/java/org/openclover/core/reporters/pdf/PageFooterRenderer.java index 5a829be5..82328773 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/pdf/PageFooterRenderer.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/pdf/PageFooterRenderer.java @@ -1,19 +1,19 @@ package org.openclover.core.reporters.pdf; -import clover.com.lowagie.text.Chunk; -import clover.com.lowagie.text.Document; -import clover.com.lowagie.text.DocumentException; -import clover.com.lowagie.text.Font; -import clover.com.lowagie.text.FontFactory; -import clover.com.lowagie.text.Image; -import clover.com.lowagie.text.Phrase; -import clover.com.lowagie.text.Rectangle; -import clover.com.lowagie.text.pdf.BaseFont; -import clover.com.lowagie.text.pdf.PdfContentByte; -import clover.com.lowagie.text.pdf.PdfPTable; -import clover.com.lowagie.text.pdf.PdfPageEventHelper; -import clover.com.lowagie.text.pdf.PdfTemplate; -import clover.com.lowagie.text.pdf.PdfWriter; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Image; +import com.lowagie.text.Phrase; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.BaseFont; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfPageEventHelper; +import com.lowagie.text.pdf.PdfTemplate; +import com.lowagie.text.pdf.PdfWriter; import org.openclover.core.util.format.PDFFormatter; import org.openclover.runtime.util.Formatting; import org_openclover_runtime.CloverVersionInfo; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/pdf/RenderingSupport.java b/clover-core/src/main/java/org/openclover/core/reporters/pdf/RenderingSupport.java index 8ec21c68..056ebb19 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/pdf/RenderingSupport.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/pdf/RenderingSupport.java @@ -1,18 +1,18 @@ package org.openclover.core.reporters.pdf; -import clover.com.lowagie.text.Chunk; -import clover.com.lowagie.text.DocumentException; -import clover.com.lowagie.text.Element; -import clover.com.lowagie.text.Font; -import clover.com.lowagie.text.FontFactory; -import clover.com.lowagie.text.Phrase; -import clover.com.lowagie.text.Rectangle; -import clover.com.lowagie.text.pdf.DefaultFontMapper; -import clover.com.lowagie.text.pdf.PdfContentByte; -import clover.com.lowagie.text.pdf.PdfPTable; -import clover.com.lowagie.text.pdf.PdfPTableEvent; -import clover.com.lowagie.text.pdf.PdfTemplate; -import clover.org.jfree.chart.JFreeChart; +import com.lowagie.text.Chunk; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Phrase; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.DefaultFontMapper; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfPTableEvent; +import com.lowagie.text.pdf.PdfTemplate; +import org.jfree.chart.JFreeChart; import org.openclover.core.api.registry.BlockMetrics; import org.openclover.core.api.registry.HasMetrics; import org.openclover.core.api.registry.PackageInfo; diff --git a/clover-core/src/main/java/org/openclover/core/reporters/util/CloverChartFactory.java b/clover-core/src/main/java/org/openclover/core/reporters/util/CloverChartFactory.java index 4117fa0e..55d03463 100644 --- a/clover-core/src/main/java/org/openclover/core/reporters/util/CloverChartFactory.java +++ b/clover-core/src/main/java/org/openclover/core/reporters/util/CloverChartFactory.java @@ -1,30 +1,30 @@ package org.openclover.core.reporters.util; -import clover.org.jfree.chart.ChartFactory; -import clover.org.jfree.chart.ChartRenderingInfo; -import clover.org.jfree.chart.ChartUtilities; -import clover.org.jfree.chart.JFreeChart; -import clover.org.jfree.chart.StandardChartTheme; -import clover.org.jfree.chart.annotations.XYPointerAnnotation; -import clover.org.jfree.chart.axis.AxisLocation; -import clover.org.jfree.chart.axis.DateAxis; -import clover.org.jfree.chart.axis.LogarithmicAxis; -import clover.org.jfree.chart.axis.NumberAxis; -import clover.org.jfree.chart.axis.NumberTickUnit; -import clover.org.jfree.chart.axis.ValueAxis; -import clover.org.jfree.chart.labels.StandardXYToolTipGenerator; -import clover.org.jfree.chart.labels.XYToolTipGenerator; -import clover.org.jfree.chart.plot.PlotOrientation; -import clover.org.jfree.chart.plot.XYPlot; -import clover.org.jfree.chart.renderer.xy.XYBarRenderer; -import clover.org.jfree.chart.renderer.xy.XYItemRenderer; -import clover.org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; -import clover.org.jfree.chart.urls.XYURLGenerator; -import clover.org.jfree.data.xy.XYDataItem; -import clover.org.jfree.data.xy.XYDataset; -import clover.org.jfree.data.xy.XYSeries; -import clover.org.jfree.data.xy.XYSeriesCollection; -import clover.org.jfree.ui.RectangleInsets; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartRenderingInfo; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.StandardChartTheme; +import org.jfree.chart.annotations.XYPointerAnnotation; +import org.jfree.chart.axis.AxisLocation; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.axis.LogarithmicAxis; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.axis.NumberTickUnit; +import org.jfree.chart.axis.ValueAxis; +import org.jfree.chart.labels.StandardXYToolTipGenerator; +import org.jfree.chart.labels.XYToolTipGenerator; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.XYBarRenderer; +import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; +import org.jfree.chart.urls.XYURLGenerator; +import org.jfree.data.xy.XYDataItem; +import org.jfree.data.xy.XYDataset; +import org.jfree.data.xy.XYSeries; +import org.jfree.data.xy.XYSeriesCollection; +import org.jfree.ui.RectangleInsets; import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.FileInfo; import org.openclover.core.api.registry.HasMetrics; diff --git a/clover-core/src/main/java/org/openclover/core/util/FileUtils.java b/clover-core/src/main/java/org/openclover/core/util/FileUtils.java index ab73c9f6..40d79179 100644 --- a/clover-core/src/main/java/org/openclover/core/util/FileUtils.java +++ b/clover-core/src/main/java/org/openclover/core/util/FileUtils.java @@ -8,7 +8,6 @@ import java.io.BufferedReader; import java.io.DataInputStream; import java.io.File; -import java.io.FilePermission; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; @@ -18,16 +17,11 @@ import java.io.Reader; import java.io.Writer; import java.nio.file.Files; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.text.CharacterIterator; import java.text.StringCharacterIterator; import java.util.StringTokenizer; -/** - * - */ public class FileUtils { public static final String JAVA_IO_TMPDIR = "java.io.tmpdir"; @@ -55,13 +49,17 @@ public static synchronized FileUtils getInstance() { * @throws java.lang.RuntimeException if java.io.tmpdir is not set */ public static File getJavaTempDir() { - final String property = AccessController.doPrivileged((PrivilegedAction) () -> - System.getProperty(JAVA_IO_TMPDIR)); - if (property == null) { - throw new RuntimeException("The " + JAVA_IO_TMPDIR + - " system property is not set. Please ensure this property is set before executing OpenClover."); - } else { - return new File(property); + try { + final String property = System.getProperty(JAVA_IO_TMPDIR); + if (property == null) { + throw new RuntimeException("The " + JAVA_IO_TMPDIR + " system property is not set. " + + "Please ensure this property is set before executing OpenClover."); + } else { + return new File(property); + } + } catch (SecurityException ex) { + throw new RuntimeException("The " + JAVA_IO_TMPDIR + " system property could not be read. " + + "Please ensure access to system properties is allowed before executing OpenClover."); } } @@ -77,9 +75,6 @@ private static int calcFSResolution() { temp = File.createTempFile("clover_fs_rez_test", ".txt"); try { - //If we can't delete or create, let's not bother - AccessController.checkPermission(new FilePermission(temp.getAbsolutePath(), "delete")); - //Limit resolution inquiry to 1s, just in case while (rez <= 1000) { temp.setLastModified(rez); @@ -90,9 +85,7 @@ private static int calcFSResolution() { } return rez; } finally { - if (temp != null) { - temp.delete(); - } + temp.delete(); } } catch (Exception e) { //Assume 1s resolution in worst case (OSX & Win95) diff --git a/clover-core/src/main/java/org/openclover/core/util/format/PDFFormatter.java b/clover-core/src/main/java/org/openclover/core/util/format/PDFFormatter.java index c348d256..87b2bf45 100644 --- a/clover-core/src/main/java/org/openclover/core/util/format/PDFFormatter.java +++ b/clover-core/src/main/java/org/openclover/core/util/format/PDFFormatter.java @@ -1,9 +1,9 @@ package org.openclover.core.util.format; -import clover.com.lowagie.text.Chunk; -import clover.com.lowagie.text.Font; -import clover.com.lowagie.text.FontFactory; -import clover.com.lowagie.text.Phrase; +import com.lowagie.text.Chunk; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Phrase; import java.awt.Color; diff --git a/clover-core/src/test/groovy/org/openclover/core/JavaSyntaxCompilationTestBase.groovy b/clover-core/src/test/groovy/org/openclover/core/JavaSyntaxCompilationTestBase.groovy index a30097d4..856ed5b9 100644 --- a/clover-core/src/test/groovy/org/openclover/core/JavaSyntaxCompilationTestBase.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/JavaSyntaxCompilationTestBase.groovy @@ -1,6 +1,6 @@ package org.openclover.core -import clover.org.apache.commons.lang3.ArrayUtils +import org.apache.commons.lang3.ArrayUtils import org.apache.tools.ant.BuildEvent import org.apache.tools.ant.BuildListener import org.apache.tools.ant.Project diff --git a/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsInOrderMTC.groovy b/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsInOrderMTC.groovy index 7b00e3ff..e918ace2 100644 --- a/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsInOrderMTC.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsInOrderMTC.groovy @@ -36,7 +36,7 @@ import org_openclover_runtime.CoverageRecorder * TestC gets hits from time=3+5 = minimum C, maximum A+B+C * */ -public class RunTestsInOrderMTC extends RunTestsMTC { +class RunTestsInOrderMTC extends RunTestsMTC { /** Expected values */ public static boolean[] TEST_A_HITS = [ @@ -64,11 +64,11 @@ public class RunTestsInOrderMTC extends RunTestsMTC { private final CoverageRecorder coverageRecorder; - public RunTestsInOrderMTC(final CoverageRecorder coverageRecorder) { + RunTestsInOrderMTC(final CoverageRecorder coverageRecorder) { this.coverageRecorder = coverageRecorder; } - public void thread1() { + void thread1() { waitForTick(0); coverageRecorder.sliceStart("MyClass", 0L, TEST_A_ID, 0); @@ -80,7 +80,7 @@ public class RunTestsInOrderMTC extends RunTestsMTC { coverageRecorder.sliceEnd("MyClass", "MyClass.testA", "MyClass testA runtime name", 0L, TEST_A_ID, 0, 0, null); } - public void thread2() { + void thread2() { waitForTick(1); coverageRecorder.sliceStart("MyClass", 0L, TEST_B_ID, 0); @@ -96,7 +96,7 @@ public class RunTestsInOrderMTC extends RunTestsMTC { coverageRecorder.sliceEnd("MyClass", "MyClass.testB", "MyClass testB runtime name", 0L, TEST_B_ID, 0, 0, null); } - public void thread3() { + void thread3() { waitForTick(2); coverageRecorder.sliceStart("MyClass", 0L, TEST_C_ID, 0); @@ -114,7 +114,7 @@ public class RunTestsInOrderMTC extends RunTestsMTC { } @Override - public void assertPerTestHitCounts(final int testCaseNumber, final CloverBitSet perTestCoverage, CoverageAssertionAccuracy accuracy) { + void assertPerTestHitCounts(final int testCaseNumber, final CloverBitSet perTestCoverage, CoverageAssertionAccuracy accuracy) { boolean[] minimumHitMask, maximumHitMask; switch (testCaseNumber) { case TEST_A_ID: @@ -139,12 +139,12 @@ public class RunTestsInOrderMTC extends RunTestsMTC { } @Override - public void assertGlobalHitCounts(GlobalCoverageRecordingTranscript globalCoverage) { + void assertGlobalHitCounts(GlobalCoverageRecordingTranscript globalCoverage) { RecorderTestUtil.assertGlobalHitCounts("GLOBAL:", GLOBAL_HITS, globalCoverage); } @Override - public void assertGlobalAndPerTestRecordings(RecordingTranscripts.Filter filter) throws IOException { + void assertGlobalAndPerTestRecordings(RecordingTranscripts.Filter filter) throws IOException { for (RecordingTranscripts.FileRef file : filter.getCoverageRecordingFiles()) { final GlobalCoverageRecordingTranscript recording = (GlobalCoverageRecordingTranscript)file.read(new CoverageDataSpec()); assertGlobalHitCounts(recording); @@ -158,7 +158,7 @@ public class RunTestsInOrderMTC extends RunTestsMTC { } @Override - public void assertGlobalAndPerTestRecordingsInRange(RecordingTranscripts.Filter filter) throws IOException { + void assertGlobalAndPerTestRecordingsInRange(RecordingTranscripts.Filter filter) throws IOException { for (RecordingTranscripts.FileRef file : filter.getCoverageRecordingFiles()) { final GlobalCoverageRecordingTranscript recording = (GlobalCoverageRecordingTranscript)file.read(new CoverageDataSpec()); assertGlobalHitCounts(recording); diff --git a/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsMTC.groovy b/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsMTC.groovy index dcbe31ab..2a306a3b 100644 --- a/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsMTC.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsMTC.groovy @@ -6,10 +6,10 @@ import org.openclover.runtime.util.CloverBitSet /** * Base class for multi-threaded test cases */ -public abstract class RunTestsMTC extends MultithreadedTestCase { +abstract class RunTestsMTC extends MultithreadedTestCase { /** How accurate our assertions shall be */ - public static enum CoverageAssertionAccuracy { + static enum CoverageAssertionAccuracy { EXACT, // check for exact true/false values in a bitmask MIN_MAX // check using minimum and maximum boundary (subset and superset of a bitmask) } @@ -19,7 +19,7 @@ public abstract class RunTestsMTC extends MultithreadedTestCase { * @param args arrays to be or-ed * @return boolean[] output */ - public static boolean[] or(boolean[] ... args) { + static boolean[] or(boolean[] ... args) { // find the longest input array int maxLength = 0; for (boolean[] arg : args) { @@ -41,9 +41,12 @@ public abstract class RunTestsMTC extends MultithreadedTestCase { return c; } - public abstract void assertPerTestHitCounts(final int testCaseNumber, final CloverBitSet perTestCoverage, - CoverageAssertionAccuracy accuracy); - public abstract void assertGlobalHitCounts(GlobalCoverageRecordingTranscript globalCoverage); - public abstract void assertGlobalAndPerTestRecordings(RecordingTranscripts.Filter filter) throws IOException; - public abstract void assertGlobalAndPerTestRecordingsInRange(RecordingTranscripts.Filter filter) throws IOException; + abstract void assertPerTestHitCounts(final int testCaseNumber, final CloverBitSet perTestCoverage, + CoverageAssertionAccuracy accuracy); + + abstract void assertGlobalHitCounts(GlobalCoverageRecordingTranscript globalCoverage); + + abstract void assertGlobalAndPerTestRecordings(RecordingTranscripts.Filter filter) throws IOException; + + abstract void assertGlobalAndPerTestRecordingsInRange(RecordingTranscripts.Filter filter) throws IOException; } diff --git a/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsOutOfOrderMTC.groovy b/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsOutOfOrderMTC.groovy index 9a92a5a2..2ae0963c 100644 --- a/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsOutOfOrderMTC.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/recorder/RunTestsOutOfOrderMTC.groovy @@ -48,7 +48,7 @@ import org_openclover_runtime.CoverageRecorder * TestC will get hits from time=6+8 = minimum C, maximum A"+C * */ -public class RunTestsOutOfOrderMTC extends RunTestsMTC { +class RunTestsOutOfOrderMTC extends RunTestsMTC { /** Expected values */ public static boolean[] TEST_A3_HITS = [ @@ -82,11 +82,11 @@ public class RunTestsOutOfOrderMTC extends RunTestsMTC { private final CoverageRecorder coverageRecorder; - public RunTestsOutOfOrderMTC(final CoverageRecorder coverageRecorder) { + RunTestsOutOfOrderMTC(final CoverageRecorder coverageRecorder) { this.coverageRecorder = coverageRecorder; } - public void thread1() { + void thread1() { waitForTick(1); coverageRecorder.sliceStart("MyClass", 0, TEST_A_ID, 0); @@ -103,7 +103,7 @@ public class RunTestsOutOfOrderMTC extends RunTestsMTC { coverageRecorder.sliceEnd("MyClass", "MyClass.testA", "MyClass testA runtime name", 0, TEST_A_ID, 0, 0, null); } - public void thread2() { + void thread2() { waitForTick(2); coverageRecorder.sliceStart("MyClass", 0, TEST_B_ID, 0); @@ -117,7 +117,7 @@ public class RunTestsOutOfOrderMTC extends RunTestsMTC { coverageRecorder.sliceEnd("MyClass", "MyClass.testB", "MyClass testB runtime name", 0, TEST_B_ID, 0, 0, null); } - public void thread3() { + void thread3() { waitForTick(5); coverageRecorder.sliceStart("MyClass", 0, TEST_C_ID, 0); @@ -136,8 +136,8 @@ public class RunTestsOutOfOrderMTC extends RunTestsMTC { } @Override - public void assertPerTestHitCounts(final int testCaseNumber, final CloverBitSet perTestCoverage, - CoverageAssertionAccuracy accuracy) { + void assertPerTestHitCounts(final int testCaseNumber, final CloverBitSet perTestCoverage, + CoverageAssertionAccuracy accuracy) { boolean[] minimumHitMask, maximumHitMask; /* calculate expected minimum and maximum code coverage */ @@ -171,12 +171,12 @@ public class RunTestsOutOfOrderMTC extends RunTestsMTC { } @Override - public void assertGlobalHitCounts(GlobalCoverageRecordingTranscript globalCoverage) { + void assertGlobalHitCounts(GlobalCoverageRecordingTranscript globalCoverage) { RecorderTestUtil.assertGlobalHitCounts("GLOBAL:", GLOBAL_HITS, globalCoverage); } @Override - public void assertGlobalAndPerTestRecordings(RecordingTranscripts.Filter filter) throws IOException { + void assertGlobalAndPerTestRecordings(RecordingTranscripts.Filter filter) throws IOException { for (RecordingTranscripts.FileRef file : filter.getCoverageRecordingFiles()) { final GlobalCoverageRecordingTranscript recording = (GlobalCoverageRecordingTranscript)file.read(new CoverageDataSpec()); assertGlobalHitCounts(recording); @@ -190,7 +190,7 @@ public class RunTestsOutOfOrderMTC extends RunTestsMTC { } @Override - public void assertGlobalAndPerTestRecordingsInRange(RecordingTranscripts.Filter filter) throws IOException { + void assertGlobalAndPerTestRecordingsInRange(RecordingTranscripts.Filter filter) throws IOException { for (RecordingTranscripts.FileRef file : filter.getCoverageRecordingFiles()) { final GlobalCoverageRecordingTranscript recording = (GlobalCoverageRecordingTranscript)file.read(new CoverageDataSpec()); assertGlobalHitCounts(recording); diff --git a/clover-core/src/test/groovy/org/openclover/core/reporters/html/HtmlRenderingSupportTest.groovy b/clover-core/src/test/groovy/org/openclover/core/reporters/html/HtmlRenderingSupportTest.groovy index a9b234a8..46118261 100644 --- a/clover-core/src/test/groovy/org/openclover/core/reporters/html/HtmlRenderingSupportTest.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/reporters/html/HtmlRenderingSupportTest.groovy @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html -import clover.org.apache.commons.lang3.StringUtils +import org.apache.commons.lang3.StringUtils import org.junit.Before import org.junit.Test import org.openclover.core.api.registry.TestCaseInfo diff --git a/clover-core/src/test/groovy/org/openclover/core/reporters/html/source/java/JavaTokenTraverserTest.groovy b/clover-core/src/test/groovy/org/openclover/core/reporters/html/source/java/JavaTokenTraverserTest.groovy index d9906a27..be10e471 100644 --- a/clover-core/src/test/groovy/org/openclover/core/reporters/html/source/java/JavaTokenTraverserTest.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/reporters/html/source/java/JavaTokenTraverserTest.groovy @@ -1,6 +1,6 @@ package org.openclover.core.reporters.html.source.java -import clover.antlr.TokenStreamException +import antlr.TokenStreamException import org.junit.Test import org.openclover.core.util.UnicodeDecodingReader diff --git a/clover-core/src/test/groovy/org/openclover/core/reporters/json/RenderTreeMapActionTest.groovy b/clover-core/src/test/groovy/org/openclover/core/reporters/json/RenderTreeMapActionTest.groovy index f2eff180..a6ce7233 100644 --- a/clover-core/src/test/groovy/org/openclover/core/reporters/json/RenderTreeMapActionTest.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/reporters/json/RenderTreeMapActionTest.groovy @@ -41,7 +41,7 @@ class RenderTreeMapActionTest { final VelocityContext context = new VelocityContext() final CloverReportConfig reportConfig = new Current() reportConfig.setFormat(Format.DEFAULT_HTML) - final Callable action = new RenderTreeMapAction(context, reportConfig, tmpDir, project) + final Callable action = new RenderTreeMapAction(context, tmpDir, project) final String json = (String) action.call() // quick check of the json object structure @@ -58,26 +58,7 @@ class RenderTreeMapActionTest { assertEquals("callback name must match that in treemap.vm","processTreeMapJson", context.get("callback")) } - @Test - void testGenerateJson() throws Exception { - final ProjectInfo project = createMockProject() - - final VelocityContext context = new VelocityContext() - final CloverReportConfig reportConfig = new Current() - final RenderTreeMapAction action = new RenderTreeMapAction(context, reportConfig, tmpDir, project) - final String json = action.generateJson(false) - - // quick check of the json object structure - final JSONObject jsonObj = new JSONObject(json) - // check there is one package - final JSONArray pkgs = jsonObj.getJSONArray("children") - assertEquals(1, pkgs.length()) - // check there are no classes in that package - assertEquals(0, pkgs.getJSONObject(0).getJSONArray("children").length()) - - } - - private ProjectInfo createMockProject() { + protected ProjectInfo createMockProject() { // mock a Project final ProjectInfo project = mock(ProjectInfo.class) ProjectMetrics projMetrics = new ProjectMetrics(project) diff --git a/clover-core/src/test/groovy/org/openclover/core/reporters/json/RenderTreeMapJsonActionTest.groovy b/clover-core/src/test/groovy/org/openclover/core/reporters/json/RenderTreeMapJsonActionTest.groovy new file mode 100644 index 00000000..71f532b7 --- /dev/null +++ b/clover-core/src/test/groovy/org/openclover/core/reporters/json/RenderTreeMapJsonActionTest.groovy @@ -0,0 +1,26 @@ +package org.openclover.core.reporters.json + +import org.junit.Test +import org.openclover.core.api.registry.ProjectInfo +import org.openclover.core.reporters.html.HtmlRenderingSupportImpl + +import static org.junit.Assert.assertEquals + +class RenderTreeMapJsonActionTest extends RenderTreeMapActionTest { + + @Test + void testGenerateJson() throws Exception { + final ProjectInfo project = createMockProject() + final HtmlRenderingSupportImpl renderingSupport = new HtmlRenderingSupportImpl(); + final String json = RenderTreeMapJsonAction.generateJson(project, renderingSupport, false) + + // quick check of the json object structure + final JSONObject jsonObj = new JSONObject(json) + // check there is one package + final JSONArray pkgs = jsonObj.getJSONArray("children") + assertEquals(1, pkgs.length()) + // check there are no classes in that package + assertEquals(0, pkgs.getJSONObject(0).getJSONArray("children").length()) + } + +} diff --git a/clover-core/src/test/groovy/org/openclover/core/reporters/util/CloverChartFactoryTest.groovy b/clover-core/src/test/groovy/org/openclover/core/reporters/util/CloverChartFactoryTest.groovy index 50b07e1b..f4cf591c 100644 --- a/clover-core/src/test/groovy/org/openclover/core/reporters/util/CloverChartFactoryTest.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/reporters/util/CloverChartFactoryTest.groovy @@ -1,13 +1,13 @@ package org.openclover.core.reporters.util -import clover.org.jfree.chart.ChartFrame -import clover.org.jfree.chart.ChartPanel -import clover.org.jfree.chart.JFreeChart -import clover.org.jfree.chart.axis.DateAxis -import clover.org.jfree.chart.axis.LogarithmicAxis -import clover.org.jfree.chart.axis.NumberAxis -import clover.org.jfree.chart.plot.XYPlot -import clover.org.jfree.data.xy.XYDataset +import org.jfree.chart.ChartFrame +import org.jfree.chart.ChartPanel +import org.jfree.chart.JFreeChart +import org.jfree.chart.axis.DateAxis +import org.jfree.chart.axis.LogarithmicAxis +import org.jfree.chart.axis.NumberAxis +import org.jfree.chart.plot.XYPlot +import org.jfree.data.xy.XYDataset import groovy.transform.CompileStatic import junit.framework.TestCase import org.openclover.buildutil.testutils.IOHelper diff --git a/clover-core/src/test/groovy/org/openclover/core/util/UnicodeDecodingReaderTest.groovy b/clover-core/src/test/groovy/org/openclover/core/util/UnicodeDecodingReaderTest.groovy index 9dc8c74b..b0dd6af7 100644 --- a/clover-core/src/test/groovy/org/openclover/core/util/UnicodeDecodingReaderTest.groovy +++ b/clover-core/src/test/groovy/org/openclover/core/util/UnicodeDecodingReaderTest.groovy @@ -1,7 +1,7 @@ package org.openclover.core.util -import clover.antlr.Token -import clover.antlr.TokenStreamException +import antlr.Token +import antlr.TokenStreamException import org.junit.Test import org.openclover.core.cfg.instr.java.JavaInstrumentationConfig import org.openclover.core.cfg.instr.java.SourceLevel diff --git a/clover-eclipse/org.openclover.eclipse.core/pom.xml b/clover-eclipse/org.openclover.eclipse.core/pom.xml index 91316338..f69d6583 100644 --- a/clover-eclipse/org.openclover.eclipse.core/pom.xml +++ b/clover-eclipse/org.openclover.eclipse.core/pom.xml @@ -74,7 +74,7 @@ org.ow2.asm asm - 5.0.3 + 9.7 ${project.build.outputDirectory} diff --git a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/ui/editors/cloud/EclipseCloudGenerator.java b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/ui/editors/cloud/EclipseCloudGenerator.java index 3503229f..e689883c 100644 --- a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/ui/editors/cloud/EclipseCloudGenerator.java +++ b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/ui/editors/cloud/EclipseCloudGenerator.java @@ -5,7 +5,6 @@ import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.PackageInfo; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.reporters.CloudGenerator; import org.openclover.core.reporters.html.ClassInfoStatsCalculator; import org.openclover.core.reporters.html.HtmlReportUtil; @@ -14,9 +13,9 @@ import org.openclover.eclipse.core.CloverEclipsePluginMessages; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.nio.file.Files; import java.util.List; public class EclipseCloudGenerator { @@ -109,7 +108,7 @@ protected void createShallowReport( ClassInfoStatsCalculator calcAxis1, ClassInfoStatsCalculator calcAxis2) throws IOException { - try (OutputStream outputStream = new FileOutputStream(new File(dir, fileName))) { + try (OutputStream outputStream = Files.newOutputStream(new File(dir, fileName).toPath())) { final EclipseEditorLinkingHtmlRenderingSupport shallowAxisRender = new EclipseEditorLinkingHtmlRenderingSupport(offsetFromRoot + fileName); final CloudGenerator reportGenerator = createReportGenerator(pageTitle, outputStream, shallowAxisRender); reportGenerator.createReport(classes, calcAxis1, calcAxis2); @@ -125,7 +124,7 @@ protected void createDeepReport( ClassInfoStatsCalculator calcAxis1, ClassInfoStatsCalculator calcAxis2) throws IOException { - try (OutputStream outputStream = new FileOutputStream(new File(dir, AGGREGATE_PREFIX + fileName))) { + try (OutputStream outputStream = Files.newOutputStream(new File(dir, AGGREGATE_PREFIX + fileName).toPath())) { final EclipseEditorLinkingHtmlRenderingSupport deepAxisRender = new EclipseEditorLinkingHtmlRenderingSupport(offsetFromRoot + AGGREGATE_PREFIX + fileName); final CloudGenerator reportGenerator = createReportGenerator(pageTitle, outputStream, deepAxisRender); reportGenerator.createReport(classes, calcAxis1, calcAxis2); diff --git a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/CustomColumnDefinition.java b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/CustomColumnDefinition.java index 5c88f909..23ed4a41 100644 --- a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/CustomColumnDefinition.java +++ b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/CustomColumnDefinition.java @@ -1,11 +1,10 @@ package org.openclover.eclipse.core.views; -import clover.antlr.RecognitionException; -import clover.antlr.collections.AST; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Tree; import org.openclover.core.registry.metrics.BlockMetrics; +import org.openclover.core.reporters.CalcParser; import org.openclover.core.reporters.CalcTreeWalker; import org.openclover.core.reporters.ExpressionEvaluator; import org.openclover.core.util.MetricsFormatUtils; @@ -34,7 +33,7 @@ public static synchronized int nextIndex() { } private final String expression; - private final AST expressionAST; + private final CalcParser calcParser; private final CalcTreeWalker expressionWalker; private final int format; private final Comparator appOnlyComparator; @@ -45,16 +44,12 @@ public CustomColumnDefinition(String id, String title, String abbreviatedTitle, super(id, ANY_COLUMN, alignment, title, abbreviatedTitle, ""); this.format = (format == RAW_FORMAT || format == PC_FORMAT) ? format : RAW_FORMAT; this.expression = expression; - this.expressionAST = ExpressionEvaluator.parse(expression, title).getAST(); + this.calcParser = ExpressionEvaluator.parse(expression, title); this.expressionWalker = new CalcTreeWalker(); this.appOnlyComparator = new MyComparator(MetricsScope.APP_ONLY); this.testOnlyComparator = new MyComparator(MetricsScope.TEST_ONLY); this.fullComparator = new MyComparator(MetricsScope.FULL); - try { - this.expressionWalker.validate(this.expressionAST); - } catch (RecognitionException e) { - throw new CloverException(e); - } + this.expressionWalker.validate(calcParser); } public CustomColumnDefinition(String title, String abbreviatedTitle, String expression, int aligment, int format) throws CloverException { @@ -74,8 +69,8 @@ public boolean isCustom() { return true; } - public double calculate(BlockMetrics metrics) throws RecognitionException { - return new CalcTreeWalker().expr(expressionAST, metrics); + public double calculate(BlockMetrics metrics) throws CloverException { + return expressionWalker.expr(calcParser, metrics); } @Override @@ -101,10 +96,10 @@ public Number getValue(MetricsScope scope, Object element) { BlockMetrics metrics = scope.getMetricsFor(element); if (metrics != null) { try { - Double result = format == CustomColumnDefinition.RAW_FORMAT + double result = format == CustomColumnDefinition.RAW_FORMAT ? calculate(metrics) : calculate(metrics) / 100.0d; - return (result.isNaN() || result.isInfinite()) ? NOT_AVAILABLE_DOUBLE : result; + return (Double.isNaN(result) || Double.isInfinite(result)) ? NOT_AVAILABLE_DOUBLE : result; } catch (Exception e) { // swallow } diff --git a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/DashboardGenerator.java b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/DashboardGenerator.java index 4d3d9088..3d0a9346 100644 --- a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/DashboardGenerator.java +++ b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/DashboardGenerator.java @@ -111,5 +111,4 @@ private void copyStaticResource(final String aLoadPath, final String aName) thro final File outfile = new File(basePath, aName); FileUtils.resourceToFile(getClass().getClassLoader(), aLoadPath + "/" + aName, outfile); } - } diff --git a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/RenderEclipseDashboardAction.java b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/RenderEclipseDashboardAction.java index e869fe0e..49b4bbf0 100644 --- a/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/RenderEclipseDashboardAction.java +++ b/clover-eclipse/org.openclover.eclipse.core/src/main/java/org/openclover/eclipse/core/views/dashboard/RenderEclipseDashboardAction.java @@ -2,7 +2,6 @@ import clover.org.apache.velocity.VelocityContext; import org.openclover.core.api.registry.ProjectInfo; -import org.openclover.core.registry.entities.FullProjectInfo; import org.openclover.core.reporters.Current; import org.openclover.core.reporters.html.RenderDashboardAction; import org.openclover.core.reporters.util.CloverChartFactory.ChartInfo; diff --git a/clover-eclipse/workspace/com.cenqua.clover.core/.classpath b/clover-eclipse/workspace/com.cenqua.clover.core/.classpath index ef1e4a78..0ddad0c9 100644 --- a/clover-eclipse/workspace/com.cenqua.clover.core/.classpath +++ b/clover-eclipse/workspace/com.cenqua.clover.core/.classpath @@ -14,9 +14,7 @@ - - diff --git a/clover-groovy/pom.xml b/clover-groovy/pom.xml index 9d6a1cbb..56a475c5 100644 --- a/clover-groovy/pom.xml +++ b/clover-groovy/pom.xml @@ -125,7 +125,7 @@ org.ow2.asm asm - 4.1 + 9.7 antlr @@ -172,55 +172,51 @@ junit-jupiter-engine 5.9.3 - + - org.openclover - clover-annotations + org.jetbrains + annotations - org.openclover - clover-antlr + commons-collections + commons-collections - org.openclover - clover-commons-collections + commons-lang + commons-lang - org.openclover - clover-commons-lang + org.apache.commons + commons-lang3 - org.openclover - clover-commons-lang3 + it.unimi.dsi + fastutil - org.openclover - clover-fastutil + com.google.code.gson + gson - org.openclover - clover-gson + com.lowagie + itext - org.openclover - clover-itext + org.jfree + jcommon - org.openclover - clover-jcommon + org.jfree + jfreechart - org.openclover - clover-jfreechart + gnu.cajo + cajo org.openclover clover-velocity - - org.openclover - clover-cajo - @@ -278,6 +274,11 @@ org.apache.maven.plugins maven-jar-plugin + + + default-jar + none + create-tests-jar diff --git a/clover-groovy/src/test/groovy/org/openclover/groovy/instr/GroovySpockTestSuite.groovy b/clover-groovy/src/test/groovy/org/openclover/groovy/instr/GroovySpockTestSuite.groovy index ba1b296f..cb35dd80 100644 --- a/clover-groovy/src/test/groovy/org/openclover/groovy/instr/GroovySpockTestSuite.groovy +++ b/clover-groovy/src/test/groovy/org/openclover/groovy/instr/GroovySpockTestSuite.groovy @@ -34,7 +34,7 @@ class GroovySpockTestSuite // dependencies of groovy jar (older versions) private File commonsCliJar = new File(testDependenciesDir, "commons-cli-1.2.jar") - private File asmJar = new File(testDependenciesDir, "asm-4.1.jar") + private File asmJar = new File(testDependenciesDir, "asm-9.7.jar") private File antlrJar = new File(testDependenciesDir, "antlr-2.7.7.jar") static GroovySpockTestSuite suite() { return new GroovySpockTestSuite() } diff --git a/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestBase.groovy b/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestBase.groovy index 845f5234..e4e8b277 100644 --- a/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestBase.groovy +++ b/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestBase.groovy @@ -191,7 +191,8 @@ abstract class TestBase new File("target/test-dependencies").listFiles(new FileFilter() { @Override boolean accept(File pathname) { - return pathname.name.matches("clover-.*\\.jar") + // skip groovy/spock/junit as we will test with specific versions + return !pathname.name.matches("(groovy|spock|junit)-.*\\.jar") } }).toList() } diff --git a/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestSuite.groovy b/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestSuite.groovy index 61e15e1c..9b1a9451 100644 --- a/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestSuite.groovy +++ b/clover-groovy/src/test/groovy/org/openclover/groovy/instr/TestSuite.groovy @@ -32,7 +32,7 @@ class TestSuite } static File getAsmJar() { - new File("target/test-dependencies/asm-4.1.jar") + new File("target/test-dependencies/asm-9.7.jar") } static File getAntlrJar() { diff --git a/clover-idea/pom.xml b/clover-idea/pom.xml index a77872cd..eb11b299 100644 --- a/clover-idea/pom.xml +++ b/clover-idea/pom.xml @@ -34,9 +34,16 @@ - org.openclover - clover-jtreemap - 1.1.0 + net.sf.jtreemap + jtreemap + 1.1.3 + + + + org.projectlombok + lombok + + diff --git a/clover-idea/src/assembly/clover-idea-jar.xml b/clover-idea/src/assembly/clover-idea-jar.xml index 93e4896e..00b74ae2 100644 --- a/clover-idea/src/assembly/clover-idea-jar.xml +++ b/clover-idea/src/assembly/clover-idea-jar.xml @@ -11,7 +11,7 @@ . org.openclover:clover - org.openclover:clover-jtreemap + net.sf.jtreemap:jtreemap true diff --git a/clover-idea/src/main/java/org/openclover/idea/build/jps/CloverJavaSourceTransformer.java b/clover-idea/src/main/java/org/openclover/idea/build/jps/CloverJavaSourceTransformer.java index 42c5cb14..71801c00 100644 --- a/clover-idea/src/main/java/org/openclover/idea/build/jps/CloverJavaSourceTransformer.java +++ b/clover-idea/src/main/java/org/openclover/idea/build/jps/CloverJavaSourceTransformer.java @@ -1,7 +1,5 @@ package org.openclover.idea.build.jps; -import clover.antlr.RecognitionException; -import clover.antlr.TokenStreamException; import com.intellij.openapi.diagnostic.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.builders.java.JavaSourceTransformer; @@ -14,7 +12,6 @@ import org.openclover.core.instr.java.Instrumenter; import org.openclover.core.util.trie.Node; import org.openclover.idea.build.InclusionDetector; -import org.openclover.runtime.api.CloverException; import java.io.File; import java.io.FileOutputStream; @@ -106,7 +103,7 @@ public CharSequence transform(final File file, final CharSequence charSequence) debugTransform(file, charSequence, instrumentedCharSequence, level); return instrumentedCharSequence; - } catch (TokenStreamException | RecognitionException | IOException | CloverException ex) { + } catch (Exception ex) { throw new CloverInstrumentationException(ex); } } else { diff --git a/clover-idea/src/main/java/org/openclover/idea/report/treemap/ClassInfoValue.java b/clover-idea/src/main/java/org/openclover/idea/report/treemap/ClassInfoValue.java index 3d438410..a8291521 100644 --- a/clover-idea/src/main/java/org/openclover/idea/report/treemap/ClassInfoValue.java +++ b/clover-idea/src/main/java/org/openclover/idea/report/treemap/ClassInfoValue.java @@ -1,6 +1,6 @@ package org.openclover.idea.report.treemap; -import clover.net.sf.jtreemap.swing.ValuePercent; +import net.sf.jtreemap.swing.ValuePercent; import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.registry.entities.FullClassInfo; diff --git a/clover-idea/src/main/java/org/openclover/idea/report/treemap/GoToSourceMouseListener.java b/clover-idea/src/main/java/org/openclover/idea/report/treemap/GoToSourceMouseListener.java index f6acd599..a0bda85d 100644 --- a/clover-idea/src/main/java/org/openclover/idea/report/treemap/GoToSourceMouseListener.java +++ b/clover-idea/src/main/java/org/openclover/idea/report/treemap/GoToSourceMouseListener.java @@ -1,8 +1,8 @@ package org.openclover.idea.report.treemap; -import clover.net.sf.jtreemap.swing.JTreeMap; -import clover.net.sf.jtreemap.swing.TreeMapNode; -import clover.net.sf.jtreemap.swing.Value; +import net.sf.jtreemap.swing.JTreeMap; +import net.sf.jtreemap.swing.TreeMapNode; +import net.sf.jtreemap.swing.Value; import com.intellij.openapi.project.Project; import org.openclover.core.api.registry.BlockMetrics; import org.openclover.core.api.registry.ClassInfo; diff --git a/clover-idea/src/main/java/org/openclover/idea/report/treemap/IdeaCoverageColorProvider.java b/clover-idea/src/main/java/org/openclover/idea/report/treemap/IdeaCoverageColorProvider.java index c1194127..30ba45ac 100644 --- a/clover-idea/src/main/java/org/openclover/idea/report/treemap/IdeaCoverageColorProvider.java +++ b/clover-idea/src/main/java/org/openclover/idea/report/treemap/IdeaCoverageColorProvider.java @@ -1,7 +1,7 @@ package org.openclover.idea.report.treemap; -import clover.net.sf.jtreemap.swing.ColorProvider; -import clover.net.sf.jtreemap.swing.Value; +import net.sf.jtreemap.swing.provider.ColorProvider; +import net.sf.jtreemap.swing.Value; import org.openclover.core.reporters.util.ReportColors; import javax.swing.JPanel; diff --git a/clover-idea/src/main/java/org/openclover/idea/report/treemap/ProjectHeapMapBuilder.java b/clover-idea/src/main/java/org/openclover/idea/report/treemap/ProjectHeapMapBuilder.java index a7c194fa..f70927a8 100644 --- a/clover-idea/src/main/java/org/openclover/idea/report/treemap/ProjectHeapMapBuilder.java +++ b/clover-idea/src/main/java/org/openclover/idea/report/treemap/ProjectHeapMapBuilder.java @@ -1,8 +1,8 @@ package org.openclover.idea.report.treemap; -import clover.net.sf.jtreemap.swing.TreeMapNode; -import clover.net.sf.jtreemap.swing.TreeMapNodeBuilder; -import clover.net.sf.jtreemap.swing.Value; +import net.sf.jtreemap.swing.TreeMapNode; +import net.sf.jtreemap.swing.TreeMapNodeBuilder; +import net.sf.jtreemap.swing.Value; import org.openclover.core.CloverDatabase; import org.openclover.core.api.registry.ClassInfo; import org.openclover.core.api.registry.PackageInfo; diff --git a/clover-idea/src/main/java/org/openclover/idea/report/treemap/TreeMapEditor.java b/clover-idea/src/main/java/org/openclover/idea/report/treemap/TreeMapEditor.java index fcc88183..3a47dd76 100644 --- a/clover-idea/src/main/java/org/openclover/idea/report/treemap/TreeMapEditor.java +++ b/clover-idea/src/main/java/org/openclover/idea/report/treemap/TreeMapEditor.java @@ -1,14 +1,14 @@ package org.openclover.idea.report.treemap; -import clover.net.sf.jtreemap.swing.DefaultToolTip; -import clover.net.sf.jtreemap.swing.DefaultValue; -import clover.net.sf.jtreemap.swing.IToolTipBuilder; -import clover.net.sf.jtreemap.swing.JTreeMap; -import clover.net.sf.jtreemap.swing.TreeMapNode; -import clover.net.sf.jtreemap.swing.TreeMapNodeBuilder; -import clover.net.sf.jtreemap.swing.Value; -import clover.net.sf.jtreemap.swing.ValuePercent; -import clover.net.sf.jtreemap.swing.provider.HSBTreeMapColorProvider; +import net.sf.jtreemap.swing.DefaultToolTip; +import net.sf.jtreemap.swing.DefaultValue; +import net.sf.jtreemap.swing.IToolTipBuilder; +import net.sf.jtreemap.swing.JTreeMap; +import net.sf.jtreemap.swing.TreeMapNode; +import net.sf.jtreemap.swing.TreeMapNodeBuilder; +import net.sf.jtreemap.swing.Value; +import net.sf.jtreemap.swing.ValuePercent; +import net.sf.jtreemap.swing.provider.HSBTreeMapColorProvider; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NotNull; @@ -21,7 +21,7 @@ import javax.swing.JToolTip; import java.awt.Color; -import static clover.net.sf.jtreemap.swing.provider.HSBTreeMapColorProvider.ColorDistributionTypes.SquareRoot; +import static net.sf.jtreemap.swing.provider.HSBTreeMapColorProvider.ColorDistributionTypes.SQUARE_ROOT; public class TreeMapEditor extends DummyFileEditor implements CoverageListener { private final JTreeMap treeMap; @@ -110,13 +110,13 @@ public JToolTip getToolTip() { class HSBColorProvider extends HSBTreeMapColorProvider { HSBColorProvider(JTreeMap treeMap) { - super(treeMap, SquareRoot, Color.GREEN, Color.RED); + super(treeMap, SQUARE_ROOT, Color.GREEN, Color.RED); } /** * Rescales the 0:100 range to -50 : 50. * - * @see clover.net.sf.jtreemap.swing.ColorProvider#getColor(clover.net.sf.jtreemap.swing.Value) + * @see net.sf.jtreemap.swing.provider.ColorProvider#getColor(net.sf.jtreemap.swing.Value) */ @Override public Color getColor(Value value) { diff --git a/clover-idea/src/main/java/org/openclover/idea/util/jdom/JDOMExternUtil.java b/clover-idea/src/main/java/org/openclover/idea/util/jdom/JDOMExternUtil.java index 8de1b5f9..e9ca5a5c 100755 --- a/clover-idea/src/main/java/org/openclover/idea/util/jdom/JDOMExternUtil.java +++ b/clover-idea/src/main/java/org/openclover/idea/util/jdom/JDOMExternUtil.java @@ -1,6 +1,6 @@ package org.openclover.idea.util.jdom; -import clover.org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils; import com.intellij.openapi.diagnostic.Logger; import org.jdom.Document; import org.jdom.Element; diff --git a/clover-idea/src/main/java/org/openclover/idea/util/tasks/ExpirableTaskProcessor.java b/clover-idea/src/main/java/org/openclover/idea/util/tasks/ExpirableTaskProcessor.java index 4d129882..4fdad42f 100644 --- a/clover-idea/src/main/java/org/openclover/idea/util/tasks/ExpirableTaskProcessor.java +++ b/clover-idea/src/main/java/org/openclover/idea/util/tasks/ExpirableTaskProcessor.java @@ -1,6 +1,6 @@ package org.openclover.idea.util.tasks; -import clover.org.apache.commons.collections.list.SetUniqueList; +import org.apache.commons.collections.list.SetUniqueList; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.progress.ProcessCanceledException; diff --git a/clover-jtreemap/pom.xml b/clover-jtreemap/pom.xml deleted file mode 100644 index eb58fd7b..00000000 --- a/clover-jtreemap/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - 4.0.0 - - org.openclover - clover-base-pom - 4.6.0-SNAPSHOT - - clover-jtreemap - 1.1.0 - jar - - Repacked with 'clover.' prefix version of the library. - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - repo - - - Clover JTreeMap Library - - - true - true - true - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - - ${skip.nexus.staging} - - - - - - - - workspace-setup - - false - false - false - clover-jtreemap-${project.version}.jar - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.8 - - - package - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - com.tonicsystems - jarjar - 1.4 - - - - - - - - diff --git a/clover-runtime/pom.xml b/clover-runtime/pom.xml index 6c3c3111..928a68d8 100644 --- a/clover-runtime/pom.xml +++ b/clover-runtime/pom.xml @@ -24,7 +24,7 @@ org.ow2.asm asm - 5.0.3 + 9.7 @@ -51,16 +51,16 @@ - org.openclover - clover-antlr + antlr + antlr - org.openclover - clover-cajo + org.slf4j + slf4j-api - org.openclover - clover-slf4j + gnu.cajo + cajo @@ -202,7 +202,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.6.0 package-jar @@ -213,35 +213,61 @@ - org.openclover:clover-antlr - org.openclover:clover-cajo - org.openclover:clover-slf4j + antlr:antlr + gnu.cajo:cajo + org.slf4j:slf4j-api - org.openclover:clover-antlr + antlr:antlr - clover/antlr/CharFormatter* - clover/antlr/collections/impl/BitSet* - clover/antlr/collections/impl/IntRange* - clover/antlr/collections/impl/Vector* - clover/antlr/collections/impl/VectorEnumerator* + antlr/CharFormatter* + antlr/collections/impl/BitSet* + antlr/collections/impl/IntRange* + antlr/collections/impl/Vector* + antlr/collections/impl/VectorEnumerator* + + META-INF/MANIFEST.MF + - org.openclover:clover-cajo + gnu.cajo:cajo META-INF/MANIFEST.MF - org.openclover:clover-slf4j + org.slf4j:slf4j-api META-INF/MANIFEST.MF + + + antlr + clover.antlr + + antlr.** + + + + gnu.cajo + clover.gnu.cajo + + gnu.cajo.** + + + + org.slf4j + clover.org.slf4j + + org.slf4j.** + + + diff --git a/clover-runtime/src/main/java/org/openclover/runtime/CloverProperties.java b/clover-runtime/src/main/java/org/openclover/runtime/CloverProperties.java index 152f8060..23ba6688 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/CloverProperties.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/CloverProperties.java @@ -1,7 +1,5 @@ package org.openclover.runtime; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -22,12 +20,7 @@ public boolean getBooleanProperty(String name, boolean defaultValue) { } public static String getSysProperty(final String name, final String defaultValue) { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(name, defaultValue); - } - }); + return System.getProperty(name, defaultValue); } public static boolean getBooleanSysProperty(String name, boolean defaultValue) { @@ -59,13 +52,7 @@ public String toString() { } private String getCloverSystemProperties() { - Properties systemProperties = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Properties run() { - return System.getProperties(); - } - }); - + Properties systemProperties = System.getProperties(); Map cloverSystemProperties = new HashMap<>(); for (Map.Entry entry : systemProperties.entrySet()) { if (((String) entry.getKey()).startsWith(CloverNames.PROP_PREFIX)) { diff --git a/clover-runtime/src/main/java/org/openclover/runtime/Environment.java b/clover-runtime/src/main/java/org/openclover/runtime/Environment.java index 6af28f44..c9c6463c 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/Environment.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/Environment.java @@ -2,8 +2,6 @@ import org.openclover.runtime.api.CloverException; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -15,12 +13,7 @@ public class Environment { static { String propStart = null; try { - propStart = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(CloverNames.PROP_ENV_PROPREF_STARTCHAR, "$"); - } - }); + propStart = System.getProperty(CloverNames.PROP_ENV_PROPREF_STARTCHAR, "$"); } catch (Exception e) { //Ignore } @@ -50,12 +43,7 @@ public static String substituteSysPropRefs(String value) { final String propertyName = j.next(); String replacement = null; try { - replacement = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(propertyName); - } - }); + replacement = System.getProperty(propertyName); if(replacement == null) { Logger.getInstance().verbose("System property \"" + propertyName + "\" was null and so was not set"); } diff --git a/clover-runtime/src/main/java/org/openclover/runtime/Logger.java b/clover-runtime/src/main/java/org/openclover/runtime/Logger.java index af009157..1ce011fa 100755 --- a/clover-runtime/src/main/java/org/openclover/runtime/Logger.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/Logger.java @@ -1,7 +1,5 @@ package org.openclover.runtime; -import java.security.AccessController; -import java.security.PrivilegedAction; public abstract class Logger { //these values mirror Ant's values @@ -29,12 +27,7 @@ public Logger getLoggerInstance(String category) { //Ensures logging level is always set if clover.logging.level is set as a sysprop static { try { - String level = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(CloverNames.PROP_LOGGING_LEVEL); - } - }); + final String level = System.getProperty(CloverNames.PROP_LOGGING_LEVEL); if ("debug".equalsIgnoreCase(level)) { setDebug(true); } else if ("verbose".equalsIgnoreCase(level)) { diff --git a/clover-runtime/src/main/java/org/openclover/runtime/RecorderLogging.java b/clover-runtime/src/main/java/org/openclover/runtime/RecorderLogging.java index 025cf5bc..d2347403 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/RecorderLogging.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/RecorderLogging.java @@ -1,8 +1,6 @@ package org.openclover.runtime; import java.lang.reflect.InvocationTargetException; -import java.security.AccessController; -import java.security.PrivilegedAction; /** * This class manages setting up logging during recording @@ -10,12 +8,7 @@ public class RecorderLogging { public static void init() { try { - String adapter = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(CloverNames.PROP_LOGGING_ADAPTER); - } - }); + final String adapter = System.getProperty(CloverNames.PROP_LOGGING_ADAPTER); if (adapter != null && adapter.length() > 0) { if ("slf4j".equalsIgnoreCase(adapter)) { initSLF4JLogging(); @@ -65,9 +58,9 @@ private static void initCustomLogging(String classname) { } catch (ClassNotFoundException e) { errorMsg += "Class not found. "; } catch (ExceptionInInitializerError | InvocationTargetException e) { - errorMsg += "An error occured during class initialisation. "; + errorMsg += "An error occurred during class initialisation. "; } catch (NoSuchMethodException | InstantiationException | IllegalAccessException e) { - errorMsg += "An error occured during class initialisation. The class must provide a no-args" + + errorMsg += "An error occurred during class initialisation. The class must provide a no-args" + " public constructor. "; } diff --git a/clover-runtime/src/main/java/org/openclover/runtime/SLF4JLogger.java b/clover-runtime/src/main/java/org/openclover/runtime/SLF4JLogger.java index c32b9fc3..3bf4683c 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/SLF4JLogger.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/SLF4JLogger.java @@ -3,10 +3,10 @@ public class SLF4JLogger extends Logger { - private final clover.org.slf4j.Logger instance; + private final org.slf4j.Logger instance; public SLF4JLogger(String category) { - instance = clover.org.slf4j.LoggerFactory.getLogger(category); + instance = org.slf4j.LoggerFactory.getLogger(category); } @Override diff --git a/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderListener.java b/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderListener.java index d2d17925..04f2e0fc 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderListener.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderListener.java @@ -1,8 +1,8 @@ package org.openclover.runtime.remote; -import clover.gnu.cajo.invoke.Remote; -import clover.gnu.cajo.invoke.RemoteInvoke; -import clover.gnu.cajo.utils.extra.ItemProxy; +import gnu.cajo.invoke.Remote; +import gnu.cajo.invoke.RemoteInvoke; +import gnu.cajo.utils.extra.ItemProxy; import org.openclover.runtime.ErrorInfo; import org.openclover.runtime.Logger; import org_openclover_runtime.Clover; diff --git a/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderService.java b/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderService.java index 82657f84..b97a526b 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderService.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/remote/CajoTcpRecorderService.java @@ -1,9 +1,9 @@ package org.openclover.runtime.remote; -import clover.gnu.cajo.invoke.Remote; -import clover.gnu.cajo.utils.ItemServer; -import clover.gnu.cajo.utils.extra.ClientProxy; +import gnu.cajo.invoke.Remote; +import gnu.cajo.utils.ItemServer; +import gnu.cajo.utils.extra.ClientProxy; import org.openclover.runtime.Logger; import org.openclover.runtime.util.Formatting; diff --git a/clover-runtime/src/main/java/org/openclover/runtime/util/CloverBitSet.java b/clover-runtime/src/main/java/org/openclover/runtime/util/CloverBitSet.java index 8900d806..a109d478 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/util/CloverBitSet.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/util/CloverBitSet.java @@ -5,7 +5,7 @@ import java.io.IOException; import java.util.BitSet; -public class CloverBitSet extends clover.antlr.collections.impl.BitSet implements ByteSized { +public class CloverBitSet extends antlr.collections.impl.BitSet implements ByteSized { private final static int BITS_PER_UNIT = 1 << LOG_BITS; private final static int BIT_INDEX_MASK = BITS_PER_UNIT - 1; private final static byte[] END_ZERO_TABLE = { @@ -29,7 +29,7 @@ public class CloverBitSet extends clover.antlr.collections.impl.BitSet implement /** * Keeps track if any modification of the bit set was possibly made via any of {@link #add(int)}, {@link #remove(int)}, - * {@link #andInPlace(clover.antlr.collections.impl.BitSet)}, {@link #orInPlace(clover.antlr.collections.impl.BitSet)}, + * {@link #andInPlace(antlr.collections.impl.BitSet)}, {@link #orInPlace(antlr.collections.impl.BitSet)}, * {@link #notInPlace()}, {@link #notInPlace(int)}, {@link #notInPlace(int, int)} methods. Note it does not check * if content was really changed, but whether the method was called. */ @@ -205,7 +205,7 @@ public boolean intersects(CloverBitSet other) { } @Override - public void andInPlace(clover.antlr.collections.impl.BitSet bitSet) { + public void andInPlace(antlr.collections.impl.BitSet bitSet) { modified = true; super.andInPlace(bitSet); } @@ -235,7 +235,7 @@ public void notInPlace(int i, int i2) { } @Override - public void orInPlace(clover.antlr.collections.impl.BitSet bitSet) { + public void orInPlace(antlr.collections.impl.BitSet bitSet) { modified = true; super.orInPlace(bitSet); } @@ -247,7 +247,7 @@ public void remove(int i) { } @Override - public void subtractInPlace(clover.antlr.collections.impl.BitSet bitSet) { + public void subtractInPlace(antlr.collections.impl.BitSet bitSet) { modified = true; super.subtractInPlace(bitSet); } @@ -299,7 +299,7 @@ public int length() { /** * Returns true if any modification of the bit set was possibly made via any of {@link #add(int)}, {@link #remove(int)}, - * {@link #andInPlace(clover.antlr.collections.impl.BitSet)}, {@link #orInPlace(clover.antlr.collections.impl.BitSet)}, + * {@link #andInPlace(antlr.collections.impl.BitSet)}, {@link #orInPlace(antlr.collections.impl.BitSet)}, * {@link #notInPlace()}, {@link #notInPlace(int)}, {@link #notInPlace(int, int)} method calls. Note it does not check * if content was really changed, but whether the method was called. * diff --git a/clover-runtime/src/main/java/org/openclover/runtime/util/FOSFactory.java b/clover-runtime/src/main/java/org/openclover/runtime/util/FOSFactory.java index d595f419..90afe15d 100644 --- a/clover-runtime/src/main/java/org/openclover/runtime/util/FOSFactory.java +++ b/clover-runtime/src/main/java/org/openclover/runtime/util/FOSFactory.java @@ -7,8 +7,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.security.AccessController; -import java.security.PrivilegedAction; /** * Factory for FileOutputStreams so that we can vary behaviour @@ -25,17 +23,11 @@ public class FOSFactory { static { Boolean useSyncIO = Boolean.FALSE; try { - useSyncIO = - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Boolean run() { - return Boolean.getBoolean(CloverNames.PROP_SYNCHRONOUS_IO); - } - }); + useSyncIO = Boolean.getBoolean(CloverNames.PROP_SYNCHRONOUS_IO); } catch (SecurityException e) { Logger.getInstance().info("Unable to determine OpenClover IO mode", e); } - USE_SYNCHRONOUS_IO = useSyncIO != null ? useSyncIO : false; + USE_SYNCHRONOUS_IO = useSyncIO; } public static FileOutputStream newFOS(File file) throws FileNotFoundException { diff --git a/clover-runtime/src/main/java/org_openclover_runtime/Clover.java b/clover-runtime/src/main/java/org_openclover_runtime/Clover.java index 617f6bd8..fb545ccf 100644 --- a/clover-runtime/src/main/java/org_openclover_runtime/Clover.java +++ b/clover-runtime/src/main/java/org_openclover_runtime/Clover.java @@ -18,8 +18,6 @@ import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -516,55 +514,50 @@ public CoverageRecorder getRecorder(final String initString, final CloverProperties properties = new CloverProperties(nvpProperties); - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public CoverageRecorder run() { - // find current profile (if any) - final CloverProfile currentProfile = selectCloverProfile(profiles); - // use proper key depending on coverage recorder type - final String recorderKey = - (currentProfile != null && currentProfile.getCoverageRecorder() == CloverProfile.CoverageRecorderType.SHARED) ? - initString + "_" + cfgbits // shared - : initString + "_" + dbVersion + "_" + cfgbits; // fixed or growable - - CoverageRecorder recorder; - synchronized (RECORDERS) { - // find existing recorder ... - recorder = RECORDERS.get(recorderKey); - if (recorder != null) { - // ... and resize if necessary - Logger.getInstance().debug("[found existing recorder for " + recorderKey + "]"); - recorder = recorder.withCapacityFor(maxNumElements); - } else { - // ... or create new one - if (Logger.isDebug()) { - Logger.getInstance().debug( - "Clover.getRecorder(" - + initString + ", " - + dbVersion + ", " - + cfgbits + ", " - + maxNumElements + ", " - + properties + ") " - + "resulting in new recorder called from (first 10 stack elements):\n" + - callerChain(10)); - } - - Logger.getInstance().debug("[creating new recorder for " + recorderKey + "]"); - recorder = createRecorder(initString, dbVersion, cfgbits, maxNumElements, currentProfile, properties); - recorder.startRun(); - } + // find current profile (if any) + final CloverProfile currentProfile = selectCloverProfile(profiles); + // use proper key depending on coverage recorder type + final String recorderKey = + (currentProfile != null && currentProfile.getCoverageRecorder() == CloverProfile.CoverageRecorderType.SHARED) ? + initString + "_" + cfgbits // shared + : initString + "_" + dbVersion + "_" + cfgbits; // fixed or growable + + CoverageRecorder recorder; + synchronized (RECORDERS) { + // find existing recorder ... + recorder = RECORDERS.get(recorderKey); + if (recorder != null) { + // ... and resize if necessary + Logger.getInstance().debug("[found existing recorder for " + recorderKey + "]"); + recorder = recorder.withCapacityFor(maxNumElements); + } else { + // ... or create new one + if (Logger.isDebug()) { + Logger.getInstance().debug( + "Clover.getRecorder(" + + initString + ", " + + dbVersion + ", " + + cfgbits + ", " + + maxNumElements + ", " + + properties + ") " + + "resulting in new recorder called from (first 10 stack elements):\n" + + callerChain(10)); + } - // growable/shared recorders may have emitted a new proxy so use this as the latest version - RECORDERS.put(recorderKey, recorder); + Logger.getInstance().debug("[creating new recorder for " + recorderKey + "]"); + recorder = createRecorder(initString, dbVersion, cfgbits, maxNumElements, currentProfile, properties); + recorder.startRun(); + } - if (distributedRuntime == null) { - distributedRuntime = new DistributedClover(properties, currentProfile); - } + // growable/shared recorders may have emitted a new proxy so use this as the latest version + RECORDERS.put(recorderKey, recorder); - return recorder; - } + if (distributedRuntime == null) { + distributedRuntime = new DistributedClover(properties, currentProfile); } - }); + } + + return recorder; } private String callerChain(int maxDepth) { @@ -623,67 +616,47 @@ public boolean hasRecorded() { @Override public void allRecordersFlush() { - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Void run() { - synchronized (RECORDERS) { - for (CoverageRecorder recorder : RECORDERS.values()) { - recorder.forceFlush(); - } - } - return null; + synchronized (RECORDERS) { + for (CoverageRecorder recorder : RECORDERS.values()) { + recorder.forceFlush(); } - }); + } } @Override public void allRecordersSliceStart(final String type, final int slice, final long startTime) { - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Void run() { - synchronized (RECORDERS) { - currentSlice = slice; - currentSliceStart = startTime > 0 ? startTime : System.currentTimeMillis(); - currentType = type; - - for (CoverageRecorder recorder : RECORDERS.values()) { - recorder.sliceStart(type, currentSliceStart, slice, testRunID); - } - if (distributedRuntime != null) { - // see CajoTcpRecorderListener.allRecordersSliceStart signature - distributedRuntime.remoteFlush( - RpcMessage.createMethodStart(type, slice, currentSliceStart)); - } - } - return null; + synchronized (RECORDERS) { + currentSlice = slice; + currentSliceStart = startTime > 0 ? startTime : System.currentTimeMillis(); + currentType = type; + + for (CoverageRecorder recorder : RECORDERS.values()) { + recorder.sliceStart(type, currentSliceStart, slice, testRunID); } - }); + if (distributedRuntime != null) { + // see CajoTcpRecorderListener.allRecordersSliceStart signature + distributedRuntime.remoteFlush( + RpcMessage.createMethodStart(type, slice, currentSliceStart)); + } + } } @Override public void allRecordersSliceEnd(final String type, final String method, /*@Nullable*/ final String runtimeTestName, final int slice, final int p, final ErrorInfo ei) { - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Void run() { - synchronized (RECORDERS) { - currentSlice = NO_SLICE; - long ts = System.currentTimeMillis(); - for (CoverageRecorder recorder : RECORDERS.values()) { - recorder.sliceEnd(type, method, runtimeTestName, ts, slice, testRunID, p, ei); - } - if (distributedRuntime != null) { - // see CajoTcpRecorderListener.allRecordersSliceEnd signature - distributedRuntime.remoteFlush( - RpcMessage.createMethodEnd(type, method, runtimeTestName, slice, p, ei)); - } - testRunID++; - } - - return null; + synchronized (RECORDERS) { + currentSlice = NO_SLICE; + long ts = System.currentTimeMillis(); + for (CoverageRecorder recorder : RECORDERS.values()) { + recorder.sliceEnd(type, method, runtimeTestName, ts, slice, testRunID, p, ei); } - }); - + if (distributedRuntime != null) { + // see CajoTcpRecorderListener.allRecordersSliceEnd signature + distributedRuntime.remoteFlush( + RpcMessage.createMethodEnd(type, method, runtimeTestName, slice, p, ei)); + } + testRunID++; + } } /** @@ -755,8 +728,6 @@ private boolean isDisableClover() { * NO: return null * * - * Note: call in AccessController.doPrivileged() as it reads system property. - * * @param profiles available profiles to choose from * @return CloverProfile or null */ diff --git a/clover-third-party-library-bom.html b/clover-third-party-library-bom.html index 71091c77..18c7f1ea 100644 --- a/clover-third-party-library-bom.html +++ b/clover-third-party-library-bom.html @@ -47,7 +47,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-annotations - clover-core\etc\licenses\ANNOTATIONS-13.0-LICENSE.TXT + clover-core/src/main/resources/licenses/ANNOTATIONS-13.0-LICENSE.TXT   @@ -60,12 +60,12 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-antlr - clover-core\etc\licenses\ANTLR-2.7.7-LICENSE.TXT + clover-core/src/main/resources/licenses/ANTLR-2.7.7-LICENSE.TXT   ASM - 5.0.3 + 9.7 BSD asm.ow2.org clover-eclipse @@ -87,7 +87,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An not available clover-core-libs\clover-cajo
Atlassian Private org.openclover:clover-cajo - clover-core\etc\licenses\CAJO-1.117-LICENSE.TXT + clover-core/src/main/resources/licenses/CAJO-1.117-LICENSE.TXT TODO: upgrade cajo to the latest version in order to have original sources (as the latest version is available on Cajo home page) @@ -100,12 +100,12 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-commons-codec - clover-core\etc\licenses\COMMONS-CODEC-1.9-LICENSE.TXT + clover-core/src/main/resources/licenses/COMMONS-CODEC-1.9-LICENSE.TXT   Commons Collections - 3.1 + 3.2.2 Apache 2.0 commons.apache.org clover-core @@ -113,7 +113,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-commons-collections - clover-core\etc\licenses\COMMONS-COLLECTIONS-3.2.1-LICENSE.TXT + clover-core/src/main/resources/licenses/COMMONS-COLLECTIONS-3.2.1-LICENSE.TXT   @@ -126,7 +126,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-commons-lang - clover-core\etc\licenses\COMMONS-LANG-2.6-LICENSE.TXT + clover-core/src/main/resources/licenses/COMMONS-LANG-2.6-LICENSE.TXT   @@ -139,7 +139,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-commons-lang3 - clover-core\etc\licenses\COMMONS-LANG3-3.3.2-LICENSE.TXT + clover-core/src/main/resources/licenses/COMMONS-LANG3-3.3.2-LICENSE.TXT   @@ -152,12 +152,12 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix clover-core-libs\clover-fastutil\src\main\resources\fastutil-4.4.3.jar Atlassian Private org.openclover:clover-fastutil - clover-core\etc\licenses\FASTUTIL-4.4.3-LICENSE.TXT + clover-core/src/main/resources/licenses/FASTUTIL-4.4.3-LICENSE.TXT   GSON - 1.3 + 2.10.1 Apache 2.0 code.google.com/p/google-gson clover-core @@ -165,7 +165,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix clover-core-libs\clover-gson\src\main\resources\gson-1.3.jar Atlassian Private org.openclover:clover-gson - clover-core\etc\licenses\GSON-1.3-LICENSE.TXT + clover-core/src/main/resources/licenses/GSON-1.3-LICENSE.TXT   @@ -178,7 +178,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-itext - clover-core\etc\licenses\ITEXT-2.0.1-LICENSE.TXT + clover-core/src/main/resources/licenses/ITEXT-2.0.1-LICENSE.TXT *** = WARNING DO NOT upgrade iText to library version later than 2.1.7. This is the latest version which was released under LGPL license. All newer versions are released under Affero GPL v3, which is a viral license. @@ -192,7 +192,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-jcommon - clover-core\etc\licenses\JCOMMON-1.0.23-LICENSE.TXT + clover-core/src/main/resources/licenses/JCOMMON-1.0.23-LICENSE.TXT   @@ -205,7 +205,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-jdom - clover-core\etc\licenses\JDOM-1.0-LICENSE.TXT + clover-core/src/main/resources/licenses/JDOM-1.0-LICENSE.TXT   @@ -218,7 +218,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-jfreechart - clover-core\etc\licenses\JFREECHART-1.0.19-LICENSE.TXT + clover-core/src/main/resources/licenses/JFREECHART-1.0.19-LICENSE.TXT   @@ -249,7 +249,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An SLF4J - 2.0.0 + 1.7.36 MIT slf4j.org clover-core @@ -257,7 +257,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository N/A - clover-core\etc\licenses\SLF4J-1.7.36-LICENSE.TXT + clover-core/src/main/resources/licenses/SLF4J-1.7.36-LICENSE.TXT   @@ -270,7 +270,7 @@

Third party binaries bundled in the final OpenClover products (Clover-for-An clover. prefix Maven Central repository Atlassian Private org.openclover:clover-velocity - clover-core\etc\licenses\VELOCITY-1.7-LICENSE.TXT + clover-core/src/main/resources/licenses/VELOCITY-1.7-LICENSE.TXT   @@ -311,7 +311,7 @@

Third party sources (and other resources) embedded in OpenClover's source co Public Domain www.antlr2.org clover-core\src\main\java\com\atlassian\clover\instr\java\java.g - clover-core\etc\licenses\ANTLR-2.7.7-LICENSE.TXT + clover-core/src/main/resources/licenses/ANTLR-2.7.7-LICENSE.TXT No Public Domain. No need to publish. @@ -321,7 +321,7 @@

Third party sources (and other resources) embedded in OpenClover's source co BSD www.antlr3.org clover-core\src\src\main\java\com\atlassian\clover\instr\java\java.g - clover-core\etc\licenses\ANTLR-JAVA-GRAMMAR-3.0-LICENSE.TXT + clover-core/src/main/resources/licenses/ANTLR-JAVA-GRAMMAR-3.0-LICENSE.TXT No A java.g file contains a fragment of grammar from http://openjdk.java.net/projects/compiler-grammar/antlrworks/Java.g, which was derived from a Java 1.5 grammar based on ANTLR3. BSD license. @@ -350,7 +350,7 @@

Third party sources (and other resources) embedded in OpenClover's source co Apache 2.0 www.jetbrains.com clover-idea\etc\icons (some of them) - clover-idea\etc\licenses\INTELLIJ-9.0-ICONS-LICENSE.TXT + clover-core/src/main/resources/licenses/INTELLIJ-9.0-ICONS-LICENSE.TXT Yes In OpenClover IDEA plugin JAR, in \icons folder. Icons were taken from IntelliJ IDEA, they are licensed under Apache 2.0. @@ -360,7 +360,7 @@

Third party sources (and other resources) embedded in OpenClover's source co BSD thejit.org clover-core\etc\html_res\jit.js - clover-core\etc\licenses\JIT-1.1.2-LICENSE.TXT + clover-core/src/main/resources/licenses/JIT-1.1.2-LICENSE.TXT No   @@ -374,7 +374,7 @@

Third party sources (and other resources) embedded in OpenClover's source co clover-core\src\main\java\com\atlassian\clover\reporters\json\JSONWriter.java
clover-core\src\main\java\com\atlassian\clover\reporters\json\JSONTokener.java
clover-core\src\main\java\com\atlassian\clover\reporters\json\JSONStringer.java - clover-core\etc\licenses\JSON-LICENSE.TXT + clover-core/src/main/resources/licenses/JSON-LICENSE.TXT No Public Domain. No need to publish. In our repository we have sources older than the first commit in https://github.com/douglascrockford/JSON-java @@ -384,7 +384,7 @@

Third party sources (and other resources) embedded in OpenClover's source co MIT https://jquery.org clover-core\etc\html_res\adg\jquery-1.8.3.min.js - clover-core\etc\licenses\JQUERY-1.8.3-LICENSE.TXT + clover-core/src/main/resources/licenses/JQUERY-1.8.3-LICENSE.TXT No   @@ -440,15 +440,6 @@

Third party tools (binaries and sources) not bundled in final binaries

target\dependencies\ant-contrib-1.0b3.jar used in our build.xml files - - ASM - 3.0 - BSD - asm.ow2.org - ~\.m2\...\asm-3.0.jar - used for compilation against groovy 1.x (to have proper bytecode), - used for compilation (buildutil - writeRethrowCheckedMethod) - ASM 4.0 @@ -565,10 +556,10 @@

Third party tools (binaries and sources) not bundled in final binaries

Spock Framework - 0.5-1.0 + 1.0-2.3 Apache 2.0 spockframework.org - target\dependencies\spock-core-*.jar + clover-groovy/target/test-dependencies/spock-core-*.jar used for integration testing whether OpenClover works with various Spock versions @@ -587,21 +578,6 @@

Third party tools (binaries and sources) not bundled in final binaries

target\dependencies\testng-6.8.21.jar used for compilation and tests (in classpath) - diff --git a/pom.xml b/pom.xml index 904ae24e..b48f173a 100644 --- a/pom.xml +++ b/pom.xml @@ -71,7 +71,6 @@ clover-core-libs clover-eclipse-libs clover-idea-libs - clover-jtreemap @@ -79,73 +78,76 @@ - org.openclover - clover-annotations + org.jetbrains + annotations 13.0 - org.openclover - clover-antlr + antlr + antlr 2.7.7 - org.openclover - clover-cajo + gnu.cajo + cajo 1.117 - org.openclover - clover-commons-codec + commons-codec + commons-codec 1.9 - org.openclover - clover-commons-collections + commons-collections + commons-collections 3.2.2 - org.openclover - clover-commons-lang + commons-lang + commons-lang 2.6 - org.openclover - clover-commons-lang3 + org.apache.commons + commons-lang3 3.3.2 - org.openclover - clover-fastutil + it.unimi.dsi + fastutil 4.4.3 - org.openclover - clover-gson - 1.3 + com.google.code.gson + gson + 2.10.1 - org.openclover - clover-itext + + com.lowagie + itext 2.0.1 - org.openclover - clover-jcommon + org.jfree + jcommon 1.0.23 - org.openclover - clover-jdom + jdom + jdom 1.0 - org.openclover - clover-jfreechart + org.jfree + jfreechart 1.0.19 - org.openclover - clover-slf4j + org.slf4j + slf4j-api 1.7.36 @@ -218,7 +220,7 @@ org.ow2.asm asm - 5.0.3 + 9.7 diff --git a/tests-functional/pom.xml b/tests-functional/pom.xml index 786cab52..d7930e66 100644 --- a/tests-functional/pom.xml +++ b/tests-functional/pom.xml @@ -57,8 +57,8 @@ test - org.openclover - clover-jdom + jdom + jdom test @@ -157,7 +157,7 @@ org.ow2.asm asm - 4.1 + 9.7 antlr diff --git a/tests-functional/src/test/groovy/org/openclover/functest/ant/groovy/AntProjectSimulacrum.groovy b/tests-functional/src/test/groovy/org/openclover/functest/ant/groovy/AntProjectSimulacrum.groovy index e0264645..2de9d8c2 100644 --- a/tests-functional/src/test/groovy/org/openclover/functest/ant/groovy/AntProjectSimulacrum.groovy +++ b/tests-functional/src/test/groovy/org/openclover/functest/ant/groovy/AntProjectSimulacrum.groovy @@ -49,7 +49,7 @@ class AntProjectSimulacrum implements JavaExecutorMixin { private List getAdditionalGroovyJars() { File antlrJar = new File(testDependenciesDir, "antlr-2.7.7.jar") - File asmJar = new File(testDependenciesDir, "asm-4.1.jar") + File asmJar = new File(testDependenciesDir, "asm-9.7.jar") File commonsCliJar = new File(testDependenciesDir, "commons-cli-1.2.jar") [ antlrJar, asmJar, commonsCliJar ] } diff --git a/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/CloverSetupTaskTestBase.groovy b/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/CloverSetupTaskTestBase.groovy index 20a703fd..f2742f21 100644 --- a/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/CloverSetupTaskTestBase.groovy +++ b/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/CloverSetupTaskTestBase.groovy @@ -1,8 +1,8 @@ package org.openclover.functest.ant.tasks -import clover.org.jdom.Document -import clover.org.jdom.Element -import clover.org.jdom.JDOMException +import org.jdom.Document +import org.jdom.Element +import org.jdom.JDOMException import groovy.transform.CompileStatic import org.junit.After import org.junit.Rule diff --git a/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/XMLReportReader.groovy b/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/XMLReportReader.groovy index b1d55b3f..cdb6ee0f 100644 --- a/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/XMLReportReader.groovy +++ b/tests-functional/src/test/groovy/org/openclover/functest/ant/tasks/XMLReportReader.groovy @@ -1,9 +1,9 @@ package org.openclover.functest.ant.tasks -import clover.org.jdom.Document -import clover.org.jdom.Element -import clover.org.jdom.JDOMException -import clover.org.jdom.input.SAXBuilder +import org.jdom.Document +import org.jdom.Element +import org.jdom.JDOMException +import org.jdom.input.SAXBuilder import groovy.transform.CompileStatic import org.xml.sax.EntityResolver import org.xml.sax.InputSource