Skip to content

Some questions #14

@satsen

Description

@satsen

First of all, thank you for this great library. It is so much simpler than ASM and I can actually do things with it.

I have 2 questions, and I hope that you will be able to help me.

How do I obtain a "Variable" (I think it's not the right thing for this use-case, but I did not find an alternative) for a constant/literal value? Say if I have a boolean variable that I want to assign the expression 1L < 4L to, the only way I found is to do mm.var(long.class).set(1L).lt(4L) which generates:

long var2 = 1L;
boolean var3 = var2 < 4L;

but I tried compiling a class with javac and I got the much simpler

boolean var1 = 1L < 4L;

(javac optimizes this but I tried with a more difficult expression, it still did not generate a single-use variable).

And then that var3 is used in a method invocation, so there's 2 redundant variables. I would love to get to know how I could for example do a simple method(1L < 4L) without 2 redundant variables.

How do I perform logical operations? Like, how can I get a var1 && var2 or a var1 || var2 expression? I only found the bitwise options in the API.

If these could be added to the wiki it would be great. Thanks again for the library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions