View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   // Created: 2001
4   ////////////////////////////////////////////////////////////////////////////////
5   package com.puppycrawl.tools.checkstyle.checks.imports.illegalimport;
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.ArithmeticException;
15  import sun.applet.*;
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 sun.*;
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  /**
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 InputIllegalImportDefault
55  {
56      /** ignore **/
57      private Class mUse1 = Connection.class;
58      /** ignore **/
59      private Class mUse2 = java.io.File.class;
60      /** ignore **/
61      private Class mUse3 = null;
62      /** ignore **/
63      private Class mUse4 = java.util.Enumeration[].class;
64      /** usage of illegal import **/
65      private String 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 TestClass1#method1(TestClass2)}.
102      * Next is a class with typed method {@link TestClass3#method2(TestClass4, TestClass5)}.
103      *
104      * @param param1 with a link {@link TestClass6}
105      * @throws TestClass7 when broken
106      * @deprecated in 1 for removal in 2. Use {@link TestClass8}
107      */
108     public void aMethodWithManyLinks() {}
109 }