8283668: Update IllegalFormatException to use sealed classes

Reviewed-by: iris, jpai
This commit is contained in:
Joe Darcy 2022-03-25 23:29:56 +00:00
parent 5ca8b91898
commit f520b4f891
13 changed files with 38 additions and 26 deletions

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,7 @@ package java.util;
*
* @since 1.5
*/
public class DuplicateFormatFlagsException extends IllegalFormatException {
public non-sealed class DuplicateFormatFlagsException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 18890531L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ package java.util;
*
* @since 1.5
*/
public class FormatFlagsConversionMismatchException
public non-sealed class FormatFlagsConversionMismatchException
extends IllegalFormatException
{
@java.io.Serial

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ package java.util;
*
* @since 16
*/
class IllegalFormatArgumentIndexException extends IllegalFormatException {
final class IllegalFormatArgumentIndexException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 4191767811181838112L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,7 +36,7 @@ package java.util;
*
* @since 1.5
*/
public class IllegalFormatCodePointException extends IllegalFormatException {
public non-sealed class IllegalFormatCodePointException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 19080630L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,7 @@ package java.util;
*
* @since 1.5
*/
public class IllegalFormatConversionException extends IllegalFormatException {
public non-sealed class IllegalFormatConversionException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 17000126L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,19 @@ package java.util;
*
* @since 1.5
*/
public class IllegalFormatException extends IllegalArgumentException {
public sealed class IllegalFormatException extends IllegalArgumentException
permits DuplicateFormatFlagsException,
FormatFlagsConversionMismatchException,
IllegalFormatArgumentIndexException,
IllegalFormatCodePointException,
IllegalFormatConversionException,
IllegalFormatFlagsException,
IllegalFormatPrecisionException,
IllegalFormatWidthException,
MissingFormatArgumentException,
MissingFormatWidthException,
UnknownFormatConversionException,
UnknownFormatFlagsException {
@java.io.Serial
private static final long serialVersionUID = 18830826L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ package java.util;
*
* @since 1.5
*/
public class IllegalFormatFlagsException extends IllegalFormatException {
public non-sealed class IllegalFormatFlagsException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 790824L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ package java.util;
*
* @since 1.5
*/
public class IllegalFormatPrecisionException extends IllegalFormatException {
public non-sealed class IllegalFormatPrecisionException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 18711008L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ package java.util;
*
* @since 1.5
*/
public class IllegalFormatWidthException extends IllegalFormatException {
public non-sealed class IllegalFormatWidthException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 16660902L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,7 +36,7 @@ package java.util;
*
* @since 1.5
*/
public class MissingFormatArgumentException extends IllegalFormatException {
public non-sealed class MissingFormatArgumentException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 19190115L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ package java.util;
*
* @since 1.5
*/
public class MissingFormatWidthException extends IllegalFormatException {
public non-sealed class MissingFormatWidthException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 15560123L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ package java.util;
*
* @since 1.5
*/
public class UnknownFormatConversionException extends IllegalFormatException {
public non-sealed class UnknownFormatConversionException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 19060418L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ package java.util;
*
* @since 1.5
*/
public class UnknownFormatFlagsException extends IllegalFormatException {
public non-sealed class UnknownFormatFlagsException extends IllegalFormatException {
@java.io.Serial
private static final long serialVersionUID = 19370506L;