View Javadoc
1   package com.google.checkstyle.test.chapter3filestructure.rule331nowildcard;
2   
3   import static java.io.File.createTempFile;
4   import static java.io.File.listRoots;
5   import static javax.swing.WindowConstants.*;
6   // violation above '.* '.*' form of import should be avoided - javax.swing.WindowConstants.*.'
7   
8   import java.awt.Component;
9   import java.awt.Graphics2D;
10  import java.awt.HeadlessException;
11  import java.awt.Label;
12  import java.io.*; // violation 'Using the '.*' form of import should be avoided - java.io.*.'
13  import java.sql.Connection;
14  import java.util.Arrays;
15  import java.util.BitSet;
16  import java.util.Calendar;
17  import java.util.Date;
18  import java.util.Enumeration;
19  import java.util.Iterator;
20  import java.util.List;
21  import javax.swing.BorderFactory;
22  import javax.swing.JToggleButton;
23  import javax.swing.JToolBar;
24  import javax.swing.ScrollPaneLayout;
25  
26  class InputNoWildcardImports {
27    public static void main(String[] args) {
28      // Use of static imports
29      try {
30        createTempFile("temp", ".txt");
31        File[] roots = listRoots();
32      } catch (IOException e) {
33        e.printStackTrace();
34      }
35      int closeOperation = EXIT_ON_CLOSE;
36  
37      // Use of java.awt classes
38      Component component;
39      Graphics2D graphics2D;
40      Label label = new Label();
41      HeadlessException headlessException = new HeadlessException();
42  
43      // Use of java.io classes
44      FileReader fileReader;
45      BufferedReader bufferedReader;
46      InputStream inputStream;
47      OutputStream outputStream;
48  
49      // Use of java.lang classes
50      String string = new String("Hello");
51      Object obj = new Object();
52  
53      // Use of java.sql classes
54      Connection connection;
55  
56      // Use of java.util classes
57      List<String> list = Arrays.asList("One", "Two", "Three");
58      BitSet bitSet = new BitSet();
59      Calendar calendar = Calendar.getInstance();
60      Date date = new Date();
61      Enumeration<String> enumeration;
62      Iterator<String> iterator;
63  
64      // Use of javax.swing classes
65      JToggleButton toggleButton = new JToggleButton();
66      JToolBar toolBar = new JToolBar();
67      ScrollPaneLayout scrollPaneLayout = new ScrollPaneLayout();
68      BorderFactory.createEmptyBorder();
69    }
70  }