Commit 0d024357 authored by ebruneton's avatar ebruneton

changed coding style (spaces, parentheses...)

parent 75c9ef72
This diff is collapsed.
......@@ -40,6 +40,7 @@ import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import java.util.Map;
/**
* The AnnotationDefault attribute is a variable length attribute in the
......@@ -50,7 +51,7 @@ import org.objectweb.asm.Label;
* at most one AnnotationDefault attribute. The JVM must make this default value
* available so it can be applied by appropriate reflective APIs.
* <p>
* The AnnotationDefault attribute has the following format:
* The AnnotationDefault attribute has the following format:
* <pre>
* AnnotationDefault_attribute {
* u2 attribute_name_index;
......@@ -58,7 +59,7 @@ import org.objectweb.asm.Label;
* member_value default_value;
* }
* </pre>
* The items of the AnnotationDefault structure are as follows:
* The items of the AnnotationDefault structure are as follows:
* <dl>
* <dt>attribute_name_index</dt>
* <dd>The value of the attribute_name_index item must be a valid index into the
......@@ -70,38 +71,50 @@ import org.objectweb.asm.Label;
* thus dependent on the default value.</dd>
* <dt>default_value</dt>
* <dd>The default_value item represents the default value of the annotation type
* {@link org.objectweb.asm.attrs.AnnotationMemberValue member} whose default
* {@link org.objectweb.asm.attrs.AnnotationMemberValue member} whose default
* value is represented by this AnnotationDefault attribute.</dd>
* </dl>
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata Facility for the Java Programming Language</a>
*
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata
* Facility for the Java Programming Language</a>
*
* @author Eugene Kuleshov
*/
public class AnnotationDefaultAttribute extends Attribute {
public class AnnotationDefaultAttribute extends Attribute implements Dumpable {
public AnnotationMemberValue defaultValue;
public AnnotationDefaultAttribute() {
super( "AnnotationDefault");
public AnnotationDefaultAttribute () {
super("AnnotationDefault");
}
protected Attribute read( ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) {
protected Attribute read (ClassReader cr, int off,
int len, char[] buf, int codeOff, Label[] labels) {
AnnotationDefaultAttribute ann = new AnnotationDefaultAttribute();
ann.defaultValue = new AnnotationMemberValue();
ann.defaultValue.read( cr, off, buf);
return ann;
ann.defaultValue.read(cr, off, buf);
return ann;
}
protected ByteVector write( ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
return defaultValue.write( new ByteVector(), cw);
protected ByteVector write (ClassWriter cw, byte[] code,
int len, int maxStack, int maxLocals) {
return defaultValue.write(new ByteVector(), cw);
}
public void dump (StringBuffer buf, String varName, Map labelNames) {
buf.append("AnnotationDefaultAttribute ").append(varName)
.append(" = new AnnotationDefaultAttribute();\n");
defaultValue.dump(buf, varName + "Val");
buf.append(varName).append(".defaultValue = ")
.append(varName).append("Val;\n");
}
/**
* Returns value in the format described in JSR-175 for Java source code.
*/
public String toString() {
return "default "+defaultValue;
public String toString () {
return "default " + defaultValue;
}
}
/* $Id: Dumpable.java,v 1.1 2003-12-02 04:55:14 ekuleshov Exp $ */
/**
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000,2002,2003 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
package org.objectweb.asm.attrs;
import java.util.Map;
......@@ -6,22 +39,23 @@ import java.util.Map;
/**
* Dumpable interface has to be implemented by the Attribute class
* in order to support DumpClassVisitor and DumpCodeVisitor.
*
* Implementation should print the ASM code that generates
* attribute data structures for current attribute state.
*
*
* Implementation should print the ASM code that generates
* attribute data structures for current attribute state.
*
* @author Eugene Kuleshov
*/
public interface Dumpable {
/**
* Dump attribute data into ASM code.
*
*
* @param buf A buffer used for printing java code.
* @param varName name of the variable in a printed code used to store attribute instance.
* @param varName name of the variable in a printed code used to store
* attribute instance.
* @param labelNames map of label instances to their names.
*/
void dump( StringBuffer buf, String varName, Map labelNames);
void dump (StringBuffer buf, String varName, Map labelNames);
}
......@@ -44,10 +44,10 @@ import org.objectweb.asm.Label;
/**
* The EnclosingMethod attribute is an optional fixed-length attribute
* in the attributes table of the ClassFile structure. A class must
* have an EnclosingMethod attribute if and only if it is a local
* class or an anonymous class. A class may have no more than one
* The EnclosingMethod attribute is an optional fixed-length attribute
* in the attributes table of the ClassFile structure. A class must
* have an EnclosingMethod attribute if and only if it is a local
* class or an anonymous class. A class may have no more than one
* EnclosingMethod attribute.
* <p>
* The EnclosingMethod attribute has the following format:
......@@ -63,53 +63,53 @@ import org.objectweb.asm.Label;
* <dt>attribute_name_index</dt>
* <dd>The value of the attribute_name_index item must be a valid index
* into the constant_pool table. The constant_pool entry at that index
* must be a CONSTANT_Utf8_info structure representing the string
* must be a CONSTANT_Utf8_info structure representing the string
* "EnclosingMethod".</dd>
* <dt>attribute_length</dt>
* <dd>The value of the attribute_length item is zero.</dd>
* <dt>method_descriptor_index</dt>
* <dd>The value of the method_descriptor_index item must be a valid
* index into the constant_pool table. The constant_pool entry at that
* index must be a CONSTANT_Utf8_info structure representing a valid
* <dd>The value of the method_descriptor_index item must be a valid
* index into the constant_pool table. The constant_pool entry at that
* index must be a CONSTANT_Utf8_info structure representing a valid
* method descriptor (JLS 4.4.3). It is the responsibility of the
* Java compiler to ensure that the method identified via the
* method_descriptor_index is indeed the closest lexically enclosing
* method of the class that contains this EnclosingMethod attribute.</dd>
* </dl>
*
*
* @author Eugene Kuleshov
*/
public class EnclosingMethodAttribute extends Attribute implements Dumpable {
private String methodDescriptor;
public EnclosingMethodAttribute() {
super( "EnclosingMethod");
public String methodDescriptor;
public EnclosingMethodAttribute () {
super("EnclosingMethod");
}
public EnclosingMethodAttribute( String methodDescriptor) {
public EnclosingMethodAttribute (String methodDescriptor) {
this();
this.methodDescriptor = methodDescriptor;
}
public String getMethodDescriptor() {
return this.methodDescriptor;
}
protected Attribute read( ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) {
return new EnclosingMethodAttribute( cr.readUTF8( off, buf));
protected Attribute read (ClassReader cr, int off,
int len, char[] buf, int codeOff, Label[] labels) {
return new EnclosingMethodAttribute(cr.readUTF8(off, buf));
}
protected ByteVector write( ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
return new ByteVector().putShort( cw.newUTF8( methodDescriptor));
protected ByteVector write (ClassWriter cw, byte[] code,
int len, int maxStack, int maxLocals) {
return new ByteVector().putShort(cw.newUTF8(methodDescriptor));
}
public void dump( StringBuffer buf, String varName, Map labelNames) {
buf.append( "EnclosingMethodAttribute ").append( varName).append( " = new EnclosingMethodAttribute(\""+methodDescriptor+"\"));\n");
public void dump (StringBuffer buf, String varName, Map labelNames) {
buf.append("EnclosingMethodAttribute ").append(varName)
.append(" = new EnclosingMethodAttribute(\"")
.append(methodDescriptor).append("\");\n");
}
public String toString() {
public String toString () {
return methodDescriptor;
}
}
/* $Id: RuntimeInvisibleAnnotations.java,v 1.3 2003-12-02 05:18:37 ekuleshov Exp $ */
/**
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000,2002,2003 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
package org.objectweb.asm.attrs;
......@@ -12,7 +44,6 @@ import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
/**
* The RuntimeInvisibleAnnotations attribute is similar to the
* RuntimeVisibleAnnotations attribute, except that the annotations represented by
......@@ -29,7 +60,7 @@ import org.objectweb.asm.Label;
* RuntimeInvisibleAnnotations attribute, which records all the runtime-invisible
* Java programming language annotations on the corresponding program element.
* <p>
* The RuntimeInvisibleAnnotations attribute has the following format:
* The RuntimeInvisibleAnnotations attribute has the following format:
* <pre>
* RuntimeInvisibleAnnotations_attribute {
* u2 attribute_name_index;
......@@ -38,7 +69,7 @@ import org.objectweb.asm.Label;
* annotation annotations[num_annotations];
* }
* </pre>
* The items of the RuntimeInvisibleAnnotations structure are as follows:
* The items of the RuntimeInvisibleAnnotations structure are as follows:
* <dl>
* <dt>attribute_name_index</dt>
* <dd>The value of the attribute_name_index item must be a valid index into the
......@@ -59,39 +90,44 @@ import org.objectweb.asm.Label;
* <dd>Each value of the annotations table represents a single runtime-invisible
* {@link org.objectweb.asm.attrs.Annotation annotation} on a program element.</dd>
* </dl>
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata Facility for the Java Programming Language</a>
*
* @author Eugene Kuleshov
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata
* Facility for the Java Programming Language</a>
*
* @author Eugene Kuleshov
*/
public class RuntimeInvisibleAnnotations extends Attribute implements Dumpable {
public List annotations = new LinkedList();
public RuntimeInvisibleAnnotations() {
super( "RuntimeInvisibleAnnotations");
public RuntimeInvisibleAnnotations () {
super("RuntimeInvisibleAnnotations");
}
protected Attribute read( ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) {
protected Attribute read (ClassReader cr, int off,
int len, char[] buf, int codeOff, Label[] labels) {
RuntimeInvisibleAnnotations atr = new RuntimeInvisibleAnnotations();
Annotation.readAnnotations( atr.annotations, cr, off, buf);
Annotation.readAnnotations(atr.annotations, cr, off, buf);
return atr;
}
protected ByteVector write( ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
return Annotation.writeAnnotations( new ByteVector(), annotations, cw);
protected ByteVector write (ClassWriter cw, byte[] code,
int len, int maxStack, int maxLocals) {
return Annotation.writeAnnotations(new ByteVector(), annotations, cw);
}
public void dump( StringBuffer buf, String varName, Map labelNames) {
buf.append( "RuntimeInvisibleAnnotations ").append( varName).append( " = new RuntimeInvisibleAnnotations();\n");
Annotation.dumpAnnotations( buf, varName, annotations);
public void dump (StringBuffer buf, String varName, Map labelNames) {
buf.append("RuntimeInvisibleAnnotations ").append(varName)
.append(" = new RuntimeInvisibleAnnotations();\n");
Annotation.dumpAnnotations(buf, varName, annotations);
}
/**
* Returns value in the format described in JSR-175 for Java source code.
*/
public String toString() {
return Annotation.stringAnnotations( annotations);
}
public String toString () {
return Annotation.stringAnnotations(annotations);
}
}
/* $Id: RuntimeInvisibleParameterAnnotations.java,v 1.3 2003-12-02 05:18:37 ekuleshov Exp $ */
/**
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000,2002,2003 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
package org.objectweb.asm.attrs;
......@@ -31,7 +63,7 @@ import org.objectweb.asm.Label;
* runtime-invisible Java programming language annotations on the parameters of
* the corresponding method.
* <p>
* The RuntimeInvisibleParameterAnnotations attribute has the following format:
* The RuntimeInvisibleParameterAnnotations attribute has the following format:
* <pre>
* RuntimeInvisibleParameterAnnotations_attribute {
* u2 attribute_name_index;
......@@ -43,7 +75,7 @@ import org.objectweb.asm.Label;
* } parameter_annotations[num_parameters];
* }
* </pre>
* The items of the RuntimeInvisibleParameterAnnotations structure are as follows:
* The items of the RuntimeInvisibleParameterAnnotations structure are as follows:
* <dl>
* <dt>attribute_name_index</dt>
* <dd>The value of the attribute_name_index item must be a valid index into the
......@@ -72,41 +104,49 @@ import org.objectweb.asm.Label;
* number of this parameter_annotations element.</dd>
* <dt>annotations</dt>
* <dd>Each value of the annotations table represents a single runtime-invisible
* {@link Annotation annotation} on the parameter corresponding to the sequence
* {@link Annotation annotation} on the parameter corresponding to the sequence
* number of this parameter_annotations element.</dd>
* </dl>
* </dd>
* </dl>
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata Facility for the Java Programming Language</a>
*
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata
* Facility for the Java Programming Language</a>
*
* @author Eugene Kuleshov
*/
public class RuntimeInvisibleParameterAnnotations extends Attribute implements Dumpable {
public class RuntimeInvisibleParameterAnnotations
extends Attribute implements Dumpable
{
public List parameters = new LinkedList();
public RuntimeInvisibleParameterAnnotations() {
super( "RuntimeInvisibleParameterAnnotations");
public RuntimeInvisibleParameterAnnotations () {
super("RuntimeInvisibleParameterAnnotations");
}
protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) {
RuntimeInvisibleParameterAnnotations atr = new RuntimeInvisibleParameterAnnotations();
Annotation.readParameterAnnotations( atr.parameters, cr, off, buf);
protected Attribute read (ClassReader cr, int off,
int len, char[] buf, int codeOff, Label[] labels) {
RuntimeInvisibleParameterAnnotations atr =
new RuntimeInvisibleParameterAnnotations();
Annotation.readParameterAnnotations(atr.parameters, cr, off, buf);
return atr;
}
protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
return Annotation.writeParametersAnnotations( new ByteVector(), parameters, cw);
protected ByteVector write (ClassWriter cw, byte[] code,
int len, int maxStack, int maxLocals) {
return Annotation.writeParametersAnnotations(
new ByteVector(), parameters, cw);
}
public void dump( StringBuffer buf, String varName, Map labelNames) {
buf.append( "RuntimeInvisibleParameterAnnotations ").append( varName).append( " = new RuntimeInvisibleParameterAnnotations();\n");
Annotation.dumpParameterAnnotations( buf, varName, parameters);
public void dump (StringBuffer buf, String varName, Map labelNames) {
buf.append("RuntimeInvisibleParameterAnnotations ").append(varName)
.append(" = new RuntimeInvisibleParameterAnnotations();\n");
Annotation.dumpParameterAnnotations(buf, varName, parameters);
}
public String toString() {
return Annotation.stringParameterAnnotations( parameters);
public String toString () {
return Annotation.stringParameterAnnotations(parameters);
}
}
/* $Id: RuntimeVisibleAnnotations.java,v 1.3 2003-12-02 05:18:37 ekuleshov Exp $ */
/**
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000,2002,2003 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
package org.objectweb.asm.attrs;
......@@ -24,7 +56,7 @@ import org.objectweb.asm.Label;
* must make these annotations available so they can be returned by the
* appropriate reflective APIs.
* <p>
* The RuntimeVisibleAnnotations attribute has the following format:
* The RuntimeVisibleAnnotations attribute has the following format:
* <pre>
* RuntimeVisibleAnnotations_attribute {
* u2 attribute_name_index;
......@@ -33,7 +65,7 @@ import org.objectweb.asm.Label;
* annotation annotations[num_annotations];
* }
* </pre>
* The items of the RuntimeVisibleAnnotations structure are as follows:
* The items of the RuntimeVisibleAnnotations structure are as follows:
* <dl>
* <dt>attribute_name_index</dt>
* <dd>The value of the attribute_name_index item must be a valid index into the
......@@ -54,39 +86,44 @@ import org.objectweb.asm.Label;
* <dd>Each value of the annotations table represents a single runtime-visible
* {@link Annotation annotation} on a program element.</dd>
* </dl>
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata Facility for the Java Programming Language</a>
*
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata
* Facility for the Java Programming Language</a>
*
* @author Eugene Kuleshov
*/
public class RuntimeVisibleAnnotations extends Attribute {
public class RuntimeVisibleAnnotations extends Attribute implements Dumpable {
public List annotations = new LinkedList();
public RuntimeVisibleAnnotations() {
super( "RuntimeVisibleAnnotations");
public RuntimeVisibleAnnotations () {
super("RuntimeVisibleAnnotations");
}
protected Attribute read( ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) {
protected Attribute read (ClassReader cr, int off,
int len, char[] buf, int codeOff, Label[] labels) {
RuntimeVisibleAnnotations atr = new RuntimeVisibleAnnotations();
Annotation.readAnnotations( atr.annotations, cr, off, buf);
Annotation.readAnnotations(atr.annotations, cr, off, buf);
return atr;
}
protected ByteVector write( ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
return Annotation.writeAnnotations( new ByteVector(), annotations, cw);
protected ByteVector write (ClassWriter cw, byte[] code,
int len, int maxStack, int maxLocals) {
return Annotation.writeAnnotations(new ByteVector(), annotations, cw);
}
public void dump( StringBuffer buf, String varName, Map labelNames) {
buf.append( "RuntimeVisibleAnnotations ").append( varName).append( " = new RuntimeVisibleAnnotations();\n");
Annotation.dumpAnnotations( buf, varName, annotations);
public void dump (StringBuffer buf, String varName, Map labelNames) {
buf.append("RuntimeVisibleAnnotations ").append(varName)
.append(" = new RuntimeVisibleAnnotations();\n");
Annotation.dumpAnnotations(buf, varName, annotations);
}
/**
* Returns value in the format described in JSR-175 for Java source code.
*/
public String toString() {
return Annotation.stringAnnotations( annotations);
public String toString () {
return Annotation.stringAnnotations(annotations);
}
}
/* $Id: RuntimeVisibleParameterAnnotations.java,v 1.3 2003-12-02 05:18:37 ekuleshov Exp $ */
/**
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000,2002,2003 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
package org.objectweb.asm.attrs;
......@@ -12,7 +44,6 @@ import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
/**
* The RuntimeVisibleParameterAnnotations attribute is a variable length attribute
* in the attributes table of the method_info structure. The
......@@ -24,7 +55,7 @@ import org.objectweb.asm.Label;
* corresponding method. The JVM must make these annotations available so they can
* be returned by the appropriate reflective APIs.
* <p>
* The RuntimeVisibleParameterAnnotations attribute has the following format:
* The RuntimeVisibleParameterAnnotations attribute has the following format:
* <pre>
* RuntimeVisibleParameterAnnotations_attribute {
* u2 attribute_name_index;
......@@ -36,7 +67,7 @@ import org.objectweb.asm.Label;
* } parameter_annotations[num_parameters];
* }
* <pre>
* The items of the RuntimeVisibleParameterAnnotations structure are as follows:
* The items of the RuntimeVisibleParameterAnnotations structure are as follows:
* <dl>
* <dt>attribute_name_index</dt>
* <dd>The value of the attribute_name_index item must be a valid index into the
......@@ -65,41 +96,49 @@ import org.objectweb.asm.Label;
* parameter_annotations element.</dd>
* <dt>annotations</dt>
* <dd>Each value of the annotations table represents a single runtime-visible
* {@link org.objectweb.asm.attrs.Annotation annotation} on the parameter
* {@link org.objectweb.asm.attrs.Annotation annotation} on the parameter
* corresponding to the sequence number of this parameter_annotations element.</dd>
* </dl>
* </dd>
* </dl>
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata Facility for the Java Programming Language</a>
*
*
* @see <a href="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata