RFR: 7902783: Static instrumentation fails with Java 9 and above if multiple inputs are used

Leonid Kuskov lkuskov at openjdk.java.net
Sat Dec 5 01:23:21 UTC 2020


This is the fix for https://bugs.openjdk.java.net/browse/CODETOOLS-7902783

java -jar jcov.jar instr -verbose -t [template] -i [pattern] -o [output] [input1] [input2]
In certain cases input classes: [input1], [input2] for instrumentation should be loaded by jcov via reflection.
Starting from version 9 Java SE and the JDK do not provide an API for applications to dynamically augment the class path at run-time. 
The fix checks the application class loader is not an instance of java.net.URLClassLoader. 
In this case, the jcov throws the message otherwise the application dynamically adds input classes: [input1], [input2] to the classpath.

-------------

Commit messages:
 - 7902783: Static instrumentation fails with Java 9 and above if multiple inputs are used
 - Merge remote-tracking branch 'upstream/master'
 - 7902724: jcov ignores covariant method overriding while gathering a methods' coverages
 - 7902642: Make JCov runtime to only depend on java.base
 - Merge branch 'CODETOOLS-7902697'
 - 7902697: Switch jcov to the latest asm lib to support latest classfile
 - Merge branch 'master' of https://github.com/lkuskov/jcov
 - 7902535: Code coverage does not work in JDK 8

Changes: https://git.openjdk.java.net/jcov/pull/5/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jcov&pr=5&range=00
  Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7902783
  Stats: 121 lines in 4 files changed: 40 ins; 45 del; 36 mod
  Patch: https://git.openjdk.java.net/jcov/pull/5.diff
  Fetch: git fetch https://git.openjdk.java.net/jcov pull/5/head:pull/5

PR: https://git.openjdk.java.net/jcov/pull/5


More information about the jcov-dev mailing list