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