Skip to content

Commit

Permalink
7902823: RepGen fails with IllegalFormatArgumentIndexException if sta…
Browse files Browse the repository at this point in the history
…rted by JDK 16 and above
  • Loading branch information
lkuskov committed Jan 29, 2021
1 parent 98f534c commit 808a935
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions build/release.properties
Expand Up @@ -23,5 +23,4 @@

build.version = 3.0
build.milestone = os.ea
build.number = 5

build.number = 7
21 changes: 12 additions & 9 deletions src/classes/com/sun/tdk/jcov/report/AbstractCoverage.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -141,7 +141,7 @@ public int compareTo(Object obj) {
* @return List of testnames covering this member
*/
public List<String> getCoveringTests(String testlist[]) {
ArrayList<String> list = new ArrayList<String>(testlist.length / 10);
ArrayList<String> list = new ArrayList<>(testlist.length / 10);
for (int i = 0; i < testlist.length; ++i) {
if (isCoveredByTest(i)) {
list.add(testlist[i]);
Expand All @@ -153,24 +153,24 @@ public List<String> getCoveringTests(String testlist[]) {
/**
* CoverageFormatter serves to format CoverageData objects into strings
*/
public static interface CoverageFormatter {
public interface CoverageFormatter {

/**
*
* @param data CoverageData object to format
* @return formatted coverage data
*/
public String format(CoverageData data);
String format(CoverageData data);
}

public static interface CoverageANCFormatter {
public interface CoverageANCFormatter {

/**
* @param data CoverageData object to format
* @param withAnc Show acceptable not covered data
* @return formatted coverage data
*/
public String format(CoverageData data, boolean withAnc);
String format(CoverageData data, boolean withAnc);

}

Expand All @@ -184,7 +184,8 @@ public String format(CoverageData data){
if (data.total == 0) {
return " -";
} else {
return String.format("%0$4.0f%% (%d/%d)", (float) data.covered / data.total * 100., data.covered, data.total);
return String.format("%4d%% (%d/%d)",
Math.floorDiv(data.covered * 100, data.total), data.covered, data.total);
}
}

Expand All @@ -193,9 +194,11 @@ public String format(CoverageData data, boolean withAnc){
return " -";
} else {
if (!withAnc) {
return String.format("%0$4.0f%% (%d/%d)", (float) data.covered / data.total * 100., data.covered, data.total);
return String.format("%4d%% (%d/%d)",
Math.floorDiv(data.covered * 100, data.total), data.covered, data.total);
}
return String.format("%0$4.0f%% (%d/%d/%d)", (float) (data.covered + data.anc) / (data.total) * 100., data.covered, data.anc, data.total);
return String.format("%4d%% (%d/%d/%d)",
Math.floorDiv((data.covered + data.anc) * 100, data.total), data.covered, data.anc, data.total);
}
}
}
Expand Down

0 comments on commit 808a935

Please sign in to comment.