Skip to content

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

@amanPras

Description

@amanPras

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions