use of org.objectweb.asm.FieldVisitor in project MinecraftForge by MinecraftForge.
the class FMLRemappingAdapter method visitField.
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
FieldVisitor fv = cv.visitField(access, remapper.mapMemberFieldName(className, name, desc), remapper.mapDesc(desc), remapper.mapSignature(signature, true), remapper.mapValue(value));
return createRemappingFieldAdapter(fv);
}
use of org.objectweb.asm.FieldVisitor in project neo4j by neo4j.
the class ClassByteCodeWriter method field.
@Override
public void field(FieldReference field, Expression value) {
//keep track of all static field->value, and initiate in <clinit> in done
if (Modifier.isStatic(field.modifiers()) && value != null) {
staticFields.put(field, value);
}
FieldVisitor fieldVisitor = classVisitor.visitField(field.modifiers(), field.name(), typeName(field.type()), signature(field.type()), null);
fieldVisitor.visitEnd();
}
use of org.objectweb.asm.FieldVisitor in project gradle by gradle.
the class ApiMemberSelector method visitEnd.
@Override
public void visitEnd() {
super.visitEnd();
apiMemberAdapter.visit(classMember.getVersion(), classMember.getAccess(), classMember.getName(), classMember.getSignature(), classMember.getSuperName(), classMember.getInterfaces());
visitAnnotationMembers(classMember.getAnnotations());
for (MethodMember method : methods) {
MethodVisitor mv = apiMemberAdapter.visitMethod(method.getAccess(), method.getName(), method.getTypeDesc(), method.getSignature(), method.getExceptions().toArray(new String[0]));
visitAnnotationMembers(mv, method.getAnnotations());
visitAnnotationMembers(mv, method.getParameterAnnotations());
mv.visitEnd();
}
for (FieldMember field : fields) {
FieldVisitor fieldVisitor = apiMemberAdapter.visitField(field.getAccess(), field.getName(), field.getTypeDesc(), field.getSignature(), field.getValue());
visitAnnotationMembers(fieldVisitor, field.getAnnotations());
fieldVisitor.visitEnd();
}
for (InnerClassMember innerClass : innerClasses) {
apiMemberAdapter.visitInnerClass(innerClass.getName(), innerClass.getOuterName(), innerClass.getInnerName(), innerClass.getAccess());
}
apiMemberAdapter.visitEnd();
}
use of org.objectweb.asm.FieldVisitor in project felix by apache.
the class ClassManipulator method addIMField.
/**
* Add the instance manager field (__im).
*/
private void addIMField() {
FieldVisitor fv = super.visitField(0, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;", null, null);
fv.visitEnd();
}
use of org.objectweb.asm.FieldVisitor in project felix by apache.
the class ClassManipulator method visitField.
/**
* Visit a Field.
* This field access is replaced by an invocation to the getter method or to the setter method.
* (except for static field).
* Inject the getter and the setter method for this field.
* @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)
* @param access : access modifier
* @param name : name of the field
* @param desc : description of the field
* @param signature : signature of the field
* @param value : value of the field
* @return FieldVisitor : null
*/
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) {
if ((access & ACC_STATIC) == 0) {
FieldVisitor flag = cv.visitField(Opcodes.ACC_PRIVATE, FIELD_FLAG_PREFIX + name, "Z", null, null);
flag.visitEnd();
Type type = Type.getType(desc);
if (type.getSort() == Type.ARRAY) {
String gDesc = "()" + desc;
createArrayGetter(name, gDesc);
// Generates setter method
String sDesc = "(" + desc + ")V";
createArraySetter(name, sDesc);
} else {
// Generate the getter method
String gDesc = "()" + desc;
createSimpleGetter(name, gDesc, type);
// Generates setter method
String sDesc = "(" + desc + ")V";
createSimpleSetter(name, sDesc, type);
}
}
return cv.visitField(access, name, desc, signature, value);
}
Aggregations