当前位置: 首页>>代码示例>>Java>>正文


Java ClassEntry类代码示例

本文整理汇总了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();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:19,代码来源:Deobfuscator.java

示例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);
		}
	}
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:22,代码来源:Deobfuscator.java

示例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);
		}
	}
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:24,代码来源:MatchesReader.java

示例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());
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:23,代码来源:MappingsConverter.java

示例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);
	}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:22,代码来源:ClassMatchingGui.java

示例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();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:19,代码来源:Deobfuscator.java

示例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);
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:17,代码来源:SourceIndexBehaviorVisitor.java

示例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);
	}
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:21,代码来源:MethodImplementationsTreeNode.java

示例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();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:27,代码来源:CodeReader.java

示例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();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:20,代码来源:TranslationIndex.java

示例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();
		}
	});
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:22,代码来源:MemberMatchingGui.java

示例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);
		}
	}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:23,代码来源:CodeReader.java

示例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());
	}
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:21,代码来源:Deobfuscator.java

示例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;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:21,代码来源:JarIndex.java

示例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();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:26,代码来源:Gui.java


注:本文中的cuchaz.enigma.mapping.ClassEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。