aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-main/src/main
diff options
context:
space:
mode:
authorZipeng WU <zipeng.wu@sonarsource.com>2023-01-10 11:51:59 +0100
committersonartech <sonartech@sonarsource.com>2023-01-12 20:02:51 +0000
commitc6a817468bcd71129f9da2b453a5a91af62df570 (patch)
tree0b20f3dd739bcb89c0e802c2d51724cbe8a7e70e /server/sonar-main/src/main
parent2b61542b6a77fdfb62ff5a815856d3babee28a1a (diff)
downloadsonarqube-c6a817468bcd71129f9da2b453a5a91af62df570.tar.gz
sonarqube-c6a817468bcd71129f9da2b453a5a91af62df570.zip
[NO-JIRA] Use record for data classes
Diffstat (limited to 'server/sonar-main/src/main')
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java19
1 files changed, 3 insertions, 16 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java
index ea0a4ded5f9..f5637492a2c 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java
@@ -92,14 +92,14 @@ public class JvmOptions<T extends JvmOptions> {
private void checkMandatoryOptionOverwrite(String propertyName, List<String> jvmOptionsFromProperty) {
List<Match> matches = jvmOptionsFromProperty.stream()
.map(jvmOption -> new Match(jvmOption, mandatoryOptionFor(jvmOption)))
- .filter(match -> match.getMandatoryOption() != null)
+ .filter(match -> match.mandatoryOption() != null)
.toList();
if (!matches.isEmpty()) {
throw new MessageException(format(
"a JVM option can't overwrite mandatory JVM options. The following JVM options defined by property '%s' are invalid: %s",
propertyName,
matches.stream()
- .map(m -> m.getOption() + " overwrites " + m.mandatoryOption.getKey() + m.mandatoryOption.getValue())
+ .map(m -> m.option() + " overwrites " + m.mandatoryOption.getKey() + m.mandatoryOption.getValue())
.collect(joining(", "))));
}
}
@@ -158,24 +158,11 @@ public class JvmOptions<T extends JvmOptions> {
return options.toString();
}
- private static final class Match {
- private final String option;
-
- private final Map.Entry<String, String> mandatoryOption;
-
+ private record Match(String option, Map.Entry<String, String> mandatoryOption) {
private Match(String option, @Nullable Map.Entry<String, String> mandatoryOption) {
this.option = option;
this.mandatoryOption = mandatoryOption;
}
- String getOption() {
- return option;
- }
-
- @CheckForNull
- Map.Entry<String, String> getMandatoryOption() {
- return mandatoryOption;
- }
-
}
}