private int addJimpleLnTags(int lnNum, SootField f) { f.addTag(new JimpleLineNumberTag(lnNum)); lnNum++; return lnNum; }
/** * @ast method * @aspect AnnotationsCodegen * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AnnotationsCodegen.jrag:32 */ public void addAttributes() { super.addAttributes(); ArrayList c = new ArrayList(); getModifiers().addRuntimeVisibleAnnotationsAttribute(c); getModifiers().addRuntimeInvisibleAnnotationsAttribute(c); getModifiers().addSourceOnlyAnnotations(c); for (Iterator iter = c.iterator(); iter.hasNext();) { soot.tagkit.Tag tag = (soot.tagkit.Tag) iter.next(); sootField.addTag(tag); } }
private void addOuterClassThisRefField(polyglot.types.Type outerType) { soot.Type outerSootType = Util.getSootType(outerType); soot.SootField field = Scene.v().makeSootField("this$0", outerSootType, soot.Modifier.PRIVATE | soot.Modifier.FINAL); sootClass.addField(field); field.addTag(new soot.tagkit.SyntheticTag()); }
private void addFinals(polyglot.types.LocalInstance li, ArrayList<SootField> finalFields) { // add as param for init for (SootMethod meth : sootClass.getMethods()) { if (meth.getName().equals("<init>")) { List<soot.Type> newParams = new ArrayList<soot.Type>(); newParams.addAll(meth.getParameterTypes()); newParams.add(Util.getSootType(li.type())); meth.setParameterTypes(newParams); } } // add field soot.SootField sf = Scene.v().makeSootField("val$" + li.name(), Util.getSootType(li.type()), soot.Modifier.FINAL | soot.Modifier.PRIVATE); sootClass.addField(sf); finalFields.add(sf); sf.addTag(new soot.tagkit.SyntheticTag()); }
.addTag(new soot.tagkit.IntegerConstantValueTag(((Integer) field.fieldInstance().constantValue()).intValue())); } else if (field.fieldInstance().constantValue() instanceof Character) { sootField .addTag(new soot.tagkit.IntegerConstantValueTag(((Character) field.fieldInstance().constantValue()).charValue())); } else if (field.fieldInstance().constantValue() instanceof Short) { sootField .addTag(new soot.tagkit.IntegerConstantValueTag(((Short) field.fieldInstance().constantValue()).shortValue())); } else if (field.fieldInstance().constantValue() instanceof Byte) { sootField.addTag(new soot.tagkit.IntegerConstantValueTag(((Byte) field.fieldInstance().constantValue()).byteValue())); } else if (field.fieldInstance().constantValue() instanceof Boolean) { boolean b = ((Boolean) field.fieldInstance().constantValue()).booleanValue(); sootField.addTag(new soot.tagkit.IntegerConstantValueTag(b ? 1 : 0)); } else if (field.fieldInstance().constantValue() instanceof Long) { sootField.addTag(new soot.tagkit.LongConstantValueTag(((Long) field.fieldInstance().constantValue()).longValue())); } else if (field.fieldInstance().constantValue() instanceof Double) { sootField.addTag( new soot.tagkit.DoubleConstantValueTag((long) ((Double) field.fieldInstance().constantValue()).doubleValue())); sootField.addTag(new soot.tagkit.FloatConstantValueTag(((Float) field.fieldInstance().constantValue()).floatValue())); } else if (field.fieldInstance().constantValue() instanceof String) { sootField.addTag(new soot.tagkit.StringConstantValueTag((String) field.fieldInstance().constantValue())); } else { throw new RuntimeException("Expecting static final field to have a constant value! For field: " + field + " of type: "
continue; field.addTag(entry.getValue());
@Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { soot.Type type = AsmUtil.toJimpleType(desc); addDep(type); SootField field = Scene.v().makeSootField(name, type, access); Tag tag; if (value instanceof Integer) { tag = new IntegerConstantValueTag((Integer) value); } else if (value instanceof Float) { tag = new FloatConstantValueTag((Float) value); } else if (value instanceof Long) { tag = new LongConstantValueTag((Long) value); } else if (value instanceof Double) { tag = new DoubleConstantValueTag((Double) value); } else if (value instanceof String) { tag = new StringConstantValueTag(value.toString()); } else { tag = null; } if (tag != null) { field.addTag(tag); } if (signature != null) { field.addTag(new SignatureTag(signature)); } field = klass.getOrAddField(field); return new FieldBuilder(field, this); }
if (!addToClass.declaresField(fieldName, fieldType)) { addToClass.addField(sootField); sootField.addTag(new soot.tagkit.SyntheticTag());
/** * @ast method * @aspect EmitJimple * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/EmitJimple.jrag:329 */ public void jimplify1phase2() { String name = name(); soot.Type type = type().getSootType(); int modifiers = sootTypeModifiers(); if (!hostType().getSootClassDecl().declaresFieldByName(name)) { SootField f = Scene.v().makeSootField(name, type, modifiers); hostType().getSootClassDecl().addField(f); if (isStatic() && isFinal() && isConstant() && (type().isPrimitive() || type().isString())) { if (type().isString()) f.addTag(new soot.tagkit.StringConstantValueTag(constant().stringValue())); else if (type().isLong()) f.addTag(new soot.tagkit.LongConstantValueTag(constant().longValue())); else if (type().isDouble()) f.addTag(new soot.tagkit.DoubleConstantValueTag(constant().doubleValue())); else if (type().isFloat()) f.addTag(new soot.tagkit.FloatConstantValueTag(constant().floatValue())); else if (type().isIntegralType()) f.addTag(new soot.tagkit.IntegerConstantValueTag(constant().intValue())); } sootField = f; } else { sootField = hostType().getSootClassDecl().getFieldByName(name); } addAttributes(); }
throw new RuntimeException("unexpected ConstantValue: " + cval); field.addTag(tag); field.addTag(new SyntheticTag()); field.addTag(new DeprecatedTag()); int signature_index = ((Signature_attribute) fieldInfo.attributes[j]).signature_index; String generic_sig = ((CONSTANT_Utf8_info) (coffiClass.constant_pool[signature_index])).convert(); field.addTag(new SignatureTag(generic_sig)); } else if (fieldInfo.attributes[j] instanceof RuntimeVisibleAnnotations_attribute || fieldInfo.attributes[j] instanceof RuntimeInvisibleAnnotations_attribute) { Generic_attribute attr = (Generic_attribute) fieldInfo.attributes[j]; String name = ((CONSTANT_Utf8_info) (coffiClass.constant_pool[attr.attribute_name])).convert(); field.addTag(new GenericAttribute(name, attr.info));
= Scene.v().makeSootField(fieldName, fieldType, soot.Modifier.STATIC | soot.Modifier.FINAL); sootClass.addField(assertionsDisabledField); assertionsDisabledField.addTag(new soot.tagkit.SyntheticTag()); soot.SootField classField = Scene.v().makeSootField(fieldName, fieldType, soot.Modifier.STATIC); addToClass.addField(classField); classField.addTag(new soot.tagkit.SyntheticTag());
df.addTag(tag);
private int addJimpleLnTags(int lnNum, SootField f) { f.addTag(new JimpleLineNumberTag(lnNum)); lnNum++; return lnNum; }
private int addJimpleLnTags(int lnNum, SootField f) { f.addTag(new JimpleLineNumberTag(lnNum)); lnNum++; return lnNum; }