View Javadoc
1   package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing;
2   
3   import static java.io.File.createTempFile;
4   import static java.awt.Button.ABORT;
5   // violation above '.* 'java.awt.Button.ABORT' .* Should be before 'java.io.File.createTempFile'.'
6   
7   import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
8   // violation above 'Extra separation .* before 'javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE''
9   
10  import com.google.checkstyle.test.chapter2filebasic.rule21filename.FileNameTest;
11  import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.SourceFileStructureTest;
12  import com.google.common.reflect.Invokable;
13  import java.util.List;
14  
15  
16  import java.util.StringTokenizer;
17  // violation above 'Extra separation in import group before 'java.util.StringTokenizer''
18  
19  import java.util.concurrent.AbstractExecutorService;
20  // violation above 'Extra separation .* before 'java.util.concurrent.AbstractExecutorService''
21  
22  /** Some javadoc. */
23  public class InputOrderingAndSpacing4 {
24    /** Some javadoc. */
25    public static void main(String[] args) {
26      // Use of static imports
27      try {
28        createTempFile("temp", ".txt");
29      } catch (Exception e) {
30        e.printStackTrace();
31      }
32      int abortAction = ABORT;
33      int closeOperation = DO_NOTHING_ON_CLOSE;
34  
35      // Use of com.google classes
36      FileNameTest fileNameTest = new FileNameTest();
37      SourceFileStructureTest sourceFileStructureTest = new SourceFileStructureTest();
38      Invokable<?, ?> invokable = Invokable.from(Object.class.getDeclaredMethods()[0]);
39  
40      // Use of java.util classes
41      List<String> list;
42      StringTokenizer tokenizer = new StringTokenizer("Hello World");
43  
44      // Use of java.util.concurrent classes
45      AbstractExecutorService abstractExecutorService = new AbstractExecutorService() {
46        @Override
47        public void shutdown() {
48        }
49  
50        @Override
51        public java.util.List<Runnable> shutdownNow() {
52          return null;
53        }
54  
55        @Override
56        public boolean isShutdown() {
57          return false;
58        }
59  
60        @Override
61        public boolean isTerminated() {
62          return false;
63        }
64  
65        @Override
66        public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) {
67          return false;
68        }
69  
70        @Override
71        public void execute(Runnable command) {
72        }
73      };
74    }
75  }