Skip to content

Commit

Permalink
Fixes isSealed for Java versions above 17
Browse files Browse the repository at this point in the history
  • Loading branch information
jqno committed Jan 4, 2022
1 parent 2e748b9 commit d562391
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public boolean isRecord() {
* @return true if T is a sealed class
*/
public boolean isSealed() {
if ("17".equals(System.getProperty("java.version"))) {
int version = Integer.parseInt(System.getProperty("java.version").replaceAll("[.-].*", ""));
if (version >= 17) {
try {
Class<?> clazz = Util.classForName("java.lang.Class");
Method isSealed = clazz.getDeclaredMethod("isSealed");
Expand Down

0 comments on commit d562391

Please sign in to comment.