diff --git a/src/java.desktop/share/classes/javax/print/DocFlavor.java b/src/java.desktop/share/classes/javax/print/DocFlavor.java index 9a5781cc605..171f4b682ac 100644 --- a/src/java.desktop/share/classes/javax/print/DocFlavor.java +++ b/src/java.desktop/share/classes/javax/print/DocFlavor.java @@ -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()); diff --git a/src/java.desktop/share/classes/javax/print/MimeType.java b/src/java.desktop/share/classes/javax/print/MimeType.java index 9c6aa0e9ac4..2091ed5bb5c 100644 --- a/src/java.desktop/share/classes/javax/print/MimeType.java +++ b/src/java.desktop/share/classes/javax/print/MimeType.java @@ -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 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> { + @Override public Iterator> 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 { + @Override public Set> 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()); diff --git a/src/java.desktop/share/classes/javax/print/PrintService.java b/src/java.desktop/share/classes/javax/print/PrintService.java index 733abfcd628..a1ef07ee76b 100644 --- a/src/java.desktop/share/classes/javax/print/PrintService.java +++ b/src/java.desktop/share/classes/javax/print/PrintService.java @@ -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(); } diff --git a/src/java.desktop/share/classes/javax/print/SimpleDoc.java b/src/java.desktop/share/classes/javax/print/SimpleDoc.java index 486d16ab466..66e674f0acf 100644 --- a/src/java.desktop/share/classes/javax/print/SimpleDoc.java +++ b/src/java.desktop/share/classes/javax/print/SimpleDoc.java @@ -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) { diff --git a/src/java.desktop/share/classes/javax/print/event/PrintEvent.java b/src/java.desktop/share/classes/javax/print/event/PrintEvent.java index 831e74fbe4f..32f0316a1d1 100644 --- a/src/java.desktop/share/classes/javax/print/event/PrintEvent.java +++ b/src/java.desktop/share/classes/javax/print/event/PrintEvent.java @@ -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()); } diff --git a/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java b/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java index f063fb7a8e0..73b73593acf 100644 --- a/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java +++ b/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java @@ -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) { } }