1   package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel;
2   public class InputOneTopLevelClassBasic
3   {
4       public InputOneTopLevelClassBasic() throws CloneNotSupportedException
5       {
6           super.equals(new String());
7           super.clone();
8       }
9   
10      public Object clone() throws CloneNotSupportedException
11      {
12          return super.clone();
13      }
14  
15      public void method() throws CloneNotSupportedException
16      {
17          super.clone();
18      }
19  
20      {
21          super.clone();
22      }
23  }
24  
25  class NoSuperClone //warn
26  {
27      public Object clone()
28      {
29          return null;
30      }
31  }
32  
33  class InnerClone //warn
34  {
35      public Object clone()
36      {
37          class Inner
38          {
39              public Object clone() throws CloneNotSupportedException
40              {
41                  return super.clone();
42              }
43          }
44          return null;
45      }
46  }
47  
48  // This could not pass as valid semantically but tests that
49  // type arguments are ignored when checking super calls
50  class CloneWithTypeArguments //warn
51  {
52      //Some code
53  }
54  
55  class CloneWithTypeArgumentsAndNoSuper //warn
56  {
57  }
58  
59  //Check that super keyword isn't snagged here
60  class MyClassWithGenericSuperMethod //warn
61  {
62      void someMethod(java.util.List<? super java.util.Map> l)
63      {
64          //Some code
65      }
66  
67      /**
68       * Not a valid clone override. Should not get flagged.
69       * @param o some object
70       * @return a cloned Object?
71       */
72      public static Object clone(Object o) {
73      return null;
74      }
75  }
76  
77  class AnotherClass { //warn
78  
79      /**
80       * Not a valid clone override. Should not get flagged.
81       * @param t some type
82       * @param <T> a type
83       * @return a cloned type?
84       */
85      public <T> T clone(T t) {
86      return null;
87      }
88  }