In addition to being potentially extremely CPU intensive when little work is done inside the loop, such loops are likely have different semantics than intended, as the Java Memory Model allows such field accesses to be hoisted out of the loop, causing the loop to never complete even if another thread does change the field's value.
Additionally since Java 9 it's recommended to call Thread.onSpinWait()
inside spin loop
on a volatile field which may significantly improve performance on some hardware.