/** * Return true if the given instruction accesses a field that is a backing * field of another property in this property-access class. */ private boolean isBackingFieldOfAnotherProperty(String name, Code code) { String methName = code.getMethod().getName(); return !"<init>".equals(methName) && _backingFields != null && !name.equals(_backingFields.get(methName)) && _backingFields.containsValue(name); }
/** * Return true if the given instruction accesses a field that is a backing * field of another property in this property-access class. */ private boolean isBackingFieldOfAnotherProperty(String name, Code code) { String methName = code.getMethod().getName(); return !"<init>".equals(methName) && _backingFields != null && !name.equals(_backingFields.get(methName)) && _backingFields.containsValue(name); }
/** * Return true if the given instruction accesses a field that is a backing * field of another property in this property-access class. */ private boolean isBackingFieldOfAnotherProperty(String name, Code code) { String methName = code.getMethod().getName(); return !"<init>".equals(methName) && _backingFields != null && !name.equals(_backingFields.get(methName)) && _backingFields.containsValue(name); }
/** * Return true if the given instruction accesses a field that is a backing * field of another property in this property-access class. */ private boolean isBackingFieldOfAnotherProperty(String name, Code code) { String methName = code.getMethod().getName(); return !"<init>".equals(methName) && _backingFields != null && !name.equals(_backingFields.get(methName)) && _backingFields.containsValue(name); }
/** * Return true if the given instruction accesses a field that is a backing * field of another property in this property-access class. */ private boolean isBackingFieldOfAnotherProperty(String name, Code code) { String methName = code.getMethod().getName(); return !"<init>".equals(methName) && _backingFields != null && !name.equals(_backingFields.get(methName)) && _backingFields.containsValue(name); }
/** * Set the field this instruction operates on, for fields that are * declared by the current class. * * @param name the field name * @param type the class of the field type * @return this instruction, for method chaining */ public FieldInstruction setField(String name, Class type) { BCClass owner = getCode().getMethod().getDeclarer(); String typeName = (type == null) ? null : type.getName(); return setField(owner.getName(), name, typeName); }
/** * Load a class constant onto the stack. * For primitive types, this translates into a * getstatic for the TYPE field of the primitive's wrapper type. * For non-primitives, things get much more complex. Suffice it to * say that the operation involves adding synthetic static fields * and even methods to the class. Note that this instruction requires * up to 3 stack positions to execute. */ public ClassConstantInstruction classconstant() { return new ClassConstantInstruction(getMethod().getDeclarer(), this, nop()); }
/** * Load a class constant onto the stack. * For primitive types, this translates into a * getstatic for the TYPE field of the primitive's wrapper type. * For non-primitives, things get much more complex. Suffice it to * say that the operation involves adding synthetic static fields * and even methods to the class. Note that this instruction requires * up to 3 stack positions to execute. */ public ClassConstantInstruction classconstant() { return new ClassConstantInstruction(getMethod().getDeclarer(), this, nop()); }
/** * Set the field this instruction operates on, for fields that are * declared by the current class. * * @param name the field name * @param type the class of the field type * @return this instruction, for method chaining */ public FieldInstruction setField(String name, Class type) { BCClass owner = getCode().getMethod().getDeclarer(); String typeName = (type == null) ? null : type.getName(); return setField(owner.getName(), name, typeName); }
/** * Set the method this instruction operates on, for methods that are * declared by the current class. * * @param name the method name * @param returnType the class of the method return type * @param param the class of the method param types * @return this instruction, for method chaining */ public MethodInstruction setMethod(String name, Class returnType, Class[] params) { BCClass owner = getCode().getMethod().getDeclarer(); String returnName = (returnType == null) ? null : returnType.getName(); String[] paramNames = null; if (params != null) { paramNames = new String[params.length]; for (int i = 0; i < params.length; i++) paramNames[i] = params[i].getName(); } return setMethod(owner.getName(), name, returnName, paramNames, false); }
/** * Set the field this instruction operates on, for fields that are * declared by the current class. * * @param name the field name * @param type the full class name of the field type * @return this instruction, for method chaining */ public FieldInstruction setField(String name, String type) { BCClass owner = getCode().getMethod().getDeclarer(); return setField(owner.getName(), name, type); }
/** * Set the field this instruction operates on, for fields that are * declared by the current class. * * @param name the field name * @param type the full class name of the field type * @return this instruction, for method chaining */ public FieldInstruction setField(String name, String type) { BCClass owner = getCode().getMethod().getDeclarer(); return setField(owner.getName(), name, type); }
/** * Set the method this instruction operates on, for methods that are * declared by the current class. * * @param name the method name * @param returnType the full class name of the method return type * @param param the full class names of the method param types * @return this instruction, for method chaining */ public MethodInstruction setMethod(String name, String returnType, String[] params) { BCClass owner = getCode().getMethod().getDeclarer(); return setMethod(owner.getName(), name, returnType, params); }
/** * Set the method this instruction operates on, for methods that are * declared by the current class. * * @param name the method name * @param returnType the full class name of the method return type * @param param the full class names of the method param types * @return this instruction, for method chaining */ public MethodInstruction setMethod(String name, String returnType, String[] params) { BCClass owner = getCode().getMethod().getDeclarer(); return setMethod(owner.getName(), name, returnType, params); }
/** * When adding class entries, make sure the bytecode spec supports them. */ private void ensureBytecodeVersion() { BCClass bc = getCode().getMethod().getDeclarer(); if (bc.getMajorVersion() < Constants.MAJOR_VERSION_JAVA5) { bc.setMajorVersion(Constants.MAJOR_VERSION_JAVA5); bc.setMinorVersion(Constants.MINOR_VERSION_JAVA5); } } }
/** * When adding class entries, make sure the bytecode spec supports them. */ private void ensureBytecodeVersion() { BCClass bc = getCode().getMethod().getDeclarer(); if (bc.getMajorVersion() < Constants.MAJOR_VERSION_JAVA5) { bc.setMajorVersion(Constants.MAJOR_VERSION_JAVA5); bc.setMinorVersion(Constants.MINOR_VERSION_JAVA5); } } }
/** * Set the field this instruction operates on, for fields that are * declared by the current class. * * @param name the field name * @param type the class of the field type * @return this instruction, for method chaining */ public FieldInstruction setField(String name, BCClass type) { BCClass owner = getCode().getMethod().getDeclarer(); String typeName = (type == null) ? null : type.getName(); return setField(owner.getName(), name, typeName); }
/** * Set the field this instruction operates on, for fields that are * declared by the current class. * * @param name the field name * @param type the class of the field type * @return this instruction, for method chaining */ public FieldInstruction setField(String name, BCClass type) { BCClass owner = getCode().getMethod().getDeclarer(); String typeName = (type == null) ? null : type.getName(); return setField(owner.getName(), name, typeName); }
/** * Set the method parameter that this instruction operates on. This * will set both the local index and the type of the instruction based * on the current method parameters. */ public LocalVariableInstruction setParam(int param) { int local = getCode().getLocalsIndex(param); if (local != -1) { BCMethod method = getCode().getMethod(); setType(method.getParamNames()[param]); } return setLocal(local); }
/** * Set the method parameter that this instruction operates on. This * will set both the local index and the type of the instruction based * on the current method parameters. */ public LocalVariableInstruction setParam(int param) { int local = getCode().getLocalsIndex(param); if (local != -1) { BCMethod method = getCode().getMethod(); setType(method.getParamNames()[param]); } return setLocal(local); }