Skip to content

Commit

Permalink
fix: Fail to compile expressions in constructors #407
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Oct 4, 2021
1 parent 846fee9 commit 1bb163f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -3,7 +3,7 @@
<groupId>me.coley</groupId>
<artifactId>recaf</artifactId>
<url>https://github.com/Col-E/Recaf/</url>
<version>2.21.0</version>
<version>2.21.1</version>
<name>Recaf</name>
<description>A modern java bytecode editor</description>
<!-- Variables -->
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/coley/recaf/Recaf.java
Expand Up @@ -31,7 +31,7 @@
* @author Matt
*/
public class Recaf {
public static final String VERSION = "2.21.0";
public static final String VERSION = "2.21.1";
public static final String DOC_URL = "https://col-e.github.io/Recaf-documentation/";
public static final int ASM_VERSION = Opcodes.ASM9;
private static Controller currentController;
Expand Down
Expand Up @@ -165,7 +165,12 @@ public void addExpression(String expression, AST ast) throws AssemblerException
try {
InputStream stream = new ByteArrayInputStream(controller.getWorkspace().getRawClass(declaringType));
CtClass declaring = ClassPool.getDefault().makeClass(stream);
CtBehavior containerMethod = declaring.getMethod(node.name, node.desc);
CtBehavior containerMethod;
if (node.name.equals("<init>")) {
containerMethod = declaring.getConstructor(node.desc);
} else {
containerMethod = declaring.getMethod(node.name, node.desc);
}
// Compile with Javassist
JavassistCompilationResult result =
JavassistCompiler.compileExpression(declaring, containerMethod, expression,
Expand Down
1 change: 0 additions & 1 deletion src/main/java/me/coley/recaf/ui/controls/ActionMenu.java
Expand Up @@ -39,7 +39,6 @@ public ActionMenu(String text, Node graphic, Runnable action) {
setGraphic(new HBox(graphic, label));
else
setGraphic(label);
setOnMenuValidation(e -> System.out.println("v"));
label.setOnMousePressed(e -> action.run());
}
}

0 comments on commit 1bb163f

Please sign in to comment.