View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   // Created: 2001
4   ////////////////////////////////////////////////////////////////////////////////
5   package com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport;
6   
7   import com.puppycrawl.tools.checkstyle.checks.imports.*;
8   
9   import java.io.*;
10  import java.lang.*;
11  import java.sql.Connection;
12  import java.util.List;
13  import java.util.List;
14  import java.lang.*;
15  import java.util.Iterator;
16  import java.util.Enumeration;
17  import java.util.Arrays;
18  
19  import javax.swing.JToolBar;
20  import javax.swing.JToggleButton;
21  import javax.swing.ScrollPaneLayout;
22  import javax.swing.BorderFactory;
23  import static java.io.File.listRoots;
24  
25  import static javax.swing.WindowConstants.*;
26  import static javax.swing.WindowConstants.*;
27  import static java.io.File.createTempFile;
28  import static java.io.File.pathSeparator;
29  import static com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass;
30  import static com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one;
31  
32  import java.awt.Component;
33  import java.awt.Graphics2D;
34  import java.awt.HeadlessException;
35  import java.awt.Label;
36  import java.util.Date;
37  import java.util.Calendar;
38  import java.util.BitSet;
39  
40  import com.puppycrawl.tools.checkstyle.Checker;
41  import com.puppycrawl.tools.checkstyle.CheckerTest;
42  import com.puppycrawl.tools.checkstyle.Definitions;
43  import com.puppycrawl.tools.checkstyle.ConfigurationLoaderTest;
44  import com.puppycrawl.tools.checkstyle.PackageNamesLoader;
45  import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
46  import com.puppycrawl.tools.checkstyle.DefaultLogger;
47  
48  /**
49   * Test case for imports
50   * Here's an import used only by javadoc: {@link Date}.
51   * @author Oliver Burn
52   * @author lkuehne
53   * @author Michael Studman
54   * @see Calendar Should avoid unused import for Calendar
55   **/
56  class InputAvoidStaticImportDefault
57  {
58      /** ignore **/
59      private Class mUse1 = Connection.class;
60      /** ignore **/
61      private Class mUse2 = java.io.File.class;
62      /** ignore **/
63      private Class mUse3 = Iterator[].class;
64      /** ignore **/
65      private Class mUse4 = java.util.Enumeration[].class;
66      /** usage of illegal import **/
67      private String ftpClient = null;
68  
69      /** usage via static method, both normal and fully qualified */
70      {
71          int[] x = {};
72          Arrays.sort(x);
73          Object obj = javax.swing.BorderFactory.createEmptyBorder();
74          File[] files = listRoots();
75      }
76  
77      /** usage of inner class as type */
78      private JToolBar.Separator mSep = null;
79  
80      /** usage of inner class in Constructor */
81      private Object mUse5 = new Object();
82  
83      /** usage of inner class in constructor, fully qualified */
84      private Object mUse6 = new javax.swing.JToggleButton.ToggleButtonModel();
85  
86      /** we use class name as member's name.
87       *  also an inline JavaDoc-only import {@link Vector linkText} */
88      private int Component;
89  
90      /**
91       * method comment with JavaDoc-only import {@link BitSet#aMethod()}
92       */
93      public void Label() {}
94      
95      /**
96       * Renders to a {@linkplain Graphics2D graphics context}.
97       * @throws HeadlessException if no graphis environment can be found.
98       * @exception HeadlessException if no graphis environment can be found.
99       */
100     public void render() {}
101 
102     /**
103      * First is a class with a method with arguments {@link TestClass1#method1(TestClass2)}.
104      * Next is a class with typed method {@link TestClass3#method2(TestClass4, TestClass5)}.
105      *
106      * @param param1 with a link {@link TestClass6}
107      * @throws TestClass7 when broken
108      * @deprecated in 1 for removal in 2. Use {@link TestClass8}
109      */
110     public void aMethodWithManyLinks() {}
111 }