aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2019-10-11 19:59:34 +0200
committerEvgeny Mandrikov <138671+Godin@users.noreply.github.com>2019-10-11 19:59:34 +0200
commitf9a4a8cec7606473edf551a6fd76279081162269 (patch)
treee38f5b9d29aebc30179a1b1972fe276306f3d8c6
parent3787b8249e4586b0c6fec57d920e5e9c32b6e852 (diff)
downloadplatform_external_jacoco-f9a4a8cec7606473edf551a6fd76279081162269.tar.gz
platform_external_jacoco-f9a4a8cec7606473edf551a6fd76279081162269.tar.bz2
platform_external_jacoco-f9a4a8cec7606473edf551a6fd76279081162269.zip
Access to static members should use qualifier of declaring type (#962)
-rw-r--r--org.jacoco.core.test/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/analysis/InstructionsBuilderTest.java4
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodCoverageCalculatorTest.java12
-rw-r--r--org.jacoco.core/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java5
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java3
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java3
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java3
8 files changed, 15 insertions, 19 deletions
diff --git a/org.jacoco.core.test/.settings/org.eclipse.jdt.ui.prefs b/org.jacoco.core.test/.settings/org.eclipse.jdt.ui.prefs
index e5394d16..815f01e2 100644
--- a/org.jacoco.core.test/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.jacoco.core.test/.settings/org.eclipse.jdt.ui.prefs
@@ -33,7 +33,7 @@ sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_modifiers=false
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/InstructionsBuilderTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/InstructionsBuilderTest.java
index 7e52a205..dd5da8ce 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/InstructionsBuilderTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/InstructionsBuilderTest.java
@@ -16,7 +16,7 @@ import static org.junit.Assert.assertEquals;
import java.util.Map;
-import org.jacoco.core.analysis.ISourceFileCoverage;
+import org.jacoco.core.analysis.ISourceNode;
import org.jacoco.core.internal.flow.LabelInfo;
import org.junit.Before;
import org.junit.Test;
@@ -53,7 +53,7 @@ public class InstructionsBuilderTest {
builder.addInstruction(i4);
Map<AbstractInsnNode, Instruction> map = builder.getInstructions();
- assertEquals(ISourceFileCoverage.UNKNOWN_LINE, map.get(i1).getLine());
+ assertEquals(ISourceNode.UNKNOWN_LINE, map.get(i1).getLine());
assertEquals(10, map.get(i2).getLine());
assertEquals(10, map.get(i3).getLine());
assertEquals(20, map.get(i4).getLine());
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodCoverageCalculatorTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodCoverageCalculatorTest.java
index 1c6768cc..0b5a9117 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodCoverageCalculatorTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodCoverageCalculatorTest.java
@@ -19,7 +19,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
-import org.jacoco.core.analysis.ISourceFileCoverage;
+import org.jacoco.core.analysis.ISourceNode;
import org.junit.Before;
import org.junit.Test;
import org.objectweb.asm.Opcodes;
@@ -205,15 +205,15 @@ public class MethodCoverageCalculatorTest {
@Test
public void should_work_without_lines() {
- addInsn(ISourceFileCoverage.UNKNOWN_LINE, false);
- addInsn(ISourceFileCoverage.UNKNOWN_LINE, false);
- addInsn(ISourceFileCoverage.UNKNOWN_LINE, true);
+ addInsn(ISourceNode.UNKNOWN_LINE, false);
+ addInsn(ISourceNode.UNKNOWN_LINE, false);
+ addInsn(ISourceNode.UNKNOWN_LINE, true);
MethodCoverageCalculator c = new MethodCoverageCalculator(instructions);
c.calculate(coverage);
- assertEquals(ISourceFileCoverage.UNKNOWN_LINE, coverage.getFirstLine());
- assertEquals(ISourceFileCoverage.UNKNOWN_LINE, coverage.getLastLine());
+ assertEquals(ISourceNode.UNKNOWN_LINE, coverage.getFirstLine());
+ assertEquals(ISourceNode.UNKNOWN_LINE, coverage.getLastLine());
assertEquals(CounterImpl.getInstance(2, 1),
coverage.getInstructionCounter());
}
diff --git a/org.jacoco.core/.settings/org.eclipse.jdt.ui.prefs b/org.jacoco.core/.settings/org.eclipse.jdt.ui.prefs
index 072b187e..a3dee78c 100644
--- a/org.jacoco.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.jacoco.core/.settings/org.eclipse.jdt.ui.prefs
@@ -34,7 +34,7 @@ sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_modifiers=false
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java
index ee8b7c6f..f6a7c5d9 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java
@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.jacoco.core.analysis.ISourceFileCoverage;
import org.jacoco.core.analysis.ISourceNode;
import org.jacoco.core.internal.analysis.filter.IFilterOutput;
import org.objectweb.asm.tree.AbstractInsnNode;
@@ -122,8 +121,8 @@ class MethodCoverageCalculator implements IFilterOutput {
private void ensureCapacity(final MethodCoverageImpl coverage) {
// Determine line range:
- int firstLine = ISourceFileCoverage.UNKNOWN_LINE;
- int lastLine = ISourceFileCoverage.UNKNOWN_LINE;
+ int firstLine = ISourceNode.UNKNOWN_LINE;
+ int lastLine = ISourceNode.UNKNOWN_LINE;
for (final Entry<AbstractInsnNode, Instruction> entry : instructions
.entrySet()) {
if (!ignored.contains(entry.getKey())) {
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java
index 37c3ac3b..ecf6dbac 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java
@@ -18,7 +18,6 @@ import java.util.Set;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
-import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.LookupSwitchInsnNode;
@@ -45,7 +44,7 @@ public final class KotlinWhenFilter implements IFilter {
private static class Matcher extends AbstractMatcher {
void match(final AbstractInsnNode start, final IFilterOutput output) {
- if (start.getType() != InsnNode.LABEL) {
+ if (start.getType() != AbstractInsnNode.LABEL) {
return;
}
cursor = start;
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java
index 5c22fc6c..1a60aef8 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/BarColumn.java
@@ -13,7 +13,6 @@
package org.jacoco.report.internal.html.table;
import java.io.IOException;
-import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Comparator;
import java.util.List;
@@ -55,7 +54,7 @@ public class BarColumn implements IColumnRenderer {
*/
public BarColumn(final CounterEntity entity, final Locale locale) {
this.entity = entity;
- this.integerFormat = DecimalFormat.getIntegerInstance(locale);
+ this.integerFormat = NumberFormat.getIntegerInstance(locale);
this.comparator = new TableItemComparator(
CounterComparator.MISSEDITEMS.reverse().on(entity).second(
CounterComparator.TOTALITEMS.reverse().on(entity)));
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java b/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java
index 308f47c6..94943349 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/table/CounterColumn.java
@@ -13,7 +13,6 @@
package org.jacoco.report.internal.html.table;
import java.io.IOException;
-import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Comparator;
import java.util.List;
@@ -114,7 +113,7 @@ public abstract class CounterColumn implements IColumnRenderer {
protected CounterColumn(final CounterEntity entity, final Locale locale,
final Comparator<ICoverageNode> comparator) {
this.entity = entity;
- this.integerFormat = DecimalFormat.getIntegerInstance(locale);
+ this.integerFormat = NumberFormat.getIntegerInstance(locale);
this.comparator = new TableItemComparator(comparator);
}