Skip to content

8355004: Apply java.io.Serial annotations in java.compiler #24891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
Expand All @@ -26,6 +26,7 @@
package javax.annotation.processing;

import java.io.IOException;
import java.io.Serial;

/**
* Indicates a {@link Filer} detected an attempt to open a file that
Expand All @@ -38,7 +39,10 @@
* @since 1.6
*/
public class FilerException extends IOException {
static final long serialVersionUID = 8426423106453163293L;

@Serial
private static final long serialVersionUID = 8426423106453163293L;

/**
* Constructs an exception with the specified detail message.
* @param s the detail message, which should include the name of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, 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
Expand All @@ -25,6 +25,8 @@

package javax.lang.model;

import java.io.Serial;

/**
* Superclass of exceptions which indicate that an unknown kind of
* entity was encountered. This situation can occur if the language
Expand All @@ -39,6 +41,7 @@
*/
public class UnknownEntityException extends RuntimeException {

@Serial
private static final long serialVersionUID = 269L;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
Expand All @@ -25,6 +25,8 @@

package javax.lang.model.element;

import java.io.Serial;

import javax.lang.model.UnknownEntityException;

/**
Expand All @@ -40,6 +42,7 @@
*/
public class UnknownAnnotationValueException extends UnknownEntityException {

@Serial
private static final long serialVersionUID = 269L;

private transient AnnotationValue av;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
Expand All @@ -25,6 +25,8 @@

package javax.lang.model.element;

import java.io.Serial;

import javax.lang.model.UnknownEntityException;

/**
Expand All @@ -39,6 +41,7 @@
*/
public class UnknownDirectiveException extends UnknownEntityException {

@Serial
private static final long serialVersionUID = 269L;

private final transient ModuleElement.Directive directive;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
Expand All @@ -25,6 +25,8 @@

package javax.lang.model.element;

import java.io.Serial;

import javax.lang.model.UnknownEntityException;

/**
Expand All @@ -39,6 +41,7 @@
*/
public class UnknownElementException extends UnknownEntityException {

@Serial
private static final long serialVersionUID = 269L;

private transient Element element;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
Expand All @@ -25,10 +25,11 @@

package javax.lang.model.type;

import java.io.ObjectInputStream;
import java.io.IOException;
import javax.lang.model.element.Element;
import java.io.ObjectInputStream;
import java.io.Serial;

import javax.lang.model.element.Element;

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

private static final long serialVersionUID = 269;
@Serial
private static final long serialVersionUID = 269L;

private transient TypeMirror type; // cannot be serialized

Expand Down Expand Up @@ -72,6 +74,7 @@ public TypeMirror getTypeMirror() {
* deserialization
* @throws IOException for an IO problem during deserialization
*/
@Serial
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
Expand All @@ -25,13 +25,14 @@

package javax.lang.model.type;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.io.ObjectInputStream;
import java.io.IOException;
import javax.lang.model.element.Element;
import java.util.List;

import javax.lang.model.element.Element;

/**
* Thrown when an application attempts to access a sequence of {@link
Expand All @@ -43,7 +44,8 @@
*/
public class MirroredTypesException extends RuntimeException {

private static final long serialVersionUID = 269;
@Serial
private static final long serialVersionUID = 269L;

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

Expand Down Expand Up @@ -87,6 +89,7 @@ public List<? extends TypeMirror> getTypeMirrors() {
* deserialization
* @throws IOException for an IO problem during deserialization
*/
@Serial
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
Expand All @@ -25,6 +25,8 @@

package javax.lang.model.type;

import java.io.Serial;

import javax.lang.model.UnknownEntityException;

/**
Expand All @@ -39,6 +41,7 @@
*/
public class UnknownTypeException extends UnknownEntityException {

@Serial
private static final long serialVersionUID = 269L;

private transient TypeMirror type;
Expand Down