JDK-8312821 : Javac accepts char literal as template
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-07-25
  • Updated: 2023-08-10
  • Resolved: 2023-08-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 b10Fixed
Related Reports
Relates :  
Description
Code:

public class Demo {
    public static void main(String[] args) {
        System.out.println(STR.'\{1+2}');
    }
}

Latest javac (build 22-ea+7-489) compiles this and produces 3 as an
output. I believe this is a mistake in the compiler.

Comments
Changeset: bc1d2eac Author: Jim Laskey <jlaskey@openjdk.org> Date: 2023-08-02 21:01:44 +0000 URL: https://git.openjdk.org/jdk/commit/bc1d2eac9abd5fb38402113c7f0805c21ef7787f
02-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15106 Date: 2023-08-01 15:28:06 +0000
01-08-2023