fix: keyword is not allowed for classname

This commit is contained in:
ReaJason
2025-02-19 00:04:29 +08:00
parent e10915784c
commit 6810bea753
7 changed files with 64 additions and 6 deletions
@@ -44,7 +44,7 @@ public class BehinderManager {
@SneakyThrows
public boolean test() {
byte[] bytes = new ByteBuddy(ClassFileVersion.JAVA_V6).redefine(Test.class)
.name(Utils.getRandomClassName(Test.class.getName()))
.name(Utils.getRandomClassName())
.visit(new TargetJreVersionVisitorWrapper(Opcodes.V1_6))
.make().getBytes();
String param = "xixi";
@@ -20,7 +20,7 @@ public class Utils {
return sb.toString();
}
public static String getRandomClassName(String sourceName) {
public static String getRandomClassName() {
String[] domainAs = new String[]{"com", "net", "org", "sun"};
String domainB = getRandomAlpha((new Random()).nextInt(5) + 3).toLowerCase();
String domainC = getRandomAlpha((new Random()).nextInt(5) + 3).toLowerCase();