Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AtomicInteger - No such method : jdk/internal/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I #1012

Open
ap891843 opened this issue May 2, 2024 · 0 comments

Comments

@ap891843
Copy link

ap891843 commented May 2, 2024

Hi Team,

I encounter below error for my project, which seems to be due to AtomicInteger . Please find the below error trace by ByteCoder

public class Test11 {
  private final AtomicInteger count = new AtomicInteger();

  public static void main(String[] args) {
    Test11 test = new Test11();
    System.out.println("he;;p");
    System.out.println(test.updateCount());
    test.clear();
  }

  private int updateCount() {
    return this.count.incrementAndGet();
  }

  private void clear() {
    this.count.getAndSet(0);
  }
}
[ERROR] Failed to execute goal de.mirkosertic.bytecoder:bytecoder-mavenplugin:2023-12-01:compile (default) on project ByteCode2: Error running Bytecoder : 
[ERROR] Current Analysis Stack is :
[ERROR] Parsing method body of org.example.Test11.main
[ERROR]  Parsing method body of org.example.Test11.clear
[ERROR]   Parsing method body of java.util.concurrent.atomic.AtomicInteger.getAndSet
[ERROR]     Visiting #2 GETSTATIC Stack size is 0 Source line 122
[ERROR]     Local 0 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Local 1 of type I
[ERROR]     Visiting #3 ALOAD Stack size is 1 Source line 122
[ERROR]     Local 0 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Local 1 of type I
[ERROR]     Stack 0 of type Ljdk/internal/misc/Unsafe;
[ERROR]     Visiting #4 GETSTATIC Stack size is 2 Source line 122
[ERROR]     Local 0 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Local 1 of type I
[ERROR]     Stack 0 of type Ljdk/internal/misc/Unsafe;
[ERROR]     Stack 1 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Visiting #5 ILOAD Stack size is 3 Source line 122
[ERROR]     Local 0 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Local 1 of type I
[ERROR]     Stack 0 of type Ljdk/internal/misc/Unsafe;
[ERROR]     Stack 1 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Stack 2 of type J
[ERROR]     Visiting #6 INVOKEVIRTUAL Stack size is 4 Source line 122
[ERROR]     Local 0 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Local 1 of type I
[ERROR]     Stack 0 of type Ljdk/internal/misc/Unsafe;
[ERROR]     Stack 1 of type Ljava/util/concurrent/atomic/AtomicInteger;
[ERROR]     Stack 2 of type J
[ERROR]     Stack 3 of type I
[ERROR] : java.lang.IllegalStateException: No such method : jdk/internal/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I

@ap891843 ap891843 changed the title Support for AtomicInteger Support for AtomicInteger - No such method : jdk/internal/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant