1
2
3
4
5
6
7 package com.puppycrawl.tools.checkstyle.checks.coding.finallocalvariable;
8
9 import java.net.CacheRequest;
10 import java.util.Collection;
11 import java.util.HashSet;
12 import java.util.List;
13
14 public class InputFinalLocalVariable3 {
15
16 private List<ProblemDescriptor> checkCodeBlock(final PsiCodeBlock body) {
17 if (body == null) return null;
18 final ControlFlow flow = new ControlFlow();
19 try {
20 int start = flow.getStartOffset(body);
21
22 int end = flow.getEndOffset(body);
23
24
25 final HashSet<Object> result = new HashSet<>();
26 body.accept(new JavaRecursiveElementWalkingVisitor() {
27
28 public void visitPatternVariable(Object variable) {
29 super.visitPatternVariable(variable);
30 if (true) return;
31 if (true) {
32 return;
33 }
34 int from;
35 int end;
36 if (true) {
37 from = flow.getEndOffset(body);
38 end = flow.getEndOffset(body);
39 } else if (false) {
40 PsiCodeBlock list;
41 end = flow.getEndOffset(body);
42 } else if (true) {
43 CacheRequest forEach;
44
45 PsiStatement body = null;
46
47 if (body == null) return;
48 from = flow.getStartOffset(body);
49 end = flow.getEndOffset(body);
50 } else {
51 return;
52 }
53 from = MathUtil.clamp(from, 0, flow.getInstructions().size());
54 end = MathUtil.clamp(end, from, flow.getInstructions().size());
55 }
56 });
57 } catch (Exception e) {
58 throw new RuntimeException(e);
59 }
60 return null;
61 }
62 }
63
64 class PsiStatement {
65 }
66
67 class MathUtil {
68
69 public static int clamp(int from, int i, int size) {
70 return 0;
71 }
72 }
73
74 class PsiExpression {
75 }
76
77 class ProblemDescriptor {
78 }
79
80 class PsiCodeBlock {
81 public void accept(JavaRecursiveElementWalkingVisitor javaRecursiveElementWalkingVisitor) {
82 }
83 }
84
85 abstract class JavaRecursiveElementWalkingVisitor {
86
87 protected void visitPatternVariable(Object variable) {
88
89 }
90 }
91
92 class ControlFlow {
93 public int getStartOffset(PsiCodeBlock body) {
94 return 0;
95 }
96
97 public int getEndOffset(PsiCodeBlock body) {
98 return 0;
99 }
100
101 public Collection<Object> getInstructions() {
102 return null;
103 }
104
105 public int getStartOffset(PsiStatement body) {
106 return 0;
107 }
108
109 public int getEndOffset(PsiStatement body) {
110 return 0;
111 }
112
113 public int getStartOffset(PsiExpression guardingExpression) {
114 return 0;
115 }
116 }