Java Code Examples for com.strobel.decompiler.DecompilerSettings#setExcludeNestedTypes()
The following examples show how to use
com.strobel.decompiler.DecompilerSettings#setExcludeNestedTypes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcyonDecompiler.java From java-disassembler with GNU General Public License v3.0 | 6 votes |
public DecompilerSettings getDecompilerSettings() { DecompilerSettings procyonSettings = new DecompilerSettings(); procyonSettings.setFlattenSwitchBlocks(settings.getEntry("fsb").getBool()); procyonSettings.setForceExplicitImports(!settings.getEntry("ci").getBool()); procyonSettings.setForceExplicitTypeArguments(settings.getEntry("ei").getBool()); procyonSettings.setRetainRedundantCasts(settings.getEntry("ec").getBool()); procyonSettings.setShowSyntheticMembers(settings.getEntry("ss").getBool()); procyonSettings.setExcludeNestedTypes(settings.getEntry("ent").getBool()); // procyonSettings.setOutputDirectory(options.getOutputDirectory()); procyonSettings.setIncludeLineNumbersInBytecode(settings.getEntry("dl").getBool()); procyonSettings.setRetainPointlessSwitches(settings.getEntry("ps").getBool()); procyonSettings.setUnicodeOutputEnabled(settings.getEntry("unicode").getBool()); procyonSettings.setMergeVariables(settings.getEntry("mv").getBool()); procyonSettings.setShowDebugLineNumbers(settings.getEntry("dl").getBool()); procyonSettings.setSimplifyMemberReferences(settings.getEntry("sm").getBool()); procyonSettings.setDisableForEachTransforms(settings.getEntry("disable-foreach").getBool()); procyonSettings.setTypeLoader(new InputTypeLoader()); // procyonSettings.setLanguage(Languages.bytecode()); // procyonSettings.setLanguage(settings.getEntry("Unoptimized AST").getBool() ? Languages.bytecodeAstUnoptimized() : Languages.bytecodeAst()); return procyonSettings; }
Example 2
Source File: ProcyonDecompiler.java From steady with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public File decompileClassFile(File inputClassFile) { //Default settings for the decompilers final DecompilerSettings settings = new DecompilerSettings(); settings.setShowSyntheticMembers(true); settings.setSimplifyMemberReferences(true); settings.setExcludeNestedTypes(true); String classFilePath = inputClassFile.getPath(); String fileNameWithOutExt = FilenameUtils.removeExtension(inputClassFile.getName()); File outFile = new File(inputClassFile.getParent(), fileNameWithOutExt + ".java"); try { final FileOutputStream stream = new FileOutputStream(outFile.toString()); final OutputStreamWriter writer = new OutputStreamWriter(stream, FileUtil.getCharset()); try { Decompiler.decompile( classFilePath, new PlainTextOutput(writer), settings ); } finally { writer.close(); stream.close(); } } catch (final IOException e) { log.debug(e.getMessage()); } return outFile; }
Example 3
Source File: ProcyonDecompiler.java From Recaf with MIT License | 5 votes |
@Override public String decompile(String name) { ITypeLoader loader = new ComposedTypeLoader(Arrays.asList( new RecafTypeLoader(getController()), new InputTypeLoader() )); Map<String, Boolean> options = getOptions(); DecompilerSettings settings = new DecompilerSettings(); settings.setFlattenSwitchBlocks(options.get("flatten-switch-blocks")); settings.setForceExplicitImports(!options.get("collapse-imports")); settings.setForceExplicitTypeArguments(options.get("force-explicit-type-arguments")); settings.setRetainRedundantCasts(options.get("retain-redundant-casts")); settings.setShowSyntheticMembers(options.get("show-synthetic-members")); settings.setExcludeNestedTypes(options.get("exclude-nested-types")); settings.setRetainPointlessSwitches(options.get("retain-pointless-switches")); settings.setUnicodeOutputEnabled(options.get("unicode-output")); settings.setMergeVariables(options.get("merge-variables")); settings.setShowDebugLineNumbers(options.get("show-debug-line-numbers")); settings.setSimplifyMemberReferences(options.get("simplify-member-references")); settings.setForceFullyQualifiedReferences(options.get("force-fully-qualified-references")); settings.setDisableForEachTransforms(options.get("disable-for-each-transforms")); settings.setTypeLoader(loader); settings.setJavaFormattingOptions(JavaFormattingOptions.createDefault()); MetadataSystem system = new MetadataSystem(loader); system.setEagerMethodLoadingEnabled(options.get("eager-methods-loading")); TypeReference ref = system.lookupType(name); DecompilationOptions decompilationOptions = new DecompilationOptions(); decompilationOptions.setSettings(settings); decompilationOptions.setFullDecompilation(true); StringWriter writer = new StringWriter(); settings.getLanguage().decompileType(ref.resolve(), new PlainTextOutput(writer), decompilationOptions); return writer.toString(); }
Example 4
Source File: ProcyonDecompiler.java From bytecode-viewer with GNU General Public License v3.0 | 5 votes |
public DecompilerSettings getDecompilerSettings() { DecompilerSettings settings = new DecompilerSettings(); settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6 .isSelected()); settings.setExcludeNestedTypes(BytecodeViewer.viewer.chckbxmntmNewCheckItem_11 .isSelected()); settings.setShowDebugLineNumbers(BytecodeViewer.viewer.chckbxmntmShowDebugLine .isSelected()); settings.setIncludeLineNumbersInBytecode(BytecodeViewer.viewer.chckbxmntmNewCheckItem_3 .isSelected()); settings.setIncludeErrorDiagnostics(BytecodeViewer.viewer.chckbxmntmNewCheckItem_4 .isSelected()); settings.setShowSyntheticMembers(BytecodeViewer.viewer.chckbxmntmNewCheckItem_7 .isSelected()); settings.setSimplifyMemberReferences(BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences .isSelected()); settings.setMergeVariables(BytecodeViewer.viewer.mnMergeVariables .isSelected()); settings.setForceExplicitTypeArguments(BytecodeViewer.viewer.chckbxmntmNewCheckItem_8 .isSelected()); settings.setForceExplicitImports(BytecodeViewer.viewer.chckbxmntmNewCheckItem_9 .isSelected()); settings.setFlattenSwitchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_10 .isSelected()); settings.setRetainPointlessSwitches(BytecodeViewer.viewer.chckbxmntmNewCheckItem_2 .isSelected()); settings.setRetainRedundantCasts(BytecodeViewer.viewer.chckbxmntmNewCheckItem_5 .isSelected()); settings.setUnicodeOutputEnabled(BytecodeViewer.viewer.chckbxmntmNewCheckItem_1 .isSelected()); settings.setJavaFormattingOptions(JavaFormattingOptions.createDefault()); return settings; }
Example 5
Source File: ConfigSaver.java From Luyten with Apache License 2.0 | 5 votes |
/** * Do not load, get the loaded instance */ private void loadConfig() { decompilerSettings = new DecompilerSettings(); if (decompilerSettings.getJavaFormattingOptions() == null) { decompilerSettings.setJavaFormattingOptions(JavaFormattingOptions.createDefault()); } luytenPreferences = new LuytenPreferences(); mainWindowPosition = new WindowPosition(); findWindowPosition = new WindowPosition(); try { Preferences prefs = Preferences.userNodeForPackage(ConfigSaver.class); if (!prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName()) .equals(decompilerSettings.getLanguage().getName())) prefs.put(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName()); decompilerSettings.setFlattenSwitchBlocks( prefs.getBoolean(FLATTEN_SWITCH_BLOCKS_ID, decompilerSettings.getFlattenSwitchBlocks())); decompilerSettings.setForceExplicitImports( prefs.getBoolean(FORCE_EXPLICIT_IMPORTS_ID, decompilerSettings.getForceExplicitImports())); decompilerSettings.setShowSyntheticMembers( prefs.getBoolean(SHOW_SYNTHETIC_MEMBERS_ID, decompilerSettings.getShowSyntheticMembers())); decompilerSettings.setExcludeNestedTypes( prefs.getBoolean(EXCLUDE_NESTED_TYPES_ID, decompilerSettings.getExcludeNestedTypes())); decompilerSettings.setForceExplicitTypeArguments(prefs.getBoolean(FORCE_EXPLICIT_TYPE_ARGUMENTS_ID, decompilerSettings.getForceExplicitTypeArguments())); decompilerSettings.setRetainRedundantCasts( prefs.getBoolean(RETAIN_REDUNDANT_CASTS_ID, decompilerSettings.getRetainRedundantCasts())); decompilerSettings.setIncludeErrorDiagnostics( prefs.getBoolean(INCLUDE_ERROR_DIAGNOSTICS_ID, decompilerSettings.getIncludeErrorDiagnostics())); decompilerSettings.setLanguage( findLanguageByName(prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName()))); decompilerSettings.setUnicodeOutputEnabled(prefs.getBoolean(UNICODE_REPLACE_ENABLED_ID, false)); mainWindowPosition = loadWindowPosition(prefs, MAIN_WINDOW_ID_PREFIX); findWindowPosition = loadWindowPosition(prefs, FIND_WINDOW_ID_PREFIX); luytenPreferences = loadLuytenPreferences(prefs); } catch (Exception e) { Luyten.showExceptionDialog("Exception!", e); } }
Example 6
Source File: FileSaver.java From Luyten with Apache License 2.0 | 5 votes |
private DecompilerSettings cloneSettings() { DecompilerSettings settings = ConfigSaver.getLoadedInstance().getDecompilerSettings(); DecompilerSettings newSettings = new DecompilerSettings(); if (newSettings.getJavaFormattingOptions() == null) { newSettings.setJavaFormattingOptions(JavaFormattingOptions.createDefault()); } // synchronized: against main menu changes synchronized (settings) { newSettings.setExcludeNestedTypes(settings.getExcludeNestedTypes()); newSettings.setFlattenSwitchBlocks(settings.getFlattenSwitchBlocks()); newSettings.setForceExplicitImports(settings.getForceExplicitImports()); newSettings.setForceExplicitTypeArguments(settings.getForceExplicitTypeArguments()); newSettings.setOutputFileHeaderText(settings.getOutputFileHeaderText()); newSettings.setLanguage(settings.getLanguage()); newSettings.setShowSyntheticMembers(settings.getShowSyntheticMembers()); newSettings.setAlwaysGenerateExceptionVariableForCatchBlocks( settings.getAlwaysGenerateExceptionVariableForCatchBlocks()); newSettings.setOutputDirectory(settings.getOutputDirectory()); newSettings.setRetainRedundantCasts(settings.getRetainRedundantCasts()); newSettings.setIncludeErrorDiagnostics(settings.getIncludeErrorDiagnostics()); newSettings.setIncludeLineNumbersInBytecode(settings.getIncludeLineNumbersInBytecode()); newSettings.setRetainPointlessSwitches(settings.getRetainPointlessSwitches()); newSettings.setUnicodeOutputEnabled(settings.isUnicodeOutputEnabled()); newSettings.setMergeVariables(settings.getMergeVariables()); newSettings.setShowDebugLineNumbers(settings.getShowDebugLineNumbers()); } return newSettings; }