From 7da81ca1bbcb3f21039a6a29a7e4a42916bf12a8 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 10 Jan 2025 23:32:06 -0500 Subject: [PATCH] Fix anonymous classes being included in class stubs --- .../recaf/services/compile/stub/ClassStubGenerator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recaf-core/src/main/java/software/coley/recaf/services/compile/stub/ClassStubGenerator.java b/recaf-core/src/main/java/software/coley/recaf/services/compile/stub/ClassStubGenerator.java index 40bd8d139..8c1e4a1e8 100644 --- a/recaf-core/src/main/java/software/coley/recaf/services/compile/stub/ClassStubGenerator.java +++ b/recaf-core/src/main/java/software/coley/recaf/services/compile/stub/ClassStubGenerator.java @@ -279,7 +279,8 @@ else if (method.hasPrivateModifier()) NameType paramInfo = getInfo("p" + i, paramType.descriptor()); code.append(paramInfo.className).append(' ').append(paramInfo.name); - if (i < parameterCount - 1) code.append(", "); + if (i < parameterCount - 1) + code.append(", "); } code.append(") { "); if (isCtor) { @@ -339,6 +340,8 @@ protected void appendInnerClasses(@Nonnull StringBuilder code) throws Expression continue; if (innerClassName.length() <= className.length()) continue; + if (!isSafeClassName(innerClassName.replace('/', '.').replace('$', '.'))) + continue; ClassPathNode innerClassPath = workspace.findClass(innerClassName); if (innerClassPath != null) { ClassInfo innerClassInfo = innerClassPath.getValue();