Record Patterns and Pattern Switches in Eclipse 2023-09 (4.29)

Add this URL to your Eclipse Installation to reach this solution's update site.

2023-09 (4.29), 2023-12 (4.30), 2024-03 (4.31)

https://download.eclipse.org/eclipse/updates/4.29-P-builds/

Learn more...
Solution Description

This marketplace solution provides support for Java 21 standard language features for Eclipse 2023-09 (4.29). To install the feature place ensure you have the latest Eclipse release, which is 4.29.

You can also install this feature from the following p2 update site directly:

https://download.eclipse.org/eclipse/updates/4.29-P-builds/

Installation can be verified by creating a java project with default execution environment as Java-21

Categories: Editor, IDE, Languages

Additional Details

Eclipse Versions: 2023-09 (4.29), 2023-12 (4.30), 2024-03 (4.31)

Platform Support: Windows, Mac, Linux/GTK

Organization Name: Eclipse Foundation

Development Status: Production/Stable

Date Created: Tuesday, September 19, 2023 - 06:14

License: EPL 2.0

Date Updated: Monday, November 20, 2023 - 01:52

Submitted by: Jay Arthanareeswaran

Date Ranking Installs Clickthroughs
May 2024 186/659 94 11
April 2024 190/687 125 11
March 2024 165/694 175 5
February 2024 159/687 174 4
January 2024 135/691 240 13
December 2023 76/671 490 14
November 2023 33/686 1375 29
October 2023 29/673 1809 24
September 2023 45/663 1089 27
August 2023 0/0 0 0
July 2023 0/0 0 0
June 2023 0/0 0 0
View Data for all Listings

Unsuccessful Installs

Unsuccessful Installs in the last 7 Days: 2

Download last 500 errors (CSV)

Marketplace Drag to Install Button

By adding the following code below to your website you will be able to add an install button for Record Patterns and Pattern Switches in Eclipse 2023-09 (4.29).

HTML Code:

Markdown Syntax:

Output:

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

Reviews Add new review

I believe there is a problem with the switch statement when guarded patterns are used. For example,

public static void foo( Object obj ) {
  switch ( obj ) {
    case null -> System.out.println( "NULL" );
    case Integer x when x > 0 -> System.out.println( "Positive Integer: " + x );
    case Integer x when x < 0 -> System.out.println( "Negatve Integer: " + x );
    case Integer x -> System.out.println( "Integer: " + x );
    default -> System.out.println( "OTHER: " + obj );
  }
}

which I tested with

public static void main( String[] args ) {
  Stream.of( 0, 42, -42 ).forEach( n -> foo( n ) );
}

should produce

Integer: 0
Negatve Integer: -42
Positive Integer: 42

but my results are

Integer: 0
Positive Integer: 42
Integer: -42

I have confirmed that I get the correct results when using Oracle's compiler. 

NOTE, when I remove the null case the results are correct. 

I really *need* the String Template preview feature in Oracle's JDK-21 release but it is not supported in this plugin. So I can use this preview feature from the command line but not through Eclipse. <Sigh>