Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 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 repeat_annotations; |
| 5 | |
| 6 | // Simple test of Java 8 repeated annotations using the new getAnnotationsByType |
| 7 | // API to access them. |
| 8 | public class RepeatAnnotationsNewApi { |
| 9 | |
| 10 | @NumberAnnotation(number = 1) |
| 11 | @NumberAnnotation(number = 2) |
| 12 | @NumberAnnotation(number = 3) |
| 13 | class Inner { |
| 14 | } |
| 15 | |
| 16 | public static void main(String[] args) { |
| 17 | NumberAnnotation[] annotations = Inner.class.getAnnotationsByType(NumberAnnotation.class); |
| 18 | System.out.println(annotations.length); |
| 19 | for (NumberAnnotation annotation : annotations) { |
| 20 | System.out.println("Number annotation value: " + annotation.number()); |
| 21 | } |
| 22 | } |
| 23 | } |