Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to static members should use qualifier of declaring type #962

Merged
merged 1 commit into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion org.jacoco.core.test/.settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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;
Expand Down Expand Up @@ -53,7 +53,7 @@ public void current_line_number_should_be_applied_to_instructions() {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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;
Expand Down Expand Up @@ -205,15 +205,15 @@ public void should_replace_branches_with_merged_instructions() {

@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());
}
Expand Down
2 changes: 1 addition & 1 deletion org.jacoco.core/.settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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;
Expand Down Expand Up @@ -122,8 +121,8 @@ private void applyReplacements() {

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())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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;
Expand All @@ -45,7 +44,7 @@ public void filter(final MethodNode methodNode,

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -114,7 +113,7 @@ protected int getValue(final ICounter counter) {
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);
}

Expand Down