Skip to content

This is a refactor and test case fix #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c5375c7
chore: update Gradle
GaoYushanTw Nov 27, 2020
e1702e3
refactor: rename
GaoYushanTw Nov 27, 2020
957302b
refactor: move mainInternalTypeName to context
GaoYushanTw Nov 27, 2020
04396b8
refactor: use field configuration
GaoYushanTw Nov 27, 2020
6e2bf53
Refactor: move load into context as field
GaoYushanTw Nov 27, 2020
8214afb
refactor: move printer into context as field
GaoYushanTw Nov 27, 2020
15035c6
refactor: move typeMaker into context as field
GaoYushanTw Nov 27, 2020
9a716db
refactor: move majorVersion into context as field
GaoYushanTw Nov 27, 2020
da4fdcb
refactor: move minorVersion into context as field
GaoYushanTw Nov 27, 2020
e60518f
refactor: move maxLineNumber into context as field
GaoYushanTw Nov 27, 2020
4dcf3e6
fix: fix test case for mainInternalTypeName
GaoYushanTw Nov 27, 2020
5fd4b0f
refactor: move last two info into context as field
GaoYushanTw Nov 27, 2020
f368466
chore: remove head in context
GaoYushanTw Nov 27, 2020
8b1e1db
chore: change permission for gradlew
GaoYushanTw Nov 27, 2020
e49cf0c
fix: fix test case
GaoYushanTw Nov 27, 2020
b683d1a
refactor: remove unused interface Processor
GaoYushanTw Nov 27, 2020
7a3799b
refactor: delete unused DeserializeClassFileProcessor
GaoYushanTw Nov 27, 2020
24bc8d6
refactor: move test stub out
GaoYushanTw Nov 28, 2020
24a27eb
refactor: move test stub out
GaoYushanTw Nov 28, 2020
3393c2b
refactor: move some stubs out
GaoYushanTw Nov 28, 2020
615196e
refactor: create AbstrctJdTest to make test easy
GaoYushanTw Nov 28, 2020
d3fbda7
refactor: apply AbstractJdTest to some test
GaoYushanTw Nov 28, 2020
837bf22
refactor: apply AbstractJdTest to test case
GaoYushanTw Nov 28, 2020
cc8d957
refactor: split body to real field
GaoYushanTw Nov 28, 2020
93586ef
refactor: JavaFragment must be Fragment
GaoYushanTw Nov 28, 2020
a33952c
refactor: make process more readable
GaoYushanTw Nov 28, 2020
744e1b3
refactor: more readable
GaoYushanTw Nov 28, 2020
73bf433
chore: cache TypeMaker in Context
GaoYushanTw Nov 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: move mainInternalTypeName to context
  • Loading branch information
GaoYushanTw committed Nov 27, 2020
commit 957302bfeae901b96bd8a10e31743ec4dcd6767c
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'

testCompile 'commons-codec:commons-codec:1.13'
testCompile 'org.apache.commons:commons-collections4:4.1'
testCompile 'org.apache.commons:commons-imaging:1.0-alpha1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ClassFileToJavaSourceDecompiler implements Decompiler {
public void decompile(Loader loader, Printer printer, String internalName) throws Exception {
DecompileContext decompileContext = new DecompileContext();

decompileContext.setHeader("mainInternalTypeName", internalName);
decompileContext.setMainInternalTypeName(internalName);
decompileContext.setHeader("loader", loader);
decompileContext.setHeader("printer", printer);

Expand All @@ -41,7 +41,7 @@ public void decompile(Loader loader, Printer printer, String internalName) throw
public void decompile(Loader loader, Printer printer, String internalName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();

decompileContext.setHeader("mainInternalTypeName", internalName);
decompileContext.setMainInternalTypeName(internalName);
decompileContext.setHeader("configuration", configuration);
decompileContext.setHeader("loader", loader);
decompileContext.setHeader("printer", printer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@

package org.jd.core.v1.model.message;

import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;

@Getter
@Setter
public class DecompileContext {
protected String mainInternalTypeName;
protected HashMap<String, Object> headers = new HashMap<>();
protected Object body;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class DeserializeClassFileProcessor extends ClassFileDeserializer impleme
@Override
public void process(DecompileContext decompileContext) throws Exception {
Loader loader = decompileContext.getHeader("loader");
String internalTypeName = decompileContext.getHeader("mainInternalTypeName");
String internalTypeName = decompileContext.getMainInternalTypeName();
ClassFile classFile = loadClassFile(loader, internalTypeName);

decompileContext.setBody(classFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class JavaSyntaxToJavaFragmentProcessor implements Processor {

public void process(DecompileContext decompileContext) throws Exception {
Loader loader = decompileContext.getHeader("loader");
String mainInternalTypeName = decompileContext.getHeader("mainInternalTypeName");
String mainInternalTypeName = decompileContext.getMainInternalTypeName();
int majorVersion = decompileContext.getHeader("majorVersion");
CompilationUnit compilationUnit = decompileContext.getBody();

Expand Down