Skip to content

Commit

Permalink
#7: Removed JD-Core native binaries and updated to jd-core 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pbi-qfs committed Jun 15, 2018
1 parent ee4ecd3 commit dc68f7e
Show file tree
Hide file tree
Showing 21 changed files with 1,527 additions and 668 deletions.
23 changes: 9 additions & 14 deletions AUDIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,19 @@ _Primary Source: https://bitbucket.org/mstrobel/procyon/_
### JAD
_Primary Source: http://www.javadecompilers.com/jad_

* `./org.sf.feeling.decompiler.jad/bin/native/jad/linux/jad`
* `./org.sf.feeling.decompiler.jad/src/native/jad/linux/jad`
* SHA-256: 805527efac5b4f1d3982f20a8533142326cc397df1b2cf6012c12df91d4794f5
* `./org.sf.feeling.decompiler.jad/src/native/jad/macos/jad`
* SHA-256: f88436c49ed025f62f87754eba0b0190568d1efa5a38199f427f7ade4f5d037e
* `./org.sf.feeling.decompiler.jad/src/native/jad/win32/jad.exe`
* SHA-256: c5f43828592c7a47261b6baf89f13455423f9c528ed1b01e7148ba2475ed6126

## JD-Core

* `./org.sf.feeling.decompiler.jd/bin/native/jd-core/linux/x86/libjd-eclipse.so`
* `./org.sf.feeling.decompiler.jd/src/native/jd-core/linux/x86/libjd-eclipse./org.sf.feeling.decompiler.jd/bin/native/jd-core/linux/x86_64/libjd-eclipse.so`
* `./org.sf.feeling.decompiler.jd/src/native/jd-core/linux/x86_64/libjd-eclipse.so`
.so
* `./org.sf.feeling.decompiler.jd/bin/native/jd-core/win32/x86/jd-eclipse.dll`
* `./org.sf.feeling.decompiler.jd/src/native/jd-core/win32/x86/jd-eclipse.dll`
* `./org.sf.feeling.decompiler.jd/bin/native/jd-core/win32/x86_64/jd-eclipse.dll`
* `./org.sf.feeling.decompiler.jd/src/native/jd-core/win32/x86_64/jd-eclipse.dll`
* `./org.sf.feeling.decompiler.jd/bin/native/jd-core/macosx/x86/libjd-eclipse.jnilib`
* `./org.sf.feeling.decompiler.jd/src/native/jd-core/macosx/x86/libjd-eclipse.jnilib`
* `./org.sf.feeling.decompiler.jd/bin/native/jd-core/macosx/x86_64/libjd-eclipse.jnilib`
* `./org.sf.feeling.decompiler.jd/src/native/jd-core/macosx/x86_64/libjd-eclipse.jnilib`
_Primary Source: https://github.com/java-decompiler/jd-eclipse/releases_

* `./org.sf.feeling.decompiler.jd/lib/jd-common-0.7.1.jar`
* SHA-256: dfc8c400110b589b5347d6337aeea8d197539e9bc866789c319be6584688c41a
* `./org.sf.feeling.decompiler.jd/lib/jd-common-ide-0.7.1.jar`
* SHA-256: 53a794093510ebb3c1411f1bf1acfb37616baea16ca11b1aa5cf5a0ec457856f
* `./org.sf.feeling.decompiler.jd/lib/jd-core-0.7.1.jar`
* SHA-256: 4977fd2d30a42d54b197d0f80a21c623210e973dd0a781ba1dcbe2e59cf3d62a
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ _If you have currently the "Eclipse" Class Decompiler installed, it is recommend
1. Clone this project
1. Clone https://github.com/ecd-plugin/update next to this project
1. Run mvn clean package

If you want to use Eclipse and help developing, continue like this:

4. Install _Eclipse for RCP and RAP Developers_
3. Import all projects into Eclipse by selecting _File_ > _Import_ > _General_ > _Existing Projects into Workspace_ > _Next_ and enter the parent of the cloned directory as "root directory".
4. Open the _org.sf.feeling.decompiler.updatesite_ project in the Package Explorer
Expand All @@ -53,7 +53,11 @@ _If you have currently the "Eclipse" Class Decompiler installed, it is recommend

## License

The plugin is licensed under the [Eclipse Public License v1.0](http://www.eclipse.org/legal/epl-v10.html)
The main plugin and most of the optional feature plugins are licensed under the [Eclipse Public License v1.0](http://www.eclipse.org/legal/epl-v10.html)

### org.sf.feeling.decompiler.jd

The optional and independent _org.sf.feeling.decompiler.jd_ project and its used libraries are licensed under the [GPL 3](https://www.gnu.org/licenses/gpl-3.0-standalone.html)

## Contributors

Expand All @@ -67,7 +71,7 @@ The plugin is licensed under the [Eclipse Public License v1.0](http://www.eclips
* Version 3.1.0
* Updated Embedded Decompilers
* CFR to version 0_130

* Version 3.0.0
* Removed adware code fragments
* Removed self-update feature (Eclipse handles updates fine)
Expand Down
328 changes: 0 additions & 328 deletions org.sf.feeling.decompiler.jd.feature/epl-v10.html

This file was deleted.

766 changes: 677 additions & 89 deletions org.sf.feeling.decompiler.jd.feature/feature.properties

Large diffs are not rendered by default.

769 changes: 696 additions & 73 deletions org.sf.feeling.decompiler.jd.feature/license.html

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions org.sf.feeling.decompiler.jd/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/jd-common-0.7.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jd-common-ide-0.7.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jd-core-0.7.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
4 changes: 4 additions & 0 deletions org.sf.feeling.decompiler.jd/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Bundle-ActivationPolicy: lazy
Bundle-Vendor: ECD Project Team
Export-Package: org.sf.feeling.decompiler.jd.actions,
org.sf.feeling.decompiler.jd.decompiler
Bundle-ClassPath: lib/jd-common-0.7.1.jar,
lib/jd-common-ide-0.7.1.jar,
lib/jd-core-0.7.1.jar,
.
4 changes: 3 additions & 1 deletion org.sf.feeling.decompiler.jd/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/
icons/,\
lib/

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,88 +1,122 @@
/*******************************************************************************
* Copyright (c) 2017 Chen Chao and other ECD project contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/

package jd.ide.eclipse.editors;

import java.io.IOException;
import java.net.URL;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.sf.feeling.decompiler.editor.BaseDecompilerSourceMapper;
import org.sf.feeling.decompiler.util.UIUtil;

public abstract class JDSourceMapper extends BaseDecompilerSourceMapper
{

protected final static String JAR_SUFFIX = ".jar"; //$NON-NLS-1$
protected final static String ZIP_SUFFIX = ".zip"; //$NON-NLS-1$
protected final static String JAVA_CLASS_SUFFIX = ".class"; //$NON-NLS-1$
protected final static String JAVA_SOURCE_SUFFIX = ".java"; //$NON-NLS-1$
protected final static int JAVA_SOURCE_SUFFIX_LENGTH = 5;
protected static boolean loaded = false;

public JDSourceMapper( IPath sourcePath, String rootPath )
{
super( sourcePath, rootPath );
}

public native String decompile( String baseName, String qualifiedName );

protected void loadLibrary( ) throws IOException
{
if ( loaded == false )
{
System.load( getLibraryPath( ) );
loaded = true;
}
}

protected String getLibraryPath( ) throws IOException
{
URL pluginUrl = null;
if ( Platform.OS_WIN32.equalsIgnoreCase( Platform.getOS( ) ) )
{
if ( Platform.ARCH_X86_64.equalsIgnoreCase( Platform.getOSArch( ) ) )
{
pluginUrl = this.getClass( ).getResource( "/native/jd-core/win32/x86_64/jd-eclipse.dll" ); //$NON-NLS-1$
}
else
{
pluginUrl = this.getClass( ).getResource( "/native/jd-core/win32/x86/jd-eclipse.dll" ); //$NON-NLS-1$
}
}
else if ( Platform.OS_LINUX.equalsIgnoreCase( Platform.getOS( ) ) )
{
if ( Platform.ARCH_X86_64.equalsIgnoreCase( Platform.getOSArch( ) ) )
{
pluginUrl = this.getClass( ).getResource( "/native/jd-core/linux/x86_64/libjd-eclipse.so" ); //$NON-NLS-1$
}
else
{
pluginUrl = this.getClass( ).getResource( "/native/jd-core/linux/x86/libjd-eclipse.so" ); //$NON-NLS-1$
}
}
else if ( Platform.OS_MACOSX.equalsIgnoreCase( Platform.getOS( ) ) )
{
if ( Platform.ARCH_X86_64.equalsIgnoreCase( Platform.getOSArch( ) ) )
{
pluginUrl = this.getClass( ).getResource( "/native/jd-core/macosx/x86_64/libjd-eclipse.jnilib" ); //$NON-NLS-1$
}
else
{
pluginUrl = this.getClass( ).getResource( "/native/jd-core/macosx/x86/libjd-eclipse.jnilib" ); //$NON-NLS-1$
}
}
String path = FileLocator.toFileURL( pluginUrl ).getFile( );
if ( UIUtil.isWin32( ) && path != null && ( path.length( ) > 0 ) && ( path.charAt( 0 ) == '/' ) )
path = path.substring( 1 );

return path;
}
}
/*
* Copyright (c) 2008-2015 Emmanuel Dupuy
* This program is made available under the terms of the GPLv3 License.
*/

package jd.ide.eclipse.editors;

import java.io.File;
import java.util.Iterator;
import java.util.Map;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.sf.feeling.decompiler.JavaDecompilerPlugin;
import org.sf.feeling.decompiler.editor.BaseDecompilerSourceMapper;

import jd.commonide.IdeDecompiler;
import jd.commonide.preferences.IdePreferences;


/**
* JDSourceMapper
*
* @project Java Decompiler Eclipse Plugin
* @version 0.1.4
* @see org.eclipse.jdt.internal.core.SourceMapper
*/
@SuppressWarnings("restriction")
public abstract class JDSourceMapper extends BaseDecompilerSourceMapper
{
private final static String JAVA_CLASS_SUFFIX = ".class";
private final static String JAVA_SOURCE_SUFFIX = ".java";
private final static int JAVA_SOURCE_SUFFIX_LENGTH = 5;

private File basePath;

@SuppressWarnings("rawtypes")
public JDSourceMapper(
File basePath, IPath sourcePath, String sourceRootPath, Map options)
{
super(sourcePath, sourceRootPath, options);
this.basePath = basePath;
}

@SuppressWarnings("rawtypes")
public char[] findSource(String javaSourcePath)
{
char[] source = null;

// Search source file
if (this.rootPaths == null)
{
source = super.findSource(javaSourcePath);
}
else
{
Iterator iterator = this.rootPaths.iterator();
while (iterator.hasNext() && (source == null))
{
String sourcesRootPath = (String)iterator.next();
source = super.findSource(
sourcesRootPath + IPath.SEPARATOR + javaSourcePath);
}
}

if ((source == null) && javaSourcePath.endsWith(JAVA_SOURCE_SUFFIX))
{
String classPath = javaSourcePath.substring(
0, javaSourcePath.length()-JAVA_SOURCE_SUFFIX_LENGTH) + JAVA_CLASS_SUFFIX;

// Decompile class file
try
{
String result = decompile(this.basePath.getAbsolutePath(), classPath);
if (result != null)
source = result.toCharArray();
}
catch (Exception e)
{
JavaDecompilerPlugin.getDefault().getLog().log(new Status(
Status.ERROR, JavaDecompilerPlugin.PLUGIN_ID,
0, e.getMessage(), e));
}
}

return source;
}

/**
* @param basePath Path to the root of the classpath, either a
* path to a directory or a path to a jar file.
* @param internalClassName internal name of the class.
* @return Decompiled class text.
*/
public String decompile(String basePath, String classPath) {
// Load preferences
IPreferenceStore store = JavaDecompilerPlugin.getDefault().getPreferenceStore();

boolean showDefaultConstructor = false; //currently unused : store.getBoolean(JavaDecompilerPlugin.PREF_SHOW_DEFAULT_CONSTRUCTOR);
boolean realignmentLineNumber = store.getBoolean(JavaDecompilerPlugin.ALIGN);
boolean showPrefixThis = false; //currently unused : store.getBoolean(JavaDecompilerPlugin.PREF_OMIT_PREFIX_THIS);
boolean mergeEmptyLines = false;
boolean unicodeEscape = false; //currently unused : store.getBoolean(JavaDecompilerPlugin.PREF_ESCAPE_UNICODE_CHARACTERS);
boolean showLineNumbers = store.getBoolean(JavaDecompilerPlugin.PREF_DISPLAY_LINE_NUMBERS);
boolean showMetadata = store.getBoolean(JavaDecompilerPlugin.PREF_DISPLAY_METADATA);

// Create preferences
IdePreferences preferences = new IdePreferences(
showDefaultConstructor, realignmentLineNumber, showPrefixThis,
mergeEmptyLines, unicodeEscape, showLineNumbers, showMetadata);

// Decompile
return IdeDecompiler.decompile(preferences, basePath, classPath);
}

/**
* @return version of JD-Core
* @since JD-Core 0.7.0
*/
public static String getVersion() { return "0.7.1"; }
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ public String removeComment( String source )
@Override
public boolean supportLevel( int level )
{
return level < 8;
return true;
}

@Override
public boolean supportDebugLevel( int level )
{
return level < 8;
return true;
}

@Override
Expand Down
Loading

0 comments on commit dc68f7e

Please sign in to comment.