本文整理汇总了Java中cuchaz.enigma.mapping.ClassEntry类的典型用法代码示例。如果您正苦于以下问题:Java ClassEntry类的具体用法?Java ClassEntry怎么用?Java ClassEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassEntry类属于cuchaz.enigma.mapping包,在下文中一共展示了ClassEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeMapping
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的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();
}
示例2: getSeparatedClasses
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
public void getSeparatedClasses(List<ClassEntry> obfClasses, List<ClassEntry> deobfClasses) {
for (ClassEntry obfClassEntry : m_jarIndex.getObfClassEntries()) {
// skip inner classes
if (obfClassEntry.isInnerClass()) {
continue;
}
// separate the classes
ClassEntry deobfClassEntry = deobfuscateEntry(obfClassEntry);
if (!deobfClassEntry.equals(obfClassEntry)) {
// if the class has a mapping, clearly it's deobfuscated
deobfClasses.add(deobfClassEntry);
} else if (!obfClassEntry.getPackageName().equals(Constants.NonePackage)) {
// also call it deobufscated if it's not in the none package
deobfClasses.add(obfClassEntry);
} else {
// otherwise, assume it's still obfuscated
obfClasses.add(obfClassEntry);
}
}
}
示例3: readEntry
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T extends Entry> T readEntry(String in) {
if (in.length() <= 0) {
return null;
}
String[] parts = in.split(" ");
if (parts.length == 3 && parts[2].indexOf('(') < 0) {
return (T)new FieldEntry(
new ClassEntry(parts[0]),
parts[1],
new Type(parts[2])
);
} else {
assert(parts.length == 2 || parts.length == 3);
if (parts.length == 2) {
return (T)EntryFactory.getBehaviorEntry(parts[0], parts[1]);
} else if (parts.length == 3) {
return (T)EntryFactory.getBehaviorEntry(parts[0], parts[1], parts[2]);
} else {
throw new Error("Malformed behavior entry: " + in);
}
}
}
示例4: translate
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的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());
}
示例5: advance
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
private void advance(ClassEntry sourceClass) {
// make sure we have a source class
if (sourceClass == null) {
sourceClass = m_sourceClasses.getSelectedClass();
if (sourceClass != null) {
sourceClass = m_sourceClasses.getNextClass(sourceClass);
} else {
sourceClass = m_sourceClasses.getFirstClass();
}
}
// set the source class
setSourceClass(sourceClass, new Runnable() {
@Override
public void run() {
pickBestDestClass();
}
});
m_sourceClasses.setSelectionClass(sourceClass);
}
示例6: rename
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的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();
}
示例7: visitMemberReferenceExpression
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
@Override
public Void visitMemberReferenceExpression(MemberReferenceExpression node, SourceIndex index) {
MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
if (ref != null) {
// make sure this is actually a field
if (ref.getErasedSignature().indexOf('(') >= 0) {
throw new Error("Expected a field here! got " + ref);
}
ClassEntry classEntry = new ClassEntry(ref.getDeclaringType().getInternalName());
FieldEntry fieldEntry = new FieldEntry(classEntry, ref.getName(), new Type(ref.getErasedSignature()));
index.addReference(node.getMemberNameToken(), fieldEntry, m_behaviorEntry);
}
return recurse(node, index);
}
示例8: load
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的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);
}
}
示例9: decompileClass
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
public void decompileClass(final ClassEntry classEntry, final Deobfuscator deobfuscator, final Boolean ignoreBadTokens, final Runnable callback) {
if (classEntry == null) {
setCode(null);
return;
}
setCode("(decompiling...)");
// run decompilation in a separate thread to keep ui responsive
new Thread() {
@Override
public void run() {
// decompile it
CompilationUnit sourceTree = deobfuscator.getSourceTree(classEntry.getOutermostClassName());
String source = deobfuscator.getSource(sourceTree);
setCode(source);
m_sourceIndex = deobfuscator.getSourceIndex(sourceTree, source, ignoreBadTokens);
if (callback != null) {
callback.run();
}
}
}.start();
}
示例10: resolveSuperclass
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
public ClassEntry resolveSuperclass(Entry entry) {
// this entry could refer to a method on a class where the method is not actually implemented
// travel up the inheritance tree to find the closest implementation
while (!entryExists(entry)) {
// is there a parent class?
ClassEntry superclassEntry = getSuperclass(entry.getClassEntry());
if (superclassEntry == null) {
// this is probably a method from a class in a library
// we can't trace the implementation up any higher unless we index the library
return null;
}
// move up to the parent class
entry = entry.cloneToNewClass(superclassEntry);
}
return entry.getClassEntry();
}
示例11: setSourceClass
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
protected void setSourceClass(ClassEntry sourceClass) {
m_obfSourceClass = m_sourceDeobfuscator.obfuscateEntry(sourceClass);
m_obfDestClass = m_classMatches.getUniqueMatches().get(m_obfSourceClass);
if (m_obfDestClass == null) {
throw new Error("No matching dest class for source class: " + m_obfSourceClass);
}
m_sourceReader.decompileClass(m_obfSourceClass, m_sourceDeobfuscator, false, new Runnable() {
@Override
public void run() {
updateSourceHighlights();
}
});
m_destReader.decompileClass(m_obfDestClass, m_destDeobfuscator, false, new Runnable() {
@Override
public void run() {
updateDestHighlights();
}
});
}
示例12: navigateToClassDeclaration
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
public void navigateToClassDeclaration(ClassEntry classEntry) {
// navigate to the class declaration
Token token = m_sourceIndex.getDeclarationToken(classEntry);
if (token == null) {
// couldn't find the class declaration token, might be an anonymous class
// look for any declaration in that class instead
for (Entry entry : m_sourceIndex.declarations()) {
if (entry.getClassEntry().equals(classEntry)) {
token = m_sourceIndex.getDeclarationToken(entry);
break;
}
}
}
if (token != null) {
navigateToToken(token);
} else {
// couldn't find anything =(
System.out.println("Unable to find declaration in source for " + classEntry);
}
}
示例13: hasDeobfuscatedName
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的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());
}
}
示例14: getClassInheritance
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的package包/类
public ClassInheritanceTreeNode getClassInheritance(Translator deobfuscatingTranslator, ClassEntry obfClassEntry) {
// get the root node
List<String> ancestry = Lists.newArrayList();
ancestry.add(obfClassEntry.getName());
for (ClassEntry classEntry : m_translationIndex.getAncestry(obfClassEntry)) {
if (containsObfClass(classEntry)) {
ancestry.add(classEntry.getName());
}
}
ClassInheritanceTreeNode rootNode = new ClassInheritanceTreeNode(
deobfuscatingTranslator,
ancestry.get(ancestry.size() - 1)
);
// expand all children recursively
rootNode.load(m_translationIndex, true);
return rootNode;
}
示例15: showReference
import cuchaz.enigma.mapping.ClassEntry; //导入依赖的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();
}