RFR: 8256411: Based anonymous classes have a weird end position

Jan Lahoda jlahoda at openjdk.java.net
Mon Nov 16 18:17:09 UTC 2020


Consider code like this:

package t;
class Test {
    class I {}
    static Object S = new Test().new I() {};
}

There is a synthetically generated `Test.I` in the extends clause of the anonymous class. The current end position for it is the end of the whole anonymous class (i.e. at '}'), which does not make much sense. The proposal is that the end position should be the end position of the "I" identifier, which is the same as if the anonymous class would not be based on an enclosing instance.

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

Commit messages:
 - 8256411: Based anonymous classes have a weird end position

Changes: https://git.openjdk.java.net/jdk/pull/1232/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1232&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8256411
  Stats: 39 lines in 3 files changed: 35 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1232.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1232/head:pull/1232

PR: https://git.openjdk.java.net/jdk/pull/1232


More information about the compiler-dev mailing list