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