Skip to content

Commit ecf9843

Browse files
author
emmanue1
committed
Fix bug on parameters in method invocations
1 parent c787196 commit ecf9843

22 files changed

+325
-172
lines changed

src/main/java/org/jd/core/v1/model/javasyntax/expression/NewExpression.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008-2019 Emmanuel Dupuy.
2+
* Copyright (c) 2008, 2019 Emmanuel Dupuy.
33
* This project is distributed under the GPLv3 license.
44
* This is a Copyleft license that gives the user the right to use,
55
* copy and modify the code freely for non-commercial purposes.
@@ -73,11 +73,6 @@ public void setParameters(BaseExpression parameters) {
7373
this.parameters = parameters;
7474
}
7575

76-
public void setDescriptorAndParameters(String descriptor, BaseExpression parameters) {
77-
this.descriptor = descriptor;
78-
this.parameters = parameters;
79-
}
80-
8176
public BodyDeclaration getBodyDeclaration() {
8277
return bodyDeclaration;
8378
}

src/main/java/org/jd/core/v1/model/javasyntax/type/WildcardTypeArgument.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
package org.jd.core.v1.model.javasyntax.type;
99

1010
public class WildcardTypeArgument implements TypeArgument {
11+
public static final WildcardTypeArgument WILDCARD_TYPE_ARGUMENT = new WildcardTypeArgument();
12+
13+
private WildcardTypeArgument() {}
1114

1215
@Override
1316
public void accept(TypeVisitor visitor) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2008, 2019 Emmanuel Dupuy.
3+
* This project is distributed under the GPLv3 license.
4+
* This is a Copyleft license that gives the user the right to use,
5+
* copy and modify the code freely for non-commercial purposes.
6+
*/
7+
8+
package org.jd.core.v1.service.converter.classfiletojavasyntax.model.javasyntax.expression;
9+
10+
import org.jd.core.v1.model.javasyntax.expression.BaseExpression;
11+
import org.jd.core.v1.model.javasyntax.expression.ConstructorInvocationExpression;
12+
import org.jd.core.v1.model.javasyntax.type.ObjectType;
13+
import org.jd.core.v1.model.javasyntax.type.Type;
14+
import org.jd.core.v1.util.DefaultList;
15+
16+
public class ClassFileConstructorInvocationExpression extends ConstructorInvocationExpression {
17+
protected DefaultList<Type> parameterTypes;
18+
19+
public ClassFileConstructorInvocationExpression(int lineNumber, ObjectType type, String descriptor, DefaultList<Type> parameterTypes, BaseExpression parameters) {
20+
super(lineNumber, type, descriptor, parameters);
21+
this.parameterTypes = parameterTypes;
22+
}
23+
24+
public DefaultList<Type> getParameterTypes() {
25+
return parameterTypes;
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2008, 2019 Emmanuel Dupuy.
3+
* This project is distributed under the GPLv3 license.
4+
* This is a Copyleft license that gives the user the right to use,
5+
* copy and modify the code freely for non-commercial purposes.
6+
*/
7+
8+
package org.jd.core.v1.service.converter.classfiletojavasyntax.model.javasyntax.expression;
9+
10+
import org.jd.core.v1.model.javasyntax.expression.BaseExpression;
11+
import org.jd.core.v1.model.javasyntax.expression.Expression;
12+
import org.jd.core.v1.model.javasyntax.expression.MethodInvocationExpression;
13+
import org.jd.core.v1.model.javasyntax.type.Type;
14+
import org.jd.core.v1.util.DefaultList;
15+
16+
public class ClassFileMethodInvocationExpression extends MethodInvocationExpression {
17+
protected DefaultList<Type> parameterTypes;
18+
19+
public ClassFileMethodInvocationExpression(int lineNumber, Type type, Expression expression, String internalTypeName, String name, String descriptor, DefaultList<Type> parameterTypes, BaseExpression parameters) {
20+
super(lineNumber, type, expression, internalTypeName, name, descriptor, parameters);
21+
this.parameterTypes = parameterTypes;
22+
}
23+
24+
public DefaultList<Type> getParameterTypes() {
25+
return parameterTypes;
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2008, 2019 Emmanuel Dupuy.
3+
* This project is distributed under the GPLv3 license.
4+
* This is a Copyleft license that gives the user the right to use,
5+
* copy and modify the code freely for non-commercial purposes.
6+
*/
7+
8+
package org.jd.core.v1.service.converter.classfiletojavasyntax.model.javasyntax.expression;
9+
10+
import org.jd.core.v1.model.javasyntax.declaration.BodyDeclaration;
11+
import org.jd.core.v1.model.javasyntax.expression.BaseExpression;
12+
import org.jd.core.v1.model.javasyntax.expression.NewExpression;
13+
import org.jd.core.v1.model.javasyntax.type.ObjectType;
14+
import org.jd.core.v1.model.javasyntax.type.Type;
15+
import org.jd.core.v1.util.DefaultList;
16+
17+
public class ClassFileNewExpression extends NewExpression {
18+
protected DefaultList<Type> parameterTypes;
19+
20+
public ClassFileNewExpression(int lineNumber, ObjectType type) {
21+
super(lineNumber, type);
22+
}
23+
24+
public ClassFileNewExpression(int lineNumber, ObjectType type, BodyDeclaration bodyDeclaration) {
25+
super(lineNumber, type, bodyDeclaration);
26+
}
27+
28+
public DefaultList<Type> getParameterTypes() {
29+
return parameterTypes;
30+
}
31+
32+
public void set(String descriptor, DefaultList<Type> parameterTypes, BaseExpression parameters) {
33+
this.descriptor = descriptor;
34+
this.parameterTypes = parameterTypes;
35+
this.parameters = parameters;
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2008, 2019 Emmanuel Dupuy.
3+
* This project is distributed under the GPLv3 license.
4+
* This is a Copyleft license that gives the user the right to use,
5+
* copy and modify the code freely for non-commercial purposes.
6+
*/
7+
8+
package org.jd.core.v1.service.converter.classfiletojavasyntax.model.javasyntax.expression;
9+
10+
import org.jd.core.v1.model.javasyntax.expression.BaseExpression;
11+
import org.jd.core.v1.model.javasyntax.expression.SuperConstructorInvocationExpression;
12+
import org.jd.core.v1.model.javasyntax.type.ObjectType;
13+
import org.jd.core.v1.model.javasyntax.type.Type;
14+
import org.jd.core.v1.util.DefaultList;
15+
16+
public class ClassFileSuperConstructorInvocationExpression extends SuperConstructorInvocationExpression {
17+
protected DefaultList<Type> parameterTypes;
18+
19+
public ClassFileSuperConstructorInvocationExpression(int lineNumber, ObjectType type, String descriptor, DefaultList<Type> parameterTypes, BaseExpression parameters) {
20+
super(lineNumber, type, descriptor, parameters);
21+
this.parameterTypes = parameterTypes;
22+
}
23+
24+
public DefaultList<Type> getParameterTypes() {
25+
return parameterTypes;
26+
}
27+
}

src/main/java/org/jd/core/v1/service/converter/classfiletojavasyntax/processor/UpdateJavaSyntaxTreeProcessor.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008-2019 Emmanuel Dupuy.
2+
* Copyright (c) 2008, 2019 Emmanuel Dupuy.
33
* This project is distributed under the GPLv3 license.
44
* This is a Copyleft license that gives the user the right to use,
55
* copy and modify the code freely for non-commercial purposes.
@@ -12,7 +12,8 @@
1212
import org.jd.core.v1.model.processor.Processor;
1313
import org.jd.core.v1.service.converter.classfiletojavasyntax.util.ObjectTypeMaker;
1414
import org.jd.core.v1.service.converter.classfiletojavasyntax.util.SignatureParser;
15-
import org.jd.core.v1.service.converter.classfiletojavasyntax.visitor.UpdateJavaSyntaxTreeVisitor;
15+
import org.jd.core.v1.service.converter.classfiletojavasyntax.visitor.UpdateJavaSyntaxTreeStep1Visitor;
16+
import org.jd.core.v1.service.converter.classfiletojavasyntax.visitor.UpdateJavaSyntaxTreeStep2Visitor;
1617

1718
/**
1819
* Create statements, init fields, merge declarations.<br><br>
@@ -28,7 +29,10 @@ public void process(Message message) throws Exception {
2829
SignatureParser parser = message.getHeader("signatureParser");
2930
CompilationUnit compilationUnit = message.getBody();
3031

31-
UpdateJavaSyntaxTreeVisitor updateJavaSyntaxTreeVisitor = new UpdateJavaSyntaxTreeVisitor(maker, parser);
32-
updateJavaSyntaxTreeVisitor.visit(compilationUnit);
32+
UpdateJavaSyntaxTreeStep1Visitor updateJavaSyntaxTreeStep1Visitor = new UpdateJavaSyntaxTreeStep1Visitor(maker, parser);
33+
updateJavaSyntaxTreeStep1Visitor.visit(compilationUnit);
34+
35+
UpdateJavaSyntaxTreeStep2Visitor updateJavaSyntaxTreeStep2Visitor = new UpdateJavaSyntaxTreeStep2Visitor();
36+
updateJavaSyntaxTreeStep2Visitor.visit(compilationUnit);
3337
}
3438
}

0 commit comments

Comments
 (0)