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 printer into context as field
  • Loading branch information
GaoYushanTw committed Nov 27, 2020
commit 8214afb16483d06188d95d9b03479de84d2e607a
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void decompile(Loader loader, Printer printer, String internalName) throw

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

decompile(decompileContext);
}
Expand All @@ -44,7 +44,7 @@ public void decompile(Loader loader, Printer printer, String internalName, Map<S
decompileContext.setMainInternalTypeName(internalName);
decompileContext.setConfiguration(configuration);
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);

decompile(decompileContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import lombok.Getter;
import lombok.Setter;
import org.jd.core.v1.api.loader.Loader;
import org.jd.core.v1.api.printer.Printer;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -20,6 +21,7 @@ public class DecompileContext {
protected String mainInternalTypeName;
protected Map<String, Object> configuration = new HashMap<>();
protected Loader loader;
protected Printer printer;

@Deprecated
protected HashMap<String, Object> headers = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class WriteTokenProcessor implements Processor {

@Override
public void process(DecompileContext decompileContext) throws Exception {
Printer printer = decompileContext.getHeader("printer");
Printer printer = decompileContext.getPrinter();
List<Token> tokens = decompileContext.getBody();
PrintTokenVisitor visitor = new PrintTokenVisitor();
int maxLineNumber = decompileContext.getHeader("maxLineNumber");
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/CfrTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JarFileToJavaSourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected void test(InputStream inputStream) throws Exception {

DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setConfiguration(configuration);

long time0 = System.currentTimeMillis();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/Java9InterfaceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JavaAnnotationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JavaAnonymousClassTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JavaArrayTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JavaAssertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JavaAutoboxingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JavaBasicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jd/core/v1/JavaEnumTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected String decompile(Loader loader, Printer printer, String internalTypeNa
protected String decompile(Loader loader, Printer printer, String internalTypeName, Map<String, Object> configuration) throws Exception {
DecompileContext decompileContext = new DecompileContext();
decompileContext.setLoader(loader);
decompileContext.setHeader("printer", printer);
decompileContext.setPrinter(printer);
decompileContext.setHeader("mainInternalTypeName", internalTypeName);
decompileContext.setConfiguration(configuration);

Expand Down
Loading