• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package test3;
2 
3 class NewExprTryCatch2 {
4 }
5 
6 public class NewExprTryCatch {
instrumentMe()7     public void instrumentMe() {
8         // we need a 'new' expression to instrument, the exact type is not important
9         new Object();
10         // if the try/catch block below is removed, the error does not occur
11         try {
12             System.out.println();
13         } catch (Throwable t) {
14         }
15     }
16 
me2()17     public void me2() throws Exception {
18         // the error is somehow related to the string concatenation and local variables,
19         // when the code below is replaced with something else, the error does not occur.
20         String s1 = "a";
21         @SuppressWarnings("unused")
22         String s2 = s1 + "b";
23     }
24 
test()25     public int test() throws Exception {
26         instrumentMe();
27         me2();
28         return 0;
29     }
30 }
31