View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.coding.overloadmethodsdeclarationorder;
2   
3   
4   
5   class OverloadInput
6   {
7       public void overloadMethod(int i)
8       {
9           //some foo code
10      }
11  
12      public void overloadMethod(String s)
13      {
14          //some foo code
15      }
16  
17      public void overloadMethod(boolean b)
18      {
19          //some foo code
20      }
21  
22      public void fooMethod()
23      {
24  
25      }
26  
27      //error because overloads never split
28      public void overloadMethod(String s, Boolean b, int i) //warn
29      {
30          //some foo code
31      }
32      
33      OverloadInput anonymous = new OverloadInput()
34      {
35          public void overloadMethod(int i)
36          {
37              //some foo code
38          }
39  
40          public void overloadMethod(String s)
41          {
42              //some foo code
43          }
44  
45          public void overloadMethod(boolean b)
46          {
47              //some foo code
48          }
49  
50          public void fooMethod()
51          {
52  
53          }
54  
55          //error because overloads never split
56          public void overloadMethod(String s, Boolean b, int i) //warn
57          {
58              //some foo code
59          }
60      };
61  }
62  
63  interface Fooable
64  {
65      public abstract void foo(int i);
66      public abstract void foo(String s);
67      public abstract void noFoo();
68      public abstract void foo(String s, Boolean b, int i); //warn
69  }
70  
71  enum FooType {
72      Strategy(""),
73      Shooter(""),
74      RPG("");
75   
76      private String description;
77   
78      private FooType(String description) {
79          this.description = description;
80      }
81   
82      public String getDescription() {
83          return description;
84      }
85   
86      public void setDescription(String description) {
87          this.description = description;
88      }
89      
90      public void overloadMethod(int i)
91      {
92          //some foo code
93      }
94  
95      public void overloadMethod(String s)
96      {
97          //some foo code
98      }
99  
100     public void overloadMethod(boolean b)
101     {
102         //some foo code
103     }
104 
105     public void fooMethod()
106     {
107 
108     }
109 
110     //error because overloads never split
111     public void overloadMethod(String s, Boolean b, int i) //warn
112     {
113         //some foo code
114     }
115 }
116 
117 @interface ClassPreamble {
118     String author();
119 }