/// <exception cref="System.IO.IOException"/> public override void InitContent(DataInputFullStream data, ConstantPool pool) { int len = data.ReadUnsignedByte(); if (len > 0) { paramAnnotations = new List <List <AnnotationExprent> >(len); for (int i = 0; i < len; i++) { List <AnnotationExprent> annotations = StructAnnotationAttribute.ParseAnnotations (pool, data); paramAnnotations.Add(annotations); } } else { paramAnnotations = new System.Collections.Generic.List <List <AnnotationExprent> >(); } }
/// <exception cref="System.IO.IOException"/> public override void InitContent(DataInputFullStream data, ConstantPool pool) { defaultValue = StructAnnotationAttribute.ParseAnnotationElement(data, pool); }
/// <exception cref="IOException"/> private static TypeAnnotation Parse(DataInputStream data, ConstantPool pool) { int targetType = data.ReadUnsignedByte(); int target = targetType << 24; switch (targetType) { case TypeAnnotation.Class_Type_Parameter: case TypeAnnotation.Method_Type_Parameter: case TypeAnnotation.Method_Parameter: { target |= data.ReadUnsignedByte(); break; } case TypeAnnotation.Super_Type_Reference: case TypeAnnotation.Class_Type_Parameter_Bound: case TypeAnnotation.Method_Type_Parameter_Bound: case TypeAnnotation.Throws_Reference: case TypeAnnotation.Catch_Clause: case TypeAnnotation.Expr_Instanceof: case TypeAnnotation.Expr_New: case TypeAnnotation.Expr_Constructor_Ref: case TypeAnnotation.Expr_Method_Ref: { target |= data.ReadUnsignedShort(); break; } case TypeAnnotation.Type_Arg_Cast: case TypeAnnotation.Type_Arg_Constructor_Call: case TypeAnnotation.Type_Arg_Method_Call: case TypeAnnotation.Type_Arg_Constructor_Ref: case TypeAnnotation.Type_Arg_Method_Ref: { data.SkipBytes(3); break; } case TypeAnnotation.Local_Variable: case TypeAnnotation.Resource_Variable: { data.SkipBytes(data.ReadUnsignedShort() * 6); break; } case TypeAnnotation.Field: case TypeAnnotation.Method_Return_Type: case TypeAnnotation.Method_Receiver: { break; } default: { throw new Exception("unknown target type: " + targetType); } } int pathLength = data.ReadUnsignedByte(); byte[] path = null; if (pathLength > 0) { path = new byte[2 * pathLength]; data.ReadFully(path); } AnnotationExprent annotation = StructAnnotationAttribute.ParseAnnotation(data, pool ); return(new TypeAnnotation(target, path, annotation)); }
public static StructGeneralAttribute CreateAttribute(string name) { StructGeneralAttribute attr; if (Attribute_Inner_Classes.GetName().Equals(name)) { attr = new StructInnerClassesAttribute(); } else if (Attribute_Constant_Value.GetName().Equals(name)) { attr = new StructConstantValueAttribute(); } else if (Attribute_Signature.GetName().Equals(name)) { attr = new StructGenericSignatureAttribute(); } else if (Attribute_Annotation_Default.GetName().Equals(name)) { attr = new StructAnnDefaultAttribute(); } else if (Attribute_Exceptions.GetName().Equals(name)) { attr = new StructExceptionsAttribute(); } else if (Attribute_Enclosing_Method.GetName().Equals(name)) { attr = new StructEnclosingMethodAttribute(); } else if (Attribute_Runtime_Visible_Annotations.GetName().Equals(name) || Attribute_Runtime_Invisible_Annotations .GetName().Equals(name)) { attr = new StructAnnotationAttribute(); } else if (Attribute_Runtime_Visible_Parameter_Annotations.GetName().Equals(name) || Attribute_Runtime_Invisible_Parameter_Annotations.GetName().Equals(name)) { attr = new StructAnnotationParameterAttribute(); } else if (Attribute_Runtime_Visible_Type_Annotations.GetName().Equals(name) || Attribute_Runtime_Invisible_Type_Annotations .GetName().Equals(name)) { attr = new StructTypeAnnotationAttribute(); } else if (Attribute_Local_Variable_Table.GetName().Equals(name)) { attr = new StructLocalVariableTableAttribute(); } else if (Attribute_Local_Variable_Type_Table.GetName().Equals(name)) { attr = new StructLocalVariableTypeTableAttribute(); } else if (Attribute_Bootstrap_Methods.GetName().Equals(name)) { attr = new StructBootstrapMethodsAttribute(); } else if (Attribute_Synthetic.GetName().Equals(name) || Attribute_Deprecated.GetName ().Equals(name)) { attr = new StructGeneralAttribute(); } else if (Attribute_Line_Number_Table.GetName().Equals(name)) { attr = new StructLineNumberTableAttribute(); } else if (Attribute_Method_Parameters.GetName().Equals(name)) { attr = new StructMethodParametersAttribute(); } else { // unsupported attribute return(null); } attr.name = name; return(attr); }