本文整理汇总了Java中cuchaz.enigma.mapping.ConstructorEntry类的典型用法代码示例。如果您正苦于以下问题:Java ConstructorEntry类的具体用法?Java ConstructorEntry怎么用?Java ConstructorEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConstructorEntry类属于cuchaz.enigma.mapping包,在下文中一共展示了ConstructorEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translate
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的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());
}
示例2: visitMethodDeclaration
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
@Override
public Void visitMethodDeclaration(MethodDeclaration node, SourceIndex index) {
MethodDefinition def = node.getUserData(Keys.METHOD_DEFINITION);
BehaviorEntry behaviorEntry = ProcyonEntryFactory.getBehaviorEntry(def);
AstNode tokenNode = node.getNameToken();
if (behaviorEntry instanceof ConstructorEntry) {
ConstructorEntry constructorEntry = (ConstructorEntry)behaviorEntry;
if (constructorEntry.isStatic()) {
// for static initializers, check elsewhere for the token node
tokenNode = node.getModifiers().firstOrNullObject();
}
}
index.addDeclaration(tokenNode, behaviorEntry);
return node.acceptVisitor(new SourceIndexBehaviorVisitor(behaviorEntry), index);
}
示例3: hasDeobfuscatedName
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的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());
}
}
示例4: rename
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的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();
}
示例5: removeMapping
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的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();
}
示例6: markAsDeobfuscated
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的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();
}
示例7: showReference
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的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();
}
示例8: visitMethodDeclaration
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
@Override
public Void visitMethodDeclaration(MethodDeclaration node, SourceIndex index)
{
MethodDefinition def = node.getUserData(Keys.METHOD_DEFINITION);
BehaviorEntry behaviorEntry = ProcyonEntryFactory.getBehaviorEntry(def);
AstNode tokenNode = node.getNameToken();
if(behaviorEntry instanceof ConstructorEntry)
{
ConstructorEntry constructorEntry = (ConstructorEntry)behaviorEntry;
if(constructorEntry.isStatic())
// for static initializers, check elsewhere for the token node
tokenNode = node.getModifiers().firstOrNullObject();
}
index.addDeclaration(tokenNode, behaviorEntry);
return node.acceptVisitor(
new SourceIndexBehaviorVisitor(behaviorEntry), index);
}
示例9: EntryReference
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
public EntryReference(E entry, String sourceName, C context) {
if (entry == null) {
throw new IllegalArgumentException("Entry cannot be null!");
}
this.entry = entry;
this.context = context;
m_isNamed = sourceName != null && sourceName.length() > 0;
if (entry instanceof ConstructorEntry && ConstructorNonNames.contains(sourceName)) {
m_isNamed = false;
}
}
示例10: getNameableEntry
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
public Entry getNameableEntry() {
if (entry instanceof ConstructorEntry) {
// renaming a constructor really means renaming the class
return entry.getClassEntry();
}
return entry;
}
示例11: visitConstructorDeclaration
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
@Override
public Void visitConstructorDeclaration(ConstructorDeclaration node, SourceIndex index) {
MethodDefinition def = node.getUserData(Keys.METHOD_DEFINITION);
ConstructorEntry constructorEntry = ProcyonEntryFactory.getConstructorEntry(def);
index.addDeclaration(node.getNameToken(), constructorEntry);
return node.acceptVisitor(new SourceIndexBehaviorVisitor(constructorEntry), index);
}
示例12: visitObjectCreationExpression
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
@Override
public Void visitObjectCreationExpression(ObjectCreationExpression node, SourceIndex index) {
MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
if (ref != null) {
ClassEntry classEntry = new ClassEntry(ref.getDeclaringType().getInternalName());
ConstructorEntry constructorEntry = new ConstructorEntry(classEntry, new Signature(ref.getErasedSignature()));
if (node.getType() instanceof SimpleType) {
SimpleType simpleTypeNode = (SimpleType)node.getType();
index.addReference(simpleTypeNode.getIdentifierToken(), constructorEntry, m_behaviorEntry);
}
}
return recurse(node, index);
}
示例13: onCaretMove
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
private void onCaretMove(int pos) {
Token token = m_controller.getToken(pos);
boolean isToken = token != null;
EntryReference<Entry,Entry> mPrevious = m_reference;
m_reference = m_controller.getDeobfReference(token);
boolean isClassEntry = isToken && m_reference.entry instanceof ClassEntry;
boolean isFieldEntry = isToken && m_reference.entry instanceof FieldEntry;
boolean isMethodEntry = isToken && m_reference.entry instanceof MethodEntry;
boolean isConstructorEntry = isToken && m_reference.entry instanceof ConstructorEntry;
boolean isInJar = isToken && m_controller.entryIsInJar(m_reference.entry);
boolean isRenameable = isToken && m_controller.referenceIsRenameable(m_reference);
if (isToken) {
showReference(m_reference);
} else {
clearReference();
}
m_renameMenu.setEnabled(isRenameable && isToken);
m_showInheritanceMenu.setEnabled(isClassEntry || isMethodEntry || isConstructorEntry);
m_showImplementationsMenu.setEnabled(isClassEntry || isMethodEntry);
m_showCallsMenu.setEnabled(isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry);
m_openEntryMenu.setEnabled(isInJar && (isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry));
m_openPreviousMenu.setEnabled(m_controller.hasPreviousLocation());
m_openGoNextMenu.setEnabled(m_controller.hasNextLocation());
m_toggleMappingMenu.setEnabled(isRenameable && isToken);
if (isToken && m_controller.entryHasDeobfuscatedName(m_reference.entry)) {
m_toggleMappingMenu.setText("Reset to obfuscated");
} else {
m_toggleMappingMenu.setText("Mark as deobfuscated");
}
if (m_reference==null){
m_reference = mPrevious;
}
}
示例14: EntryReference
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
public EntryReference(E entry, String sourceName, C context) {
if (entry == null) {
throw new IllegalArgumentException("Entry cannot be null!");
}
this.entry = entry;
this.context = context;
this.sourceName = sourceName != null && sourceName.length() > 0;
if (entry instanceof ConstructorEntry && ConstructorNonNames.contains(sourceName)) {
this.sourceName = false;
}
}
示例15: getNameableEntry
import cuchaz.enigma.mapping.ConstructorEntry; //导入依赖的package包/类
public Entry getNameableEntry() {
if (entry instanceof ConstructorEntry) {
// renaming a constructor really means renaming the class
return entry.getClassEntry();
}
return entry;
}