8386109: Add missing @Override annotations in "javax.print.*" packages

Reviewed-by: azvegint, kizune, aivanov, prr
This commit is contained in:
Sergey Bylokhov 2026-06-18 03:24:13 +00:00
parent 7e356c4eb5
commit 524779ccde
6 changed files with 37 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2026, 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
@ -511,6 +511,7 @@ public class DocFlavor implements Serializable, Cloneable {
* value is enclosed in quotes. A "class=" parameter is appended to
* the MIME type string to indicate the representation class name.
*/
@Override
public String toString() {
return getStringValue();
}
@ -518,6 +519,7 @@ public class DocFlavor implements Serializable, Cloneable {
/**
* Returns a hash code for this doc flavor object.
*/
@Override
public int hashCode() {
return getStringValue().hashCode();
}
@ -539,6 +541,7 @@ public class DocFlavor implements Serializable, Cloneable {
* @return {@code true} if this doc flavor object equals {@code obj},
* {@code false} otherwise
*/
@Override
public boolean equals(Object obj) {
return obj instanceof DocFlavor other &&
getStringValue().equals(other.getStringValue());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2026, 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
@ -135,20 +135,25 @@ class MimeType implements Serializable, Cloneable {
public ParameterMapEntry(int theIndex) {
myIndex = theIndex;
}
@Override
public String getKey(){
return myPieces[myIndex];
}
@Override
public String getValue(){
return myPieces[myIndex+1];
}
@Override
public String setValue (String value) {
throw new UnsupportedOperationException();
}
@Override
public boolean equals(Object o) {
return o instanceof Map.Entry<?, ?> entry &&
getKey().equals(entry.getKey()) &&
getValue().equals(entry.getValue());
}
@Override
public int hashCode() {
return getKey().hashCode() ^ getValue().hashCode();
}
@ -163,9 +168,11 @@ class MimeType implements Serializable, Cloneable {
* The current index of the iterator.
*/
private int myIndex = 2;
@Override
public boolean hasNext() {
return myIndex < myPieces.length;
}
@Override
public Map.Entry<String, String> next() {
if (hasNext()) {
ParameterMapEntry result = new ParameterMapEntry (myIndex);
@ -175,6 +182,7 @@ class MimeType implements Serializable, Cloneable {
throw new NoSuchElementException();
}
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@ -184,9 +192,11 @@ class MimeType implements Serializable, Cloneable {
* Parameter map entry set.
*/
private class ParameterMapEntrySet extends AbstractSet<Map.Entry<String, String>> {
@Override
public Iterator<Map.Entry<String, String>> iterator() {
return new ParameterMapEntrySetIterator();
}
@Override
public int size() {
return (myPieces.length - 2) / 2;
}
@ -196,6 +206,7 @@ class MimeType implements Serializable, Cloneable {
* Parameter map.
*/
private class ParameterMap extends AbstractMap<String, String> {
@Override
public Set<Map.Entry<String, String>> entrySet() {
if (myEntrySet == null) {
myEntrySet = new ParameterMapEntrySet();
@ -266,6 +277,7 @@ class MimeType implements Serializable, Cloneable {
* @return MIME type string based on the canonical form. Each parameter
* value is enclosed in quotes.
*/
@Override
public String toString() {
return getStringValue();
}
@ -273,6 +285,7 @@ class MimeType implements Serializable, Cloneable {
/**
* Returns a hash code for this MIME type object.
*/
@Override
public int hashCode() {
return getStringValue().hashCode();
}
@ -292,6 +305,7 @@ class MimeType implements Serializable, Cloneable {
* @return {@code true} if this MIME type object equals {@code obj},
* {@code false} otherwise
*/
@Override
public boolean equals (Object obj) {
return obj instanceof MimeType mimeType &&
getStringValue().equals(mimeType.getStringValue());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2026, 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
@ -425,6 +425,7 @@ public interface PrintService {
* @return {@code true} if this service is the same as the obj argument,
* {@code false} otherwise
*/
@Override
public boolean equals(Object obj);
/**
@ -433,5 +434,6 @@ public interface PrintService {
*
* @return hash code of this object
*/
@Override
public int hashCode();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2026, 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
@ -131,6 +131,7 @@ public final class SimpleDoc implements Doc {
*
* @return doc flavor
*/
@Override
public DocFlavor getDocFlavor() {
return flavor;
}
@ -151,6 +152,7 @@ public final class SimpleDoc implements Doc {
* {@code null} to obtain all attribute values from the job's
* attribute set
*/
@Override
public DocAttributeSet getAttributes() {
return attributes;
}
@ -168,6 +170,7 @@ public final class SimpleDoc implements Doc {
* @throws IOException if the representation class is a stream and there was
* an I/O error while constructing the stream
*/
@Override
public Object getPrintData() throws IOException {
return printData;
}
@ -193,6 +196,7 @@ public final class SimpleDoc implements Doc {
* meet the criteria stated above, {@code null} is returned.
* @throws IOException if there was an I/O error while creating the reader
*/
@Override
public Reader getReaderForText() throws IOException {
if (printData instanceof Reader) {
@ -235,6 +239,7 @@ public final class SimpleDoc implements Doc {
* @throws IOException if there was an I/O error while creating the input
* stream
*/
@Override
public InputStream getStreamForBytes() throws IOException {
if (printData instanceof InputStream) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2026, 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
@ -53,6 +53,7 @@ public class PrintEvent extends java.util.EventObject {
*
* @return a message describing the event
*/
@Override
public String toString() {
return ("PrintEvent on " + getSource().toString());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2026, 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
@ -49,6 +49,7 @@ public abstract class PrintJobAdapter implements PrintJobListener {
*
* @param pje the event being notified
*/
@Override
public void printDataTransferCompleted(PrintJobEvent pje) {
}
@ -57,6 +58,7 @@ public abstract class PrintJobAdapter implements PrintJobListener {
*
* @param pje the event being notified
*/
@Override
public void printJobCompleted(PrintJobEvent pje) {
}
@ -66,6 +68,7 @@ public abstract class PrintJobAdapter implements PrintJobListener {
*
* @param pje the event being notified
*/
@Override
public void printJobFailed(PrintJobEvent pje) {
}
@ -74,6 +77,7 @@ public abstract class PrintJobAdapter implements PrintJobListener {
*
* @param pje the event being notified
*/
@Override
public void printJobCanceled(PrintJobEvent pje) {
}
@ -86,6 +90,7 @@ public abstract class PrintJobAdapter implements PrintJobListener {
*
* @param pje the event being notified
*/
@Override
public void printJobNoMoreEvents(PrintJobEvent pje) {
}
@ -95,6 +100,7 @@ public abstract class PrintJobAdapter implements PrintJobListener {
*
* @param pje the event being notified
*/
@Override
public void printJobRequiresAttention(PrintJobEvent pje) {
}
}