mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-10 20:30:11 +08:00
fix generated static new class structure
This commit is contained in:
parent
3d98eb4c8a
commit
b9796e0397
@ -27,7 +27,6 @@ public class StaticNewClassGenerator {
|
||||
TypeVariableName typeVariable = TypeVariableName.get("T");
|
||||
MethodSpec.Builder builder = MethodSpec.methodBuilder(ConstPool.SN_METHOD)
|
||||
.addModifiers(Modifier.PUBLIC).addModifiers(Modifier.STATIC)
|
||||
.addException(Exception.class)
|
||||
.addTypeVariable(typeVariable)
|
||||
.varargs(true)
|
||||
.addParameter(ParameterizedTypeName.get(ClassName.get(Class.class), typeVariable), "type")
|
||||
|
@ -58,9 +58,10 @@ public class TestableClassTranslator extends TreeTranslator {
|
||||
nameTable.fromString("class"), null);
|
||||
ListBuffer<JCTree.JCExpression> args = ListBuffer.of(classType);
|
||||
args.addAll(newClassExpr.args);
|
||||
TestableFieldAccess ne = new TestableFieldAccess(treeMaker.Ident(nameTable.fromString(ConstPool.SN_PKG)),
|
||||
nameTable.fromString(ConstPool.SN_CLS), null);
|
||||
jcExpressionStatement.expr = new TestableMethodInvocation(null,
|
||||
new TestableFieldAccess(treeMaker.Ident(nameTable.fromString(ConstPool.SN_PKG_CLS)),
|
||||
nameTable.fromString(ConstPool.SN_METHOD), null), args.toList());
|
||||
new TestableFieldAccess(ne, nameTable.fromString(ConstPool.SN_METHOD), null), args.toList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user