linkedin / linkedin/dexmaker

Why Code#compare parameter order is reversed after generated dex?

Open
#180 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2k
Forks
262
PR merge metrics
No merged PRs in 30d

Description

I have the following code:

Local local1 = methodCodeBlock.newLocal(TypeId.INT);
Local parameter = methodCodeBlock.getParameter(0, TypeId.INT);
            
...
     
methodCodeBlock.compare(Comparison.LT, label, local1, parameter);

The expected result should be:

if(local1 >= parameter)
...

But when I invoke the DexMaker#generate, the result I see is:

if(parameter >= local1)
...

Is this a bug? Or am I using it incorrectly? If I use it incorrectly, can someone tell me how to use it correctly? Thank a lot!
Is this project still alive? The last update I saw was last May

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the shown compare(...) call as a reproduction, then inspect Code#compare and DexMaker#generate to trace operand ordering in the generated dex. Done means confirming whether the reversal is expected or fixing it, with the correct usage or behavior verified against the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
devtools, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.