Home | History | Annotate | Download | only in annotationremoval
      1 // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
      2 // for details. All rights reserved. Use of this source code is governed by a
      3 // BSD-style license that can be found in the LICENSE file.
      4 package annotationremoval;
      5 
      6 public class OuterClass {
      7   public class InnerClass {
      8     private int value;
      9 
     10     public InnerClass(int x) {
     11       this.value = x;
     12     }
     13 
     14     int computeAResult(int y) {
     15       int result = 1;
     16       for (int i = value; i < y; i++) {
     17         result++;
     18         if (result == 1) {
     19           return result;
     20         }
     21       }
     22       return value * y;
     23     }
     24   }
     25 
     26   public abstract class MagicClass {
     27     public abstract int returnAnInt();
     28   }
     29 
     30   public int getValueFromInner(int x) {
     31     class LocalMagic extends MagicClass {
     32 
     33       @Override
     34       public int returnAnInt() {
     35         return 123;
     36       }
     37     }
     38 
     39     InnerClass inner = new InnerClass(x);
     40     MagicClass magic = new MagicClass() {
     41 
     42       @Override
     43       public int returnAnInt() {
     44         return 124;
     45       }
     46     };
     47     MagicClass localMagic = new LocalMagic();
     48     return inner.computeAResult(42) + magic.returnAnInt() + localMagic.returnAnInt();
     49   }
     50 }
     51