refactor naming

This commit is contained in:
金戟 2020-05-15 00:42:00 +08:00
parent 67eeb52513
commit 3d98eb4c8a

View File

@ -50,7 +50,7 @@ public class TestableProcessor extends BaseProcessor {
private void createStaticNewClass() {
if (!isStaticNewClassExist()) {
try {
writeSourceFile(ConstPool.SN_PKG + "." + ConstPool.SN_CLS, new StaticNewClassGenerator().fetch());
writeSourceFile(ConstPool.SN_PKG_CLS, new StaticNewClassGenerator().fetch());
} catch (IOException e) {
e.printStackTrace();
}
@ -59,8 +59,9 @@ public class TestableProcessor extends BaseProcessor {
private boolean isStaticNewClassExist() {
try {
FileObject staticNewClassFile = filter.getResource(SOURCE_OUTPUT, ConstPool.SN_PKG, ConstPool.SN_CLS + JAVA_POSTFIX);
return staticNewClassFile.getName().contains(GENERATED_TEST_SOURCES) || staticNewClassFile.getLastModified() > 0;
FileObject staticNewClassFile = filter.getResource(SOURCE_OUTPUT, ConstPool.SN_PKG,
ConstPool.SN_CLS + JAVA_POSTFIX);
return isCompilingTestClass(staticNewClassFile) || staticNewClassFile.getLastModified() > 0;
} catch (FilerException e) {
return true;
} catch (IOException e) {
@ -68,6 +69,10 @@ public class TestableProcessor extends BaseProcessor {
}
}
private boolean isCompilingTestClass(FileObject staticNewClassFile) {
return staticNewClassFile.getName().contains(GENERATED_TEST_SOURCES);
}
private void processFieldElement(Element field) {
JCTree tree = trees.getTree(field);
tree.accept(new TestableFieldTranslator(treeMaker));