[lworld] RFR: 8292753: [lworld] javac is accepting erroneous synchronized statements

Vicente Romero vromero at openjdk.org
Tue Aug 23 18:33:49 UTC 2022


javac should issue an error for this code:

value class C<T extends C> {
    void m(T t) {
        synchronized(t) {}
    }
}

as type variable T is bounded by a value class. Also code like this one should be rejected:

value class C<T extends C> {
    void foo(Object o) {
        synchronized ((C & I)o) {} // one of the superclasses of the intersection type is a value class
    }
}

-------------

Commit messages:
 - 8292753: [lworld] missing javac errors for synchronized statement

Changes: https://git.openjdk.org/valhalla/pull/724/files
 Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=724&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8292753
  Stats: 41 lines in 3 files changed: 33 ins; 4 del; 4 mod
  Patch: https://git.openjdk.org/valhalla/pull/724.diff
  Fetch: git fetch https://git.openjdk.org/valhalla pull/724/head:pull/724

PR: https://git.openjdk.org/valhalla/pull/724


More information about the valhalla-dev mailing list