forked from phoedos/pmd
[java] Add new language version 23 and 23-preview
This commit is contained in:
parent
10add3f0f7
commit
568314bb89
@ -2,7 +2,7 @@
|
||||
title: Java support
|
||||
permalink: pmd_languages_java.html
|
||||
author: Clément Fournier
|
||||
last_updated: December 2023 (7.0.0)
|
||||
last_updated: July 2024 (7.5.0)
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
|
||||
summary: "Java-specific features and guidance"
|
||||
---
|
||||
@ -15,8 +15,10 @@ Usually the latest non-preview Java Version is the default version.
|
||||
|
||||
| Java Version | Alias | Supported by PMD since |
|
||||
|--------------|-------|------------------------|
|
||||
| 23-preview | | 7.5.0 |
|
||||
| 23 (default) | | 7.5.0 |
|
||||
| 22-preview | | 7.0.0 |
|
||||
| 22 (default) | | 7.0.0 |
|
||||
| 22 | | 7.0.0 |
|
||||
| 21-preview | | 7.0.0 |
|
||||
| 21 | | 7.0.0 |
|
||||
| 20 | | 6.55.0 |
|
||||
|
@ -213,7 +213,7 @@ accordingly and this rule won't be executed.
|
||||
The specific version of a language to be used is selected via the `sourceLanguage`
|
||||
nested element. Example:
|
||||
|
||||
<sourceLanguage name="java" version="22"/>
|
||||
<sourceLanguage name="java" version="23"/>
|
||||
|
||||
The available versions depend on the language. You can get a list of the currently supported language versions
|
||||
via the CLI option `--help`.
|
||||
|
@ -53,6 +53,7 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest {
|
||||
"java-20",
|
||||
"java-21", "java-21-preview",
|
||||
"java-22", "java-22-preview",
|
||||
"java-23", "java-23-preview",
|
||||
"java-5", "java-6", "java-7",
|
||||
"java-8", "java-9", "jsp-2", "jsp-3", "kotlin-1.6",
|
||||
"kotlin-1.7", "kotlin-1.8", "modelica-3.4", "modelica-3.5",
|
||||
|
@ -44,8 +44,10 @@ public class JavaLanguageModule extends LanguageModuleBase implements PmdCapable
|
||||
.addVersion("20")
|
||||
.addVersion("21")
|
||||
.addVersion("21-preview")
|
||||
.addDefaultVersion("22") // 22 is the default
|
||||
.addVersion("22-preview"));
|
||||
.addVersion("22")
|
||||
.addVersion("22-preview")
|
||||
.addDefaultVersion("23") // 23 is the default
|
||||
.addVersion("23-preview"));
|
||||
}
|
||||
|
||||
public static JavaLanguageModule getInstance() {
|
||||
|
@ -24,8 +24,8 @@ class JavaLanguageModuleTest {
|
||||
|
||||
@Test
|
||||
void previewVersionShouldBeGreaterThanNonPreview() {
|
||||
LanguageVersion java = JavaLanguageModule.getInstance().getVersion("22");
|
||||
LanguageVersion javaPreview = JavaLanguageModule.getInstance().getVersion("22-preview");
|
||||
LanguageVersion java = JavaLanguageModule.getInstance().getVersion("23");
|
||||
LanguageVersion javaPreview = JavaLanguageModule.getInstance().getVersion("23-preview");
|
||||
|
||||
assertTrue(javaPreview.compareTo(java) > 0, "java-preview should be greater than java");
|
||||
}
|
||||
|
@ -41,8 +41,10 @@ class LanguageVersionTest extends AbstractLanguageVersionTest {
|
||||
new TestDescriptor(java, "21-preview"),
|
||||
new TestDescriptor(java, "22"),
|
||||
new TestDescriptor(java, "22-preview"),
|
||||
new TestDescriptor(java, "23"),
|
||||
new TestDescriptor(java, "23-preview"),
|
||||
|
||||
defaultVersionIs(java, "22"),
|
||||
defaultVersionIs(java, "23"),
|
||||
|
||||
// this one won't be found: case-sensitive!
|
||||
versionDoesNotExist("JAVA", "JAVA", "1.7"),
|
||||
|
@ -36,7 +36,8 @@ enum class JavaVersion : Comparable<JavaVersion> {
|
||||
J19,
|
||||
J20,
|
||||
J21, J21__PREVIEW,
|
||||
J22, J22__PREVIEW;
|
||||
J22, J22__PREVIEW,
|
||||
J23, J23__PREVIEW;
|
||||
|
||||
/** Name suitable for use with e.g. [JavaParsingHelper.parse] */
|
||||
val pmdName: String = name.removePrefix("J").replaceFirst("__", "-").replace('_', '.').lowercase()
|
||||
|
Loading…
x
Reference in New Issue
Block a user