Deprecate the StableAPI annotations, switch to JB annotations

This commit is contained in:
FalsePattern committed 2025-05-26 09:45:57 +02:00
1 parent 8645d20a16
commit df1f294776
96 files changed
+1079 -762

No files matched your search

@@ -21,7 +21,6 @@
*/
package com.falsepattern.lib.asm;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.asm.exceptions.AsmClassNotFoundException;
import com.falsepattern.lib.asm.exceptions.AsmFieldNotFoundException;
import com.falsepattern.lib.asm.exceptions.AsmMethodNotFoundException;
@@ -44,9 +43,7 @@ import org.objectweb.asm.tree.MethodNode;
import java.util.Arrays;
import java.util.Objects;
@StableAPI(since = "0.10.0")
public class ASMUtil {
@StableAPI.Expose
public static FieldNode findFieldStandard(ClassNode cn, String name, boolean optional) {
for (final FieldNode ret : cn.fields) {
if (name.equals(ret.name)) {
@@ -60,7 +57,6 @@ public class ASMUtil {
}
@SneakyThrows
@StableAPI.Expose
public static FieldNode findFieldFromMCP(ClassNode cn, String fieldName, boolean optional) {
val classMapping = discoverClassMappingType(cn);
if (classMapping == null) {
@@ -76,7 +72,6 @@ public class ASMUtil {
optional);
}
@StableAPI.Expose
public static FieldNode findFieldFromUniversal(ClassNode cn, UniversalField field, boolean optional) {
String[] possibilities = CoreLoadingPlugin.isObfuscated() ? new String[]{field.getName(MappingType.SRG),
field.getName(MappingType.Notch)}
@@ -93,7 +88,6 @@ public class ASMUtil {
possibilities.length == 1 ? possibilities[0] : Arrays.toString(possibilities));
}
@StableAPI.Expose
public static MethodNode findMethodStandard(ClassNode cn, String name, String descriptor, boolean optional) {
for (final MethodNode ret : cn.methods) {
if (name.equals(ret.name) && descriptor.equals(ret.desc)) {
@@ -107,7 +101,6 @@ public class ASMUtil {
}
@SneakyThrows
@StableAPI.Expose
public static MethodNode findMethodFromMCP(ClassNode cn, String mcpName, String mcpDescriptor, boolean optional) {
val classMapping = discoverClassMappingType(cn);
if (classMapping == null) {
@@ -121,7 +114,6 @@ public class ASMUtil {
return findMethodStandard(cn, method.getName(classMapping), method.getDescriptor(classMapping), optional);
}
@StableAPI.Expose
public static MethodNode findMethodFromUniversal(ClassNode cn, UniversalMethod method, boolean optional) {
String[] possibleNames = CoreLoadingPlugin.isObfuscated() ? new String[]{method.getName(MappingType.SRG),
method.getName(MappingType.Notch)}
@@ -142,7 +134,6 @@ public class ASMUtil {
possibleDescriptors.length == 1 ? possibleDescriptors[0] : Arrays.toString(possibleDescriptors));
}
@StableAPI.Expose
public static MappingType discoverClassMappingType(ClassNode cn) {
if (!CoreLoadingPlugin.isObfuscated()) {
if (MappingManager.containsClass(NameType.Internal, MappingType.MCP, cn.name)) {
@@ -156,7 +147,6 @@ public class ASMUtil {
return null;
}
@StableAPI.Expose
public static UniversalClass toUniversalClass(ClassNode cn) {
if (!CoreLoadingPlugin.isObfuscated()) {
try {
@@ -177,7 +167,6 @@ public class ASMUtil {
}
}
@StableAPI.Expose
public static ClassNode parseClass(byte[] bytes, int readerFlags) {
val cn = new ClassNode(Opcodes.ASM5);
val reader = new ClassReader(bytes);
@@ -185,14 +174,12 @@ public class ASMUtil {
return cn;
}
@StableAPI.Expose
public static byte[] serializeClass(ClassNode cn, int writerFlags) {
val writer = new ClassWriter(writerFlags);
cn.accept(writer);
return writer.toByteArray();
}
@StableAPI.Expose
public static boolean anyEquals(String str, String... options) {
for (val option : options) {
if (Objects.equals(str, option)) {
@@ -21,29 +21,21 @@
*/
package com.falsepattern.lib.asm;
import com.falsepattern.lib.DeprecationDetails;
import com.falsepattern.lib.StableAPI;
import org.objectweb.asm.tree.ClassNode;
/**
* See: {@link com.falsepattern.lib.turboasm.TurboClassTransformer}.
* This class will not be removed, for backwards compatibility reasons.
*/
@StableAPI(since = "0.10.0")
@Deprecated
@DeprecationDetails(deprecatedSince = "1.2.0")
@Deprecated(since = "1.2.0")
public interface IClassNodeTransformer {
@StableAPI.Expose
String getName();
@StableAPI.Expose
boolean shouldTransform(ClassNode cn, String transformedName, boolean obfuscated);
@StableAPI.Expose
default int internalSortingOrder() {
return 0;
}
@StableAPI.Expose
void transform(ClassNode cn, String transformedName, boolean obfuscated);
}
@@ -21,8 +21,6 @@
*/
package com.falsepattern.lib.asm;
import com.falsepattern.lib.DeprecationDetails;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.asm.CoreLoadingPlugin;
import lombok.val;
import org.apache.logging.log4j.Logger;
@@ -39,14 +37,10 @@ import java.util.List;
* See: {@link com.falsepattern.lib.turboasm.MergeableTurboTransformer}.
* This class will not be removed, for backwards compatibility reasons.
*/
@StableAPI(since = "0.10.0")
@Deprecated
@DeprecationDetails(deprecatedSince = "1.2.0")
@Deprecated(since = "1.2.0")
public interface SmartTransformer extends IClassTransformer {
@StableAPI.Expose
Logger logger();
@StableAPI.Expose
List<IClassNodeTransformer> transformers();
@Override
@@ -21,11 +21,10 @@
*/
package com.falsepattern.lib.asm.exceptions;
import com.falsepattern.lib.StableAPI;
import org.jetbrains.annotations.ApiStatus;
@StableAPI(since = "0.10.0")
public class AsmClassNotFoundException extends AsmTransformException {
@StableAPI.Internal
@ApiStatus.Internal
public AsmClassNotFoundException(final String clazz) {
super("can't find class " + clazz);
}
@@ -21,11 +21,10 @@
*/
package com.falsepattern.lib.asm.exceptions;
import com.falsepattern.lib.StableAPI;
import org.jetbrains.annotations.ApiStatus;
@StableAPI(since = "0.10.0")
public class AsmFieldNotFoundException extends AsmTransformException {
@StableAPI.Internal
@ApiStatus.Internal
public AsmFieldNotFoundException(final String field) {
super("can't find field " + field);
}
@@ -21,10 +21,10 @@
*/
package com.falsepattern.lib.asm.exceptions;
import com.falsepattern.lib.StableAPI;
import org.jetbrains.annotations.ApiStatus;
@StableAPI(since = "0.10.0")
public class AsmMethodNotFoundException extends AsmTransformException {
@ApiStatus.Internal
public AsmMethodNotFoundException(final String method) {
super("can't find method " + method);
}
@@ -21,21 +21,15 @@
*/
package com.falsepattern.lib.asm.exceptions;
import com.falsepattern.lib.StableAPI;
@StableAPI(since = "0.10.0")
public class AsmTransformException extends RuntimeException {
@StableAPI.Expose
public AsmTransformException(final String message) {
super(message);
}
@StableAPI.Expose
public AsmTransformException(final Throwable cause) {
super(cause);
}
@StableAPI.Expose
public AsmTransformException(final String message, final Throwable cause) {
super(message, cause);
}
@@ -0,0 +1,26 @@
/*
* This file is part of FalsePatternLib.
*
* Copyright (C) 2022-2025 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* FalsePatternLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* FalsePatternLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FalsePatternLib. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @since 0.10.0
*/
package com.falsepattern.lib.asm.exceptions;
@@ -0,0 +1,26 @@
/*
* This file is part of FalsePatternLib.
*
* Copyright (C) 2022-2025 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* FalsePatternLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* FalsePatternLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FalsePatternLib. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @since 0.10.0
*/
package com.falsepattern.lib.asm;