use of dyvilx.tools.asm.AnnotationVisitor in project Dyvil by Dyvil.
the class AnnotationExpr method writeAnnotationValue.
@Override
public void writeAnnotationValue(AnnotationVisitor visitor, String key) {
final AnnotationVisitor av = visitor.visitAnnotation(key, this.annotation.getType().getExtendedName());
this.annotation.write(av);
av.visitEnd();
}
use of dyvilx.tools.asm.AnnotationVisitor in project Dyvil by Dyvil.
the class ArrayExpr method writeAnnotationValue.
@Override
public void writeAnnotationValue(AnnotationVisitor visitor, String key) {
final AnnotationVisitor arrayVisitor = visitor.visitArray(key);
for (IValue value : this.values) {
value.writeAnnotationValue(arrayVisitor, null);
}
arrayVisitor.visitEnd();
}
use of dyvilx.tools.asm.AnnotationVisitor in project Dyvil by Dyvil.
the class ModifierUtil method writeModifiers.
public static void writeModifiers(AnnotatableVisitor visitor, long flags) {
final int dyvilModifiers = (int) (flags >> 32);
if (dyvilModifiers != 0) {
final AnnotationVisitor annotationVisitor = visitor.visitAnnotation(DYVIL_MODIFIERS, true);
annotationVisitor.visit("value", dyvilModifiers);
annotationVisitor.visitEnd();
}
}
use of dyvilx.tools.asm.AnnotationVisitor in project Dyvil by Dyvil.
the class CodeClass method writeClassParameters.
private void writeClassParameters(ClassWriter writer) throws BytecodeException {
final int parameterCount = this.parameters.size();
if (parameterCount == 0) {
return;
}
final AnnotationVisitor annotationVisitor = writer.visitAnnotation(AnnotationUtil.CLASS_PARAMETERS, false);
final AnnotationVisitor arrayVisitor = annotationVisitor.visitArray("names");
for (int i = 0; i < parameterCount; i++) {
final IParameter parameter = this.parameters.get(i);
parameter.write(writer);
arrayVisitor.visit("", parameter.getInternalName());
}
arrayVisitor.visitEnd();
annotationVisitor.visitEnd();
}
use of dyvilx.tools.asm.AnnotationVisitor in project Dyvil by Dyvil.
the class AnnotationMetadata method write.
@Override
public void write(ClassWriter writer) throws BytecodeException {
for (IParameter parameter : this.theClass.getParameters()) {
final StringBuilder desc = new StringBuilder("()");
parameter.getType().appendExtendedName(desc);
final MethodVisitor methodVisitor = writer.visitMethod(Modifiers.PUBLIC | Modifiers.ABSTRACT, parameter.getInternalName(), desc.toString(), null, null);
final IValue argument = parameter.getValue();
if (argument != null && argument.isAnnotationConstant()) {
final AnnotationVisitor av = methodVisitor.visitAnnotationDefault();
argument.writeAnnotationValue(av, parameter.getInternalName());
av.visitEnd();
}
methodVisitor.visitEnd();
}
}
Aggregations