1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy of 6 * the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 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, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16 17 package com.android.multidexlegacytestapp; 18 19 import androidx.multidex.MultiDexApplication; 20 21 import java.lang.annotation.Annotation; 22 23 @AnnotationWithEnum(ReferencedByAnnotation.B) 24 public class TestApplication extends MultiDexApplication { 25 26 public static Annotation annotation = getAnnotationWithEnum(); 27 public static Annotation annotation2 = getSoleAnnotation(Annotated.class); 28 public static Annotation annotation3 = getSoleAnnotation(Annotated2.class); 29 public static Class<?> interfaceClass = InterfaceWithEnum.class; 30 getAnnotationWithEnum()31 public static Annotation getAnnotationWithEnum() { 32 return getSoleAnnotation(TestApplication.class); 33 } 34 getSoleAnnotation(Class<?> annotated)35 public static Annotation getSoleAnnotation(Class<?> annotated) { 36 Annotation[] annot = annotated.getAnnotations(); 37 if (annot.length == 1) { 38 return annot[0]; 39 } 40 41 throw new AssertionError(); 42 } 43 44 } 45