public void setAccessMethodForField(String owner, String name, String sig, boolean isStatic) { accessMethodForField = new FieldDescriptor(owner, name, sig, isStatic); }
public boolean same(LoadedVariable other) { if(other.lvState != lvState) { return false; } if(lvState == LoadedVariableState.LOCAL && num != other.num) { return false; } if ((lvState == LoadedVariableState.FIELD) && !fd.equals(other.fd)) { return false; } return true; }
protected UnresolvedXField(FieldDescriptor m) { super(m.getClassDescriptor().getDottedClassName(), m.getName(), m.getSignature(), m.isStatic() ? Const.ACC_STATIC : 0); if (m.getSignature().charAt(0) == '(') { throw new IllegalArgumentException("Bad signature: " + m.getSignature()); } if (XFactory.DEBUG_UNRESOLVED) { System.out.println("Unresolved xmethod: " + this); } }
public int getIndex(FieldDescriptor f) { Integer i = addedFields.get(f); if (i != null) { return i; } int index = cpg.addFieldref(f.getSlashedClassName(), f.getName(), f.getSignature()); addedFields.put(f, index); return index; } public void optimize(InstructionList instructionList) {
@Override protected void writeKey(Writer writer, FieldDescriptor key) throws IOException { writer.write(key.getClassDescriptor().getDottedClassName()); writer.write(","); writer.write(key.getName()); writer.write(","); writer.write(key.getSignature()); writer.write(","); XField xField = XFactory.createXField(key); int flags = xField.getAccessFlags() & 0xf; writer.write(String.valueOf(flags)); }
public void purgeBoringEntries() { Collection<FieldDescriptor> keys = new ArrayList<>(getKeys()); for (FieldDescriptor f : keys) { FieldStoreType type = getProperty(f); Type fieldType = Type.getType(f.getSignature()); if (!(fieldType instanceof ReferenceType)) { removeProperty(f); continue; } ReferenceType storeType = type.getLoadType((ReferenceType) fieldType); if (storeType.equals(fieldType)) { removeProperty(f); } } }
@Override public final boolean equals(Object obj) { if (obj instanceof FieldDescriptor) { return haveEqualFields((FieldDescriptor) obj); } return false; }
boolean samePackage = packageName.equals(extractPackage(xField.getFieldDescriptor().getSlashedClassName())); boolean initOnly = seen == Const.GETSTATIC || getClassName().equals(getClassConstantOperand()) && inStaticInitializer; boolean safeValue = seen == Const.GETSTATIC || emptyArrayOnTOS
Instruction replacement; int index = getIndex(field); if (field.isStatic()) { if (isSetter) { replacement = new PUTSTATIC(index);
public int getIndex(FieldDescriptor f) { Integer i = addedFields.get(f); if (i != null) { return i; } int index = cpg.addFieldref(f.getSlashedClassName(), f.getName(), f.getSignature()); addedFields.put(f, index); return index; } public void optimize(InstructionList instructionList) {
@Override protected void writeKey(Writer writer, FieldDescriptor key) throws IOException { writer.write(key.getClassDescriptor().getDottedClassName()); writer.write(","); writer.write(key.getName()); writer.write(","); writer.write(key.getSignature()); writer.write(","); XField xField = XFactory.createXField(key); int flags = xField.getAccessFlags() & 0xf; writer.write(String.valueOf(flags)); }
String dottedClass = DeepSubtypeAnalysis.getComponentClass(fieldInfo.getSignature()); JavaClass fieldClass = Repository.lookupClass(dottedClass); if (fieldClass != null && fieldClass.instanceOf(bundleClass)) {
@Override public final boolean equals(Object obj) { if (obj instanceof FieldDescriptor) { return haveEqualFields((FieldDescriptor) obj); } return false; }
boolean samePackage = packageName.equals(extractPackage(xField.getFieldDescriptor().getSlashedClassName())); boolean initOnly = seen == GETSTATIC || getClassName().equals(getClassConstantOperand()) && inStaticInitializer; boolean safeValue = seen == GETSTATIC || emptyArrayOnTOS
Instruction replacement; int index = getIndex(field); if (field.isStatic()) { if (isSetter) { replacement = new PUTSTATIC(index);
@Override public String toString() { return (isStatic() ? "static " : "") + getClassDescriptor().getDottedClassName() + "." + getName() + " " + getSignature(); }
/** * Get a FieldDescriptor. * * @param className * the name of the class the field belongs to, in VM format * (e.g., "java/lang/String") * @param name * the name of the field * @param signature * the field signature (type) * @param isStatic * true if field is static, false if not * @return FieldDescriptor */ public FieldDescriptor getFieldDescriptor(@SlashedClassName String className, String name, String signature, boolean isStatic) { FieldDescriptor fieldDescriptor = new FieldDescriptor(className, name, signature, isStatic); FieldDescriptor existing = fieldDescriptorMap.get(fieldDescriptor); if (existing == null) { fieldDescriptorMap.put(fieldDescriptor, fieldDescriptor); existing = fieldDescriptor; } return existing; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MethodCall other = (MethodCall) obj; if (!method.equals(other.method)) { return false; } if (!target.equals(other.target)) { return false; } return true; } }
public void purgeBoringEntries() { Collection<FieldDescriptor> keys = new ArrayList<FieldDescriptor>(getKeys()); for (FieldDescriptor f : keys) { String s = f.getSignature(); FieldStoreType type = getProperty(f); Type fieldType = Type.getType(f.getSignature()); if (!(fieldType instanceof ReferenceType)) { removeProperty(f); continue; } ReferenceType storeType = type.getLoadType((ReferenceType) fieldType); if (storeType.equals(fieldType)) { removeProperty(f); } } }
/** * Factory method. Construct from a FieldDescriptor. * * @param fieldDescriptor * the FieldDescriptor * @return the FieldAnnotation */ public static FieldAnnotation fromFieldDescriptor(FieldDescriptor fieldDescriptor) { return new FieldAnnotation(fieldDescriptor.getClassDescriptor().getDottedClassName(), fieldDescriptor.getName(), fieldDescriptor.getSignature(), fieldDescriptor.isStatic()); }