1 package com.puppycrawl.tools.checkstyle.coding; 2 3 public class InputInnerAssignment 4 { 5 void innerAssignments() 6 { 7 int a; 8 int b; 9 int c; 10 11 a = b = c = 1; 13 String s = Integer.toString(b = 2); 15 Integer i = new Integer (a += 5); 17 c = b++; 20 for (int j = 0; j < 6; j += 2) { a += j; 22 } 23 } 24 25 public void demoBug1195047Comment3() 26 { 27 int y = 1; 29 int b = 0; 30 boolean bb; 31 int i; 32 33 if (bb = false) {} 34 for (i = 0; bb = false; i = i + 1) {} 35 while (bb = false) {} 36 if ((bb = false)) {} 37 for (int j = 0; (bb = false); j += 1) {} 38 while ((bb = false)) {} 39 i = (bb = false) ? (b = 2) : (b += 1); 40 i = (b += 1) + (b -= 1); 41 do {i += 1;} while (bb = false); 42 } 43 44 public static void demoInputStreamIdiom(java.io.InputStream is) throws java.io.IOException 45 { 46 int b; 47 while ((b = is.read()) != -1) { 49 } 51 } 52 53 public static void demoNoBrace() 54 { 55 int sum = 0; 59 60 for (int i = 0; i < 3; i++) 61 sum = sum + i; 62 63 if (sum > 4) 64 sum += 2; 65 else if (sum < 2) 66 sum += 1; 67 else 68 sum += 100; 69 70 while (sum > 4) 71 sum -= 1; 72 73 do 74 sum = sum + 1; 75 while (sum < 6); 76 } 77 78 @SuppressWarnings (value = "unchecked") 79 public java.util.Collection <Object > allParams() { 80 java.util.ArrayList params = new java.util.ArrayList (); 81 params.add("one"); 82 params.add("two"); 83 return params; 84 } 85 } 86 | Popular Tags |