1b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato/*
2b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * ProGuard -- shrinking, optimization, obfuscation, and preverification
3b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato *             of Java bytecode.
4b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato *
5b9cc48a43ed984587c939d02fba5316bf5c0df6eYing Wang * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
6b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato *
7b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This program is free software; you can redistribute it and/or modify it
8b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * under the terms of the GNU General Public License as published by the Free
9b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Software Foundation; either version 2 of the License, or (at your option)
10b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * any later version.
11b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato *
12b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This program is distributed in the hope that it will be useful, but WITHOUT
13b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * more details.
16b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato *
17b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * You should have received a copy of the GNU General Public License along
18b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * with this program; if not, write to the Free Software Foundation, Inc.,
19b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */
21b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratopackage proguard.classfile.attribute.annotation.visitor;
22b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
23b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimport proguard.classfile.*;
24b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimport proguard.classfile.attribute.Attribute;
25b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimport proguard.classfile.attribute.annotation.*;
26b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimport proguard.classfile.attribute.visitor.AttributeVisitor;
27b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimport proguard.classfile.util.SimplifiedVisitor;
28b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
29b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato/**
30b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This AttributeVisitor lets a given AnnotationVisitor visit all Annotation
31b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * objects of the attributes it visits.
32b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato *
33b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * @author Eric Lafortune
34b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */
35b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratopublic class AllAnnotationVisitor
36b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoextends      SimplifiedVisitor
37b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimplements   AttributeVisitor
38b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato{
39b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    private final AnnotationVisitor annotationVisitor;
40b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
41b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
42b9cc48a43ed984587c939d02fba5316bf5c0df6eYing Wang    /**
43b9cc48a43ed984587c939d02fba5316bf5c0df6eYing Wang     * Creates a new AllAnnotationVisitor.
44b9cc48a43ed984587c939d02fba5316bf5c0df6eYing Wang     * @param annotationVisitor the AnnotationVisitor to which visits will be
45b9cc48a43ed984587c939d02fba5316bf5c0df6eYing Wang     *                          delegated.
46b9cc48a43ed984587c939d02fba5316bf5c0df6eYing Wang     */
47b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public AllAnnotationVisitor(AnnotationVisitor annotationVisitor)
48b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
49b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        this.annotationVisitor = annotationVisitor;
50b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
51b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
52b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
53b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    // Implementations for AttributeVisitor.
54b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
55b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
56b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
57b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
58b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitRuntimeVisibleAnnotationsAttribute(Clazz clazz, RuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute)
59b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
60b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        // Visit the annotations.
61b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        runtimeVisibleAnnotationsAttribute.annotationsAccept(clazz, annotationVisitor);
62b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
63b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
64b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
65b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitRuntimeVisibleAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute)
66b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
67b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        // Visit the annotations.
68b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        runtimeVisibleAnnotationsAttribute.annotationsAccept(clazz, field, annotationVisitor);
69b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
70b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
71b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
72b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitRuntimeVisibleAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute)
73b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
74b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        // Visit the annotations.
75b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        runtimeVisibleAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor);
76b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
77b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
78b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
79b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitRuntimeInvisibleAnnotationsAttribute(Clazz clazz, RuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute)
80b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
81b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        // Visit the annotations.
82b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        runtimeInvisibleAnnotationsAttribute.annotationsAccept(clazz, annotationVisitor);
83b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
84b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
85b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
86b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitRuntimeInvisibleAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute)
87b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
88b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        // Visit the annotations.
89b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        runtimeInvisibleAnnotationsAttribute.annotationsAccept(clazz, field, annotationVisitor);
90b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
91b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
92b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
93b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitRuntimeInvisibleAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute)
94b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
95b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        // Visit the annotations.
96b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        runtimeInvisibleAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor);
97b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
98b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
99b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato
100b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    public void visitAnyParameterAnnotationsAttribute(Clazz clazz, Method method, ParameterAnnotationsAttribute parameterAnnotationsAttribute)
101b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    {
102b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        // Visit the annotations.
103b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato        parameterAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor);
104b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato    }
105b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato}
106