本文整理汇总了Java中cuchaz.enigma.mapping.MethodEntry类的典型用法代码示例。如果您正苦于以下问题:Java MethodEntry类的具体用法?Java MethodEntry怎么用?Java MethodEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MethodEntry类属于cuchaz.enigma.mapping包,在下文中一共展示了MethodEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translate
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T extends Entry> T translate(T in, BiMap<ClassEntry,ClassEntry> map) {
if (in instanceof FieldEntry) {
return (T)new FieldEntry(
map.get(in.getClassEntry()),
in.getName(),
translate(((FieldEntry)in).getType(), map)
);
} else if (in instanceof MethodEntry) {
return (T)new MethodEntry(
map.get(in.getClassEntry()),
in.getName(),
translate(((MethodEntry)in).getSignature(), map)
);
} else if (in instanceof ConstructorEntry) {
return (T)new ConstructorEntry(
map.get(in.getClassEntry()),
translate(((ConstructorEntry)in).getSignature(), map)
);
}
throw new Error("Unhandled entry type: " + in.getClass());
}
示例2: getNext
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
private CheckCast getNext() throws BadBytecode {
int prevPos = 0;
while (m_iter.hasNext()) {
int pos = m_iter.next();
int opcode = m_iter.byteAt(pos);
switch (opcode) {
case Opcode.CHECKCAST:
// get the type of this op code (next two bytes are a classinfo index)
MethodEntry prevMethodEntry = getMethodEntry(prevPos);
if (prevMethodEntry != null) {
return new CheckCast(m_constants.getClassInfo(m_iter.s16bitAt(pos + 1)), prevMethodEntry);
}
break;
}
prevPos = pos;
}
return null;
}
示例3: load
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public void load(JarIndex index) {
// get all method implementations
List<MethodImplementationsTreeNode> nodes = Lists.newArrayList();
for (String implementingClassName : index.getImplementingClasses(m_entry.getClassName())) {
MethodEntry methodEntry = new MethodEntry(
new ClassEntry(implementingClassName),
m_entry.getName(),
m_entry.getSignature()
);
if (index.containsObfBehavior(methodEntry)) {
nodes.add(new MethodImplementationsTreeNode(m_deobfuscatingTranslator, methodEntry));
}
}
// add them to this node
for (MethodImplementationsTreeNode node : nodes) {
this.add(node);
}
}
示例4: markBridges
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public void markBridges(CtClass c) {
for (CtMethod method : c.getDeclaredMethods()) {
MethodEntry methodEntry = EntryFactory.getMethodEntry(method);
// is this a bridge method?
MethodEntry bridgedMethodEntry = m_jarIndex.getBridgedMethod(methodEntry);
if (bridgedMethodEntry != null) {
// it's a bridge method! add the bridge flag
int flags = method.getMethodInfo().getAccessFlags();
flags |= AccessFlag.BRIDGE;
method.getMethodInfo().setAccessFlags(flags);
}
}
}
示例5: getReport
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public String getReport() {
StringBuilder buf = new StringBuilder();
buf.append(m_inconsistentGroups.size());
buf.append(" groups of methods related by inheritance and/or interfaces have different deobf names!\n");
for (Set<MethodEntry> group : m_inconsistentGroups) {
buf.append("\tGroup with ");
buf.append(group.size());
buf.append(" methods:\n");
for (MethodEntry methodEntry : group) {
buf.append("\t\t");
buf.append(methodEntry.toString());
buf.append(" => ");
buf.append(m_deobfNamesByObfMethod.get(methodEntry));
buf.append("\n");
}
}
return buf.toString();
}
示例6: indexBehavior
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
private void indexBehavior(CtBehavior behavior) {
// get the behavior entry
final BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior);
if (behaviorEntry instanceof MethodEntry) {
MethodEntry methodEntry = (MethodEntry)behaviorEntry;
// index implementation
m_methodImplementations.put(behaviorEntry.getClassName(), methodEntry);
// look for bridge and bridged methods
CtMethod bridgedMethod = getBridgedMethod((CtMethod)behavior);
if (bridgedMethod != null) {
m_bridgedMethods.put(methodEntry, EntryFactory.getMethodEntry(bridgedMethod));
}
}
// looks like we don't care about constructors here
}
示例7: getRelatedMethodImplementations
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
private void getRelatedMethodImplementations(Set<MethodEntry> methodEntries, MethodInheritanceTreeNode node) {
MethodEntry methodEntry = node.getMethodEntry();
if (containsObfBehavior(methodEntry)) {
// collect the entry
methodEntries.add(methodEntry);
}
// look at interface methods too
for (MethodImplementationsTreeNode implementationsNode : getMethodImplementations(null, methodEntry)) {
getRelatedMethodImplementations(methodEntries, implementationsNode);
}
// recurse
for (int i = 0; i < node.getChildCount(); i++) {
getRelatedMethodImplementations(methodEntries, (MethodInheritanceTreeNode)node.getChildAt(i));
}
}
示例8: hasDeobfuscatedName
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public boolean hasDeobfuscatedName(Entry obfEntry) {
Translator translator = getTranslator(TranslationDirection.Deobfuscating);
if (obfEntry instanceof ClassEntry) {
ClassEntry obfClass = (ClassEntry)obfEntry;
List<ClassMapping> mappingChain = m_mappings.getClassMappingChain(obfClass);
ClassMapping classMapping = mappingChain.get(mappingChain.size() - 1);
return classMapping != null && classMapping.getDeobfName() != null;
} else if (obfEntry instanceof FieldEntry) {
return translator.translate((FieldEntry)obfEntry) != null;
} else if (obfEntry instanceof MethodEntry) {
return translator.translate((MethodEntry)obfEntry) != null;
} else if (obfEntry instanceof ConstructorEntry) {
// constructors have no names
return false;
} else if (obfEntry instanceof ArgumentEntry) {
return translator.translate((ArgumentEntry)obfEntry) != null;
} else {
throw new Error("Unknown entry type: " + obfEntry.getClass().getName());
}
}
示例9: rename
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public void rename(Entry obfEntry, String newName) {
if (obfEntry instanceof ClassEntry) {
m_renamer.setClassName((ClassEntry)obfEntry, Descriptor.toJvmName(newName));
} else if (obfEntry instanceof FieldEntry) {
m_renamer.setFieldName((FieldEntry)obfEntry, newName);
} else if (obfEntry instanceof MethodEntry) {
m_renamer.setMethodTreeName((MethodEntry)obfEntry, newName);
} else if (obfEntry instanceof ConstructorEntry) {
throw new IllegalArgumentException("Cannot rename constructors");
} else if (obfEntry instanceof ArgumentEntry) {
m_renamer.setArgumentName((ArgumentEntry)obfEntry, newName);
} else {
throw new Error("Unknown entry type: " + obfEntry.getClass().getName());
}
// clear caches
m_translatorCache.clear();
}
示例10: removeMapping
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public void removeMapping(Entry obfEntry) {
if (obfEntry instanceof ClassEntry) {
m_renamer.removeClassMapping((ClassEntry)obfEntry);
} else if (obfEntry instanceof FieldEntry) {
m_renamer.removeFieldMapping((FieldEntry)obfEntry);
} else if (obfEntry instanceof MethodEntry) {
m_renamer.removeMethodTreeMapping((MethodEntry)obfEntry);
} else if (obfEntry instanceof ConstructorEntry) {
throw new IllegalArgumentException("Cannot rename constructors");
} else if (obfEntry instanceof ArgumentEntry) {
m_renamer.removeArgumentMapping((ArgumentEntry)obfEntry);
} else {
throw new Error("Unknown entry type: " + obfEntry);
}
// clear caches
m_translatorCache.clear();
}
示例11: markAsDeobfuscated
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public void markAsDeobfuscated(Entry obfEntry) {
if (obfEntry instanceof ClassEntry) {
m_renamer.markClassAsDeobfuscated((ClassEntry)obfEntry);
} else if (obfEntry instanceof FieldEntry) {
m_renamer.markFieldAsDeobfuscated((FieldEntry)obfEntry);
} else if (obfEntry instanceof MethodEntry) {
m_renamer.markMethodTreeAsDeobfuscated((MethodEntry)obfEntry);
} else if (obfEntry instanceof ConstructorEntry) {
throw new IllegalArgumentException("Cannot rename constructors");
} else if (obfEntry instanceof ArgumentEntry) {
m_renamer.markArgumentAsDeobfuscated((ArgumentEntry)obfEntry);
} else {
throw new Error("Unknown entry type: " + obfEntry);
}
// clear caches
m_translatorCache.clear();
}
示例12: showReference
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
private void showReference(EntryReference<Entry,Entry> reference) {
if (reference == null) {
clearReference();
return;
}
m_reference = reference;
m_infoPanel.removeAll();
if (reference.entry instanceof ClassEntry) {
showClassEntry((ClassEntry)m_reference.entry);
} else if (m_reference.entry instanceof FieldEntry) {
showFieldEntry((FieldEntry)m_reference.entry);
} else if (m_reference.entry instanceof MethodEntry) {
showMethodEntry((MethodEntry)m_reference.entry);
} else if (m_reference.entry instanceof ConstructorEntry) {
showConstructorEntry((ConstructorEntry)m_reference.entry);
} else if (m_reference.entry instanceof ArgumentEntry) {
showArgumentEntry((ArgumentEntry)m_reference.entry);
} else {
throw new Error("Unknown entry type: " + m_reference.entry.getClass().getName());
}
redraw();
}
示例13: markBridges
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public void markBridges(CtClass c) {
for (CtMethod method : c.getDeclaredMethods()) {
MethodEntry methodEntry = EntryFactory.getMethodEntry(method);
// is this a bridge method?
MethodEntry bridgedMethodEntry = this.m_jarIndex.getBridgedMethod(methodEntry);
if (bridgedMethodEntry != null) {
// it's a bridge method! add the bridge flag
int flags = method.getMethodInfo().getAccessFlags();
flags |= AccessFlag.BRIDGE;
method.getMethodInfo().setAccessFlags(flags);
}
}
}
示例14: load
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
public void load(JarIndex index, boolean recurse) {
// get all the child nodes
List<MethodInheritanceTreeNode> nodes = Lists.newArrayList();
for (ClassEntry subclassEntry : index.getTranslationIndex().getSubclass(this.entry.getClassEntry())) {
MethodEntry methodEntry = new MethodEntry(subclassEntry, this.entry.getName(), this.entry.getSignature()
);
nodes.add(new MethodInheritanceTreeNode(this.deobfuscatingTranslator, methodEntry, index.containsObfBehavior(methodEntry)
));
}
// add them to this node
nodes.forEach(this::add);
if (recurse) {
for (MethodInheritanceTreeNode node : nodes) {
node.load(index, true);
}
}
}
示例15: getNext
import cuchaz.enigma.mapping.MethodEntry; //导入依赖的package包/类
private CheckCast getNext() throws BadBytecode
{
int prevPos = 0;
while(m_iter.hasNext())
{
int pos = m_iter.next();
int opcode = m_iter.byteAt(pos);
switch(opcode)
{
case Opcode.CHECKCAST:
// get the type of this op code (next two bytes are a
// classinfo index)
MethodEntry prevMethodEntry = getMethodEntry(prevPos);
if(prevMethodEntry != null)
return new CheckCast(m_constants.getClassInfo(m_iter
.s16bitAt(pos + 1)), prevMethodEntry);
break;
}
prevPos = pos;
}
return null;
}