Skip to content

Commit

Permalink
Fixed: missing Fernflower in update site;
Browse files Browse the repository at this point in the history
Ignore out outdated decompiler plugins (remains of older ECD versions)
  • Loading branch information
jpstotz committed Mar 18, 2024
1 parent f899e9d commit ba64098
Show file tree
Hide file tree
Showing 33 changed files with 279 additions and 222 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.project
**/bin/
**/target
**/.tycho-consumer-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.benf.cfr.reader.util.output.IllegalIdentifierDump;
import org.benf.cfr.reader.util.output.MethodErrorCollector;
import org.benf.cfr.reader.util.output.StringStreamDumper;
import org.sf.feeling.decompiler.JavaDecompilerConstants;
import org.sf.feeling.decompiler.JavaDecompilerPlugin;
import org.sf.feeling.decompiler.cfr.CfrDecompilerPlugin;
import org.sf.feeling.decompiler.editor.BaseDecompiler;
Expand Down Expand Up @@ -140,7 +141,7 @@ public void decompileFromArchive(String archivePath, String packege, String clas
StopWatch stopWatch = new StopWatch();
stopWatch.start();
String tempDir = JavaDecompilerPlugin.getDefault().getPreferenceStore()
.getString(JavaDecompilerPlugin.TEMP_DIR);
.getString(JavaDecompilerConstants.TEMP_DIR);
File workingDir = new File(tempDir + "/ecd_cfr_" + System.currentTimeMillis()); //$NON-NLS-1$
try {
workingDir.mkdirs();
Expand Down Expand Up @@ -194,7 +195,8 @@ public boolean supportLevel(int level) {

@Override
public boolean supportDebugLevel(int level) {
return false; // CFR is not usable when debugging?
return false; // CFR does not seem to have an option to create code that matche sthe original
// line numbers
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.jetbrains.java.decompiler.main.decompiler.PrintStreamLogger;
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.sf.feeling.decompiler.JavaDecompilerConstants;
import org.sf.feeling.decompiler.JavaDecompilerPlugin;
import org.sf.feeling.decompiler.editor.BaseDecompiler;
import org.sf.feeling.decompiler.editor.IDecompiler;
Expand Down Expand Up @@ -158,7 +159,7 @@ public void decompileFromArchive(String archivePath, String packege, String clas
StopWatch stopWatch = new StopWatch();
stopWatch.start();
File workingDir = new File(
JavaDecompilerPlugin.getDefault().getPreferenceStore().getString(JavaDecompilerPlugin.TEMP_DIR) + "/" //$NON-NLS-1$
JavaDecompilerPlugin.getDefault().getPreferenceStore().getString(JavaDecompilerConstants.TEMP_DIR) + "/" //$NON-NLS-1$
+ System.currentTimeMillis());

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.jd.core.v1.ClassFileToJavaSourceDecompiler;
import org.sf.feeling.decompiler.JavaDecompilerConstants;
import org.sf.feeling.decompiler.JavaDecompilerPlugin;
import org.sf.feeling.decompiler.editor.BaseDecompilerSourceMapper;
import org.sf.feeling.decompiler.jd.decompiler.JDCorePrinter;
Expand Down Expand Up @@ -73,12 +74,12 @@ public char[] findSource(String javaSourcePath) {
}
} else {
JavaDecompilerPlugin.getDefault().getLog()
.log(new Status(Status.ERROR, JavaDecompilerPlugin.PLUGIN_ID, 0,
.log(new Status(Status.ERROR, JavaDecompilerConstants.PLUGIN_ID, 0,
"Unable to decompile: " + decompilePath + " is not a valid file.", null));
}
} catch (Exception e) {
JavaDecompilerPlugin.getDefault().getLog()
.log(new Status(Status.ERROR, JavaDecompilerPlugin.PLUGIN_ID, 0, e.getMessage(), e));
.log(new Status(Status.ERROR, JavaDecompilerConstants.PLUGIN_ID, 0, e.getMessage(), e));
}
}

Expand All @@ -96,10 +97,10 @@ public String decompile(String basePath, String classPath) throws Exception {
// Load preferences
IPreferenceStore store = JavaDecompilerPlugin.getDefault().getPreferenceStore();

boolean realignmentLineNumber = store.getBoolean(JavaDecompilerPlugin.ALIGN);
boolean realignmentLineNumber = store.getBoolean(JavaDecompilerConstants.ALIGN);
boolean unicodeEscape = false; // currently unused :
// store.getBoolean(JavaDecompilerPlugin.PREF_ESCAPE_UNICODE_CHARACTERS);
boolean showLineNumbers = store.getBoolean(JavaDecompilerPlugin.PREF_DISPLAY_LINE_NUMBERS);
boolean showLineNumbers = store.getBoolean(JavaDecompilerConstants.PREF_DISPLAY_LINE_NUMBERS);
// boolean showMetadata =
// store.getBoolean(JavaDecompilerPlugin.PREF_DISPLAY_METADATA);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.regex.Pattern;

import org.apache.commons.lang3.time.StopWatch;
import org.sf.feeling.decompiler.JavaDecompilerConstants;
import org.sf.feeling.decompiler.JavaDecompilerPlugin;
import org.sf.feeling.decompiler.editor.BaseDecompiler;
import org.sf.feeling.decompiler.editor.IDecompiler;
Expand Down Expand Up @@ -169,7 +170,7 @@ public void decompileFromArchive(String archivePath, String packege, String clas
StopWatch stopWatch = new StopWatch();
stopWatch.start();
File workingDir = new File(
JavaDecompilerPlugin.getDefault().getPreferenceStore().getString(JavaDecompilerPlugin.TEMP_DIR) + "/" //$NON-NLS-1$
JavaDecompilerPlugin.getDefault().getPreferenceStore().getString(JavaDecompilerConstants.TEMP_DIR) + "/" //$NON-NLS-1$
+ System.currentTimeMillis());

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.jetbrains.java.decompiler.main.decompiler.PrintStreamLogger;
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.sf.feeling.decompiler.JavaDecompilerConstants;
import org.sf.feeling.decompiler.JavaDecompilerPlugin;
import org.sf.feeling.decompiler.editor.BaseDecompiler;
import org.sf.feeling.decompiler.editor.IDecompiler;
Expand Down Expand Up @@ -157,7 +158,7 @@ public boolean accept(File dir, String name) {
public void decompileFromArchive(String archivePath, String packege, String className) {
start = System.currentTimeMillis();
File workingDir = new File(
JavaDecompilerPlugin.getDefault().getPreferenceStore().getString(JavaDecompilerPlugin.TEMP_DIR) + "/" //$NON-NLS-1$
JavaDecompilerPlugin.getDefault().getPreferenceStore().getString(JavaDecompilerConstants.TEMP_DIR) + "/" //$NON-NLS-1$
+ System.currentTimeMillis());

try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.sf.feeling.decompiler;

public class JavaDecompilerConstants {

public static final String EDITOR_ID = "org.sf.feeling.decompiler.ClassFileEditor"; //$NON-NLS-1$
public static final String PLUGIN_ID = "org.sf.feeling.decompiler"; //$NON-NLS-1$
public static final String TEMP_DIR = "org.sf.feeling.decompiler.tempd"; //$NON-NLS-1$

public static final String REUSE_BUFFER = "org.sf.feeling.decompiler.reusebuff"; //$NON-NLS-1$
public static final String IGNORE_EXISTING = "org.sf.feeling.decompiler.alwaysuse"; //$NON-NLS-1$
public static final String USE_ECLIPSE_FORMATTER = "org.sf.feeling.decompiler.use_eclipse_formatter"; //$NON-NLS-1$
public static final String USE_ECLIPSE_SORTER = "org.sf.feeling.decompiler.use_eclipse_sorter"; //$NON-NLS-1$
public static final String DECOMPILER_TYPE = "org.sf.feeling.decompiler.type"; //$NON-NLS-1$
public static final String PREF_DISPLAY_LINE_NUMBERS = "jd.ide.eclipse.prefs.DisplayLineNumbers"; //$NON-NLS-1$
public static final String PREF_DISPLAY_METADATA = "jd.ide.eclipse.prefs.DisplayMetadata"; //$NON-NLS-1$
public static final String ALIGN = "jd.ide.eclipse.prefs.RealignLineNumbers"; //$NON-NLS-1$
public static final String DEFAULT_EDITOR = "org.sf.feeling.decompiler.default_editor"; //$NON-NLS-1$ ;
public static final String EXPORT_ENCODING = "org.sf.feeling.decompiler.export.encoding"; //$NON-NLS-1$ ;
@Deprecated
public static final String ATTACH_SOURCE = "org.sf.feeling.decompiler.attach_source"; //$NON-NLS-1$ ;
public static final String bytecodeMnemonicPreferencesPrefix = "BYTECODEMNEMONIC_"; //$NON-NLS-1$
public static final String BYTECODE_MNEMONIC = bytecodeMnemonicPreferencesPrefix + "bytecodeMnemonic"; //$NON-NLS-1$
public static final String BYTECODE_MNEMONIC_BOLD = bytecodeMnemonicPreferencesPrefix + "bytecodeMnemonic_bold"; //$NON-NLS-1$
public static final String BYTECODE_MNEMONIC_ITALIC = bytecodeMnemonicPreferencesPrefix + "bytecodeMnemonic_italic"; //$NON-NLS-1$
public static final String BYTECODE_MNEMONIC_STRIKETHROUGH = bytecodeMnemonicPreferencesPrefix
+ "bytecodeMnemonic_strikethrough"; //$NON-NLS-1$
public static final String BYTECODE_MNEMONIC_UNDERLINE = bytecodeMnemonicPreferencesPrefix
+ "bytecodeMnemonic_underline"; //$NON-NLS-1$
public static final String classFileAttributePreferencesPrefix = "CLASS_FILE_ATTR_"; //$NON-NLS-1$
public static final String CLASS_FILE_ATTR_SHOW_CONSTANT_POOL = classFileAttributePreferencesPrefix
+ "show_constantPool"; //$NON-NLS-1$
public static final String CLASS_FILE_ATTR_SHOW_LINE_NUMBER_TABLE = classFileAttributePreferencesPrefix
+ "show_lineNumberTable"; //$NON-NLS-1$
public static final String CLASS_FILE_ATTR_SHOW_VARIABLE_TABLE = classFileAttributePreferencesPrefix
+ "show_localVariableTable"; //$NON-NLS-1$
public static final String CLASS_FILE_ATTR_SHOW_EXCEPTION_TABLE = classFileAttributePreferencesPrefix
+ "show_exceptionTable"; //$NON-NLS-1$
public static final String CLASS_FILE_ATTR_SHOW_MAXS = classFileAttributePreferencesPrefix + "show_maxs"; //$NON-NLS-1$
public static final String CLASS_FILE_ATTR_RENDER_TRYCATCH_BLOCKS = classFileAttributePreferencesPrefix
+ "render_tryCatchBlocks"; //$NON-NLS-1$
public static final String CLASS_FILE_ATTR_SHOW_SOURCE_LINE_NUMBERS = classFileAttributePreferencesPrefix
+ "render_sourceLineNumbers"; //$NON-NLS-1$
public static final String BRANCH_TARGET_ADDRESS_RENDERING = "BRANCH_TARGET_ADDRESS_RENDERING"; //$NON-NLS-1$
public static final String BRANCH_TARGET_ADDRESS_ABSOLUTE = BRANCH_TARGET_ADDRESS_RENDERING + "_ABSOLUTE"; //$NON-NLS-1$
public static final String BRANCH_TARGET_ADDRESS_RELATIVE = BRANCH_TARGET_ADDRESS_RENDERING + "_RELATIVE"; //$NON-NLS-1$
public static final int SOURCE_MODE = 0;
public static final int BYTE_CODE_MODE = 1;
public static final int DISASSEMBLER_MODE = 2;

}
Loading

0 comments on commit ba64098

Please sign in to comment.