View Javadoc
1   /*
2   DescendantToken
3   limitedTokens = LITERAL_THIS, LITERAL_NULL
4   minimumDepth = (default)0
5   maximumDepth = 1
6   minimumNumber = (default)0
7   maximumNumber = 1
8   sumTokenCounts = true
9   minimumMessage = (default)null
10  maximumMessage = this cannot be null.
11  tokens = NOT_EQUAL, EQUAL
12  
13  
14  */
15  
16  package com.puppycrawl.tools.checkstyle.checks.descendanttoken;
17  
18  public class InputDescendantTokenReturnFromFinally3 {
19      public void foo() {
20          try {
21              System.currentTimeMillis();
22          } finally {
23              return;
24          }
25      }
26  
27      public void bar() {
28          try {
29              System.currentTimeMillis();
30          } finally {
31              if (System.currentTimeMillis() == 0) {
32                  return; // return from if statement
33              }
34          }
35      }
36      public void thisNull() {
37          boolean result = (this == null) || (null == this); // 2 violations
38          boolean result2 = (this != null) && (null != this); // 2 violations
39          boolean result3 = (this.getClass().getName()
40              == String.valueOf(null == System.getProperty("abc")));
41      }
42  }