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