< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/tree/FieldNode.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch


 156      *            the field's access flags (see
 157      *            {@link jdk.internal.org.objectweb.asm.Opcodes}). This parameter also
 158      *            indicates if the field is synthetic and/or deprecated.
 159      * @param name
 160      *            the field's name.
 161      * @param desc
 162      *            the field's descriptor (see {@link jdk.internal.org.objectweb.asm.Type
 163      *            Type}).
 164      * @param signature
 165      *            the field's signature.
 166      * @param value
 167      *            the field's initial value. This parameter, which may be
 168      *            <tt>null</tt> if the field does not have an initial value,
 169      *            must be an {@link Integer}, a {@link Float}, a {@link Long}, a
 170      *            {@link Double} or a {@link String}.
 171      * @throws IllegalStateException
 172      *             If a subclass calls this constructor.
 173      */
 174     public FieldNode(final int access, final String name, final String desc,
 175             final String signature, final Object value) {
 176         this(Opcodes.ASM5, access, name, desc, signature, value);
 177         if (getClass() != FieldNode.class) {
 178             throw new IllegalStateException();
 179         }
 180     }
 181 
 182     /**
 183      * Constructs a new {@link FieldNode}. <i>Subclasses must not use this
 184      * constructor</i>.
 185      *
 186      * @param api
 187      *            the ASM API version implemented by this visitor. Must be one
 188      *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 189      * @param access
 190      *            the field's access flags (see
 191      *            {@link jdk.internal.org.objectweb.asm.Opcodes}). This parameter also
 192      *            indicates if the field is synthetic and/or deprecated.
 193      * @param name
 194      *            the field's name.
 195      * @param desc
 196      *            the field's descriptor (see {@link jdk.internal.org.objectweb.asm.Type


 259             attrs = new ArrayList<Attribute>(1);
 260         }
 261         attrs.add(attr);
 262     }
 263 
 264     @Override
 265     public void visitEnd() {
 266     }
 267 
 268     // ------------------------------------------------------------------------
 269     // Accept methods
 270     // ------------------------------------------------------------------------
 271 
 272     /**
 273      * Checks that this field node is compatible with the given ASM API version.
 274      * This methods checks that this node, and all its nodes recursively, do not
 275      * contain elements that were introduced in more recent versions of the ASM
 276      * API than the given version.
 277      *
 278      * @param api
 279      *            an ASM API version. Must be one of {@link Opcodes#ASM4} or
 280      *            {@link Opcodes#ASM5}.
 281      */
 282     public void check(final int api) {
 283         if (api == Opcodes.ASM4) {
 284             if (visibleTypeAnnotations != null
 285                     && visibleTypeAnnotations.size() > 0) {
 286                 throw new RuntimeException();
 287             }
 288             if (invisibleTypeAnnotations != null
 289                     && invisibleTypeAnnotations.size() > 0) {
 290                 throw new RuntimeException();
 291             }
 292         }
 293     }
 294 
 295     /**
 296      * Makes the given class visitor visit this field.
 297      *
 298      * @param cv
 299      *            a class visitor.
 300      */




 156      *            the field's access flags (see
 157      *            {@link jdk.internal.org.objectweb.asm.Opcodes}). This parameter also
 158      *            indicates if the field is synthetic and/or deprecated.
 159      * @param name
 160      *            the field's name.
 161      * @param desc
 162      *            the field's descriptor (see {@link jdk.internal.org.objectweb.asm.Type
 163      *            Type}).
 164      * @param signature
 165      *            the field's signature.
 166      * @param value
 167      *            the field's initial value. This parameter, which may be
 168      *            <tt>null</tt> if the field does not have an initial value,
 169      *            must be an {@link Integer}, a {@link Float}, a {@link Long}, a
 170      *            {@link Double} or a {@link String}.
 171      * @throws IllegalStateException
 172      *             If a subclass calls this constructor.
 173      */
 174     public FieldNode(final int access, final String name, final String desc,
 175             final String signature, final Object value) {
 176         this(Opcodes.ASM6, access, name, desc, signature, value);
 177         if (getClass() != FieldNode.class) {
 178             throw new IllegalStateException();
 179         }
 180     }
 181 
 182     /**
 183      * Constructs a new {@link FieldNode}. <i>Subclasses must not use this
 184      * constructor</i>.
 185      *
 186      * @param api
 187      *            the ASM API version implemented by this visitor. Must be one
 188      *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 189      * @param access
 190      *            the field's access flags (see
 191      *            {@link jdk.internal.org.objectweb.asm.Opcodes}). This parameter also
 192      *            indicates if the field is synthetic and/or deprecated.
 193      * @param name
 194      *            the field's name.
 195      * @param desc
 196      *            the field's descriptor (see {@link jdk.internal.org.objectweb.asm.Type


 259             attrs = new ArrayList<Attribute>(1);
 260         }
 261         attrs.add(attr);
 262     }
 263 
 264     @Override
 265     public void visitEnd() {
 266     }
 267 
 268     // ------------------------------------------------------------------------
 269     // Accept methods
 270     // ------------------------------------------------------------------------
 271 
 272     /**
 273      * Checks that this field node is compatible with the given ASM API version.
 274      * This methods checks that this node, and all its nodes recursively, do not
 275      * contain elements that were introduced in more recent versions of the ASM
 276      * API than the given version.
 277      *
 278      * @param api
 279      *            an ASM API version. Must be one of {@link Opcodes#ASM4},
 280      *            {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
 281      */
 282     public void check(final int api) {
 283         if (api == Opcodes.ASM4) {
 284             if (visibleTypeAnnotations != null
 285                     && visibleTypeAnnotations.size() > 0) {
 286                 throw new RuntimeException();
 287             }
 288             if (invisibleTypeAnnotations != null
 289                     && invisibleTypeAnnotations.size() > 0) {
 290                 throw new RuntimeException();
 291             }
 292         }
 293     }
 294 
 295     /**
 296      * Makes the given class visitor visit this field.
 297      *
 298      * @param cv
 299      *            a class visitor.
 300      */


< prev index next >