From d87af7508cfefaef70b61b2af8d0cc72d48b321c Mon Sep 17 00:00:00 2001 From: "Jan S." Date: Sat, 16 Mar 2024 10:51:24 +0100 Subject: [PATCH] unused minimal json library removed --- AUDIT.md | 16 +- README.md | 2 +- org.sf.feeling.decompiler/.classpath | 1 - .../META-INF/MANIFEST.MF | 6 +- .../sf/feeling/decompiler/util/UIUtil.java | 199 ------------------ 5 files changed, 4 insertions(+), 220 deletions(-) diff --git a/AUDIT.md b/AUDIT.md index d3bff47e..3b5ab482 100644 --- a/AUDIT.md +++ b/AUDIT.md @@ -21,17 +21,8 @@ _Primary Source: https://mvnrepository.com/artifact/org.ow2.asm/asm_ * SHA-256: cda4de455fab48ff0bcb7c48b4639447d4de859a7afc30a094a986f0936beba2 * https://repo1.maven.org/maven2/org/ow2/asm/asm/9.1/asm-9.1.jar -### Apache commons - -_Primary Source: https://commons.apache.org/downloads/index.html_ - -* `./org.sf.feeling.decompiler.source.attach/lib/commons-compress.jar` - * Not included in ECD repository, downloaded automatically via Maven - * SHA-256: c267f17160e9ef662b4d78b7f29dca7c82b15c5cff2cb6a9865ef4ab3dd5b787 - * Equal to https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.23.0/commons-compress-1.23.0.jar - ### Fernflower -* `./org.sf.feeling.decompiler/lib/fernflower.jar` +* `./org.sf.feeling.decompiler.fernflower/lib/fernflower.jar` * Not included in ECD repository, downloaded automatically via Maven * SHA-256: 97b3579a221a3edf9651fca278257307441cb6dfdcfe1a1c6579f11002ff5d27 * Version from https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/java/java-decompiler-engine/232.10203.10/java-decompiler-engine-232.10203.10.jar @@ -45,11 +36,6 @@ _Build Source: https://github.com/Vineflower/vineflower_ * version from: https://repo1.maven.org/maven2/org/vineflower/vineflower/1.9.3/vineflower-1.9.3.jar ### Minimal JSON -_Primary Source: https://github.com/ralfstx/minimal-json_ - -* `./org.sf.feeling.decompiler/lib/json.jar` - * SHA-256: e1d280900c78f18ae2e00c14e7410a77ba19cf084154b386532846aa6dc81721 - * Version from http://central.maven.org/maven2/com/eclipsesource/minimal-json/minimal-json/0.9.4/minimal-json-0.9.4.jar ### CFR _Project homepage: https://www.benf.org/other/cfr/_ diff --git a/README.md b/README.md index a16f0711..04cf9e4c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ _If you have currently the "Eclipse" Class Decompiler installed, it is recommend ## How to build from source? - Requiremnent: JDK 11 or newer (make sure `JAVA_HOME` environment variable points to an appropriate JDK) + Requiremnent: JDK 17 (make sure `JAVA_HOME` environment variable points to an JDK 17) If you want to test the latest features of this plugin, you have to build it from source. For this, proceed as following: diff --git a/org.sf.feeling.decompiler/.classpath b/org.sf.feeling.decompiler/.classpath index da10b9ea..4c923924 100644 --- a/org.sf.feeling.decompiler/.classpath +++ b/org.sf.feeling.decompiler/.classpath @@ -7,7 +7,6 @@ - diff --git a/org.sf.feeling.decompiler/META-INF/MANIFEST.MF b/org.sf.feeling.decompiler/META-INF/MANIFEST.MF index 1415a211..2bd831cc 100644 --- a/org.sf.feeling.decompiler/META-INF/MANIFEST.MF +++ b/org.sf.feeling.decompiler/META-INF/MANIFEST.MF @@ -1,7 +1,6 @@ Manifest-Version: 1.0 Bundle-ActivationPolicy: lazy -Bundle-ClassPath: lib/json.jar, - lib/com.drgarbage.asm_5.0.3.jar, +Bundle-ClassPath: lib/com.drgarbage.asm_5.0.3.jar, lib/com.drgarbage.asm.util_5.0.3.jar, lib/com.drgarbage.bytecodevisualizer.plugin_4.4.1.201408050542.jar, lib/com.drgarbage.core.plugin_4.4.1.201408050542.jar, @@ -37,8 +36,7 @@ Bundle-ManifestVersion: 2 Bundle-Activator: org.sf.feeling.decompiler.JavaDecompilerPlugin Bundle-SymbolicName: org.sf.feeling.decompiler;singleton:=true Eclipse-ExtensibleAPI: true -Export-Package: com.eclipsesource.json, - org.objectweb.asm, +Export-Package: org.objectweb.asm, org.sf.feeling.decompiler, org.sf.feeling.decompiler.actions, org.sf.feeling.decompiler.editor, diff --git a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/UIUtil.java b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/UIUtil.java index 3d3246d4..32a9b776 100644 --- a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/UIUtil.java +++ b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/UIUtil.java @@ -23,22 +23,12 @@ import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.navigator.IExtensionStateConstants.Values; import org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart; -import org.eclipse.jdt.ui.text.IJavaColorConstants; -import org.eclipse.jdt.ui.text.JavaTextTools; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorPart; @@ -54,15 +44,10 @@ import org.eclipse.ui.navigator.CommonNavigatorManager; import org.eclipse.ui.navigator.IExtensionStateModel; import org.eclipse.ui.navigator.INavigatorContentService; -import org.eclipse.ui.themes.ColorUtil; import org.eclipse.ui.views.contentoutline.ContentOutline; import org.sf.feeling.decompiler.JavaDecompilerPlugin; import org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor; -import com.eclipsesource.json.Json; -import com.eclipsesource.json.JsonObject; -import com.eclipsesource.json.JsonValue; - public class UIUtil { public static void openBrowser(String url) { @@ -408,142 +393,6 @@ public static boolean requestFromShowMatch() { return false; } - public static StyleRange getAdTextStyleRange(StyledText textWidget, int offset, int length) { - JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools(); - IPreferenceStore preferences = (IPreferenceStore) ReflectionUtils.getFieldValue(textTools, "fPreferenceStore"); //$NON-NLS-1$ - String textColor = preferences.getString(IJavaColorConstants.JAVADOC_LINK); - - StyleRange styleRange = null; - if (isDark(textWidget)) { - String darkStyleValue = JavaDecompilerPlugin.getDefault().getPreferenceStore().getString("darkStyle"); //$NON-NLS-1$ - if (darkStyleValue != null && darkStyleValue.trim().length() > 0) { - styleRange = handleStyleValue(textWidget, offset, length, darkStyleValue, "text", textColor, false); //$NON-NLS-1$ - } - } else { - String brightStyleValue = JavaDecompilerPlugin.getDefault().getPreferenceStore().getString("brightStyle"); //$NON-NLS-1$ - if (brightStyleValue != null && brightStyleValue.trim().length() > 0) { - styleRange = handleStyleValue(textWidget, offset, length, brightStyleValue, "text", textColor, false); //$NON-NLS-1$ - } - - } - - if (styleRange == null) { - styleRange = getDefaultCommonRange(textWidget, offset, length); - } - return styleRange; - } - - private static StyleRange handleStyleValue(StyledText textWidget, int offset, int length, String brightStyleValue, - String property, String defaultColor, boolean isLink) { - JsonValue styleValue = null; - try { - styleValue = Json.parse(brightStyleValue); - } catch (Exception e) { - Logger.debug(e); - } - - if (styleValue != null && styleValue.isObject()) { - JsonObject style = styleValue.asObject(); - if (style.get(property) != null && style.get(property).isObject()) { - return getStyleRange(textWidget, offset, length, style.get(property).asObject(), defaultColor, isLink); - } - } - - return null; - } - - private static StyleRange getStyleRange(StyledText textWidget, int offset, int length, JsonObject style, - String defaultColor, boolean isLink) { - int contentLength = textWidget.getCharCount(); - if (contentLength - offset < 0) - return null; - StyleRange range = new StyleRange(offset, offset + length < contentLength ? length : contentLength - offset, - defaultColor == null ? null - : JFaceResources.getResources().createColor(ColorUtil.getColorValue(defaultColor)), - null); - JsonValue fontStyleValue = style.get("fontStyle"); //$NON-NLS-1$ - if (fontStyleValue != null && fontStyleValue.isNumber()) { - range.fontStyle = fontStyleValue.asInt(); - } - - JsonValue fontFamilyValue = style.get("fontFamily"); //$NON-NLS-1$ - if (fontFamilyValue != null && fontFamilyValue.isString()) { - if (range.font == null) { - FontData fontData = textWidget.getFont().getFontData()[0]; - fontData.setName(fontFamilyValue.asString()); - Font font = new Font(textWidget.getDisplay(), fontData); - range.font = font; - } else { - FontData fontData = range.font.getFontData()[0]; - fontData.setName(fontFamilyValue.asString()); - } - } - - JsonValue fontSizeValue = style.get("fontSize"); //$NON-NLS-1$ - if (fontSizeValue != null && fontSizeValue.isNumber()) { - FontData textFontData = textWidget.getFont().getFontData()[0]; - if (fontSizeValue.asInt() > textFontData.getHeight()) { - if (range.font == null) { - FontData fontData = textFontData; - fontData.setHeight(fontSizeValue.asInt()); - Font font = new Font(textWidget.getDisplay(), fontData); - range.font = font; - } else { - FontData fontData = range.font.getFontData()[0]; - fontData.setHeight(fontSizeValue.asInt()); - } - } - } - - if (isLink) { - range.underline = true; - range.underlineStyle = SWT.UNDERLINE_LINK; - } - - JsonValue underlineValue = style.get("underline"); //$NON-NLS-1$ - if (underlineValue != null && underlineValue.isBoolean()) { - range.underline = underlineValue.asBoolean(); - if (range.underline) { - range.underlineStyle = SWT.UNDERLINE_LINK; - } - } - - JsonValue underlineStyleValue = style.get("underlineStyle"); //$NON-NLS-1$ - if (underlineStyleValue != null && underlineStyleValue.isNumber()) { - range.underlineStyle = underlineStyleValue.asInt(); - } - - JsonValue hideUnderlineValue = style.get("hideUnderline"); //$NON-NLS-1$ - if (hideUnderlineValue != null && hideUnderlineValue.isBoolean()) { - if (hideUnderlineValue.asBoolean()) { - range.underlineColor = textWidget.getBackground(); - } - } - - JsonValue backgroundValue = style.get("background"); //$NON-NLS-1$ - if (backgroundValue != null && backgroundValue.isString()) { - String backgroundString = backgroundValue.asString(); - RGB rgb = ColorUtil.getColorValue(backgroundString); - if (rgb != null) { - range.background = new Color(textWidget.getDisplay(), rgb); - } - } - - JsonValue foregroundValue = style.get("foreground"); //$NON-NLS-1$ - if (foregroundValue != null && foregroundValue.isString()) { - String foregroundString = foregroundValue.asString(); - RGB rgb = ColorUtil.getColorValue(foregroundString); - if (rgb != null) { - range.foreground = new Color(textWidget.getDisplay(), rgb); - if (range.underlineColor == null) { - range.underlineColor = range.foreground; - } - } - } - - return range; - } - public static boolean isDark(Control textWidget) { if (textWidget != null && !textWidget.isDisposed()) { Color color = textWidget.getBackground(); @@ -555,54 +404,6 @@ public static boolean isDark(Control textWidget) { return false; } - public static StyleRange getAdLinkStyleRange(StyledText textWidget, int offset, int length) { - JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools(); - IPreferenceStore preferences = (IPreferenceStore) ReflectionUtils.getFieldValue(textTools, "fPreferenceStore"); //$NON-NLS-1$ - String linkColor = preferences.getString(IJavaColorConstants.JAVADOC_DEFAULT); - - StyleRange styleRange = null; - if (isDark(textWidget)) { - String darkStyleValue = JavaDecompilerPlugin.getDefault().getPreferenceStore().getString("darkStyle"); //$NON-NLS-1$ - if (darkStyleValue != null && darkStyleValue.trim().length() > 0) { - styleRange = handleStyleValue(textWidget, offset, length, darkStyleValue, "link", linkColor, true); //$NON-NLS-1$ - } - } else { - String brightStyleValue = JavaDecompilerPlugin.getDefault().getPreferenceStore().getString("brightStyle"); //$NON-NLS-1$ - if (brightStyleValue != null && brightStyleValue.trim().length() > 0) { - styleRange = handleStyleValue(textWidget, offset, length, brightStyleValue, "link", linkColor, true); //$NON-NLS-1$ - } - } - - if (styleRange == null) { - styleRange = getDefaultLinkRange(textWidget, offset, length); - } - return styleRange; - } - - private static StyleRange getDefaultLinkRange(StyledText textWidget, int offset, int length) { - JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools(); - IPreferenceStore preferences = (IPreferenceStore) ReflectionUtils.getFieldValue(textTools, "fPreferenceStore"); //$NON-NLS-1$ - String linkColor = preferences.getString(IJavaColorConstants.JAVADOC_LINK); - - StyleRange range = new StyleRange(offset, length, - JFaceResources.getResources().createColor(ColorUtil.getColorValue(linkColor)), null); - range.font = textWidget.getFont(); - range.underline = true; - range.underlineStyle = SWT.UNDERLINE_LINK; - return range; - } - - private static StyleRange getDefaultCommonRange(StyledText textWidget, int offset, int length) { - JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools(); - IPreferenceStore preferences = (IPreferenceStore) ReflectionUtils.getFieldValue(textTools, "fPreferenceStore"); //$NON-NLS-1$ - String commentColor = preferences.getString(IJavaColorConstants.JAVADOC_DEFAULT); - - StyleRange range = new StyleRange(offset, length, - new Color(textWidget.getDisplay(), ColorUtil.getColorValue(commentColor)), null); - range.font = textWidget.getFont(); - return range; - } - public static boolean requestFromLinkToSelection() { StackTraceElement[] stacks = Thread.currentThread().getStackTrace(); for (int i = 0; i < stacks.length && i < 10; i++) {