Questions tagged [varhandle]
2 questions
2
votes
2 answers
Can't load hidden class with VarHandle
I am trying to load a class as a hidden class in Java, but run into a VerifyError. The class uses a VarHandle, which has a PolymorphicSignature. I believe the error is implying that the polymorphic call is using the non-hidden class, but it's not…

Carl Mastrangelo
- 5,970
- 1
- 28
- 37
0
votes
0 answers
Have I implemented an atomic circular counter correctly using VarHandles
My code:
static final VarHandle COUNTER_VAR_HANDLE = //;
static final int MAX = 10;
int counter = -1;
int getNext() {
var next = 0;
var prev = 0;
do {
prev = (int) COUNTER_VAR_HANDLE.getOpaque(this);
next = (prev + 1) % MAX;
}…

Cheetah
- 13,785
- 31
- 106
- 190