From 4164ff6a03ad8b97622e08467d638bc3e849ea79 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 16 Nov 2020 21:48:14 -0700 Subject: [PATCH] Updates from PR comments --- core-java-modules/core-java-15/pom.xml | 4 ++-- .../java/com/baeldung/whatsnew/records/Person.java | 10 ++++++---- .../com/baeldung/whatsnew/sealedclasses/Employee.java | 6 ++---- .../com/baeldung/whatsnew/sealedclasses/Manager.java | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/core-java-modules/core-java-15/pom.xml b/core-java-modules/core-java-15/pom.xml index df8aeafca9..c6f1454078 100644 --- a/core-java-modules/core-java-15/pom.xml +++ b/core-java-modules/core-java-15/pom.xml @@ -51,8 +51,8 @@ ${maven.compiler.release} --enable-preview - 14 - 14 + 15 + 15 diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/records/Person.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/records/Person.java index e59fa86ed6..67d3151440 100644 --- a/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/records/Person.java +++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/records/Person.java @@ -3,13 +3,15 @@ package com.baeldung.whatsnew.records; /** * Java record with a header indicating 2 fields. */ -public record Person(String name, int age) { - +public record Person(String name, int age) +{ /** * Public constructor that does some basic validation. */ - public Person { - if (age < 0) { + public Person + { + if (age < 0) + { throw new IllegalArgumentException("Age cannot be negative"); } } diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Employee.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Employee.java index e9a2e25417..72ef75cb7c 100644 --- a/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Employee.java +++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Employee.java @@ -2,12 +2,10 @@ package com.baeldung.whatsnew.sealedclasses; import java.util.Date; -public non-sealed class Employee extends Person { - +public non-sealed class Employee extends Person +{ public Date getHiredDate() { return new Date(); } - - } diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Manager.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Manager.java index 79c50b057e..87cbcf2673 100644 --- a/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Manager.java +++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/whatsnew/sealedclasses/Manager.java @@ -1,4 +1,5 @@ package com.baeldung.whatsnew.sealedclasses; -public final class Manager extends Person { +public final class Manager extends Person +{ }