• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // ASM: a very small and fast Java bytecode manipulation framework
2 // Copyright (c) 2000-2011 INRIA, France Telecom
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions
7 // are met:
8 // 1. Redistributions of source code must retain the above copyright
9 //    notice, this list of conditions and the following disclaimer.
10 // 2. Redistributions in binary form must reproduce the above copyright
11 //    notice, this list of conditions and the following disclaimer in the
12 //    documentation and/or other materials provided with the distribution.
13 // 3. Neither the name of the copyright holders nor the names of its
14 //    contributors may be used to endorse or promote products derived from
15 //    this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 // THE POSSIBILITY OF SUCH DAMAGE.
28 package org.objectweb.asm.tree;
29 
30 import org.objectweb.asm.ClassVisitor;
31 
32 /**
33  * A node that represents an inner class. This inner class is not necessarily a member of the {@link
34  * ClassNode} containing this object. More precisely, every class or interface C which is referenced
35  * by a {@link ClassNode} and which is not a package member must be represented with an {@link
36  * InnerClassNode}. The {@link ClassNode} must reference its nested class or interface members, and
37  * its enclosing class, if any. See the JVMS 4.7.6 section for more details.
38  *
39  * @author Eric Bruneton
40  */
41 public class InnerClassNode {
42 
43   /** The internal name of an inner class (see {@link org.objectweb.asm.Type#getInternalName()}). */
44   public String name;
45 
46   /**
47    * The internal name of the class to which the inner class belongs (see {@link
48    * org.objectweb.asm.Type#getInternalName()}). May be {@literal null}.
49    */
50   public String outerName;
51 
52   /**
53    * The (simple) name of the inner class inside its enclosing class. Must be {@literal null} if the
54    * inner class is not the member of a class or interface (e.g. for local or anonymous classes).
55    */
56   public String innerName;
57 
58   /**
59    * The access flags of the inner class as originally declared in the source code from which the
60    * class was compiled.
61    */
62   public int access;
63 
64   /**
65    * Constructs a new {@link InnerClassNode} for an inner class C.
66    *
67    * @param name the internal name of C (see {@link org.objectweb.asm.Type#getInternalName()}).
68    * @param outerName the internal name of the class or interface C is a member of (see {@link
69    *     org.objectweb.asm.Type#getInternalName()}). Must be {@literal null} if C is not the member
70    *     of a class or interface (e.g. for local or anonymous classes).
71    * @param innerName the (simple) name of C. Must be {@literal null} for anonymous inner classes.
72    * @param access the access flags of C originally declared in the source code from which this
73    *     class was compiled.
74    */
InnerClassNode( final String name, final String outerName, final String innerName, final int access)75   public InnerClassNode(
76       final String name, final String outerName, final String innerName, final int access) {
77     this.name = name;
78     this.outerName = outerName;
79     this.innerName = innerName;
80     this.access = access;
81   }
82 
83   /**
84    * Makes the given class visitor visit this inner class.
85    *
86    * @param classVisitor a class visitor.
87    */
accept(final ClassVisitor classVisitor)88   public void accept(final ClassVisitor classVisitor) {
89     classVisitor.visitInnerClass(name, outerName, innerName, access);
90   }
91 }
92