本文整理汇总了Java中com.android.dx.cf.iface.MethodList.get方法的典型用法代码示例。如果您正苦于以下问题:Java MethodList.get方法的具体用法?Java MethodList.get怎么用?Java MethodList.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.dx.cf.iface.MethodList
的用法示例。
在下文中一共展示了MethodList.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translateAnnotationDefaults
import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
/**
* Gets the {@code AnnotationDefault} attributes out of a
* given class, if any, reforming them as an
* {@code AnnotationDefault} annotation.
*
* @param cf {@code non-null;} the class in question
* @return {@code null-ok;} an appropriately-constructed
* {@code AnnotationDefault} annotation, if there were any
* annotation defaults in the class, or {@code null} if not
*/
private static Annotation translateAnnotationDefaults(DirectClassFile cf) {
CstType thisClass = cf.getThisClass();
MethodList methods = cf.getMethods();
int sz = methods.size();
Annotation result =
new Annotation(thisClass, AnnotationVisibility.EMBEDDED);
boolean any = false;
for (int i = 0; i < sz; i++) {
Method one = methods.get(i);
AttributeList attribs = one.getAttributes();
AttAnnotationDefault oneDefault = (AttAnnotationDefault)
attribs.findFirst(AttAnnotationDefault.ATTRIBUTE_NAME);
if (oneDefault != null) {
NameValuePair pair = new NameValuePair(
one.getNat().getName(),
oneDefault.getValue());
result.add(pair);
any = true;
}
}
if (! any) {
return null;
}
result.setImmutable();
return AnnotationUtils.makeAnnotationDefault(result);
}
示例2: process
import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
/**
* Process the given Java Class file and add the classes to the given root.
*
* @param cf
* the class file to process
* @param root
* the root element to append the classes to
* @param referencedTypes
* will be filled with the types references in this class file
* @return the class name for the DEXMLVM file
*/
private TypePlusSuperType process(DirectClassFile cf, Element root,
Map<String, ReferenceKind> referencedTypes) {
boolean skeletonOnly = hasSkeletonOnlyAnnotation(cf.getAttributes());
Element classElement = processClass(cf, root, referencedTypes);
processFields(cf.getFields(), classElement, referencedTypes, skeletonOnly);
MethodList methods = cf.getMethods();
int sz = methods.size();
for (int i = 0; i < sz; i++) {
Method one = methods.get(i);
if (hasIgnoreAnnotation(one.getAttributes())) {
// If this method has the @XMLVMIgnore annotation, we just
// simply ignore it.
continue;
}
if (skeletonOnly
&& (one.getAccessFlags() & (AccessFlags.ACC_PRIVATE | AccessFlags.ACC_SYNTHETIC)) != 0) {
// We only want to generate skeletons. This method is private or
// synthetic so simply ignore it.
continue;
}
try {
processMethod(one, cf, classElement, referencedTypes, skeletonOnly);
} catch (RuntimeException ex) {
String msg = "...while processing " + one.getName().toHuman() + " "
+ one.getDescriptor().toHuman();
throw ExceptionWithContext.withContext(ex, msg);
}
}
String className = classElement.getAttributeValue("name");
String superClassName = classElement.getAttributeValue("extends");
return new TypePlusSuperType(className, superClassName);
}
示例3: getAllDependencies
import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
/**
* Adds all dependencies of the given class to classDeps.
*/
private static void getAllDependencies(byte[] bytes, String relativePath,
Dependencies.ClassDeps classDeps) {
Log.debug(TAG, relativePath);
DirectClassFile classFile = new DirectClassFile(bytes, relativePath, false);
classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
try {
classFile.getMagic();
} catch (ParseException ex) {
Log.warn(TAG, "Put to red-list as it couldn't be parsed: " + relativePath);
BAD_CLASSES.add(classDeps.getClassName());
return;
}
String superClassName = "";
// This can happen for java.lang.Object.
if (classFile.getSuperclass() != null) {
superClassName = Util.parseClassName(
classFile.getSuperclass().getClassType().getClassName()).toString();
}
// Super Class
if (!superClassName.isEmpty()) {
Set<String> superClass = new HashSet<String>();
superClass.add(superClassName.replace('/', '.'));
classDeps.getMethodDeps("SUPER").addDependency(superClassName.replace('/', '.'), "");
}
// Interfaces
TypeList interfaces = classFile.getInterfaces();
if (interfaces.size() > 0) {
Set<String> interfaceList = new HashSet<String>();
for (int i = 0; i < interfaces.size(); ++i) {
interfaceList.add(Util.parseClassName(interfaces.getType(i).getClassName())
.toString());
classDeps.getMethodDeps("INTERFACES").addDependency(
Util.parseClassName(interfaces.getType(i).getClassName()).toString(), "");
}
}
// Methods
MethodList methods = classFile.getMethods();
for (int i = 0; i < methods.size(); i++) {
Method method = methods.get(i);
// CstMethodRef methodRef = new
// CstMethodRef(method.getDefiningClass(), method.getNat());
// We shouldn't need to go through the signature. If the class is
// not used in the code block, we can ignore it.
// processSignature(methodRef, dependencies);
processCode(getCode(method, classFile),
classDeps.getMethodDeps(method.getName().toHuman()));
}
}