• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.eclipse.org/org/documents/epl-v10.php
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package mock_android.dummy;
18 
19 import java.util.ArrayList;
20 import java.util.Collection;
21 import java.util.Iterator;
22 import java.util.List;
23 
24 public class InnerTest {
25 
26     private int mSomeField;
27     private MyStaticInnerClass mInnerInstance;
28     private MyIntEnum mTheIntEnum;
29     private MyGenerics1<int[][], InnerTest, MyIntEnum, float[]> mGeneric1;
30 
31     public class NotStaticInner2 extends NotStaticInner1 {
32 
33     }
34 
35     public class NotStaticInner1 {
36 
someThing()37         public void someThing() {
38             mSomeField = 2;
39             mInnerInstance = null;
40         }
41 
42     }
43 
44     private static class MyStaticInnerClass {
45 
46     }
47 
48     private static class DerivingClass extends InnerTest {
49 
50     }
51 
52     // enums are a kind of inner static class
53     public enum MyIntEnum {
54         VALUE0(0),
55         VALUE1(1),
56         VALUE2(2);
57 
MyIntEnum(int myInt)58         MyIntEnum(int myInt) {
59             this.myInt = myInt;
60         }
61         final int myInt;
62     }
63 
64     public static class MyGenerics1<T, U, V, W> {
MyGenerics1()65         public MyGenerics1() {
66             int a = 1;
67         }
68     }
69 
genericMethod1(X a, X[] b)70     public <X> void genericMethod1(X a, X[] b) {
71     }
72 
genericMethod2(X a, List<Y> b)73     public <X, Y> void genericMethod2(X a, List<Y> b) {
74     }
75 
genericMethod3(X a, List<Y> b)76     public <X, Y extends InnerTest> void genericMethod3(X a, List<Y> b) {
77     }
78 
genericMethod4(T[] a, Collection<T> b, Collection<?> c)79     public <T extends InnerTest> void genericMethod4(T[] a, Collection<T> b, Collection<?> c) {
80         Iterator<T> i = b.iterator();
81     }
82 
someMethod(InnerTest self)83     public void someMethod(InnerTest self) {
84         mSomeField = self.mSomeField;
85         MyStaticInnerClass m = new MyStaticInnerClass();
86         mInnerInstance = m;
87         mTheIntEnum = null;
88         mGeneric1 = new MyGenerics1();
89         genericMethod4(new DerivingClass[0], new ArrayList<DerivingClass>(), new ArrayList<InnerTest>());
90     }
91 }
92