1class AnonymousClassDeclarations { 2 3 static class DoFn<I,O> { 4 static class ProcessContext { 5 public Long innerClassMethod() {} 6 } 7 8 enum MyEnum { 9 E1, E2, E3 10 } 11 12 public void process(ProcessContext context) {} 13 } 14 15 static class Transform<I,O> {} 16 17 static class ParDo { 18 static <I,O> Transform<I,O> of(DoFn<I,O> doFn) { 19 return null; 20 } 21 } 22 23 void fooBar1() { 24 ParDo.of(new DoFn<Integer,Long>() {}); 25 } 26 27 void fooBar2() { 28 ParDo.of(new DoFn<Integer,Long>() { 29 public void process(ProcessContext c){ 30 return c.innerClassMethod(); 31 } 32 }); 33 } 34 35 void fooBar3() { 36 ParDo.of(new DoFn<Integer,Long>() { 37 38 void callAnnonClassInnerMethod() {} 39 40 public void process(ProcessContext c) { 41 callAnnonClassInnerMethod(); 42 } 43 }); 44 } 45 46 void fooBar4() { 47 ParDo.of(new DoFn<Integer,Long>() { 48 49 void callAnnonClassInnerMethod() {} 50 51 public void process(ProcessContext c) { 52 MyEnum.E3.toString(); 53 } 54 }); 55 } 56 57 void fooBar5() { 58 ParDo.of(new DoFn<Integer,Long>() { 59 60 void callAnnonClassInnerMethod() {} 61 62 enum MyInnerEnum { 63 E1, E2, E3 64 } 65 public void process(ProcessContext c) { 66 MyInnerEnum.E3.toString(); 67 } 68 }); 69 } 70 71 void fooBar6() { 72 new DoFn.ProcessContext() {}.innerClassMethod(); 73 } 74 75} 76