本文整理匯總了Java中com.strobel.decompiler.languages.java.ast.AstBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java AstBuilder類的具體用法?Java AstBuilder怎麽用?Java AstBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AstBuilder類屬於com.strobel.decompiler.languages.java.ast包,在下文中一共展示了AstBuilder類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSourceTree
import com.strobel.decompiler.languages.java.ast.AstBuilder; //導入依賴的package包/類
public CompilationUnit getSourceTree(String className) {
// we don't know if this class name is obfuscated or deobfuscated
// we need to tell the decompiler the deobfuscated name so it doesn't get freaked out
// the decompiler only sees classes after deobfuscation, so we need to load it by the deobfuscated name if there is one
// first, assume class name is deobf
String deobfClassName = className;
// if it wasn't actually deobf, then we can find a mapping for it and get the deobf name
ClassMapping classMapping = m_mappings.getClassByObf(className);
if (classMapping != null && classMapping.getDeobfName() != null) {
deobfClassName = classMapping.getDeobfName();
}
// set the type loader
TranslatingTypeLoader loader = new TranslatingTypeLoader(
m_jar,
m_jarIndex,
getTranslator(TranslationDirection.Obfuscating),
getTranslator(TranslationDirection.Deobfuscating)
);
m_settings.setTypeLoader(loader);
// see if procyon can find the type
TypeReference type = new MetadataSystem(loader).lookupType(deobfClassName);
if (type == null) {
throw new Error(String.format("Unable to find type: %s (deobf: %s)\nTried class names: %s",
className, deobfClassName, loader.getClassNamesToTry(deobfClassName)
));
}
TypeDefinition resolvedType = type.resolve();
// decompile it!
DecompilerContext context = new DecompilerContext();
context.setCurrentType(resolvedType);
context.setSettings(m_settings);
AstBuilder builder = new AstBuilder(context);
builder.addType(resolvedType);
builder.runTransformations(null);
return builder.getCompilationUnit();
}
示例2: getSourceTree
import com.strobel.decompiler.languages.java.ast.AstBuilder; //導入依賴的package包/類
public CompilationUnit getSourceTree(String className) {
// we don't know if this class name is obfuscated or deobfuscated
// we need to tell the decompiler the deobfuscated name so it doesn't get freaked out
// the decompiler only sees classes after deobfuscation, so we need to load it by the deobfuscated name if there is one
// first, assume class name is deobf
String deobfClassName = className;
// if it wasn't actually deobf, then we can find a mapping for it and get the deobf name
ClassMapping classMapping = this.mappings.getClassByObf(className);
if (classMapping != null && classMapping.getDeobfName() != null) {
deobfClassName = classMapping.getDeobfName();
}
// set the type loader
TranslatingTypeLoader loader = new TranslatingTypeLoader(
this.jar,
this.jarIndex,
getTranslator(TranslationDirection.Obfuscating),
getTranslator(TranslationDirection.Deobfuscating)
);
this.settings.setTypeLoader(loader);
// see if procyon can find the type
TypeReference type = new MetadataSystem(loader).lookupType(deobfClassName);
if (type == null) {
throw new Error(String.format("Unable to find type: %s (deobf: %s)\nTried class names: %s",
className, deobfClassName, loader.getClassNamesToTry(deobfClassName)
));
}
TypeDefinition resolvedType = type.resolve();
// decompile it!
DecompilerContext context = new DecompilerContext();
context.setCurrentType(resolvedType);
context.setSettings(this.settings);
AstBuilder builder = new AstBuilder(context);
builder.addType(resolvedType);
builder.runTransformations(null);
return builder.getCompilationUnit();
}
示例3: getSourceTree
import com.strobel.decompiler.languages.java.ast.AstBuilder; //導入依賴的package包/類
public CompilationUnit getSourceTree(String className)
{
// we don't know if this class name is obfuscated or deobfuscated
// we need to tell the decompiler the deobfuscated name so it doesn't
// get freaked out
// the decompiler only sees classes after deobfuscation, so we need to
// load it by the deobfuscated name if there is one
// first, assume class name is deobf
String deobfClassName = className;
// if it wasn't actually deobf, then we can find a mapping for it and
// get the deobf name
ClassMapping classMapping = m_mappings.getClassByObf(className);
if(classMapping != null && classMapping.getDeobfName() != null)
deobfClassName = classMapping.getDeobfName();
// set the type loader
TranslatingTypeLoader loader =
new TranslatingTypeLoader(m_jar, m_jarIndex,
getTranslator(TranslationDirection.Obfuscating),
getTranslator(TranslationDirection.Deobfuscating));
m_settings.setTypeLoader(loader);
// see if procyon can find the type
TypeReference type =
new MetadataSystem(loader).lookupType(deobfClassName);
if(type == null)
throw new Error(String.format(
"Unable to find type: %s (deobf: %s)\nTried class names: %s",
className, deobfClassName,
loader.getClassNamesToTry(deobfClassName)));
TypeDefinition resolvedType = type.resolve();
// decompile it!
DecompilerContext context = new DecompilerContext();
context.setCurrentType(resolvedType);
context.setSettings(m_settings);
AstBuilder builder = new AstBuilder(context);
builder.addType(resolvedType);
builder.runTransformations(null);
return builder.getCompilationUnit();
}