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


Java ClassEntry.isInnerClass方法代码示例

本文整理汇总了Java中cuchaz.enigma.mapping.ClassEntry.isInnerClass方法的典型用法代码示例。如果您正苦于以下问题:Java ClassEntry.isInnerClass方法的具体用法?Java ClassEntry.isInnerClass怎么用?Java ClassEntry.isInnerClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cuchaz.enigma.mapping.ClassEntry的用法示例。


在下文中一共展示了ClassEntry.isInnerClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
		}
	}
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:21,代码来源:Deobfuscator.java

示例2: getClassNamesToTry

import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
public List<String> getClassNamesToTry(ClassEntry obfClassEntry) {
	List<String> classNamesToTry = Lists.newArrayList();
	classNamesToTry.add(obfClassEntry.getName());
	if (obfClassEntry.getPackageName().equals(Constants.NonePackage)) {
		// taking off the none package, if any
		classNamesToTry.add(obfClassEntry.getSimpleName());
	}
	if (obfClassEntry.isInnerClass()){
		String innerMostClassName = obfClassEntry.getInnermostClassName();
		while (obfClassEntry.isInnerClass()){
			// try just the inner class name
			classNamesToTry.add(obfClassEntry.getOutermostClassInnerName());
			obfClassEntry = obfClassEntry.getOutermostInnerClassEntry();
		}
		classNamesToTry.add(innerMostClassName);
	}

	return classNamesToTry;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:20,代码来源:TranslatingTypeLoader.java

示例3: getNamableName

import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
public String getNamableName() {
	if (getNameableEntry() instanceof ClassEntry) {
		ClassEntry classEntry = (ClassEntry)getNameableEntry();
		if (classEntry.isInnerClass()) {
			// make sure we only rename the inner class name
			return classEntry.getInnermostClassName();
		}
	}
	
	return getNameableEntry().getName();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:12,代码来源:EntryReference.java

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

示例5: loadType

import cuchaz.enigma.mapping.ClassEntry; //导入方法依赖的package包/类
private byte[] loadType(String className) {
		
		// NOTE: don't know if class name is obf or deobf
		ClassEntry classEntry = new ClassEntry(className);
		ClassEntry obfClassEntry = m_obfuscatingTranslator.translateEntry(classEntry);
		
		// is this an inner class referenced directly? (ie trying to load b instead of a$b)
		if (!obfClassEntry.isInnerClass()) {
			List<ClassEntry> classChain = m_jarIndex.getObfClassChain(obfClassEntry);
			if (classChain.size() > 1) {
				System.err.println(String.format("WARNING: no class %s after inner class reconstruction. Try %s",
					className, obfClassEntry.buildClassEntry(classChain)
				));
//				return null;
			}
		}
		
		// is this a class we should even know about?
		if (!m_jarIndex.containsObfClass(obfClassEntry)) {
			return null;
		}
		
		// DEBUG
		//System.out.println(String.format("Looking for %s (obf: %s)", classEntry.getName(), obfClassEntry.getName()));

		// find the class in the jar
		String classInJarName = findClassInJar(obfClassEntry);
		if (classInJarName == null) {
			// couldn't find it
			return null;
		}
		
		try {
			// read the class file into a buffer
			ByteArrayOutputStream data = new ByteArrayOutputStream();
			byte[] buf = new byte[1024 * 1024]; // 1 KiB
			InputStream in = m_jar.getInputStream(m_jar.getJarEntry(classInJarName + ".class"));
			while (true) {
				int bytesRead = in.read(buf);
				if (bytesRead <= 0) {
					break;
				}
				data.write(buf, 0, bytesRead);
			}
			data.close();
			in.close();
			buf = data.toByteArray();
			
			// load the javassist handle to the raw class
			ClassPool classPool = new ClassPool();
			String classInJarJavaName = Descriptor.toJavaName(classInJarName);
			classPool.insertClassPath(new ByteArrayClassPath(classInJarJavaName, buf));
			CtClass c = classPool.get(classInJarJavaName);
			
			c = transformClass(c);
			
			// sanity checking
			assertClassName(c, classEntry);
			
			// DEBUG
			//Util.writeClass( c );
			
			// we have a transformed class!
			return c.toBytecode();
		} catch (IOException | NotFoundException | CannotCompileException ex) {
			throw new Error(ex);
		}
	}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:69,代码来源:TranslatingTypeLoader.java


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