Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 21 #1370

Merged
merged 7 commits into from
Nov 28, 2023
Merged

Java 21 #1370

merged 7 commits into from
Nov 28, 2023

Conversation

TwoOfTwelve
Copy link
Contributor

@TwoOfTwelve TwoOfTwelve commented Nov 5, 2023

To update java for java 21 the following things have to be done:

  • Update java version in pom.xml
  • Update java version in workflow files
  • Update expected java version for tests
  • Verify the old tests are still working
  • Write rules and tests for new java features
  • Verify the rules below indeed do not impact jplag
  • Enable Previews
  • Right now the java version for enabling previews is hard coded. It should be unified with the version in NewJavaFeaturesTest

The following new features are relevant to jplag:

  • Record Patterns and Pattern matching for switch have been finalized
    Works without changes
  • String templates (preview)
    Works without changes
  • Unnamed patterns and variables (preview)
    Ignore vardefs without name (javac maps "_" to an empty string)
  • Anonymous classes. Produced negative positions for end of class tokens
  • Guards for cases. Should be extracted as an additional if.

The following changes should not impact jplag:

  • Virtual threads / Structured concurrency
  • Foreign function api (preview) [maybe poses problems for obfuscation of plagiarisms]
  • Scoped values

@TwoOfTwelve TwoOfTwelve changed the title Updated java version in workflow files and pom.xml Java 21 Nov 5, 2023
@TwoOfTwelve TwoOfTwelve added this to the v5.0.0 milestone Nov 7, 2023
@TwoOfTwelve TwoOfTwelve self-assigned this Nov 14, 2023
@TwoOfTwelve TwoOfTwelve marked this pull request as ready for review November 18, 2023 08:56
@TwoOfTwelve
Copy link
Contributor Author

Solves #1319

@SirYwell
Copy link
Contributor

There are a few things that aren't really covered:

  • case pattern with guards (case Integer i when i > 0:)
    • it might make sense to desugar it into an if
  • JEP 445 (though it might make sense to skip that, there are a few changes to how the compiler handles it in Java 22)

Is that intentional?

@TwoOfTwelve
Copy link
Contributor Author

Thank you. I missed those two things. JPlag works with anonymous classes. There was just a minor error with negative code positions. The order of tokens might be weird, but as this is still just a preview feature I think that is ok.

For guards I added a rule to generate an additional IF and IF_END token, the same way it would be done if there was an if in the case body instead.

@tsaglam tsaglam added enhancement Issue/PR that involves features, improvements and other changes minor Minor issue/feature/contribution/change language PR / Issue deals (partly) with new and/or existing languages for JPlag labels Nov 22, 2023
Copy link
Member

@Kr0nox Kr0nox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small thing

@tsaglam tsaglam merged commit c88cbf8 into develop Nov 28, 2023
8 checks passed
@tsaglam tsaglam deleted the feature/java-21 branch November 28, 2023 15:56
This was referenced Nov 28, 2023
@dfuchss
Copy link
Member

dfuchss commented Dec 1, 2023

-> https://github.com/jplag/JPlag/actions/runs/7057421814/workflow#L54

It seems that you've missed one last line :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue/PR that involves features, improvements and other changes language PR / Issue deals (partly) with new and/or existing languages for JPlag minor Minor issue/feature/contribution/change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants