private void insertTInvocation0 ( String className , int probeId ) { // Check if class name has been seen since the last label. if ( ! mSeenClasses . add ( className ) ) return ; // Check if this class name should be ignored. if ( Types . isIgnorableInternalName ( className ) ) return ; // x. (we tried). Surround invocation of monitor with // try/finally. This approach did not work in some cases as I // was using local variables to save exception exception that // has to be thrown; however, the same local variable may be // used in finally block, so I would override. // NOTE: The following is deprecated and excluded from code // (see monitor for new approach and accesses to fields): // We check if class contains "$" in which case we assume (without // consequences) that the class is inner and we invoke coverage method // that takes string as input. The reason for this special treatment is // access policy, as the inner class may be private and we cannot load // its .class. (See 57f5365935d26d2e6c47ec368612c6b003a2da79 for the // test that is throwing an exception without this.) However, note // that this slows down the execution a lot. // boolean isNonInnerClass = !className.contains("$"); boolean isNonInnerClass = true ; // See the class visitor; currently we override // the version number to 49 for all classes that have lower version // number (so else branch should not be executed for this reason any // more). Earlier comment: Note that we have to use class name in case // of classes that have classfiles with major version of 48 or lower // as ldc could not load .class prior to version 49 (in theory we // could generate a method that does it for us, as the compiler // would do, but then we would change bytecode too much). if ( isNonInnerClass && mIsNewerThanJava4 ) { insertTInvocation ( className , probeId ) ; } else { // DEPRECATED: This part is deprecated and should never be executed. // Using Class.forName(className) was very slow. mv . visitLdcInsn ( className . replaceAll ( "/" , "." ) ) ; mv . visitMethodInsn ( Opcodes . INVOKESTATIC , Names . COVERAGE_MONITOR_VM , Instr . COVERAGE_MONITOR_MNAME , Instr . STRING_V_DESC , false ) ; } }
Checks if the class name belongs to a set of classes that should be ignored ; if not an invocation to coverage monitor is inserted .