JDK-8305733 : Pattern.CASE_INSENSITIVE does not take effect in jdk11
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.regex
  • Affected Version: 8,11
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2023-04-06
  • Updated: 2024-03-25
  • Resolved: 2024-03-25
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.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
System:
Ubuntu 22.04.2 LTS on Windows 10 x86_64

Java Runtime Information:
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment 18.9 (build 11.0.12+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode)

A DESCRIPTION OF THE PROBLEM :
Pattern.CASE_INSENSITIVE does not take effect in jdk11, but it can match characters normally when using jdk17

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run included source code.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Pattern.compile("some\\p{javaLowerCase}*Name", Pattern.CASE_INSENSITIVE) can match the value of "someOtherName"

---------- BEGIN SOURCE ----------
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class BugReport {
    public static void main(String[] args) {
        Pattern normalisedCamelCasePattern = Pattern.compile("some\\p{javaLowerCase}*Name", Pattern.CASE_INSENSITIVE);
        ArrayList<String> candidates = new ArrayList<>();
        candidates.add("someName");
        candidates.add("someOtherName");
        for (String candidate : candidates) {
            Matcher matcher = normalisedCamelCasePattern.matcher(candidate);
            if (matcher.lookingAt()) {
                System.out.println("success:" + candidate);
            } else {
                System.out.println("fail:" + candidate);
            }
        }
    }
}
---------- END SOURCE ----------

FREQUENCY : rarely



Comments
What is the difference of this change to a full backport of JDK-8214245? If there's no difference, this should be a backport of JDK-8214245. And then we'd also need to file a CSR. Removing the fix request label for now until these questions are settled.
31-08-2023

Fix Request (11u). From Korov, https://github.com/openjdk/jdk11u-dev/pull/2062. Here we test whether the matching of Posix character, Unicode character, Unicode categories, aliases, properties, and java methods is correct under the condition of ignoring case. Currently considered no risk.
30-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/2061 Date: 2023-07-27 14:47:47 +0000
27-07-2023

This was fixed in JDK-8214245 (CSR JDK-8238984 and RN JDK-8239887) for JDK 15 onwards. Since the fix required a CSR with medium behavioral compatibility issues, it won't probably be backported in 11 and 8.
11-05-2023

The observations on Windows 10: JDK 8: Failed, someOtherName failed. JDK 11: Failed. JDK 17: Passed. JDK 20: Passed. JDK21ea+5: Passed.
07-04-2023