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