build: config spotless plugin and reformat code

This commit is contained in:
Frank.R.Wu 2023-06-15 11:07:54 +08:00
parent 35ac40cd76
commit c8accd5c22
2 changed files with 12 additions and 5 deletions

View File

@ -2,6 +2,8 @@ plugins {
id 'java-library'
}
apply from: '../spotless.gradle'
group 'com.bdware.sc'
version '1.0-SNAPSHOT'

View File

@ -115,13 +115,17 @@ public class ConsistencyPluginManager {
while (enumeration.hasMoreElements()) {
JarEntry entry = enumeration.nextElement();
String entryName = entry.getName();
if (entryName.endsWith(".class") && entryName.lastIndexOf(".") >= entryName.lastIndexOf("/")) {
if (entryName.endsWith(".class")
&& entryName.lastIndexOf(".") >= entryName.lastIndexOf("/")) {
try {
String className = entryName.replaceAll("/", ".").substring(0, entryName.length() - 6);
String className = entryName.replaceAll("/", ".").substring(0,
entryName.length() - 6);
Class<?> clazz = urlClassLoader.loadClass(className);
// ContractExecutorFactory子类 && 非抽象类
if (ContractExecutorFactory.class.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
ContractExecutorFactory factory = (ContractExecutorFactory) (clazz.newInstance());
if (ContractExecutorFactory.class.isAssignableFrom(clazz)
&& !Modifier.isAbstract(clazz.getModifiers())) {
ContractExecutorFactory factory =
(ContractExecutorFactory) (clazz.newInstance());
factoriesMap.put(factory.getExecutorName(), factory);
}
} catch (Exception e) {
@ -140,7 +144,8 @@ public class ConsistencyPluginManager {
}
@Deprecated
public ContractExecutor createContractExecutor(ContractExecType type, Map<String, Object> args) {
public ContractExecutor createContractExecutor(ContractExecType type,
Map<String, Object> args) {
String name = "";
switch (type) {
case Sole: