本文整理汇总了Java中cuchaz.enigma.mapping.ClassEntry.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ClassEntry.equals方法的具体用法?Java ClassEntry.equals怎么用?Java ClassEntry.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cuchaz.enigma.mapping.ClassEntry
的用法示例。
在下文中一共展示了ClassEntry.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSeparatedClasses
import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
public void getSeparatedClasses(List<ClassEntry> obfClasses, List<ClassEntry> deobfClasses,List<ClassEntry> nonePkgClass,List<ClassEntry> innerClass) {
Set<ClassEntry> all = m_jarIndex.getObfClassEntries();
for (ClassEntry obfClassEntry : all) {
// skip inner classes
if (obfClassEntry.isInnerClass()) {
innerClass.add(obfClassEntry);
}
ClassEntry deobfClassEntry = deobfuscateEntry(obfClassEntry);
// separate the classes
if (isInDeObfuscatTrans(obfClassEntry) || !deobfClassEntry.equals(obfClassEntry)) {
deobfClasses.add(deobfClassEntry);
}else if (obfClassEntry.getPackageName().equals(Constants.NonePackage)){
nonePkgClass.add(obfClassEntry);
}else{
// otherwise, assume it's still obfuscated
obfClasses.add(obfClassEntry);
}
}
}
示例2: visitTypeDeclaration
import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
@Override
public Void visitTypeDeclaration(TypeDeclaration node, SourceIndex index) {
// is this this class, or a subtype?
TypeDefinition def = node.getUserData(Keys.TYPE_DEFINITION);
ClassEntry classEntry = new ClassEntry(def.getInternalName());
if (!classEntry.equals(m_classEntry)) {
// it's a sub-type, recurse
index.addDeclaration(node.getNameToken(), classEntry);
return node.acceptVisitor(new SourceIndexClassVisitor(classEntry), index);
}
return recurse(node, index);
}
示例3: getSubclass
import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
public List<ClassEntry> getSubclass(ClassEntry classEntry) {
// linear search is fast enough for now
List<ClassEntry> subclasses = Lists.newArrayList();
for (Map.Entry<ClassEntry,ClassEntry> entry : m_superclasses.entrySet()) {
ClassEntry subclass = entry.getKey();
ClassEntry superclass = entry.getValue();
if (classEntry.equals(superclass)) {
subclasses.add(subclass);
}
}
return subclasses;
}
示例4: isSaneOuterClass
import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
private boolean isSaneOuterClass(ClassEntry outerClassEntry, ClassEntry innerClassEntry) {
// clearly this would be silly
if (outerClassEntry.equals(innerClassEntry)) {
return false;
}
// is the outer class in the jar?
if (!m_obfClassEntries.contains(outerClassEntry)) {
return false;
}
return true;
}
示例5: getSourceIndex
import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
public SourceIndex getSourceIndex(CompilationUnit sourceTree, String source, Boolean ignoreBadTokens) {
// build the source index
SourceIndex index;
if (ignoreBadTokens != null) {
index = new SourceIndex(source, ignoreBadTokens);
} else {
index = new SourceIndex(source);
}
sourceTree.acceptVisitor(new SourceIndexVisitor(), index);
// DEBUG
// sourceTree.acceptVisitor( new TreeDumpVisitor( new File( "tree.txt" ) ), null );
// resolve all the classes in the source references
for (Token token : index.referenceTokens()) {
EntryReference<Entry,Entry> deobfReference = index.getDeobfReference(token);
// get the obfuscated entry
Entry obfEntry = obfuscateEntry(deobfReference.entry);
// try to resolve the class
ClassEntry resolvedObfClassEntry = m_jarIndex.getTranslationIndex().resolveEntryClass(obfEntry);
if (resolvedObfClassEntry != null && !resolvedObfClassEntry.equals(obfEntry.getClassEntry())) {
// change the class of the entry
obfEntry = obfEntry.cloneToNewClass(resolvedObfClassEntry);
// save the new deobfuscated reference
deobfReference.entry = deobfuscateEntry(obfEntry);
index.replaceDeobfReference(token, deobfReference);
}
// DEBUG
// System.out.println( token + " -> " + reference + " -> " + index.getReferenceToken( reference ) );
}
return index;
}
示例6: findOuterClass
import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
private ClassEntry findOuterClass(CtClass c) {
ClassEntry classEntry = EntryFactory.getClassEntry(c);
// does this class already have an outer class?
if (classEntry.isInnerClass()) {
return classEntry.getOuterClassEntry();
}
// inner classes:
// have constructors that can (illegally) set synthetic fields
// the outer class is the only class that calls constructors
// use the synthetic fields to find the synthetic constructors
for (CtConstructor constructor : c.getDeclaredConstructors()) {
Set<String> syntheticFieldTypes = Sets.newHashSet();
if (!isIllegalConstructor(syntheticFieldTypes, constructor)) {
continue;
}
ConstructorEntry constructorEntry = EntryFactory.getConstructorEntry(constructor);
// gather the classes from the illegally-set synthetic fields
Set<ClassEntry> illegallySetClasses = Sets.newHashSet();
for (String type : syntheticFieldTypes) {
if (type.startsWith("L")) {
ClassEntry outerClassEntry = new ClassEntry(type.substring(1, type.length() - 1));
if (isSaneOuterClass(outerClassEntry, classEntry)) {
illegallySetClasses.add(outerClassEntry);
}
}
}
// who calls this constructor?
Set<ClassEntry> callerClasses = Sets.newHashSet();
for (EntryReference<BehaviorEntry,BehaviorEntry> reference : getBehaviorReferences(constructorEntry)) {
// make sure it's not a call to super
if (reference.entry instanceof ConstructorEntry && reference.context instanceof ConstructorEntry) {
// is the entry a superclass of the context?
ClassEntry calledClassEntry = reference.entry.getClassEntry();
ClassEntry superclassEntry = m_translationIndex.getSuperclass(reference.context.getClassEntry());
if (superclassEntry != null && superclassEntry.equals(calledClassEntry)) {
// it's a super call, skip
continue;
}
}
if (isSaneOuterClass(reference.context.getClassEntry(), classEntry)) {
callerClasses.add(reference.context.getClassEntry());
}
}
// do we have an answer yet?
if (callerClasses.isEmpty()) {
if (illegallySetClasses.size() == 1) {
return illegallySetClasses.iterator().next();
} else {
System.out.println(String.format("WARNING: Unable to find outer class for %s. No caller and no illegally set field classes.", classEntry));
}
} else {
if (callerClasses.size() == 1) {
return callerClasses.iterator().next();
} else {
// multiple callers, do the illegally set classes narrow it down?
Set<ClassEntry> intersection = Sets.newHashSet(callerClasses);
intersection.retainAll(illegallySetClasses);
if (intersection.size() == 1) {
return intersection.iterator().next();
} else {
System.out.println(String.format("WARNING: Unable to choose outer class for %s among options: %s", classEntry, callerClasses));
}
}
}
}
return null;
}