feat: Имплементация нативных затычек
- Абстрактные методы также будут игнорироваться. - Реализация `FileTools.unpackAsset`.
This commit is contained in:
Binary file not shown.
@@ -151,6 +151,13 @@ public class RebuildJavadoc {
|
|||||||
if (isInterface && method.isEmpty()) {
|
if (isInterface && method.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
int modifiers = method.getModifiers();
|
||||||
|
if ((modifiers & AccessFlag.ABSTRACT) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((modifiers & AccessFlag.NATIVE) != 0) {
|
||||||
|
method.setModifiers(modifiers & ~AccessFlag.NATIVE);
|
||||||
|
}
|
||||||
String desiredValue = "null";
|
String desiredValue = "null";
|
||||||
try {
|
try {
|
||||||
desiredValue = getStubReturnForMethod(method);
|
desiredValue = getStubReturnForMethod(method);
|
||||||
@@ -178,7 +185,7 @@ public class RebuildJavadoc {
|
|||||||
if (ctClass.isFrozen()) {
|
if (ctClass.isFrozen()) {
|
||||||
ctClass.defrost();
|
ctClass.defrost();
|
||||||
}
|
}
|
||||||
if (ctClass.isEnum() || ctClass.isInterface()) {
|
if (ctClass.isEnum() || ctClass.isInterface() || (ctClass.getModifiers() & AccessFlag.ABSTRACT) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CtConstructor minimumConstructor = getMinimumConstructor(ctClass.getDeclaredConstructors());
|
CtConstructor minimumConstructor = getMinimumConstructor(ctClass.getDeclaredConstructors());
|
||||||
@@ -226,11 +233,12 @@ public class RebuildJavadoc {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
CtClass returnClass = method.getReturnType();
|
CtClass returnClass = method.getReturnType();
|
||||||
if (returnClass.isEnum() || returnClass.isInterface()) {
|
if (returnClass.isEnum() || returnClass.isInterface() || (returnClass.getModifiers() & AccessFlag.ABSTRACT) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String returnType = returnClass.getName();
|
String returnType = returnClass.getName();
|
||||||
if ((method.getModifiers() & AccessFlag.STATIC) == 0 && returnType.equals(ctClass.getName())) {
|
int modifiers = method.getModifiers();
|
||||||
|
if ((modifiers & AccessFlag.ABSTRACT) != 0 || ((modifiers & AccessFlag.STATIC) == 0 && returnType.equals(ctClass.getName()))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (rewrittenSingletonClasses.contains(returnType)) {
|
if (rewrittenSingletonClasses.contains(returnType)) {
|
||||||
|
|||||||
@@ -127,7 +127,16 @@ public class FileTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static File unpackAsset(String name, String path) throws IOException {
|
public static File unpackAsset(String name, String path) throws IOException {
|
||||||
throw new IOException("FileTools.unpackAsset");
|
File inputFile = new File(DIR_WORK + "assets/" + name);
|
||||||
|
File outputFile = new File(path);
|
||||||
|
|
||||||
|
if (inputFile.equals(outputFile)) {
|
||||||
|
return outputFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputFile.createNewFile();
|
||||||
|
copy(inputFile, outputFile);
|
||||||
|
return outputFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unpackAssetDir(String name, String path) {
|
public static void unpackAssetDir(String name, String path) {
|
||||||
|
|||||||
Reference in New Issue
Block a user