Skip to content

Commit 5ad02c9

Browse files
committed
8355004: Apply java.io.Serial annotations in java.compiler
Reviewed-by: liach, darcy
1 parent 2926435 commit 5ad02c9

File tree

8 files changed

+42
-17
lines changed

8 files changed

+42
-17
lines changed

src/java.compiler/share/classes/javax/annotation/processing/FilerException.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
2626
package javax.annotation.processing;
2727

2828
import java.io.IOException;
29+
import java.io.Serial;
2930

3031
/**
3132
* Indicates a {@link Filer} detected an attempt to open a file that
@@ -38,7 +39,10 @@
3839
* @since 1.6
3940
*/
4041
public class FilerException extends IOException {
41-
static final long serialVersionUID = 8426423106453163293L;
42+
43+
@Serial
44+
private static final long serialVersionUID = 8426423106453163293L;
45+
4246
/**
4347
* Constructs an exception with the specified detail message.
4448
* @param s the detail message, which should include the name of

src/java.compiler/share/classes/javax/lang/model/UnknownEntityException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
2525

2626
package javax.lang.model;
2727

28+
import java.io.Serial;
29+
2830
/**
2931
* Superclass of exceptions which indicate that an unknown kind of
3032
* entity was encountered. This situation can occur if the language
@@ -39,6 +41,7 @@
3941
*/
4042
public class UnknownEntityException extends RuntimeException {
4143

44+
@Serial
4245
private static final long serialVersionUID = 269L;
4346

4447
/**

src/java.compiler/share/classes/javax/lang/model/element/UnknownAnnotationValueException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
2525

2626
package javax.lang.model.element;
2727

28+
import java.io.Serial;
29+
2830
import javax.lang.model.UnknownEntityException;
2931

3032
/**
@@ -40,6 +42,7 @@
4042
*/
4143
public class UnknownAnnotationValueException extends UnknownEntityException {
4244

45+
@Serial
4346
private static final long serialVersionUID = 269L;
4447

4548
private transient AnnotationValue av;

src/java.compiler/share/classes/javax/lang/model/element/UnknownDirectiveException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
2525

2626
package javax.lang.model.element;
2727

28+
import java.io.Serial;
29+
2830
import javax.lang.model.UnknownEntityException;
2931

3032
/**
@@ -39,6 +41,7 @@
3941
*/
4042
public class UnknownDirectiveException extends UnknownEntityException {
4143

44+
@Serial
4245
private static final long serialVersionUID = 269L;
4346

4447
private final transient ModuleElement.Directive directive;

src/java.compiler/share/classes/javax/lang/model/element/UnknownElementException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
2525

2626
package javax.lang.model.element;
2727

28+
import java.io.Serial;
29+
2830
import javax.lang.model.UnknownEntityException;
2931

3032
/**
@@ -39,6 +41,7 @@
3941
*/
4042
public class UnknownElementException extends UnknownEntityException {
4143

44+
@Serial
4245
private static final long serialVersionUID = 269L;
4346

4447
private transient Element element;

src/java.compiler/share/classes/javax/lang/model/type/MirroredTypeException.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,11 @@
2525

2626
package javax.lang.model.type;
2727

28-
import java.io.ObjectInputStream;
2928
import java.io.IOException;
30-
import javax.lang.model.element.Element;
29+
import java.io.ObjectInputStream;
30+
import java.io.Serial;
3131

32+
import javax.lang.model.element.Element;
3233

3334
/**
3435
* Thrown when an application attempts to access the {@link Class} object
@@ -40,7 +41,8 @@
4041
*/
4142
public class MirroredTypeException extends MirroredTypesException {
4243

43-
private static final long serialVersionUID = 269;
44+
@Serial
45+
private static final long serialVersionUID = 269L;
4446

4547
private transient TypeMirror type; // cannot be serialized
4648

@@ -72,6 +74,7 @@ public TypeMirror getTypeMirror() {
7274
* deserialization
7375
* @throws IOException for an IO problem during deserialization
7476
*/
77+
@Serial
7578
private void readObject(ObjectInputStream s)
7679
throws IOException, ClassNotFoundException {
7780
s.defaultReadObject();

src/java.compiler/share/classes/javax/lang/model/type/MirroredTypesException.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,14 @@
2525

2626
package javax.lang.model.type;
2727

28+
import java.io.IOException;
29+
import java.io.ObjectInputStream;
30+
import java.io.Serial;
2831
import java.util.ArrayList;
29-
import java.util.List;
3032
import java.util.Collections;
31-
import java.io.ObjectInputStream;
32-
import java.io.IOException;
33-
import javax.lang.model.element.Element;
33+
import java.util.List;
3434

35+
import javax.lang.model.element.Element;
3536

3637
/**
3738
* Thrown when an application attempts to access a sequence of {@link
@@ -43,7 +44,8 @@
4344
*/
4445
public class MirroredTypesException extends RuntimeException {
4546

46-
private static final long serialVersionUID = 269;
47+
@Serial
48+
private static final long serialVersionUID = 269L;
4749

4850
transient List<? extends TypeMirror> types; // cannot be serialized
4951

@@ -87,6 +89,7 @@ public List<? extends TypeMirror> getTypeMirrors() {
8789
* deserialization
8890
* @throws IOException for an IO problem during deserialization
8991
*/
92+
@Serial
9093
private void readObject(ObjectInputStream s)
9194
throws IOException, ClassNotFoundException {
9295
s.defaultReadObject();

src/java.compiler/share/classes/javax/lang/model/type/UnknownTypeException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
2525

2626
package javax.lang.model.type;
2727

28+
import java.io.Serial;
29+
2830
import javax.lang.model.UnknownEntityException;
2931

3032
/**
@@ -39,6 +41,7 @@
3941
*/
4042
public class UnknownTypeException extends UnknownEntityException {
4143

44+
@Serial
4245
private static final long serialVersionUID = 269L;
4346

4447
private transient TypeMirror type;

0 commit comments

Comments
 (0)