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


Java MethodMapping类代码示例

本文整理汇总了Java中cuchaz.enigma.mapping.MethodMapping的典型用法代码示例。如果您正苦于以下问题:Java MethodMapping类的具体用法?Java MethodMapping怎么用?Java MethodMapping使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MethodMapping类属于cuchaz.enigma.mapping包,在下文中一共展示了MethodMapping类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkMethod

import cuchaz.enigma.mapping.MethodMapping; //导入依赖的package包/类
public void checkMethod(ClassEntry classEntry, MethodMapping methodMapping) {
	
	// TEMP: disable the expensive check for now, maybe we can optimize it later, or just use it for debugging
	if (true) return;
	
	BehaviorEntry obfBehaviorEntry = EntryFactory.getObfBehaviorEntry(classEntry, methodMapping);
	if (!(obfBehaviorEntry instanceof MethodEntry)) {
		// only methods have related implementations
		return;
	}
	MethodEntry obfMethodEntry = (MethodEntry)obfBehaviorEntry;
	String deobfName = methodMapping.getDeobfName();
	m_deobfNamesByObfMethod.put(obfMethodEntry, deobfName);
	
	// have we seen this method's group before?
	Set<MethodEntry> group = m_groupsByObfMethod.get(obfMethodEntry);
	if (group == null) {
		
		// no, compute the group and save the name
		group = m_jarIndex.getRelatedMethodImplementations(obfMethodEntry);
		m_deobfNamesByGroup.put(group, deobfName);
		
		assert(group.contains(obfMethodEntry));
		for (MethodEntry relatedMethodEntry : group) {
			m_groupsByObfMethod.put(relatedMethodEntry, group);
		}
	}
	
	// check the name
	if (!sameName(m_deobfNamesByGroup.get(group), deobfName)) {
		m_inconsistentGroups.add(group);
	}
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:34,代码来源:RelatedMethodChecker.java

示例2: checkMethod

import cuchaz.enigma.mapping.MethodMapping; //导入依赖的package包/类
public void checkMethod(ClassEntry classEntry, MethodMapping methodMapping)
{
	
	// TEMP: disable the expensive check for now, maybe we can optimize it
	// later, or just use it for debugging
	if("".isEmpty())
		return;
	
	BehaviorEntry obfBehaviorEntry =
		EntryFactory.getObfBehaviorEntry(classEntry, methodMapping);
	if(!(obfBehaviorEntry instanceof MethodEntry))
		// only methods have related implementations
		return;
	MethodEntry obfMethodEntry = (MethodEntry)obfBehaviorEntry;
	String deobfName = methodMapping.getDeobfName();
	m_deobfNamesByObfMethod.put(obfMethodEntry, deobfName);
	
	// have we seen this method's group before?
	Set<MethodEntry> group = m_groupsByObfMethod.get(obfMethodEntry);
	if(group == null)
	{
		
		// no, compute the group and save the name
		group = m_jarIndex.getRelatedMethodImplementations(obfMethodEntry);
		m_deobfNamesByGroup.put(group, deobfName);
		
		assert group.contains(obfMethodEntry);
		for(MethodEntry relatedMethodEntry : group)
			m_groupsByObfMethod.put(relatedMethodEntry, group);
	}
	
	// check the name
	if(!sameName(m_deobfNamesByGroup.get(group), deobfName))
		m_inconsistentGroups.add(group);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:36,代码来源:RelatedMethodChecker.java

示例3: migrateClassMapping

import cuchaz.enigma.mapping.MethodMapping; //导入依赖的package包/类
private static ClassMapping migrateClassMapping(ClassEntry newObfClass, ClassMapping oldClassMapping, final ClassMatches matches, boolean useSimpleName) {
	
	ClassNameReplacer replacer = new ClassNameReplacer() {
		@Override
		public String replace(String className) {
			ClassEntry newClassEntry = matches.getUniqueMatches().get(new ClassEntry(className));
			if (newClassEntry != null) {
				return newClassEntry.getName();
			}
			return null;
		}
	};
	
	ClassMapping newClassMapping;
	String deobfName = oldClassMapping.getDeobfName();
	if (deobfName != null) {
		if (useSimpleName) {
			deobfName = new ClassEntry(deobfName).getSimpleName();
		}
		newClassMapping = new ClassMapping(newObfClass.getName(), deobfName);
	} else {
		newClassMapping = new ClassMapping(newObfClass.getName());
	}
	
	// migrate fields
	for (FieldMapping oldFieldMapping : oldClassMapping.fields()) {
		if (canMigrate(oldFieldMapping.getObfType(), matches)) {
			newClassMapping.addFieldMapping(new FieldMapping(oldFieldMapping, replacer));
		} else {
			System.out.println(String.format("Can't map field, dropping: %s.%s %s",
				oldClassMapping.getDeobfName(),
				oldFieldMapping.getDeobfName(),
				oldFieldMapping.getObfType()
			));
		}
	}
	
	// migrate methods
	for (MethodMapping oldMethodMapping : oldClassMapping.methods()) {
		if (canMigrate(oldMethodMapping.getObfSignature(), matches)) {
			newClassMapping.addMethodMapping(new MethodMapping(oldMethodMapping, replacer));
		} else {
			System.out.println(String.format("Can't map method, dropping: %s.%s %s",
				oldClassMapping.getDeobfName(),
				oldMethodMapping.getDeobfName(),
				oldMethodMapping.getObfSignature()
			));
		}
	}
	
	return newClassMapping;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:53,代码来源:MappingsConverter.java


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