classDefItem = new ClassDefItem(thisType, flags, supertype.constant, interfaces.ropTypes, new CstString(sourceFile)); EncodedMethod encoded = method.toEncodedMethod(dexOptions); if (method.isDirect()) { classDefItem.addDirectMethod(encoded); } else { classDefItem.addVirtualMethod(encoded); EncodedField encoded = field.toEncodedField(); if (field.isStatic()) { classDefItem.addStaticField(encoded, Constants.getConstant(field.staticValue)); } else { classDefItem.addInstanceField(encoded);
classDefItem.addMethodAnnotations(cstMethodRef, annotations, dexMaker.getDexFile());
ClassDefItem c = classDefs.get(type); if ((c == null) || (c.hasIndex())) { return idx; CstType superclassCst = c.getSuperclass(); if (superclassCst != null) { Type superclass = superclassCst.getClassType(); TypeList interfaces = c.getInterfaces(); int sz = interfaces.size(); for (int i = 0; i < sz; i++) { c.setIndex(idx); orderedDefs.add(c); return idx + 1;
out.addDirectMethod(mi); } else { out.addVirtualMethod(mi); AttributeTranslator.getMethodAnnotations(one); if (annotations.size() != 0) { out.addMethodAnnotations(meth, annotations); AttributeTranslator.getParameterAnnotations(one); if (list.size() != 0) { out.addParameterAnnotations(meth, list);
constVal = coerceConstant(constVal, field.getType()); out.addStaticField(fi, constVal); } else { EncodedField fi = new EncodedField(field, accessFlags); out.addInstanceField(fi); AttributeTranslator.getAnnotations(one.getAttributes()); if (annotations.size() != 0) { out.addFieldAnnotations(field, annotations);
cf.getSourceFile(); ClassDefItem out = new ClassDefItem(thisClass, classAccessFlags, cf.getSuperclass(), cf.getInterfaces(), sourceFile); AttributeTranslator.getClassAnnotations(cf, cfOptions); if (classAnnotations.size() != 0) { out.setClassAnnotations(classAnnotations);
/** * Adds an element to this instance. It is illegal to attempt to add more * than one class with the same name. * * @param clazz {@code non-null;} the class def to add */ public void add(ClassDefItem clazz) { Type type; try { type = clazz.getThisClass().getClassType(); } catch (NullPointerException ex) { // Elucidate the exception. throw new NullPointerException("clazz == null"); } throwIfPrepared(); if (classDefs.get(type) != null) { throw new IllegalArgumentException("already added: " + type); } classDefs.put(type, clazz); }
ClassDefItem c = classDefs.get(type); if ((c == null) || (c.hasIndex())) { return idx; CstType superclassCst = c.getSuperclass(); if (superclassCst != null) { Type superclass = superclassCst.getClassType(); TypeList interfaces = c.getInterfaces(); int sz = interfaces.size(); for (int i = 0; i < sz; i++) { c.setIndex(idx); orderedDefs.add(c); return idx + 1;
out.addDirectMethod(mi); } else { out.addVirtualMethod(mi); AttributeTranslator.getMethodAnnotations(one); if (annotations.size() != 0) { out.addMethodAnnotations(meth, annotations); AttributeTranslator.getParameterAnnotations(one); if (list.size() != 0) { out.addParameterAnnotations(meth, list);
constVal = coerceConstant(constVal, field.getType()); out.addStaticField(fi, constVal); } else { EncodedField fi = new EncodedField(field, accessFlags); out.addInstanceField(fi); AttributeTranslator.getAnnotations(one.getAttributes()); if (annotations.size() != 0) { out.addFieldAnnotations(field, annotations);
cf.getSourceFile(); ClassDefItem out = new ClassDefItem(thisClass, classAccessFlags, cf.getSuperclass(), cf.getInterfaces(), sourceFile); AttributeTranslator.getClassAnnotations(cf, args); if (classAnnotations.size() != 0) { out.setClassAnnotations(classAnnotations);
/** * Adds an element to this instance. It is illegal to attempt to add more * than one class with the same name. * * @param clazz {@code non-null;} the class def to add */ public void add(ClassDefItem clazz) { Type type; try { type = clazz.getThisClass().getClassType(); } catch (NullPointerException ex) { // Elucidate the exception. throw new NullPointerException("clazz == null"); } throwIfPrepared(); if (classDefs.get(type) != null) { throw new IllegalArgumentException("already added: " + type); } classDefs.put(type, clazz); }
ClassDefItem c = classDefs.get(type); if ((c == null) || (c.hasIndex())) { return idx; CstType superclassCst = c.getSuperclass(); if (superclassCst != null) { Type superclass = superclassCst.getClassType(); TypeList interfaces = c.getInterfaces(); int sz = interfaces.size(); for (int i = 0; i < sz; i++) { c.setIndex(idx); orderedDefs.add(c); return idx + 1;
ClassDefItem toClassDefItem() { if (!declared) { throw new IllegalStateException("Undeclared type " + type + " declares members: " + fields.keySet() + " " + methods.keySet()); } DexOptions dexOptions = new DexOptions(); dexOptions.targetApiLevel = DexFormat.API_NO_EXTENDED_OPCODES; CstType thisType = type.constant; ClassDefItem out = new ClassDefItem(thisType, flags, supertype.constant, interfaces.ropTypes, new CstString(sourceFile)); for (MethodDeclaration method : methods.values()) { EncodedMethod encoded = method.toEncodedMethod(dexOptions); if (method.isDirect()) { out.addDirectMethod(encoded); } else { out.addVirtualMethod(encoded); } } for (FieldDeclaration field : fields.values()) { EncodedField encoded = field.toEncodedField(); if (field.isStatic()) { out.addStaticField(encoded, Constants.getConstant(field.staticValue)); } else { out.addInstanceField(encoded); } } return out; } }
out.addDirectMethod(mi); } else { out.addVirtualMethod(mi); AttributeTranslator.getMethodAnnotations(one); if (annotations.size() != 0) { out.addMethodAnnotations(meth, annotations, dexFile); AttributeTranslator.getParameterAnnotations(one); if (list.size() != 0) { out.addParameterAnnotations(meth, list, dexFile);
constVal = coerceConstant(constVal, field.getType()); out.addStaticField(fi, constVal); } else { EncodedField fi = new EncodedField(field, accessFlags); out.addInstanceField(fi); AttributeTranslator.getAnnotations(one.getAttributes()); if (annotations.size() != 0) { out.addFieldAnnotations(field, annotations, dexFile);
cf.getSourceFile(); ClassDefItem out = new ClassDefItem(thisClass, classAccessFlags, cf.getSuperclass(), cf.getInterfaces(), sourceFile); AttributeTranslator.getClassAnnotations(cf, cfOptions); if (classAnnotations.size() != 0) { out.setClassAnnotations(classAnnotations, dexFile);
/** * Adds an element to this instance. It is illegal to attempt to add more * than one class with the same name. * * @param clazz {@code non-null;} the class def to add */ public void add(ClassDefItem clazz) { Type type; try { type = clazz.getThisClass().getClassType(); } catch (NullPointerException ex) { // Elucidate the exception. throw new NullPointerException("clazz == null"); } throwIfPrepared(); if (classDefs.get(type) != null) { throw new IllegalArgumentException("already added: " + type); } classDefs.put(type, clazz); }
classDefItem.addMethodAnnotations(cstMethodRef, annotations, dexMaker.getDexFile());
ClassDefItem c = classDefs.get(type); if ((c == null) || (c.hasIndex())) { return idx; CstType superclassCst = c.getSuperclass(); if (superclassCst != null) { Type superclass = superclassCst.getClassType(); TypeList interfaces = c.getInterfaces(); int sz = interfaces.size(); for (int i = 0; i < sz; i++) { c.setIndex(idx); orderedDefs.add(c); return idx + 1;