1 package com.puppycrawl.tools.checkstyle.usage; 2 3 4 public class InputUnusedMethod 5 { 6 7 private void methodUnused0() 8 { 9 } 10 11 private void methodUsed0() 12 { 13 } 14 15 private void methodUsed1(int aParam) 16 { 17 } 18 19 private void methodUsed1(double aParam) 20 { 21 } 22 23 private void methodUsed1(String aParam) 24 { 25 } 26 27 public static void main(String [] args) 28 { 29 InputUnusedMethod method = new InputUnusedMethod(); 30 method.methodUsed0(); 31 method.methodUsed1(0 + 4); 32 method.methodUsed1(Math.sqrt(2.0)); 33 method.methodUsed1("" + "a"); 34 } 35 } 36 37 interface InterfaceMethod 38 { 39 public void method(int aParam); 40 } 41 42 abstract class AbstractClassMethod 43 { 44 public abstract void method(int aParam); 45 } 46 47 50 class Ternary 51 { 52 private int m() 53 { 54 return 1; 55 } 56 57 public void m1() 58 { 59 int i = 0; 60 int j = (i == 0) ? (i) : m(); 61 } 62 } 63 64 class SerializableTest implements java.io.Serializable 65 { 66 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException 67 { 68 } 70 71 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException , ClassNotFoundException 72 { 73 } 75 76 private Object writeReplace() throws java.io.ObjectStreamException 77 { 78 return new SerializableTest(); 80 } 81 82 private Object readResolve() throws java.io.ObjectStreamException 83 { 84 return new SerializableTest(); 86 } 87 } 88 89 class BadSerializableTest1 implements java.io.Serializable 90 { 91 private void writeObject(Object out) throws java.io.IOException 92 { 93 } 94 95 private void writeObject(java.io.ObjectOutputStream out, int i) throws java.io.IOException 96 { 97 } 98 99 private void writeObject(java.io.ObjectOutputStream out) 100 { 101 } 102 103 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException 104 { 105 } 106 107 private void readObject(Object in) throws java.io.IOException , ClassNotFoundException 108 { 109 } 110 111 private int writeReplace() throws java.io.ObjectStreamException 112 { 113 return 1; 114 } 115 116 private Object writeReplace(int i) throws java.io.ObjectStreamException 117 { 118 return new SerializableTest(); 119 } 120 121 private int readResolve() throws java.io.ObjectStreamException 122 { 123 return 1; 124 } 125 126 private Object readResolve(int i) throws java.io.ObjectStreamException 127 { 128 return new SerializableTest(); 129 } 130 } 131 132 class BadSerializableTest2 implements java.io.Serializable 133 { 134 private int writeObject(java.io.ObjectOutputStream out) throws java.io.IOException 135 { 136 return 1; 137 } 138 139 private void readObject(java.io.ObjectInputStream in) throws ClassNotFoundException 140 { 141 } 142 143 private Object readResolve() 144 { 145 return new SerializableTest(); 146 } 147 } 148 149 class BadSerializableTest3 implements java.io.Serializable 150 { 151 private int readObject(java.io.ObjectInputStream in) throws java.io.IOException , ClassNotFoundException 152 { 153 return 1; 154 } 155 } 156 | Popular Tags |