View Javadoc
1   /*
2   VariableDeclarationUsageDistance
3   allowedDistance = (default)3
4   ignoreVariablePattern = (default)
5   validateBetweenScopes = (default)false
6   ignoreFinal = (default)true
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.coding.variabledeclarationusagedistance;
12  
13  import java.awt.event.ActionListener;
14  import java.awt.event.ActionEvent;
15  import javax.swing.JMenuItem;
16  
17  public class InputVariableDeclarationUsageDistanceAnonymous {
18      public void method() {
19          JMenuItem prefs = new JMenuItem("Preferences..."); // violation 'Distance .* is 4.'
20  
21          nothing();
22          nothing();
23          nothing();
24          prefs.addActionListener(new ActionListener() {
25              public void actionPerformed(ActionEvent e) {
26              }
27          });
28      }
29  
30      public void nothing() {
31      }
32  }