1 package com.puppycrawl.tools.checkstyle; 6 7 import java.io.*; import java.awt.Dimension ; import java.awt.Color ; 10 11 15 class InputSemantic 16 { 17 18 static { 19 Boolean x = new Boolean (true); 20 } 21 22 23 { 24 Boolean x = new Boolean (true); 25 Boolean [] y = new Boolean []{Boolean.TRUE, Boolean.FALSE}; 26 } 27 28 29 Boolean getBoolean() 30 { 31 return new java.lang.Boolean (true); 32 } 33 34 void otherInstantiations() 35 { 36 Object o1 = new InputBraces(); 38 Object o2 = new InputModifier(); 39 ByteArrayOutputStream s = new ByteArrayOutputStream(); 41 File f = new File("/tmp"); 42 Dimension dim = new Dimension (); 44 Color col = new Color (0, 0, 0); 45 } 46 47 void exHandlerTest() 48 { 49 try { 50 ; } 52 catch (IllegalStateException emptyCatchIsAlwaysAnError) { 53 } 54 catch (NullPointerException ex) { 55 } 58 catch (ArrayIndexOutOfBoundsException ex) { 59 ; 60 } 63 catch (NegativeArraySizeException ex) { 64 { 65 } 66 } 68 catch (UnsupportedOperationException handledException) { 69 System.out.println(handledException.getMessage()); 70 } 71 catch (SecurityException ex) { } 72 catch (StringIndexOutOfBoundsException ex) {} 73 catch (IllegalArgumentException ex) { } 74 75 try { 76 } 77 finally { 78 } 79 try { 80 } 82 finally { 83 } 85 try { 86 ; } 88 finally { 89 ; } 91 } 92 93 94 private static final long IGNORE = 666l + 666L; 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 public class EqualsVsHashCode1 117 { 118 public boolean equals(int a) { 120 return a == 1; 121 } 122 } 123 124 public class EqualsVsHashCode2 125 { 126 public boolean equals(String a) { 128 return true; 129 } 130 } 131 132 public class EqualsVsHashCode3 133 { 134 public boolean equals(Object a) { 136 return true; 137 } 138 139 public int hashCode() 140 { 141 return 0; 142 } 143 } 144 145 public class EqualsVsHashCode4 146 { 147 ByteArrayOutputStream bos1 = new ByteArrayOutputStream() 149 { 150 public boolean equals(Object a) { 152 return true; 153 } 154 155 public int hashCode() 156 { 157 return 0; 158 } 159 }; 160 161 ByteArrayOutputStream bos2 = new ByteArrayOutputStream() 162 { 163 public boolean equals(Object a) { 165 return true; 166 } 167 }; 168 } 169 170 public void triggerEmptyBlockWithoutBlock() 171 { 172 if (true) 174 return; 175 } 176 177 { 179 } 180 181 public class EqualsVsHashCode5 182 { 183 public <A> boolean equals(int a) { 185 return a == 1; 186 } 187 } 188 189 public class EqualsVsHashCode6 190 { 191 public <A> boolean equals(Comparable <A> a) { 193 return true; 194 } 195 } 196 197 } 198 | Popular Tags |