Coder Social home page Coder Social logo

Compiler error with Java 21 about named-regexp HOT 4 CLOSED

cushon avatar cushon commented on April 28, 2024
Compiler error with Java 21

from named-regexp.

Comments (4)

tony19 avatar tony19 commented on April 28, 2024 1

Hmm. This library is a backport of named capture groups, which were introduced in Java 7. If you can target Java 8, why would you need to use this library? What am I missing?

If it really is needed, I suppose I could create a major release that renames namedGroups() to namedGroupsList() as an upgrade path.

from named-regexp.

tony19 avatar tony19 commented on April 28, 2024 1

I decided to address the problem anyway.

Fixed in #74, released in v1.0.0.

from named-regexp.

cushon avatar cushon commented on April 28, 2024

The namedGroups() API was added to the JDK in JDK 20: https://bugs.openjdk.org/browse/JDK-8292872

The repro also required updating the source version to 1.8:

diff --git a/pom.xml b/pom.xml
index c88cba2..2f96e9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,8 +60,8 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
-    <maven.compiler.source>1.6</maven.compiler.source>
-    <maven.compiler.target>1.6</maven.compiler.target>
+    <maven.compiler.source>8</maven.compiler.source>
+    <maven.compiler.target>8</maven.compiler.target>
   </properties>

   <build>

from named-regexp.

cushon avatar cushon commented on April 28, 2024

Thanks, that is a good question! I noticed this because my employer builds third party dependencies from source, and I was testing with Java 21. We were using named-regexp as a dependency of https://github.com/contentful/contentful.java

Using java.util.regex instead of the backport works for me, I also sent a PR to update contentful: contentful/contentful.java#297

from named-regexp.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.