java: fix aliasing FP

reorganise code, adding `LockField`
This commit is contained in:
yoff
2025-10-27 14:30:25 +01:00
parent 531b994819
commit 406e48b3bb
3 changed files with 32 additions and 20 deletions

View File

@@ -1,4 +1,3 @@
| examples/Alias.java:16:13:16:13 | y | This field access (publicly accessible via $@) is not protected by any monitor, but the class is annotated as @ThreadSafe. | examples/Alias.java:16:13:16:13 | y | this expression |
| examples/C.java:14:9:14:14 | this.y | This field access (publicly accessible via $@) is not protected by any monitor, but the class is annotated as @ThreadSafe. | examples/C.java:14:9:14:14 | this.y | this expression |
| examples/C.java:15:9:15:14 | this.y | This field access (publicly accessible via $@) is not protected by any monitor, but the class is annotated as @ThreadSafe. | examples/C.java:15:9:15:14 | this.y | this expression |
| examples/C.java:16:9:16:14 | this.y | This field access (publicly accessible via $@) is not protected by any monitor, but the class is annotated as @ThreadSafe. | examples/C.java:16:9:16:14 | this.y | this expression |

View File

@@ -13,7 +13,7 @@ public class Alias {
final ReentrantLock lock = this.lock;
lock.lock();
try {
y = 42; // $ SPURIOUS: Alert
y = 42;
} finally {
this.lock.unlock();
}