1 /*
2 DescendantToken
3 limitedTokens = LITERAL_RETURN
4 minimumDepth = (default)0
5 maximumDepth = (default)2147483647
6 minimumNumber = (default)0
7 maximumNumber = 0
8 sumTokenCounts = (default)false
9 minimumMessage = (default)null
10 maximumMessage = Return from finally is not allowed.
11 tokens = LITERAL_FINALLY
12
13
14 */
15
16 package com.puppycrawl.tools.checkstyle.checks.descendanttoken;
17
18 public class InputDescendantTokenReturnFromFinally {
19 public void foo() {
20 try {
21 System.currentTimeMillis();
22 } finally { // violation 'Return from finally is not allowed'
23 return;
24 }
25 }
26
27 public void bar() {
28 try {
29 System.currentTimeMillis();
30 } finally { // violation 'Return from finally is not allowed'
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);
38 boolean result2 = (this != null) && (null != this);
39 boolean result3 = (this.getClass().getName()
40 == String.valueOf(null == System.getProperty("abc")));
41 }
42 }