summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/inspection/dataFlow/CheckedExceptionDominance/src/Test.java
blob: 4a0a690f0e21b214353713c53977d738ba62606e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 public class CheckedExceptionDominance {
   private static class CheckedException extends Exception {}

   public static void foo() {
     boolean flag = true;

     try {
       bar();
     }
     catch (CheckedException e) {
       flag = false;
     }
     catch (Exception e) {
     }

     if (flag) { // This should not be highlighted as always true;
       System.out.println("Must not happen");
     }
   }

   public static void bar() throws CheckedException {
     throw new CheckedException();
   }
 }