Skip to content

Commit 808a935

Browse files
committed
7902823: RepGen fails with IllegalFormatArgumentIndexException if started by JDK 16 and above
1 parent 98f534c commit 808a935

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

build/release.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@
2323

2424
build.version = 3.0
2525
build.milestone = os.ea
26-
build.number = 5
27-
26+
build.number = 7

src/classes/com/sun/tdk/jcov/report/AbstractCoverage.java

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -141,7 +141,7 @@ public int compareTo(Object obj) {
141141
* @return List of testnames covering this member
142142
*/
143143
public List<String> getCoveringTests(String testlist[]) {
144-
ArrayList<String> list = new ArrayList<String>(testlist.length / 10);
144+
ArrayList<String> list = new ArrayList<>(testlist.length / 10);
145145
for (int i = 0; i < testlist.length; ++i) {
146146
if (isCoveredByTest(i)) {
147147
list.add(testlist[i]);
@@ -153,24 +153,24 @@ public List<String> getCoveringTests(String testlist[]) {
153153
/**
154154
* CoverageFormatter serves to format CoverageData objects into strings
155155
*/
156-
public static interface CoverageFormatter {
156+
public interface CoverageFormatter {
157157

158158
/**
159159
*
160160
* @param data CoverageData object to format
161161
* @return formatted coverage data
162162
*/
163-
public String format(CoverageData data);
163+
String format(CoverageData data);
164164
}
165165

166-
public static interface CoverageANCFormatter {
166+
public interface CoverageANCFormatter {
167167

168168
/**
169169
* @param data CoverageData object to format
170170
* @param withAnc Show acceptable not covered data
171171
* @return formatted coverage data
172172
*/
173-
public String format(CoverageData data, boolean withAnc);
173+
String format(CoverageData data, boolean withAnc);
174174

175175
}
176176

@@ -184,7 +184,8 @@ public String format(CoverageData data){
184184
if (data.total == 0) {
185185
return " -";
186186
} else {
187-
return String.format("%0$4.0f%% (%d/%d)", (float) data.covered / data.total * 100., data.covered, data.total);
187+
return String.format("%4d%% (%d/%d)",
188+
Math.floorDiv(data.covered * 100, data.total), data.covered, data.total);
188189
}
189190
}
190191

@@ -193,9 +194,11 @@ public String format(CoverageData data, boolean withAnc){
193194
return " -";
194195
} else {
195196
if (!withAnc) {
196-
return String.format("%0$4.0f%% (%d/%d)", (float) data.covered / data.total * 100., data.covered, data.total);
197+
return String.format("%4d%% (%d/%d)",
198+
Math.floorDiv(data.covered * 100, data.total), data.covered, data.total);
197199
}
198-
return String.format("%0$4.0f%% (%d/%d/%d)", (float) (data.covered + data.anc) / (data.total) * 100., data.covered, data.anc, data.total);
200+
return String.format("%4d%% (%d/%d/%d)",
201+
Math.floorDiv((data.covered + data.anc) * 100, data.total), data.covered, data.anc, data.total);
199202
}
200203
}
201204
}

0 commit comments

Comments
 (0)