1
2 package uk.co.badgersinfoil.cvprof.example;
3
4 public class Initializers {
5
6 // Class initialisation code, called after the class is loaded
7 // but before any instance has been created
|
8 static {
9 String a = "foo";
|
10 }
11
12 // Code to initialise class fields is gathered together and executed
13 // at the time that any static initialisation blocks (like the one
14 // above)
|
15 private static Object classVar = new Object();
|
16
17
18 // Code to initialse instance varables is gatherd together, and a copy
19 // is added to the start of each constructor. This means that one
20 // copy of the code may be covered, while the copy in another
21 // constructor is not.
22 //
23 // Coverage reporting in such instances will be confusing, until
24 // cvprof is taught to report 'partial coverage'
|
25 > private Object instanceVar = new Object();
|
26
|
27 public Initializers() {
28 }
|
29
30 /** This constructor doesn't get called */
|
31 > public Initializers(String name) {
|
32 // we ignore our argument, for no particular reason
|
33 > }
|
34
35 public void test() {
|
36 }
|
37 }
|