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