diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index de1f16f41..b2b6f849a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,7 +19,7 @@ image-io-ext-ico = "3.0.2" instrument-server = "1.4.2" jackson = "2.17.1" jakarta-annotation = "3.0.0" -jasm = "471022383c" +jasm = "8fb350ce7d" jlinker = "1.0.7" jphantom = "1.4.4" junit = "5.11.0" diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/resolve/AssemblyResolver.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/resolve/AssemblyResolver.java index e5355cde3..371f2bf3b 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/resolve/AssemblyResolver.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/resolve/AssemblyResolver.java @@ -97,7 +97,10 @@ private static AssemblyResolution resolveAt(int position, @Nullable ASTClass par return new TypeReferenceResolution(parentClassDec, method, (ASTIdentifier) selectedType); } - ASTElement selectedAnno = get(position, method.getAnnotations()); + ASTElement selectedAnno = get(position, method.getVisibleAnnotations()); + if (selectedAnno != null) + return new MethodAnnotationResolution(parentClassDec, method, (ASTAnnotation) selectedAnno); + selectedAnno = get(position, method.getInvisibleAnnotations()); if (selectedAnno != null) return new MethodAnnotationResolution(parentClassDec, method, (ASTAnnotation) selectedAnno); @@ -119,7 +122,10 @@ else if (selectedInstruction != null) { return new MethodResolution(parentClassDec, method); } else if (child instanceof ASTField field) { - ASTElement selectedAnno = get(position, field.getAnnotations()); + ASTElement selectedAnno = get(position, field.getVisibleAnnotations()); + if (selectedAnno != null) + return new FieldAnnotationResolution(parentClassDec, field, (ASTAnnotation) selectedAnno); + selectedAnno = get(position, field.getInvisibleAnnotations()); if (selectedAnno != null) return new FieldAnnotationResolution(parentClassDec, field, (ASTAnnotation) selectedAnno); @@ -133,7 +139,10 @@ else if (selectedInstruction != null) { if (selectedInner != null) return new InnerClassResolution(klass, (ASTInner) selectedInner); - ASTElement selectedAnno = get(position, klass.getAnnotations()); + ASTElement selectedAnno = get(position, klass.getVisibleAnnotations()); + if (selectedAnno != null) + return new ClassAnnotationResolution(klass, (ASTAnnotation) selectedAnno); + selectedAnno = get(position, klass.getInvisibleAnnotations()); if (selectedAnno != null) return new ClassAnnotationResolution(klass, (ASTAnnotation) selectedAnno); diff --git a/recaf-ui/src/main/resources/syntax/jasm.json b/recaf-ui/src/main/resources/syntax/jasm.json index 71cb9f878..7b9334294 100644 --- a/recaf-ui/src/main/resources/syntax/jasm.json +++ b/recaf-ui/src/main/resources/syntax/jasm.json @@ -29,7 +29,7 @@ }, { "name": "Keywords", - "regex": "\\b(?:method|field|class|implements|inner|annotation|code|parameters|exceptions|sourcefile|public|private|native|abstract|interface|synthetic|strict|enum|super|module|synchronizer|bridge|varargs|volatile|transient|static|final|protected|aaload|aastore|aconst_null|aload|aload_0|aload_1|aload_2|aload_3|anewarray|areturn|arraylength|astore|astore_0|astore_1|astore_2|astore_3|athrow|baload|bastore|bipush|caload|castore|checkcast|d2f|d2i|d2l|dadd|daload|dastore|dcmpg|dcmpl|dconst_0|dconst_1|ddiv|dload|dload_0|dload_1|dload_2|dload_3|dmul|dneg|drem|dreturn|dstore|dstore_0|dstore_1|dstore_2|dstore_3|dsub|dup|dup_x1|dup_x2|dup2|dup2_x1|dup2_x2|f2d|f2i|f2l|fadd|faload|fastore|fcmpg|fcmpl|fconst_0|fconst_1|fconst_2|fdiv|fload|fload_0|fload_1|fload_2|fload_3|fmul|fneg|frem|freturn|fstore|fstore_0|fstore_1|fstore_2|fstore_3|fsub|getfield|getstatic|goto|goto_w|i2b|i2c|i2d|i2f|i2l|i2s|iadd|iaload|iand|iastore|iconst_0|iconst_1|iconst_2|iconst_3|iconst_4|iconst_5|iconst_m1|idiv|if_acmpeq|if_acmpne|if_icmple|if_icmpeq|if_icmpne|if_icmplt|if_icmpge|if_icmpgt|if_icmple|ifeq|ifne|iflt|ifge|ifgt|ifle|ifnonnull|ifnull|iinc|iload|iload_0|iload_1|iload_2|iload_3|imul|ineg|instanceof|invokedynamic|invokeinterface|invokespecial(?:interface)?|invokestatic(?:interface)?|invokevirtual(?:interface)?|ior|irem|ireturn|ishl|ishr|istore|istore_0|istore_1|istore_2|istore_3|isub|iushr|ixor|jsr|jsr_w|l2d|l2f|l2i|ladd|laload|land|lastore|lcmp|lconst_0|lconst_1|ldc|ldc_w|ldc2_w|ldiv|lload|lload_0|lload_1|lload_2|lload_3|lmul|lneg|lookupswitch|lor|lrem|line|lreturn|lshl|lshr|lstore|lstore_0|lstore_1|lstore_2|lstore_3|lsub|lushr|lxor|monitorenter|monitorexit|multianewarray|new|newarray|nop|pop|pop2|putfield|putstatic|ret|return|saload|sastore|sipush|swap|tableswitch|wide)\\b", + "regex": "\\b(?:method|field|class|implements|inner|(?:(?:in)?visible-)?annotation|code|parameters|exceptions|sourcefile|default-value|public|private|native|abstract|interface|synthetic|strict|enum|super|module|synchronized|bridge|varargs|volatile|transient|static|final|protected|aconst_null|anewarray|areturn|arraylength|athrow|bipush|checkcast|d2(?:f|i|l)|dadd|dcmpg|dcmpl|dconst_(?:1|0)|ddiv|dmul|dneg|drem|dreturn|dsub|dup(?:2|_x1|_x2|2_x1|2_x2)?|f2(?:d|i|l)|fadd|fcmpg|fcmpl|fconst_(?:0|1|2)|fdiv|fmul|fneg|frem|freturn|fsub|get(?:field|static)|goto|i2(?:b|c|d|f|l|s)|iadd|iand|iconst_(?:0|1|2|3|4|5|m1)|idiv|if_(?:acmp(?:ne|eq)|icmp(?:le|eq|ne|lt|ge|gt|le))\n|if(?:eq|ne|lt|ge|gt|le|nonnull|null)|iinc|imul|ineg|instanceof|invoke(?:dynamic|interface|special(?:interface)?|static(?:interface)?|virtual(?:interface)?)|ior|irem|ireturn|ishl|ishr|(?:a|i|f|d|l)store|(?:a|i|f|d|l)load|(?:c|l|b|s|d|f|i)astore|(?:c|l|b|s|d|f|i)aload|isub|iushr|ixor|jsr|l2(?:d|f|i)|ladd|land|lcmp|lconst_(?:0|1)|ldc|ldiv|lmul|lneg|lookupswitch|lor|lrem|line|lreturn|lshl|lshr|lstore|lsub|lushr|lxor|monitor(?:enter|exit)|multianewarray|new(?:array)?|nop|pop(?:2)?|put(?:field|static)|ret(?:urn)?|sipush|swap|tableswitch|wide)\\b", "classes": [ "keyword" ],