Description
To reproduce, run tests with jcov, create a diff and run DiffCoverage:
$ make jcov-test TEST=test/jdk/java/util/Vector
$ hg diff -r 49773 src/java.base/share/classes/java/util/Vector.java > diff.txt
$ java -jar .../jcov_3.0/lib/jcov.jar DiffCoverage -all build/.../test-results/jcov-output/result.xml diff.txt
? 2 | * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
? 28 |import java.io.IOException;
? 29 |import java.io.ObjectInputStream;
? 30 |import java.io.StreamCorruptedException;
? 35 |import jdk.internal.util.ArraysSupport;
? 36 |
? 105 | @SuppressWarnings("serial") // Conditionally serializable
? 128 | @java.io.Serial
? 256 | int oldCapacity = elementData.length;
? 257 | int newCapacity = ArraysSupport.newLength(oldCapacity,
? 258 | minCapacity - oldCapacity, /* minimum growth */
? 259 | capacityIncrement > 0 ? capacityIncrement : oldCapacity
? 260 | /* preferred growth */);
? 261 | return elementData = Arrays.copyOf(elementData, newCapacity);
? 1144 | * Loads a {@code Vector} instance from a stream
? 1145 | * (that is, deserializes it).
? 1146 | * This method performs checks to ensure the consistency
? 1147 | * of the fields.
? 1148 | *
? 1149 | * @param in the stream
? 1150 | * @throws java.io.IOException if an I/O error occurs
? 1151 | * @throws ClassNotFoundException if the stream contains data
? 1152 | * of a non-existing class
? 1153 | */
? 1154 | @java.io.Serial
? 1155 | private void readObject(ObjectInputStream in)
? 1156 | throws IOException, ClassNotFoundException {
? 1157 | ObjectInputStream.GetField gfields = in.readFields();
? 1158 | int count = gfields.get("elementCount", 0);
? 1159 | Object[] data = (Object[])gfields.get("elementData", null);
? 1160 | if (count < 0 || data == null || count > data.length) {
? 1161 | throw new StreamCorruptedException("Inconsistent vector internals");
? 1162 | }
? 1163 | elementCount = count;
? 1164 | elementData = data.clone();
? 1165 | }
? 1166 |
? 1167 | /**
? 1176 | @java.io.Serial
? 1376 | // TODO(8203662): remove increment of modCount from ...
lines: 40 new; 0 covered; 0 not covered; 0 not code; 40 no information
Note that all lines are reported as "no information".
$ make jcov-test TEST=test/jdk/java/util/Vector
$ hg diff -r 49773 src/java.base/share/classes/java/util/Vector.java > diff.txt
$ java -jar .../jcov_3.0/lib/jcov.jar DiffCoverage -all build/.../test-results/jcov-output/result.xml diff.txt
? 2 | * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
? 28 |import java.io.IOException;
? 29 |import java.io.ObjectInputStream;
? 30 |import java.io.StreamCorruptedException;
? 35 |import jdk.internal.util.ArraysSupport;
? 36 |
? 105 | @SuppressWarnings("serial") // Conditionally serializable
? 128 | @java.io.Serial
? 256 | int oldCapacity = elementData.length;
? 257 | int newCapacity = ArraysSupport.newLength(oldCapacity,
? 258 | minCapacity - oldCapacity, /* minimum growth */
? 259 | capacityIncrement > 0 ? capacityIncrement : oldCapacity
? 260 | /* preferred growth */);
? 261 | return elementData = Arrays.copyOf(elementData, newCapacity);
? 1144 | * Loads a {@code Vector} instance from a stream
? 1145 | * (that is, deserializes it).
? 1146 | * This method performs checks to ensure the consistency
? 1147 | * of the fields.
? 1148 | *
? 1149 | * @param in the stream
? 1150 | * @throws java.io.IOException if an I/O error occurs
? 1151 | * @throws ClassNotFoundException if the stream contains data
? 1152 | * of a non-existing class
? 1153 | */
? 1154 | @java.io.Serial
? 1155 | private void readObject(ObjectInputStream in)
? 1156 | throws IOException, ClassNotFoundException {
? 1157 | ObjectInputStream.GetField gfields = in.readFields();
? 1158 | int count = gfields.get("elementCount", 0);
? 1159 | Object[] data = (Object[])gfields.get("elementData", null);
? 1160 | if (count < 0 || data == null || count > data.length) {
? 1161 | throw new StreamCorruptedException("Inconsistent vector internals");
? 1162 | }
? 1163 | elementCount = count;
? 1164 | elementData = data.clone();
? 1165 | }
? 1166 |
? 1167 | /**
? 1176 | @java.io.Serial
? 1376 | // TODO(8203662): remove increment of modCount from ...
lines: 40 new; 0 covered; 0 not covered; 0 not code; 40 no information
Note that all lines are reported as "no information".