diff --git a/core/src/main/java/com/alibaba/testable/core/translator/EnableTestableTranslator.java b/core/src/main/java/com/alibaba/testable/core/translator/EnableTestableTranslator.java index 7fca2c2..b5d18ab 100644 --- a/core/src/main/java/com/alibaba/testable/core/translator/EnableTestableTranslator.java +++ b/core/src/main/java/com/alibaba/testable/core/translator/EnableTestableTranslator.java @@ -86,7 +86,7 @@ public class EnableTestableTranslator extends BaseTranslator { @Override public void visitMethodDef(JCMethodDecl jcMethodDecl) { for (JCAnnotation a : jcMethodDecl.mods.annotations) { - if (ConstPool.ANNOTATION_TESTABLE_INJECT.equals(a.type.tsym.toString())) { + if (a.type != null && ConstPool.ANNOTATION_TESTABLE_INJECT.equals(a.type.tsym.toString())) { ListBuffer args = new ListBuffer<>(); for (JCVariableDecl p : jcMethodDecl.params) { args.add(cx.treeMaker.Select(p.vartype, cx.names.fromString(ConstPool.CLASS_OF_TYPE))); @@ -145,16 +145,6 @@ public class EnableTestableTranslator extends BaseTranslator { return expr; } - private List removeAnnotation(List annotations, String target) { - ListBuffer nb = new ListBuffer<>(); - for (JCAnnotation i : annotations) { - if (!i.type.tsym.toString().equals(target)) { - nb.add(i); - } - } - return nb.toList(); - } - private boolean isPrivateField(JCAssign expr) { return expr.lhs.getClass().equals(JCFieldAccess.class) && ((JCFieldAccess)(expr).lhs).selected.getClass().equals(JCIdent.class) &&