當前位置: 首頁>>代碼示例>>Java>>正文


Java FieldEntry類代碼示例

本文整理匯總了Java中cuchaz.enigma.mapping.FieldEntry的典型用法代碼示例。如果您正苦於以下問題:Java FieldEntry類的具體用法?Java FieldEntry怎麽用?Java FieldEntry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FieldEntry類屬於cuchaz.enigma.mapping包,在下文中一共展示了FieldEntry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readEntry

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的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

示例2: translate

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的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

示例3: visitMemberReferenceExpression

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的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

示例4: hasDeobfuscatedName

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的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

示例5: rename

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的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

示例6: removeMapping

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的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

示例7: markAsDeobfuscated

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
public void markAsDeobfuscated(Entry obfEntry) {
	if (obfEntry instanceof ClassEntry) {
		m_renamer.markClassAsDeobfuscated((ClassEntry)obfEntry);
	} else if (obfEntry instanceof FieldEntry) {
		m_renamer.markFieldAsDeobfuscated((FieldEntry)obfEntry);
	} else if (obfEntry instanceof MethodEntry) {
		m_renamer.markMethodTreeAsDeobfuscated((MethodEntry)obfEntry);
	} else if (obfEntry instanceof ConstructorEntry) {
		throw new IllegalArgumentException("Cannot rename constructors");
	} else if (obfEntry instanceof ArgumentEntry) {
		m_renamer.markArgumentAsDeobfuscated((ArgumentEntry)obfEntry);
	} else {
		throw new Error("Unknown entry type: " + obfEntry);
	}
	
	// clear caches
	m_translatorCache.clear();
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:19,代碼來源:Deobfuscator.java

示例8: showReference

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的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

示例9: computeFieldMatches

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
private static void computeFieldMatches(File memberMatchesFile, JarFile destJar, File destMappingsFile, File classMatchesFile)
throws IOException, MappingParseException {
	
	System.out.println("Reading class matches...");
	ClassMatches classMatches = MatchesReader.readClasses(classMatchesFile);
	System.out.println("Reading mappings...");
	Mappings destMappings = new MappingsReader().read(new FileReader(destMappingsFile));
	System.out.println("Indexing dest jar...");
	Deobfuscator destDeobfuscator = new Deobfuscator(destJar);
	
	System.out.println("Writing matches...");
	
	// get the matched and unmatched mappings
	MemberMatches<FieldEntry> fieldMatches = MappingsConverter.computeMemberMatches(
		destDeobfuscator,
		destMappings,
		classMatches,
		MappingsConverter.getFieldDoer()
	);
	
	MatchesWriter.writeMembers(fieldMatches, memberMatchesFile);
	System.out.println("Wrote:\n\t" + memberMatchesFile.getAbsolutePath());
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:24,代碼來源:ConvertMain.java

示例10: editFieldMatches

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
private static void editFieldMatches(JarFile sourceJar, JarFile destJar, File destMappingsFile, Mappings sourceMappings, File classMatchesFile, final File fieldMatchesFile)
throws IOException, MappingParseException {
	
	System.out.println("Reading matches...");
	ClassMatches classMatches = MatchesReader.readClasses(classMatchesFile);
	MemberMatches<FieldEntry> fieldMatches = MatchesReader.readMembers(fieldMatchesFile);
	
	// prep deobfuscators
	Deobfuscators deobfuscators = new Deobfuscators(sourceJar, destJar);
	deobfuscators.source.setMappings(sourceMappings);
	Mappings destMappings = new MappingsReader().read(new FileReader(destMappingsFile));
	MappingsChecker checker = new MappingsChecker(deobfuscators.dest.getJarIndex());
	checker.dropBrokenMappings(destMappings);
	deobfuscators.dest.setMappings(destMappings);
	
	new MemberMatchingGui<FieldEntry>(classMatches, fieldMatches, deobfuscators.source, deobfuscators.dest).setSaveListener(new MemberMatchingGui.SaveListener<FieldEntry>() {
		@Override
		public void save(MemberMatches<FieldEntry> matches) {
			try {
				MatchesWriter.writeMembers(matches, fieldMatchesFile);
			} catch (IOException ex) {
				throw new Error(ex);
			}
		}
	});
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:27,代碼來源:ConvertMain.java

示例11: convertMappings

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
@SuppressWarnings("unused")
private static void convertMappings(File outMappingsFile, JarFile sourceJar, JarFile destJar, Mappings mappings, File classMatchesFile, File fieldMatchesFile)
throws IOException {
	
	System.out.println("Reading matches...");
	ClassMatches classMatches = MatchesReader.readClasses(classMatchesFile);
	MemberMatches<FieldEntry> fieldMatches = MatchesReader.readMembers(fieldMatchesFile);

	Deobfuscators deobfuscators = new Deobfuscators(sourceJar, destJar);
	deobfuscators.source.setMappings(mappings);
	
	// apply matches
	Mappings newMappings = MappingsConverter.newMappings(classMatches, mappings, deobfuscators.source, deobfuscators.dest);
	MappingsConverter.applyMemberMatches(newMappings, classMatches, fieldMatches, MappingsConverter.getFieldDoer());
	
	// write out the converted mappings
	try (FileWriter out = new FileWriter(outMappingsFile)) {
		new MappingsWriter().write(out, newMappings);
	}
	System.out.println("Wrote converted mappings to:\n\t" + outMappingsFile.getAbsolutePath());
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:22,代碼來源:ConvertMain.java

示例12: fieldReferences

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
@Test
@SuppressWarnings("unchecked")
public void fieldReferences() {
	Collection<EntryReference<FieldEntry,BehaviorEntry>> references;
	
	// name
	references = m_index.getFieldReferences(m_nameField);
	assertThat(references, containsInAnyOrder(
		newFieldReferenceByConstructor(m_nameField, m_baseClass.getName(), "(Ljava/lang/String;)V"),
		newFieldReferenceByMethod(m_nameField, m_baseClass.getName(), "a", "()Ljava/lang/String;")
	));
	
	// numThings
	references = m_index.getFieldReferences(m_numThingsField);
	assertThat(references, containsInAnyOrder(
		newFieldReferenceByConstructor(m_numThingsField, m_subClassB.getName(), "()V"),
		newFieldReferenceByMethod(m_numThingsField, m_subClassB.getName(), "b", "()V")
	));
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:20,代碼來源:TestJarIndexInheritanceTree.java

示例13: read

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void read(InputStream in) throws IOException
{
	try
	{
		ObjectInputStream oin =
			new ObjectInputStream(new GZIPInputStream(in));
		m_superclasses = (HashMap<ClassEntry, ClassEntry>)oin.readObject();
		m_fieldEntries =
			(HashMultimap<ClassEntry, FieldEntry>)oin.readObject();
		m_behaviorEntries =
			(HashMultimap<ClassEntry, BehaviorEntry>)oin.readObject();
	}catch(ClassNotFoundException ex)
	{
		throw new Error(ex);
	}
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-Enigma,代碼行數:18,代碼來源:TranslationIndex.java

示例14: fieldReferences

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
@Test
@SuppressWarnings("unchecked")
public void fieldReferences()
{
	Collection<EntryReference<FieldEntry, BehaviorEntry>> references;
	
	// name
	references = m_index.getFieldReferences(m_nameField);
	assertThat(
		references,
		containsInAnyOrder(
			newFieldReferenceByConstructor(m_nameField,
				m_baseClass.getName(), "(Ljava/lang/String;)V"),
			newFieldReferenceByMethod(m_nameField, m_baseClass.getName(),
				"a", "()Ljava/lang/String;")));
	
	// numThings
	references = m_index.getFieldReferences(m_numThingsField);
	assertThat(
		references,
		containsInAnyOrder(
			newFieldReferenceByConstructor(m_numThingsField,
				m_subClassB.getName(), "()V"),
			newFieldReferenceByMethod(m_numThingsField,
				m_subClassB.getName(), "b", "()V")));
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-Enigma,代碼行數:27,代碼來源:TestJarIndexInheritanceTree.java

示例15: makeMatch

import cuchaz.enigma.mapping.FieldEntry; //導入依賴的package包/類
public void makeMatch(FieldEntry sourceField, FieldEntry destField) {
	boolean wasRemoved = m_unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField);
	assert (wasRemoved);
	wasRemoved = m_unmatchedDestFields.remove(destField.getClassEntry(), destField);
	assert (wasRemoved);
	addMatch(sourceField, destField);
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:8,代碼來源:FieldMatches.java


注:本文中的cuchaz.enigma.mapping.FieldEntry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。