Home | History | Annotate | Download | only in dummy
      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 
     23 public class InnerTest {
     24 
     25     private int mSomeField;
     26     private MyStaticInnerClass mInnerInstance;
     27     private MyIntEnum mTheIntEnum;
     28     private MyGenerics1<int[][], InnerTest, MyIntEnum, float[]> mGeneric1;
     29 
     30     public class NotStaticInner2 extends NotStaticInner1 {
     31 
     32     }
     33 
     34     public class NotStaticInner1 {
     35 
     36         public void someThing() {
     37             mSomeField = 2;
     38             mInnerInstance = null;
     39         }
     40 
     41     }
     42 
     43     private static class MyStaticInnerClass {
     44 
     45     }
     46 
     47     private static class DerivingClass extends InnerTest {
     48 
     49     }
     50 
     51     // enums are a kind of inner static class
     52     public enum MyIntEnum {
     53         VALUE0(0),
     54         VALUE1(1),
     55         VALUE2(2);
     56 
     57         MyIntEnum(int myInt) {
     58             this.myInt = myInt;
     59         }
     60         final int myInt;
     61     }
     62 
     63     public static class MyGenerics1<T, U, V, W> {
     64         public MyGenerics1() {
     65             int a = 1;
     66         }
     67     }
     68 
     69     public <X> void genericMethod1(X a, X[] a) {
     70     }
     71 
     72     public <X, Y> void genericMethod2(X a, List<Y> b) {
     73     }
     74 
     75     public <X, Y> void genericMethod3(X a, List<Y extends InnerTest> b) {
     76     }
     77 
     78     public <T extends InnerTest> void genericMethod4(T[] a, Collection<T> b, Collection<?> c) {
     79         Iterator<T> i = b.iterator();
     80     }
     81 
     82     public void someMethod(InnerTest self) {
     83         mSomeField = self.mSomeField;
     84         MyStaticInnerClass m = new MyStaticInnerClass();
     85         mInnerInstance = m;
     86         mTheIntEnum = null;
     87         mGeneric1 = new MyGenerics1();
     88         genericMethod(new DerivingClass[0], new ArrayList<DerivingClass>(), new ArrayList<InnerTest>());
     89     }
     90 }
     91