use jacoco instrument command to get probed class and it seems strange

14 views
Skip to first unread message

Jiajie Zhuang

unread,
Nov 16, 2024, 4:16:18 PM11/16/24
to JaCoCo and EclEmma Users
this is my source code :
public class App { 
 public static void main(String[] args) throws InterruptedException { 
 System.out.println( "invoke invoke main" ); 
 while( true ) { Thread.currentThread().sleep( 1000 ); 
 System.out.println( new Date() ); 
 }
 }
 }

and this is the class I got by using instrument command 
public class App { 
 public App() { 
 boolean[] var2 = (boolean[])"$jacocoData"; 
 super(); 
 var2[0] = true; 
 } 

 public static void main(String[] args) throws InterruptedException { 
 boolean[] var2 = (boolean[])"$jacocoData"; 
 System.out.println("invoke invoke main"); 
 var2[1] = true; 
 while(true) { 
 Thread.currentThread(); 
 Thread.sleep(1000L); 
 var2[2] = true; 
 System.out.println(new Date()); 
 var2[3] = true; 
 
 } 
}

why the static field $jacocoData and init method $jacocoInit() are not in the class file?

this is the stackoverflow link
Reply all
Reply to author
Forward
0 new messages