1 package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; 2 3 import java.util.Collection; 4 import java.util.Map; 5 6 // we need these interfaces for generics 7 // violation below 'Top-level class Foo has to reside in its own source file.' 8 interface Foo {} 9 10 // violation below 'Top-level class Foo2 has to reside in its own source file.' 11 interface Foo2 {} 12 13 /** some javadoc. */ 14 public class InputWhitespaceAroundGenerics {} 15 16 // No whitespace after commas 17 // violation below 'Top-level class BadCommas has to reside in its own source file.' 18 class BadCommas < A, B, C extends Map < A, String > > { 19 // 7 violations above: 20 // ''\<' is followed by whitespace.' 21 // ''\<' is preceded with whitespace.' 22 // ''\<' is followed by whitespace.' 23 // ''\<' is preceded with whitespace.' 24 // ''\>' is followed by whitespace.' 25 // ''\>' is preceded with whitespace.' 26 // ''\>' is preceded with whitespace.' 27 private final java.util.Hashtable < Integer, Foo > test = 28 // 3 violations above: 29 // ''\<' is followed by whitespace.' 30 // ''\<' is preceded with whitespace.' 31 // ''\>' is preceded with whitespace.' 32 new java.util.Hashtable < Integer, Foo >(); 33 // 3 violations above: 34 // ''\<' is followed by whitespace.' 35 // ''\<' is preceded with whitespace.' 36 // ''\>' is preceded with whitespace.' 37 } 38 39 // violation below 'Top-level class Wildcard has to reside in its own source file.' 40 class Wildcard { 41 public static void foo(Collection < ? extends Wildcard[] > collection) { 42 // 3 violations above: 43 // ''\<' is followed by whitespace.' 44 // ''\<' is preceded with whitespace.' 45 // ''\>' is preceded with whitespace.' 46 // A statement is important in this method to flush out any 47 // issues with parsing the wildcard in the signature 48 collection.size(); 49 } 50 51 public static void foo2(Collection<? extends Wildcard[]> collection) { 52 // A statement is important in this method to flush out any 53 // issues with parsing the wildcard in the signature 54 collection.size(); 55 } 56 }