• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The Bazel Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 package com.google.devtools.build.android.desugar.testdata.java8;
15 
16 import java.lang.annotation.Retention;
17 import java.lang.annotation.RetentionPolicy;
18 
19 /** Test for b/38302860. The annotations of default methods should be kept after desugaring. */
20 public class AnnotationsOfDefaultMethodsShouldBeKept {
21 
22   /**
23    * An interface, that has annotation, annotated abstract methods, and annotated default methods.
24    * After desugaring, all these annotations should remain in the interface.
25    */
26   @SomeAnnotation(1)
27   public interface AnnotatedInterface {
28 
29     @SomeAnnotation(2)
annotatedAbstractMethod()30     void annotatedAbstractMethod();
31 
32     @SomeAnnotation(3)
annotatedDefaultMethod()33     default void annotatedDefaultMethod() {}
34   }
35 
36   /**
37    * A simple annotation, used for testing.
38    */
39   @Retention(value = RetentionPolicy.RUNTIME)
40   public @interface SomeAnnotation {
value()41     int value();
42   }
43 }
44