From 5c810c0c708a1aebee7eb234323a31265c3f44f2 Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Thu, 12 Nov 2026 13:24:32 -0500 Subject: [PATCH 1/2] Reduce diffs to OpenJDK. The primary goal here is to make future merges easier. (I have had trouble in past merges that I traced to spurious diffs.) Most of the changes are about removing whitespace that I had regrettably left behind when removing Checker-Framework-specific annotations from typetools/checker-framework. There are other changes, too, including restoring the `ThreadGroup.destroy()` method that I'd removed in a prior bad merge. (This doesn't matter for nullness purposes, but it, too, could reduce the chances of problems in future merges.) Gemini (which did the work) elaborates: > ### Summary of Changes > > 1. **Top-level files (3 files)** > - Removed Checker Framework leftovers `azure-pipelines.yml` and `README-rewritten-jdk-history` (`git rm`). > - Reverted [.gitignore](https://github.com/jspecify/jdk/blob/main/.gitignore) to match `openjdk/master`. > > 2. **Merge-conflict restoration & CF leftovers** > - [ThreadGroup.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/lang/ThreadGroup.java): Restored the broken/commented-out `destroy()` Javadoc, `@Deprecated(since="16", forRemoval=true)`, and `public final void destroy() {}` from `openjdk/master`, and removed its 3 `@SuppressWarnings("index:array.access.unsafe.high")` annotations. > - Removed all remaining 38 leftover `@SuppressWarnings(...)` annotations across 14 files, reverted the modified `@SuppressWarnings` in [EnumMap.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/EnumMap.java) back to `@SuppressWarnings("unchecked")`, reverted the temporary `result` variable in [ResourceBundle.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/ResourceBundle.java) back to `return sb.toString();`, and removed the 2 CF comments in [HashMap.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/HashMap.java) and [ListIterator.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/ListIterator.java). > - Removed all 18 leftover `@Override` annotations ([AbstractCollection.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/AbstractCollection.java), [PrimitiveIterator.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/PrimitiveIterator.java), and [Thread.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/lang/Thread.java)). > - Reverted all 7 explicit diamond type arguments in [TemporalQueries.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/time/temporal/TemporalQueries.java) back to `new TemporalQuery<>()`. > > 3. **Unused & duplicate imports** > - Removed 98 unused `org.jspecify.annotations` imports (95 `Nullable`, 3 `NonNull`) while keeping the placement/surrounding blank lines of retained JSpecify imports unchanged. > - Removed the duplicate `import org.jspecify.annotations.Nullable;` (and its extra blank line) at the top of [AbstractChronology.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/time/chrono/AbstractChronology.java#L62-L64) (keeping the grouped JSpecify imports further down the import block). > - Removed the 4 unused non-JSpecify imports in [InheritableThreadLocal.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/lang/InheritableThreadLocal.java), [Reference.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/lang/ref/Reference.java), and [UUID.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/UUID.java), and removed the duplicate `import java.lang.ref.WeakReference;` in [WeakHashMap.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/WeakHashMap.java) (restoring upstream import order). > > 4. **SQL postfix array annotations & `CompletableFuture` wraps & whitespace normalization** > - Standardized [CallableStatement.java](https://github.com/jspecify/jdk/blob/main/src/java.sql/share/classes/java/sql/CallableStatement.java#L974) (`setBytes`) and [ResultSet.java](https://github.com/jspecify/jdk/blob/main/src/java.sql/share/classes/java/sql/ResultSet.java#L2099) (`updateBytes`) to `byte x @Nullable []`. > - Undid all 9 line-wrap/unwrap diffs in both directions in [CompletableFuture.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java). > - Normalized 2,776 unchanged-token whitespace gaps, 147 gaps around `@Nullable`/`@NonNull` (including tabs in Swing/AWT parameter lists and trailing-space newlines in [Attributes.java](https://github.com/jspecify/jdk/blob/main/src/java.naming/share/classes/javax/naming/directory/Attributes.java#L102) and [NamespaceContext.java](https://github.com/jspecify/jdk/blob/main/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java#L207)), 69 gaps around `@NullMarked`, and `extends Object` in [ConcurrentHashMap.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java). > > ### Verification > > - **Exact token & whitespace verification vs `openjdk/master`** across all 879 modified `.java` files: > - `0` unchanged-token whitespace diffs > - `0` inserted-region whitespace anomalies (outside kept JSpecify import placement) > - `0` unused JSpecify imports > - `0` non-JSpecify annotations added or removed (exact preserved counts: `4038` `@Nullable`, `578` `@NullMarked`, `43` `@NonNull`, `8` `@NullUnmarked`) > - Only remaining non-annotation / non-import / non-`extends Object` hunks are the 25 intentional ones: [module-info.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/module-info.java#L138), [Provider.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/security/Provider.java#L573) (3 `?>`), [Objects.java](https://github.com/jspecify/jdk/blob/main/src/java.base/share/classes/java/util/Objects.java#L70) (J2CL overload), and the 20 intentional JSpecify comments. > - **Build**: `make jdk` completed with exit code `0` (`Finished building target 'jdk' in configuration 'linux-x86_64-server-release'`). I tested the results with the same Javadoc-based methodology as in https://github.com/jspecify/jdk/pull/179. I saw some changes in "auxiliary" files like the `class-use` files, but the only change to "actual Javadoc" I saw was in `ThreadGroup`, where `destroy()` returns, as expected. --- .gitignore | 19 +- README-rewritten-jdk-history | 65 ---- azure-pipelines.yml | 137 ------- .../classes/java/io/BufferedInputStream.java | 2 +- .../classes/java/io/BufferedOutputStream.java | 1 - .../share/classes/java/io/BufferedReader.java | 8 +- .../share/classes/java/io/BufferedWriter.java | 1 - .../classes/java/io/ByteArrayInputStream.java | 1 - .../java/io/ByteArrayOutputStream.java | 12 +- .../classes/java/io/CharArrayReader.java | 6 +- .../classes/java/io/CharArrayWriter.java | 10 +- .../share/classes/java/io/Closeable.java | 2 - .../share/classes/java/io/DataInput.java | 6 +- .../classes/java/io/DataInputStream.java | 4 +- .../share/classes/java/io/DataOutput.java | 1 - .../classes/java/io/DataOutputStream.java | 6 +- .../share/classes/java/io/Externalizable.java | 1 - src/java.base/share/classes/java/io/File.java | 9 - .../share/classes/java/io/FileDescriptor.java | 1 - .../share/classes/java/io/FileFilter.java | 1 - .../classes/java/io/FileInputStream.java | 1 - .../classes/java/io/FileOutputStream.java | 1 - .../share/classes/java/io/FilePermission.java | 4 +- .../share/classes/java/io/FileReader.java | 1 - .../share/classes/java/io/FileWriter.java | 1 - .../share/classes/java/io/FilenameFilter.java | 1 - .../classes/java/io/FilterOutputStream.java | 3 +- .../share/classes/java/io/FilterReader.java | 5 +- .../share/classes/java/io/FilterWriter.java | 3 +- .../share/classes/java/io/Flushable.java | 1 - .../share/classes/java/io/InputStream.java | 1 - .../classes/java/io/LineNumberReader.java | 10 +- .../share/classes/java/io/ObjectInput.java | 4 +- .../classes/java/io/ObjectInputStream.java | 8 +- .../java/io/ObjectInputValidation.java | 1 - .../share/classes/java/io/ObjectOutput.java | 2 +- .../classes/java/io/ObjectOutputStream.java | 4 +- .../classes/java/io/ObjectStreamClass.java | 3 +- .../java/io/ObjectStreamConstants.java | 1 - .../classes/java/io/ObjectStreamField.java | 10 +- .../share/classes/java/io/OutputStream.java | 5 +- .../classes/java/io/OutputStreamWriter.java | 2 +- .../classes/java/io/PipedOutputStream.java | 1 - .../share/classes/java/io/PipedReader.java | 5 +- .../share/classes/java/io/PipedWriter.java | 1 - .../share/classes/java/io/PrintStream.java | 8 +- .../share/classes/java/io/PrintWriter.java | 4 +- .../classes/java/io/PushbackInputStream.java | 12 +- .../share/classes/java/io/PushbackReader.java | 7 +- .../classes/java/io/RandomAccessFile.java | 12 +- .../share/classes/java/io/Reader.java | 7 +- .../classes/java/io/SequenceInputStream.java | 1 - .../classes/java/io/StreamTokenizer.java | 5 +- .../java/io/StringBufferInputStream.java | 1 - .../share/classes/java/io/StringReader.java | 1 - .../share/classes/java/io/StringWriter.java | 7 +- .../share/classes/java/io/Writer.java | 4 +- .../java/lang/AbstractMethodError.java | 2 - .../java/lang/AbstractStringBuilder.java | 56 ++- .../share/classes/java/lang/Appendable.java | 2 +- .../java/lang/ArithmeticException.java | 2 - .../lang/ArrayIndexOutOfBoundsException.java | 3 - .../java/lang/ArrayStoreException.java | 2 - .../classes/java/lang/AssertionError.java | 9 - .../share/classes/java/lang/Boolean.java | 25 +- .../share/classes/java/lang/Byte.java | 58 +-- .../share/classes/java/lang/CharSequence.java | 10 +- .../share/classes/java/lang/Character.java | 341 +++++------------- .../share/classes/java/lang/Class.java | 32 +- .../classes/java/lang/ClassCastException.java | 2 - .../java/lang/ClassCircularityError.java | 2 - .../classes/java/lang/ClassFormatError.java | 2 - .../share/classes/java/lang/ClassLoader.java | 24 +- .../java/lang/ClassNotFoundException.java | 2 - .../java/lang/CloneNotSupportedException.java | 2 - .../share/classes/java/lang/Cloneable.java | 1 - .../share/classes/java/lang/Comparable.java | 5 +- .../share/classes/java/lang/Deprecated.java | 1 - .../share/classes/java/lang/Double.java | 35 +- .../share/classes/java/lang/Enum.java | 13 +- .../lang/EnumConstantNotPresentException.java | 2 - .../share/classes/java/lang/Error.java | 7 +- .../share/classes/java/lang/Exception.java | 14 +- .../share/classes/java/lang/Float.java | 32 +- .../classes/java/lang/IllegalAccessError.java | 2 - .../java/lang/IllegalAccessException.java | 2 - .../java/lang/IllegalArgumentException.java | 4 - .../lang/IllegalMonitorStateException.java | 2 - .../java/lang/IllegalStateException.java | 4 - .../lang/IllegalThreadStateException.java | 2 - .../lang/IncompatibleClassChangeError.java | 2 - .../java/lang/IndexOutOfBoundsException.java | 2 - .../java/lang/InheritableThreadLocal.java | 5 +- .../classes/java/lang/InstantiationError.java | 2 - .../java/lang/InstantiationException.java | 2 - .../share/classes/java/lang/Integer.java | 132 ++----- .../classes/java/lang/InternalError.java | 4 - .../java/lang/InterruptedException.java | 2 - .../share/classes/java/lang/LinkageError.java | 3 - .../share/classes/java/lang/Long.java | 127 ++----- .../share/classes/java/lang/Math.java | 24 +- .../share/classes/java/lang/Module.java | 1 + .../share/classes/java/lang/ModuleLayer.java | 1 + .../java/lang/NegativeArraySizeException.java | 2 - .../java/lang/NoClassDefFoundError.java | 2 - .../classes/java/lang/NoSuchFieldError.java | 2 - .../java/lang/NoSuchFieldException.java | 2 - .../classes/java/lang/NoSuchMethodError.java | 2 - .../java/lang/NoSuchMethodException.java | 2 - .../java/lang/NullPointerException.java | 2 - .../share/classes/java/lang/Number.java | 19 +- .../share/classes/java/lang/Object.java | 8 +- .../classes/java/lang/OutOfMemoryError.java | 2 - .../share/classes/java/lang/Override.java | 1 - .../share/classes/java/lang/Package.java | 18 +- .../share/classes/java/lang/Process.java | 2 - .../share/classes/java/lang/Readable.java | 3 +- .../share/classes/java/lang/Runnable.java | 2 - .../classes/java/lang/RuntimeException.java | 4 - .../classes/java/lang/SecurityException.java | 4 - .../classes/java/lang/SecurityManager.java | 1 - .../share/classes/java/lang/Short.java | 56 +-- .../classes/java/lang/StackOverflowError.java | 2 - .../classes/java/lang/StackTraceElement.java | 9 +- .../share/classes/java/lang/StrictMath.java | 1 - .../share/classes/java/lang/String.java | 196 ++-------- .../share/classes/java/lang/StringBuffer.java | 51 ++- .../classes/java/lang/StringBuilder.java | 50 ++- .../lang/StringIndexOutOfBoundsException.java | 3 - .../classes/java/lang/SuppressWarnings.java | 1 - .../share/classes/java/lang/System.java | 5 +- .../share/classes/java/lang/Thread.java | 6 - .../share/classes/java/lang/ThreadGroup.java | 15 +- .../share/classes/java/lang/Throwable.java | 8 +- .../java/lang/TypeNotPresentException.java | 5 +- .../share/classes/java/lang/UnknownError.java | 2 - .../java/lang/UnsatisfiedLinkError.java | 2 - .../lang/UnsupportedClassVersionError.java | 2 - .../lang/UnsupportedOperationException.java | 4 - .../share/classes/java/lang/VerifyError.java | 2 - .../java/lang/VirtualMachineError.java | 4 - .../share/classes/java/lang/Void.java | 3 +- .../java/lang/module/ModuleDescriptor.java | 2 - .../share/classes/java/lang/ref/Cleaner.java | 1 - .../java/lang/ref/PhantomReference.java | 1 - .../classes/java/lang/ref/Reference.java | 3 - .../classes/java/lang/ref/SoftReference.java | 1 - .../java/lang/reflect/AccessibleObject.java | 1 - .../java/lang/reflect/AnnotatedElement.java | 1 - .../java/lang/reflect/Constructor.java | 8 +- .../classes/java/lang/reflect/Field.java | 59 +-- .../java/lang/reflect/GenericDeclaration.java | 1 - .../java/lang/reflect/InvocationHandler.java | 2 +- .../reflect/InvocationTargetException.java | 2 - .../classes/java/lang/reflect/Method.java | 11 +- .../java/lang/reflect/ParameterizedType.java | 4 +- .../share/classes/java/math/BigDecimal.java | 2 +- .../share/classes/java/math/BigInteger.java | 26 +- .../share/classes/java/math/MathContext.java | 1 + .../share/classes/java/net/BindException.java | 1 + .../share/classes/java/net/HttpCookie.java | 2 - .../share/classes/java/net/Inet4Address.java | 2 +- .../share/classes/java/net/Inet6Address.java | 2 +- .../share/classes/java/net/InetAddress.java | 2 - .../java/net/PortUnreachableException.java | 1 + .../share/classes/java/net/SocketOption.java | 1 + .../classes/java/net/SocketPermission.java | 2 - .../java/net/SocketTimeoutException.java | 1 + src/java.base/share/classes/java/net/URI.java | 2 - .../classes/java/net/URISyntaxException.java | 1 + src/java.base/share/classes/java/net/URL.java | 2 +- .../share/classes/java/net/URLDecoder.java | 1 + .../share/classes/java/nio/ByteOrder.java | 1 - .../java/nio/channels/FileChannel.java | 34 +- .../classes/java/nio/charset/CoderResult.java | 1 + .../java/nio/charset/CodingErrorAction.java | 1 + .../nio/charset/MalformedInputException.java | 1 + .../charset/UnmappableCharacterException.java | 1 + .../java/nio/charset/spi/CharsetProvider.java | 1 + .../nio/file/DirectoryIteratorException.java | 1 + .../java/nio/file/DirectoryStream.java | 1 + .../classes/java/nio/file/FileSystems.java | 1 + .../share/classes/java/nio/file/Path.java | 26 -- .../java/nio/file/attribute/AclEntry.java | 2 - .../attribute/BasicFileAttributeView.java | 1 + .../java/security/BasicPermission.java | 2 - .../classes/java/security/CodeSource.java | 3 +- .../security/GeneralSecurityException.java | 1 + .../share/classes/java/security/Key.java | 1 + .../share/classes/java/security/KeyStore.java | 2 +- .../classes/java/security/MessageDigest.java | 10 +- .../java/security/PKCS12Attribute.java | 2 - .../share/classes/java/security/Policy.java | 2 +- .../java/security/ProtectionDomain.java | 2 +- .../java/security/spec/EllipticCurve.java | 2 - .../share/classes/java/text/Collator.java | 2 - .../share/classes/java/text/DateFormat.java | 2 - .../classes/java/text/DecimalFormat.java | 2 - .../classes/java/text/MessageFormat.java | 2 +- .../classes/java/text/SimpleDateFormat.java | 2 - .../share/classes/java/time/Clock.java | 2 - .../share/classes/java/time/LocalDate.java | 2 - .../classes/java/time/LocalDateTime.java | 2 - .../share/classes/java/time/LocalTime.java | 2 - .../share/classes/java/time/MonthDay.java | 2 - .../classes/java/time/OffsetDateTime.java | 2 - .../share/classes/java/time/OffsetTime.java | 2 - .../share/classes/java/time/Period.java | 2 - .../share/classes/java/time/Year.java | 2 - .../share/classes/java/time/YearMonth.java | 2 - .../share/classes/java/time/ZoneId.java | 2 - .../classes/java/time/ZonedDateTime.java | 2 - .../java/time/chrono/AbstractChronology.java | 2 - .../classes/java/time/chrono/HijrahDate.java | 2 - .../java/time/chrono/JapaneseDate.java | 2 - .../classes/java/time/chrono/MinguoDate.java | 2 - .../java/time/chrono/ThaiBuddhistDate.java | 2 - .../java/time/format/DecimalStyle.java | 2 - .../java/time/temporal/ChronoField.java | 1 - .../java/time/temporal/ChronoUnit.java | 1 - .../classes/java/time/temporal/IsoFields.java | 1 - .../java/time/temporal/JulianFields.java | 1 - .../java/time/temporal/TemporalAdjuster.java | 1 - .../java/time/temporal/TemporalAmount.java | 1 - .../java/time/temporal/TemporalQueries.java | 14 +- .../java/time/temporal/TemporalUnit.java | 1 - .../java/time/temporal/ValueRange.java | 2 - .../java/time/temporal/WeekFields.java | 2 - .../classes/java/util/AbstractCollection.java | 25 +- .../share/classes/java/util/AbstractList.java | 31 +- .../share/classes/java/util/AbstractMap.java | 34 +- .../java/util/AbstractSequentialList.java | 3 - .../share/classes/java/util/AbstractSet.java | 5 +- .../share/classes/java/util/ArrayDeque.java | 12 +- .../share/classes/java/util/ArrayList.java | 65 ++-- .../share/classes/java/util/Arrays.java | 157 ++++---- .../share/classes/java/util/BitSet.java | 49 +-- .../share/classes/java/util/Calendar.java | 141 ++++---- .../share/classes/java/util/Collection.java | 17 +- .../share/classes/java/util/Collections.java | 12 +- .../share/classes/java/util/Comparator.java | 10 +- .../share/classes/java/util/Currency.java | 3 +- .../share/classes/java/util/Date.java | 6 +- .../share/classes/java/util/Deque.java | 5 +- .../share/classes/java/util/Dictionary.java | 7 +- .../java/util/DoubleSummaryStatistics.java | 1 - .../share/classes/java/util/EnumMap.java | 47 +-- .../share/classes/java/util/EnumSet.java | 1 - .../share/classes/java/util/Enumeration.java | 1 - .../classes/java/util/EventListener.java | 1 - .../classes/java/util/EventListenerProxy.java | 3 +- .../share/classes/java/util/EventObject.java | 4 +- .../share/classes/java/util/Formattable.java | 1 - .../classes/java/util/FormattableFlags.java | 1 - .../share/classes/java/util/Formatter.java | 2 - .../classes/java/util/GregorianCalendar.java | 10 +- .../share/classes/java/util/HashMap.java | 36 +- .../share/classes/java/util/HashSet.java | 11 +- .../share/classes/java/util/Hashtable.java | 52 +-- .../classes/java/util/IdentityHashMap.java | 43 +-- .../java/util/IntSummaryStatistics.java | 1 - .../share/classes/java/util/Iterator.java | 3 - .../classes/java/util/LinkedHashMap.java | 14 +- .../classes/java/util/LinkedHashSet.java | 1 - .../share/classes/java/util/LinkedList.java | 42 +-- .../share/classes/java/util/List.java | 33 +- .../share/classes/java/util/ListIterator.java | 8 +- .../share/classes/java/util/Locale.java | 17 +- .../java/util/LongSummaryStatistics.java | 1 - .../share/classes/java/util/Map.java | 28 +- .../share/classes/java/util/NavigableMap.java | 14 +- .../share/classes/java/util/NavigableSet.java | 18 +- .../share/classes/java/util/Observable.java | 3 +- .../share/classes/java/util/Observer.java | 1 - .../share/classes/java/util/Optional.java | 6 +- .../classes/java/util/OptionalDouble.java | 3 - .../share/classes/java/util/OptionalInt.java | 3 - .../share/classes/java/util/OptionalLong.java | 3 - .../classes/java/util/PrimitiveIterator.java | 3 - .../classes/java/util/PriorityQueue.java | 13 +- .../share/classes/java/util/Properties.java | 17 +- .../classes/java/util/PropertyPermission.java | 4 +- .../share/classes/java/util/Queue.java | 1 - .../share/classes/java/util/Random.java | 1 - .../share/classes/java/util/RandomAccess.java | 1 - .../classes/java/util/ResourceBundle.java | 45 +-- .../share/classes/java/util/Scanner.java | 45 ++- .../classes/java/util/ServiceLoader.java | 4 +- .../share/classes/java/util/Set.java | 14 +- .../classes/java/util/SimpleTimeZone.java | 3 - .../share/classes/java/util/SortedMap.java | 16 +- .../share/classes/java/util/SortedSet.java | 8 +- .../share/classes/java/util/Spliterator.java | 1 - .../classes/java/util/StringTokenizer.java | 4 +- .../share/classes/java/util/TimeZone.java | 8 - .../share/classes/java/util/Timer.java | 7 +- .../share/classes/java/util/TimerTask.java | 3 +- .../share/classes/java/util/TreeMap.java | 84 +---- .../share/classes/java/util/TreeSet.java | 28 +- .../share/classes/java/util/UUID.java | 2 - .../share/classes/java/util/Vector.java | 61 +--- .../share/classes/java/util/WeakHashMap.java | 37 +- .../util/concurrent/ArrayBlockingQueue.java | 1 - .../java/util/concurrent/BlockingDeque.java | 3 - .../java/util/concurrent/BlockingQueue.java | 1 - .../java/util/concurrent/Callable.java | 1 - .../util/concurrent/CompletableFuture.java | 27 +- .../java/util/concurrent/CompletionStage.java | 6 +- .../util/concurrent/ConcurrentHashMap.java | 36 +- .../concurrent/ConcurrentLinkedDeque.java | 8 - .../concurrent/ConcurrentLinkedQueue.java | 7 - .../java/util/concurrent/ConcurrentMap.java | 2 - .../concurrent/ConcurrentSkipListMap.java | 36 -- .../concurrent/ConcurrentSkipListSet.java | 10 - .../util/concurrent/CopyOnWriteArrayList.java | 5 - .../util/concurrent/CopyOnWriteArraySet.java | 4 - .../java/util/concurrent/DelayQueue.java | 6 +- .../util/concurrent/ExecutionException.java | 4 - .../java/util/concurrent/ExecutorService.java | 2 +- .../classes/java/util/concurrent/Future.java | 2 - .../util/concurrent/LinkedBlockingDeque.java | 1 - .../util/concurrent/LinkedBlockingQueue.java | 1 - .../util/concurrent/LinkedTransferQueue.java | 2 - .../concurrent/PriorityBlockingQueue.java | 1 - .../util/concurrent/SynchronousQueue.java | 8 - .../java/util/function/BiFunction.java | 1 - .../util/function/DoubleBinaryOperator.java | 1 - .../java/util/function/DoubleConsumer.java | 1 - .../java/util/function/DoubleFunction.java | 1 - .../java/util/function/DoublePredicate.java | 1 - .../java/util/function/DoubleSupplier.java | 1 - .../util/function/DoubleToIntFunction.java | 1 - .../util/function/DoubleToLongFunction.java | 1 - .../util/function/DoubleUnaryOperator.java | 1 - .../classes/java/util/function/Function.java | 1 - .../java/util/function/IntBinaryOperator.java | 1 - .../java/util/function/IntConsumer.java | 1 - .../java/util/function/IntFunction.java | 1 - .../java/util/function/IntPredicate.java | 1 - .../java/util/function/IntSupplier.java | 1 - .../util/function/IntToDoubleFunction.java | 1 - .../java/util/function/IntToLongFunction.java | 1 - .../java/util/function/IntUnaryOperator.java | 1 - .../util/function/LongBinaryOperator.java | 1 - .../java/util/function/LongConsumer.java | 1 - .../java/util/function/LongFunction.java | 1 - .../java/util/function/LongPredicate.java | 1 - .../java/util/function/LongSupplier.java | 1 - .../util/function/LongToDoubleFunction.java | 1 - .../java/util/function/LongToIntFunction.java | 1 - .../java/util/function/LongUnaryOperator.java | 1 - .../classes/java/util/function/Supplier.java | 1 - .../classes/java/util/jar/Attributes.java | 7 - .../share/classes/java/util/jar/JarFile.java | 6 +- .../classes/java/util/regex/Matcher.java | 21 +- .../classes/java/util/regex/Pattern.java | 20 +- .../util/regex/PatternSyntaxException.java | 6 - .../classes/java/util/stream/BaseStream.java | 2 - .../classes/java/util/stream/Collectors.java | 1 - .../java/util/stream/DoubleStream.java | 3 - .../classes/java/util/stream/IntStream.java | 3 - .../classes/java/util/stream/LongStream.java | 3 - .../classes/java/util/stream/Stream.java | 2 - .../java/util/zip/InflaterInputStream.java | 3 +- .../java/util/zip/InflaterOutputStream.java | 1 + .../share/classes/java/util/zip/ZipEntry.java | 5 +- .../classes/java/util/zip/ZipException.java | 1 + .../share/classes/java/util/zip/ZipFile.java | 3 +- .../classes/javax/net/ssl/SNIHostName.java | 2 - .../classes/javax/net/ssl/SNIServerName.java | 2 - .../javax/net/ssl/X509ExtendedKeyManager.java | 1 - .../classes/javax/net/ssl/X509KeyManager.java | 4 +- .../security/auth/login/Configuration.java | 2 +- .../internal/module/ModuleReferenceImpl.java | 2 - .../sun/security/util/ObjectIdentifier.java | 2 - .../sun/security/x509/GeneralNames.java | 2 - .../sun/security/x509/GeneralSubtrees.java | 2 - .../share/classes/sun/security/x509/RDN.java | 2 - .../classes/sun/text/CompactByteArray.java | 2 - .../classes/sun/util/BuddhistCalendar.java | 2 - .../classes/sun/util/calendar/ZoneInfo.java | 2 - .../sun/util/locale/LocaleExtensions.java | 2 - .../java/awt/datatransfer/DataFlavor.java | 10 +- .../com/sun/media/sound/ModelIdentifier.java | 2 - .../classes/java/awt/AlphaComposite.java | 2 - .../share/classes/java/awt/BasicStroke.java | 2 - .../share/classes/java/awt/Component.java | 8 +- .../share/classes/java/awt/Container.java | 3 +- .../share/classes/java/awt/Dialog.java | 4 +- .../share/classes/java/awt/Dimension.java | 2 - .../share/classes/java/awt/DisplayMode.java | 2 - .../share/classes/java/awt/Font.java | 13 +- .../share/classes/java/awt/Frame.java | 1 - .../share/classes/java/awt/JobAttributes.java | 2 - .../share/classes/java/awt/MenuShortcut.java | 2 - .../classes/java/awt/PageAttributes.java | 2 - .../share/classes/java/awt/Point.java | 2 - .../share/classes/java/awt/Rectangle.java | 2 - .../java/awt/font/FontRenderContext.java | 2 - .../java/awt/font/ImageGraphicAttribute.java | 2 - .../classes/java/awt/font/NumericShaper.java | 2 - .../java/awt/font/ShapeGraphicAttribute.java | 2 - .../classes/java/awt/font/TextHitInfo.java | 3 - .../java/awt/font/TransformAttribute.java | 2 - .../java/awt/geom/AffineTransform.java | 2 - .../java/awt/image/ComponentColorModel.java | 4 +- .../java/awt/image/IndexColorModel.java | 2 - .../java/awt/image/PackedColorModel.java | 4 +- .../share/classes/java/beans/Beans.java | 2 +- .../classes/java/beans/FeatureDescriptor.java | 3 +- .../java/beans/PropertyChangeSupport.java | 38 +- .../java/beans/PropertyDescriptor.java | 10 - .../javax/swing/DefaultListCellRenderer.java | 2 +- .../share/classes/javax/swing/JComponent.java | 4 +- .../share/classes/javax/swing/JDialog.java | 2 +- .../classes/javax/swing/JFileChooser.java | 40 +- .../classes/javax/swing/JOptionPane.java | 72 ++-- .../share/classes/javax/swing/JRootPane.java | 3 +- .../share/classes/javax/swing/UIDefaults.java | 2 - .../share/classes/javax/swing/UIManager.java | 3 - .../swing/table/DefaultTableCellRenderer.java | 4 +- .../classes/javax/swing/text/TabSet.java | 2 - .../classes/javax/swing/text/TabStop.java | 2 - .../swing/tree/DefaultTreeCellRenderer.java | 2 +- .../classes/javax/swing/tree/TreePath.java | 2 - .../sun/java2d/loops/CompositeType.java | 2 - .../classes/sun/java2d/loops/SurfaceType.java | 2 - .../share/classes/sun/java2d/pipe/Region.java | 2 - .../sun/print/PSStreamPrintService.java | 2 - .../classes/sun/swing/BakedArrayList.java | 2 - .../lang/instrument/ClassFileTransformer.java | 5 +- .../classes/java/util/logging/Level.java | 22 +- .../classes/java/util/logging/LogRecord.java | 4 +- .../classes/java/util/logging/Logger.java | 107 ++---- .../com/sun/jmx/mbeanserver/NamedObject.java | 2 - .../classes/javax/management/Attribute.java | 2 - .../classes/javax/management/Descriptor.java | 2 - .../javax/management/ImmutableDescriptor.java | 2 - .../javax/management/MBeanAttributeInfo.java | 2 - .../management/MBeanConstructorInfo.java | 2 - .../javax/management/MBeanFeatureInfo.java | 2 - .../classes/javax/management/MBeanInfo.java | 2 - .../management/MBeanNotificationInfo.java | 2 - .../javax/management/MBeanOperationInfo.java | 2 - .../javax/management/MBeanParameterInfo.java | 2 - .../javax/management/MBeanPermission.java | 2 - .../classes/javax/management/MBeanServer.java | 1 - .../management/MBeanServerPermission.java | 5 +- .../javax/management/ObjectInstance.java | 2 - .../classes/javax/management/ObjectName.java | 2 - .../javax/management/openmbean/ArrayType.java | 2 - .../management/openmbean/CompositeData.java | 2 - .../management/openmbean/CompositeType.java | 7 +- .../openmbean/OpenMBeanAttributeInfo.java | 2 - .../OpenMBeanAttributeInfoSupport.java | 2 - .../openmbean/OpenMBeanConstructorInfo.java | 2 - .../OpenMBeanConstructorInfoSupport.java | 2 - .../management/openmbean/OpenMBeanInfo.java | 2 - .../openmbean/OpenMBeanOperationInfo.java | 2 - .../OpenMBeanOperationInfoSupport.java | 2 - .../openmbean/OpenMBeanParameterInfo.java | 2 - .../OpenMBeanParameterInfoSupport.java | 2 - .../management/openmbean/SimpleType.java | 2 - .../management/openmbean/TabularData.java | 2 - .../javax/management/remote/JMXPrincipal.java | 2 - .../management/remote/JMXServiceURL.java | 2 - .../sun/management/LazyCompositeData.java | 2 - .../classes/com/sun/jndi/ldap/LdapName.java | 2 - .../classes/javax/naming/CompoundName.java | 2 - .../javax/naming/directory/Attributes.java | 7 +- .../classes/javax/naming/ldap/LdapName.java | 2 - .../share/classes/javax/naming/ldap/Rdn.java | 2 - .../java/util/prefs/AbstractPreferences.java | 2 +- .../classes/java/util/prefs/Preferences.java | 4 +- .../classes/java/rmi/MarshalledObject.java | 2 - .../share/classes/java/rmi/dgc/VMID.java | 2 - .../share/classes/java/rmi/server/ObjID.java | 2 - .../share/classes/java/rmi/server/UID.java | 2 - .../rmi/ssl/SslRMIClientSocketFactory.java | 2 - .../rmi/ssl/SslRMIServerSocketFactory.java | 2 - .../auth/kerberos/KerberosCredMessage.java | 2 - .../sun/security/krb5/PrincipalName.java | 2 - .../security/krb5/internal/KerberosTime.java | 2 - .../share/classes/javax/smartcardio/ATR.java | 2 - .../javax/smartcardio/CardPermission.java | 2 - .../javax/smartcardio/CommandAPDU.java | 2 - .../javax/smartcardio/ResponseAPDU.java | 2 - .../javax/sql/rowset/serial/SerialArray.java | 2 - .../javax/sql/rowset/serial/SerialBlob.java | 2 - .../javax/sql/rowset/serial/SerialClob.java | 2 - .../sql/rowset/serial/SerialDatalink.java | 2 - .../sql/rowset/serial/SerialJavaObject.java | 2 - .../javax/sql/rowset/serial/SerialRef.java | 2 - .../javax/sql/rowset/serial/SerialStruct.java | 2 - .../classes/java/sql/CallableStatement.java | 2 +- .../share/classes/java/sql/DriverManager.java | 5 +- .../share/classes/java/sql/ResultSet.java | 2 +- .../share/classes/java/sql/SQLType.java | 1 - .../dom/DOMCanonicalizationMethod.java | 2 - .../jcp/xml/dsig/internal/dom/DOMKeyInfo.java | 2 - .../dsig/internal/dom/DOMRetrievalMethod.java | 2 - .../xml/dsig/internal/dom/DOMTransform.java | 2 - .../xml/dsig/internal/dom/DOMX509Data.java | 2 - .../xsltc/compiler/util/ObjectType.java | 2 - .../internal/impl/dtd/XMLContentSpec.java | 2 - .../internal/impl/dtd/XMLDTDDescription.java | 2 - .../internal/impl/dtd/models/CMStateSet.java | 2 - .../impl/xpath/regex/RegularExpression.java | 2 - .../internal/impl/xs/XSDDescription.java | 2 - .../internal/impl/xs/XSElementDecl.java | 2 - .../internal/impl/xs/util/ShortListImpl.java | 2 - .../org/apache/xerces/internal/xni/QName.java | 2 - .../stream/writers/XMLStreamWriterImpl.java | 2 - .../javax/xml/namespace/NamespaceContext.java | 5 +- .../javax/xml/parsers/DocumentBuilder.java | 6 - .../xml/parsers/DocumentBuilderFactory.java | 6 - .../parsers/ParserConfigurationException.java | 1 - .../classes/javax/xml/parsers/SAXParser.java | 6 - .../javax/xml/parsers/SAXParserFactory.java | 7 - .../classes/javax/xml/stream/XMLResolver.java | 1 - .../javax/xml/stream/XMLStreamException.java | 8 - .../javax/xml/transform/URIResolver.java | 1 - .../xml/xpath/XPathVariableResolver.java | 1 - .../share/classes/org/w3c/dom/Attr.java | 6 - .../classes/org/w3c/dom/CharacterData.java | 4 - .../share/classes/org/w3c/dom/Document.java | 13 - .../share/classes/org/w3c/dom/Element.java | 10 - .../classes/org/w3c/dom/NamedNodeMap.java | 4 - .../share/classes/org/w3c/dom/Node.java | 27 -- .../share/classes/org/w3c/dom/NodeList.java | 2 - .../share/classes/org/w3c/dom/Text.java | 2 - .../share/classes/org/w3c/dom/ls/LSInput.java | 8 - .../org/w3c/dom/ls/LSResourceResolver.java | 1 - .../classes/org/xml/sax/EntityResolver.java | 1 - .../classes/org/xml/sax/InputSource.java | 9 - .../org/xml/sax/ext/EntityResolver2.java | 2 - .../java/accessibility/util/Translator.java | 2 - .../com/sun/tools/attach/VirtualMachine.java | 2 - .../attach/VirtualMachineDescriptor.java | 2 - .../sun/security/pkcs11/SunPKCS11.java | 2 - .../hotspot/debugger/linux/LinuxAddress.java | 2 - .../sun/jvmstat/monitor/HostIdentifier.java | 2 - .../sun/jvmstat/monitor/VmIdentifier.java | 2 - .../classes/sun/tools/jstat/OptionFormat.java | 2 - .../sun/tools/jconsole/inspector/XMBean.java | 2 - .../sun/tools/jconsole/inspector/XObject.java | 2 - .../com/sun/tools/jdi/EventQueueImpl.java | 2 - .../internal/AbstractResourcePoolEntry.java | 2 - .../jlink/internal/ImageLocationWriter.java | 2 - .../sun/management/jdp/JdpJmxPacket.java | 2 - .../LocalRMIServerSocketFactory.java | 2 - .../classes/com/sun/management/GcInfo.java | 2 - .../classes/com/sun/jndi/dns/DnsName.java | 2 - .../security/auth/NTNumericCredential.java | 2 - .../security/auth/NTSidDomainPrincipal.java | 2 - .../security/auth/NTSidGroupPrincipal.java | 2 - .../auth/NTSidPrimaryGroupPrincipal.java | 2 - .../sun/security/auth/NTSidUserPrincipal.java | 2 - .../share/classes/sun/misc/Signal.java | 2 - 559 files changed, 1129 insertions(+), 3640 deletions(-) delete mode 100644 README-rewritten-jdk-history delete mode 100644 azure-pipelines.yml diff --git a/.gitignore b/.gitignore index 59a09360bad..a45e2113756 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,23 @@ /build/ -/.cache -/compile_commands.json /dist/ -.DS_Store /.idea/ +/.vscode/ +/nbproject/ +nbproject/private/ +/webrev +/.src-rev /.jib/ -**/JTreport/** -**/JTwork/** +.DS_Store .metadata/ +.recommenders/ +test/nashorn/script/external +test/nashorn/lib NashornProfile.txt -/nbproject/ -nbproject/private/ +**/JTreport/** +**/JTwork/** /src/utils/LogCompilation/target/ /src/utils/LogCompilation/logc.jar /.project/ -.recommenders/ /.settings/ /compile_commands.json /.cache diff --git a/README-rewritten-jdk-history b/README-rewritten-jdk-history deleted file mode 100644 index 42f5c77655e..00000000000 --- a/README-rewritten-jdk-history +++ /dev/null @@ -1,65 +0,0 @@ -Sometimes openjdk/jdk and openjdk/jdk11u have their history rewritten incompatibly. :-( - - -Here is how Mike dealt with that problem the last time it happened. - -# Do this: - -cd $t/libraries -mv jdk-fork-openjdk jdk-fork-openjdk-BEFORE-JDK-FORCE-PUSH -git clone git@github.com:openjdk/jdk.git jdk-fork-openjdk -cd jdk-fork-openjdk -# May need to update the commit number; see the README file -git checkout da75f3c4ad5bdf25167a3ed80e51f567ab3dbd01 - -cd $t/libraries -mv jdk-fork-typetools-branch-master jdk-fork-typetools-branch-master-BEFORE-JDK-FORCE-PUSH -# Browse to https://github.com/typetools/jdk/settings and delete the repository -# Browse to https://github.com/openjdk/jdk and fork the repository to typetools -cd $t/libraries -git clone git@github.com:typetools/jdk.git jdk-fork-typetools-branch-master -cd jdk-fork-typetools-branch-master -git reset --hard da75f3c4ad5bdf25167a3ed80e51f567ab3dbd01 -git push -f -cd $t/libraries -rsync -a --exclude '.git' jdk-fork-typetools-branch-master-BEFORE-JDK-FORCE-PUSH/ jdk-fork-typetools-branch-master/ -(cd jdk-fork-typetools-branch-master && git add . && git commit -m "Pluggable type-checking annotations" && git push) - -cd $t/libraries -rm -rf jdk11u-fork-openjdk -cd /scratch/mernst/clones/types/libraries -git clone git@github.com:openjdk/jdk11u.git jdk11u-fork-openjdk - -cd $t/libraries -mv jdk11u-fork-typetools jdk-fork-typetools-BEFORE-JDK-FORCE-PUSH -# Browse to https://github.com/typetools/jdk11u/settings and delete the repository -# Browse to https://github.com/openjdk/jdk11u and fork the repository to typetools -cd $t/libraries -git clone git@github.com:typetools/jdk11u.git jdk11u-fork-typetools-branch-master -# Update it from its upstreams in the usual way. - -cd $t/libraries -mv jdk-fork-mernst jdk-fork-mernst-BEFORE-JDK-FORCE-PUSH -# Browse to https://github.com/mernst/jdk/settings and delete the repository -# Browse to https://github.com/typetools/jdk and fork the repository to mernst -cd $t/libraries -git clone git@github.com:mernst/jdk.git jdk-fork-mernst - -cd $t/libraries -mv jdk11u-fork-mernst jdk11u-fork-mernst-BEFORE-JDK-FORCE-PUSH -# Browse to https://github.com/mernst/jdk11u/settings and delete the repository -# Browse to https://github.com/typetools/jdk11u and fork the repository to mernst -cd $t/libraries -git clone git@github.com:mernst/jdk11u.git jdk11u-fork-mernst - - -Browse to each of these URLs: -https://dev.azure.com/mernst22/jdk/_build -https://dev.azure.com/mernst22/jdk11u/_build -https://dev.azure.com/typetools/jdk/_build -https://dev.azure.com/typetools/jdk11u/_build -At each URL: - * Queue the project in hopes that will start automatic building for each commit. - * If the above doesn't work, change the instructions to the below: - * Delete and re-create the pipeline, because of apparent caching problems when checking out the projects. - diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index c321d7eb55d..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,137 +0,0 @@ -jobs: - -- job: build_jdk - pool: - vmImage: 'ubuntu-latest' - container: mdernst/cf-ubuntu-jdk11-plus-buildjdk:latest - steps: - - bash: | - whoami - git config --get remote.origin.url - pwd - ls -al - env | sort - displayName: show environment - - bash: pwd && ls && bash ./configure --with-jtreg=/jtreg --disable-warnings-as-errors - displayName: configure - - bash: make jdk - timeoutInMinutes: 90 - displayName: make jdk - ## This works only after `make images` - # - bash: build/*/images/jdk/bin/java -version - # displayName: version - ## Don't run tests, which pass only with old version of tools (compilers, etc.). - # - bash: make -C /jdk run-test-tier1 - # displayName: make run-test-tier1 - -- job: build_jdk11u - pool: - vmImage: 'ubuntu-latest' - container: mdernst/cf-ubuntu-jdk11-plus-buildjdk:latest - timeoutInMinutes: 0 - steps: - - bash: | - whoami - git config --get remote.origin.url - pwd - ls -al - env | sort - displayName: show environment - - bash: | - set -ex - if [ -d /tmp/$USER/plume-scripts ]; \ - then git -C /tmp/$USER/plume-scripts pull -q > /dev/null 2>&1 ; \ - else mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git ; \ - fi - displayName: plume-scripts - # This creates ../jdk11u . - # If the depth is too small, the merge will fail. - - bash: | - set -ex - /tmp/$USER/plume-scripts/git-clone-related typetools jdk11u ../jdk11u -q --depth 99 - displayName: clone-related-jdk11u - - bash: | - set -ex - git config --global user.email "you@example.com" - git config --global user.name "Your Name" - eval `/tmp/$USER/plume-scripts/ci-info typetools` - cd ../jdk11u && git pull --no-edit https://github.com/${CI_ORGANIZATION}/jdk ${CI_BRANCH} || (echo "Merge failed; see 'Pull request merge conflicts' at https://github.com/typetools/jdk/blob/master/README" && false) - displayName: git merge - - bash: cd ../jdk11u && export JT_HOME=/jtreg && bash ./configure --with-jtreg --disable-warnings-as-errors - displayName: configure - - bash: cd ../jdk11u && make jdk - displayName: make jdk - ## This works only after `make images` - # - bash: cd ../jdk11u && build/*/images/jdk/bin/java -version - # displayName: version - # - bash: make -C /jdk11u run-test-tier1 - # timeoutInMinutes: 0 - # displayName: make run-test-tier1 - # - bash: make -C /jdk11u :test/jdk:tier1 - - bash: cd ../jdk11u && make run-test TEST="jtreg:test/jdk:tier1" - timeoutInMinutes: 0 - displayName: make run-test - -- job: test_cftests_all_jdk8 - pool: - vmImage: 'ubuntu-latest' - container: mdernst/cf-ubuntu-jdk8:latest - steps: - - checkout: self - fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git - displayName: clone plume-scripts - - bash: /tmp/$USER/plume-scripts/git-clone-related typetools checker-framework - displayName: clone checker-framework - - bash: (cd ../checker-framework && checker/bin-devel/test-cftests-all.sh) - displayName: test-cftests-all.sh - -- job: test_cftests_all_jdk11 - pool: - vmImage: 'ubuntu-latest' - container: mdernst/cf-ubuntu-jdk11:latest - steps: - - checkout: self - fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git - displayName: clone plume-scripts - - bash: /tmp/$USER/plume-scripts/git-clone-related typetools checker-framework - displayName: clone checker-framework - - bash: (cd ../checker-framework && checker/bin-devel/test-cftests-all.sh) - displayName: test-cftests-all.sh -## Here is how to create artifacts that can be downloaded. -# - bash: (cd ../checker-framework/checker/build/jtregJdk11/ && tar -czvf all.tgz all) -# condition: succeededOrFailed() -# displayName: tar jtregJdk11/all -# - publish: $(System.DefaultWorkingDirectory)/../checker-framework/checker/build/jtregJdk11/all.tgz -# artifact: all.tgz -# condition: failed() -# displayName: publish all.tgz - -- job: test_daikon - pool: - vmImage: 'ubuntu-latest' - container: mdernst/cf-ubuntu-jdk11:latest - steps: - - checkout: self - fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git - displayName: clone plume-scripts - - bash: /tmp/$USER/plume-scripts/git-clone-related typetools checker-framework - displayName: clone checker-framework - - bash: (cd ../checker-framework && checker/bin-devel/test-daikon.sh) - displayName: test-daikon.sh - -- job: test_plume_lib - pool: - vmImage: 'ubuntu-latest' - container: mdernst/cf-ubuntu-jdk11:latest - steps: - - checkout: self - fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git - displayName: clone plume-scripts - - bash: /tmp/$USER/plume-scripts/git-clone-related typetools checker-framework - displayName: clone checker-framework - - bash: (cd ../checker-framework && checker/bin-devel/test-plume-lib.sh) - displayName: test-plume-lib.sh diff --git a/src/java.base/share/classes/java/io/BufferedInputStream.java b/src/java.base/share/classes/java/io/BufferedInputStream.java index 095a84b6249..53599fd6ded 100644 --- a/src/java.base/share/classes/java/io/BufferedInputStream.java +++ b/src/java.base/share/classes/java/io/BufferedInputStream.java @@ -236,7 +236,7 @@ public BufferedInputStream(InputStream in) { * @param size the buffer size. * @throws IllegalArgumentException if {@code size <= 0}. */ - public BufferedInputStream(InputStream in, int size) { + public BufferedInputStream(InputStream in, int size) { super(in); if (size <= 0) { throw new IllegalArgumentException("Buffer size <= 0"); diff --git a/src/java.base/share/classes/java/io/BufferedOutputStream.java b/src/java.base/share/classes/java/io/BufferedOutputStream.java index a0e25029463..30daf950de2 100644 --- a/src/java.base/share/classes/java/io/BufferedOutputStream.java +++ b/src/java.base/share/classes/java/io/BufferedOutputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Arrays; import jdk.internal.misc.VM; diff --git a/src/java.base/share/classes/java/io/BufferedReader.java b/src/java.base/share/classes/java/io/BufferedReader.java index 441791b017a..ebaf339f138 100644 --- a/src/java.base/share/classes/java/io/BufferedReader.java +++ b/src/java.base/share/classes/java/io/BufferedReader.java @@ -106,7 +106,7 @@ public class BufferedReader extends Reader { * * @throws IllegalArgumentException If {@code sz <= 0} */ - public BufferedReader(Reader in, int sz) { + public BufferedReader(Reader in, int sz) { super(in); if (sz <= 0) throw new IllegalArgumentException("Buffer size <= 0"); @@ -407,7 +407,7 @@ String readLine(boolean ignoreLF, boolean[] term) throws IOException { /** * {@inheritDoc} */ - public long skip( long n) throws IOException { + public long skip(long n) throws IOException { if (n < 0L) { throw new IllegalArgumentException("skip value is negative"); } @@ -447,8 +447,6 @@ public long skip( long n) throws IOException { * * @throws IOException If an I/O error occurs */ - - public boolean ready() throws IOException { synchronized (lock) { ensureOpen(); @@ -497,7 +495,7 @@ public boolean markSupported() { * @throws IllegalArgumentException If {@code readAheadLimit < 0} * @throws IOException If an I/O error occurs */ - public void mark( int readAheadLimit) throws IOException { + public void mark(int readAheadLimit) throws IOException { if (readAheadLimit < 0) { throw new IllegalArgumentException("Read-ahead limit < 0"); } diff --git a/src/java.base/share/classes/java/io/BufferedWriter.java b/src/java.base/share/classes/java/io/BufferedWriter.java index d147f688dc8..b6e2992acc8 100644 --- a/src/java.base/share/classes/java/io/BufferedWriter.java +++ b/src/java.base/share/classes/java/io/BufferedWriter.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Arrays; import java.util.Objects; diff --git a/src/java.base/share/classes/java/io/ByteArrayInputStream.java b/src/java.base/share/classes/java/io/ByteArrayInputStream.java index c428a23b383..c0d19ef56d5 100644 --- a/src/java.base/share/classes/java/io/ByteArrayInputStream.java +++ b/src/java.base/share/classes/java/io/ByteArrayInputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Arrays; import java.util.Objects; diff --git a/src/java.base/share/classes/java/io/ByteArrayOutputStream.java b/src/java.base/share/classes/java/io/ByteArrayOutputStream.java index eddd0febe1e..8872fe82e52 100644 --- a/src/java.base/share/classes/java/io/ByteArrayOutputStream.java +++ b/src/java.base/share/classes/java/io/ByteArrayOutputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.nio.charset.Charset; import java.util.Arrays; @@ -60,7 +59,7 @@ public class ByteArrayOutputStream extends OutputStream { /** * The number of valid bytes in the buffer. */ - protected int count; + protected int count; /** * Creates a new {@code ByteArrayOutputStream}. The buffer capacity is @@ -77,7 +76,7 @@ public ByteArrayOutputStream() { * @param size the initial size. * @throws IllegalArgumentException if size is negative. */ - public ByteArrayOutputStream( int size) { + public ByteArrayOutputStream(int size) { if (size < 0) { throw new IllegalArgumentException("Negative initial size: " + size); @@ -187,7 +186,7 @@ public synchronized void reset() { * @return the current contents of this output stream, as a byte array. * @see java.io.ByteArrayOutputStream#size() */ - public synchronized byte[] toByteArray() { + public synchronized byte[] toByteArray() { return Arrays.copyOf(buf, count); } @@ -198,8 +197,7 @@ public synchronized byte[] toByteArray() { * of valid bytes in this output stream. * @see java.io.ByteArrayOutputStream#count */ - - public synchronized int size() { + public synchronized int size() { return count; } @@ -253,7 +251,6 @@ public synchronized String toString() { * If the named charset is not supported * @since 1.1 */ - public synchronized String toString(String charsetName) throws UnsupportedEncodingException { @@ -303,7 +300,6 @@ public synchronized String toString(Charset charset) { * @see java.io.ByteArrayOutputStream#toString() * @see Charset#defaultCharset() */ - @Deprecated public synchronized String toString(int hibyte) { return new String(buf, hibyte, 0, count); diff --git a/src/java.base/share/classes/java/io/CharArrayReader.java b/src/java.base/share/classes/java/io/CharArrayReader.java index 97558865682..87a98a3f3c1 100644 --- a/src/java.base/share/classes/java/io/CharArrayReader.java +++ b/src/java.base/share/classes/java/io/CharArrayReader.java @@ -103,7 +103,7 @@ private void ensureOpen() throws IOException { * * @throws IOException If an I/O error occurs */ - public int read() throws IOException { + public int read() throws IOException { synchronized (lock) { ensureOpen(); if (pos >= count) @@ -188,7 +188,7 @@ public int read(CharBuffer target) throws IOException { * * @throws IOException {@inheritDoc} */ - public long skip(long n) throws IOException { + public long skip(long n) throws IOException { synchronized (lock) { ensureOpen(); @@ -236,7 +236,7 @@ public boolean markSupported() { * * @throws IOException If an I/O error occurs */ - public void mark( int readAheadLimit) throws IOException { + public void mark(int readAheadLimit) throws IOException { synchronized (lock) { ensureOpen(); markedPos = pos; diff --git a/src/java.base/share/classes/java/io/CharArrayWriter.java b/src/java.base/share/classes/java/io/CharArrayWriter.java index 50df74257e5..5593b5e998b 100644 --- a/src/java.base/share/classes/java/io/CharArrayWriter.java +++ b/src/java.base/share/classes/java/io/CharArrayWriter.java @@ -68,7 +68,7 @@ public CharArrayWriter() { * @param initialSize an int specifying the initial buffer size. * @throws IllegalArgumentException if initialSize is negative */ - public CharArrayWriter( int initialSize) { + public CharArrayWriter(int initialSize) { if (initialSize < 0) { throw new IllegalArgumentException("Negative initial size: " + initialSize); @@ -127,7 +127,7 @@ public void write(char[] c, int off, int len) { * or {@code off + len} is negative or greater than the length * of the given string */ - public void write(String str, int off, int len) { + public void write(String str, int off, int len) { synchronized (lock) { int newcount = count + len; if (newcount > buf.length) { @@ -216,7 +216,7 @@ public CharArrayWriter append(@Nullable CharSequence csq) { * * @since 1.5 */ - public CharArrayWriter append(@Nullable CharSequence csq, int start, int end) { + public CharArrayWriter append(@Nullable CharSequence csq, int start, int end) { if (csq == null) csq = "null"; return append(csq.subSequence(start, end)); } @@ -267,8 +267,7 @@ public char[] toCharArray() { * * @return an int representing the current size of the buffer. */ - - public int size() { + public int size() { return count; } @@ -276,7 +275,6 @@ public int size() { * Converts input data to a string. * @return the string. */ - public String toString() { synchronized (lock) { return new String(buf, 0, count); diff --git a/src/java.base/share/classes/java/io/Closeable.java b/src/java.base/share/classes/java/io/Closeable.java index 38a76f41de4..13ca6b2faf4 100644 --- a/src/java.base/share/classes/java/io/Closeable.java +++ b/src/java.base/share/classes/java/io/Closeable.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.IOException; @@ -53,6 +52,5 @@ public interface Closeable extends AutoCloseable { * * @throws IOException if an I/O error occurs */ - public void close() throws IOException; } diff --git a/src/java.base/share/classes/java/io/DataInput.java b/src/java.base/share/classes/java/io/DataInput.java index 37f8d822eff..a38a35e0bae 100644 --- a/src/java.base/share/classes/java/io/DataInput.java +++ b/src/java.base/share/classes/java/io/DataInput.java @@ -273,7 +273,7 @@ public interface DataInput { * @return the number of bytes actually skipped. * @throws IOException if an I/O error occurs. */ - int skipBytes(int n) throws IOException; + int skipBytes(int n) throws IOException; /** * Reads one input byte and returns @@ -324,7 +324,7 @@ public interface DataInput { * all the bytes. * @throws IOException if an I/O error occurs. */ - int readUnsignedByte() throws IOException; + int readUnsignedByte() throws IOException; /** * Reads two input bytes and returns @@ -368,7 +368,7 @@ public interface DataInput { * all the bytes. * @throws IOException if an I/O error occurs. */ - int readUnsignedShort() throws IOException; + int readUnsignedShort() throws IOException; /** * Reads two input bytes and returns a {@code char} value. diff --git a/src/java.base/share/classes/java/io/DataInputStream.java b/src/java.base/share/classes/java/io/DataInputStream.java index 6ae1715a974..ca254a1590c 100644 --- a/src/java.base/share/classes/java/io/DataInputStream.java +++ b/src/java.base/share/classes/java/io/DataInputStream.java @@ -234,7 +234,7 @@ public final void readFully(byte[] b, int off, int len) throws IOException { * the contained input stream does not support * reading after close, or another I/O error occurs. */ - public final int skipBytes(int n) throws IOException { + public final int skipBytes(int n) throws IOException { int total = 0; int cur = 0; @@ -299,7 +299,7 @@ public final byte readByte() throws IOException { * another I/O error occurs. * @see java.io.FilterInputStream#in */ - public final int readUnsignedByte() throws IOException { + public final int readUnsignedByte() throws IOException { int ch = in.read(); if (ch < 0) throw new EOFException(); diff --git a/src/java.base/share/classes/java/io/DataOutput.java b/src/java.base/share/classes/java/io/DataOutput.java index 176b6a5b7b9..34f2b3724c9 100644 --- a/src/java.base/share/classes/java/io/DataOutput.java +++ b/src/java.base/share/classes/java/io/DataOutput.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * The {@code DataOutput} interface provides diff --git a/src/java.base/share/classes/java/io/DataOutputStream.java b/src/java.base/share/classes/java/io/DataOutputStream.java index a11efe30624..c94b09a2ec1 100644 --- a/src/java.base/share/classes/java/io/DataOutputStream.java +++ b/src/java.base/share/classes/java/io/DataOutputStream.java @@ -27,7 +27,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.lang.runtime.ExactConversionsSupport; @@ -108,7 +107,7 @@ private void incCount(int value) { * @throws IOException if an I/O error occurs. * @see java.io.FilterOutputStream#out */ - public synchronized void write( int b) throws IOException { + public synchronized void write(int b) throws IOException { out.write(b); incCount(1); } @@ -414,8 +413,7 @@ private static String tooLongMsg(String s, long utflen) { * @return the value of the {@code written} field. * @see java.io.DataOutputStream#written */ - - public final int size() { + public final int size() { return written; } } diff --git a/src/java.base/share/classes/java/io/Externalizable.java b/src/java.base/share/classes/java/io/Externalizable.java index 10850c1fb0e..073040990c0 100644 --- a/src/java.base/share/classes/java/io/Externalizable.java +++ b/src/java.base/share/classes/java/io/Externalizable.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.ObjectOutput; import java.io.ObjectInput; diff --git a/src/java.base/share/classes/java/io/File.java b/src/java.base/share/classes/java/io/File.java index 42f05613e0a..21f75777190 100644 --- a/src/java.base/share/classes/java/io/File.java +++ b/src/java.base/share/classes/java/io/File.java @@ -158,7 +158,6 @@ * @since 1.0 */ - @NullMarked public class File implements Serializable, Comparable @@ -486,7 +485,6 @@ public String getName() { * abstract pathname, or {@code null} if this pathname * does not name a parent */ - public @Nullable String getParent() { int index = path.lastIndexOf(separatorChar); if (index < prefixLength) { @@ -513,7 +511,6 @@ public String getName() { * * @since 1.2 */ - public @Nullable File getParentFile() { String p = this.getParent(); if (p == null) return null; @@ -547,7 +544,6 @@ public String getPath() { * @return {@code true} if this abstract pathname is absolute, * {@code false} otherwise */ - public boolean isAbsolute() { return FS.isAbsolute(this); } @@ -817,7 +813,6 @@ public boolean exists() { * abstract pathname exists and is a directory; * {@code false} otherwise */ - public boolean isDirectory() { if (isInvalid()) { return false; @@ -841,7 +836,6 @@ public boolean isDirectory() { * abstract pathname exists and is a normal file; * {@code false} otherwise */ - public boolean isFile() { if (isInvalid()) { return false; @@ -870,7 +864,6 @@ public boolean isFile() { * * @since 1.2 */ - public boolean isHidden() { if (isInvalid()) { return false; @@ -2015,7 +2008,6 @@ public boolean equals(@Nullable Object obj) { * * @return A hash code for this abstract pathname */ - public int hashCode() { return FS.hashCode(this); } @@ -2026,7 +2018,6 @@ public int hashCode() { * * @return The string form of this abstract pathname */ - public String toString() { return getPath(); } diff --git a/src/java.base/share/classes/java/io/FileDescriptor.java b/src/java.base/share/classes/java/io/FileDescriptor.java index b5512aa402d..933ed6c9bf8 100644 --- a/src/java.base/share/classes/java/io/FileDescriptor.java +++ b/src/java.base/share/classes/java/io/FileDescriptor.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.ArrayList; import java.util.List; diff --git a/src/java.base/share/classes/java/io/FileFilter.java b/src/java.base/share/classes/java/io/FileFilter.java index f5ce9890df6..3dc0fbbe2a9 100644 --- a/src/java.base/share/classes/java/io/FileFilter.java +++ b/src/java.base/share/classes/java/io/FileFilter.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** diff --git a/src/java.base/share/classes/java/io/FileInputStream.java b/src/java.base/share/classes/java/io/FileInputStream.java index 031b8bfc8c1..58d7f7e9c3a 100644 --- a/src/java.base/share/classes/java/io/FileInputStream.java +++ b/src/java.base/share/classes/java/io/FileInputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.nio.channels.FileChannel; import java.util.Arrays; diff --git a/src/java.base/share/classes/java/io/FileOutputStream.java b/src/java.base/share/classes/java/io/FileOutputStream.java index 191404405af..9ce8e68e12b 100644 --- a/src/java.base/share/classes/java/io/FileOutputStream.java +++ b/src/java.base/share/classes/java/io/FileOutputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.nio.channels.FileChannel; import jdk.internal.access.SharedSecrets; diff --git a/src/java.base/share/classes/java/io/FilePermission.java b/src/java.base/share/classes/java/io/FilePermission.java index 43b7ba5f4b6..ac34ede376f 100644 --- a/src/java.base/share/classes/java/io/FilePermission.java +++ b/src/java.base/share/classes/java/io/FilePermission.java @@ -775,9 +775,8 @@ private static int containsPath(Path p1, Path p2) { * pathname and actions as this FilePermission object, * {@code false} otherwise. */ - @Override - public boolean equals( @Nullable Object obj) { + public boolean equals(@Nullable Object obj) { if (obj == this) return true; @@ -808,7 +807,6 @@ public boolean equals( @Nullable Object obj) { * * @return a hash code value for this object. */ - @Override public int hashCode() { if (nb) { diff --git a/src/java.base/share/classes/java/io/FileReader.java b/src/java.base/share/classes/java/io/FileReader.java index 627062da2da..c090c96804f 100644 --- a/src/java.base/share/classes/java/io/FileReader.java +++ b/src/java.base/share/classes/java/io/FileReader.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.nio.charset.Charset; diff --git a/src/java.base/share/classes/java/io/FileWriter.java b/src/java.base/share/classes/java/io/FileWriter.java index 4fa5f2e83a2..65077c5b4c5 100644 --- a/src/java.base/share/classes/java/io/FileWriter.java +++ b/src/java.base/share/classes/java/io/FileWriter.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.nio.charset.Charset; diff --git a/src/java.base/share/classes/java/io/FilenameFilter.java b/src/java.base/share/classes/java/io/FilenameFilter.java index 9499d7d7ba1..20b42bfa8c0 100644 --- a/src/java.base/share/classes/java/io/FilenameFilter.java +++ b/src/java.base/share/classes/java/io/FilenameFilter.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Instances of classes that implement this interface are used to diff --git a/src/java.base/share/classes/java/io/FilterOutputStream.java b/src/java.base/share/classes/java/io/FilterOutputStream.java index 3e89b32adb8..8ffd6f77f5b 100644 --- a/src/java.base/share/classes/java/io/FilterOutputStream.java +++ b/src/java.base/share/classes/java/io/FilterOutputStream.java @@ -45,7 +45,6 @@ * @author Jonathan Payne * @since 1.0 */ - @NullMarked public class FilterOutputStream extends OutputStream { /** @@ -89,7 +88,7 @@ public FilterOutputStream(@Nullable OutputStream out) { * @throws IOException if an I/O error occurs. */ @Override - public void write( int b) throws IOException { + public void write(int b) throws IOException { out.write(b); } diff --git a/src/java.base/share/classes/java/io/FilterReader.java b/src/java.base/share/classes/java/io/FilterReader.java index 422cdf03b67..b90d14e1d81 100644 --- a/src/java.base/share/classes/java/io/FilterReader.java +++ b/src/java.base/share/classes/java/io/FilterReader.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** @@ -84,7 +83,7 @@ public int read(char[] cbuf, int off, int len) throws IOException { * contained {@code Reader}'s {@code skip} method throws an * IllegalArgumentException for a negative parameter */ - public long skip( long n) throws IOException { + public long skip(long n) throws IOException { return in.skip(n); } @@ -109,7 +108,7 @@ public boolean markSupported() { * * @throws IOException If an I/O error occurs */ - public void mark( int readAheadLimit) throws IOException { + public void mark(int readAheadLimit) throws IOException { in.mark(readAheadLimit); } diff --git a/src/java.base/share/classes/java/io/FilterWriter.java b/src/java.base/share/classes/java/io/FilterWriter.java index beb8c3de6ee..0d975ec3480 100644 --- a/src/java.base/share/classes/java/io/FilterWriter.java +++ b/src/java.base/share/classes/java/io/FilterWriter.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** @@ -101,7 +100,7 @@ public void write(char[] cbuf, int off, int len) throws IOException { * * @throws IOException If an I/O error occurs */ - public void write(String str, int off, int len) throws IOException { + public void write(String str, int off, int len) throws IOException { out.write(str, off, len); } diff --git a/src/java.base/share/classes/java/io/Flushable.java b/src/java.base/share/classes/java/io/Flushable.java index 9669e6a9f23..74e67e400bd 100644 --- a/src/java.base/share/classes/java/io/Flushable.java +++ b/src/java.base/share/classes/java/io/Flushable.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.IOException; diff --git a/src/java.base/share/classes/java/io/InputStream.java b/src/java.base/share/classes/java/io/InputStream.java index 8bd521aa720..7c344d16e24 100644 --- a/src/java.base/share/classes/java/io/InputStream.java +++ b/src/java.base/share/classes/java/io/InputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import jdk.internal.util.ArraysSupport; import java.util.ArrayList; diff --git a/src/java.base/share/classes/java/io/LineNumberReader.java b/src/java.base/share/classes/java/io/LineNumberReader.java index 07654da304e..376c70e2b45 100644 --- a/src/java.base/share/classes/java/io/LineNumberReader.java +++ b/src/java.base/share/classes/java/io/LineNumberReader.java @@ -96,7 +96,7 @@ public LineNumberReader(Reader in) { * @param sz * An int specifying the size of the buffer */ - public LineNumberReader(Reader in, int sz) { + public LineNumberReader(Reader in, int sz) { super(in, sz); } @@ -108,7 +108,7 @@ public LineNumberReader(Reader in, int sz) { * * @see #getLineNumber */ - public void setLineNumber( int lineNumber) { + public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } @@ -119,7 +119,7 @@ public void setLineNumber( int lineNumber) { * * @see #setLineNumber */ - public int getLineNumber() { + public int getLineNumber() { return lineNumber; } @@ -274,7 +274,7 @@ public int read(char[] cbuf, int off, int len) throws IOException { /** * {@inheritDoc} */ - public long skip( long n) throws IOException { + public long skip(long n) throws IOException { if (n < 0) throw new IllegalArgumentException("skip() value is negative"); int nn = (int) Math.min(n, maxSkipBufferSize); @@ -308,7 +308,7 @@ public long skip( long n) throws IOException { * @throws IOException * If an I/O error occurs */ - public void mark( int readAheadLimit) throws IOException { + public void mark(int readAheadLimit) throws IOException { synchronized (lock) { // If the most recently read character is '\r', then increment the // read ahead limit as in this case if the next character is '\n', diff --git a/src/java.base/share/classes/java/io/ObjectInput.java b/src/java.base/share/classes/java/io/ObjectInput.java index 97f41173f1d..8898dc3ffeb 100644 --- a/src/java.base/share/classes/java/io/ObjectInput.java +++ b/src/java.base/share/classes/java/io/ObjectInput.java @@ -95,7 +95,7 @@ public interface ObjectInput extends DataInput, AutoCloseable { * @return the actual number of bytes skipped. * @throws IOException If an I/O error has occurred. */ - public long skip(long n) throws IOException; + public long skip(long n) throws IOException; /** * Returns the number of bytes that can be read @@ -103,7 +103,7 @@ public interface ObjectInput extends DataInput, AutoCloseable { * @return the number of available bytes. * @throws IOException If an I/O error has occurred. */ - public int available() throws IOException; + public int available() throws IOException; /** * Closes the input stream. Must be called diff --git a/src/java.base/share/classes/java/io/ObjectInputStream.java b/src/java.base/share/classes/java/io/ObjectInputStream.java index 4c4b3e4f20a..f06f5ad3464 100644 --- a/src/java.base/share/classes/java/io/ObjectInputStream.java +++ b/src/java.base/share/classes/java/io/ObjectInputStream.java @@ -1057,7 +1057,7 @@ public byte readByte() throws IOException { * @throws EOFException If end of file is reached. * @throws IOException If other I/O error has occurred. */ - public int readUnsignedByte() throws IOException { + public int readUnsignedByte() throws IOException { return bin.readUnsignedByte(); } @@ -1090,7 +1090,7 @@ public short readShort() throws IOException { * @throws EOFException If end of file is reached. * @throws IOException If other I/O error has occurred. */ - public int readUnsignedShort() throws IOException { + public int readUnsignedShort() throws IOException { return bin.readUnsignedShort(); } @@ -3241,11 +3241,11 @@ public void readFully(byte[] b) throws IOException { readFully(b, 0, b.length, false); } - public void readFully(byte[] b, int off, int len) throws IOException { + public void readFully(byte[] b, int off, int len) throws IOException { readFully(b, off, len, false); } - public void readFully(byte[] b, int off, int len, boolean copy) + public void readFully(byte[] b, int off, int len, boolean copy) throws IOException { while (len > 0) { diff --git a/src/java.base/share/classes/java/io/ObjectInputValidation.java b/src/java.base/share/classes/java/io/ObjectInputValidation.java index 09465e3d81e..36a331ba51c 100644 --- a/src/java.base/share/classes/java/io/ObjectInputValidation.java +++ b/src/java.base/share/classes/java/io/ObjectInputValidation.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Callback interface to allow validation of objects within a graph. diff --git a/src/java.base/share/classes/java/io/ObjectOutput.java b/src/java.base/share/classes/java/io/ObjectOutput.java index 5b7fdb65392..26456fb0710 100644 --- a/src/java.base/share/classes/java/io/ObjectOutput.java +++ b/src/java.base/share/classes/java/io/ObjectOutput.java @@ -57,7 +57,7 @@ public void writeObject(@Nullable Object obj) * @param b the byte * @throws IOException If an I/O error has occurred. */ - public void write( int b) throws IOException; + public void write(int b) throws IOException; /** * Writes an array of bytes. This method will block until the bytes diff --git a/src/java.base/share/classes/java/io/ObjectOutputStream.java b/src/java.base/share/classes/java/io/ObjectOutputStream.java index a8e35cefb83..53181ed7da3 100644 --- a/src/java.base/share/classes/java/io/ObjectOutputStream.java +++ b/src/java.base/share/classes/java/io/ObjectOutputStream.java @@ -1732,7 +1732,7 @@ public void write(byte[] b) throws IOException { write(b, 0, b.length, false); } - public void write(byte[] b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { write(b, off, len, false); } @@ -1752,7 +1752,7 @@ public void close() throws IOException { * them to underlying stream (to avoid exposing a reference to the * original byte array). */ - void write(byte[] b, int off, int len, boolean copy) + void write(byte[] b, int off, int len, boolean copy) throws IOException { if (!(copy || blkmode)) { // write directly diff --git a/src/java.base/share/classes/java/io/ObjectStreamClass.java b/src/java.base/share/classes/java/io/ObjectStreamClass.java index f4d766fa413..97eda85b591 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamClass.java +++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java @@ -264,7 +264,7 @@ public static ObjectStreamClass lookupAny(Class cl) { * * @return a string representing the name of the class */ - public String getName() { + public String getName() { return name; } @@ -327,7 +327,6 @@ public ObjectStreamField[] getFields() { /** * Return a string describing this ObjectStreamClass. */ - public String toString() { return name + ": static final long serialVersionUID = " + getSerialVersionUID() + "L;"; diff --git a/src/java.base/share/classes/java/io/ObjectStreamConstants.java b/src/java.base/share/classes/java/io/ObjectStreamConstants.java index 584aa093621..a65c2841290 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamConstants.java +++ b/src/java.base/share/classes/java/io/ObjectStreamConstants.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Constants written into the Object Serialization Stream. diff --git a/src/java.base/share/classes/java/io/ObjectStreamField.java b/src/java.base/share/classes/java/io/ObjectStreamField.java index 54251ac9168..d4fc8241836 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamField.java +++ b/src/java.base/share/classes/java/io/ObjectStreamField.java @@ -40,7 +40,7 @@ * @since 1.2 */ @NullMarked -public class ObjectStreamField +public class ObjectStreamField implements Comparable { @@ -194,7 +194,7 @@ public char getTypeCode() { * @return null if this field has a primitive type. */ // REMIND: deprecate? - public @Nullable String getTypeString() { + public @Nullable String getTypeString() { return isPrimitive() ? null : getSignature(); } @@ -226,7 +226,6 @@ protected void setOffset(int offset) { * @return true if and only if this field corresponds to a primitive type */ // REMIND: deprecate? - public boolean isPrimitive() { char tcode = getTypeCode(); return ((tcode != 'L') && (tcode != '[')); @@ -240,7 +239,6 @@ public boolean isPrimitive() { * * @since 1.4 */ - public boolean isUnshared() { return unshared; } @@ -252,8 +250,7 @@ public boolean isUnshared() { * are compared. */ // REMIND: deprecate? - - public int compareTo( Object obj) { + public int compareTo(Object obj) { ObjectStreamField other = (ObjectStreamField) obj; boolean isPrim = isPrimitive(); if (isPrim != other.isPrimitive()) { @@ -265,7 +262,6 @@ public int compareTo( Object obj) { /** * Return a string that describes this field. */ - public String toString() { return getSignature() + ' ' + name; } diff --git a/src/java.base/share/classes/java/io/OutputStream.java b/src/java.base/share/classes/java/io/OutputStream.java index 83f99e25fbb..c6f44bf866c 100644 --- a/src/java.base/share/classes/java/io/OutputStream.java +++ b/src/java.base/share/classes/java/io/OutputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; @@ -49,7 +48,7 @@ * @since 1.0 */ @NullMarked -public abstract class OutputStream implements Closeable, Flushable { +public abstract class OutputStream implements Closeable, Flushable { /** * Constructor for subclasses to call. */ @@ -112,7 +111,7 @@ public void close() { * an {@code IOException} may be thrown if the * output stream has been closed. */ - public abstract void write( int b) throws IOException; + public abstract void write(int b) throws IOException; /** * Writes {@code b.length} bytes from the specified byte array diff --git a/src/java.base/share/classes/java/io/OutputStreamWriter.java b/src/java.base/share/classes/java/io/OutputStreamWriter.java index f4998f54259..c1c75d4b98e 100644 --- a/src/java.base/share/classes/java/io/OutputStreamWriter.java +++ b/src/java.base/share/classes/java/io/OutputStreamWriter.java @@ -224,7 +224,7 @@ public void write(char[] cbuf, int off, int len) throws IOException { * * @throws IOException If an I/O error occurs */ - public void write(String str, int off, int len) throws IOException { + public void write(String str, int off, int len) throws IOException { se.write(str, off, len); } diff --git a/src/java.base/share/classes/java/io/PipedOutputStream.java b/src/java.base/share/classes/java/io/PipedOutputStream.java index 64ce96eda53..5b502fd601d 100644 --- a/src/java.base/share/classes/java/io/PipedOutputStream.java +++ b/src/java.base/share/classes/java/io/PipedOutputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/io/PipedReader.java b/src/java.base/share/classes/java/io/PipedReader.java index edb1658c093..6a001ba53bd 100644 --- a/src/java.base/share/classes/java/io/PipedReader.java +++ b/src/java.base/share/classes/java/io/PipedReader.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; @@ -128,7 +127,7 @@ public PipedReader() { * @throws IllegalArgumentException if {@code pipeSize <= 0}. * @since 1.6 */ - public PipedReader( int pipeSize) { + public PipedReader(int pipeSize) { initPipe(pipeSize); } @@ -239,7 +238,7 @@ synchronized void receivedLast() { * {@link #connect(java.io.PipedWriter) unconnected}, closed, * or an I/O error occurs. */ - public synchronized int read() throws IOException { + public synchronized int read() throws IOException { if (!connected) { throw new IOException("Pipe not connected"); } else if (closedByReader) { diff --git a/src/java.base/share/classes/java/io/PipedWriter.java b/src/java.base/share/classes/java/io/PipedWriter.java index a043f268d0d..6af97e93345 100644 --- a/src/java.base/share/classes/java/io/PipedWriter.java +++ b/src/java.base/share/classes/java/io/PipedWriter.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/io/PrintStream.java b/src/java.base/share/classes/java/io/PrintStream.java index 5ccc4af2d3a..c57438d4b02 100644 --- a/src/java.base/share/classes/java/io/PrintStream.java +++ b/src/java.base/share/classes/java/io/PrintStream.java @@ -64,7 +64,6 @@ * @see Charset#defaultCharset() */ - @NullMarked public class PrintStream extends FilterOutputStream implements Appendable, Closeable @@ -1062,8 +1061,6 @@ public void println(@Nullable Object x) { * * @since 1.5 */ - - public PrintStream printf(String format, @Nullable Object ... args) { return format(format, args); } @@ -1116,7 +1113,6 @@ public PrintStream printf(String format, @Nullable Object ... args) { * * @since 1.5 */ - public PrintStream printf(@Nullable Locale l, String format, @Nullable Object ... args) { return format(l, format, args); } @@ -1162,7 +1158,6 @@ public PrintStream printf(@Nullable Locale l, String format, @Nullable Object .. * * @since 1.5 */ - public PrintStream format(String format, @Nullable Object ... args) { try { synchronized (this) { @@ -1217,7 +1212,6 @@ public PrintStream format(String format, @Nullable Object ... args) { * * @since 1.5 */ - public PrintStream format(@Nullable Locale l, String format, @Nullable Object ... args) { try { synchronized (this) { @@ -1298,7 +1292,7 @@ public PrintStream append(@Nullable CharSequence csq) { * * @since 1.5 */ - public PrintStream append(@Nullable CharSequence csq, int start, int end) { + public PrintStream append(@Nullable CharSequence csq, int start, int end) { if (csq == null) csq = "null"; return append(csq.subSequence(start, end)); } diff --git a/src/java.base/share/classes/java/io/PrintWriter.java b/src/java.base/share/classes/java/io/PrintWriter.java index a0cd55a2c17..378809f2929 100644 --- a/src/java.base/share/classes/java/io/PrintWriter.java +++ b/src/java.base/share/classes/java/io/PrintWriter.java @@ -862,7 +862,6 @@ public void println(@Nullable Object x) { * * @since 1.5 */ - public PrintWriter printf(String format, @Nullable Object ... args) { return format(format, args); } @@ -916,7 +915,6 @@ public PrintWriter printf(String format, @Nullable Object ... args) { * * @since 1.5 */ - public PrintWriter printf(@Nullable Locale l, String format, @Nullable Object ... args) { return format(l, format, args); } @@ -1100,7 +1098,7 @@ public PrintWriter append(@Nullable CharSequence csq) { * * @since 1.5 */ - public PrintWriter append(@Nullable CharSequence csq, int start, int end) { + public PrintWriter append(@Nullable CharSequence csq, int start, int end) { if (csq == null) csq = "null"; return append(csq.subSequence(start, end)); } diff --git a/src/java.base/share/classes/java/io/PushbackInputStream.java b/src/java.base/share/classes/java/io/PushbackInputStream.java index c20fd91a03e..839564507f9 100644 --- a/src/java.base/share/classes/java/io/PushbackInputStream.java +++ b/src/java.base/share/classes/java/io/PushbackInputStream.java @@ -92,7 +92,7 @@ private void ensureOpen() throws IOException { * @throws IllegalArgumentException if {@code size <= 0} * @since 1.1 */ - public PushbackInputStream(InputStream in, int size) { + public PushbackInputStream(InputStream in, int size) { super(in); if (size <= 0) { throw new IllegalArgumentException("size <= 0"); @@ -133,7 +133,7 @@ public PushbackInputStream(InputStream in) { * or an I/O error occurs. * @see java.io.InputStream#read() */ - public int read() throws IOException { + public int read() throws IOException { ensureOpen(); if (pos < buf.length) { return buf[pos++] & 0xff; @@ -164,7 +164,7 @@ public int read() throws IOException { * or an I/O error occurs. * @see java.io.InputStream#read(byte[], int, int) */ - public int read(byte[] b, int off, int len) throws IOException { + public int read(byte[] b, int off, int len) throws IOException { ensureOpen(); if (b == null) { throw new NullPointerException(); @@ -229,7 +229,7 @@ public void unread(int b) throws IOException { * invoking its {@link #close()} method. * @since 1.1 */ - public void unread(byte[] b, int off, int len) throws IOException { + public void unread(byte[] b, int off, int len) throws IOException { ensureOpen(); if (len > pos) { throw new IOException("Push back buffer is full"); @@ -275,7 +275,7 @@ public void unread(byte[] b) throws IOException { * @see java.io.FilterInputStream#in * @see java.io.InputStream#available() */ - public int available() throws IOException { + public int available() throws IOException { ensureOpen(); int n = buf.length - pos; int avail = super.available(); @@ -306,7 +306,7 @@ public int available() throws IOException { * @see java.io.InputStream#skip(long n) * @since 1.2 */ - public long skip(long n) throws IOException { + public long skip(long n) throws IOException { ensureOpen(); if (n <= 0) { return 0; diff --git a/src/java.base/share/classes/java/io/PushbackReader.java b/src/java.base/share/classes/java/io/PushbackReader.java index 9fbf3ffc7a1..8d198fa32d2 100644 --- a/src/java.base/share/classes/java/io/PushbackReader.java +++ b/src/java.base/share/classes/java/io/PushbackReader.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; @@ -54,7 +53,7 @@ public class PushbackReader extends FilterReader { * @param size The size of the pushback buffer * @throws IllegalArgumentException if {@code size <= 0} */ - public PushbackReader(Reader in, int size) { + public PushbackReader(Reader in, int size) { super(in); if (size <= 0) { throw new IllegalArgumentException("size <= 0"); @@ -206,7 +205,7 @@ public boolean ready() throws IOException { * * @throws IOException Always, since mark is not supported */ - public void mark( int readAheadLimit) throws IOException { + public void mark(int readAheadLimit) throws IOException { throw new IOException("mark/reset not supported"); } @@ -247,7 +246,7 @@ public void close() throws IOException { /** * {@inheritDoc} */ - public long skip( long n) throws IOException { + public long skip(long n) throws IOException { if (n < 0L) throw new IllegalArgumentException("skip value is negative"); synchronized (lock) { diff --git a/src/java.base/share/classes/java/io/RandomAccessFile.java b/src/java.base/share/classes/java/io/RandomAccessFile.java index 8ee8bd63f67..6513c70ffa2 100644 --- a/src/java.base/share/classes/java/io/RandomAccessFile.java +++ b/src/java.base/share/classes/java/io/RandomAccessFile.java @@ -66,7 +66,7 @@ */ @NullMarked -public class RandomAccessFile implements DataOutput, DataInput, Closeable { +public class RandomAccessFile implements DataOutput, DataInput, Closeable { private static final int O_RDONLY = 1; private static final int O_RDWR = 2; @@ -525,7 +525,7 @@ public final void readFully(byte[] b, int off, int len) throws IOException { * @return the actual number of bytes skipped. * @throws IOException if an I/O error occurs. */ - public int skipBytes( int n) throws IOException { + public int skipBytes(int n) throws IOException { long pos; long len; long newpos; @@ -582,7 +582,7 @@ private void traceImplWrite(int b) throws IOException { } } - private native void write0( int b) throws IOException; + private native void write0(int b) throws IOException; /** * Writes a sub array as a sequence of bytes. @@ -672,7 +672,7 @@ public void write(byte[] b, int off, int len) throws IOException { * @throws IOException if {@code pos} is less than * {@code 0} or if an I/O error occurs. */ - public void seek( long pos) throws IOException { + public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException("Negative seek offset"); } @@ -822,7 +822,7 @@ public final byte readByte() throws IOException { * @throws EOFException if this file has reached the end. * @throws IOException if an I/O error occurs. */ - public final int readUnsignedByte() throws IOException { + public final int readUnsignedByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); @@ -1123,7 +1123,7 @@ public final void writeBoolean(boolean v) throws IOException { * @param v a {@code byte} value to be written. * @throws IOException if an I/O error occurs. */ - public final void writeByte( int v) throws IOException { + public final void writeByte(int v) throws IOException { write(v); } diff --git a/src/java.base/share/classes/java/io/Reader.java b/src/java.base/share/classes/java/io/Reader.java index 742d25ca5db..98d6b5c76bc 100644 --- a/src/java.base/share/classes/java/io/Reader.java +++ b/src/java.base/share/classes/java/io/Reader.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.nio.CharBuffer; import java.nio.ReadOnlyBufferException; @@ -59,7 +58,7 @@ */ @NullMarked -public abstract class Reader implements Readable, Closeable { +public abstract class Reader implements Readable, Closeable { private static final int TRANSFER_BUFFER_SIZE = 8192; @@ -574,7 +573,7 @@ public String readAllAsString() throws IOException { * @throws IllegalArgumentException If {@code n} is negative. * @throws IOException If an I/O error occurs */ - public long skip( long n) throws IOException { + public long skip(long n) throws IOException { if (n < 0L) throw new IllegalArgumentException("skip value is negative"); synchronized (lock) { @@ -629,7 +628,7 @@ public boolean markSupported() { * @throws IOException If the stream does not support mark(), * or if some other I/O error occurs */ - public void mark( int readAheadLimit) throws IOException { + public void mark(int readAheadLimit) throws IOException { throw new IOException("mark() not supported"); } diff --git a/src/java.base/share/classes/java/io/SequenceInputStream.java b/src/java.base/share/classes/java/io/SequenceInputStream.java index f636ebdd126..ff17114a378 100644 --- a/src/java.base/share/classes/java/io/SequenceInputStream.java +++ b/src/java.base/share/classes/java/io/SequenceInputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Arrays; import java.util.Collections; diff --git a/src/java.base/share/classes/java/io/StreamTokenizer.java b/src/java.base/share/classes/java/io/StreamTokenizer.java index cf6f00ac379..e145b0cb98e 100644 --- a/src/java.base/share/classes/java/io/StreamTokenizer.java +++ b/src/java.base/share/classes/java/io/StreamTokenizer.java @@ -66,7 +66,7 @@ */ @NullMarked -public class StreamTokenizer { +public class StreamTokenizer { /* Only one of these will be non-null */ private Reader reader = null; @@ -765,7 +765,7 @@ public void pushBack() { * * @return the current line number of this stream tokenizer. */ - public int lineno() { + public int lineno() { return LINENO; } @@ -785,7 +785,6 @@ public int lineno() { * @see java.io.StreamTokenizer#sval * @see java.io.StreamTokenizer#ttype */ - public String toString() { String ret = switch (ttype) { case TT_EOF -> "EOF"; diff --git a/src/java.base/share/classes/java/io/StringBufferInputStream.java b/src/java.base/share/classes/java/io/StringBufferInputStream.java index 0550785d06c..489c67c5035 100644 --- a/src/java.base/share/classes/java/io/StringBufferInputStream.java +++ b/src/java.base/share/classes/java/io/StringBufferInputStream.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * This class allows an application to create an input stream in diff --git a/src/java.base/share/classes/java/io/StringReader.java b/src/java.base/share/classes/java/io/StringReader.java index 7d9946ca1af..01e48492400 100644 --- a/src/java.base/share/classes/java/io/StringReader.java +++ b/src/java.base/share/classes/java/io/StringReader.java @@ -26,7 +26,6 @@ package java.io; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/io/StringWriter.java b/src/java.base/share/classes/java/io/StringWriter.java index fcb641564b3..7d8394e3719 100644 --- a/src/java.base/share/classes/java/io/StringWriter.java +++ b/src/java.base/share/classes/java/io/StringWriter.java @@ -68,7 +68,7 @@ public StringWriter() { * @throws IllegalArgumentException * If {@code initialSize} is negative */ - public StringWriter( int initialSize) { + public StringWriter(int initialSize) { if (initialSize < 0) { throw new IllegalArgumentException("Negative buffer size"); } @@ -122,7 +122,7 @@ public void write(String str) { * or {@code off + len} is negative or greater than the length * of the given string */ - public void write(String str, int off, int len) { + public void write(String str, int off, int len) { buf.append(str, off, off + len); } @@ -191,7 +191,7 @@ public StringWriter append(@Nullable CharSequence csq) { * * @since 1.5 */ - public StringWriter append(@Nullable CharSequence csq, int start, int end) { + public StringWriter append(@Nullable CharSequence csq, int start, int end) { if (csq == null) csq = "null"; return append(csq.subSequence(start, end)); } @@ -221,7 +221,6 @@ public StringWriter append(char c) { /** * Return the buffer's current value as a string. */ - public String toString() { return buf.toString(); } diff --git a/src/java.base/share/classes/java/io/Writer.java b/src/java.base/share/classes/java/io/Writer.java index 37ea59748f5..f9b638bb2cd 100644 --- a/src/java.base/share/classes/java/io/Writer.java +++ b/src/java.base/share/classes/java/io/Writer.java @@ -51,7 +51,7 @@ */ @NullMarked -public abstract class Writer implements Appendable, Closeable, Flushable { +public abstract class Writer implements Appendable, Closeable, Flushable { /** * Temporary buffer used to hold writes of strings and single characters @@ -365,7 +365,7 @@ public Writer append(@Nullable CharSequence csq) throws IOException { * * @since 1.5 */ - public Writer append(@Nullable CharSequence csq, int start, int end) throws IOException { + public Writer append(@Nullable CharSequence csq, int start, int end) throws IOException { if (csq == null) csq = "null"; return append(csq.subSequence(start, end)); } diff --git a/src/java.base/share/classes/java/lang/AbstractMethodError.java b/src/java.base/share/classes/java/lang/AbstractMethodError.java index 125768f3d0b..af3bad9e01e 100644 --- a/src/java.base/share/classes/java/lang/AbstractMethodError.java +++ b/src/java.base/share/classes/java/lang/AbstractMethodError.java @@ -45,7 +45,6 @@ public class AbstractMethodError extends IncompatibleClassChangeError { /** * Constructs an {@code AbstractMethodError} with no detail message. */ - public AbstractMethodError() { super(); } @@ -56,7 +55,6 @@ public AbstractMethodError() { * * @param s the detail message. */ - public AbstractMethodError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java index f27d897776d..998ea00a900 100644 --- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java +++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java @@ -100,7 +100,7 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence /** * Creates an AbstractStringBuilder of the specified capacity. */ - AbstractStringBuilder( int capacity) { + AbstractStringBuilder(int capacity) { if (COMPACT_STRINGS) { value = new byte[capacity]; coder = LATIN1; @@ -198,9 +198,8 @@ int compareTo(AbstractStringBuilder another) { * @return the length of the sequence of characters currently * represented by this object */ - @Override - public int length() { + public int length() { return count; } @@ -211,7 +210,7 @@ public int length() { * * @return the current capacity */ - public int capacity() { + public int capacity() { return value.length >> coder; } @@ -231,7 +230,7 @@ public int capacity() { * * @param minimumCapacity the minimum desired capacity. */ - public void ensureCapacity( int minimumCapacity) { + public void ensureCapacity(int minimumCapacity) { if (minimumCapacity > 0) { value = ensureCapacitySameCoder(value, coder, minimumCapacity); } @@ -392,7 +391,7 @@ public void trimToSize() { * @throws IndexOutOfBoundsException if the * {@code newLength} argument is negative. */ - public void setLength( int newLength) { + public void setLength(int newLength) { if (newLength < 0) { throw new StringIndexOutOfBoundsException(newLength); } @@ -553,7 +552,7 @@ public int codePointCount(int beginIndex, int endIndex) { * before {@code index} has fewer than the absolute value of * {@code codePointOffset} code points. */ - public int offsetByCodePoints( int index, int codePointOffset) { + public int offsetByCodePoints(int index, int codePointOffset) { if (index < 0 || index > count) { throw new IndexOutOfBoundsException(); } @@ -755,7 +754,7 @@ private AbstractStringBuilder appendNull() { * {@code end} is greater than {@code s.length()} */ @Override - public AbstractStringBuilder append(@Nullable CharSequence s, int start, int end) { + public AbstractStringBuilder append(@Nullable CharSequence s, int start, int end) { if (s == null) { s = "null"; } @@ -1023,7 +1022,7 @@ public AbstractStringBuilder append(double d) { * is negative, greater than {@code length()}, or * greater than {@code end}. */ - public AbstractStringBuilder delete( int start, int end) { + public AbstractStringBuilder delete(int start, int end) { int count = this.count; if (end > count) { end = count; @@ -1142,7 +1141,7 @@ public AbstractStringBuilder replace(int start, int end, String str) { * @throws StringIndexOutOfBoundsException if {@code start} is * less than zero, or greater than the length of this object. */ - public String substring( int start) { + public String substring(int start) { return substring(start, count); } @@ -1172,7 +1171,7 @@ public String substring( int start) { * or if {@code start} is greater than {@code end} */ @Override - public CharSequence subSequence( int start, int end) { + public CharSequence subSequence(int start, int end) { return substring(start, end); } @@ -1224,8 +1223,8 @@ private static void shift(byte[] value, byte coder, int count, int offset, int n * {@code (offset+len)} is greater than * {@code str.length}. */ - public AbstractStringBuilder insert( int index, char[] str, int offset, - int len) + public AbstractStringBuilder insert(int index, char[] str, int offset, + int len) { byte coder = this.coder; int count = this.count; @@ -1262,7 +1261,7 @@ public AbstractStringBuilder insert( int index, char[] str, int offset, * @return a reference to this object. * @throws StringIndexOutOfBoundsException if the offset is invalid. */ - public AbstractStringBuilder insert( int offset, Object obj) { + public AbstractStringBuilder insert(int offset, Object obj) { return insert(offset, String.valueOf(obj)); } @@ -1383,7 +1382,7 @@ public AbstractStringBuilder insert(int offset, char[] str) { * @return a reference to this object. * @throws IndexOutOfBoundsException if the offset is invalid. */ - public AbstractStringBuilder insert( int dstOffset, @Nullable CharSequence s) { + public AbstractStringBuilder insert(int dstOffset, @Nullable CharSequence s) { if (s == null) { s = "null"; } @@ -1438,8 +1437,8 @@ public AbstractStringBuilder insert( int dstOffset, @Nullable CharSequence s) { * {@code start} is greater than {@code end} or * {@code end} is greater than {@code s.length()} */ - public AbstractStringBuilder insert( int dstOffset, @Nullable CharSequence s, - int start, int end) + public AbstractStringBuilder insert(int dstOffset, @Nullable CharSequence s, + int start, int end) { if (s == null) { s = "null"; @@ -1483,7 +1482,7 @@ public AbstractStringBuilder insert( int dstOffset, @Nullable CharSequence s, * @return a reference to this object. * @throws StringIndexOutOfBoundsException if the offset is invalid. */ - public AbstractStringBuilder insert( int offset, boolean b) { + public AbstractStringBuilder insert(int offset, boolean b) { return insert(offset, String.valueOf(b)); } @@ -1546,7 +1545,7 @@ public AbstractStringBuilder insert(int offset, char c) { * @return a reference to this object. * @throws StringIndexOutOfBoundsException if the offset is invalid. */ - public AbstractStringBuilder insert( int offset, int i) { + public AbstractStringBuilder insert(int offset, int i) { return insert(offset, String.valueOf(i)); } @@ -1569,7 +1568,7 @@ public AbstractStringBuilder insert( int offset, int i) { * @return a reference to this object. * @throws StringIndexOutOfBoundsException if the offset is invalid. */ - public AbstractStringBuilder insert( int offset, long l) { + public AbstractStringBuilder insert(int offset, long l) { return insert(offset, String.valueOf(l)); } @@ -1592,7 +1591,7 @@ public AbstractStringBuilder insert( int offset, long l) { * @return a reference to this object. * @throws StringIndexOutOfBoundsException if the offset is invalid. */ - public AbstractStringBuilder insert( int offset, float f) { + public AbstractStringBuilder insert(int offset, float f) { return insert(offset, String.valueOf(f)); } @@ -1615,7 +1614,7 @@ public AbstractStringBuilder insert( int offset, float f) { * @return a reference to this object. * @throws StringIndexOutOfBoundsException if the offset is invalid. */ - public AbstractStringBuilder insert( int offset, double d) { + public AbstractStringBuilder insert(int offset, double d) { return insert(offset, String.valueOf(d)); } @@ -1633,8 +1632,7 @@ public AbstractStringBuilder insert( int offset, double d) { * @return the index of the first occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */ - - public int indexOf(String str) { + public int indexOf(String str) { return indexOf(str, 0); } @@ -1655,8 +1653,7 @@ public int indexOf(String str) { * starting at the specified index, * or {@code -1} if there is no such occurrence. */ - - public int indexOf(String str, int fromIndex) { + public int indexOf(String str, int fromIndex) { return String.indexOf(value, coder, count, str, fromIndex); } @@ -1675,8 +1672,7 @@ public int indexOf(String str, int fromIndex) { * @return the index of the last occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */ - - public int lastIndexOf(String str) { + public int lastIndexOf(String str) { return lastIndexOf(str, count); } @@ -1697,8 +1693,7 @@ public int lastIndexOf(String str) { * searching backward from the specified index, * or {@code -1} if there is no such occurrence. */ - - public int lastIndexOf(String str, int fromIndex) { + public int lastIndexOf(String str, int fromIndex) { return String.lastIndexOf(value, coder, count, str, fromIndex); } @@ -1750,7 +1745,6 @@ public AbstractStringBuilder reverse() { * * @return a string representation of this sequence of characters. */ - @Override public abstract String toString(); diff --git a/src/java.base/share/classes/java/lang/Appendable.java b/src/java.base/share/classes/java/lang/Appendable.java index 6d880ce091c..2e175c49df4 100644 --- a/src/java.base/share/classes/java/lang/Appendable.java +++ b/src/java.base/share/classes/java/lang/Appendable.java @@ -116,7 +116,7 @@ public interface Appendable { * @throws IOException * If an I/O error occurs */ - Appendable append(@Nullable CharSequence csq, int start, int end) throws IOException; + Appendable append(@Nullable CharSequence csq, int start, int end) throws IOException; /** * Appends the specified character to this {@code Appendable}. diff --git a/src/java.base/share/classes/java/lang/ArithmeticException.java b/src/java.base/share/classes/java/lang/ArithmeticException.java index 944b91b8ec0..25c9f14db57 100644 --- a/src/java.base/share/classes/java/lang/ArithmeticException.java +++ b/src/java.base/share/classes/java/lang/ArithmeticException.java @@ -49,7 +49,6 @@ public class ArithmeticException extends RuntimeException { * Constructs an {@code ArithmeticException} with no detail * message. */ - public ArithmeticException() { super(); } @@ -60,7 +59,6 @@ public ArithmeticException() { * * @param s the detail message. */ - public ArithmeticException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java b/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java index b02ee9d1322..ed3af72f27e 100644 --- a/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java +++ b/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java @@ -43,7 +43,6 @@ public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException { * Constructs an {@code ArrayIndexOutOfBoundsException} with no detail * message. */ - public ArrayIndexOutOfBoundsException() { super(); } @@ -54,7 +53,6 @@ public ArrayIndexOutOfBoundsException() { * * @param s the detail message. */ - public ArrayIndexOutOfBoundsException(@Nullable String s) { super(s); } @@ -68,7 +66,6 @@ public ArrayIndexOutOfBoundsException(@Nullable String s) { * * @param index the illegal index. */ - public ArrayIndexOutOfBoundsException(int index) { super("Array index out of range: " + index); } diff --git a/src/java.base/share/classes/java/lang/ArrayStoreException.java b/src/java.base/share/classes/java/lang/ArrayStoreException.java index ea91ff909a9..4d40f8bef07 100644 --- a/src/java.base/share/classes/java/lang/ArrayStoreException.java +++ b/src/java.base/share/classes/java/lang/ArrayStoreException.java @@ -47,7 +47,6 @@ public class ArrayStoreException extends RuntimeException { /** * Constructs an {@code ArrayStoreException} with no detail message. */ - public ArrayStoreException() { super(); } @@ -58,7 +57,6 @@ public ArrayStoreException() { * * @param s the detail message. */ - public ArrayStoreException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/AssertionError.java b/src/java.base/share/classes/java/lang/AssertionError.java index 5d195d6aa60..1fc7dffd389 100644 --- a/src/java.base/share/classes/java/lang/AssertionError.java +++ b/src/java.base/share/classes/java/lang/AssertionError.java @@ -51,7 +51,6 @@ public class AssertionError extends Error { /** * Constructs an AssertionError with no detail message. */ - public AssertionError() { } @@ -60,7 +59,6 @@ public AssertionError() { * even if it is a null reference. The public constructors will * never call this constructor with a null argument. */ - private AssertionError(String detailMessage) { super(detailMessage); } @@ -92,7 +90,6 @@ public AssertionError(@Nullable Object detailMessage) { * * @param detailMessage value to be used in constructing detail message */ - public AssertionError(boolean detailMessage) { this(String.valueOf(detailMessage)); } @@ -105,7 +102,6 @@ public AssertionError(boolean detailMessage) { * * @param detailMessage value to be used in constructing detail message */ - public AssertionError(char detailMessage) { this(String.valueOf(detailMessage)); } @@ -118,7 +114,6 @@ public AssertionError(char detailMessage) { * * @param detailMessage value to be used in constructing detail message */ - public AssertionError(int detailMessage) { this(String.valueOf(detailMessage)); } @@ -131,7 +126,6 @@ public AssertionError(int detailMessage) { * * @param detailMessage value to be used in constructing detail message */ - public AssertionError(long detailMessage) { this(String.valueOf(detailMessage)); } @@ -144,7 +138,6 @@ public AssertionError(long detailMessage) { * * @param detailMessage value to be used in constructing detail message */ - public AssertionError(float detailMessage) { this(String.valueOf(detailMessage)); } @@ -157,7 +150,6 @@ public AssertionError(float detailMessage) { * * @param detailMessage value to be used in constructing detail message */ - public AssertionError(double detailMessage) { this(String.valueOf(detailMessage)); } @@ -175,7 +167,6 @@ public AssertionError(double detailMessage) { * * @since 1.7 */ - public AssertionError(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } diff --git a/src/java.base/share/classes/java/lang/Boolean.java b/src/java.base/share/classes/java/lang/Boolean.java index 2825fea4b90..2d4dc1967e8 100644 --- a/src/java.base/share/classes/java/lang/Boolean.java +++ b/src/java.base/share/classes/java/lang/Boolean.java @@ -75,13 +75,13 @@ * The {@code Boolean} object corresponding to the primitive * value {@code true}. */ - public static final Boolean TRUE = new Boolean(true); + public static final Boolean TRUE = new Boolean(true); /** * The {@code Boolean} object corresponding to the primitive * value {@code false}. */ - public static final Boolean FALSE = new Boolean(false); + public static final Boolean FALSE = new Boolean(false); /** * The Class object representing the primitive type boolean. @@ -155,9 +155,6 @@ public Boolean(@Nullable String s) { * @return the boolean represented by the string argument * @since 1.5 */ - - - public static boolean parseBoolean(@Nullable String s) { return "true".equalsIgnoreCase(s); } @@ -216,9 +213,7 @@ public static Boolean valueOf(boolean b) { * @param s a string. * @return the {@code Boolean} value represented by the string. */ - - - public static Boolean valueOf(@Nullable String s) { + public static Boolean valueOf(@Nullable String s) { return parseBoolean(s) ? TRUE : FALSE; } @@ -256,8 +251,6 @@ public String toString() { * {@code true}; returns the integer {@code 1237} if this * object represents {@code false}. */ - - @Override public int hashCode() { return Boolean.hashCode(value); @@ -271,8 +264,6 @@ public int hashCode() { * @return a hash code value for a {@code boolean} value. * @since 1.8 */ - - public static int hashCode(boolean value) { return value ? 1231 : 1237; } @@ -323,8 +314,6 @@ public static boolean getBoolean(@Nullable String name) { * @see Comparable * @since 1.5 */ - - public int compareTo(Boolean b) { return compare(this.value, b.value); } @@ -343,8 +332,6 @@ public int compareTo(Boolean b) { * a value greater than {@code 0} if {@code x && !y} * @since 1.7 */ - - public static int compare(boolean x, boolean y) { return (x == y) ? 0 : (x ? 1 : -1); } @@ -359,8 +346,6 @@ public static int compare(boolean x, boolean y) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static boolean logicalAnd(boolean a, boolean b) { return a && b; } @@ -375,8 +360,6 @@ public static boolean logicalAnd(boolean a, boolean b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static boolean logicalOr(boolean a, boolean b) { return a || b; } @@ -391,8 +374,6 @@ public static boolean logicalOr(boolean a, boolean b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static boolean logicalXor(boolean a, boolean b) { return a ^ b; } diff --git a/src/java.base/share/classes/java/lang/Byte.java b/src/java.base/share/classes/java/lang/Byte.java index 136e685bd3d..3dbabaef4a5 100644 --- a/src/java.base/share/classes/java/lang/Byte.java +++ b/src/java.base/share/classes/java/lang/Byte.java @@ -82,13 +82,13 @@ * A constant holding the minimum value a {@code byte} can * have, -27. */ - public static final byte MIN_VALUE = -128; + public static final byte MIN_VALUE = -128; /** * A constant holding the maximum value a {@code byte} can * have, 27-1. */ - public static final byte MAX_VALUE = 127; + public static final byte MAX_VALUE = 127; /** * The {@code Class} instance representing the primitive type @@ -229,9 +229,7 @@ public static Byte valueOf(byte b) { * @throws NumberFormatException If the string does * not contain a parsable {@code byte}. */ - - - public static byte parseByte(String s, int radix) + public static byte parseByte(String s, int radix) throws NumberFormatException { int i = Integer.parseInt(s, radix); if (i < MIN_VALUE || i > MAX_VALUE) @@ -258,8 +256,6 @@ public static byte parseByte(String s, int radix) * @throws NumberFormatException if the string does not * contain a parsable {@code byte}. */ - - public static byte parseByte(String s) throws NumberFormatException { return parseByte(s, 10); } @@ -289,9 +285,7 @@ public static byte parseByte(String s) throws NumberFormatException { * @throws NumberFormatException If the {@code String} does * not contain a parsable {@code byte}. */ - - - public static Byte valueOf(String s, int radix) + public static Byte valueOf(String s, int radix) throws NumberFormatException { return valueOf(parseByte(s, radix)); } @@ -318,9 +312,7 @@ public static Byte valueOf(String s, int radix) * @throws NumberFormatException If the {@code String} does * not contain a parsable {@code byte}. */ - - - public static Byte valueOf(String s) throws NumberFormatException { + public static Byte valueOf(String s) throws NumberFormatException { return valueOf(s, 10); } @@ -366,8 +358,6 @@ public static Byte valueOf(String s) throws NumberFormatException { * contain a parsable {@code byte}. * @see java.lang.Byte#parseByte(java.lang.String, int) */ - - public static Byte decode(String nm) throws NumberFormatException { int i = Integer.decode(nm); if (i < MIN_VALUE || i > MAX_VALUE) @@ -438,9 +428,7 @@ public byte byteValue() { * a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public short shortValue() { + public short shortValue() { return (short)value; } @@ -449,9 +437,7 @@ public short shortValue() { * a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public int intValue() { + public int intValue() { return (int)value; } @@ -460,9 +446,7 @@ public int intValue() { * a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public long longValue() { + public long longValue() { return (long)value; } @@ -471,9 +455,7 @@ public long longValue() { * a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public float floatValue() { + public float floatValue() { return (float)value; } @@ -482,9 +464,7 @@ public float floatValue() { * after a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public double doubleValue() { + public double doubleValue() { return (double)value; } @@ -509,8 +489,6 @@ public String toString() { * * @return a hash code value for this {@code Byte} */ - - @Override public int hashCode() { return Byte.hashCode(value); @@ -524,8 +502,6 @@ public int hashCode() { * @return a hash code value for a {@code byte} value. * @since 1.8 */ - - public static int hashCode(byte value) { return (int)value; } @@ -560,8 +536,6 @@ public boolean equals(@Nullable Object obj) { * comparison). * @since 1.2 */ - - public int compareTo(Byte anotherByte) { return compare(this.value, anotherByte.value); } @@ -580,8 +554,6 @@ public int compareTo(Byte anotherByte) { * a value greater than {@code 0} if {@code x > y} * @since 1.7 */ - - public static int compare(byte x, byte y) { return x - y; } @@ -598,8 +570,6 @@ public static int compare(byte x, byte y) { * unsigned values * @since 9 */ - - public static int compareUnsigned(byte x, byte y) { return Byte.toUnsignedInt(x) - Byte.toUnsignedInt(y); } @@ -620,8 +590,6 @@ public static int compareUnsigned(byte x, byte y) { * conversion * @since 1.8 */ - - public static int toUnsignedInt(byte x) { return ((int) x) & 0xff; } @@ -642,8 +610,6 @@ public static int toUnsignedInt(byte x) { * conversion * @since 1.8 */ - - public static long toUnsignedLong(byte x) { return ((long) x) & 0xffL; } @@ -655,7 +621,7 @@ public static long toUnsignedLong(byte x) { * * @since 1.5 */ - public static final int SIZE = 8; + public static final int SIZE = 8; /** * The number of bytes used to represent a {@code byte} value in two's @@ -663,7 +629,7 @@ public static long toUnsignedLong(byte x) { * * @since 1.8 */ - public static final int BYTES = SIZE / Byte.SIZE; + public static final int BYTES = SIZE / Byte.SIZE; /** use serialVersionUID from JDK 1.1. for interoperability */ @java.io.Serial diff --git a/src/java.base/share/classes/java/lang/CharSequence.java b/src/java.base/share/classes/java/lang/CharSequence.java index 3872e3e6a23..0f9fd1a6b5d 100644 --- a/src/java.base/share/classes/java/lang/CharSequence.java +++ b/src/java.base/share/classes/java/lang/CharSequence.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.NoSuchElementException; import java.util.Objects; @@ -68,8 +67,6 @@ public interface CharSequence { * * @return the number of {@code char}s in this sequence */ - - int length(); /** @@ -90,7 +87,7 @@ public interface CharSequence { * if the {@code index} argument is negative or not less than * {@code length()} */ - char charAt( int index); + char charAt(int index); /** * Returns {@code true} if this character sequence is empty. @@ -125,7 +122,7 @@ default boolean isEmpty() { * if {@code end} is greater than {@code length()}, * or if {@code start} is greater than {@code end} */ - CharSequence subSequence( int start, int end); + CharSequence subSequence(int start, int end); /** * Returns a string containing the characters in this sequence in the same @@ -134,8 +131,7 @@ default boolean isEmpty() { * * @return a string consisting of exactly this sequence of characters */ - - public String toString(); + public String toString(); /** * Returns a stream of {@code int} zero-extending the {@code char} values diff --git a/src/java.base/share/classes/java/lang/Character.java b/src/java.base/share/classes/java/lang/Character.java index 5b68942fed2..43db36e0302 100644 --- a/src/java.base/share/classes/java/lang/Character.java +++ b/src/java.base/share/classes/java/lang/Character.java @@ -249,7 +249,7 @@ * @see Integer#toString(int, int) * @see Integer#valueOf(String) */ - public static final int MIN_RADIX = 2; + public static final int MIN_RADIX = 2; /** * The maximum radix available for conversion to and from strings. @@ -263,7 +263,7 @@ * @see Integer#toString(int, int) * @see Integer#valueOf(String) */ - public static final int MAX_RADIX = 36; + public static final int MAX_RADIX = 36; /** * The constant value of this field is the smallest value of type @@ -271,7 +271,7 @@ * * @since 1.0.2 */ - public static final char MIN_VALUE = '\u0000'; + public static final char MIN_VALUE = '\u0000'; /** * The constant value of this field is the largest value of type @@ -279,7 +279,7 @@ * * @since 1.0.2 */ - public static final char MAX_VALUE = '\uFFFF'; + public static final char MAX_VALUE = '\uFFFF'; /** * The {@code Class} instance representing the primitive type @@ -301,55 +301,55 @@ * General category "Cn" in the Unicode specification. * @since 1.1 */ - public static final byte UNASSIGNED = 0; + public static final byte UNASSIGNED = 0; /** * General category "Lu" in the Unicode specification. * @since 1.1 */ - public static final byte UPPERCASE_LETTER = 1; + public static final byte UPPERCASE_LETTER = 1; /** * General category "Ll" in the Unicode specification. * @since 1.1 */ - public static final byte LOWERCASE_LETTER = 2; + public static final byte LOWERCASE_LETTER = 2; /** * General category "Lt" in the Unicode specification. * @since 1.1 */ - public static final byte TITLECASE_LETTER = 3; + public static final byte TITLECASE_LETTER = 3; /** * General category "Lm" in the Unicode specification. * @since 1.1 */ - public static final byte MODIFIER_LETTER = 4; + public static final byte MODIFIER_LETTER = 4; /** * General category "Lo" in the Unicode specification. * @since 1.1 */ - public static final byte OTHER_LETTER = 5; + public static final byte OTHER_LETTER = 5; /** * General category "Mn" in the Unicode specification. * @since 1.1 */ - public static final byte NON_SPACING_MARK = 6; + public static final byte NON_SPACING_MARK = 6; /** * General category "Me" in the Unicode specification. * @since 1.1 */ - public static final byte ENCLOSING_MARK = 7; + public static final byte ENCLOSING_MARK = 7; /** * General category "Mc" in the Unicode specification. * @since 1.1 */ - public static final byte COMBINING_SPACING_MARK = 8; + public static final byte COMBINING_SPACING_MARK = 8; /** * General category "Nd" in the Unicode specification. @@ -361,126 +361,126 @@ * General category "Nl" in the Unicode specification. * @since 1.1 */ - public static final byte LETTER_NUMBER = 10; + public static final byte LETTER_NUMBER = 10; /** * General category "No" in the Unicode specification. * @since 1.1 */ - public static final byte OTHER_NUMBER = 11; + public static final byte OTHER_NUMBER = 11; /** * General category "Zs" in the Unicode specification. * @since 1.1 */ - public static final byte SPACE_SEPARATOR = 12; + public static final byte SPACE_SEPARATOR = 12; /** * General category "Zl" in the Unicode specification. * @since 1.1 */ - public static final byte LINE_SEPARATOR = 13; + public static final byte LINE_SEPARATOR = 13; /** * General category "Zp" in the Unicode specification. * @since 1.1 */ - public static final byte PARAGRAPH_SEPARATOR = 14; + public static final byte PARAGRAPH_SEPARATOR = 14; /** * General category "Cc" in the Unicode specification. * @since 1.1 */ - public static final byte CONTROL = 15; + public static final byte CONTROL = 15; /** * General category "Cf" in the Unicode specification. * @since 1.1 */ - public static final byte FORMAT = 16; + public static final byte FORMAT = 16; /** * General category "Co" in the Unicode specification. * @since 1.1 */ - public static final byte PRIVATE_USE = 18; + public static final byte PRIVATE_USE = 18; /** * General category "Cs" in the Unicode specification. * @since 1.1 */ - public static final byte SURROGATE = 19; + public static final byte SURROGATE = 19; /** * General category "Pd" in the Unicode specification. * @since 1.1 */ - public static final byte DASH_PUNCTUATION = 20; + public static final byte DASH_PUNCTUATION = 20; /** * General category "Ps" in the Unicode specification. * @since 1.1 */ - public static final byte START_PUNCTUATION = 21; + public static final byte START_PUNCTUATION = 21; /** * General category "Pe" in the Unicode specification. * @since 1.1 */ - public static final byte END_PUNCTUATION = 22; + public static final byte END_PUNCTUATION = 22; /** * General category "Pc" in the Unicode specification. * @since 1.1 */ - public static final byte CONNECTOR_PUNCTUATION = 23; + public static final byte CONNECTOR_PUNCTUATION = 23; /** * General category "Po" in the Unicode specification. * @since 1.1 */ - public static final byte OTHER_PUNCTUATION = 24; + public static final byte OTHER_PUNCTUATION = 24; /** * General category "Sm" in the Unicode specification. * @since 1.1 */ - public static final byte MATH_SYMBOL = 25; + public static final byte MATH_SYMBOL = 25; /** * General category "Sc" in the Unicode specification. * @since 1.1 */ - public static final byte CURRENCY_SYMBOL = 26; + public static final byte CURRENCY_SYMBOL = 26; /** * General category "Sk" in the Unicode specification. * @since 1.1 */ - public static final byte MODIFIER_SYMBOL = 27; + public static final byte MODIFIER_SYMBOL = 27; /** * General category "So" in the Unicode specification. * @since 1.1 */ - public static final byte OTHER_SYMBOL = 28; + public static final byte OTHER_SYMBOL = 28; /** * General category "Pi" in the Unicode specification. * @since 1.4 */ - public static final byte INITIAL_QUOTE_PUNCTUATION = 29; + public static final byte INITIAL_QUOTE_PUNCTUATION = 29; /** * General category "Pf" in the Unicode specification. * @since 1.4 */ - public static final byte FINAL_QUOTE_PUNCTUATION = 30; + public static final byte FINAL_QUOTE_PUNCTUATION = 30; /** * Error flag. Use int (code point) to avoid confusion with U+FFFF. */ - static final int ERROR = 0xFFFFFFFF; + static final int ERROR = 0xFFFFFFFF; /** @@ -488,145 +488,145 @@ * values have undefined directionality in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_UNDEFINED = -1; + public static final byte DIRECTIONALITY_UNDEFINED = -1; /** * Strong bidirectional character type "L" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0; + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0; /** * Strong bidirectional character type "R" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1; + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1; /** * Strong bidirectional character type "AL" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2; + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2; /** * Weak bidirectional character type "EN" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3; + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3; /** * Weak bidirectional character type "ES" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4; + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4; /** * Weak bidirectional character type "ET" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5; + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5; /** * Weak bidirectional character type "AN" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6; + public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6; /** * Weak bidirectional character type "CS" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7; + public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7; /** * Weak bidirectional character type "NSM" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_NONSPACING_MARK = 8; + public static final byte DIRECTIONALITY_NONSPACING_MARK = 8; /** * Weak bidirectional character type "BN" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9; + public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9; /** * Neutral bidirectional character type "B" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10; + public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10; /** * Neutral bidirectional character type "S" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11; + public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11; /** * Neutral bidirectional character type "WS" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_WHITESPACE = 12; + public static final byte DIRECTIONALITY_WHITESPACE = 12; /** * Neutral bidirectional character type "ON" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13; + public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13; /** * Strong bidirectional character type "LRE" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14; + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14; /** * Strong bidirectional character type "LRO" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15; + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15; /** * Strong bidirectional character type "RLE" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16; + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16; /** * Strong bidirectional character type "RLO" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17; + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17; /** * Weak bidirectional character type "PDF" in the Unicode specification. * @since 1.4 */ - public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18; + public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18; /** * Weak bidirectional character type "LRI" in the Unicode specification. * @since 9 */ - public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE = 19; + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE = 19; /** * Weak bidirectional character type "RLI" in the Unicode specification. * @since 9 */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE = 20; + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE = 20; /** * Weak bidirectional character type "FSI" in the Unicode specification. * @since 9 */ - public static final byte DIRECTIONALITY_FIRST_STRONG_ISOLATE = 21; + public static final byte DIRECTIONALITY_FIRST_STRONG_ISOLATE = 21; /** * Weak bidirectional character type "PDI" in the Unicode specification. * @since 9 */ - public static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE = 22; + public static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE = 22; /** * The minimum value of a @@ -637,7 +637,7 @@ * * @since 1.5 */ - public static final char MIN_HIGH_SURROGATE = '\uD800'; + public static final char MIN_HIGH_SURROGATE = '\uD800'; /** * The maximum value of a @@ -648,7 +648,7 @@ * * @since 1.5 */ - public static final char MAX_HIGH_SURROGATE = '\uDBFF'; + public static final char MAX_HIGH_SURROGATE = '\uDBFF'; /** * The minimum value of a @@ -659,7 +659,7 @@ * * @since 1.5 */ - public static final char MIN_LOW_SURROGATE = '\uDC00'; + public static final char MIN_LOW_SURROGATE = '\uDC00'; /** * The maximum value of a @@ -670,7 +670,7 @@ * * @since 1.5 */ - public static final char MAX_LOW_SURROGATE = '\uDFFF'; + public static final char MAX_LOW_SURROGATE = '\uDFFF'; /** * The minimum value of a Unicode surrogate code unit in the @@ -678,7 +678,7 @@ * * @since 1.5 */ - public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; + public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; /** * The maximum value of a Unicode surrogate code unit in the @@ -686,7 +686,7 @@ * * @since 1.5 */ - public static final char MAX_SURROGATE = MAX_LOW_SURROGATE; + public static final char MAX_SURROGATE = MAX_LOW_SURROGATE; /** * The minimum value of a @@ -695,7 +695,7 @@ * * @since 1.5 */ - public static final int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000; + public static final int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000; /** * The minimum value of a @@ -704,7 +704,7 @@ * * @since 1.5 */ - public static final int MIN_CODE_POINT = 0x000000; + public static final int MIN_CODE_POINT = 0x000000; /** * The maximum value of a @@ -713,7 +713,7 @@ * * @since 1.5 */ - public static final int MAX_CODE_POINT = 0X10FFFF; + public static final int MAX_CODE_POINT = 0X10FFFF; /** * Returns an {@link Optional} containing the nominal descriptor for this @@ -760,8 +760,6 @@ protected Subset(String name) { * object; since this method is {@code final}, this * guarantee holds for all subclasses. */ - - public final boolean equals(@Nullable Object obj) { return (this == obj); } @@ -773,7 +771,6 @@ public final boolean equals(@Nullable Object obj) { * {@code equals} and {@code hashCode} methods will * be consistent in all subclasses. */ - public final int hashCode() { return super.hashCode(); } @@ -781,7 +778,6 @@ public final int hashCode() { /** * Returns the name of this subset. */ - public final String toString() { return name; } @@ -798,7 +794,7 @@ public final String toString() { * * @since 1.2 */ - public static final class UnicodeBlock extends Subset { + public static final class UnicodeBlock extends Subset { /** * NUM_ENTITIES should match the total number of UnicodeBlock identifier * names plus their aliases. @@ -4671,7 +4667,6 @@ private UnicodeBlock(String idName, String... aliases) { * {@code null} if the character is not a member of any * Unicode block */ - public static @Nullable UnicodeBlock of(char c) { return of((int)c); } @@ -4692,7 +4687,6 @@ private UnicodeBlock(String idName, String... aliases) { * @see Character#isValidCodePoint(int) * @since 1.5 */ - public static @Nullable UnicodeBlock of(int codePoint) { if (!isValidCodePoint(codePoint)) { throw new IllegalArgumentException( @@ -4752,7 +4746,6 @@ private UnicodeBlock(String idName, String... aliases) { * @throws NullPointerException if {@code blockName} is null * @since 1.5 */ - public static final UnicodeBlock forName(String blockName) { UnicodeBlock block = map.get(blockName.toUpperCase(Locale.US)); if (block == null) { @@ -9367,7 +9360,6 @@ public static enum UnicodeScript { * @see Character#isValidCodePoint(int) * */ - public static UnicodeScript of(int codePoint) { if (!isValidCodePoint(codePoint)) throw new IllegalArgumentException( @@ -9402,7 +9394,6 @@ public static UnicodeScript of(int codePoint) { * invalid name * @throws NullPointerException if {@code scriptName} is null */ - public static final UnicodeScript forName(String scriptName) { scriptName = scriptName.toUpperCase(Locale.ENGLISH); //.replace(' ', '_')); @@ -9530,8 +9521,6 @@ public char charValue() { * * @return a hash code value for this {@code Character} */ - - @Override public int hashCode() { return Character.hashCode(value); @@ -9546,8 +9535,6 @@ public int hashCode() { * @param value The {@code char} for which to return a hash code. * @return a hash code value for a {@code char} value. */ - - public static int hashCode(char value) { return (int)value; } @@ -9597,9 +9584,7 @@ public String toString() { * @return the string representation of the specified {@code char} * @since 1.4 */ - - - public static String toString(char c) { + public static String toString(char c) { return String.valueOf(c); } @@ -9615,9 +9600,7 @@ public static String toString(char c) { * valid Unicode code point}. * @since 11 */ - - - public static String toString(int codePoint) { + public static String toString(int codePoint) { return String.valueOfCodePoint(codePoint); } @@ -9633,8 +9616,6 @@ public static String toString(int codePoint) { * {@code false} otherwise. * @since 1.5 */ - - public static boolean isValidCodePoint(int codePoint) { // Optimized form of: // codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT @@ -9653,8 +9634,6 @@ public static boolean isValidCodePoint(int codePoint) { * {@code false} otherwise. * @since 1.7 */ - - public static boolean isBmpCodePoint(int codePoint) { return codePoint >>> 16 == 0; // Optimized form of: @@ -9674,8 +9653,6 @@ public static boolean isBmpCodePoint(int codePoint) { * {@code false} otherwise. * @since 1.5 */ - - public static boolean isSupplementaryCodePoint(int codePoint) { return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT && codePoint < MAX_CODE_POINT + 1; @@ -9701,8 +9678,6 @@ public static boolean isSupplementaryCodePoint(int codePoint) { * @see Character.UnicodeBlock#of(int) * @since 1.5 */ - - public static boolean isHighSurrogate(char ch) { // Help VM constant-fold; MAX_HIGH_SURROGATE + 1 == MIN_LOW_SURROGATE return ch >= MIN_HIGH_SURROGATE && ch < (MAX_HIGH_SURROGATE + 1); @@ -9727,8 +9702,6 @@ public static boolean isHighSurrogate(char ch) { * @see Character#isHighSurrogate(char) * @since 1.5 */ - - public static boolean isLowSurrogate(char ch) { return ch >= MIN_LOW_SURROGATE && ch < (MAX_LOW_SURROGATE + 1); } @@ -9753,8 +9726,6 @@ public static boolean isLowSurrogate(char ch) { * {@code false} otherwise. * @since 1.7 */ - - public static boolean isSurrogate(char ch) { return ch >= MIN_SURROGATE && ch < (MAX_SURROGATE + 1); } @@ -9777,8 +9748,6 @@ public static boolean isSurrogate(char ch) { * {@code false} otherwise. * @since 1.5 */ - - public static boolean isSurrogatePair(char high, char low) { return isHighSurrogate(high) && isLowSurrogate(low); } @@ -9799,9 +9768,7 @@ public static boolean isSurrogatePair(char high, char low) { * @see Character#isSupplementaryCodePoint(int) * @since 1.5 */ - - - public static int charCount(int codePoint) { + public static int charCount(int codePoint) { return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT ? 2 : 1; } @@ -9817,8 +9784,6 @@ public static int charCount(int codePoint) { * specified surrogate pair. * @since 1.5 */ - - public static int toCodePoint(char high, char low) { // Optimized form of: // return ((high - MIN_HIGH_SURROGATE) << 10) @@ -9851,9 +9816,7 @@ public static int toCodePoint(char high, char low) { * {@link CharSequence#length() seq.length()}. * @since 1.5 */ - - - public static int codePointAt(CharSequence seq, int index) { + public static int codePointAt(CharSequence seq, int index) { char c1 = seq.charAt(index); if (isHighSurrogate(c1) && ++index < seq.length()) { char c2 = seq.charAt(index); @@ -9885,9 +9848,7 @@ public static int codePointAt(CharSequence seq, int index) { * the length of the {@code char} array. * @since 1.5 */ - - - public static int codePointAt(char[] a, int index) { + public static int codePointAt(char[] a, int index) { return codePointAtImpl(a, index, a.length); } @@ -9923,8 +9884,6 @@ public static int codePointAt(char[] a, int index, int limit) { return codePointAtImpl(a, index, limit); } - - // throws ArrayIndexOutOfBoundsException if index out of bounds static int codePointAtImpl(char[] a, int index, int limit) { char c1 = a[index]; @@ -9958,9 +9917,7 @@ static int codePointAtImpl(char[] a, int index, int limit) { * CharSequence#length() seq.length()}. * @since 1.5 */ - - - public static int codePointBefore(CharSequence seq, int index) { + public static int codePointBefore(CharSequence seq, int index) { char c2 = seq.charAt(--index); if (isLowSurrogate(c2) && index > 0) { char c1 = seq.charAt(--index); @@ -9992,9 +9949,7 @@ public static int codePointBefore(CharSequence seq, int index) { * {@code char} array * @since 1.5 */ - - - public static int codePointBefore(char[] a, int index) { + public static int codePointBefore(char[] a, int index) { return codePointBeforeImpl(a, index, 0); } @@ -10032,8 +9987,6 @@ public static int codePointBefore(char[] a, int index, int start) { return codePointBeforeImpl(a, index, start); } - - // throws ArrayIndexOutOfBoundsException if index-1 out of bounds static int codePointBeforeImpl(char[] a, int index, int start) { char c2 = a[--index]; @@ -10070,8 +10023,6 @@ static int codePointBeforeImpl(char[] a, int index, int start) { * character in the UTF-16 encoding * @since 1.7 */ - - public static char highSurrogate(int codePoint) { return (char) ((codePoint >>> 10) + (MIN_HIGH_SURROGATE - (MIN_SUPPLEMENTARY_CODE_POINT >>> 10))); @@ -10101,8 +10052,6 @@ public static char highSurrogate(int codePoint) { * character in the UTF-16 encoding * @since 1.7 */ - - public static char lowSurrogate(int codePoint) { return (char) ((codePoint & 0x3ff) + MIN_LOW_SURROGATE); } @@ -10138,9 +10087,7 @@ public static char lowSurrogate(int codePoint) { * {@code dst[dstIndex]}.) * @since 1.5 */ - - - public static int toChars(int codePoint, char[] dst, int dstIndex) { + public static int toChars(int codePoint, char[] dst, int dstIndex) { if (isBmpCodePoint(codePoint)) { dst[dstIndex] = (char) codePoint; return 1; @@ -10169,8 +10116,6 @@ public static int toChars(int codePoint, char[] dst, int dstIndex) { * {@code codePoint} is not a valid Unicode code point. * @since 1.5 */ - - public static char[] toChars(int codePoint) { if (isBmpCodePoint(codePoint)) { return new char[] { (char) codePoint }; @@ -10250,8 +10195,6 @@ public static int codePointCount(char[] a, int offset, int count) { return codePointCountImpl(a, offset, count); } - - static int codePointCountImpl(char[] a, int offset, int count) { int endIndex = offset + count; int n = count; @@ -10287,9 +10230,7 @@ static int codePointCountImpl(char[] a, int offset, int count) { * of {@code codePointOffset} code points. * @since 1.5 */ - - - public static int offsetByCodePoints(CharSequence seq, int index, + public static int offsetByCodePoints(CharSequence seq, int index, int codePointOffset) { int length = seq.length(); if (index < 0 || index > length) { @@ -10356,10 +10297,8 @@ public static int offsetByCodePoints(CharSequence seq, int index, * {@code codePointOffset} code points. * @since 1.5 */ - - - public static int offsetByCodePoints(char[] a, int start, int count, - int index, int codePointOffset) { + public static int offsetByCodePoints(char[] a, int start, int count, + int index, int codePointOffset) { if (count > a.length-start || start < 0 || count < 0 || index < start || index > start+count) { throw new IndexOutOfBoundsException(); @@ -10367,8 +10306,6 @@ public static int offsetByCodePoints(char[] a, int start, int count, return offsetByCodePointsImpl(a, start, count, index, codePointOffset); } - - static int offsetByCodePointsImpl(char[]a, int start, int count, int index, int codePointOffset) { int x = index; @@ -10430,8 +10367,6 @@ static int offsetByCodePointsImpl(char[]a, int start, int count, * @see Character#toLowerCase(char) * @see Character#getType(char) */ - - public static boolean isLowerCase(char ch) { return isLowerCase((int)ch); } @@ -10464,8 +10399,6 @@ public static boolean isLowerCase(char ch) { * @see Character#getType(int) * @since 1.5 */ - - public static boolean isLowerCase(int codePoint) { return CharacterData.of(codePoint).isLowerCase(codePoint); } @@ -10501,8 +10434,6 @@ public static boolean isLowerCase(int codePoint) { * @see Character#getType(char) * @since 1.0 */ - - public static boolean isUpperCase(char ch) { return isUpperCase((int)ch); } @@ -10533,8 +10464,6 @@ public static boolean isUpperCase(char ch) { * @see Character#getType(int) * @since 1.5 */ - - public static boolean isUpperCase(int codePoint) { return CharacterData.of(codePoint).isUpperCase(codePoint); } @@ -10576,8 +10505,6 @@ public static boolean isUpperCase(int codePoint) { * @see Character#getType(char) * @since 1.0.2 */ - - public static boolean isTitleCase(char ch) { return isTitleCase((int)ch); } @@ -10614,8 +10541,6 @@ public static boolean isTitleCase(char ch) { * @see Character#getType(int) * @since 1.5 */ - - public static boolean isTitleCase(int codePoint) { return getType(codePoint) == Character.TITLECASE_LETTER; } @@ -10655,8 +10580,6 @@ public static boolean isTitleCase(int codePoint) { * @see Character#forDigit(int, int) * @see Character#getType(char) */ - - public static boolean isDigit(char ch) { return isDigit((int)ch); } @@ -10691,8 +10614,6 @@ public static boolean isDigit(char ch) { * @see Character#getType(int) * @since 1.5 */ - - public static boolean isDigit(int codePoint) { return CharacterData.of(codePoint).isDigit(codePoint); } @@ -10722,8 +10643,6 @@ public static boolean isDigit(int codePoint) { * @see Character#isUpperCase(char) * @since 1.0.2 */ - - public static boolean isDefined(char ch) { return isDefined((int)ch); } @@ -10748,8 +10667,6 @@ public static boolean isDefined(char ch) { * @see Character#isUpperCase(int) * @since 1.5 */ - - public static boolean isDefined(int codePoint) { return getType(codePoint) != Character.UNASSIGNED; } @@ -10789,8 +10706,6 @@ public static boolean isDefined(int codePoint) { * @see Character#isUnicodeIdentifierStart(char) * @see Character#isUpperCase(char) */ - - public static boolean isLetter(char ch) { return isLetter((int)ch); } @@ -10824,8 +10739,6 @@ public static boolean isLetter(char ch) { * @see Character#isUpperCase(int) * @since 1.5 */ - - public static boolean isLetter(int codePoint) { return ((((1 << Character.UPPERCASE_LETTER) | (1 << Character.LOWERCASE_LETTER) | @@ -10859,8 +10772,6 @@ public static boolean isLetter(int codePoint) { * @see Character#isUnicodeIdentifierPart(char) * @since 1.0.2 */ - - public static boolean isLetterOrDigit(char ch) { return isLetterOrDigit((int)ch); } @@ -10882,8 +10793,6 @@ public static boolean isLetterOrDigit(char ch) { * @see Character#isUnicodeIdentifierPart(int) * @since 1.5 */ - - public static boolean isLetterOrDigit(int codePoint) { return ((((1 << Character.UPPERCASE_LETTER) | (1 << Character.LOWERCASE_LETTER) | @@ -10919,8 +10828,6 @@ public static boolean isLetterOrDigit(int codePoint) { * @since 1.0.2 * @deprecated Replaced by isJavaIdentifierStart(char). */ - - @Deprecated(since="1.1") public static boolean isJavaLetter(char ch) { return isJavaIdentifierStart(ch); @@ -10957,8 +10864,6 @@ public static boolean isJavaLetter(char ch) { * @since 1.0.2 * @deprecated Replaced by isJavaIdentifierPart(char). */ - - @Deprecated(since="1.1") public static boolean isJavaLetterOrDigit(char ch) { return isJavaIdentifierPart(ch); @@ -10986,8 +10891,6 @@ public static boolean isJavaLetterOrDigit(char ch) { * character, {@code false} otherwise. * @since 1.7 */ - - public static boolean isAlphabetic(int codePoint) { return (((((1 << Character.UPPERCASE_LETTER) | (1 << Character.LOWERCASE_LETTER) | @@ -11008,8 +10911,6 @@ public static boolean isAlphabetic(int codePoint) { * character, {@code false} otherwise. * @since 1.7 */ - - public static boolean isIdeographic(int codePoint) { return CharacterData.of(codePoint).isIdeographic(codePoint); } @@ -11187,8 +11088,6 @@ public static boolean isJavaIdentifierPart(int codePoint) { * @see Character#isUnicodeIdentifierPart(char) * @since 1.1 */ - - public static boolean isUnicodeIdentifierStart(char ch) { return isUnicodeIdentifierStart((int)ch); } @@ -11228,8 +11127,6 @@ public static boolean isUnicodeIdentifierStart(char ch) { * @see Character#isUnicodeIdentifierPart(int) * @since 1.5 */ - - public static boolean isUnicodeIdentifierStart(int codePoint) { return CharacterData.of(codePoint).isUnicodeIdentifierStart(codePoint); } @@ -11283,8 +11180,6 @@ public static boolean isUnicodeIdentifierStart(int codePoint) { * @see Character#isUnicodeIdentifierStart(char) * @since 1.1 */ - - public static boolean isUnicodeIdentifierPart(char ch) { return isUnicodeIdentifierPart((int)ch); } @@ -11333,8 +11228,6 @@ public static boolean isUnicodeIdentifierPart(char ch) { * @see Character#isUnicodeIdentifierStart(int) * @since 1.5 */ - - public static boolean isUnicodeIdentifierPart(int codePoint) { return CharacterData.of(codePoint).isUnicodeIdentifierPart(codePoint); } @@ -11370,8 +11263,6 @@ public static boolean isUnicodeIdentifierPart(int codePoint) { * @see Character#isUnicodeIdentifierPart(char) * @since 1.1 */ - - public static boolean isIdentifierIgnorable(char ch) { return isIdentifierIgnorable((int)ch); } @@ -11402,8 +11293,6 @@ public static boolean isIdentifierIgnorable(char ch) { * @see Character#isUnicodeIdentifierPart(int) * @since 1.5 */ - - public static boolean isIdentifierIgnorable(int codePoint) { return CharacterData.of(codePoint).isIdentifierIgnorable(codePoint); } @@ -11548,8 +11437,6 @@ public static boolean isExtendedPictographic(int codePoint) { * @see Character#isLowerCase(char) * @see String#toLowerCase() */ - - public static char toLowerCase(char ch) { return (char)toLowerCase((int)ch); } @@ -11579,8 +11466,6 @@ public static char toLowerCase(char ch) { * * @since 1.5 */ - - public static int toLowerCase(int codePoint) { return CharacterData.of(codePoint).toLowerCase(codePoint); } @@ -11612,8 +11497,6 @@ public static int toLowerCase(int codePoint) { * @see Character#isUpperCase(char) * @see String#toUpperCase() */ - - public static char toUpperCase(char ch) { return (char)toUpperCase((int)ch); } @@ -11643,8 +11526,6 @@ public static char toUpperCase(char ch) { * * @since 1.5 */ - - public static int toUpperCase(int codePoint) { return CharacterData.of(codePoint).toUpperCase(codePoint); } @@ -11677,8 +11558,6 @@ public static int toUpperCase(int codePoint) { * @see Character#toUpperCase(char) * @since 1.0.2 */ - - public static char toTitleCase(char ch) { return (char)toTitleCase((int)ch); } @@ -11706,8 +11585,6 @@ public static char toTitleCase(char ch) { * @see Character#toUpperCase(int) * @since 1.5 */ - - public static int toTitleCase(int codePoint) { return CharacterData.of(codePoint).toTitleCase(codePoint); } @@ -11762,9 +11639,7 @@ public static int toTitleCase(int codePoint) { * @see Character#forDigit(int, int) * @see Character#isDigit(char) */ - - - public static int digit(char ch, int radix) { + public static int digit(char ch, int radix) { return digit((int)ch, radix); } @@ -11816,9 +11691,7 @@ public static int digit(char ch, int radix) { * @see Character#isDigit(int) * @since 1.5 */ - - - public static int digit(int codePoint, int radix) { + public static int digit(int codePoint, int radix) { return CharacterData.of(codePoint).digit(codePoint, radix); } @@ -11857,9 +11730,7 @@ public static int digit(int codePoint, int radix) { * @see Character#isDigit(char) * @since 1.1 */ - - - public static int getNumericValue( char ch) { + public static int getNumericValue(char ch) { return getNumericValue((int)ch); } @@ -11893,8 +11764,6 @@ public static int getNumericValue( char ch) { * @see Character#isDigit(int) * @since 1.5 */ - - public static int getNumericValue(int codePoint) { return CharacterData.of(codePoint).getNumericValue(codePoint); } @@ -11931,8 +11800,6 @@ public static int getNumericValue(int codePoint) { * @see Character#isWhitespace(char) * @deprecated Replaced by isWhitespace(char). */ - - @Deprecated(since="1.1") public static boolean isSpace(char ch) { return (ch <= 0x0020) && @@ -11967,8 +11834,6 @@ public static boolean isSpace(char ch) { * @see Character#isWhitespace(char) * @since 1.1 */ - - public static boolean isSpaceChar(char ch) { return isSpaceChar((int)ch); } @@ -11992,8 +11857,6 @@ public static boolean isSpaceChar(char ch) { * @see Character#isWhitespace(int) * @since 1.5 */ - - public static boolean isSpaceChar(int codePoint) { return ((((1 << Character.SPACE_SEPARATOR) | (1 << Character.LINE_SEPARATOR) | @@ -12032,8 +11895,6 @@ public static boolean isSpaceChar(int codePoint) { * @see Character#isSpaceChar(char) * @since 1.1 */ - - public static boolean isWhitespace(char ch) { return isWhitespace((int)ch); } @@ -12065,8 +11926,6 @@ public static boolean isWhitespace(char ch) { * @see Character#isSpaceChar(int) * @since 1.5 */ - - public static boolean isWhitespace(int codePoint) { return CharacterData.of(codePoint).isWhitespace(codePoint); } @@ -12091,8 +11950,6 @@ public static boolean isWhitespace(int codePoint) { * @see Character#isWhitespace(char) * @since 1.1 */ - - public static boolean isISOControl(char ch) { return isISOControl((int)ch); } @@ -12111,8 +11968,6 @@ public static boolean isISOControl(char ch) { * @see Character#isWhitespace(int) * @since 1.5 */ - - public static boolean isISOControl(int codePoint) { // Optimized form of: // (codePoint >= 0x00 && codePoint <= 0x1F) || @@ -12164,8 +12019,6 @@ public static boolean isISOControl(int codePoint) { * @see Character#UPPERCASE_LETTER * @since 1.1 */ - - public static int getType(char ch) { return getType((int)ch); } @@ -12208,8 +12061,6 @@ public static int getType(char ch) { * @see Character#UPPERCASE_LETTER UPPERCASE_LETTER * @since 1.5 */ - - public static int getType(int codePoint) { return CharacterData.of(codePoint).getType(codePoint); } @@ -12238,9 +12089,7 @@ public static int getType(int codePoint) { * @see Character#MAX_RADIX * @see Character#digit(char, int) */ - - - public static char forDigit(int digit, int radix) { + public static char forDigit(int digit, int radix) { if ((digit >= radix) || (digit < 0)) { return '\0'; } @@ -12294,8 +12143,6 @@ public static char forDigit(int digit, int radix) { * @see Character#DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE * @since 1.4 */ - - public static byte getDirectionality(char ch) { return getDirectionality((int)ch); } @@ -12337,8 +12184,6 @@ public static byte getDirectionality(char ch) { * @see Character#DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE * @since 1.5 */ - - public static byte getDirectionality(int codePoint) { return CharacterData.of(codePoint).getDirectionality(codePoint); } @@ -12362,8 +12207,6 @@ public static byte getDirectionality(int codePoint) { * if the {@code char} is not mirrored or is not defined. * @since 1.4 */ - - public static boolean isMirrored(char ch) { return isMirrored((int)ch); } @@ -12383,8 +12226,6 @@ public static boolean isMirrored(char ch) { * if the character is not mirrored or is not defined. * @since 1.5 */ - - public static boolean isMirrored(int codePoint) { return CharacterData.of(codePoint).isMirrored(codePoint); } @@ -12403,8 +12244,6 @@ public static boolean isMirrored(int codePoint) { * locale-dependent. * @since 1.2 */ - - public int compareTo(Character anotherCharacter) { return compare(this.value, anotherCharacter.value); } @@ -12423,8 +12262,6 @@ public int compareTo(Character anotherCharacter) { * a value greater than {@code 0} if {@code x > y} * @since 1.7 */ - - public static int compare(char x, char y) { return x - y; } @@ -12443,8 +12280,6 @@ public static int compare(char x, char y) { * @see Character#toTitleCase(char) * @since 1.4 */ - - static int toUpperCaseEx(int codePoint) { assert isValidCodePoint(codePoint); return CharacterData.of(codePoint).toUpperCaseEx(codePoint); @@ -12461,8 +12296,6 @@ static int toUpperCaseEx(int codePoint) { * @return a {@code char[]} with the uppercased character. * @since 1.4 */ - - static char[] toUpperCaseCharArray(int codePoint) { // As of Unicode 6.0, 1:M uppercasings only happen in the BMP. assert isBmpCodePoint(codePoint); @@ -12475,7 +12308,7 @@ static char[] toUpperCaseCharArray(int codePoint) { * * @since 1.5 */ - public static final int SIZE = 16; + public static final int SIZE = 16; /** * The number of bytes used to represent a {@code char} value in unsigned @@ -12483,7 +12316,7 @@ static char[] toUpperCaseCharArray(int codePoint) { * * @since 1.8 */ - public static final int BYTES = SIZE / Byte.SIZE; + public static final int BYTES = SIZE / Byte.SIZE; /** * Returns the value obtained by reversing the order of the bytes in the @@ -12533,8 +12366,6 @@ public static char reverseBytes(char ch) { * * @since 1.7 */ - - public static @Nullable String getName(int codePoint) { if (!isValidCodePoint(codePoint)) { throw new IllegalArgumentException( @@ -12587,8 +12418,6 @@ public static char reverseBytes(char ch) { * * @since 9 */ - - public static int codePointOf(String name) { name = name.trim().toUpperCase(Locale.ROOT); int cp = CharacterName.getInstance().getCodePoint(name); diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 3c61c8cd905..26470f73f16 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -274,7 +274,6 @@ private Class(ClassLoader loader, Class arrayComponentType, char mods, Protec * * @return a string representation of this {@code Class} object. */ - public String toString() { String kind = isInterface() ? "interface " : isPrimitive() ? "" : "class "; return kind.concat(getName()); @@ -475,7 +474,7 @@ static String typeVarBounds(TypeVariable typeVar) { * @jls 12.4 Initialization of Classes and Interfaces */ @CallerSensitive - public static Class forName( String className) + public static Class forName(String className) throws ClassNotFoundException { Class caller = Reflection.getCallerClass(); return forName(className, caller); @@ -738,7 +737,7 @@ public boolean isValue() { */ @CallerSensitive @Deprecated(since="9") - public T newInstance() + public T newInstance() throws InstantiationException, IllegalAccessException { // Constructor lookup @@ -912,7 +911,6 @@ public boolean isPrimitive() { * interface; {@code false} otherwise * @since 1.5 */ - public boolean isAnnotation() { return (getModifiers() & ClassFile.ACC_ANNOTATION) != 0; } @@ -928,7 +926,6 @@ public boolean isAnnotation() { * programming language and JVM modeling in core reflection * @since 1.5 */ - public boolean isSynthetic() { return (getModifiers() & ClassFile.ACC_SYNTHETIC) != 0; } @@ -1000,9 +997,7 @@ public boolean isSynthetic() { * represented by this {@code Class} object. * @jls 13.1 The Form of a Binary */ - - - public String getName() { + public String getName() { String name = this.name; return name != null ? name : initClassName(); } @@ -1166,7 +1161,6 @@ public TypeVariable>[] getTypeParameters() { * * @return the package of this class. */ - public @Nullable Package getPackage() { if (isPrimitive() || isArray()) { return null; @@ -1202,7 +1196,7 @@ public TypeVariable>[] getTypeParameters() { * @since 9 * @jls 6.7 Fully Qualified Names and Canonical Names */ - public String getPackageName() { + public String getPackageName() { String pn = this.packageName; if (pn == null) { Class c = isArray() ? elementType() : this; @@ -1265,7 +1259,6 @@ public String getPackageName() { * * @return an array of interfaces directly implemented by this class */ - public Class[] getInterfaces() { // defensively copy before handing over to user code return getInterfaces(true); @@ -1783,7 +1776,7 @@ private static Class toClass(Type o) { * @return the simple name of the underlying class * @since 1.5 */ - public String getSimpleName() { + public String getSimpleName() { ReflectionData rd = reflectionData(); String simpleName = rd.simpleName; if (simpleName == null) { @@ -1851,7 +1844,7 @@ public String getTypeName() { * @jls 6.7 Fully Qualified Names and Canonical Names * @since 1.5 */ - public @Nullable String getCanonicalName() { + public @Nullable String getCanonicalName() { ReflectionData rd = reflectionData(); String canonicalName = rd.canonicalName; if (canonicalName == null) { @@ -1860,7 +1853,6 @@ public String getTypeName() { return canonicalName == ReflectionData.NULL_SENTINEL? null : canonicalName; } - private String getCanonicalName0() { if (isArray()) { String canonicalName = getComponentType().getCanonicalName(); @@ -1898,7 +1890,6 @@ private String getCanonicalName0() { * @since 1.5 * @jls 15.9.5 Anonymous Class Declarations */ - public boolean isAnonymousClass() { return !isArray() && isLocalOrAnonymousClass() && getSimpleBinaryName0() == null; @@ -1912,7 +1903,6 @@ public boolean isAnonymousClass() { * @since 1.5 * @jls 14.3 Local Class and Interface Declarations */ - public boolean isLocalClass() { return isLocalOrAnonymousClass() && (isArray() || getSimpleBinaryName0() != null); @@ -1926,7 +1916,6 @@ public boolean isLocalClass() { * @since 1.5 * @jls 8.5 Member Class and Interface Declarations */ - public boolean isMemberClass() { return !isLocalOrAnonymousClass() && getDeclaringClass0() != null; } @@ -2933,7 +2922,6 @@ private static class ReflectionData { // Cached names String simpleName; - String canonicalName; static final String NULL_SENTINEL = new String(); @@ -3485,7 +3473,6 @@ public boolean desiredAssertionStatus() { * @since 1.5 * @jls 8.9.1 Enum Constants */ - public boolean isEnum() { // An enum must both directly extend java.lang.Enum and have // the ENUM bit set; classes for specialized enum constants @@ -3529,7 +3516,7 @@ public boolean isRecord() { * @since 1.5 * @jls 8.9.1 Enum Constants */ - public T @Nullable [] getEnumConstants() { + public T @Nullable [] getEnumConstants() { T[] values = getEnumConstantsShared(); return (values != null) ? values.clone() : null; } @@ -3568,7 +3555,7 @@ T[] getEnumConstantsShared() { * efficiently. Note that the map is returned by this method is * created lazily on first use. Typically it won't ever get created. */ - Map enumConstantDirectory() { + Map enumConstantDirectory() { Map directory = enumConstantDirectory; if (directory == null) { T[] universe = getEnumConstantsShared(); @@ -3658,9 +3645,8 @@ private String cannotCastMsg(Object obj) { * {@inheritDoc} * @since 1.5 */ - @Override - public boolean isAnnotationPresent( Class annotationClass) { + public boolean isAnnotationPresent(Class annotationClass) { return GenericDeclaration.super.isAnnotationPresent(annotationClass); } diff --git a/src/java.base/share/classes/java/lang/ClassCastException.java b/src/java.base/share/classes/java/lang/ClassCastException.java index 1fa17750b89..250d250ca4a 100644 --- a/src/java.base/share/classes/java/lang/ClassCastException.java +++ b/src/java.base/share/classes/java/lang/ClassCastException.java @@ -47,7 +47,6 @@ public class ClassCastException extends RuntimeException { /** * Constructs a {@code ClassCastException} with no detail message. */ - public ClassCastException() { super(); } @@ -58,7 +57,6 @@ public ClassCastException() { * * @param s the detail message. */ - public ClassCastException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/ClassCircularityError.java b/src/java.base/share/classes/java/lang/ClassCircularityError.java index ef9cb38eec9..77a732ec032 100644 --- a/src/java.base/share/classes/java/lang/ClassCircularityError.java +++ b/src/java.base/share/classes/java/lang/ClassCircularityError.java @@ -42,7 +42,6 @@ public class ClassCircularityError extends LinkageError { /** * Constructs a {@code ClassCircularityError} with no detail message. */ - public ClassCircularityError() { super(); } @@ -54,7 +53,6 @@ public ClassCircularityError() { * @param s * The detail message */ - public ClassCircularityError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/ClassFormatError.java b/src/java.base/share/classes/java/lang/ClassFormatError.java index e55cbf2c501..113aa3347a9 100644 --- a/src/java.base/share/classes/java/lang/ClassFormatError.java +++ b/src/java.base/share/classes/java/lang/ClassFormatError.java @@ -43,7 +43,6 @@ public class ClassFormatError extends LinkageError { /** * Constructs a {@code ClassFormatError} with no detail message. */ - public ClassFormatError() { super(); } @@ -54,7 +53,6 @@ public ClassFormatError() { * * @param s the detail message. */ - public ClassFormatError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/ClassLoader.java b/src/java.base/share/classes/java/lang/ClassLoader.java index d9de028e302..bb9c0ddee4a 100644 --- a/src/java.base/share/classes/java/lang/ClassLoader.java +++ b/src/java.base/share/classes/java/lang/ClassLoader.java @@ -502,7 +502,7 @@ final String name() { * @throws ClassNotFoundException * If the class was not found */ - public Class loadClass( String name) throws ClassNotFoundException { + public Class loadClass(String name) throws ClassNotFoundException { return loadClass(name, false); } @@ -547,7 +547,7 @@ public Class loadClass( String name) throws ClassNotFoundException { * @throws ClassNotFoundException * If the class could not be found */ - protected Class loadClass( String name, boolean resolve) + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(name)) { @@ -685,7 +685,7 @@ protected Object getClassLoadingLock(String className) { * * @since 1.2 */ - protected Class findClass( String name) throws ClassNotFoundException { + protected Class findClass(String name) throws ClassNotFoundException { throw new ClassNotFoundException(name); } @@ -766,7 +766,6 @@ protected Class findClass( String name) throws ClassNotFoundException { * defineClass(String, byte[], int, int)} */ @Deprecated(since="1.1") - @SuppressWarnings("signature") protected final Class defineClass(byte[] b, int off, int len) throws ClassFormatError { @@ -837,7 +836,7 @@ protected final Class defineClass(byte[] b, int off, int len) * * @since 1.1 */ - protected final Class defineClass(@Nullable String name, byte[] b, int off, int len) + protected final Class defineClass(@Nullable String name, byte[] b, int off, int len) throws ClassFormatError { return defineClass(name, b, off, len, null); @@ -970,7 +969,7 @@ private void postDefineClass(Class c, ProtectionDomain pd) { * "{@code java.}" and this class loader is not the platform * class loader or its ancestor. */ - protected final Class defineClass(@Nullable String name, byte[] b, int off, int len, + protected final Class defineClass(@Nullable String name, byte[] b, int off, int len, @Nullable ProtectionDomain protectionDomain) throws ClassFormatError { @@ -1090,7 +1089,7 @@ private Class defineClass(String name, ByteBuffer b, int len, ProtectionDomai } } - static native Class defineClass1(ClassLoader loader, String name, byte[] b, int off, int len, + static native Class defineClass1(ClassLoader loader, String name, byte[] b, int off, int len, ProtectionDomain pd, String source); // Warning: Before calling this method, the provided ByteBuffer must be guarded @@ -1233,7 +1232,7 @@ protected final void resolveClass(Class c) { * @see #ClassLoader(ClassLoader) * @see #getParent() */ - protected final Class findSystemClass( String name) + protected final Class findSystemClass(String name) throws ClassNotFoundException { return getSystemClassLoader().loadClass(name); @@ -1266,7 +1265,7 @@ static Class findBootstrapClassOrNull(String name) { * * @since 1.1 */ - protected final @Nullable Class findLoadedClass( String name) { + protected final @Nullable Class findLoadedClass(String name) { if (!checkName(name)) return null; return findLoadedClass0(name); @@ -2094,7 +2093,7 @@ private Package toPackage(String name, NamedPackage p, Module m) { * @see * The JAR File Specification: Package Sealing */ - protected Package definePackage( String name, @Nullable String specTitle, + protected Package definePackage(String name, @Nullable String specTitle, @Nullable String specVersion, @Nullable String specVendor, @Nullable String implTitle, @Nullable String implVersion, @Nullable String implVendor, @Nullable URL sealBase) @@ -2232,8 +2231,6 @@ public final Package[] getDefinedPackages() { * * @since 1.2 */ - - @SuppressWarnings({"nullness:return.type.incompatible"}) protected Package[] getPackages() { Stream pkgs = packages(); ClassLoader ld = parent; @@ -2526,7 +2523,6 @@ public void clearAssertionStatus() { * * @since 1.4 */ - boolean desiredAssertionStatus(String className) { synchronized (assertionLock) { // assert classAssertionStatus != null; @@ -2559,8 +2555,6 @@ boolean desiredAssertionStatus(String className) { // Set up the assertions with information provided by the VM. // Note: Should only be called inside a synchronized block - @SuppressWarnings({"contracts.postcondition.not.satisfied"}) - private void initializeJavaAssertionMaps() { // assert Thread.holdsLock(assertionLock); diff --git a/src/java.base/share/classes/java/lang/ClassNotFoundException.java b/src/java.base/share/classes/java/lang/ClassNotFoundException.java index d812088c134..a2a45f235e6 100644 --- a/src/java.base/share/classes/java/lang/ClassNotFoundException.java +++ b/src/java.base/share/classes/java/lang/ClassNotFoundException.java @@ -60,7 +60,6 @@ public class ClassNotFoundException extends ReflectiveOperationException { /** * Constructs a {@code ClassNotFoundException} with no detail message. */ - public ClassNotFoundException() { super((Throwable)null); // Disallow initCause } @@ -71,7 +70,6 @@ public ClassNotFoundException() { * * @param s the detail message. */ - public ClassNotFoundException(@Nullable String s) { super(s, null); // Disallow initCause } diff --git a/src/java.base/share/classes/java/lang/CloneNotSupportedException.java b/src/java.base/share/classes/java/lang/CloneNotSupportedException.java index f5ac556e5c2..765ab2fafd5 100644 --- a/src/java.base/share/classes/java/lang/CloneNotSupportedException.java +++ b/src/java.base/share/classes/java/lang/CloneNotSupportedException.java @@ -52,7 +52,6 @@ public class CloneNotSupportedException extends Exception { * Constructs a {@code CloneNotSupportedException} with no * detail message. */ - public CloneNotSupportedException() { super(); } @@ -63,7 +62,6 @@ public CloneNotSupportedException() { * * @param s the detail message. */ - public CloneNotSupportedException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/Cloneable.java b/src/java.base/share/classes/java/lang/Cloneable.java index 259c36033f5..f116c07e3cf 100644 --- a/src/java.base/share/classes/java/lang/Cloneable.java +++ b/src/java.base/share/classes/java/lang/Cloneable.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * A class implements the {@code Cloneable} interface to diff --git a/src/java.base/share/classes/java/lang/Comparable.java b/src/java.base/share/classes/java/lang/Comparable.java index ee9edfa91b5..04120037fc3 100644 --- a/src/java.base/share/classes/java/lang/Comparable.java +++ b/src/java.base/share/classes/java/lang/Comparable.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.*; @@ -143,7 +142,5 @@ public interface Comparable { * @throws ClassCastException if the specified object's type prevents it * from being compared to this object. */ - - - public int compareTo( T o); + public int compareTo(T o); } diff --git a/src/java.base/share/classes/java/lang/Deprecated.java b/src/java.base/share/classes/java/lang/Deprecated.java index 84cac4c5e30..4eeec2581d1 100644 --- a/src/java.base/share/classes/java/lang/Deprecated.java +++ b/src/java.base/share/classes/java/lang/Deprecated.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; diff --git a/src/java.base/share/classes/java/lang/Double.java b/src/java.base/share/classes/java/lang/Double.java index 337bfac22b1..53f38416902 100644 --- a/src/java.base/share/classes/java/lang/Double.java +++ b/src/java.base/share/classes/java/lang/Double.java @@ -403,7 +403,7 @@ * {@code 0x1.fffffffffffffP+1023} and also equal to * {@code Double.longBitsToDouble(0x7fefffffffffffffL)}. */ - public static final double MAX_VALUE = 0x1.fffffffffffffP+1023; // 1.7976931348623157e+308 + public static final double MAX_VALUE = 0x1.fffffffffffffP+1023; // 1.7976931348623157e+308 /** * A constant holding the smallest positive normal value of type @@ -422,7 +422,7 @@ * {@code 0x0.0000000000001P-1022} and also equal to * {@code Double.longBitsToDouble(0x1L)}. */ - public static final double MIN_VALUE = 0x0.0000000000001P-1022; // 4.9e-324 + public static final double MIN_VALUE = 0x0.0000000000001P-1022; // 4.9e-324 /** * The number of bits used to represent a {@code double} value, @@ -430,7 +430,7 @@ * * @since 1.5 */ - public static final int SIZE = 64; + public static final int SIZE = 64; /** * The number of bits in the significand of a {@code double} @@ -465,7 +465,7 @@ * * @since 1.8 */ - public static final int BYTES = SIZE / Byte.SIZE; + public static final int BYTES = SIZE / Byte.SIZE; /** * The {@code Class} instance representing the primitive type @@ -624,8 +624,6 @@ * @param d the {@code double} to be converted. * @return a string representation of the argument. */ - - public static String toString(double d) { return DoubleToDecimal.toString(d); } @@ -712,8 +710,6 @@ public static String toString(double d) { * @return a hex string representation of the argument. * @since 1.5 */ - - public static String toHexString(double d) { /* * Modeled after the "a" conversion specifier in C99, section @@ -970,8 +966,6 @@ public static String toHexString(double d) { * parsable number. * @see Double##decimalToBinaryConversion Decimal ↔ Binary Conversion Issues */ - - public static Double valueOf(String s) throws NumberFormatException { return new Double(parseDouble(s)); } @@ -1021,8 +1015,6 @@ public static Double valueOf(double d) { * @see Double##decimalToBinaryConversion Decimal ↔ Binary Conversion Issues * @since 1.2 */ - - public static double parseDouble(String s) throws NumberFormatException { return FloatingDecimal.parseDouble(s); } @@ -1039,8 +1031,6 @@ public static double parseDouble(String s) throws NumberFormatException { * @return {@code true} if the value of the argument is NaN; * {@code false} otherwise. */ - - public static boolean isNaN(double v) { return (v != v); } @@ -1133,8 +1123,6 @@ public Double(String s) throws NumberFormatException { * @return {@code true} if the value represented by this object is * NaN; {@code false} otherwise. */ - - public boolean isNaN() { return isNaN(value); } @@ -1147,8 +1135,6 @@ public boolean isNaN() { * positive infinity or negative infinity; * {@code false} otherwise. */ - - public boolean isInfinite() { return isInfinite(value); } @@ -1162,8 +1148,6 @@ public boolean isInfinite() { * @return a {@code String} representation of this object. * @see java.lang.Double#toString(double) */ - - public String toString() { return toString(value); } @@ -1280,8 +1264,6 @@ public double doubleValue() { * * @return a {@code hash code} value for this object. */ - - @Override public int hashCode() { return Double.hashCode(value); @@ -1295,7 +1277,6 @@ public int hashCode() { * @return a hash code value for a {@code double} value. * @since 1.8 */ - public static int hashCode(double value) { return Long.hashCode(doubleToLongBits(value)); } @@ -1557,8 +1538,6 @@ public int compareTo(Double anotherDouble) { * {@code d2}. * @since 1.4 */ - - public static int compare(double d1, double d2) { if (d1 < d2) return -1; // Neither val is NaN, thisVal is smaller @@ -1587,8 +1566,6 @@ public static int compare(double d1, double d2) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static double sum(double a, double b) { return a + b; } @@ -1607,8 +1584,6 @@ public static double sum(double a, double b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static double max(double a, double b) { return Math.max(a, b); } @@ -1627,8 +1602,6 @@ public static double max(double a, double b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static double min(double a, double b) { return Math.min(a, b); } diff --git a/src/java.base/share/classes/java/lang/Enum.java b/src/java.base/share/classes/java/lang/Enum.java index 9ec7bae4bb8..750fda10b51 100644 --- a/src/java.base/share/classes/java/lang/Enum.java +++ b/src/java.base/share/classes/java/lang/Enum.java @@ -102,7 +102,7 @@ public abstract class Enum> * * @return the name of this enum constant */ - public final String name() { + public final String name() { return name; } @@ -128,7 +128,7 @@ public final String name() { * * @return the ordinal of this enumeration constant */ - public final int ordinal() { + public final int ordinal() { return ordinal; } @@ -143,7 +143,7 @@ public final int ordinal() { * in the enum declaration, where the initial constant is assigned * an ordinal of zero). */ - protected Enum(String name, int ordinal) { + protected Enum(String name, int ordinal) { this.name = name; this.ordinal = ordinal; } @@ -156,7 +156,6 @@ protected Enum(String name, int ordinal) { * * @return the name of this enum constant */ - public String toString() { return name; } @@ -169,8 +168,7 @@ public String toString() { * @return true if the specified object is equal to this * enum constant. */ - - public final boolean equals( @Nullable Object other) { + public final boolean equals(@Nullable Object other) { return this==other; } @@ -185,7 +183,6 @@ public final boolean equals( @Nullable Object other) { * * @return a hash code for this enum constant. */ - public final int hashCode() { // Once initialized, the hash field value does not change. // HotSpot's identity hash code generation also never returns zero @@ -206,7 +203,6 @@ public final int hashCode() { * * @return (never returns) */ - protected final Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } @@ -220,7 +216,6 @@ protected final Object clone() throws CloneNotSupportedException { * same enum type. The natural order implemented by this * method is the order in which the constants are declared. */ - @SuppressWarnings({"rawtypes"}) public final int compareTo(E o) { Enum other = o; Enum self = this; diff --git a/src/java.base/share/classes/java/lang/EnumConstantNotPresentException.java b/src/java.base/share/classes/java/lang/EnumConstantNotPresentException.java index a8595a255aa..f1cc19f9467 100644 --- a/src/java.base/share/classes/java/lang/EnumConstantNotPresentException.java +++ b/src/java.base/share/classes/java/lang/EnumConstantNotPresentException.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Thrown when an application tries to access an enum constant by name @@ -62,7 +61,6 @@ public class EnumConstantNotPresentException extends RuntimeException { * @param enumType the type of the missing enum constant * @param constantName the name of the missing enum constant */ - public EnumConstantNotPresentException(Class enumType, String constantName) { super(enumType.getName() + "." + constantName); diff --git a/src/java.base/share/classes/java/lang/Error.java b/src/java.base/share/classes/java/lang/Error.java index 9c5a5055d5c..8514e453079 100644 --- a/src/java.base/share/classes/java/lang/Error.java +++ b/src/java.base/share/classes/java/lang/Error.java @@ -56,7 +56,6 @@ public class Error extends Throwable { * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ - public Error() { super(); if (Throwable.jfrTracing) { @@ -72,7 +71,6 @@ public Error() { * @param message the detail message. The detail message is saved for * later retrieval by the {@link #getMessage()} method. */ - public Error(@Nullable String message) { super(message); if (Throwable.jfrTracing) { @@ -94,8 +92,7 @@ public Error(@Nullable String message) { * unknown.) * @since 1.4 */ - - public Error(@Nullable String message, @Nullable Throwable cause) { + public Error(@Nullable String message, @Nullable Throwable cause) { super(message, cause); if (Throwable.jfrTracing) { ThrowableTracer.traceError(getClass(), message); @@ -115,7 +112,6 @@ public Error(@Nullable String message, @Nullable Throwable cause) { * unknown.) * @since 1.4 */ - public Error(@Nullable Throwable cause) { super(cause); if (Throwable.jfrTracing) { @@ -138,7 +134,6 @@ public Error(@Nullable Throwable cause) { * * @since 1.7 */ - protected Error(@Nullable String message, @Nullable Throwable cause, boolean enableSuppression, boolean writableStackTrace) { diff --git a/src/java.base/share/classes/java/lang/Exception.java b/src/java.base/share/classes/java/lang/Exception.java index e40b4ffbd1f..4c4c1c67017 100644 --- a/src/java.base/share/classes/java/lang/Exception.java +++ b/src/java.base/share/classes/java/lang/Exception.java @@ -55,8 +55,7 @@ public class Exception extends Throwable { * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ - - public Exception() { + public Exception() { super(); } @@ -68,8 +67,7 @@ public Exception() { * @param message the detail message. The detail message is saved for * later retrieval by the {@link #getMessage()} method. */ - - public Exception(@Nullable String message) { + public Exception(@Nullable String message) { super(message); } @@ -87,8 +85,7 @@ public Exception(@Nullable String message) { * unknown.) * @since 1.4 */ - - public Exception(@Nullable String message, @Nullable Throwable cause) { + public Exception(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -106,8 +103,7 @@ public Exception(@Nullable String message, @Nullable Throwable cause) { * unknown.) * @since 1.4 */ - - public Exception(@Nullable Throwable cause) { + public Exception(@Nullable Throwable cause) { super(cause); } @@ -125,7 +121,7 @@ public Exception(@Nullable Throwable cause) { * be writable * @since 1.7 */ - protected Exception(@Nullable String message, @Nullable Throwable cause, + protected Exception(@Nullable String message, @Nullable Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); diff --git a/src/java.base/share/classes/java/lang/Float.java b/src/java.base/share/classes/java/lang/Float.java index 2d3c13d5834..7e702f288de 100644 --- a/src/java.base/share/classes/java/lang/Float.java +++ b/src/java.base/share/classes/java/lang/Float.java @@ -143,7 +143,7 @@ * * @since 1.5 */ - public static final int SIZE = 32; + public static final int SIZE = 32; /** * The number of bits in the significand of a {@code float} value, @@ -178,7 +178,7 @@ * * @since 1.8 */ - public static final int BYTES = SIZE / Byte.SIZE; + public static final int BYTES = SIZE / Byte.SIZE; /** * The {@code Class} instance representing the primitive type @@ -337,8 +337,6 @@ * @param f the {@code float} to be converted. * @return a string representation of the argument. */ - - public static String toString(float f) { return FloatToDecimal.toString(f); } @@ -425,8 +423,6 @@ public static String toString(float f) { * @return a hex string representation of the argument. * @since 1.5 */ - - public static String toHexString(float f) { if (Math.abs(f) < Float.MIN_NORMAL && f != 0.0f ) {// float subnormal @@ -572,8 +568,6 @@ public static String toHexString(float f) { * parsable number. * @see Double##decimalToBinaryConversion Decimal ↔ Binary Conversion Issues */ - - public static Float valueOf(String s) throws NumberFormatException { return new Float(parseFloat(s)); } @@ -622,8 +616,6 @@ public static Float valueOf(float f) { * @see Double##decimalToBinaryConversion Decimal ↔ Binary Conversion Issues * @since 1.2 */ - - public static float parseFloat(String s) throws NumberFormatException { return FloatingDecimal.parseFloat(s); } @@ -640,8 +632,6 @@ public static float parseFloat(String s) throws NumberFormatException { * @return {@code true} if the argument is NaN; * {@code false} otherwise. */ - - public static boolean isNaN(float v) { return (v != v); } @@ -751,8 +741,6 @@ public Float(String s) throws NumberFormatException { * @return {@code true} if the value represented by this object is * NaN; {@code false} otherwise. */ - - public boolean isNaN() { return isNaN(value); } @@ -765,8 +753,6 @@ public boolean isNaN() { * positive infinity or negative infinity; * {@code false} otherwise. */ - - public boolean isInfinite() { return isInfinite(value); } @@ -780,8 +766,6 @@ public boolean isInfinite() { * @return a {@code String} representation of this object. * @see java.lang.Float#toString(float) */ - - public String toString() { return Float.toString(value); } @@ -884,8 +868,6 @@ public double doubleValue() { * * @return a hash code value for this object. */ - - @Override public int hashCode() { return Float.hashCode(value); @@ -899,8 +881,6 @@ public int hashCode() { * @return a hash code value for a {@code float} value. * @since 1.8 */ - - public static int hashCode(float value) { return floatToIntBits(value); } @@ -1345,8 +1325,6 @@ public int compareTo(Float anotherFloat) { * {@code f2}. * @since 1.4 */ - - public static int compare(float f1, float f2) { if (f1 < f2) return -1; // Neither val is NaN, thisVal is smaller @@ -1375,8 +1353,6 @@ public static int compare(float f1, float f2) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static float sum(float a, float b) { return a + b; } @@ -1395,8 +1371,6 @@ public static float sum(float a, float b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static float max(float a, float b) { return Math.max(a, b); } @@ -1415,8 +1389,6 @@ public static float max(float a, float b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static float min(float a, float b) { return Math.min(a, b); } diff --git a/src/java.base/share/classes/java/lang/IllegalAccessError.java b/src/java.base/share/classes/java/lang/IllegalAccessError.java index 24ee9acbe39..eb2f7f6644a 100644 --- a/src/java.base/share/classes/java/lang/IllegalAccessError.java +++ b/src/java.base/share/classes/java/lang/IllegalAccessError.java @@ -46,7 +46,6 @@ public class IllegalAccessError extends IncompatibleClassChangeError { /** * Constructs an {@code IllegalAccessError} with no detail message. */ - public IllegalAccessError() { super(); } @@ -57,7 +56,6 @@ public IllegalAccessError() { * * @param s the detail message. */ - public IllegalAccessError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/IllegalAccessException.java b/src/java.base/share/classes/java/lang/IllegalAccessException.java index e3533966a18..1fc1f5f5da6 100644 --- a/src/java.base/share/classes/java/lang/IllegalAccessException.java +++ b/src/java.base/share/classes/java/lang/IllegalAccessException.java @@ -66,7 +66,6 @@ public class IllegalAccessException extends ReflectiveOperationException { * Constructs an {@code IllegalAccessException} without a * detail message. */ - public IllegalAccessException() { super(); } @@ -76,7 +75,6 @@ public IllegalAccessException() { * * @param s the detail message. */ - public IllegalAccessException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/IllegalArgumentException.java b/src/java.base/share/classes/java/lang/IllegalArgumentException.java index 356325dccd1..8ed2aa20ca6 100644 --- a/src/java.base/share/classes/java/lang/IllegalArgumentException.java +++ b/src/java.base/share/classes/java/lang/IllegalArgumentException.java @@ -40,7 +40,6 @@ public class IllegalArgumentException extends RuntimeException { * Constructs an {@code IllegalArgumentException} with no * detail message. */ - public IllegalArgumentException() { super(); } @@ -51,7 +50,6 @@ public IllegalArgumentException() { * * @param s the detail message. */ - public IllegalArgumentException(@Nullable String s) { super(s); } @@ -72,7 +70,6 @@ public IllegalArgumentException(@Nullable String s) { * unknown.) * @since 1.5 */ - public IllegalArgumentException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -91,7 +88,6 @@ public IllegalArgumentException(@Nullable String message, @Nullable Throwable ca * unknown.) * @since 1.5 */ - public IllegalArgumentException(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/lang/IllegalMonitorStateException.java b/src/java.base/share/classes/java/lang/IllegalMonitorStateException.java index c75c2db5791..3c2bad3db73 100644 --- a/src/java.base/share/classes/java/lang/IllegalMonitorStateException.java +++ b/src/java.base/share/classes/java/lang/IllegalMonitorStateException.java @@ -49,7 +49,6 @@ public class IllegalMonitorStateException extends RuntimeException { * Constructs an {@code IllegalMonitorStateException} with no * detail message. */ - public IllegalMonitorStateException() { super(); } @@ -60,7 +59,6 @@ public IllegalMonitorStateException() { * * @param s the detail message. */ - public IllegalMonitorStateException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/IllegalStateException.java b/src/java.base/share/classes/java/lang/IllegalStateException.java index 0918d2cbb9f..e30d2f88a48 100644 --- a/src/java.base/share/classes/java/lang/IllegalStateException.java +++ b/src/java.base/share/classes/java/lang/IllegalStateException.java @@ -43,7 +43,6 @@ public class IllegalStateException extends RuntimeException { * Constructs an IllegalStateException with no detail message. * A detail message is a String that describes this particular exception. */ - public IllegalStateException() { super(); } @@ -55,7 +54,6 @@ public IllegalStateException() { * * @param s the String that contains a detailed message */ - public IllegalStateException(@Nullable String s) { super(s); } @@ -76,7 +74,6 @@ public IllegalStateException(@Nullable String s) { * unknown.) * @since 1.5 */ - public IllegalStateException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -95,7 +92,6 @@ public IllegalStateException(@Nullable String message, @Nullable Throwable cause * unknown.) * @since 1.5 */ - public IllegalStateException(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/lang/IllegalThreadStateException.java b/src/java.base/share/classes/java/lang/IllegalThreadStateException.java index 55daf413ce0..8d942521bc4 100644 --- a/src/java.base/share/classes/java/lang/IllegalThreadStateException.java +++ b/src/java.base/share/classes/java/lang/IllegalThreadStateException.java @@ -44,7 +44,6 @@ public class IllegalThreadStateException extends IllegalArgumentException { * Constructs an {@code IllegalThreadStateException} with no * detail message. */ - public IllegalThreadStateException() { super(); } @@ -55,7 +54,6 @@ public IllegalThreadStateException() { * * @param s the detail message. */ - public IllegalThreadStateException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/IncompatibleClassChangeError.java b/src/java.base/share/classes/java/lang/IncompatibleClassChangeError.java index 8849dd93829..f5b952899b2 100644 --- a/src/java.base/share/classes/java/lang/IncompatibleClassChangeError.java +++ b/src/java.base/share/classes/java/lang/IncompatibleClassChangeError.java @@ -44,7 +44,6 @@ public class IncompatibleClassChangeError extends LinkageError { * Constructs an {@code IncompatibleClassChangeError} with no * detail message. */ - public IncompatibleClassChangeError () { super(); } @@ -55,7 +54,6 @@ public IncompatibleClassChangeError () { * * @param s the detail message. */ - public IncompatibleClassChangeError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java b/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java index fd1c5640218..765941a3689 100644 --- a/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java +++ b/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java @@ -45,7 +45,6 @@ public class IndexOutOfBoundsException extends RuntimeException { /** * Constructs an {@code IndexOutOfBoundsException} with no detail message. */ - public IndexOutOfBoundsException() { super(); } @@ -56,7 +55,6 @@ public IndexOutOfBoundsException() { * * @param s the detail message */ - public IndexOutOfBoundsException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/InheritableThreadLocal.java b/src/java.base/share/classes/java/lang/InheritableThreadLocal.java index 64afd96b7b0..998aa69d325 100644 --- a/src/java.base/share/classes/java/lang/InheritableThreadLocal.java +++ b/src/java.base/share/classes/java/lang/InheritableThreadLocal.java @@ -28,8 +28,6 @@ import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; -import java.lang.ref.*; - /** * This class extends {@code ThreadLocal} to provide inheritance of values * from parent thread to child thread: when a child thread is created, the @@ -56,9 +54,8 @@ * @see Thread.Builder#inheritInheritableThreadLocals(boolean) */ - @NullMarked -public class InheritableThreadLocal< T extends @Nullable Object> extends ThreadLocal { +public class InheritableThreadLocal extends ThreadLocal { /** * Creates an inheritable thread local variable. */ diff --git a/src/java.base/share/classes/java/lang/InstantiationError.java b/src/java.base/share/classes/java/lang/InstantiationError.java index 0d60d56d315..14a8b4a91d0 100644 --- a/src/java.base/share/classes/java/lang/InstantiationError.java +++ b/src/java.base/share/classes/java/lang/InstantiationError.java @@ -48,7 +48,6 @@ public class InstantiationError extends IncompatibleClassChangeError { /** * Constructs an {@code InstantiationError} with no detail message. */ - public InstantiationError() { super(); } @@ -59,7 +58,6 @@ public InstantiationError() { * * @param s the detail message. */ - public InstantiationError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/InstantiationException.java b/src/java.base/share/classes/java/lang/InstantiationException.java index 46f16f7da14..e4c15c064e4 100644 --- a/src/java.base/share/classes/java/lang/InstantiationException.java +++ b/src/java.base/share/classes/java/lang/InstantiationException.java @@ -52,7 +52,6 @@ public class InstantiationException extends ReflectiveOperationException { /** * Constructs an {@code InstantiationException} with no detail message. */ - public InstantiationException() { super(); } @@ -63,7 +62,6 @@ public InstantiationException() { * * @param s the detail message. */ - public InstantiationException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/Integer.java b/src/java.base/share/classes/java/lang/Integer.java index 58494cc4365..72b2d4978aa 100644 --- a/src/java.base/share/classes/java/lang/Integer.java +++ b/src/java.base/share/classes/java/lang/Integer.java @@ -93,13 +93,13 @@ * A constant holding the minimum value an {@code int} can * have, -231. */ - @Native public static final int MIN_VALUE = 0x80000000; + @Native public static final int MIN_VALUE = 0x80000000; /** * A constant holding the maximum value an {@code int} can * have, 231-1. */ - @Native public static final int MAX_VALUE = 0x7fffffff; + @Native public static final int MAX_VALUE = 0x7fffffff; /** * The {@code Class} instance representing the primitive type @@ -166,10 +166,7 @@ * @see java.lang.Character#MAX_RADIX * @see java.lang.Character#MIN_RADIX */ - - - - public static String toString(int i, int radix) { + public static String toString(int i, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) radix = 10; @@ -202,9 +199,7 @@ public static String toString(int i, int radix) { return toStringUTF16(i, radix); } - - - private static String toStringUTF16(int i, int radix) { + private static String toStringUTF16(int i, int radix) { byte[] buf = new byte[33 * 2]; boolean negative = (i < 0); int charPos = 32; @@ -249,10 +244,7 @@ private static String toStringUTF16(int i, int radix) { * @see #toString(int, int) * @since 1.8 */ - - - - public static String toUnsignedString( int i, int radix) { + public static String toUnsignedString(int i, int radix) { return Long.toUnsignedString(toUnsignedLong(i), radix); } @@ -306,9 +298,7 @@ public static String toUnsignedString( int i, int radix) { * @see #toUnsignedString(int, int) * @since 1.0.2 */ - - - public static String toHexString( int i) { + public static String toHexString(int i) { return toUnsignedString0(i, 4); } @@ -346,9 +336,7 @@ public static String toHexString( int i) { * @see #toUnsignedString(int, int) * @since 1.0.2 */ - - - public static String toOctalString( int i) { + public static String toOctalString(int i) { return toUnsignedString0(i, 3); } @@ -380,16 +368,14 @@ public static String toOctalString( int i) { * @see #toUnsignedString(int, int) * @since 1.0.2 */ - - - public static String toBinaryString( int i) { + public static String toBinaryString(int i) { return toUnsignedString0(i, 1); } /** * Convert the integer to an unsigned number. */ - private static String toUnsignedString0( int val, int shift) { + private static String toUnsignedString0(int val, int shift) { // assert shift > 0 && shift <=5 : "Illegal shift value"; int mag = Integer.SIZE - Integer.numberOfLeadingZeros(val); int chars = Math.max(((mag + (shift - 1)) / shift), 1); @@ -450,9 +436,7 @@ public static String toString(int i) { * @see #toUnsignedString(int, int) * @since 1.8 */ - - - public static String toUnsignedString( int i) { + public static String toUnsignedString(int i) { return Long.toString(toUnsignedLong(i)); } @@ -588,9 +572,7 @@ public static int parseInt(String s, int radix) * {@link java.lang.Character#MAX_RADIX}. * @since 9 */ - - - public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix) + public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { Objects.requireNonNull(s); Objects.checkFromToIndex(beginIndex, endIndex, s.length()); @@ -656,8 +638,6 @@ public static int parseInt(CharSequence s, int beginIndex, int endIndex, int ra * @throws NumberFormatException if the string does not contain a * parsable integer. */ - - public static int parseInt(String s) throws NumberFormatException { return parseInt(s, 10); } @@ -705,9 +685,7 @@ public static int parseInt(String s) throws NumberFormatException { * does not contain a parsable {@code int}. * @since 1.8 */ - - - public static int parseUnsignedInt(String s, int radix) + public static int parseUnsignedInt(String s, int radix) throws NumberFormatException { if (s == null) { throw new NumberFormatException("Cannot parse null string"); @@ -784,9 +762,7 @@ public static int parseUnsignedInt(String s, int radix) * {@link java.lang.Character#MAX_RADIX}. * @since 9 */ - - - public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix) + public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { Objects.requireNonNull(s); Objects.checkFromToIndex(beginIndex, endIndex, s.length()); @@ -857,9 +833,7 @@ public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, * parsable unsigned integer. * @since 1.8 */ - - - public static int parseUnsignedInt(String s) throws NumberFormatException { + public static int parseUnsignedInt(String s) throws NumberFormatException { return parseUnsignedInt(s, 10); } @@ -888,9 +862,7 @@ public static int parseUnsignedInt(String s) throws NumberFormatException { * @throws NumberFormatException if the {@code String} * does not contain a parsable {@code int}. */ - - - public static Integer valueOf(String s, int radix) throws NumberFormatException { + public static Integer valueOf(String s, int radix) throws NumberFormatException { return Integer.valueOf(parseInt(s,radix)); } @@ -916,8 +888,6 @@ public static Integer valueOf(String s, int radix) throws NumberFormatExceptio * @throws NumberFormatException if the string cannot be parsed * as an integer. */ - - public static Integer valueOf(String s) throws NumberFormatException { return Integer.valueOf(parseInt(s, 10)); } @@ -1113,9 +1083,7 @@ public Integer(String s) throws NumberFormatException { * after a narrowing primitive conversion. * @jls 5.1.3 Narrowing Primitive Conversion */ - - - public byte byteValue() { + public byte byteValue() { return (byte)value; } @@ -1124,9 +1092,7 @@ public byte byteValue() { * after a narrowing primitive conversion. * @jls 5.1.3 Narrowing Primitive Conversion */ - - - public short shortValue() { + public short shortValue() { return (short)value; } @@ -1145,9 +1111,7 @@ public int intValue() { * @jls 5.1.2 Widening Primitive Conversion * @see Integer#toUnsignedLong(int) */ - - - public long longValue() { + public long longValue() { return (long)value; } @@ -1156,9 +1120,7 @@ public long longValue() { * after a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public float floatValue() { + public float floatValue() { return (float)value; } @@ -1167,9 +1129,7 @@ public float floatValue() { * after a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public double doubleValue() { + public double doubleValue() { return (double)value; } @@ -1183,9 +1143,7 @@ public double doubleValue() { * @return a string representation of the value of this object in * base 10. */ - - - public String toString() { + public String toString() { return toString(value); } @@ -1196,8 +1154,6 @@ public String toString() { * primitive {@code int} value represented by this * {@code Integer} object. */ - - @Override public int hashCode() { return Integer.hashCode(value); @@ -1212,8 +1168,6 @@ public int hashCode() { * * @return a hash code value for an {@code int} value. */ - - public static int hashCode(int value) { return value; } @@ -1263,8 +1217,6 @@ public boolean equals(@Nullable Object obj) { * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.System#getProperty(java.lang.String, java.lang.String) */ - - public static @Nullable Integer getInteger(@Nullable String nm) { return getInteger(nm, null); } @@ -1309,8 +1261,6 @@ public boolean equals(@Nullable Object obj) { * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.System#getProperty(java.lang.String, java.lang.String) */ - - public static Integer getInteger(@Nullable String nm, int val) { Integer result = getInteger(nm, null); return (result == null) ? Integer.valueOf(val) : result; @@ -1404,8 +1354,6 @@ public static Integer getInteger(@Nullable String nm, int val) { * contain a parsable integer. * @see java.lang.Integer#parseInt(java.lang.String, int) */ - - public static Integer decode(String nm) throws NumberFormatException { int radix = 10; int index = 0; @@ -1466,8 +1414,6 @@ else if (nm.startsWith("0", index) && nm.length() > 1 + index) { * comparison). * @since 1.2 */ - - public int compareTo(Integer anotherInteger) { return compare(this.value, anotherInteger.value); } @@ -1486,8 +1432,6 @@ public int compareTo(Integer anotherInteger) { * a value greater than {@code 0} if {@code x > y} * @since 1.7 */ - - public static int compare(int x, int y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } @@ -1526,9 +1470,7 @@ public static int compareUnsigned(int x, int y) { * conversion * @since 1.8 */ - - - public static long toUnsignedLong(int x) { + public static long toUnsignedLong(int x) { return ((long) x) & 0xffffffffL; } @@ -1585,7 +1527,7 @@ public static int remainderUnsigned(int dividend, int divisor) { * * @since 1.5 */ - @Native public static final int SIZE = 32; + @Native public static final int SIZE = 32; /** * The number of bytes used to represent an {@code int} value in two's @@ -1593,7 +1535,7 @@ public static int remainderUnsigned(int dividend, int divisor) { * * @since 1.8 */ - public static final int BYTES = SIZE / Byte.SIZE; + public static final int BYTES = SIZE / Byte.SIZE; /** * Returns an {@code int} value with at most a single one-bit, in the @@ -1608,9 +1550,7 @@ public static int remainderUnsigned(int dividend, int divisor) { * the specified value is itself equal to zero. * @since 1.5 */ - - - public static int highestOneBit( int i) { + public static int highestOneBit(int i) { return i & (MIN_VALUE >>> numberOfLeadingZeros(i)); } @@ -1627,9 +1567,7 @@ public static int highestOneBit( int i) { * the specified value is itself equal to zero. * @since 1.5 */ - - - public static int lowestOneBit( int i) { + public static int lowestOneBit(int i) { // HD, Section 2-1 return i & -i; } @@ -1736,9 +1674,7 @@ public static int bitCount(int i) { * specified number of bits. * @since 1.5 */ - - - public static int rotateLeft( int i, int distance) { + public static int rotateLeft(int i, int distance) { return (i << distance) | (i >>> -distance); } @@ -1762,9 +1698,7 @@ public static int rotateLeft( int i, int distance) { * specified number of bits. * @since 1.5 */ - - - public static int rotateRight( int i, int distance) { + public static int rotateRight(int i, int distance) { return (i >>> distance) | (i << -distance); } @@ -2017,9 +1951,7 @@ private static int parallelSuffix(int maskCount) { * @return the signum function of the specified {@code int} value. * @since 1.5 */ - - - public static int signum(int i) { + public static int signum(int i) { // HD, Section 2-7 return (i >> 31) | (-i >>> 31); } @@ -2050,8 +1982,6 @@ public static int reverseBytes(int i) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static int sum(int a, int b) { return a + b; } @@ -2066,8 +1996,6 @@ public static int sum(int a, int b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static int max(int a, int b) { return Math.max(a, b); } @@ -2082,8 +2010,6 @@ public static int max(int a, int b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static int min(int a, int b) { return Math.min(a, b); } diff --git a/src/java.base/share/classes/java/lang/InternalError.java b/src/java.base/share/classes/java/lang/InternalError.java index b9d75b8bcb6..a1303e784fd 100644 --- a/src/java.base/share/classes/java/lang/InternalError.java +++ b/src/java.base/share/classes/java/lang/InternalError.java @@ -41,7 +41,6 @@ public class InternalError extends VirtualMachineError { /** * Constructs an {@code InternalError} with no detail message. */ - public InternalError() { super(); } @@ -52,7 +51,6 @@ public InternalError() { * * @param message the detail message. */ - public InternalError(@Nullable String message) { super(message); } @@ -72,7 +70,6 @@ public InternalError(@Nullable String message) { * unknown.) * @since 1.8 */ - public InternalError(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -89,7 +86,6 @@ public InternalError(@Nullable String message, @Nullable Throwable cause) { * unknown.) * @since 1.8 */ - public InternalError(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/lang/InterruptedException.java b/src/java.base/share/classes/java/lang/InterruptedException.java index 44befd52a7d..344857a20d4 100644 --- a/src/java.base/share/classes/java/lang/InterruptedException.java +++ b/src/java.base/share/classes/java/lang/InterruptedException.java @@ -52,7 +52,6 @@ public class InterruptedException extends Exception { /** * Constructs an {@code InterruptedException} with no detail message. */ - public InterruptedException() { super(); } @@ -63,7 +62,6 @@ public InterruptedException() { * * @param s the detail message. */ - public InterruptedException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/LinkageError.java b/src/java.base/share/classes/java/lang/LinkageError.java index 0c14e5fdede..f3346fddf11 100644 --- a/src/java.base/share/classes/java/lang/LinkageError.java +++ b/src/java.base/share/classes/java/lang/LinkageError.java @@ -45,7 +45,6 @@ public class LinkageError extends Error { /** * Constructs a {@code LinkageError} with no detail message. */ - public LinkageError() { super(); } @@ -56,7 +55,6 @@ public LinkageError() { * * @param s the detail message. */ - public LinkageError(@Nullable String s) { super(s); } @@ -69,7 +67,6 @@ public LinkageError(@Nullable String s) { * @param cause the cause, may be {@code null} * @since 1.7 */ - public LinkageError(@Nullable String s, @Nullable Throwable cause) { super(s, cause); } diff --git a/src/java.base/share/classes/java/lang/Long.java b/src/java.base/share/classes/java/lang/Long.java index d01bafd4df3..2bb64885113 100644 --- a/src/java.base/share/classes/java/lang/Long.java +++ b/src/java.base/share/classes/java/lang/Long.java @@ -93,13 +93,13 @@ * A constant holding the minimum value a {@code long} can * have, -263. */ - @Native public static final long MIN_VALUE = 0x8000000000000000L; + @Native public static final long MIN_VALUE = 0x8000000000000000L; /** * A constant holding the maximum value a {@code long} can * have, 263-1. */ - @Native public static final long MAX_VALUE = 0x7fffffffffffffffL; + @Native public static final long MAX_VALUE = 0x7fffffffffffffffL; /** * The {@code Class} instance representing the primitive type @@ -153,9 +153,7 @@ * @see java.lang.Character#MAX_RADIX * @see java.lang.Character#MIN_RADIX */ - - - public static String toString(long i, int radix) { + public static String toString(long i, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) radix = 10; if (radix == 10) @@ -184,8 +182,7 @@ public static String toString(long i, int radix) { return toStringUTF16(i, radix); } - - private static String toStringUTF16(long i, int radix) { + private static String toStringUTF16(long i, int radix) { byte[] buf = new byte[65 * 2]; int charPos = 64; boolean negative = (i < 0); @@ -229,9 +226,7 @@ private static String toStringUTF16(long i, int radix) { * @see #toString(long, int) * @since 1.8 */ - - - public static String toUnsignedString( long i, int radix) { + public static String toUnsignedString(long i, int radix) { if (i >= 0) return toString(i, radix); else { @@ -263,7 +258,7 @@ public static String toUnsignedString( long i, int radix) { * Return a BigInteger equal to the unsigned value of the * argument. */ - private static BigInteger toUnsignedBigInteger( long i) { + private static BigInteger toUnsignedBigInteger(long i) { if (i >= 0L) return BigInteger.valueOf(i); else { @@ -327,9 +322,7 @@ private static BigInteger toUnsignedBigInteger( long i) { * @see #toUnsignedString(long, int) * @since 1.0.2 */ - - - public static String toHexString( long i) { + public static String toHexString(long i) { return toUnsignedString0(i, 4); } @@ -368,9 +361,7 @@ public static String toHexString( long i) { * @see #toUnsignedString(long, int) * @since 1.0.2 */ - - - public static String toOctalString( long i) { + public static String toOctalString(long i) { return toUnsignedString0(i, 3); } @@ -403,9 +394,7 @@ public static String toOctalString( long i) { * @see #toUnsignedString(long, int) * @since 1.0.2 */ - - - public static String toBinaryString( long i) { + public static String toBinaryString(long i) { return toUnsignedString0(i, 1); } @@ -414,7 +403,7 @@ public static String toBinaryString( long i) { * @param val the value to format * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary) */ - static String toUnsignedString0( long val, int shift) { + static String toUnsignedString0(long val, int shift) { // assert shift > 0 && shift <=5 : "Illegal shift value"; int mag = Long.SIZE - Long.numberOfLeadingZeros(val); int chars = Math.max(((mag + (shift - 1)) / shift), 1); @@ -475,9 +464,7 @@ public static String toString(long i) { * @see #toUnsignedString(long, int) * @since 1.8 */ - - - public static String toUnsignedString( long i) { + public static String toUnsignedString(long i) { return toUnsignedString(i, 10); } @@ -613,9 +600,7 @@ public static long parseLong(String s, int radix) * {@link java.lang.Character#MAX_RADIX}. * @since 9 */ - - - public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix) + public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { Objects.requireNonNull(s); Objects.checkFromToIndex(beginIndex, endIndex, s.length()); @@ -688,8 +673,6 @@ public static long parseLong(CharSequence s, int beginIndex, int endIndex, int * @throws NumberFormatException if the string does not contain a * parsable {@code long}. */ - - public static long parseLong(String s) throws NumberFormatException { return parseLong(s, 10); } @@ -737,9 +720,7 @@ public static long parseLong(String s) throws NumberFormatException { * does not contain a parsable {@code long}. * @since 1.8 */ - - - public static long parseUnsignedLong(String s, int radix) + public static long parseUnsignedLong(String s, int radix) throws NumberFormatException { if (s == null) { throw new NumberFormatException("Cannot parse null string"); @@ -816,9 +797,7 @@ public static long parseUnsignedLong(String s, int radix) * {@link java.lang.Character#MAX_RADIX}. * @since 9 */ - - - public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix) + public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { Objects.requireNonNull(s); Objects.checkFromToIndex(beginIndex, endIndex, s.length()); @@ -889,9 +868,7 @@ public static long parseUnsignedLong(CharSequence s, int beginIndex, int endInde * parsable unsigned integer. * @since 1.8 */ - - - public static long parseUnsignedLong(String s) throws NumberFormatException { + public static long parseUnsignedLong(String s) throws NumberFormatException { return parseUnsignedLong(s, 10); } @@ -921,9 +898,7 @@ public static long parseUnsignedLong(String s) throws NumberFormatException { * @throws NumberFormatException If the {@code String} does not * contain a parsable {@code long}. */ - - - public static Long valueOf(String s, int radix) throws NumberFormatException { + public static Long valueOf(String s, int radix) throws NumberFormatException { return Long.valueOf(parseLong(s, radix)); } @@ -949,8 +924,6 @@ public static Long valueOf(String s, int radix) throws NumberFormatException { * @throws NumberFormatException If the string cannot be parsed * as a {@code long}. */ - - public static Long valueOf(String s) throws NumberFormatException { return Long.valueOf(parseLong(s, 10)); @@ -1072,8 +1045,6 @@ public static Long valueOf(long l) { * @see java.lang.Long#parseLong(String, int) * @since 1.2 */ - - public static Long decode(String nm) throws NumberFormatException { int radix = 10; int index = 0; @@ -1174,9 +1145,7 @@ public Long(String s) throws NumberFormatException { * a narrowing primitive conversion. * @jls 5.1.3 Narrowing Primitive Conversion */ - - - public byte byteValue() { + public byte byteValue() { return (byte)value; } @@ -1185,9 +1154,7 @@ public byte byteValue() { * a narrowing primitive conversion. * @jls 5.1.3 Narrowing Primitive Conversion */ - - - public short shortValue() { + public short shortValue() { return (short)value; } @@ -1196,9 +1163,7 @@ public short shortValue() { * a narrowing primitive conversion. * @jls 5.1.3 Narrowing Primitive Conversion */ - - - public int intValue() { + public int intValue() { return (int)value; } @@ -1216,9 +1181,7 @@ public long longValue() { * a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public float floatValue() { + public float floatValue() { return (float)value; } @@ -1227,9 +1190,7 @@ public float floatValue() { * after a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public double doubleValue() { + public double doubleValue() { return (double)value; } @@ -1243,9 +1204,7 @@ public double doubleValue() { * @return a string representation of the value of this object in * base 10. */ - - - public String toString() { + public String toString() { return toString(value); } @@ -1261,8 +1220,6 @@ public String toString() { * * @return a hash code value for this object. */ - - @Override public int hashCode() { return Long.hashCode(value); @@ -1276,8 +1233,6 @@ public int hashCode() { * @return a hash code value for a {@code long} value. * @since 1.8 */ - - public static int hashCode(long value) { return (int)(value ^ (value >>> 32)); } @@ -1327,8 +1282,6 @@ public boolean equals(@Nullable Object obj) { * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.System#getProperty(java.lang.String, java.lang.String) */ - - public static @Nullable Long getLong(@Nullable String nm) { return getLong(nm, null); } @@ -1372,8 +1325,6 @@ public boolean equals(@Nullable Object obj) { * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.System#getProperty(java.lang.String, java.lang.String) */ - - public static Long getLong(@Nullable String nm, long val) { Long result = Long.getLong(nm, null); return (result == null) ? Long.valueOf(val) : result; @@ -1445,8 +1396,6 @@ public static Long getLong(@Nullable String nm, long val) { * comparison). * @since 1.2 */ - - public int compareTo(Long anotherLong) { return compare(this.value, anotherLong.value); } @@ -1465,8 +1414,6 @@ public int compareTo(Long anotherLong) { * a value greater than {@code 0} if {@code x > y} * @since 1.7 */ - - public static int compare(long x, long y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } @@ -1571,7 +1518,7 @@ public static long remainderUnsigned(long dividend, long divisor) { * * @since 1.5 */ - @Native public static final int SIZE = 64; + @Native public static final int SIZE = 64; /** * The number of bytes used to represent a {@code long} value in two's @@ -1579,7 +1526,7 @@ public static long remainderUnsigned(long dividend, long divisor) { * * @since 1.8 */ - public static final int BYTES = SIZE / Byte.SIZE; + public static final int BYTES = SIZE / Byte.SIZE; /** * Returns a {@code long} value with at most a single one-bit, in the @@ -1594,9 +1541,7 @@ public static long remainderUnsigned(long dividend, long divisor) { * the specified value is itself equal to zero. * @since 1.5 */ - - - public static long highestOneBit( long i) { + public static long highestOneBit(long i) { return i & (MIN_VALUE >>> numberOfLeadingZeros(i)); } @@ -1613,9 +1558,7 @@ public static long highestOneBit( long i) { * the specified value is itself equal to zero. * @since 1.5 */ - - - public static long lowestOneBit( long i) { + public static long lowestOneBit(long i) { // HD, Section 2-1 return i & -i; } @@ -1711,9 +1654,7 @@ public static int bitCount(long i) { * specified number of bits. * @since 1.5 */ - - - public static long rotateLeft( long i, int distance) { + public static long rotateLeft(long i, int distance) { return (i << distance) | (i >>> -distance); } @@ -1737,9 +1678,7 @@ public static long rotateLeft( long i, int distance) { * specified number of bits. * @since 1.5 */ - - - public static long rotateRight( long i, int distance) { + public static long rotateRight(long i, int distance) { return (i >>> distance) | (i << -distance); } @@ -2002,9 +1941,7 @@ private static long parallelSuffix(long maskCount) { * @return the signum function of the specified {@code long} value. * @since 1.5 */ - - - public static int signum(long i) { + public static int signum(long i) { // HD, Section 2-7 return (int) ((i >> 63) | (-i >>> 63)); } @@ -2034,8 +1971,6 @@ public static long reverseBytes(long i) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static long sum(long a, long b) { return a + b; } @@ -2050,8 +1985,6 @@ public static long sum(long a, long b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static long max(long a, long b) { return Math.max(a, b); } @@ -2066,8 +1999,6 @@ public static long max(long a, long b) { * @see java.util.function.BinaryOperator * @since 1.8 */ - - public static long min(long a, long b) { return Math.min(a, b); } diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java index 023c82e71ed..b0d2326f000 100644 --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.math.BigDecimal; import java.util.Random; @@ -130,7 +129,7 @@ */ @NullMarked -public final class Math { +public final class Math { /** * Don't let anyone instantiate this class. @@ -243,7 +242,6 @@ public static double tan(double a) { * @param a the value whose arc sine is to be returned. * @return the arc sine of the argument. */ - public static double asin(double a) { return StrictMath.asin(a); // default impl. delegates to StrictMath } @@ -262,7 +260,6 @@ public static double asin(double a) { * @param a the value whose arc cosine is to be returned. * @return the arc cosine of the argument. */ - public static double acos(double a) { return StrictMath.acos(a); // default impl. delegates to StrictMath } @@ -284,7 +281,6 @@ public static double acos(double a) { * @param a the value whose arc tangent is to be returned. * @return the arc tangent of the argument. */ - public static double atan(double a) { return StrictMath.atan(a); // default impl. delegates to StrictMath } @@ -299,7 +295,6 @@ public static double atan(double a) { * in radians. * @since 1.2 */ - public static double toRadians(double angdeg) { return angdeg * DEGREES_TO_RADIANS; } @@ -316,7 +311,6 @@ public static double toRadians(double angdeg) { * in degrees. * @since 1.2 */ - public static double toDegrees(double angrad) { return angrad * RADIANS_TO_DEGREES; } @@ -481,7 +475,6 @@ public static double cbrt(double a) { * @return the remainder when {@code f1} is divided by * {@code f2}. */ - public static double IEEEremainder(double f1, double f2) { return StrictMath.IEEEremainder(f1, f2); // delegate to StrictMath } @@ -903,7 +896,6 @@ private static final class RandomNumberGeneratorHolder { * @see #nextDown(double) * @see Random#nextDouble() */ - public static double random() { return RandomNumberGeneratorHolder.randomNumberGenerator.nextDouble(); } @@ -2558,7 +2550,6 @@ public static float fma(float a, float b, float c) { * @return the size of an ulp of the argument * @since 1.5 */ - public static double ulp(double d) { int exp = getExponent(d); @@ -2605,7 +2596,6 @@ public static double ulp(double d) { * @return the size of an ulp of the argument * @since 1.5 */ - public static float ulp(float f) { int exp = getExponent(f); @@ -2726,7 +2716,6 @@ public static double sinh(double x) { * @return The hyperbolic cosine of {@code x}. * @since 1.5 */ - public static double cosh(double x) { return StrictMath.cosh(x); } @@ -2886,7 +2875,6 @@ public static double atanh(double x) { * without intermediate overflow or underflow * @since 1.5 */ - public static double hypot(double x, double y) { return StrictMath.hypot(x, y); } @@ -2925,7 +2913,6 @@ public static double hypot(double x, double y) { * @return the value e{@code x} - 1. * @since 1.5 */ - public static double expm1(double x) { return StrictMath.expm1(x); } @@ -2963,7 +2950,6 @@ public static double expm1(double x) { * log of {@code x} + 1 * @since 1.5 */ - public static double log1p(double x) { return StrictMath.log1p(x); } @@ -3042,7 +3028,6 @@ public static float copySign(float magnitude, float sign) { * @return the unbiased exponent of the argument * @since 1.6 */ - public static int getExponent(float f) { /* * Bitwise convert f to integer, mask out exponent bits, shift @@ -3071,7 +3056,6 @@ public static int getExponent(float f) { * @return the unbiased exponent of the argument * @since 1.6 */ - public static int getExponent(double d) { /* * Bitwise convert d to long, mask out exponent bits, shift @@ -3122,7 +3106,6 @@ public static int getExponent(double d) { * direction of {@code direction}. * @since 1.6 */ - public static double nextAfter(double start, double direction) { /* * The cases: @@ -3207,7 +3190,6 @@ public static double nextAfter(double start, double direction) { * direction of {@code direction}. * @since 1.6 */ - public static float nextAfter(float start, double direction) { /* * The cases: @@ -3281,7 +3263,6 @@ public static float nextAfter(float start, double direction) { * infinity. * @since 1.6 */ - public static double nextUp(double d) { // Use a single conditional and handle the likely cases first. if (d < Double.POSITIVE_INFINITY) { @@ -3321,7 +3302,6 @@ public static double nextUp(double d) { * infinity. * @since 1.6 */ - public static float nextUp(float f) { // Use a single conditional and handle the likely cases first. if (f < Float.POSITIVE_INFINITY) { @@ -3446,7 +3426,6 @@ public static float nextDown(float f) { * @return {@code d} × 2{@code scaleFactor} * @since 1.6 */ - public static double scalb(double d, int scaleFactor) { if (scaleFactor > -DoubleConsts.EXP_BIAS) { if (scaleFactor <= DoubleConsts.EXP_BIAS) { @@ -3499,7 +3478,6 @@ public static double scalb(double d, int scaleFactor) { * @return {@code f} × 2{@code scaleFactor} * @since 1.6 */ - public static float scalb(float f, int scaleFactor) { // magnitude of a power of two so large that scaling a finite // nonzero value by it would be guaranteed to over or diff --git a/src/java.base/share/classes/java/lang/Module.java b/src/java.base/share/classes/java/lang/Module.java index 9d5b79cb432..941d42babd8 100644 --- a/src/java.base/share/classes/java/lang/Module.java +++ b/src/java.base/share/classes/java/lang/Module.java @@ -101,6 +101,7 @@ * @see Class#getModule() * @jls 7.7 Module Declarations */ + @NullMarked public final class Module implements AnnotatedElement { diff --git a/src/java.base/share/classes/java/lang/ModuleLayer.java b/src/java.base/share/classes/java/lang/ModuleLayer.java index 68f38cbefef..9984114ca56 100644 --- a/src/java.base/share/classes/java/lang/ModuleLayer.java +++ b/src/java.base/share/classes/java/lang/ModuleLayer.java @@ -148,6 +148,7 @@ * @since 9 * @see Module#getLayer() */ + @NullMarked @AOTSafeClassInitializer public final class ModuleLayer { diff --git a/src/java.base/share/classes/java/lang/NegativeArraySizeException.java b/src/java.base/share/classes/java/lang/NegativeArraySizeException.java index 68b2c944342..104a2d6823a 100644 --- a/src/java.base/share/classes/java/lang/NegativeArraySizeException.java +++ b/src/java.base/share/classes/java/lang/NegativeArraySizeException.java @@ -42,7 +42,6 @@ public class NegativeArraySizeException extends RuntimeException { * Constructs a {@code NegativeArraySizeException} with no * detail message. */ - public NegativeArraySizeException() { super(); } @@ -53,7 +52,6 @@ public NegativeArraySizeException() { * * @param s the detail message. */ - public NegativeArraySizeException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/NoClassDefFoundError.java b/src/java.base/share/classes/java/lang/NoClassDefFoundError.java index a802418fd46..d2a333c1781 100644 --- a/src/java.base/share/classes/java/lang/NoClassDefFoundError.java +++ b/src/java.base/share/classes/java/lang/NoClassDefFoundError.java @@ -48,7 +48,6 @@ public class NoClassDefFoundError extends LinkageError { /** * Constructs a {@code NoClassDefFoundError} with no detail message. */ - public NoClassDefFoundError() { super(); } @@ -59,7 +58,6 @@ public NoClassDefFoundError() { * * @param s the detail message. */ - public NoClassDefFoundError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/NoSuchFieldError.java b/src/java.base/share/classes/java/lang/NoSuchFieldError.java index 554783db5de..95e5d934ea4 100644 --- a/src/java.base/share/classes/java/lang/NoSuchFieldError.java +++ b/src/java.base/share/classes/java/lang/NoSuchFieldError.java @@ -46,7 +46,6 @@ public class NoSuchFieldError extends IncompatibleClassChangeError { /** * Constructs a {@code NoSuchFieldError} with no detail message. */ - public NoSuchFieldError() { super(); } @@ -57,7 +56,6 @@ public NoSuchFieldError() { * * @param s the detail message. */ - public NoSuchFieldError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/NoSuchFieldException.java b/src/java.base/share/classes/java/lang/NoSuchFieldException.java index f3fe4df8243..3a9d5d79144 100644 --- a/src/java.base/share/classes/java/lang/NoSuchFieldException.java +++ b/src/java.base/share/classes/java/lang/NoSuchFieldException.java @@ -41,7 +41,6 @@ public class NoSuchFieldException extends ReflectiveOperationException { /** * Constructor. */ - public NoSuchFieldException() { super(); } @@ -51,7 +50,6 @@ public NoSuchFieldException() { * * @param s the detail message */ - public NoSuchFieldException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/NoSuchMethodError.java b/src/java.base/share/classes/java/lang/NoSuchMethodError.java index 295cd2bc083..7bdce6470c1 100644 --- a/src/java.base/share/classes/java/lang/NoSuchMethodError.java +++ b/src/java.base/share/classes/java/lang/NoSuchMethodError.java @@ -47,7 +47,6 @@ public class NoSuchMethodError extends IncompatibleClassChangeError { /** * Constructs a {@code NoSuchMethodError} with no detail message. */ - public NoSuchMethodError() { super(); } @@ -58,7 +57,6 @@ public NoSuchMethodError() { * * @param s the detail message. */ - public NoSuchMethodError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/NoSuchMethodException.java b/src/java.base/share/classes/java/lang/NoSuchMethodException.java index 5914f206b90..1e75562a855 100644 --- a/src/java.base/share/classes/java/lang/NoSuchMethodException.java +++ b/src/java.base/share/classes/java/lang/NoSuchMethodException.java @@ -41,7 +41,6 @@ public class NoSuchMethodException extends ReflectiveOperationException { /** * Constructs a {@code NoSuchMethodException} without a detail message. */ - public NoSuchMethodException() { super(); } @@ -51,7 +50,6 @@ public NoSuchMethodException() { * * @param s the detail message. */ - public NoSuchMethodException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/NullPointerException.java b/src/java.base/share/classes/java/lang/NullPointerException.java index 7c8e46e89bb..9b3700afbe3 100644 --- a/src/java.base/share/classes/java/lang/NullPointerException.java +++ b/src/java.base/share/classes/java/lang/NullPointerException.java @@ -59,7 +59,6 @@ public class NullPointerException extends RuntimeException { /** * Constructs a {@code NullPointerException} with no detail message. */ - public NullPointerException() { super(); } @@ -70,7 +69,6 @@ public NullPointerException() { * * @param s the detail message. */ - public NullPointerException(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/Number.java b/src/java.base/share/classes/java/lang/Number.java index e1b308b95c6..2afc256191d 100644 --- a/src/java.base/share/classes/java/lang/Number.java +++ b/src/java.base/share/classes/java/lang/Number.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * The abstract class {@code Number} is the superclass of platform @@ -79,8 +78,7 @@ * @return the numeric value represented by this object after conversion * to type {@code int}. */ - - public abstract int intValue(); + public abstract int intValue(); /** * Returns the value of the specified number as a {@code long}. @@ -88,8 +86,7 @@ * @return the numeric value represented by this object after conversion * to type {@code long}. */ - - public abstract long longValue(); + public abstract long longValue(); /** * Returns the value of the specified number as a {@code float}. @@ -97,8 +94,7 @@ * @return the numeric value represented by this object after conversion * to type {@code float}. */ - - public abstract float floatValue(); + public abstract float floatValue(); /** * Returns the value of the specified number as a {@code double}. @@ -106,8 +102,7 @@ * @return the numeric value represented by this object after conversion * to type {@code double}. */ - - public abstract double doubleValue(); + public abstract double doubleValue(); /** * Returns the value of the specified number as a {@code byte}. @@ -120,8 +115,7 @@ * to type {@code byte}. * @since 1.1 */ - - public byte byteValue() { + public byte byteValue() { return (byte)intValue(); } @@ -136,8 +130,7 @@ public byte byteValue() { * to type {@code short}. * @since 1.1 */ - - public short shortValue() { + public short shortValue() { return (short)intValue(); } diff --git a/src/java.base/share/classes/java/lang/Object.java b/src/java.base/share/classes/java/lang/Object.java index 628ce2b1975..ae7ae3f919d 100644 --- a/src/java.base/share/classes/java/lang/Object.java +++ b/src/java.base/share/classes/java/lang/Object.java @@ -196,9 +196,7 @@ public Object() {} * @see #hashCode() * @see java.util.HashMap */ - - - public boolean equals( @Nullable Object obj) { + public boolean equals(@Nullable Object obj) { return (this == obj); } @@ -314,8 +312,6 @@ public boolean equals( @Nullable Object obj) { * the {@code toString} nor {@code hashCode} methods were * overridden by the object's class. */ - - public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } @@ -582,7 +578,7 @@ public final void wait(long timeoutMillis) throws InterruptedException { * @see #wait() * @see #wait(long) */ - public final void wait(long timeoutMillis, int nanos) throws InterruptedException { + public final void wait(long timeoutMillis, int nanos) throws InterruptedException { if (timeoutMillis < 0) { throw new IllegalArgumentException("timeoutMillis value is negative"); } diff --git a/src/java.base/share/classes/java/lang/OutOfMemoryError.java b/src/java.base/share/classes/java/lang/OutOfMemoryError.java index 9c296334125..4be4e1f99c5 100644 --- a/src/java.base/share/classes/java/lang/OutOfMemoryError.java +++ b/src/java.base/share/classes/java/lang/OutOfMemoryError.java @@ -48,7 +48,6 @@ public class OutOfMemoryError extends VirtualMachineError { /** * Constructs an {@code OutOfMemoryError} with no detail message. */ - public OutOfMemoryError() { super(); } @@ -59,7 +58,6 @@ public OutOfMemoryError() { * * @param s the detail message. */ - public OutOfMemoryError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/Override.java b/src/java.base/share/classes/java/lang/Override.java index c6d933bcfa1..d95a5f7a5da 100644 --- a/src/java.base/share/classes/java/lang/Override.java +++ b/src/java.base/share/classes/java/lang/Override.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.lang.annotation.*; diff --git a/src/java.base/share/classes/java/lang/Package.java b/src/java.base/share/classes/java/lang/Package.java index 2d4cb6371fe..88fc6ac40a0 100644 --- a/src/java.base/share/classes/java/lang/Package.java +++ b/src/java.base/share/classes/java/lang/Package.java @@ -125,7 +125,7 @@ public final class Package extends NamedPackage implements java.lang.reflect.Ann * The Java Language Specification, * for example, {@code java.lang} */ - public String getName() { + public String getName() { return packageName(); } @@ -230,7 +230,6 @@ public String getName() { * @return true if the package is sealed, false otherwise * */ - public boolean isSealed() { return module().isNamed() || versionInfo.sealBase != null; } @@ -249,8 +248,7 @@ public boolean isSealed() { * @param url the code source URL * @return true if this package is sealed with respect to the given {@code url} */ - - public boolean isSealed( URL url) { + public boolean isSealed(URL url) { Objects.requireNonNull(url); URL sealBase = null; @@ -288,7 +286,6 @@ public boolean isSealed( URL url) { * @throws NumberFormatException if the current version is not known or * the desired or current version is not of the correct dotted form. */ - public boolean isCompatibleWith(String desired) throws NumberFormatException { @@ -358,7 +355,6 @@ public boolean isCompatibleWith(String desired) * * @see ClassLoader#getDefinedPackage */ - @CallerSensitive @Deprecated(since="9") public static @Nullable Package getPackage(String name) { @@ -380,7 +376,6 @@ public boolean isCompatibleWith(String desired) * * @see ClassLoader#getDefinedPackages */ - @CallerSensitive public static Package[] getPackages() { ClassLoader cl = ClassLoader.getClassLoader(Reflection.getCallerClass()); @@ -391,7 +386,6 @@ public static Package[] getPackages() { * Return the hash code computed from the package name. * @return the hash code computed from the package name. */ - @Override public int hashCode(){ return packageName().hashCode(); @@ -404,7 +398,6 @@ public int hashCode(){ * If the package version is defined it is appended. * @return the string representation of the package. */ - @Override public String toString() { String spec = versionInfo.specTitle; @@ -462,9 +455,8 @@ class PackageInfoProxy {} * @throws NullPointerException {@inheritDoc} * @since 1.5 */ - @Override - public boolean isAnnotationPresent( Class annotationClass) { + public boolean isAnnotationPresent(Class annotationClass) { return AnnotatedElement.super.isAnnotationPresent(annotationClass); } @@ -542,7 +534,7 @@ public Annotation[] getDeclaredAnnotations() { * @param sealbase code source where this Package comes from * @param loader defining class loader */ - Package( String name, + Package(String name, String spectitle, String specversion, String specvendor, String impltitle, String implversion, String implvendor, URL sealbase, ClassLoader loader) @@ -557,7 +549,7 @@ public Annotation[] getDeclaredAnnotations() { sealbase); } - Package( String name, Module module) { + Package(String name, Module module) { super(name, module); this.versionInfo = VersionInfo.NULL_VERSION_INFO; } diff --git a/src/java.base/share/classes/java/lang/Process.java b/src/java.base/share/classes/java/lang/Process.java index 5ed35ce6f10..bb681866d89 100644 --- a/src/java.base/share/classes/java/lang/Process.java +++ b/src/java.base/share/classes/java/lang/Process.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import jdk.internal.misc.Blocker; import jdk.internal.util.StaticProperty; @@ -312,7 +311,6 @@ private static IOException quietClose(Closeable c, IOException firstIOE) { * @return the output stream connected to the normal input of the * process */ - public abstract OutputStream getOutputStream(); /** diff --git a/src/java.base/share/classes/java/lang/Readable.java b/src/java.base/share/classes/java/lang/Readable.java index 2816f5307c1..bb19dd97554 100644 --- a/src/java.base/share/classes/java/lang/Readable.java +++ b/src/java.base/share/classes/java/lang/Readable.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.IOException; @@ -57,5 +56,5 @@ public interface Readable { * @throws java.nio.ReadOnlyBufferException if cb is a read only buffer, * even if its length is zero */ - public int read(java.nio.CharBuffer cb) throws IOException; + public int read(java.nio.CharBuffer cb) throws IOException; } diff --git a/src/java.base/share/classes/java/lang/Runnable.java b/src/java.base/share/classes/java/lang/Runnable.java index 92dedaf9ded..f67bbf97c9f 100644 --- a/src/java.base/share/classes/java/lang/Runnable.java +++ b/src/java.base/share/classes/java/lang/Runnable.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents an operation that does not return a result. @@ -39,7 +38,6 @@ * @since 1.0 */ @NullMarked - @FunctionalInterface public interface Runnable { /** diff --git a/src/java.base/share/classes/java/lang/RuntimeException.java b/src/java.base/share/classes/java/lang/RuntimeException.java index b4df523a6a4..3bb5e8e7760 100644 --- a/src/java.base/share/classes/java/lang/RuntimeException.java +++ b/src/java.base/share/classes/java/lang/RuntimeException.java @@ -52,7 +52,6 @@ public class RuntimeException extends Exception { * detail message. The cause is not initialized, and may subsequently be * initialized by a call to {@link #initCause}. */ - public RuntimeException() { super(); } @@ -64,7 +63,6 @@ public RuntimeException() { * @param message the detail message. The detail message is saved for * later retrieval by the {@link #getMessage()} method. */ - public RuntimeException(@Nullable String message) { super(message); } @@ -83,7 +81,6 @@ public RuntimeException(@Nullable String message) { * unknown.) * @since 1.4 */ - public RuntimeException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -100,7 +97,6 @@ public RuntimeException(@Nullable String message, @Nullable Throwable cause) { * unknown.) * @since 1.4 */ - public RuntimeException(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/lang/SecurityException.java b/src/java.base/share/classes/java/lang/SecurityException.java index 4a4eb668618..b5c15e4e793 100644 --- a/src/java.base/share/classes/java/lang/SecurityException.java +++ b/src/java.base/share/classes/java/lang/SecurityException.java @@ -45,7 +45,6 @@ public class SecurityException extends RuntimeException { /** * Constructs a {@code SecurityException} with no detail message. */ - public SecurityException() { super(); } @@ -56,7 +55,6 @@ public SecurityException() { * * @param s the detail message. */ - public SecurityException(@Nullable String s) { super(s); } @@ -72,7 +70,6 @@ public SecurityException(@Nullable String s) { * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ - public SecurityException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -88,7 +85,6 @@ public SecurityException(@Nullable String message, @Nullable Throwable cause) { * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ - public SecurityException(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/lang/SecurityManager.java b/src/java.base/share/classes/java/lang/SecurityManager.java index f110615c4a7..20a2f47d913 100644 --- a/src/java.base/share/classes/java/lang/SecurityManager.java +++ b/src/java.base/share/classes/java/lang/SecurityManager.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.FileDescriptor; import java.net.InetAddress; diff --git a/src/java.base/share/classes/java/lang/Short.java b/src/java.base/share/classes/java/lang/Short.java index 7606ed25027..3444e5a5586 100644 --- a/src/java.base/share/classes/java/lang/Short.java +++ b/src/java.base/share/classes/java/lang/Short.java @@ -82,13 +82,13 @@ * A constant holding the minimum value a {@code short} can * have, -215. */ - public static final short MIN_VALUE = -32768; + public static final short MIN_VALUE = -32768; /** * A constant holding the maximum value a {@code short} can * have, 215-1. */ - public static final short MAX_VALUE = 32767; + public static final short MAX_VALUE = 32767; /** * The {@code Class} instance representing the primitive type @@ -148,9 +148,7 @@ public static String toString(short s) { * @throws NumberFormatException If the {@code String} * does not contain a parsable {@code short}. */ - - - public static short parseShort(String s, int radix) + public static short parseShort(String s, int radix) throws NumberFormatException { int i = Integer.parseInt(s, radix); if (i < MIN_VALUE || i > MAX_VALUE) @@ -177,8 +175,6 @@ public static short parseShort(String s, int radix) * @throws NumberFormatException If the string does not * contain a parsable {@code short}. */ - - public static short parseShort(String s) throws NumberFormatException { return parseShort(s, 10); } @@ -208,9 +204,7 @@ public static short parseShort(String s) throws NumberFormatException { * @throws NumberFormatException If the {@code String} does * not contain a parsable {@code short}. */ - - - public static Short valueOf(String s, int radix) + public static Short valueOf(String s, int radix) throws NumberFormatException { return valueOf(parseShort(s, radix)); } @@ -237,8 +231,6 @@ public static Short valueOf(String s, int radix) * @throws NumberFormatException If the {@code String} does * not contain a parsable {@code short}. */ - - public static Short valueOf(String s) throws NumberFormatException { return valueOf(s, 10); } @@ -371,8 +363,6 @@ public static Short valueOf(short s) { * contain a parsable {@code short}. * @see java.lang.Short#parseShort(java.lang.String, int) */ - - public static Short decode(String nm) throws NumberFormatException { int i = Integer.decode(nm); if (i < MIN_VALUE || i > MAX_VALUE) @@ -434,9 +424,7 @@ public Short(String s) throws NumberFormatException { * a narrowing primitive conversion. * @jls 5.1.3 Narrowing Primitive Conversion */ - - - public byte byteValue() { + public byte byteValue() { return (byte)value; } @@ -454,9 +442,7 @@ public short shortValue() { * a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public int intValue() { + public int intValue() { return (int)value; } @@ -465,9 +451,7 @@ public int intValue() { * a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public long longValue() { + public long longValue() { return (long)value; } @@ -476,9 +460,7 @@ public long longValue() { * after a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public float floatValue() { + public float floatValue() { return (float)value; } @@ -487,9 +469,7 @@ public float floatValue() { * after a widening primitive conversion. * @jls 5.1.2 Widening Primitive Conversion */ - - - public double doubleValue() { + public double doubleValue() { return (double)value; } @@ -514,8 +494,6 @@ public String toString() { * * @return a hash code value for this {@code Short} */ - - @Override public int hashCode() { return Short.hashCode(value); @@ -529,8 +507,6 @@ public int hashCode() { * @return a hash code value for a {@code short} value. * @since 1.8 */ - - public static int hashCode(short value) { return (int)value; } @@ -565,8 +541,6 @@ public boolean equals(@Nullable Object obj) { * comparison). * @since 1.2 */ - - public int compareTo(Short anotherShort) { return compare(this.value, anotherShort.value); } @@ -585,8 +559,6 @@ public int compareTo(Short anotherShort) { * a value greater than {@code 0} if {@code x > y} * @since 1.7 */ - - public static int compare(short x, short y) { return x - y; } @@ -603,8 +575,6 @@ public static int compare(short x, short y) { * unsigned values * @since 9 */ - - public static int compareUnsigned(short x, short y) { return Short.toUnsignedInt(x) - Short.toUnsignedInt(y); } @@ -614,7 +584,7 @@ public static int compareUnsigned(short x, short y) { * complement binary form. * @since 1.5 */ - public static final int SIZE = 16; + public static final int SIZE = 16; /** * The number of bytes used to represent a {@code short} value in two's @@ -622,7 +592,7 @@ public static int compareUnsigned(short x, short y) { * * @since 1.8 */ - public static final int BYTES = SIZE / Byte.SIZE; + public static final int BYTES = SIZE / Byte.SIZE; /** * Returns the value obtained by reversing the order of the bytes in the @@ -655,8 +625,6 @@ public static short reverseBytes(short i) { * conversion * @since 1.8 */ - - public static int toUnsignedInt(short x) { return ((int) x) & 0xffff; } @@ -677,8 +645,6 @@ public static int toUnsignedInt(short x) { * conversion * @since 1.8 */ - - public static long toUnsignedLong(short x) { return ((long) x) & 0xffffL; } diff --git a/src/java.base/share/classes/java/lang/StackOverflowError.java b/src/java.base/share/classes/java/lang/StackOverflowError.java index bd83bdf044e..aeca3b1c5db 100644 --- a/src/java.base/share/classes/java/lang/StackOverflowError.java +++ b/src/java.base/share/classes/java/lang/StackOverflowError.java @@ -42,7 +42,6 @@ public class StackOverflowError extends VirtualMachineError { /** * Constructs a {@code StackOverflowError} with no detail message. */ - public StackOverflowError() { super(); } @@ -53,7 +52,6 @@ public StackOverflowError() { * * @param s the detail message. */ - public StackOverflowError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/StackTraceElement.java b/src/java.base/share/classes/java/lang/StackTraceElement.java index 7d505ed2b2a..fb1f38f46ff 100644 --- a/src/java.base/share/classes/java/lang/StackTraceElement.java +++ b/src/java.base/share/classes/java/lang/StackTraceElement.java @@ -123,7 +123,7 @@ public final class StackTraceElement implements java.io.Serializable { * {@code methodName} is null * @since 1.5 */ - public StackTraceElement( String declaringClass, String methodName, + public StackTraceElement(String declaringClass, String methodName, @Nullable String fileName, int lineNumber) { this(null, null, null, declaringClass, methodName, fileName, lineNumber); } @@ -258,7 +258,7 @@ public int getLineNumber() { * of the {@code Class} containing the execution point represented * by this stack trace element} */ - public String getClassName() { + public String getClassName() { return declaringClass; } @@ -284,7 +284,6 @@ public String getMethodName() { * @return {@code true} if the method containing the execution point * represented by this stack trace element is a native method. */ - public boolean isNativeMethod() { return lineNumber == -2; } @@ -430,8 +429,7 @@ private static int length(String s) { * {@code StackTraceElement} instance representing the same * execution point as this instance. */ - - public boolean equals( @Nullable Object obj) { + public boolean equals(@Nullable Object obj) { if (obj==this) return true; return (obj instanceof StackTraceElement e) @@ -447,7 +445,6 @@ public boolean equals( @Nullable Object obj) { /** * Returns a hash code value for this stack trace element. */ - public int hashCode() { int result = 31*declaringClass.hashCode() + methodName.hashCode(); result = 31*result + Objects.hashCode(classLoaderName); diff --git a/src/java.base/share/classes/java/lang/StrictMath.java b/src/java.base/share/classes/java/lang/StrictMath.java index eaba66f85ed..dd6cf8f92ea 100644 --- a/src/java.base/share/classes/java/lang/StrictMath.java +++ b/src/java.base/share/classes/java/lang/StrictMath.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Random; import jdk.internal.math.DoubleConsts; diff --git a/src/java.base/share/classes/java/lang/String.java b/src/java.base/share/classes/java/lang/String.java index 5f087d3bfa6..a36ff543f56 100644 --- a/src/java.base/share/classes/java/lang/String.java +++ b/src/java.base/share/classes/java/lang/String.java @@ -280,9 +280,7 @@ public final class String * an empty character sequence. Note that use of this constructor is * unnecessary since Strings are immutable. */ - - - public String() { + public String() { this.value = "".value; this.coder = "".coder; } @@ -385,9 +383,7 @@ private static Void rangeCheck(char[] value, int offset, int count) { * * @since 1.5 */ - - - public String(int [] codePoints, int offset, int count) { + public String(int[] codePoints, int offset, int count) { checkBoundsOffCount(offset, count, codePoints.length); if (count == 0) { this.value = "".value; @@ -446,8 +442,6 @@ public String(int [] codePoints, int offset, int count) { * @see #String(byte[], java.nio.charset.Charset) * @see #String(byte[]) */ - - @Deprecated(since="1.1") public String(byte[] ascii, int hibyte, int offset, int count) { checkBoundsOffCount(offset, count, ascii.length); @@ -502,8 +496,6 @@ public String(byte[] ascii, int hibyte, int offset, int count) { * @see #String(byte[], java.nio.charset.Charset) * @see #String(byte[]) */ - - @Deprecated(since="1.1") public String(byte[] ascii, int hibyte) { this(ascii, hibyte, 0, ascii.length); @@ -1768,9 +1760,7 @@ public String(byte[] bytes) { * @param buffer * A {@code StringBuffer} */ - - - public String( StringBuffer buffer) { + public String(StringBuffer buffer) { this(buffer.toString()); } @@ -1792,9 +1782,7 @@ public String( StringBuffer buffer) { * * @since 1.5 */ - - - public String( StringBuilder builder) { + public String(StringBuilder builder) { this(builder, null); } @@ -1806,9 +1794,7 @@ public String( StringBuilder builder) { * @return the length of the sequence of characters represented by this * object. */ - - - public int length() { + public int length() { return value.length >> coder(); } @@ -1848,9 +1834,7 @@ public boolean isEmpty() { * argument is negative or not less than the length of this * string. */ - - - public char charAt( int index) { + public char charAt(int index) { if (isLatin1()) { return StringLatin1.charAt(value, index); } else { @@ -1880,9 +1864,7 @@ public char charAt( int index) { * string. * @since 1.5 */ - - - public int codePointAt( int index) { + public int codePointAt(int index) { if (isLatin1()) { checkIndex(index, value.length); return value[index] & 0xff; @@ -1914,9 +1896,7 @@ public int codePointAt( int index) { * of this string. * @since 1.5 */ - - - public int codePointBefore( int index) { + public int codePointBefore(int index) { int i = index - 1; checkIndex(i, length()); if (isLatin1()) { @@ -2073,9 +2053,7 @@ public void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) { * * @since 1.1 */ - - - public byte[] getBytes(String charsetName) + public byte[] getBytes(String charsetName) throws UnsupportedEncodingException { return encode(lookupCharset(charsetName), coder(), value); } @@ -2098,9 +2076,7 @@ public byte[] getBytes(String charsetName) * * @since 1.6 */ - - - public byte[] getBytes(Charset charset) { + public byte[] getBytes(Charset charset) { if (charset == null) throw new NullPointerException(); return encode(charset, coder(), value); } @@ -2186,10 +2162,7 @@ void copyToSegmentRaw(MemorySegment segment, long offset, int srcIndex, int srcL * @see #compareTo(String) * @see #equalsIgnoreCase(String) */ - - - - public boolean equals( @Nullable Object anObject) { + public boolean equals(@Nullable Object anObject) { if (this == anObject) { return true; } @@ -2216,9 +2189,7 @@ public boolean equals( @Nullable Object anObject) { * * @since 1.4 */ - - - public boolean contentEquals( StringBuffer sb) { + public boolean contentEquals(StringBuffer sb) { return contentEquals((CharSequence)sb); } @@ -2259,9 +2230,7 @@ private boolean nonSyncContentEquals(AbstractStringBuilder sb) { * * @since 1.5 */ - - - public boolean contentEquals( CharSequence cs) { + public boolean contentEquals(CharSequence cs) { // Argument is a StringBuffer, StringBuilder if (cs instanceof AbstractStringBuilder) { if (cs instanceof StringBuffer) { @@ -2326,9 +2295,6 @@ public boolean contentEquals( CharSequence cs) { * @see #equalsFoldCase(String) * @see #codePoints() */ - - - public boolean equalsIgnoreCase(@Nullable String anotherString) { return (this == anotherString) ? true : (anotherString != null) @@ -2431,8 +2397,6 @@ public boolean equalsFoldCase(@Nullable String anotherString) { * value greater than {@code 0} if this string is * lexicographically greater than the string argument. */ - - public int compareTo(String anotherString) { byte[] v1 = value; byte[] v2 = anotherString.value; @@ -2507,8 +2471,6 @@ public int compare(String s1, String s2) { * @see #compareToFoldCase(String) * @since 1.2 */ - - public int compareToIgnoreCase(String str) { return CASE_INSENSITIVE_ORDER.compare(this, str); } @@ -2621,8 +2583,6 @@ public int compareToFoldCase(String str) { * exactly matches the specified subregion of the string argument; * {@code false} otherwise. */ - - public boolean regionMatches(int toffset, String other, int ooffset, int len) { // Note: toffset, ooffset, or len might be near -1>>>1. if ((ooffset < 0) || (toffset < 0) || @@ -2713,8 +2673,6 @@ public boolean regionMatches(int toffset, String other, int ooffset, int len) { * argument. * @see #codePoints() */ - - public boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len) { if (!ignoreCase) { @@ -2756,8 +2714,6 @@ public boolean regionMatches(boolean ignoreCase, int toffset, * this.substring(toffset).startsWith(prefix) * */ - - public boolean startsWith(String prefix, int toffset) { // Note: toffset might be near -1>>>1. if (toffset < 0 || toffset > length() - prefix.length()) { @@ -2801,8 +2757,6 @@ public boolean startsWith(String prefix, int toffset) { * {@link #equals(Object)} method. * @since 1.0 */ - - public boolean startsWith(String prefix) { return startsWith(prefix, 0); } @@ -2818,8 +2772,6 @@ public boolean startsWith(String prefix) { * empty string or is equal to this {@code String} object * as determined by the {@link #equals(Object)} method. */ - - public boolean endsWith(String suffix) { return startsWith(suffix, length() - suffix.length()); } @@ -2837,8 +2789,6 @@ public boolean endsWith(String suffix) { * * @return a hash code value for this object. */ - - public int hashCode() { // The hash or hashIsZero fields are subject to a benign data race, // making it crucial to ensure that any observable result of the @@ -3017,9 +2967,7 @@ public int indexOf(int ch, int beginIndex, int endIndex) { * character sequence represented by this object, or * {@code -1} if the character does not occur. */ - - - public int lastIndexOf(int ch) { + public int lastIndexOf(int ch) { return lastIndexOf(ch, length() - 1); } @@ -3057,9 +3005,7 @@ public int lastIndexOf(int ch) { * than or equal to {@code fromIndex}, or {@code -1} * if the character does not occur before that point. */ - - - public int lastIndexOf(int ch, int fromIndex) { + public int lastIndexOf(int ch, int fromIndex) { return isLatin1() ? StringLatin1.lastIndexOf(value, ch, fromIndex) : StringUTF16.lastIndexOf(value, ch, fromIndex); } @@ -3120,9 +3066,7 @@ public int indexOf(String str) { * starting at the specified index, * or {@code -1} if there is no such occurrence. */ - - - public int indexOf(String str, int fromIndex) { + public int indexOf(String str, int fromIndex) { return indexOf(value, coder(), length(), str, fromIndex); } @@ -3210,9 +3154,7 @@ static int indexOf(byte[] src, byte srcCoder, int srcCount, * @return the index of the last occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */ - - - public int lastIndexOf(String str) { + public int lastIndexOf(String str) { return lastIndexOf(str, length()); } @@ -3233,9 +3175,7 @@ public int lastIndexOf(String str) { * searching backward from the specified index, * or {@code -1} if there is no such occurrence. */ - - - public int lastIndexOf(String str, int fromIndex) { + public int lastIndexOf(String str, int fromIndex) { return lastIndexOf(value, coder(), length(), str, fromIndex); } @@ -3325,9 +3265,7 @@ public String substring(int beginIndex) { * {@code beginIndex} is larger than * {@code endIndex}. */ - - - public String substring( int beginIndex, int endIndex) { + public String substring(int beginIndex, int endIndex) { int length = length(); checkBoundsBeginEnd(beginIndex, endIndex, length); if (beginIndex == 0 && endIndex == length) { @@ -3366,9 +3304,7 @@ public String substring( int beginIndex, int endIndex) { * * @since 1.4 */ - - - public CharSequence subSequence( int beginIndex, int endIndex) { + public CharSequence subSequence(int beginIndex, int endIndex) { return this.substring(beginIndex, endIndex); } @@ -3392,8 +3328,6 @@ public CharSequence subSequence( int beginIndex, int endIndex) { * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. */ - - public String concat(String str) { if (str.isEmpty()) { return this; @@ -3430,8 +3364,6 @@ public String concat(String str) { * @return a string derived from this string by replacing every * occurrence of {@code oldChar} with {@code newChar}. */ - - public String replace(char oldChar, char newChar) { if (oldChar != newChar) { String ret = isLatin1() ? StringLatin1.replace(value, oldChar, newChar) @@ -3469,9 +3401,7 @@ public String replace(char oldChar, char newChar) { * * @since 1.4 */ - - - public boolean matches( String regex) { + public boolean matches(String regex) { return Pattern.matches(regex, this); } @@ -3483,8 +3413,6 @@ public boolean matches( String regex) { * @return true if this string contains {@code s}, false otherwise * @since 1.5 */ - - public boolean contains(CharSequence s) { return indexOf(s.toString()) >= 0; } @@ -3529,9 +3457,7 @@ public boolean contains(CharSequence s) { * * @since 1.4 */ - - - public String replaceFirst( String regex, String replacement) { + public String replaceFirst(String regex, String replacement) { return Pattern.compile(regex).matcher(this).replaceFirst(replacement); } @@ -3575,9 +3501,7 @@ public String replaceFirst( String regex, String replacement) { * * @since 1.4 */ - - - public String replaceAll( String regex, String replacement) { + public String replaceAll(String regex, String replacement) { return Pattern.compile(regex).matcher(this).replaceAll(replacement); } @@ -3984,8 +3908,6 @@ public String[] split(String regex) { * @see java.util.StringJoiner * @since 1.8 */ - - public static String join(CharSequence delimiter, @Nullable CharSequence... elements) { var delim = delimiter.toString(); var elems = new String[elements.length]; @@ -4079,8 +4001,6 @@ static String join(String prefix, String suffix, String delimiter, String[] elem * @see java.util.StringJoiner * @since 1.8 */ - - public static String join(CharSequence delimiter, Iterable elements) { Objects.requireNonNull(delimiter); @@ -4151,9 +4071,7 @@ public static String join(CharSequence delimiter, * @see java.lang.String#toUpperCase(Locale) * @since 1.1 */ - - - public String toLowerCase( Locale locale) { + public String toLowerCase(Locale locale) { return isLatin1() ? StringLatin1.toLowerCase(this, value, locale) : StringUTF16.toLowerCase(this, value, locale); } @@ -4177,8 +4095,6 @@ public String toLowerCase( Locale locale) { * @return the {@code String}, converted to lowercase. * @see java.lang.String#toLowerCase(Locale) */ - - public String toLowerCase() { return toLowerCase(Locale.getDefault()); } @@ -4235,9 +4151,7 @@ public String toLowerCase() { * @see java.lang.String#toLowerCase(Locale) * @since 1.1 */ - - - public String toUpperCase( Locale locale) { + public String toUpperCase(Locale locale) { return isLatin1() ? StringLatin1.toUpperCase(this, value, locale) : StringUTF16.toUpperCase(this, value, locale); } @@ -4261,8 +4175,6 @@ public String toUpperCase( Locale locale) { * @return the {@code String}, converted to uppercase. * @see java.lang.String#toUpperCase(Locale) */ - - public String toUpperCase() { return toUpperCase(Locale.getDefault()); } @@ -4303,8 +4215,6 @@ public String toUpperCase() { * and trailing space removed, or this string if it * has no leading or trailing space. */ - - public String trim() { String ret = isLatin1() ? StringLatin1.trim(value) : StringUTF16.trim(value); @@ -4337,8 +4247,6 @@ public String trim() { * * @since 11 */ - - public String strip() { String ret = isLatin1() ? StringLatin1.strip(value) : StringUTF16.strip(value); @@ -4369,8 +4277,6 @@ public String strip() { * * @since 11 */ - - public String stripLeading() { String ret = isLatin1() ? StringLatin1.stripLeading(value) : StringUTF16.stripLeading(value); @@ -4401,8 +4307,6 @@ public String stripLeading() { * * @since 11 */ - - public String stripTrailing() { String ret = isLatin1() ? StringLatin1.stripTrailing(value) : StringUTF16.stripTrailing(value); @@ -4418,8 +4322,6 @@ public String stripTrailing() { * * @since 11 */ - - public boolean isBlank() { return indexOfNonWhitespace() == length(); } @@ -4830,9 +4732,7 @@ public String translateEscapes() { * * @return the string itself. */ - - - public String toString() { + public String toString() { return this; } @@ -4880,9 +4780,7 @@ public IntStream codePoints() { * of this string and whose contents are initialized to contain * the character sequence represented by this string. */ - - - public char [] toCharArray() { + public char[] toCharArray() { return isLatin1() ? StringLatin1.toChars(value) : StringUTF16.toChars(value); } @@ -4924,10 +4822,7 @@ public IntStream codePoints() { * @see java.util.Formatter * @since 1.5 */ - - - - public static String format(String format, @Nullable Object ... args) { + public static String format(String format, @Nullable Object... args) { return new Formatter().format(format, args).toString(); } @@ -4968,10 +4863,7 @@ public static String format(String format, @Nullable Object ... args) { * @see java.util.Formatter * @since 1.5 */ - - - - public static String format( @Nullable Locale l, String format, @Nullable Object ... args) { + public static String format(@Nullable Locale l, String format, @Nullable Object... args) { return new Formatter(l).format(format, args).toString(); } @@ -5005,9 +4897,7 @@ public String formatted(@Nullable Object... args) { * {@code obj.toString()} is returned. * @see java.lang.Object#toString() */ - - - public static String valueOf( @Nullable Object obj) { + public static String valueOf(@Nullable Object obj) { return (obj == null) ? "null" : obj.toString(); } @@ -5091,9 +4981,7 @@ public static String copyValueOf(char[] data) { * {@code "true"} is returned; otherwise, a string equal to * {@code "false"} is returned. */ - - - public static String valueOf(boolean b) { + public static String valueOf(boolean b) { return b ? "true" : "false"; } @@ -5105,9 +4993,7 @@ public static String valueOf(boolean b) { * @return a string of length {@code 1} containing * as its single character the argument {@code c}. */ - - - public static String valueOf(char c) { + public static String valueOf(char c) { if (COMPACT_STRINGS && StringLatin1.canEncode(c)) { return new String(StringLatin1.toBytes(c), LATIN1); } @@ -5124,9 +5010,7 @@ public static String valueOf(char c) { * @return a string representation of the {@code int} argument. * @see java.lang.Integer#toString(int, int) */ - - - public static String valueOf(int i) { + public static String valueOf(int i) { return Integer.toString(i); } @@ -5140,9 +5024,7 @@ public static String valueOf(int i) { * @return a string representation of the {@code long} argument. * @see java.lang.Long#toString(long) */ - - - public static String valueOf(long l) { + public static String valueOf(long l) { return Long.toString(l); } @@ -5156,8 +5038,6 @@ public static String valueOf(long l) { * @return a string representation of the {@code float} argument. * @see java.lang.Float#toString(float) */ - - public static String valueOf(float f) { return Float.toString(f); } @@ -5172,8 +5052,6 @@ public static String valueOf(float f) { * @return a string representation of the {@code double} argument. * @see java.lang.Double#toString(double) */ - - public static String valueOf(double d) { return Double.toString(d); } @@ -5201,9 +5079,7 @@ public static String valueOf(double d) { * @return a string that has the same contents as this string, but is * guaranteed to be from a pool of unique strings. */ - - - public native String intern(); + public native String intern(); /** * Returns a string whose value is the concatenation of this @@ -5223,8 +5099,6 @@ public static String valueOf(double d) { * * @since 11 */ - - public String repeat(int count) { if (count < 0) { throw new IllegalArgumentException("count is negative: " + count); diff --git a/src/java.base/share/classes/java/lang/StringBuffer.java b/src/java.base/share/classes/java/lang/StringBuffer.java index 5e9569b8cea..4e0dabbf441 100644 --- a/src/java.base/share/classes/java/lang/StringBuffer.java +++ b/src/java.base/share/classes/java/lang/StringBuffer.java @@ -112,7 +112,7 @@ * @see java.lang.String * @since 1.0 */ -@NullMarked + @NullMarked public final class StringBuffer extends AbstractStringBuilder implements Appendable, Serializable, Comparable, CharSequence @@ -204,14 +204,13 @@ public synchronized int compareTo(StringBuffer another) { return super.compareTo(another); } - @Override - public synchronized int length() { + public synchronized int length() { return count; } @Override - public synchronized int capacity() { + public synchronized int capacity() { return super.capacity(); } @@ -234,7 +233,7 @@ public synchronized void trimToSize() { * @see #length() */ @Override - public synchronized void setLength( int newLength) { + public synchronized void setLength(int newLength) { toStringCache = null; super.setLength(newLength); } @@ -286,7 +285,7 @@ public synchronized int offsetByCodePoints(int index, int codePointOffset) { @Override public synchronized void getChars(int srcBegin, int srcEnd, char[] dst, - int dstBegin) + int dstBegin) { super.getChars(srcBegin, srcEnd, dst, dstBegin); } @@ -302,7 +301,7 @@ public synchronized void setCharAt(int index, char ch) { } @Override - public synchronized StringBuffer append( @Nullable Object obj) { + public synchronized StringBuffer append(@Nullable Object obj) { toStringCache = null; super.append(String.valueOf(obj)); return this; @@ -340,7 +339,7 @@ public synchronized StringBuffer append(@Nullable String str) { * @return a reference to this object. * @since 1.4 */ - public synchronized StringBuffer append( @Nullable StringBuffer sb) { + public synchronized StringBuffer append(@Nullable StringBuffer sb) { toStringCache = null; super.append(sb); return this; @@ -350,7 +349,7 @@ public synchronized StringBuffer append( @Nullable StringBuffer sb) { * @since 1.8 */ @Override - synchronized StringBuffer append( AbstractStringBuilder asb) { + synchronized StringBuffer append(AbstractStringBuilder asb) { toStringCache = null; super.append(asb); return this; @@ -378,7 +377,7 @@ synchronized StringBuffer append( AbstractStringBuilder asb) { * @since 1.5 */ @Override - public synchronized StringBuffer append( @Nullable CharSequence s) { + public synchronized StringBuffer append(@Nullable CharSequence s) { toStringCache = null; super.append(s); return this; @@ -389,7 +388,7 @@ public synchronized StringBuffer append( @Nullable CharSequence s) { * @since 1.5 */ @Override - public synchronized StringBuffer append( @Nullable CharSequence s, int start, int end) + public synchronized StringBuffer append(@Nullable CharSequence s, int start, int end) { toStringCache = null; super.append(s, start, end); @@ -397,7 +396,7 @@ public synchronized StringBuffer append( @Nullable CharSequence s, int start, } @Override - public synchronized StringBuffer append( char[] str) { + public synchronized StringBuffer append(char[] str) { toStringCache = null; super.append(str); return this; @@ -407,14 +406,14 @@ public synchronized StringBuffer append( char[] str) { * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override - public synchronized StringBuffer append( char[] str, int offset, int len) { + public synchronized StringBuffer append(char[] str, int offset, int len) { toStringCache = null; super.append(str, offset, len); return this; } @Override - public synchronized StringBuffer append( boolean b) { + public synchronized StringBuffer append(boolean b) { toStringCache = null; super.append(b); return this; @@ -447,21 +446,21 @@ public synchronized StringBuffer appendCodePoint(int codePoint) { } @Override - public synchronized StringBuffer append( long lng) { + public synchronized StringBuffer append(long lng) { toStringCache = null; super.append(lng); return this; } @Override - public synchronized StringBuffer append( float f) { + public synchronized StringBuffer append(float f) { toStringCache = null; super.append(f); return this; } @Override - public synchronized StringBuffer append( double d) { + public synchronized StringBuffer append(double d) { toStringCache = null; super.append(d); return this; @@ -532,8 +531,8 @@ public synchronized String substring(int start, int end) { * @since 1.2 */ @Override - public synchronized StringBuffer insert(int index, char[] str, int offset, - int len) + public synchronized StringBuffer insert(int index, char[] str, int offset, + int len) { toStringCache = null; super.insert(index, str, offset, len); @@ -589,7 +588,7 @@ public StringBuffer insert(int dstOffset, @Nullable CharSequence s) { */ @Override public synchronized StringBuffer insert(int dstOffset, @Nullable CharSequence s, - int start, int end) + int start, int end) { toStringCache = null; super.insert(dstOffset, s, start, end); @@ -669,9 +668,8 @@ public StringBuffer insert(int offset, double d) { /** * @since 1.4 */ - @Override - public int indexOf(String str) { + public int indexOf(String str) { // Note, synchronization achieved via invocations of other StringBuffer methods return super.indexOf(str); } @@ -679,18 +677,16 @@ public int indexOf(String str) { /** * @since 1.4 */ - @Override - public synchronized int indexOf(String str, int fromIndex) { + public synchronized int indexOf(String str, int fromIndex) { return super.indexOf(str, fromIndex); } /** * @since 1.4 */ - @Override - public int lastIndexOf(String str) { + public int lastIndexOf(String str) { // Note, synchronization achieved via invocations of other StringBuffer methods return lastIndexOf(str, count); } @@ -698,9 +694,8 @@ public int lastIndexOf(String str) { /** * @since 1.4 */ - @Override - public synchronized int lastIndexOf(String str, int fromIndex) { + public synchronized int lastIndexOf(String str, int fromIndex) { return super.lastIndexOf(str, fromIndex); } diff --git a/src/java.base/share/classes/java/lang/StringBuilder.java b/src/java.base/share/classes/java/lang/StringBuilder.java index b860c9b28b0..6d76e675b7e 100644 --- a/src/java.base/share/classes/java/lang/StringBuilder.java +++ b/src/java.base/share/classes/java/lang/StringBuilder.java @@ -218,7 +218,7 @@ public StringBuilder append(@Nullable CharSequence s) { * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder append(@Nullable CharSequence s, int start, int end) { + public StringBuilder append(@Nullable CharSequence s, int start, int end) { super.append(s, start, end); return this; } @@ -233,7 +233,7 @@ public StringBuilder append(char[] str) { * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder append(char[] str, int offset, int len) { + public StringBuilder append(char[] str, int offset, int len) { super.append(str, offset, len); return this; } @@ -289,7 +289,7 @@ public StringBuilder appendCodePoint(int codePoint) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder delete( int start, int end) { + public StringBuilder delete(int start, int end) { super.delete(start, end); return this; } @@ -298,7 +298,7 @@ public StringBuilder delete( int start, int end) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder deleteCharAt( int index) { + public StringBuilder deleteCharAt(int index) { super.deleteCharAt(index); return this; } @@ -307,7 +307,7 @@ public StringBuilder deleteCharAt( int index) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder replace( int start, int end, String str) { + public StringBuilder replace(int start, int end, String str) { super.replace(start, end, str); return this; } @@ -316,8 +316,8 @@ public StringBuilder replace( int start, int end, String str) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int index, char[] str, int offset, - int len) + public StringBuilder insert(int index, char[] str, int offset, + int len) { super.insert(index, str, offset, len); return this; @@ -327,7 +327,7 @@ public StringBuilder insert( int index, char[] str, int offset, * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, @Nullable Object obj) { + public StringBuilder insert(int offset, @Nullable Object obj) { super.insert(offset, obj); return this; } @@ -336,7 +336,7 @@ public StringBuilder insert( int offset, @Nullable Object obj) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, @Nullable String str) { + public StringBuilder insert(int offset, @Nullable String str) { super.insert(offset, str); return this; } @@ -345,7 +345,7 @@ public StringBuilder insert( int offset, @Nullable String str) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, char[] str) { + public StringBuilder insert(int offset, char[] str) { super.insert(offset, str); return this; } @@ -354,7 +354,7 @@ public StringBuilder insert( int offset, char[] str) { * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int dstOffset, @Nullable CharSequence s) { + public StringBuilder insert(int dstOffset, @Nullable CharSequence s) { super.insert(dstOffset, s); return this; } @@ -363,8 +363,8 @@ public StringBuilder insert( int dstOffset, @Nullable CharSequence s) { * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int dstOffset, @Nullable CharSequence s, - int start, int end) + public StringBuilder insert(int dstOffset, @Nullable CharSequence s, + int start, int end) { super.insert(dstOffset, s, start, end); return this; @@ -374,7 +374,7 @@ public StringBuilder insert( int dstOffset, @Nullable CharSequence s, * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, boolean b) { + public StringBuilder insert(int offset, boolean b) { super.insert(offset, b); return this; } @@ -383,7 +383,7 @@ public StringBuilder insert( int offset, boolean b) { * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, char c) { + public StringBuilder insert(int offset, char c) { super.insert(offset, c); return this; } @@ -392,7 +392,7 @@ public StringBuilder insert( int offset, char c) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, int i) { + public StringBuilder insert(int offset, int i) { super.insert(offset, i); return this; } @@ -401,7 +401,7 @@ public StringBuilder insert( int offset, int i) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, long l) { + public StringBuilder insert(int offset, long l) { super.insert(offset, l); return this; } @@ -410,7 +410,7 @@ public StringBuilder insert( int offset, long l) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, float f) { + public StringBuilder insert(int offset, float f) { super.insert(offset, f); return this; } @@ -419,32 +419,28 @@ public StringBuilder insert( int offset, float f) { * @throws StringIndexOutOfBoundsException {@inheritDoc} */ @Override - public StringBuilder insert( int offset, double d) { + public StringBuilder insert(int offset, double d) { super.insert(offset, d); return this; } - @Override - public int indexOf(String str) { + public int indexOf(String str) { return super.indexOf(str); } - @Override - public int indexOf(String str, int fromIndex) { + public int indexOf(String str, int fromIndex) { return super.indexOf(str, fromIndex); } - @Override - public int lastIndexOf(String str) { + public int lastIndexOf(String str) { return super.lastIndexOf(str); } - @Override - public int lastIndexOf(String str, int fromIndex) { + public int lastIndexOf(String str, int fromIndex) { return super.lastIndexOf(str, fromIndex); } diff --git a/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java b/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java index 8f351c6e3ea..40c40ebba16 100644 --- a/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java +++ b/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java @@ -46,7 +46,6 @@ public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException { * Constructs a {@code StringIndexOutOfBoundsException} with no detail * message. */ - public StringIndexOutOfBoundsException() { super(); } @@ -57,7 +56,6 @@ public StringIndexOutOfBoundsException() { * * @param s the detail message. */ - public StringIndexOutOfBoundsException(@Nullable String s) { super(s); } @@ -71,7 +69,6 @@ public StringIndexOutOfBoundsException(@Nullable String s) { * * @param index the illegal index. */ - public StringIndexOutOfBoundsException(int index) { super("String index out of range: " + index); } diff --git a/src/java.base/share/classes/java/lang/SuppressWarnings.java b/src/java.base/share/classes/java/lang/SuppressWarnings.java index e4ffe25bcf4..f43fb6cf28b 100644 --- a/src/java.base/share/classes/java/lang/SuppressWarnings.java +++ b/src/java.base/share/classes/java/lang/SuppressWarnings.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java index 439433aee17..c79c3703e55 100644 --- a/src/java.base/share/classes/java/lang/System.java +++ b/src/java.base/share/classes/java/lang/System.java @@ -102,7 +102,7 @@ * @since 1.0 */ @NullMarked -public final class System { +public final class System { /* Register the natives via the static initializer. * * The VM will invoke the initPhase1 method to complete the initialization @@ -757,7 +757,6 @@ public static void setProperties(@Nullable Properties props) { * @see #setProperty * @see java.lang.System#getProperties() */ - public static @Nullable String getProperty(String key) { checkKey(key); return props.getProperty(key); @@ -780,7 +779,6 @@ public static void setProperties(@Nullable Properties props) { * @see #setProperty * @see java.lang.System#getProperties() */ - public static @Nullable String getProperty(String key, @Nullable String def) { checkKey(key); return props.getProperty(key, def); @@ -1557,7 +1555,6 @@ public static Logger getLogger(String name, ResourceBundle bundle) { * @param status exit status. * @see java.lang.Runtime#exit(int) */ - public static void exit(int status) { Runtime.getRuntime().exit(status); } diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index 1df78ac8566..3308685899b 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -1713,7 +1713,6 @@ public static boolean interrupted() { * @see ##thread-interruption Thread Interruption * @see #interrupt() */ - public boolean isInterrupted() { return interrupted; } @@ -2124,7 +2123,6 @@ void daemon(boolean on) { * {@code false} otherwise. * @see #setDaemon(boolean) */ - public final boolean isDaemon() { if (isVirtual()) { return true; @@ -2153,8 +2151,6 @@ public final void checkAccess() { } * * @return a string representation of this thread. */ - @Override - public String toString() { StringBuilder sb = new StringBuilder("Thread[#"); sb.append(threadId()); @@ -2221,8 +2217,6 @@ public void setContextClassLoader(@Nullable ClassLoader cl) { * the specified object. * @since 1.4 */ - - public static native boolean holdsLock(Object obj); private static final StackTraceElement[] EMPTY_STACK_TRACE diff --git a/src/java.base/share/classes/java/lang/ThreadGroup.java b/src/java.base/share/classes/java/lang/ThreadGroup.java index 91717df9aba..7c3a562281c 100644 --- a/src/java.base/share/classes/java/lang/ThreadGroup.java +++ b/src/java.base/share/classes/java/lang/ThreadGroup.java @@ -255,8 +255,6 @@ public final void setDaemon(boolean daemon) { * @param pri the new priority of the thread group. * @see #getMaxPriority */ - - @SuppressWarnings("index:array.access.unsafe.high") public final void setMaxPriority(int pri) { if (pri >= Thread.MIN_PRIORITY && pri <= Thread.MAX_PRIORITY) { synchronized (this) { @@ -487,8 +485,6 @@ private int enumerate(ThreadGroup[] list, int i, boolean recurse) { * @see java.lang.Thread#interrupt() * @since 1.2 */ - - @SuppressWarnings("index:array.access.unsafe.high") public final void interrupt() { for (Thread thread : Thread.getAllThreads()) { ThreadGroup g = thread.getThreadGroup(); @@ -501,14 +497,20 @@ public final void interrupt() { /** * Does nothing. * + * @deprecated This method was originally specified to destroy an empty + * thread group. The ability to explicitly destroy a thread group + * no longer exists. A thread group is eligible to be GC'ed when + * there are no live threads in the group and it is otherwise + * unreachable. + */ + @Deprecated(since="16", forRemoval=true) + public final void destroy() { } /** * Prints information about this thread group to the standard * output. This method is useful only for debugging. */ - - @SuppressWarnings("index:array.access.unsafe.high") public void list() { Map> map = new HashMap<>(); for (Thread thread : Thread.getAllThreads()) { @@ -588,7 +590,6 @@ public void uncaughtException(Thread t, Throwable e) { * * @return a string representation of this thread group. */ - public String toString() { return getClass().getName() + "[name=" + getName() diff --git a/src/java.base/share/classes/java/lang/Throwable.java b/src/java.base/share/classes/java/lang/Throwable.java index 60250de5dd3..7571bd6db2e 100644 --- a/src/java.base/share/classes/java/lang/Throwable.java +++ b/src/java.base/share/classes/java/lang/Throwable.java @@ -115,7 +115,7 @@ * @since 1.0 */ @NullMarked -public class Throwable implements Serializable { +public class Throwable implements Serializable { /** use serialVersionUID from JDK 1.0.2 for interoperability */ @java.io.Serial private static final long serialVersionUID = -3042686055658047285L; @@ -409,7 +409,6 @@ protected Throwable(@Nullable String message, @Nullable Throwable cause, * @return the detail message string of this {@code Throwable} instance * (which may be {@code null}). */ - public @Nullable String getMessage() { return detailMessage; } @@ -424,7 +423,6 @@ protected Throwable(@Nullable String message, @Nullable Throwable cause, * @return The localized description of this throwable. * @since 1.1 */ - public @Nullable String getLocalizedMessage() { return getMessage(); } @@ -449,7 +447,6 @@ protected Throwable(@Nullable String message, @Nullable Throwable cause, * cause is nonexistent or unknown. * @since 1.4 */ - public synchronized @Nullable Throwable getCause() { return (cause==this ? null : cause); } @@ -490,7 +487,7 @@ protected Throwable(@Nullable String message, @Nullable Throwable cause, * been called on this throwable. * @since 1.4 */ - public synchronized Throwable initCause(@Nullable Throwable cause) { + public synchronized Throwable initCause(@Nullable Throwable cause) { if (this.cause != this) throw new IllegalStateException("Can't overwrite cause with " + Objects.toString(cause, "a null"), this); @@ -524,7 +521,6 @@ final void setCause(Throwable t) { * * @return a string representation of this throwable. */ - public String toString() { String s = getClass().getName(); String message = getLocalizedMessage(); diff --git a/src/java.base/share/classes/java/lang/TypeNotPresentException.java b/src/java.base/share/classes/java/lang/TypeNotPresentException.java index 30f64ab587b..c078428d865 100644 --- a/src/java.base/share/classes/java/lang/TypeNotPresentException.java +++ b/src/java.base/share/classes/java/lang/TypeNotPresentException.java @@ -64,8 +64,7 @@ public class TypeNotPresentException extends RuntimeException { * @param cause the exception that was thrown when the system attempted to * load the named type, or {@code null} if unavailable or inapplicable */ - - public TypeNotPresentException( String typeName, @Nullable Throwable cause) { + public TypeNotPresentException(String typeName, @Nullable Throwable cause) { super("Type " + typeName + " not present", cause); this.typeName = typeName; } @@ -75,5 +74,5 @@ public TypeNotPresentException( String typeName, @Nullable Throwable cause) { * * @return the fully qualified name of the unavailable type or type variable name */ - public String typeName() { return typeName;} + public String typeName() { return typeName;} } diff --git a/src/java.base/share/classes/java/lang/UnknownError.java b/src/java.base/share/classes/java/lang/UnknownError.java index c77ae36aa0d..a6e9bee7874 100644 --- a/src/java.base/share/classes/java/lang/UnknownError.java +++ b/src/java.base/share/classes/java/lang/UnknownError.java @@ -42,7 +42,6 @@ public class UnknownError extends VirtualMachineError { /** * Constructs an {@code UnknownError} with no detail message. */ - public UnknownError() { super(); } @@ -53,7 +52,6 @@ public UnknownError() { * * @param s the detail message. */ - public UnknownError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/UnsatisfiedLinkError.java b/src/java.base/share/classes/java/lang/UnsatisfiedLinkError.java index 2c66859771d..7eb04a7f46c 100644 --- a/src/java.base/share/classes/java/lang/UnsatisfiedLinkError.java +++ b/src/java.base/share/classes/java/lang/UnsatisfiedLinkError.java @@ -43,7 +43,6 @@ public class UnsatisfiedLinkError extends LinkageError { /** * Constructs an {@code UnsatisfiedLinkError} with no detail message. */ - public UnsatisfiedLinkError() { super(); } @@ -54,7 +53,6 @@ public UnsatisfiedLinkError() { * * @param s the detail message. */ - public UnsatisfiedLinkError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/UnsupportedClassVersionError.java b/src/java.base/share/classes/java/lang/UnsupportedClassVersionError.java index aa5f8e9238a..0084920215c 100644 --- a/src/java.base/share/classes/java/lang/UnsupportedClassVersionError.java +++ b/src/java.base/share/classes/java/lang/UnsupportedClassVersionError.java @@ -44,7 +44,6 @@ public class UnsupportedClassVersionError extends ClassFormatError { * Constructs a {@code UnsupportedClassVersionError} * with no detail message. */ - public UnsupportedClassVersionError() { super(); } @@ -55,7 +54,6 @@ public UnsupportedClassVersionError() { * * @param s the detail message. */ - public UnsupportedClassVersionError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/UnsupportedOperationException.java b/src/java.base/share/classes/java/lang/UnsupportedOperationException.java index 359eddd5ecd..7bc51b8cdf4 100644 --- a/src/java.base/share/classes/java/lang/UnsupportedOperationException.java +++ b/src/java.base/share/classes/java/lang/UnsupportedOperationException.java @@ -45,7 +45,6 @@ public class UnsupportedOperationException extends RuntimeException { * as its detail message. The cause is not initialized, and may subsequently * be initialized by a call to {@link #initCause(Throwable)}. */ - public UnsupportedOperationException() { } @@ -56,7 +55,6 @@ public UnsupportedOperationException() { * * @param message the detail message */ - public UnsupportedOperationException(@Nullable String message) { super(message); } @@ -77,7 +75,6 @@ public UnsupportedOperationException(@Nullable String message) { * unknown.) * @since 1.5 */ - public UnsupportedOperationException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -97,7 +94,6 @@ public UnsupportedOperationException(@Nullable String message, @Nullable Throwab * unknown.) * @since 1.5 */ - public UnsupportedOperationException(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/lang/VerifyError.java b/src/java.base/share/classes/java/lang/VerifyError.java index 290db3838ac..e6a2c2d06f4 100644 --- a/src/java.base/share/classes/java/lang/VerifyError.java +++ b/src/java.base/share/classes/java/lang/VerifyError.java @@ -43,7 +43,6 @@ public class VerifyError extends LinkageError { /** * Constructs an {@code VerifyError} with no detail message. */ - public VerifyError() { super(); } @@ -53,7 +52,6 @@ public VerifyError() { * * @param s the detail message. */ - public VerifyError(@Nullable String s) { super(s); } diff --git a/src/java.base/share/classes/java/lang/VirtualMachineError.java b/src/java.base/share/classes/java/lang/VirtualMachineError.java index b7d2f6cecff..034216f773d 100644 --- a/src/java.base/share/classes/java/lang/VirtualMachineError.java +++ b/src/java.base/share/classes/java/lang/VirtualMachineError.java @@ -44,7 +44,6 @@ public abstract class VirtualMachineError extends Error { /** * Constructs a {@code VirtualMachineError} with no detail message. */ - public VirtualMachineError() { super(); } @@ -55,7 +54,6 @@ public VirtualMachineError() { * * @param message the detail message. */ - public VirtualMachineError(@Nullable String message) { super(message); } @@ -74,7 +72,6 @@ public VirtualMachineError(@Nullable String message) { * unknown.) * @since 1.8 */ - public VirtualMachineError(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -91,7 +88,6 @@ public VirtualMachineError(@Nullable String message, @Nullable Throwable cause) * unknown.) * @since 1.8 */ - public VirtualMachineError(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/lang/Void.java b/src/java.base/share/classes/java/lang/Void.java index 7725638e214..fcea1321f66 100644 --- a/src/java.base/share/classes/java/lang/Void.java +++ b/src/java.base/share/classes/java/lang/Void.java @@ -26,7 +26,6 @@ package java.lang; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * The {@code Void} class is an uninstantiable placeholder class to hold a @@ -37,7 +36,7 @@ */ @NullMarked public final - class Void { +class Void { /** * The {@code Class} object representing the pseudo-type corresponding to diff --git a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java index 245f8159947..2dd4127e5ca 100644 --- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java +++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java @@ -2310,8 +2310,6 @@ public int compareTo(ModuleDescriptor that) { * descriptor that is equal to this module descriptor */ @Override - - public boolean equals(@Nullable Object ob) { if (ob == this) return true; diff --git a/src/java.base/share/classes/java/lang/ref/Cleaner.java b/src/java.base/share/classes/java/lang/ref/Cleaner.java index 6ac2630a393..db4cc8adb67 100644 --- a/src/java.base/share/classes/java/lang/ref/Cleaner.java +++ b/src/java.base/share/classes/java/lang/ref/Cleaner.java @@ -31,7 +31,6 @@ import java.util.concurrent.ThreadFactory; import java.util.function.Function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * {@code Cleaner} manages a set of object references and corresponding cleaning actions. diff --git a/src/java.base/share/classes/java/lang/ref/PhantomReference.java b/src/java.base/share/classes/java/lang/ref/PhantomReference.java index edb338fd052..08aec11a595 100644 --- a/src/java.base/share/classes/java/lang/ref/PhantomReference.java +++ b/src/java.base/share/classes/java/lang/ref/PhantomReference.java @@ -73,7 +73,6 @@ public non-sealed class PhantomReference<@jdk.internal.RequiresIdentity T> exten * * @return {@code null} */ - public @Nullable T get() { return null; } diff --git a/src/java.base/share/classes/java/lang/ref/Reference.java b/src/java.base/share/classes/java/lang/ref/Reference.java index 297add8af39..d8dc1fe332f 100644 --- a/src/java.base/share/classes/java/lang/ref/Reference.java +++ b/src/java.base/share/classes/java/lang/ref/Reference.java @@ -28,7 +28,6 @@ import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; -import jdk.internal.vm.annotation.AOTRuntimeSetup; import jdk.internal.vm.annotation.AOTSafeClassInitializer; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.IntrinsicCandidate; @@ -212,7 +211,6 @@ private static class ReferenceHandler extends Thread { super(g, null, name, 0, false); } - @SuppressWarnings({"unchecked"}) public void run() { while (true) { processPendingReferences(); @@ -544,7 +542,6 @@ protected Object clone() throws CloneNotSupportedException { this(referent, null); } - @SuppressWarnings({"unchecked"}) Reference(T referent, ReferenceQueue queue) { if (referent != null) { Objects.requireIdentity(referent); diff --git a/src/java.base/share/classes/java/lang/ref/SoftReference.java b/src/java.base/share/classes/java/lang/ref/SoftReference.java index 55fdd952d67..7145c9468dc 100644 --- a/src/java.base/share/classes/java/lang/ref/SoftReference.java +++ b/src/java.base/share/classes/java/lang/ref/SoftReference.java @@ -125,7 +125,6 @@ public SoftReference(@jdk.internal.RequiresIdentity @Nullable T referent, @Nulla * @return The object to which this reference refers, or * {@code null} if this reference object has been cleared */ - public @Nullable T get() { T o = super.get(); if (o != null && this.timestamp != clock) diff --git a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java index 65d474afa76..c0ea09f8ada 100644 --- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java +++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java @@ -426,7 +426,6 @@ public boolean isAccessible() { * @see #setAccessible(boolean) */ @CallerSensitive - public final boolean canAccess(@Nullable Object obj) { if (!Member.class.isInstance(this)) { return override; diff --git a/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java b/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java index ddbb6e4886c..83726ca5d83 100644 --- a/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java +++ b/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java @@ -291,7 +291,6 @@ public interface AnnotatedElement { * type is present on this element, else false * @throws NullPointerException if the given annotation class is null */ - default boolean isAnnotationPresent(Class annotationClass) { return getAnnotation(annotationClass) != null; } diff --git a/src/java.base/share/classes/java/lang/reflect/Constructor.java b/src/java.base/share/classes/java/lang/reflect/Constructor.java index 1fba64fd188..41f28aa44c1 100644 --- a/src/java.base/share/classes/java/lang/reflect/Constructor.java +++ b/src/java.base/share/classes/java/lang/reflect/Constructor.java @@ -67,9 +67,7 @@ * @author Nakul Saraiya * @since 1.1 */ - @NullMarked - public final class Constructor extends Executable { private final Class clazz; private final int slot; @@ -331,7 +329,6 @@ public boolean equals(@Nullable Object obj) { * the same as the hashcode for the underlying constructor's * declaring class name. */ - public int hashCode() { return getDeclaringClass().getName().hashCode(); } @@ -360,7 +357,6 @@ public int hashCode() { * @jls 8.8.3 Constructor Modifiers * @jls 8.9.2 Enum Body Declarations */ - public String toString() { return sharedToString(parameterTypes, exceptionTypes); @@ -486,7 +482,7 @@ void specificToGenericStringHeader(StringBuilder sb) { */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public T newInstance(@Nullable Object @Nullable ... initargs) + public T newInstance(@Nullable Object @Nullable ... initargs) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { @@ -516,7 +512,6 @@ T newInstanceWithCaller(Object[] args, boolean checkAccess, Class caller) * @since 1.5 * @jls 8.4.1 Formal Parameters */ - @Override public boolean isVarArgs() { return super.isVarArgs(); @@ -531,7 +526,6 @@ public boolean isVarArgs() { * href="{@docRoot}/java.base/java/lang/reflect/package-summary.html#LanguageJvmModel">Java * programming language and JVM modeling in core reflection */ - @Override public boolean isSynthetic() { return super.isSynthetic(); diff --git a/src/java.base/share/classes/java/lang/reflect/Field.java b/src/java.base/share/classes/java/lang/reflect/Field.java index dac8e8239fe..296fcea8ba8 100644 --- a/src/java.base/share/classes/java/lang/reflect/Field.java +++ b/src/java.base/share/classes/java/lang/reflect/Field.java @@ -77,7 +77,6 @@ * @author Nakul Saraiya * @since 1.1 */ - @NullMarked public final class Field extends AccessibleObject implements Member { @@ -220,7 +219,6 @@ void checkCanSetAccessible(Class caller) { * Returns the {@code Class} object representing the class or interface * that declares the field represented by this {@code Field} object. */ - @Override public Class getDeclaringClass() { return clazz; @@ -229,8 +227,7 @@ public Class getDeclaringClass() { /** * Returns the name of the field represented by this {@code Field} object. */ - - public String getName() { + public String getName() { return name; } @@ -244,7 +241,6 @@ public String getName() { * @jls 8.3 Field Declarations * @jls 9.3 Field (Constant) Declarations */ - public int getModifiers() { return modifiers; } @@ -270,7 +266,6 @@ public Set accessFlags() { * @since 1.5 * @jls 8.9.1 Enum Constants */ - public boolean isEnumConstant() { return (getModifiers() & Modifier.ENUM) != 0; } @@ -286,7 +281,6 @@ public boolean isEnumConstant() { * href="{@docRoot}/java.base/java/lang/reflect/package-summary.html#LanguageJvmModel">Java * programming language and JVM modeling in core reflection */ - public boolean isSynthetic() { return Modifier.isSynthetic(getModifiers()); } @@ -320,7 +314,6 @@ public boolean isStrictInit() { * @return a {@code Class} object identifying the declared * type of the field represented by this object */ - public Class getType() { return type; } @@ -349,7 +342,6 @@ public Class getType() { * that cannot be instantiated for any reason * @since 1.5 */ - public Type getGenericType() { if (getGenericSignature() != null) return getGenericInfo().getGenericType(); @@ -378,7 +370,6 @@ public boolean equals(@Nullable Object obj) { * exclusive-or of the hashcodes for the underlying field's * declaring class name and its name. */ - public int hashCode() { return getDeclaringClass().getName().hashCode() ^ getName().hashCode(); } @@ -404,7 +395,6 @@ public int hashCode() { * @return a string describing this {@code Field} * @jls 8.3.1 Field Modifiers */ - public String toString() { return modifierPrefix() + getType().getTypeName() + " " @@ -451,7 +441,6 @@ String toShortString() { * @since 1.5 * @jls 8.3.1 Field Modifiers */ - public String toGenericString() { Type fieldType = getGenericType(); return modifierPrefix() @@ -511,10 +500,9 @@ public String toGenericString() { * the field is a {@linkplain #isStrictInit() strictly-initialized} * static field that has not been initialized. */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public @Nullable Object get( @Nullable Object obj) + public @Nullable Object get(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -552,10 +540,9 @@ public String toGenericString() { * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public boolean getBoolean( @Nullable Object obj) + public boolean getBoolean(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -593,10 +580,9 @@ public boolean getBoolean( @Nullable Object obj) * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public byte getByte( @Nullable Object obj) + public byte getByte(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -636,10 +622,9 @@ public byte getByte( @Nullable Object obj) * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public char getChar( @Nullable Object obj) + public char getChar(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -679,10 +664,9 @@ public char getChar( @Nullable Object obj) * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public short getShort( @Nullable Object obj) + public short getShort(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -722,10 +706,9 @@ public short getShort( @Nullable Object obj) * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public int getInt( @Nullable Object obj) + public int getInt(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -765,10 +748,9 @@ public int getInt( @Nullable Object obj) * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public long getLong( @Nullable Object obj) + public long getLong(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -808,10 +790,9 @@ public long getLong( @Nullable Object obj) * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public float getFloat( @Nullable Object obj) + public float getFloat(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -851,10 +832,9 @@ public float getFloat( @Nullable Object obj) * static field that has not been initialized. * @see Field#get */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public double getDouble( @Nullable Object obj) + public double getDouble(@Nullable Object obj) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -993,8 +973,7 @@ public double getDouble( @Nullable Object obj) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void set( @Nullable Object obj, - @Nullable Object value) + public void set(@Nullable Object obj, @Nullable Object value) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1039,7 +1018,7 @@ public void set( @Nullable Object obj, */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setBoolean( @Nullable Object obj, boolean z) + public void setBoolean(@Nullable Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1084,7 +1063,7 @@ public void setBoolean( @Nullable Object obj, boolean z) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setByte( @Nullable Object obj, byte b) + public void setByte(@Nullable Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1129,7 +1108,7 @@ public void setByte( @Nullable Object obj, byte b) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setChar( @Nullable Object obj, char c) + public void setChar(@Nullable Object obj, char c) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1174,7 +1153,7 @@ public void setChar( @Nullable Object obj, char c) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setShort( @Nullable Object obj, short s) + public void setShort(@Nullable Object obj, short s) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1219,7 +1198,7 @@ public void setShort( @Nullable Object obj, short s) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setInt( @Nullable Object obj, int i) + public void setInt(@Nullable Object obj, int i) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1264,7 +1243,7 @@ public void setInt( @Nullable Object obj, int i) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setLong( @Nullable Object obj, long l) + public void setLong(@Nullable Object obj, long l) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1309,7 +1288,7 @@ public void setLong( @Nullable Object obj, long l) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setFloat( @Nullable Object obj, float f) + public void setFloat(@Nullable Object obj, float f) throws IllegalArgumentException, IllegalAccessException { if (!override) { @@ -1354,7 +1333,7 @@ public void setFloat( @Nullable Object obj, float f) */ @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization - public void setDouble( @Nullable Object obj, double d) + public void setDouble(@Nullable Object obj, double d) throws IllegalArgumentException, IllegalAccessException { if (!override) { diff --git a/src/java.base/share/classes/java/lang/reflect/GenericDeclaration.java b/src/java.base/share/classes/java/lang/reflect/GenericDeclaration.java index d3628f717c8..382d7235986 100644 --- a/src/java.base/share/classes/java/lang/reflect/GenericDeclaration.java +++ b/src/java.base/share/classes/java/lang/reflect/GenericDeclaration.java @@ -26,7 +26,6 @@ package java.lang.reflect; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * A common interface for all entities that declare type variables. diff --git a/src/java.base/share/classes/java/lang/reflect/InvocationHandler.java b/src/java.base/share/classes/java/lang/reflect/InvocationHandler.java index a7b83f4c0c4..48659bfc27b 100644 --- a/src/java.base/share/classes/java/lang/reflect/InvocationHandler.java +++ b/src/java.base/share/classes/java/lang/reflect/InvocationHandler.java @@ -97,7 +97,7 @@ public interface InvocationHandler { * * @see UndeclaredThrowableException */ - public @Nullable Object invoke(Object proxy, Method method, @Nullable Object @Nullable[] args) + public @Nullable Object invoke(Object proxy, Method method, @Nullable Object @Nullable [] args) throws Throwable; /** diff --git a/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java b/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java index 52e59bb5aaa..26094308483 100644 --- a/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java +++ b/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java @@ -68,7 +68,6 @@ protected InvocationTargetException() { * * @param target the target exception, may be {@code null} */ - public InvocationTargetException(@Nullable Throwable target) { super((Throwable)null); // Disallow initCause this.target = target; @@ -81,7 +80,6 @@ public InvocationTargetException(@Nullable Throwable target) { * @param target the target exception, may be {@code null} * @param s the detail message, may be {@code null} */ - public InvocationTargetException(@Nullable Throwable target, @Nullable String s) { super(s, null); // Disallow initCause this.target = target; diff --git a/src/java.base/share/classes/java/lang/reflect/Method.java b/src/java.base/share/classes/java/lang/reflect/Method.java index 2eef5636f8c..afbdd4078e8 100644 --- a/src/java.base/share/classes/java/lang/reflect/Method.java +++ b/src/java.base/share/classes/java/lang/reflect/Method.java @@ -73,7 +73,6 @@ * @since 1.1 */ @NullMarked -@SuppressWarnings({"rawtypes"}) public final class Method extends Executable { private final Class clazz; private final int slot; @@ -216,7 +215,7 @@ public Class getDeclaringClass() { * object, as a {@code String}. */ @Override - public String getName() { + public String getName() { return name; } @@ -250,7 +249,6 @@ public TypeVariable[] getTypeParameters() { * * @return the return type for the method this object represents */ - public Class getReturnType() { return returnType; } @@ -279,7 +277,6 @@ public Class getReturnType() { * type that cannot be instantiated for any reason * @since 1.5 */ - public Type getGenericReturnType() { if (getGenericSignature() != null) { return getGenericInfo().getReturnType(); @@ -366,7 +363,6 @@ public boolean equals(@Nullable Object obj) { * as the exclusive-or of the hashcodes for the underlying * method's declaring class name and the method's name. */ - public int hashCode() { int hc = hash; @@ -405,7 +401,6 @@ public int hashCode() { * @jls 9.4 Method Declarations * @jls 9.6.1 Annotation Interface Elements */ - public String toString() { return sharedToString(parameterTypes, exceptionTypes); @@ -564,7 +559,6 @@ void specificToGenericStringHeader(StringBuilder sb) { * @throws ExceptionInInitializerError if the initialization * provoked by this method fails. */ - @CallerSensitive @ForceInline // to ensure Reflection.getCallerClass optimization @IntrinsicCandidate @@ -676,7 +670,6 @@ private boolean isCallerSensitive() { * href="{@docRoot}/java.base/java/lang/reflect/package-summary.html#LanguageJvmModel">Java * programming language and JVM modeling in core reflection */ - public boolean isBridge() { return (getModifiers() & Modifier.BRIDGE) != 0; } @@ -686,7 +679,6 @@ public boolean isBridge() { * @since 1.5 * @jls 8.4.1 Formal Parameters */ - @Override public boolean isVarArgs() { return super.isVarArgs(); @@ -701,7 +693,6 @@ public boolean isVarArgs() { * programming language and JVM modeling in core reflection * @since 1.5 */ - @Override public boolean isSynthetic() { return super.isSynthetic(); diff --git a/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java b/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java index 22ed8d58977..74ac9f3632d 100644 --- a/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java +++ b/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java @@ -67,7 +67,7 @@ public interface ParameterizedType extends Type { * be instantiated for any reason * @since 1.5 */ - Type [] getActualTypeArguments(); + Type[] getActualTypeArguments(); /** * {@return the {@code Type} object representing the class or interface @@ -81,7 +81,7 @@ public interface ParameterizedType extends Type { * * @since 1.5 */ - Type getRawType(); + Type getRawType(); /** * Returns a {@code Type} object representing the type that this type diff --git a/src/java.base/share/classes/java/math/BigDecimal.java b/src/java.base/share/classes/java/math/BigDecimal.java index 8c738af69dd..bb13c857b94 100644 --- a/src/java.base/share/classes/java/math/BigDecimal.java +++ b/src/java.base/share/classes/java/math/BigDecimal.java @@ -3740,7 +3740,7 @@ public static void check(BigDecimal num) { * @jls 5.1.3 Narrowing Primitive Conversion */ @Override - public int intValue() { + public int intValue() { return (intCompact != INFLATED && scale == 0) ? (int)intCompact : (int)longValue(); diff --git a/src/java.base/share/classes/java/math/BigInteger.java b/src/java.base/share/classes/java/math/BigInteger.java index 604a25d66f0..5e44d852f78 100644 --- a/src/java.base/share/classes/java/math/BigInteger.java +++ b/src/java.base/share/classes/java/math/BigInteger.java @@ -182,7 +182,7 @@ public class BigInteger extends Number implements Comparable { * a signum of 0. This is necessary to ensures that there is exactly one * representation for each BigInteger value. */ - final int signum; + final int signum; /** * The magnitude of this BigInteger, in big-endian order: the @@ -442,7 +442,7 @@ private BigInteger(int[] val) { * negative or greater than or equal to the array length. * @since 9 */ - public BigInteger( int signum, byte[] magnitude, int off, int len) { + public BigInteger(int signum, byte[] magnitude, int off, int len) { if (signum < -1 || signum > 1) { throw(new NumberFormatException("Invalid signum value")); } @@ -481,7 +481,7 @@ public BigInteger( int signum, byte[] magnitude, int off, int len) { * legal values (-1, 0, and 1), or {@code signum} is 0 and * {@code magnitude} contains one or more non-zero bytes. */ - public BigInteger( int signum, byte[] magnitude) { + public BigInteger(int signum, byte[] magnitude) { this(signum, magnitude, 0, magnitude.length); } @@ -527,7 +527,7 @@ private BigInteger(int signum, int[] magnitude) { * outside the range from {@link Character#MIN_RADIX} to * {@link Character#MAX_RADIX}, inclusive. */ - public BigInteger(String val, int radix) { + public BigInteger(String val, int radix) { int cursor = 0, numDigits; final int len = val.length(); @@ -1187,7 +1187,7 @@ private boolean passesMillerRabin(int iterations, Random rnd) { * with the arguments reversed in two ways: it assumes that its * arguments are correct, and it doesn't copy the magnitude array. */ - BigInteger(int[] magnitude, int signum) { + BigInteger(int[] magnitude, int signum) { this.signum = (magnitude.length == 0 ? 0 : signum); this.mag = magnitude; if (mag.length >= MAX_MAG_LENGTH) { @@ -1200,7 +1200,7 @@ private boolean passesMillerRabin(int iterations, Random rnd) { * arguments are correct. The {@code magnitude} array is assumed to be * unchanged for the duration of the constructor call. */ - private BigInteger(byte[] magnitude, int signum) { + private BigInteger(byte[] magnitude, int signum) { this.signum = (magnitude.length == 0 ? 0 : signum); this.mag = stripLeadingZeroBytes(magnitude, 0, magnitude.length); if (mag.length >= MAX_MAG_LENGTH) { @@ -2943,7 +2943,7 @@ public BigInteger negate() { * @return -1, 0 or 1 as the value of this BigInteger is negative, zero or * positive. */ - public int signum() { + public int signum() { return this.signum; } @@ -4045,7 +4045,7 @@ public int compareTo(BigInteger val) { * @return -1, 0 or 1 as this magnitude array is less than, equal to or * greater than the magnitude array for the specified BigInteger's. */ - final int compareMagnitude(BigInteger val) { + final int compareMagnitude(BigInteger val) { int[] m1 = mag; int len1 = m1.length; int[] m2 = val.mag; @@ -4064,7 +4064,7 @@ final int compareMagnitude(BigInteger val) { * Version of compareMagnitude that compares magnitude with long value. * val can't be Long.MIN_VALUE. */ - final int compareMagnitude(long val) { + final int compareMagnitude(long val) { assert val != Long.MIN_VALUE; int[] m1 = mag; int len = m1.length; @@ -4178,7 +4178,7 @@ public int hashCode() { * @see Character#forDigit * @see #BigInteger(java.lang.String, int) */ - public String toString( int radix) { + public String toString(int radix) { if (signum == 0) return "0"; if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) @@ -4337,7 +4337,7 @@ private static void toString(BigInteger u, StringBuilder sb, * This could be changed to a more complicated caching method using * {@code Future}. */ - private static BigInteger getRadixConversionCache( int radix, int exponent) { + private static BigInteger getRadixConversionCache(int radix, int exponent) { BigInteger[] cacheLine = powerCache[radix]; // volatile read if (exponent < cacheLine.length) { return cacheLine[exponent]; @@ -4466,7 +4466,7 @@ public long longValue() { * @return this BigInteger converted to a {@code float}. * @jls 5.1.3 Narrowing Primitive Conversion */ - public float floatValue() { + public float floatValue() { if (signum == 0) { return 0.0f; } @@ -4551,7 +4551,7 @@ public float floatValue() { * @return this BigInteger converted to a {@code double}. * @jls 5.1.3 Narrowing Primitive Conversion */ - public double doubleValue() { + public double doubleValue() { if (signum == 0) { return 0.0; } diff --git a/src/java.base/share/classes/java/math/MathContext.java b/src/java.base/share/classes/java/math/MathContext.java index 3f165d7f8df..cd4dd680db3 100644 --- a/src/java.base/share/classes/java/math/MathContext.java +++ b/src/java.base/share/classes/java/math/MathContext.java @@ -56,6 +56,7 @@ * * @since 1.5 */ + @NullMarked public final class MathContext implements Serializable { diff --git a/src/java.base/share/classes/java/net/BindException.java b/src/java.base/share/classes/java/net/BindException.java index 139f44fbb83..d7577331249 100644 --- a/src/java.base/share/classes/java/net/BindException.java +++ b/src/java.base/share/classes/java/net/BindException.java @@ -35,6 +35,7 @@ * * @since 1.1 */ + @NullMarked public class BindException extends SocketException { @java.io.Serial diff --git a/src/java.base/share/classes/java/net/HttpCookie.java b/src/java.base/share/classes/java/net/HttpCookie.java index 2687956b57a..dddfbcea978 100644 --- a/src/java.base/share/classes/java/net/HttpCookie.java +++ b/src/java.base/share/classes/java/net/HttpCookie.java @@ -749,8 +749,6 @@ public String toString() { * otherwise, {@code false} */ @Override - - public boolean equals(@Nullable Object obj) { if (obj == this) return true; diff --git a/src/java.base/share/classes/java/net/Inet4Address.java b/src/java.base/share/classes/java/net/Inet4Address.java index 9320f122b4e..2d8202f3bbb 100644 --- a/src/java.base/share/classes/java/net/Inet4Address.java +++ b/src/java.base/share/classes/java/net/Inet4Address.java @@ -130,7 +130,7 @@ @NullMarked public final - class Inet4Address extends InetAddress { +class Inet4Address extends InetAddress { static final int INADDRSZ = 4; /** use serialVersionUID from InetAddress, but Inet4Address instance diff --git a/src/java.base/share/classes/java/net/Inet6Address.java b/src/java.base/share/classes/java/net/Inet6Address.java index a235e561737..0c86cad9bdb 100644 --- a/src/java.base/share/classes/java/net/Inet6Address.java +++ b/src/java.base/share/classes/java/net/Inet6Address.java @@ -202,7 +202,7 @@ @NullMarked public final - class Inet6Address extends InetAddress { +class Inet6Address extends InetAddress { static final int INADDRSZ = 16; private static class Inet6AddressHolder { diff --git a/src/java.base/share/classes/java/net/InetAddress.java b/src/java.base/share/classes/java/net/InetAddress.java index 97d86e19cab..27b77e3fe22 100644 --- a/src/java.base/share/classes/java/net/InetAddress.java +++ b/src/java.base/share/classes/java/net/InetAddress.java @@ -864,8 +864,6 @@ public int hashCode() { * {@code false} otherwise. * @see java.net.InetAddress#getAddress() */ - - public boolean equals(@Nullable Object obj) { return false; } diff --git a/src/java.base/share/classes/java/net/PortUnreachableException.java b/src/java.base/share/classes/java/net/PortUnreachableException.java index afdd47af207..cabfb7fe61e 100644 --- a/src/java.base/share/classes/java/net/PortUnreachableException.java +++ b/src/java.base/share/classes/java/net/PortUnreachableException.java @@ -34,6 +34,7 @@ * * @since 1.4 */ + @NullMarked public class PortUnreachableException extends SocketException { @java.io.Serial diff --git a/src/java.base/share/classes/java/net/SocketOption.java b/src/java.base/share/classes/java/net/SocketOption.java index ea5975a6e00..41e31bb2035 100644 --- a/src/java.base/share/classes/java/net/SocketOption.java +++ b/src/java.base/share/classes/java/net/SocketOption.java @@ -44,6 +44,7 @@ * * @see StandardSocketOptions */ + @NullMarked public interface SocketOption { diff --git a/src/java.base/share/classes/java/net/SocketPermission.java b/src/java.base/share/classes/java/net/SocketPermission.java index 5635226d108..259c6b27bf0 100644 --- a/src/java.base/share/classes/java/net/SocketPermission.java +++ b/src/java.base/share/classes/java/net/SocketPermission.java @@ -1002,8 +1002,6 @@ private boolean compareHostnames(SocketPermission that) { * in the comparison if obj only contains the action, 'resolve'. */ @Override - - public boolean equals(@Nullable Object obj) { if (obj == this) return true; diff --git a/src/java.base/share/classes/java/net/SocketTimeoutException.java b/src/java.base/share/classes/java/net/SocketTimeoutException.java index 48cea30928a..47b800a1af9 100644 --- a/src/java.base/share/classes/java/net/SocketTimeoutException.java +++ b/src/java.base/share/classes/java/net/SocketTimeoutException.java @@ -33,6 +33,7 @@ * * @since 1.4 */ + @NullMarked public class SocketTimeoutException extends java.io.InterruptedIOException { @java.io.Serial diff --git a/src/java.base/share/classes/java/net/URI.java b/src/java.base/share/classes/java/net/URI.java index 2b4bd9b001b..2c8bacfbcbb 100644 --- a/src/java.base/share/classes/java/net/URI.java +++ b/src/java.base/share/classes/java/net/URI.java @@ -1546,8 +1546,6 @@ public int getPort() { * @return {@code true} if, and only if, the given object is a URI that * is identical to this URI */ - - public boolean equals(@Nullable Object ob) { if (ob == this) return true; diff --git a/src/java.base/share/classes/java/net/URISyntaxException.java b/src/java.base/share/classes/java/net/URISyntaxException.java index e9a6645c476..beb808a8881 100644 --- a/src/java.base/share/classes/java/net/URISyntaxException.java +++ b/src/java.base/share/classes/java/net/URISyntaxException.java @@ -35,6 +35,7 @@ * @see URI * @since 1.4 */ + @NullMarked public class URISyntaxException extends Exception diff --git a/src/java.base/share/classes/java/net/URL.java b/src/java.base/share/classes/java/net/URL.java index f46c475398e..8bbe61b3c88 100644 --- a/src/java.base/share/classes/java/net/URL.java +++ b/src/java.base/share/classes/java/net/URL.java @@ -1300,7 +1300,7 @@ public final Object getContent() throws java.io.IOException { /** * The URLStreamHandler factory. */ - private static volatile URLStreamHandlerFactory factory; + private static volatile URLStreamHandlerFactory factory; /** * Sets an application's {@code URLStreamHandlerFactory}. diff --git a/src/java.base/share/classes/java/net/URLDecoder.java b/src/java.base/share/classes/java/net/URLDecoder.java index b1d5d8ecd21..7460e047748 100644 --- a/src/java.base/share/classes/java/net/URLDecoder.java +++ b/src/java.base/share/classes/java/net/URLDecoder.java @@ -82,6 +82,7 @@ * @author Michael McCloskey * @since 1.2 */ + @NullMarked public final class URLDecoder { diff --git a/src/java.base/share/classes/java/nio/ByteOrder.java b/src/java.base/share/classes/java/nio/ByteOrder.java index a7a3641e122..461f0e6e3dc 100644 --- a/src/java.base/share/classes/java/nio/ByteOrder.java +++ b/src/java.base/share/classes/java/nio/ByteOrder.java @@ -26,7 +26,6 @@ package java.nio; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import jdk.internal.misc.Unsafe; diff --git a/src/java.base/share/classes/java/nio/channels/FileChannel.java b/src/java.base/share/classes/java/nio/channels/FileChannel.java index 8bb54a6551f..ea1b5cacab3 100644 --- a/src/java.base/share/classes/java/nio/channels/FileChannel.java +++ b/src/java.base/share/classes/java/nio/channels/FileChannel.java @@ -372,7 +372,7 @@ public static FileChannel open(Path path, OpenOption... options) * @throws ClosedByInterruptException {@inheritDoc} * @throws NonReadableChannelException {@inheritDoc} */ - public abstract int read(ByteBuffer dst) throws IOException; + public abstract int read(ByteBuffer dst) throws IOException; /** * Reads a sequence of bytes from this channel into a subsequence of the @@ -388,7 +388,7 @@ public static FileChannel open(Path path, OpenOption... options) * @throws ClosedByInterruptException {@inheritDoc} * @throws NonReadableChannelException {@inheritDoc} */ - public abstract long read(ByteBuffer[] dsts, int offset, int length) + public abstract long read(ByteBuffer[] dsts, int offset, int length) throws IOException; /** @@ -404,7 +404,7 @@ public abstract long read(ByteBuffer[] dsts, int offset, int length) * @throws ClosedByInterruptException {@inheritDoc} * @throws NonReadableChannelException {@inheritDoc} */ - public final long read(ByteBuffer[] dsts) throws IOException { + public final long read(ByteBuffer[] dsts) throws IOException { return read(dsts, 0, dsts.length); } @@ -424,7 +424,7 @@ public final long read(ByteBuffer[] dsts) throws IOException { * @throws ClosedByInterruptException {@inheritDoc} * @throws NonWritableChannelException {@inheritDoc} */ - public abstract int write(ByteBuffer src) throws IOException; + public abstract int write(ByteBuffer src) throws IOException; /** * Writes a sequence of bytes to this channel from a subsequence of the @@ -443,7 +443,7 @@ public final long read(ByteBuffer[] dsts) throws IOException { * @throws ClosedByInterruptException {@inheritDoc} * @throws NonWritableChannelException {@inheritDoc} */ - public abstract long write(ByteBuffer[] srcs, int offset, int length) + public abstract long write(ByteBuffer[] srcs, int offset, int length) throws IOException; /** @@ -462,7 +462,7 @@ public abstract long write(ByteBuffer[] srcs, int offset, int length) * @throws ClosedByInterruptException {@inheritDoc} * @throws NonWritableChannelException {@inheritDoc} */ - public final long write(ByteBuffer[] srcs) throws IOException { + public final long write(ByteBuffer[] srcs) throws IOException { return write(srcs, 0, srcs.length); } @@ -482,7 +482,7 @@ public final long write(ByteBuffer[] srcs) throws IOException { * @throws IOException * If some other I/O error occurs */ - public abstract long position() throws IOException; + public abstract long position() throws IOException; /** * Sets this channel's file position. @@ -510,7 +510,7 @@ public final long write(ByteBuffer[] srcs) throws IOException { * @throws IOException * If some other I/O error occurs */ - public abstract FileChannel position( long newPosition) throws IOException; + public abstract FileChannel position(long newPosition) throws IOException; /** * Returns the current size of this channel's file. @@ -524,7 +524,7 @@ public final long write(ByteBuffer[] srcs) throws IOException { * @throws IOException * If some other I/O error occurs */ - public abstract long size() throws IOException; + public abstract long size() throws IOException; /** * Truncates this channel's file to the given size. @@ -553,7 +553,7 @@ public final long write(ByteBuffer[] srcs) throws IOException { * @throws IOException * If some other I/O error occurs */ - public abstract FileChannel truncate( long size) throws IOException; + public abstract FileChannel truncate(long size) throws IOException; /** * Forces any updates to this channel's file to be written to the storage @@ -671,7 +671,7 @@ public final long write(ByteBuffer[] srcs) throws IOException { * @throws IOException * If some other I/O error occurs */ - public abstract long transferTo( long position, long count, + public abstract long transferTo(long position, long count, WritableByteChannel target) throws IOException; @@ -741,8 +741,8 @@ public abstract long transferTo( long position, long count, * @throws IOException * If some other I/O error occurs */ - public abstract long transferFrom(ReadableByteChannel src, - long position, long count) + public abstract long transferFrom(ReadableByteChannel src, + long position, long count) throws IOException; /** @@ -789,7 +789,7 @@ public abstract long transferFrom(ReadableByteChannel src, * @throws IOException * If some other I/O error occurs */ - public abstract int read(ByteBuffer dst, long position) throws IOException; + public abstract int read(ByteBuffer dst, long position) throws IOException; /** * Writes a sequence of bytes to this channel from the given buffer, @@ -838,7 +838,7 @@ public abstract long transferFrom(ReadableByteChannel src, * @throws IOException * If some other I/O error occurs */ - public abstract int write(ByteBuffer src, long position) throws IOException; + public abstract int write(ByteBuffer src, long position) throws IOException; // -- Memory-mapped buffers -- @@ -1180,7 +1180,7 @@ public MemorySegment map(MapMode mode, long offset, long size, Arena arena) * @see #tryLock() * @see #tryLock(long,long,boolean) */ - public abstract FileLock lock( long position, long size, boolean shared) + public abstract FileLock lock(long position, long size, boolean shared) throws IOException; /** @@ -1306,7 +1306,7 @@ public final FileLock lock() throws IOException { * @see #lock(long,long,boolean) * @see #tryLock() */ - public abstract @Nullable FileLock tryLock( long position, long size, boolean shared) + public abstract @Nullable FileLock tryLock(long position, long size, boolean shared) throws IOException; /** diff --git a/src/java.base/share/classes/java/nio/charset/CoderResult.java b/src/java.base/share/classes/java/nio/charset/CoderResult.java index 64e7ac7ca67..da77752f32a 100644 --- a/src/java.base/share/classes/java/nio/charset/CoderResult.java +++ b/src/java.base/share/classes/java/nio/charset/CoderResult.java @@ -81,6 +81,7 @@ * @author JSR-51 Expert Group * @since 1.4 */ + @NullMarked public final class CoderResult { diff --git a/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java b/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java index 2de5ab891cd..dba4f46621e 100644 --- a/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java +++ b/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java @@ -40,6 +40,7 @@ * @author JSR-51 Expert Group * @since 1.4 */ + @NullMarked public final class CodingErrorAction { diff --git a/src/java.base/share/classes/java/nio/charset/MalformedInputException.java b/src/java.base/share/classes/java/nio/charset/MalformedInputException.java index 352ec83887e..eb61832d21f 100644 --- a/src/java.base/share/classes/java/nio/charset/MalformedInputException.java +++ b/src/java.base/share/classes/java/nio/charset/MalformedInputException.java @@ -34,6 +34,7 @@ * * @since 1.4 */ + @NullMarked public class MalformedInputException extends CharacterCodingException diff --git a/src/java.base/share/classes/java/nio/charset/UnmappableCharacterException.java b/src/java.base/share/classes/java/nio/charset/UnmappableCharacterException.java index f844c95096a..8fb576989e7 100644 --- a/src/java.base/share/classes/java/nio/charset/UnmappableCharacterException.java +++ b/src/java.base/share/classes/java/nio/charset/UnmappableCharacterException.java @@ -34,6 +34,7 @@ * * @since 1.4 */ + @NullMarked public class UnmappableCharacterException extends CharacterCodingException diff --git a/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java b/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java index 548bb08486d..921253c9259 100644 --- a/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java +++ b/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java @@ -81,6 +81,7 @@ * * @see java.nio.charset.Charset */ + @NullMarked public abstract class CharsetProvider { diff --git a/src/java.base/share/classes/java/nio/file/DirectoryIteratorException.java b/src/java.base/share/classes/java/nio/file/DirectoryIteratorException.java index ee0c7db1aec..420573d4fd0 100644 --- a/src/java.base/share/classes/java/nio/file/DirectoryIteratorException.java +++ b/src/java.base/share/classes/java/nio/file/DirectoryIteratorException.java @@ -41,6 +41,7 @@ * @since 1.7 * @see DirectoryStream */ + @NullMarked public final class DirectoryIteratorException extends ConcurrentModificationException diff --git a/src/java.base/share/classes/java/nio/file/DirectoryStream.java b/src/java.base/share/classes/java/nio/file/DirectoryStream.java index 08f01088ba1..01341578d99 100644 --- a/src/java.base/share/classes/java/nio/file/DirectoryStream.java +++ b/src/java.base/share/classes/java/nio/file/DirectoryStream.java @@ -117,6 +117,7 @@ * * @see Files#newDirectoryStream(Path) */ + @NullMarked public interface DirectoryStream extends Closeable, Iterable { diff --git a/src/java.base/share/classes/java/nio/file/FileSystems.java b/src/java.base/share/classes/java/nio/file/FileSystems.java index 382b00e0639..4089a60c541 100644 --- a/src/java.base/share/classes/java/nio/file/FileSystems.java +++ b/src/java.base/share/classes/java/nio/file/FileSystems.java @@ -87,6 +87,7 @@ * * @since 1.7 */ + @NullMarked public final class FileSystems { private FileSystems() { } diff --git a/src/java.base/share/classes/java/nio/file/Path.java b/src/java.base/share/classes/java/nio/file/Path.java index cc1a9955204..06e5ce2a7a0 100644 --- a/src/java.base/share/classes/java/nio/file/Path.java +++ b/src/java.base/share/classes/java/nio/file/Path.java @@ -148,7 +148,6 @@ public interface Path * * @since 11 */ - public static Path of(String first, String... more) { return FileSystems.getDefault().getPath(first, more); } @@ -196,7 +195,6 @@ public static Path of(String first, String... more) { * * @since 11 */ - public static Path of(URI uri) { String scheme = uri.getScheme(); if (scheme == null) @@ -221,7 +219,6 @@ public static Path of(URI uri) { * * @return the file system that created this object */ - FileSystem getFileSystem(); /** @@ -232,7 +229,6 @@ public static Path of(URI uri) { * * @return {@code true} if, and only if, this path is absolute */ - boolean isAbsolute(); /** @@ -242,7 +238,6 @@ public static Path of(URI uri) { * @return a path representing the root component of this path, * or {@code null} */ - @Nullable Path getRoot(); /** @@ -253,7 +248,6 @@ public static Path of(URI uri) { * @return a path representing the name of the file or directory, or * {@code null} if this path has zero elements */ - @Nullable Path getFileName(); /** @@ -279,7 +273,6 @@ public static Path of(URI uri) { * * @return a path representing the path's parent */ - @Nullable Path getParent(); /** @@ -288,7 +281,6 @@ public static Path of(URI uri) { * @return the number of elements in the path, or {@code 0} if this path * only represents a root component */ - int getNameCount(); /** @@ -309,7 +301,6 @@ public static Path of(URI uri) { * equal to the number of elements, or this path has zero name * elements */ - Path getName(int index); /** @@ -337,7 +328,6 @@ public static Path of(URI uri) { * the number of elements. If {@code endIndex} is less than or * equal to {@code beginIndex}, or larger than the number of elements. */ - Path subpath(int beginIndex, int endIndex); /** @@ -363,7 +353,6 @@ public static Path of(URI uri) { * @return {@code true} if this path starts with the given path; otherwise * {@code false} */ - boolean startsWith(Path other); /** @@ -388,7 +377,6 @@ public static Path of(URI uri) { * @throws InvalidPathException * If the path string cannot be converted to a Path. */ - default boolean startsWith(String other) { return startsWith(getFileSystem().getPath(other)); } @@ -418,7 +406,6 @@ default boolean startsWith(String other) { * @return {@code true} if this path ends with the given path; otherwise * {@code false} */ - boolean endsWith(Path other); /** @@ -446,7 +433,6 @@ default boolean startsWith(String other) { * @throws InvalidPathException * If the path string cannot be converted to a Path. */ - default boolean endsWith(String other) { return endsWith(getFileSystem().getPath(other)); } @@ -476,7 +462,6 @@ default boolean endsWith(String other) { * @see #getParent * @see #toRealPath */ - Path normalize(); // -- resolution and relativization -- @@ -502,7 +487,6 @@ default boolean endsWith(String other) { * * @see #relativize */ - Path resolve(Path other); /** @@ -529,7 +513,6 @@ default boolean endsWith(String other) { * * @see FileSystem#getPath */ - default Path resolve(String other) { return resolve(getFileSystem().getPath(other)); } @@ -645,7 +628,6 @@ default Path resolve(String first, String... more) { * * @see #resolve(Path) */ - default Path resolveSibling(Path other) { if (other == null) throw new NullPointerException(); @@ -674,7 +656,6 @@ default Path resolveSibling(Path other) { * * @see FileSystem#getPath */ - default Path resolveSibling(String other) { return resolveSibling(getFileSystem().getPath(other)); } @@ -720,7 +701,6 @@ default Path resolveSibling(String other) { * if {@code other} is not a {@code Path} that can be relativized * against this path */ - Path relativize(Path other); /** @@ -769,7 +749,6 @@ default Path resolveSibling(String other) { * a file system, and the URI of the enclosing file system cannot be * obtained */ - URI toUri(); /** @@ -789,7 +768,6 @@ default Path resolveSibling(String other) { * @throws java.io.IOError * if an I/O error occurs */ - Path toAbsolutePath(); /** @@ -829,7 +807,6 @@ default Path resolveSibling(String other) { * @throws IOException * if the file does not exist or an I/O error occurs */ - Path toRealPath(LinkOption... options) throws IOException; /** @@ -857,7 +834,6 @@ default Path resolveSibling(String other) { * @throws UnsupportedOperationException * if this {@code Path} is not associated with the default provider */ - default File toFile() { if (getFileSystem() == FileSystems.getDefault()) { return new File(toString()); @@ -1000,7 +976,6 @@ default WatchKey register(WatchService watcher, * * @return an iterator over the name elements of this path */ - @Override default Iterator iterator() { return new Iterator<>() { @@ -1045,7 +1020,6 @@ public Path next() { * @throws ClassCastException * if the paths are associated with different providers */ - @Override int compareTo(Path other); diff --git a/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java b/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java index a015f6dfc82..71bc97bb9d2 100644 --- a/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java +++ b/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java @@ -343,8 +343,6 @@ public Set flags() { * is identical to this AclEntry */ @Override - - public boolean equals(@Nullable Object ob) { if (ob == this) return true; diff --git a/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java b/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java index 23616159ce3..ce00d611ebb 100644 --- a/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java +++ b/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java @@ -102,6 +102,7 @@ * * @since 1.7 */ + @NullMarked public interface BasicFileAttributeView extends FileAttributeView diff --git a/src/java.base/share/classes/java/security/BasicPermission.java b/src/java.base/share/classes/java/security/BasicPermission.java index 43d1228d156..13ebe4bcff6 100644 --- a/src/java.base/share/classes/java/security/BasicPermission.java +++ b/src/java.base/share/classes/java/security/BasicPermission.java @@ -205,8 +205,6 @@ public boolean implies(Permission p) { * object, {@code false} otherwise. */ @Override - - public boolean equals(@Nullable Object obj) { if (obj == this) return true; diff --git a/src/java.base/share/classes/java/security/CodeSource.java b/src/java.base/share/classes/java/security/CodeSource.java index 512b51cbdc5..8682a7decec 100644 --- a/src/java.base/share/classes/java/security/CodeSource.java +++ b/src/java.base/share/classes/java/security/CodeSource.java @@ -52,6 +52,7 @@ * @author Roland Schemers * @since 1.2 */ + @NullMarked public class CodeSource implements java.io.Serializable { @@ -154,8 +155,6 @@ public int hashCode() { * {@code false} otherwise. */ @Override - - public boolean equals(@Nullable Object obj) { if (obj == this) return true; diff --git a/src/java.base/share/classes/java/security/GeneralSecurityException.java b/src/java.base/share/classes/java/security/GeneralSecurityException.java index fab878ff40f..957c0ed0a31 100644 --- a/src/java.base/share/classes/java/security/GeneralSecurityException.java +++ b/src/java.base/share/classes/java/security/GeneralSecurityException.java @@ -36,6 +36,7 @@ * @author Jan Luehe * @since 1.2 */ + @NullMarked public class GeneralSecurityException extends Exception { diff --git a/src/java.base/share/classes/java/security/Key.java b/src/java.base/share/classes/java/security/Key.java index 9940c7c3f37..25afff7ec2e 100644 --- a/src/java.base/share/classes/java/security/Key.java +++ b/src/java.base/share/classes/java/security/Key.java @@ -104,6 +104,7 @@ * @author Benjamin Renaud * @since 1.1 */ + @NullMarked public interface Key extends java.io.Serializable { diff --git a/src/java.base/share/classes/java/security/KeyStore.java b/src/java.base/share/classes/java/security/KeyStore.java index 2745309522c..efd36033d12 100644 --- a/src/java.base/share/classes/java/security/KeyStore.java +++ b/src/java.base/share/classes/java/security/KeyStore.java @@ -204,7 +204,7 @@ */ @NullMarked -public class KeyStore { +public class KeyStore { private static final Debug kdebug = Debug.getInstance("keystore"); private static final Debug pdebug = diff --git a/src/java.base/share/classes/java/security/MessageDigest.java b/src/java.base/share/classes/java/security/MessageDigest.java index a9aa2342abb..27540ff8b3d 100644 --- a/src/java.base/share/classes/java/security/MessageDigest.java +++ b/src/java.base/share/classes/java/security/MessageDigest.java @@ -448,7 +448,7 @@ public void update(byte input) { * @param len the number of bytes to use, starting at * {@code offset}. */ - public void update( byte[] input, int offset, int len) { + public void update(byte[] input, int offset, int len) { if (input == null) { throw new IllegalArgumentException("No input buffer given"); } @@ -464,7 +464,7 @@ public void update( byte[] input, int offset, int len) { * * @param input the array of bytes. */ - public void update( byte[] input) { + public void update(byte[] input) { engineUpdate(input, 0, input.length); state = IN_PROGRESS; } @@ -493,7 +493,7 @@ public final void update(ByteBuffer input) { * * @return the array of bytes for the resulting hash value. */ - public byte[] digest() { + public byte[] digest() { /* Resetting is the responsibility of implementors. */ byte[] result = engineDigest(); state = INITIAL; @@ -514,7 +514,7 @@ public byte[] digest() { * * @throws DigestException if an error occurs. */ - public int digest( byte[] buf, int offset, int len) throws DigestException { + public int digest(byte[] buf, int offset, int len) throws DigestException { if (buf == null) { throw new IllegalArgumentException("No output buffer given"); } @@ -539,7 +539,7 @@ public int digest( byte[] buf, int offset, int len) throws DigestException { * * @return the array of bytes for the resulting hash value. */ - public byte[] digest( byte[] input) { + public byte[] digest(byte[] input) { update(input); return digest(); } diff --git a/src/java.base/share/classes/java/security/PKCS12Attribute.java b/src/java.base/share/classes/java/security/PKCS12Attribute.java index 9e374f7a653..5341c43c5e8 100644 --- a/src/java.base/share/classes/java/security/PKCS12Attribute.java +++ b/src/java.base/share/classes/java/security/PKCS12Attribute.java @@ -198,8 +198,6 @@ public byte[] getEncoded() { * their DER encodings are equal. */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/security/Policy.java b/src/java.base/share/classes/java/security/Policy.java index e3296517adb..320d95ac222 100644 --- a/src/java.base/share/classes/java/security/Policy.java +++ b/src/java.base/share/classes/java/security/Policy.java @@ -343,7 +343,7 @@ private static Policy handleException(NoSuchAlgorithmException nsae) * * @since 1.6 */ - public Policy. @Nullable Parameters getParameters() { + public Policy.@Nullable Parameters getParameters() { return null; } diff --git a/src/java.base/share/classes/java/security/ProtectionDomain.java b/src/java.base/share/classes/java/security/ProtectionDomain.java index c96f1114323..cb9522fcab9 100644 --- a/src/java.base/share/classes/java/security/ProtectionDomain.java +++ b/src/java.base/share/classes/java/security/ProtectionDomain.java @@ -48,6 +48,7 @@ * @author Gary Ellison * @since 1.2 */ + @NullMarked public class ProtectionDomain { @@ -154,7 +155,6 @@ public ProtectionDomain(@Nullable CodeSource codesource, * @return the {@code CodeSource} of this domain which may be {@code null}. * @since 1.2 */ - public final @Nullable CodeSource getCodeSource() { return this.codesource; } diff --git a/src/java.base/share/classes/java/security/spec/EllipticCurve.java b/src/java.base/share/classes/java/security/spec/EllipticCurve.java index 6a0e5d9b78d..e3ebe723e7c 100644 --- a/src/java.base/share/classes/java/security/spec/EllipticCurve.java +++ b/src/java.base/share/classes/java/security/spec/EllipticCurve.java @@ -168,8 +168,6 @@ public BigInteger getB() { * @return true if {@code obj} is an instance of * EllipticCurve and the field, A, and B match, false otherwise. */ - - public boolean equals(@Nullable Object obj) { if (this == obj) return true; diff --git a/src/java.base/share/classes/java/text/Collator.java b/src/java.base/share/classes/java/text/Collator.java index 215631216dc..a81e17ea106 100644 --- a/src/java.base/share/classes/java/text/Collator.java +++ b/src/java.base/share/classes/java/text/Collator.java @@ -532,8 +532,6 @@ public Object clone() * false otherwise. */ @Override - - public boolean equals(@Nullable Object that) { if (this == that) { diff --git a/src/java.base/share/classes/java/text/DateFormat.java b/src/java.base/share/classes/java/text/DateFormat.java index f197c6a0615..06af923e1c0 100644 --- a/src/java.base/share/classes/java/text/DateFormat.java +++ b/src/java.base/share/classes/java/text/DateFormat.java @@ -851,8 +851,6 @@ public int hashCode() { * @return {@code true} if the specified object is equal to this {@code DateFormat} * @see Object#equals(Object) */ - - public boolean equals(@Nullable Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; diff --git a/src/java.base/share/classes/java/text/DecimalFormat.java b/src/java.base/share/classes/java/text/DecimalFormat.java index caae0e5e8ae..252e9c33553 100644 --- a/src/java.base/share/classes/java/text/DecimalFormat.java +++ b/src/java.base/share/classes/java/text/DecimalFormat.java @@ -3197,8 +3197,6 @@ public Object clone() { * @see Object#equals(Object) */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/src/java.base/share/classes/java/text/MessageFormat.java b/src/java.base/share/classes/java/text/MessageFormat.java index 5db6c652d56..0839adabf78 100644 --- a/src/java.base/share/classes/java/text/MessageFormat.java +++ b/src/java.base/share/classes/java/text/MessageFormat.java @@ -1058,7 +1058,7 @@ public final StringBuffer format(@Nullable Object @Nullable [] arguments, String * that use it. * @throws NullPointerException if {@code pattern} is {@code null} */ - public static String format( String pattern, @Nullable Object @Nullable ... arguments) { + public static String format(String pattern, @Nullable Object @Nullable ... arguments) { MessageFormat temp = new MessageFormat(pattern); return temp.format(arguments); } diff --git a/src/java.base/share/classes/java/text/SimpleDateFormat.java b/src/java.base/share/classes/java/text/SimpleDateFormat.java index e1e8ee79e6f..09eb4b2de7c 100644 --- a/src/java.base/share/classes/java/text/SimpleDateFormat.java +++ b/src/java.base/share/classes/java/text/SimpleDateFormat.java @@ -2499,8 +2499,6 @@ public String toString() { * @see Object#equals(Object) */ @Override - - public boolean equals(@Nullable Object obj) { if (!super.equals(obj)) { diff --git a/src/java.base/share/classes/java/time/Clock.java b/src/java.base/share/classes/java/time/Clock.java index 27f20d09c5c..4476e44eafd 100644 --- a/src/java.base/share/classes/java/time/Clock.java +++ b/src/java.base/share/classes/java/time/Clock.java @@ -461,8 +461,6 @@ public long millis() { * @return true if this is equal to the other clock */ @Override - - public boolean equals(@Nullable Object obj) { return super.equals(obj); } diff --git a/src/java.base/share/classes/java/time/LocalDate.java b/src/java.base/share/classes/java/time/LocalDate.java index f162845f315..888da06f484 100644 --- a/src/java.base/share/classes/java/time/LocalDate.java +++ b/src/java.base/share/classes/java/time/LocalDate.java @@ -2146,8 +2146,6 @@ public boolean isEqual(ChronoLocalDate other) { * @return true if this is equal to the other date */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/LocalDateTime.java b/src/java.base/share/classes/java/time/LocalDateTime.java index 660e5cd3d5f..def2fa82713 100644 --- a/src/java.base/share/classes/java/time/LocalDateTime.java +++ b/src/java.base/share/classes/java/time/LocalDateTime.java @@ -1941,8 +1941,6 @@ public boolean isEqual(ChronoLocalDateTime other) { * @return true if this is equal to the other date-time */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/LocalTime.java b/src/java.base/share/classes/java/time/LocalTime.java index 31f8a81f0c5..22b0fbab742 100644 --- a/src/java.base/share/classes/java/time/LocalTime.java +++ b/src/java.base/share/classes/java/time/LocalTime.java @@ -1603,8 +1603,6 @@ public boolean isBefore(LocalTime other) { * @return true if this is equal to the other time */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/MonthDay.java b/src/java.base/share/classes/java/time/MonthDay.java index 851c8e6e4b3..5ce8fb4e1b4 100644 --- a/src/java.base/share/classes/java/time/MonthDay.java +++ b/src/java.base/share/classes/java/time/MonthDay.java @@ -749,8 +749,6 @@ public boolean isBefore(MonthDay other) { * @return true if this is equal to the other month-day */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/OffsetDateTime.java b/src/java.base/share/classes/java/time/OffsetDateTime.java index 476d21e6326..e512143886c 100644 --- a/src/java.base/share/classes/java/time/OffsetDateTime.java +++ b/src/java.base/share/classes/java/time/OffsetDateTime.java @@ -1898,8 +1898,6 @@ public boolean isEqual(OffsetDateTime other) { * @return true if this is equal to the other date-time */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/OffsetTime.java b/src/java.base/share/classes/java/time/OffsetTime.java index 24697f2aaaa..45ca8aa42a1 100644 --- a/src/java.base/share/classes/java/time/OffsetTime.java +++ b/src/java.base/share/classes/java/time/OffsetTime.java @@ -1374,8 +1374,6 @@ public boolean isEqual(OffsetTime other) { * @return true if this is equal to the other time */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/Period.java b/src/java.base/share/classes/java/time/Period.java index f31f26d05f9..82c13ab5837 100644 --- a/src/java.base/share/classes/java/time/Period.java +++ b/src/java.base/share/classes/java/time/Period.java @@ -1000,8 +1000,6 @@ private void validateChrono(TemporalAccessor temporal) { * @return true if this is equal to the other period */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/Year.java b/src/java.base/share/classes/java/time/Year.java index 6fd5656dda3..6038c5f9c97 100644 --- a/src/java.base/share/classes/java/time/Year.java +++ b/src/java.base/share/classes/java/time/Year.java @@ -1073,8 +1073,6 @@ public boolean isBefore(Year other) { * @return true if this is equal to the other year */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/YearMonth.java b/src/java.base/share/classes/java/time/YearMonth.java index 83c6e7471de..f33d7a2165d 100644 --- a/src/java.base/share/classes/java/time/YearMonth.java +++ b/src/java.base/share/classes/java/time/YearMonth.java @@ -1196,8 +1196,6 @@ public boolean isBefore(YearMonth other) { * @return true if this is equal to the other year-month */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/ZoneId.java b/src/java.base/share/classes/java/time/ZoneId.java index fdf58bc0435..79f0ad338f8 100644 --- a/src/java.base/share/classes/java/time/ZoneId.java +++ b/src/java.base/share/classes/java/time/ZoneId.java @@ -602,8 +602,6 @@ public ZoneId normalized() { * @return true if this is equal to the other time-zone ID */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/ZonedDateTime.java b/src/java.base/share/classes/java/time/ZonedDateTime.java index 8abe5f0438a..f5fae574093 100644 --- a/src/java.base/share/classes/java/time/ZonedDateTime.java +++ b/src/java.base/share/classes/java/time/ZonedDateTime.java @@ -2194,8 +2194,6 @@ public OffsetDateTime toOffsetDateTime() { * @return true if this is equal to the other date-time */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/chrono/AbstractChronology.java b/src/java.base/share/classes/java/time/chrono/AbstractChronology.java index b2a643d2c81..77e77a0f400 100644 --- a/src/java.base/share/classes/java/time/chrono/AbstractChronology.java +++ b/src/java.base/share/classes/java/time/chrono/AbstractChronology.java @@ -61,8 +61,6 @@ */ package java.time.chrono; -import org.jspecify.annotations.Nullable; - import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH; import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR; import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH; diff --git a/src/java.base/share/classes/java/time/chrono/HijrahDate.java b/src/java.base/share/classes/java/time/chrono/HijrahDate.java index 380d13fde24..a063477d76c 100644 --- a/src/java.base/share/classes/java/time/chrono/HijrahDate.java +++ b/src/java.base/share/classes/java/time/chrono/HijrahDate.java @@ -633,8 +633,6 @@ public ChronoPeriod until(ChronoLocalDate endDate) { * @return true if this is equal to the other date and the Chronologies are equal */ @Override // override for performance - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/chrono/JapaneseDate.java b/src/java.base/share/classes/java/time/chrono/JapaneseDate.java index e7d5b74a30d..5d0a1b2ab4a 100644 --- a/src/java.base/share/classes/java/time/chrono/JapaneseDate.java +++ b/src/java.base/share/classes/java/time/chrono/JapaneseDate.java @@ -701,8 +701,6 @@ public long toEpochDay() { * @return true if this is equal to the other date */ @Override // override for performance - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/chrono/MinguoDate.java b/src/java.base/share/classes/java/time/chrono/MinguoDate.java index 46e7cfba117..007a8419885 100644 --- a/src/java.base/share/classes/java/time/chrono/MinguoDate.java +++ b/src/java.base/share/classes/java/time/chrono/MinguoDate.java @@ -462,8 +462,6 @@ public long toEpochDay() { * @return true if this is equal to the other date */ @Override // override for performance - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java index c69b0f32f20..2a3e2e35fd7 100644 --- a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java +++ b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java @@ -464,8 +464,6 @@ public long toEpochDay() { * @return true if this is equal to the other date */ @Override // override for performance - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/format/DecimalStyle.java b/src/java.base/share/classes/java/time/format/DecimalStyle.java index a03a7b964b3..3f714b0347a 100644 --- a/src/java.base/share/classes/java/time/format/DecimalStyle.java +++ b/src/java.base/share/classes/java/time/format/DecimalStyle.java @@ -355,8 +355,6 @@ String convertNumberToI18N(String numericText) { * @return true if this is equal to the other date */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/time/temporal/ChronoField.java b/src/java.base/share/classes/java/time/temporal/ChronoField.java index bbf3b09927b..d1916bf5b9b 100644 --- a/src/java.base/share/classes/java/time/temporal/ChronoField.java +++ b/src/java.base/share/classes/java/time/temporal/ChronoField.java @@ -57,7 +57,6 @@ package java.time.temporal; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.ERAS; diff --git a/src/java.base/share/classes/java/time/temporal/ChronoUnit.java b/src/java.base/share/classes/java/time/temporal/ChronoUnit.java index e1f59c22dad..38ff8199ca0 100644 --- a/src/java.base/share/classes/java/time/temporal/ChronoUnit.java +++ b/src/java.base/share/classes/java/time/temporal/ChronoUnit.java @@ -57,7 +57,6 @@ package java.time.temporal; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.time.Duration; diff --git a/src/java.base/share/classes/java/time/temporal/IsoFields.java b/src/java.base/share/classes/java/time/temporal/IsoFields.java index 34c52825385..81a3081f8ee 100644 --- a/src/java.base/share/classes/java/time/temporal/IsoFields.java +++ b/src/java.base/share/classes/java/time/temporal/IsoFields.java @@ -57,7 +57,6 @@ package java.time.temporal; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import static java.time.DayOfWeek.THURSDAY; import static java.time.DayOfWeek.WEDNESDAY; diff --git a/src/java.base/share/classes/java/time/temporal/JulianFields.java b/src/java.base/share/classes/java/time/temporal/JulianFields.java index 2735d7ed4af..b7b28b7e141 100644 --- a/src/java.base/share/classes/java/time/temporal/JulianFields.java +++ b/src/java.base/share/classes/java/time/temporal/JulianFields.java @@ -62,7 +62,6 @@ package java.time.temporal; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import static java.time.temporal.ChronoField.EPOCH_DAY; import static java.time.temporal.ChronoUnit.DAYS; diff --git a/src/java.base/share/classes/java/time/temporal/TemporalAdjuster.java b/src/java.base/share/classes/java/time/temporal/TemporalAdjuster.java index 6d20f3cfe45..00d438b40b1 100644 --- a/src/java.base/share/classes/java/time/temporal/TemporalAdjuster.java +++ b/src/java.base/share/classes/java/time/temporal/TemporalAdjuster.java @@ -64,7 +64,6 @@ import java.time.DateTimeException; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Strategy for adjusting a temporal object. diff --git a/src/java.base/share/classes/java/time/temporal/TemporalAmount.java b/src/java.base/share/classes/java/time/temporal/TemporalAmount.java index ea0071ad17a..9643786c618 100644 --- a/src/java.base/share/classes/java/time/temporal/TemporalAmount.java +++ b/src/java.base/share/classes/java/time/temporal/TemporalAmount.java @@ -62,7 +62,6 @@ package java.time.temporal; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.time.DateTimeException; import java.time.Duration; diff --git a/src/java.base/share/classes/java/time/temporal/TemporalQueries.java b/src/java.base/share/classes/java/time/temporal/TemporalQueries.java index 17abf9a51bb..d6a90782878 100644 --- a/src/java.base/share/classes/java/time/temporal/TemporalQueries.java +++ b/src/java.base/share/classes/java/time/temporal/TemporalQueries.java @@ -345,7 +345,7 @@ private TemporalQueries() { /** * A strict query for the {@code ZoneId}. */ - static final TemporalQuery ZONE_ID = new TemporalQuery() { + static final TemporalQuery ZONE_ID = new TemporalQuery<>() { @Override public ZoneId queryFrom(TemporalAccessor temporal) { return temporal.query(TemporalQueries.ZONE_ID); @@ -360,7 +360,7 @@ public String toString() { /** * A query for the {@code Chronology}. */ - static final TemporalQuery CHRONO = new TemporalQuery() { + static final TemporalQuery CHRONO = new TemporalQuery<>() { @Override public Chronology queryFrom(TemporalAccessor temporal) { return temporal.query(TemporalQueries.CHRONO); @@ -376,7 +376,7 @@ public String toString() { /** * A query for the smallest supported unit. */ - static final TemporalQuery PRECISION = new TemporalQuery() { + static final TemporalQuery PRECISION = new TemporalQuery<>() { @Override public TemporalUnit queryFrom(TemporalAccessor temporal) { return temporal.query(TemporalQueries.PRECISION); @@ -392,7 +392,7 @@ public String toString() { /** * A query for {@code ZoneOffset} returning null if not found. */ - static final TemporalQuery OFFSET = new TemporalQuery() { + static final TemporalQuery OFFSET = new TemporalQuery<>() { @Override public ZoneOffset queryFrom(TemporalAccessor temporal) { if (temporal.isSupported(OFFSET_SECONDS)) { @@ -410,7 +410,7 @@ public String toString() { /** * A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}. */ - static final TemporalQuery ZONE = new TemporalQuery() { + static final TemporalQuery ZONE = new TemporalQuery<>() { @Override public ZoneId queryFrom(TemporalAccessor temporal) { ZoneId zone = temporal.query(ZONE_ID); @@ -426,7 +426,7 @@ public String toString() { /** * A query for {@code LocalDate} returning null if not found. */ - static final TemporalQuery LOCAL_DATE = new TemporalQuery() { + static final TemporalQuery LOCAL_DATE = new TemporalQuery<>() { @Override public LocalDate queryFrom(TemporalAccessor temporal) { if (temporal.isSupported(EPOCH_DAY)) { @@ -444,7 +444,7 @@ public String toString() { /** * A query for {@code LocalTime} returning null if not found. */ - static final TemporalQuery LOCAL_TIME = new TemporalQuery() { + static final TemporalQuery LOCAL_TIME = new TemporalQuery<>() { @Override public LocalTime queryFrom(TemporalAccessor temporal) { if (temporal.isSupported(NANO_OF_DAY)) { diff --git a/src/java.base/share/classes/java/time/temporal/TemporalUnit.java b/src/java.base/share/classes/java/time/temporal/TemporalUnit.java index 100d301388a..20f6373e790 100644 --- a/src/java.base/share/classes/java/time/temporal/TemporalUnit.java +++ b/src/java.base/share/classes/java/time/temporal/TemporalUnit.java @@ -62,7 +62,6 @@ package java.time.temporal; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.time.DateTimeException; import java.time.Duration; diff --git a/src/java.base/share/classes/java/time/temporal/ValueRange.java b/src/java.base/share/classes/java/time/temporal/ValueRange.java index f99aece8dbb..dc71b5e22c4 100644 --- a/src/java.base/share/classes/java/time/temporal/ValueRange.java +++ b/src/java.base/share/classes/java/time/temporal/ValueRange.java @@ -391,8 +391,6 @@ private void readObject(ObjectInputStream s) * @return true if this is equal to the other range */ @Override - - public boolean equals(@Nullable Object obj) { if (obj == this) { return true; diff --git a/src/java.base/share/classes/java/time/temporal/WeekFields.java b/src/java.base/share/classes/java/time/temporal/WeekFields.java index a1f00d06c15..a720d2081fa 100644 --- a/src/java.base/share/classes/java/time/temporal/WeekFields.java +++ b/src/java.base/share/classes/java/time/temporal/WeekFields.java @@ -654,8 +654,6 @@ public TemporalField weekBasedYear() { * @return true if this is equal to the specified rules */ @Override - - public boolean equals(@Nullable Object object) { if (this == object) { return true; diff --git a/src/java.base/share/classes/java/util/AbstractCollection.java b/src/java.base/share/classes/java/util/AbstractCollection.java index b7e5a0a6ef3..7a02582ebc4 100644 --- a/src/java.base/share/classes/java/util/AbstractCollection.java +++ b/src/java.base/share/classes/java/util/AbstractCollection.java @@ -64,7 +64,6 @@ * @since 1.2 */ - @NullMarked public abstract class AbstractCollection implements Collection { /** @@ -81,13 +80,9 @@ protected AbstractCollection() { * * @return an iterator over the elements contained in this collection */ - @Override - public abstract Iterator iterator(); - @Override - - public abstract int size(); + public abstract int size(); /** * {@inheritDoc} @@ -95,8 +90,6 @@ protected AbstractCollection() { * @implSpec * This implementation returns {@code size() == 0}. */ - @Override - public boolean isEmpty() { return size() == 0; } @@ -111,8 +104,6 @@ public boolean isEmpty() { * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - @Override - public boolean contains(@Nullable Object o) { Iterator it = iterator(); if (o==null) { @@ -150,8 +141,6 @@ public boolean contains(@Nullable Object o) { * return list.toArray(); * } */ - @Override - public @Nullable Object[] toArray() { // Estimate size of array; be prepared to see more or fewer elements Object[] r = new Object[size()]; @@ -192,8 +181,6 @@ public boolean contains(@Nullable Object o) { * @throws ArrayStoreException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - @Override - @SuppressWarnings("unchecked") public T[] toArray(T[] a) { // Estimate size of array; be prepared to see more or fewer elements @@ -265,7 +252,6 @@ private static T[] finishToArray(T[] r, Iterator it) { * @throws IllegalArgumentException {@inheritDoc} * @throws IllegalStateException {@inheritDoc} */ - @Override public boolean add(E e) { throw new UnsupportedOperationException(); } @@ -287,7 +273,6 @@ public boolean add(E e) { * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - @Override public boolean remove(@Nullable Object o) { Iterator it = iterator(); if (o==null) { @@ -324,8 +309,6 @@ public boolean remove(@Nullable Object o) { * @throws NullPointerException {@inheritDoc} * @see #contains(Object) */ - @Override - public boolean containsAll(Collection c) { for (Object e : c) if (!contains(e)) @@ -352,7 +335,6 @@ public boolean containsAll(Collection c) { * * @see #add(Object) */ - @Override public boolean addAll(Collection c) { boolean modified = false; for (E e : c) @@ -383,7 +365,6 @@ public boolean addAll(Collection c) { * @see #remove(Object) * @see #contains(Object) */ - @Override public boolean removeAll(Collection c) { Objects.requireNonNull(c); boolean modified = false; @@ -419,7 +400,6 @@ public boolean removeAll(Collection c) { * @see #remove(Object) * @see #contains(Object) */ - @Override public boolean retainAll(Collection c) { Objects.requireNonNull(c); boolean modified = false; @@ -449,7 +429,6 @@ public boolean retainAll(Collection c) { * * @throws UnsupportedOperationException {@inheritDoc} */ - @Override public void clear() { Iterator it = iterator(); while (it.hasNext()) { @@ -471,8 +450,6 @@ public void clear() { * * @return a string representation of this collection */ - @Override - public String toString() { Iterator it = iterator(); if (! it.hasNext()) diff --git a/src/java.base/share/classes/java/util/AbstractList.java b/src/java.base/share/classes/java/util/AbstractList.java index 8c02363aa03..da76c7a252e 100644 --- a/src/java.base/share/classes/java/util/AbstractList.java +++ b/src/java.base/share/classes/java/util/AbstractList.java @@ -75,7 +75,6 @@ * @since 1.2 */ - @NullMarked public abstract class AbstractList extends AbstractCollection implements List { /** @@ -124,8 +123,7 @@ public boolean add(E e) { * * @throws IndexOutOfBoundsException {@inheritDoc} */ - - public abstract E get( int index); + public abstract E get(int index); /** * {@inheritDoc} @@ -140,7 +138,7 @@ public boolean add(E e) { * @throws IllegalArgumentException {@inheritDoc} * @throws IndexOutOfBoundsException {@inheritDoc} */ - public E set( int index, E element) { + public E set(int index, E element) { throw new UnsupportedOperationException(); } @@ -157,7 +155,7 @@ public E set( int index, E element) { * @throws IllegalArgumentException {@inheritDoc} * @throws IndexOutOfBoundsException {@inheritDoc} */ - public void add( int index, E element) { + public void add(int index, E element) { throw new UnsupportedOperationException(); } @@ -171,7 +169,7 @@ public void add( int index, E element) { * @throws UnsupportedOperationException {@inheritDoc} * @throws IndexOutOfBoundsException {@inheritDoc} */ - public E remove( int index) { + public E remove(int index) { throw new UnsupportedOperationException(); } @@ -189,8 +187,7 @@ public E remove( int index) { * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - - public int indexOf(@Nullable Object o) { + public int indexOf(@Nullable Object o) { ListIterator it = listIterator(); if (o==null) { while (it.hasNext()) @@ -216,8 +213,7 @@ public int indexOf(@Nullable Object o) { * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - - public int lastIndexOf(@Nullable Object o) { + public int lastIndexOf(@Nullable Object o) { ListIterator it = listIterator(size()); if (o==null) { while (it.hasPrevious()) @@ -273,7 +269,7 @@ public void clear() { * @throws IllegalArgumentException {@inheritDoc} * @throws IndexOutOfBoundsException {@inheritDoc} */ - public boolean addAll( int index, Collection c) { + public boolean addAll(int index, Collection c) { rangeCheckForAdd(index); boolean modified = false; for (E e : c) { @@ -305,7 +301,6 @@ public boolean addAll( int index, Collection c) { * * @return an iterator over the elements in this list in proper sequence */ - public Iterator iterator() { return new Itr(); } @@ -345,7 +340,7 @@ public ListIterator listIterator() { * * @throws IndexOutOfBoundsException {@inheritDoc} */ - public ListIterator listIterator(final int index) { + public ListIterator listIterator(final int index) { rangeCheckForAdd(index); return new ListItr(index); @@ -504,8 +499,7 @@ public void add(E e) { * @throws IllegalArgumentException if the endpoint indices are out of order * {@code (fromIndex > toIndex)} */ - - public List subList( int fromIndex, int toIndex) { + public List subList(int fromIndex, int toIndex) { subListRangeCheck(fromIndex, toIndex, size()); return (this instanceof RandomAccess ? new RandomAccessSubList<>(this, fromIndex, toIndex) : @@ -546,8 +540,7 @@ static void subListRangeCheck(int fromIndex, int toIndex, int size) { * @param o the object to be compared for equality with this list * @return {@code true} if the specified object is equal to this list */ - - public boolean equals( @Nullable Object o) { + public boolean equals(@Nullable Object o) { if (o == this) return true; if (!(o instanceof List)) @@ -574,7 +567,6 @@ public boolean equals( @Nullable Object o) { * * @return the hash code value for this list */ - public int hashCode() { int hashCode = 1; for (E e : this) @@ -605,7 +597,7 @@ public int hashCode() { * @param fromIndex index of first element to be removed * @param toIndex index after last element to be removed */ - protected void removeRange( int fromIndex, int toIndex) { + protected void removeRange(int fromIndex, int toIndex) { ListIterator it = listIterator(fromIndex); for (int i=0, n=toIndex-fromIndex; i> i = entrySet().iterator(); if (value==null) { @@ -153,8 +150,6 @@ public boolean containsValue(@Nullable Object value) { * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - - public boolean containsKey(@Nullable Object key) { Iterator> i = entrySet().iterator(); if (key==null) { @@ -187,7 +182,6 @@ public boolean containsKey(@Nullable Object key) { * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - public @Nullable V get(@Nullable Object key) { Iterator> i = entrySet().iterator(); if (key==null) { @@ -221,8 +215,6 @@ public boolean containsKey(@Nullable Object key) { * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - - public @Nullable V put(K key, V value) { throw new UnsupportedOperationException(); } @@ -361,8 +353,7 @@ public void clear() { * is performed, so there is a slight chance that multiple calls to this * method will not all return the same set. */ - - public Set< K> keySet() { + public Set keySet() { Set ks = keySet; if (ks == null) { ks = new AbstractSet<>() { @@ -370,12 +361,10 @@ public Iterator iterator() { return new KeyIterator(); } - public int size() { return AbstractMap.this.size(); } - public boolean isEmpty() { return AbstractMap.this.isEmpty(); } @@ -409,7 +398,6 @@ public boolean contains(Object k) { * performed, so there is a slight chance that multiple calls to this * method will not all return the same collection. */ - public Collection values() { Collection vals = values; if (vals == null) { @@ -418,12 +406,10 @@ public Iterator iterator() { return new ValueIterator(); } - public int size() { return AbstractMap.this.size(); } - public boolean isEmpty() { return AbstractMap.this.isEmpty(); } @@ -441,8 +427,7 @@ public boolean contains(Object v) { return vals; } - - public abstract Set> entrySet(); + public abstract Set> entrySet(); // Comparison and hashing @@ -469,8 +454,7 @@ public boolean contains(Object v) { * @param o object to be compared for equality with this map * @return {@code true} if the specified object is equal to this map */ - - public boolean equals( @Nullable Object o) { + public boolean equals(@Nullable Object o) { if (o == this) return true; @@ -516,7 +500,6 @@ public boolean equals( @Nullable Object o) { * @see Object#equals(Object) * @see Set#equals(Object) */ - public int hashCode() { int h = 0; for (Entry entry : entrySet()) @@ -536,7 +519,6 @@ public int hashCode() { * * @return a string representation of this map */ - public String toString() { Iterator> i = entrySet().iterator(); if (! i.hasNext()) @@ -646,7 +628,6 @@ public SimpleEntry(Entry entry) { * * @return the key corresponding to this entry */ - public K getKey() { return key; } @@ -656,7 +637,6 @@ public K getKey() { * * @return the value corresponding to this entry */ - public V getValue() { return value; } @@ -714,7 +694,6 @@ && eq(key, e.getKey()) * @return the hash code value for this map entry * @see #equals */ - public int hashCode() { return (key == null ? 0 : key.hashCode()) ^ (value == null ? 0 : value.hashCode()); @@ -728,7 +707,6 @@ public int hashCode() { * * @return a String representation of this map entry */ - public String toString() { return key + "=" + value; } @@ -798,7 +776,6 @@ public SimpleImmutableEntry(Entry entry) { * * @return the key corresponding to this entry */ - public K getKey() { return key; } @@ -808,7 +785,6 @@ public K getKey() { * * @return the value corresponding to this entry */ - public V getValue() { return value; } @@ -870,7 +846,6 @@ && eq(key, e.getKey()) * @return the hash code value for this map entry * @see #equals */ - public int hashCode() { return (key == null ? 0 : key.hashCode()) ^ (value == null ? 0 : value.hashCode()); @@ -884,7 +859,6 @@ public int hashCode() { * * @return a String representation of this map entry */ - public String toString() { return key + "=" + value; } diff --git a/src/java.base/share/classes/java/util/AbstractSequentialList.java b/src/java.base/share/classes/java/util/AbstractSequentialList.java index 1176db7c831..58c4fbe5086 100644 --- a/src/java.base/share/classes/java/util/AbstractSequentialList.java +++ b/src/java.base/share/classes/java/util/AbstractSequentialList.java @@ -71,7 +71,6 @@ * @since 1.2 */ - @NullMarked public abstract class AbstractSequentialList extends AbstractList { /** @@ -90,7 +89,6 @@ protected AbstractSequentialList() { * * @throws IndexOutOfBoundsException {@inheritDoc} */ - public E get(int index) { try { return listIterator(index).next(); @@ -242,7 +240,6 @@ public boolean addAll(int index, Collection c) { * * @return an iterator over the elements in this list (in proper sequence) */ - public Iterator iterator() { return listIterator(); } diff --git a/src/java.base/share/classes/java/util/AbstractSet.java b/src/java.base/share/classes/java/util/AbstractSet.java index 368917ececa..8df80090fa9 100644 --- a/src/java.base/share/classes/java/util/AbstractSet.java +++ b/src/java.base/share/classes/java/util/AbstractSet.java @@ -58,7 +58,6 @@ * @since 1.2 */ - @NullMarked public abstract class AbstractSet extends AbstractCollection implements Set { /** @@ -87,8 +86,7 @@ protected AbstractSet() { * @param o object to be compared for equality with this set * @return {@code true} if the specified object is equal to this set */ - - public boolean equals( @Nullable Object o) { + public boolean equals(@Nullable Object o) { if (o == this) return true; @@ -121,7 +119,6 @@ public boolean equals( @Nullable Object o) { * @see Object#equals(Object) * @see Set#equals(Object) */ - public int hashCode() { int h = 0; Iterator i = iterator(); diff --git a/src/java.base/share/classes/java/util/ArrayDeque.java b/src/java.base/share/classes/java/util/ArrayDeque.java index 8903e6e794e..4698e287b8e 100644 --- a/src/java.base/share/classes/java/util/ArrayDeque.java +++ b/src/java.base/share/classes/java/util/ArrayDeque.java @@ -189,7 +189,7 @@ public ArrayDeque() { * * @param numElements lower bound on initial capacity of the deque */ - public ArrayDeque( int numElements) { + public ArrayDeque(int numElements) { elements = new Object[(numElements < 1) ? 1 : (numElements == Integer.MAX_VALUE) ? Integer.MAX_VALUE : @@ -647,8 +647,7 @@ boolean delete(int i) { * * @return the number of elements in this deque */ - - public int size() { + public int size() { return sub(tail, head, elements.length); } @@ -657,8 +656,6 @@ public int size() { * * @return {@code true} if this deque contains no elements */ - - public boolean isEmpty() { return head == tail; } @@ -671,7 +668,6 @@ public boolean isEmpty() { * * @return an iterator over the elements in this deque */ - public Iterator iterator() { return new DeqIterator(); } @@ -1005,7 +1001,6 @@ private boolean bulkRemoveModified( * @param o object to be checked for containment in this deque * @return {@code true} if this deque contains the specified element */ - public boolean contains(@Nullable Object o) { if (o != null) { final Object[] es = elements; @@ -1073,7 +1068,6 @@ private static void circularClear(Object[] es, int i, int end) { * * @return an array containing all of the elements in this deque */ - public Object[] toArray() { return toArray(Object[].class); } @@ -1131,7 +1125,6 @@ private T[] toArray(Class klazz) { * this deque * @throws NullPointerException if the specified array is null */ - @SuppressWarnings("unchecked") public T[] toArray(T[] a) { final int size; @@ -1155,7 +1148,6 @@ private T[] toArray(Class klazz) { * * @return a copy of this deque */ - public ArrayDeque clone() { try { @SuppressWarnings("unchecked") diff --git a/src/java.base/share/classes/java/util/ArrayList.java b/src/java.base/share/classes/java/util/ArrayList.java index 66991d51c8f..f9f541be71e 100644 --- a/src/java.base/share/classes/java/util/ArrayList.java +++ b/src/java.base/share/classes/java/util/ArrayList.java @@ -110,7 +110,6 @@ * @see Vector * @since 1.2 */ - @NullMarked public class ArrayList extends AbstractList implements List, RandomAccess, Cloneable, java.io.Serializable @@ -157,7 +156,7 @@ public class ArrayList extends AbstractList * @throws IllegalArgumentException if the specified initial capacity * is negative */ - public ArrayList( int initialCapacity) { + public ArrayList(int initialCapacity) { if (initialCapacity > 0) { this.elementData = new Object[initialCapacity]; } else if (initialCapacity == 0) { @@ -255,8 +254,7 @@ private Object[] grow() { * * @return the number of elements in this list */ - - public int size() { + public int size() { return size; } @@ -265,7 +263,6 @@ public int size() { * * @return {@code true} if this list contains no elements */ - public boolean isEmpty() { return size == 0; } @@ -279,7 +276,6 @@ public boolean isEmpty() { * @param o element whose presence in this list is to be tested * @return {@code true} if this list contains the specified element */ - public boolean contains(@Nullable Object o) { return indexOf(o) >= 0; } @@ -291,8 +287,7 @@ public boolean contains(@Nullable Object o) { * {@code Objects.equals(o, get(i))}, * or -1 if there is no such index. */ - - public int indexOf(@Nullable Object o) { + public int indexOf(@Nullable Object o) { return indexOfRange(o, 0, size); } @@ -321,8 +316,7 @@ int indexOfRange(Object o, int start, int end) { * {@code Objects.equals(o, get(i))}, * or -1 if there is no such index. */ - - public int lastIndexOf(@Nullable Object o) { + public int lastIndexOf(@Nullable Object o) { return lastIndexOfRange(o, 0, size); } @@ -350,7 +344,6 @@ int lastIndexOfRange(Object o, int start, int end) { * * @return a clone of this {@code ArrayList} instance */ - public Object clone() { try { ArrayList v = (ArrayList) super.clone(); @@ -377,7 +370,6 @@ public Object clone() { * @return an array containing all of the elements in this list in * proper sequence */ - public @Nullable Object[] toArray() { return Arrays.copyOf(elementData, size); } @@ -406,7 +398,6 @@ public Object clone() { * this list * @throws NullPointerException if the specified array is null */ - @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length < size) @@ -421,7 +412,7 @@ public Object clone() { // Positional Access Operations @SuppressWarnings("unchecked") - E elementData( int index) { + E elementData(int index) { return (E) elementData[index]; } @@ -437,8 +428,7 @@ static E elementAt(Object[] es, int index) { * @return the element at the specified position in this list * @throws IndexOutOfBoundsException {@inheritDoc} */ - - public E get( int index) { + public E get(int index) { Objects.checkIndex(index, size); return elementData(index); } @@ -481,7 +471,7 @@ public E getLast() { * @return the element previously at the specified position * @throws IndexOutOfBoundsException {@inheritDoc} */ - public E set( int index, E element) { + public E set(int index, E element) { Objects.checkIndex(index, size); E oldValue = elementData(index); elementData[index] = element; @@ -521,7 +511,7 @@ public boolean add(E e) { * @param element element to be inserted * @throws IndexOutOfBoundsException {@inheritDoc} */ - public void add( int index, E element) { + public void add(int index, E element) { rangeCheckForAdd(index); modCount++; final int s; @@ -562,7 +552,7 @@ public void addLast(E element) { * @return the element that was removed from the list * @throws IndexOutOfBoundsException {@inheritDoc} */ - public E remove( int index) { + public E remove(int index) { Objects.checkIndex(index, size); final Object[] es = elementData; @@ -610,8 +600,6 @@ public E removeLast() { /** * {@inheritDoc} */ - - public boolean equals(@Nullable Object o) { if (o == this) { return true; @@ -803,7 +791,7 @@ public boolean addAll(Collection c) { * @throws IndexOutOfBoundsException {@inheritDoc} * @throws NullPointerException if the specified collection is null */ - public boolean addAll( int index, Collection c) { + public boolean addAll(int index, Collection c) { rangeCheckForAdd(index); Object[] a = c.toArray(); @@ -858,7 +846,7 @@ private void shiftTailOverGap(Object[] es, int lo, int hi) { /** * A version of rangeCheck used by add and addAll. */ - private void rangeCheckForAdd( int index) { + private void rangeCheckForAdd(int index) { if (index > size || index < 0) throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); } @@ -868,7 +856,7 @@ private void rangeCheckForAdd( int index) { * Of the many possible refactorings of the error handling code, * this "outlining" performs best with both server and client VMs. */ - private String outOfBoundsMsg( int index) { + private String outOfBoundsMsg(int index) { return "Index: "+index+", Size: "+size; } @@ -1026,7 +1014,7 @@ private void readObject(java.io.ObjectInputStream s) * * @throws IndexOutOfBoundsException {@inheritDoc} */ - public ListIterator listIterator( int index) { + public ListIterator listIterator(int index) { rangeCheckForAdd(index); return new ListItr(index); } @@ -1050,7 +1038,6 @@ public ListIterator listIterator() { * * @return an iterator over the elements in this list in proper sequence */ - public Iterator iterator() { return new Itr(); } @@ -1098,7 +1085,6 @@ public void remove() { } } - @SuppressWarnings({"unchecked"}) @Override public void forEachRemaining(Consumer action) { Objects.requireNonNull(action); @@ -1213,7 +1199,7 @@ public void add(E e) { * @throws IndexOutOfBoundsException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - public List subList( int fromIndex, int toIndex) { + public List subList(int fromIndex, int toIndex) { subListRangeCheck(fromIndex, toIndex, size); return new SubList<>(this, fromIndex, toIndex); } @@ -1246,7 +1232,7 @@ private SubList(SubList parent, int fromIndex, int toIndex) { this.modCount = parent.modCount; } - public E set( int index, E element) { + public E set(int index, E element) { Objects.checkIndex(index, size); checkForComodification(); E oldValue = root.elementData(offset + index); @@ -1254,26 +1240,25 @@ public E set( int index, E element) { return oldValue; } - public E get( int index) { + public E get(int index) { Objects.checkIndex(index, size); checkForComodification(); return root.elementData(offset + index); } - - public int size() { + public int size() { checkForComodification(); return size; } - public void add( int index, E element) { + public void add(int index, E element) { rangeCheckForAdd(index); checkForComodification(); root.add(offset + index, element); updateSizeAndModCount(1); } - public E remove( int index) { + public E remove(int index) { Objects.checkIndex(index, size); checkForComodification(); E result = root.remove(offset + index); @@ -1291,7 +1276,7 @@ public boolean addAll(Collection c) { return addAll(this.size, c); } - public boolean addAll( int index, Collection c) { + public boolean addAll(int index, Collection c) { rangeCheckForAdd(index); int cSize = c.size(); if (cSize==0) @@ -1386,12 +1371,11 @@ public boolean contains(Object o) { return indexOf(o) >= 0; } - public Iterator iterator() { return listIterator(); } - public ListIterator listIterator( int index) { + public ListIterator listIterator(int index) { checkForComodification(); rangeCheckForAdd(index); @@ -1512,12 +1496,12 @@ public List subList(int fromIndex, int toIndex) { return new SubList<>(this, fromIndex, toIndex); } - private void rangeCheckForAdd( int index) { + private void rangeCheckForAdd(int index) { if (index < 0 || index > this.size) throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); } - private String outOfBoundsMsg( int index) { + private String outOfBoundsMsg(int index) { return "Index: "+index+", Size: "+this.size; } @@ -1535,7 +1519,6 @@ private void updateSizeAndModCount(int sizeChange) { } while (slist != null); } - public Spliterator spliterator() { checkForComodification(); @@ -1648,7 +1631,6 @@ public void forEach(Consumer action) { * @return a {@code Spliterator} over the elements in this list * @since 1.8 */ - @Override public Spliterator spliterator() { return new ArrayListSpliterator(0, -1, 0); @@ -1818,7 +1800,6 @@ boolean removeIf(Predicate filter, int i, final int end) { } } - @SuppressWarnings({"unchecked"}) @Override public void replaceAll(UnaryOperator operator) { replaceAllRange(operator, 0, size); diff --git a/src/java.base/share/classes/java/util/Arrays.java b/src/java.base/share/classes/java/util/Arrays.java index 0463c957dd4..ab8d5e93a50 100644 --- a/src/java.base/share/classes/java/util/Arrays.java +++ b/src/java.base/share/classes/java/util/Arrays.java @@ -1036,7 +1036,7 @@ static final class LegacyMergeSort { * ordering of the array elements is found to violate the * {@link Comparable} contract */ - public static void sort( Object[] a) { + public static void sort(Object[] a) { if (LegacyMergeSort.userRequested) legacyMergeSort(a); else @@ -1101,7 +1101,7 @@ private static void legacyMergeSort(Object[] a) { * not mutually comparable (for example, strings and * integers). */ - public static void sort( Object[] a, int fromIndex, int toIndex) { + public static void sort(Object[] a, int fromIndex, int toIndex) { rangeCheck(a.length, fromIndex, toIndex); if (LegacyMergeSort.userRequested) legacyMergeSort(a, fromIndex, toIndex); @@ -1111,7 +1111,7 @@ public static void sort( Object[] a, int fromIndex, int toIndex) { /** To be removed in a future release. */ private static void legacyMergeSort(Object[] a, - int fromIndex, int toIndex) { + int fromIndex, int toIndex) { Object[] aux = copyOfRange(a, fromIndex, toIndex); mergeSort(aux, a, fromIndex, toIndex, -fromIndex); } @@ -1297,7 +1297,7 @@ private static void legacyMergeSort(T[] a, Comparator c) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void sort(T[] a, int fromIndex, int toIndex, + public static void sort(T[] a, int fromIndex, int toIndex, @Nullable Comparator c) { if (c == null) { sort(a, fromIndex, toIndex); @@ -1311,7 +1311,7 @@ private static void legacyMergeSort(T[] a, Comparator c) { } /** To be removed in a future release. */ - private static void legacyMergeSort(T[] a, int fromIndex, int toIndex, + private static void legacyMergeSort(T[] a, int fromIndex, int toIndex, Comparator c) { T[] aux = copyOfRange(a, fromIndex, toIndex); if (c==null) @@ -1576,7 +1576,7 @@ public static void parallelPrefix(int[] array, int fromIndex, * that this guarantees that the return value will be >= 0 if * and only if the key is found. */ - public static int binarySearch(long[] a, long key) { + public static int binarySearch(long[] a, long key) { return binarySearch0(a, 0, a.length, key); } @@ -1612,14 +1612,14 @@ public static int binarySearch(long[] a, long key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(long[] a, int fromIndex, int toIndex, + public static int binarySearch(long[] a, int fromIndex, int toIndex, long key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(long[] a, int fromIndex, int toIndex, + private static int binarySearch0(long[] a, int fromIndex, int toIndex, long key) { int low = fromIndex; int high = toIndex - 1; @@ -1657,7 +1657,7 @@ else if (midVal > key) * that this guarantees that the return value will be >= 0 if * and only if the key is found. */ - public static int binarySearch(int[] a, int key) { + public static int binarySearch(int[] a, int key) { return binarySearch0(a, 0, a.length, key); } @@ -1693,14 +1693,14 @@ public static int binarySearch(int[] a, int key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(int[] a, int fromIndex, int toIndex, + public static int binarySearch(int[] a, int fromIndex, int toIndex, int key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(int[] a, int fromIndex, int toIndex, + private static int binarySearch0(int[] a, int fromIndex, int toIndex, int key) { int low = fromIndex; int high = toIndex - 1; @@ -1738,7 +1738,7 @@ else if (midVal > key) * that this guarantees that the return value will be >= 0 if * and only if the key is found. */ - public static int binarySearch(short[] a, short key) { + public static int binarySearch(short[] a, short key) { return binarySearch0(a, 0, a.length, key); } @@ -1774,14 +1774,14 @@ public static int binarySearch(short[] a, short key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(short[] a, int fromIndex, int toIndex, + public static int binarySearch(short[] a, int fromIndex, int toIndex, short key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(short[] a, int fromIndex, int toIndex, + private static int binarySearch0(short[] a, int fromIndex, int toIndex, short key) { int low = fromIndex; int high = toIndex - 1; @@ -1819,7 +1819,7 @@ else if (midVal > key) * that this guarantees that the return value will be >= 0 if * and only if the key is found. */ - public static int binarySearch(char[] a, char key) { + public static int binarySearch(char[] a, char key) { return binarySearch0(a, 0, a.length, key); } @@ -1855,14 +1855,14 @@ public static int binarySearch(char[] a, char key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(char[] a, int fromIndex, int toIndex, + public static int binarySearch(char[] a, int fromIndex, int toIndex, char key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(char[] a, int fromIndex, int toIndex, + private static int binarySearch0(char[] a, int fromIndex, int toIndex, char key) { int low = fromIndex; int high = toIndex - 1; @@ -1900,7 +1900,7 @@ else if (midVal > key) * that this guarantees that the return value will be >= 0 if * and only if the key is found. */ - public static int binarySearch(byte[] a, byte key) { + public static int binarySearch(byte[] a, byte key) { return binarySearch0(a, 0, a.length, key); } @@ -1936,14 +1936,14 @@ public static int binarySearch(byte[] a, byte key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(byte[] a, int fromIndex, int toIndex, + public static int binarySearch(byte[] a, int fromIndex, int toIndex, byte key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(byte[] a, int fromIndex, int toIndex, + private static int binarySearch0(byte[] a, int fromIndex, int toIndex, byte key) { int low = fromIndex; int high = toIndex - 1; @@ -1982,7 +1982,7 @@ else if (midVal > key) * that this guarantees that the return value will be >= 0 if * and only if the key is found. */ - public static int binarySearch(double[] a, double key) { + public static int binarySearch(double[] a, double key) { return binarySearch0(a, 0, a.length, key); } @@ -2019,14 +2019,14 @@ public static int binarySearch(double[] a, double key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(double[] a, int fromIndex, int toIndex, + public static int binarySearch(double[] a, int fromIndex, int toIndex, double key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(double[] a, int fromIndex, int toIndex, + private static int binarySearch0(double[] a, int fromIndex, int toIndex, double key) { int low = fromIndex; int high = toIndex - 1; @@ -2073,7 +2073,7 @@ else if (midBits < keyBits) // (-0.0, 0.0) or (!NaN, NaN) * that this guarantees that the return value will be >= 0 if * and only if the key is found. */ - public static int binarySearch(float[] a, float key) { + public static int binarySearch(float[] a, float key) { return binarySearch0(a, 0, a.length, key); } @@ -2110,14 +2110,14 @@ public static int binarySearch(float[] a, float key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(float[] a, int fromIndex, int toIndex, + public static int binarySearch(float[] a, int fromIndex, int toIndex, float key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(float[] a, int fromIndex, int toIndex, + private static int binarySearch0(float[] a, int fromIndex, int toIndex, float key) { int low = fromIndex; int high = toIndex - 1; @@ -2172,7 +2172,7 @@ else if (midBits < keyBits) // (-0.0, 0.0) or (!NaN, NaN) * @throws ClassCastException if the search key is not comparable to the * elements of the array. */ - public static int binarySearch(Object[] a, Object key) { + public static int binarySearch(Object[] a, Object key) { return binarySearch0(a, 0, a.length, key); } @@ -2216,14 +2216,14 @@ public static int binarySearch(Object[] a, Object key) { * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(Object[] a, int fromIndex, int toIndex, + public static int binarySearch(Object[] a, int fromIndex, int toIndex, Object key) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key); } // Like public version, but without range checks. - private static int binarySearch0(Object[] a, int fromIndex, int toIndex, + private static int binarySearch0(Object[] a, int fromIndex, int toIndex, Object key) { int low = fromIndex; int high = toIndex - 1; @@ -2275,7 +2275,7 @@ else if (cmp > 0) * or the search key is not comparable to the * elements of the array using this comparator. */ - public static int binarySearch(T[] a, T key, @Nullable Comparator c) { + public static int binarySearch(T[] a, T key, @Nullable Comparator c) { return binarySearch0(a, 0, a.length, key, c); } @@ -2321,14 +2321,14 @@ else if (cmp > 0) * if {@code fromIndex < 0 or toIndex > a.length} * @since 1.6 */ - public static int binarySearch(T[] a, int fromIndex, int toIndex, + public static int binarySearch(T[] a, int fromIndex, int toIndex, T key, @Nullable Comparator c) { rangeCheck(a.length, fromIndex, toIndex); return binarySearch0(a, fromIndex, toIndex, key, c); } // Like public version, but without range checks. - private static int binarySearch0(T[] a, int fromIndex, int toIndex, + private static int binarySearch0(T[] a, int fromIndex, int toIndex, T key, Comparator c) { if (c == null) { return binarySearch0(a, fromIndex, toIndex, key); @@ -2364,8 +2364,7 @@ else if (cmp > 0) * @param a2 the other array to be tested for equality * @return {@code true} if the two arrays are equal */ - - public static boolean equals( long @Nullable [] a, long @Nullable [] a2) { + public static boolean equals(long @Nullable [] a, long @Nullable [] a2) { if (a==a2) return true; if (a==null || a2==null) @@ -2437,8 +2436,7 @@ public static boolean equals(long[] a, int aFromIndex, int aToIndex, * @param a2 the other array to be tested for equality * @return {@code true} if the two arrays are equal */ - - public static boolean equals( int @Nullable [] a, int @Nullable [] a2) { + public static boolean equals(int @Nullable [] a, int @Nullable [] a2) { if (a==a2) return true; if (a==null || a2==null) @@ -2728,7 +2726,6 @@ public static boolean equals(byte[] a, int aFromIndex, int aToIndex, * @param a2 the other array to be tested for equality * @return {@code true} if the two arrays are equal */ - public static boolean equals(boolean @Nullable [] a, boolean @Nullable [] a2) { if (a==a2) return true; @@ -2807,7 +2804,6 @@ public static boolean equals(boolean[] a, int aFromIndex, int aToIndex, * @return {@code true} if the two arrays are equal * @see Double#equals(Object) */ - public static boolean equals(double @Nullable [] a, double @Nullable [] a2) { if (a==a2) return true; @@ -2891,7 +2887,6 @@ public static boolean equals(double[] a, int aFromIndex, int aToIndex, * @return {@code true} if the two arrays are equal * @see Float#equals(Object) */ - public static boolean equals(float @Nullable [] a, float @Nullable [] a2) { if (a==a2) return true; @@ -2972,8 +2967,7 @@ public static boolean equals(float[] a, int aFromIndex, int aToIndex, * @param a2 the other array to be tested for equality * @return {@code true} if the two arrays are equal */ - - public static boolean equals(@Nullable Object @Nullable [] a, @Nullable Object @Nullable [] a2) { + public static boolean equals(@Nullable Object @Nullable [] a, @Nullable Object @Nullable [] a2) { if (a==a2) return true; if (a==null || a2==null) @@ -3150,7 +3144,7 @@ public static boolean equals(@Nullable Object[] a, int aFromIndex, int aToIndex, * @param a the array to be filled * @param val the value to be stored in all elements of the array */ - public static void fill( long[] a, long val) { + public static void fill(long[] a, long val) { for (int i = 0, len = a.length; i < len; i++) a[i] = val; } @@ -3172,7 +3166,7 @@ public static void fill( long[] a, long val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill( long[] a, int fromIndex, int toIndex, long val) { + public static void fill(long[] a, int fromIndex, int toIndex, long val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3185,7 +3179,7 @@ public static void fill( long[] a, int fromIndex, int toIndex, long val) { * @param a the array to be filled * @param val the value to be stored in all elements of the array */ - public static void fill( int[] a, int val) { + public static void fill(int[] a, int val) { for (int i = 0, len = a.length; i < len; i++) a[i] = val; } @@ -3207,7 +3201,7 @@ public static void fill( int[] a, int val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill( int[] a, int fromIndex, int toIndex, int val) { + public static void fill(int[] a, int fromIndex, int toIndex, int val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3220,7 +3214,7 @@ public static void fill( int[] a, int fromIndex, int toIndex, int val) { * @param a the array to be filled * @param val the value to be stored in all elements of the array */ - public static void fill( short[] a, short val) { + public static void fill(short[] a, short val) { for (int i = 0, len = a.length; i < len; i++) a[i] = val; } @@ -3242,7 +3236,7 @@ public static void fill( short[] a, short val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill( short[] a, int fromIndex, int toIndex, short val) { + public static void fill(short[] a, int fromIndex, int toIndex, short val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3255,7 +3249,7 @@ public static void fill( short[] a, int fromIndex, int toIndex, short val) { * @param a the array to be filled * @param val the value to be stored in all elements of the array */ - public static void fill( char[] a, char val) { + public static void fill(char[] a, char val) { for (int i = 0, len = a.length; i < len; i++) a[i] = val; } @@ -3277,7 +3271,7 @@ public static void fill( char[] a, char val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill( char[] a, int fromIndex, int toIndex, char val) { + public static void fill(char[] a, int fromIndex, int toIndex, char val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3290,7 +3284,7 @@ public static void fill( char[] a, int fromIndex, int toIndex, char val) { * @param a the array to be filled * @param val the value to be stored in all elements of the array */ - public static void fill( byte[] a, byte val) { + public static void fill(byte[] a, byte val) { for (int i = 0, len = a.length; i < len; i++) a[i] = val; } @@ -3312,7 +3306,7 @@ public static void fill( byte[] a, byte val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill( byte[] a, int fromIndex, int toIndex, byte val) { + public static void fill(byte[] a, int fromIndex, int toIndex, byte val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3347,7 +3341,7 @@ public static void fill(boolean[] a, boolean val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill(boolean[] a, int fromIndex, int toIndex, + public static void fill(boolean[] a, int fromIndex, int toIndex, boolean val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) @@ -3383,7 +3377,7 @@ public static void fill(double[] a, double val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill(double[] a, int fromIndex, int toIndex,double val){ + public static void fill(double[] a, int fromIndex, int toIndex,double val){ rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3418,7 +3412,7 @@ public static void fill(float[] a, float val) { * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or * {@code toIndex > a.length} */ - public static void fill(float[] a, int fromIndex, int toIndex, float val) { + public static void fill(float[] a, int fromIndex, int toIndex, float val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3433,7 +3427,7 @@ public static void fill(float[] a, int fromIndex, int toIndex, float val) { * @throws ArrayStoreException if the specified value is not of a * runtime type that can be stored in the specified array */ - public static void fill(@Nullable Object[] a, @Nullable Object val) { + public static void fill(@Nullable Object[] a, @Nullable Object val) { for (int i = 0, len = a.length; i < len; i++) a[i] = val; } @@ -3457,7 +3451,7 @@ public static void fill(@Nullable Object[] a, @Nullable Object val) { * @throws ArrayStoreException if the specified value is not of a * runtime type that can be stored in the specified array */ - public static void fill(@Nullable Object[] a, int fromIndex, int toIndex, @Nullable Object val) { + public static void fill(@Nullable Object[] a, int fromIndex, int toIndex, @Nullable Object val) { rangeCheck(a.length, fromIndex, toIndex); for (int i = fromIndex; i < toIndex; i++) a[i] = val; @@ -3485,7 +3479,7 @@ public static void fill(@Nullable Object[] a, int fromIndex, int toIndex, @Nu * @since 1.6 */ @SuppressWarnings("unchecked") - public static @Nullable T[] copyOf(@Nullable T[] original, int newLength) { + public static @Nullable T[] copyOf(@Nullable T[] original, int newLength) { return (T[]) copyOf(original, newLength, original.getClass()); } @@ -3778,7 +3772,7 @@ public static boolean[] copyOf(boolean[] original, int newLength) { * @since 1.6 */ @SuppressWarnings("unchecked") - public static @Nullable T[] copyOfRange(@Nullable T[] original, int from, int to) { + public static @Nullable T[] copyOfRange(@Nullable T[] original, int from, int to) { return copyOfRange(original, from, to, (Class) original.getClass()); } @@ -4223,18 +4217,15 @@ private static class ArrayList extends AbstractList } @Override - - public int size() { + public int size() { return a.length; } - @Override public Object[] toArray() { return Arrays.copyOf(a, a.length, Object[].class); } - @Override @SuppressWarnings("unchecked") public T[] toArray(T[] a) { @@ -4280,7 +4271,6 @@ public boolean contains(Object o) { return indexOf(o) >= 0; } - @Override public Spliterator spliterator() { return Spliterators.spliterator(a, Spliterator.ORDERED); @@ -4668,8 +4658,7 @@ private static int primitiveArrayHashCode(Object a, Class cl) { * @see Objects#deepEquals(Object, Object) * @since 1.5 */ - - public static boolean deepEquals(@Nullable Object @Nullable [] a1, @Nullable Object @Nullable [] a2) { + public static boolean deepEquals(@Nullable Object @Nullable [] a1, @Nullable Object @Nullable [] a2) { if (a1 == a2) return true; if (a1 == null || a2==null) @@ -4735,8 +4724,7 @@ else if (e1 instanceof boolean[] && e2 instanceof boolean[]) * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(long @Nullable [] a) { + public static String toString(long @Nullable [] a) { if (a == null) return "null"; int iMax = a.length - 1; @@ -4766,8 +4754,7 @@ public static String toString(long @Nullable [] a) { * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(int @Nullable [] a) { + public static String toString(int @Nullable [] a) { if (a == null) return "null"; int iMax = a.length - 1; @@ -4797,8 +4784,7 @@ public static String toString(int @Nullable [] a) { * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(short @Nullable [] a) { + public static String toString(short @Nullable [] a) { if (a == null) return "null"; int iMax = a.length - 1; @@ -4828,8 +4814,7 @@ public static String toString(short @Nullable [] a) { * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(char @Nullable [] a) { + public static String toString(char @Nullable [] a) { if (a == null) return "null"; int iMax = a.length - 1; @@ -4859,8 +4844,7 @@ public static String toString(char @Nullable [] a) { * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(byte @Nullable [] a) { + public static String toString(byte @Nullable [] a) { if (a == null) return "null"; int iMax = a.length - 1; @@ -4890,8 +4874,7 @@ public static String toString(byte @Nullable [] a) { * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(boolean @Nullable [] a) { + public static String toString(boolean @Nullable [] a) { if (a == null) return "null"; int iMax = a.length - 1; @@ -4921,8 +4904,7 @@ public static String toString(boolean @Nullable [] a) { * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(float @Nullable [] a) { + public static String toString(float @Nullable [] a) { if (a == null) return "null"; @@ -4953,8 +4935,7 @@ public static String toString(float @Nullable [] a) { * @return a string representation of {@code a} * @since 1.5 */ - - public static String toString(double @Nullable [] a) { + public static String toString(double @Nullable [] a) { if (a == null) return "null"; int iMax = a.length - 1; @@ -4987,8 +4968,7 @@ public static String toString(double @Nullable [] a) { * @see #deepToString(Object[]) * @since 1.5 */ - - public static String toString(@Nullable Object @Nullable [] a) { + public static String toString(@Nullable Object @Nullable [] a) { if (a == null) return "null"; @@ -5039,8 +5019,7 @@ public static String toString(@Nullable Object @Nullable [] a) { * @see #toString(Object[]) * @since 1.5 */ - - public static String deepToString(@Nullable Object @Nullable [] a) { + public static String deepToString(@Nullable Object @Nullable [] a) { if (a == null) return "null"; @@ -5344,7 +5323,6 @@ public static void parallelSetAll(double[] array, IntToDoubleFunction generator) * @return a spliterator for the array elements * @since 1.8 */ - public static Spliterator spliterator(T[] array) { return Spliterators.spliterator(array, Spliterator.ORDERED | Spliterator.IMMUTABLE); @@ -5369,7 +5347,6 @@ public static void parallelSetAll(double[] array, IntToDoubleFunction generator) * the array size * @since 1.8 */ - public static Spliterator spliterator(T[] array, int startInclusive, int endExclusive) { return Spliterators.spliterator(array, startInclusive, endExclusive, Spliterator.ORDERED | Spliterator.IMMUTABLE); @@ -5386,7 +5363,6 @@ public static void parallelSetAll(double[] array, IntToDoubleFunction generator) * @return a spliterator for the array elements * @since 1.8 */ - public static Spliterator.OfInt spliterator(int[] array) { return Spliterators.spliterator(array, Spliterator.ORDERED | Spliterator.IMMUTABLE); @@ -5410,7 +5386,6 @@ public static Spliterator.OfInt spliterator(int[] array) { * the array size * @since 1.8 */ - public static Spliterator.OfInt spliterator(int[] array, int startInclusive, int endExclusive) { return Spliterators.spliterator(array, startInclusive, endExclusive, Spliterator.ORDERED | Spliterator.IMMUTABLE); @@ -5427,7 +5402,6 @@ public static Spliterator.OfInt spliterator(int[] array, int startInclusive, int * @return the spliterator for the array elements * @since 1.8 */ - public static Spliterator.OfLong spliterator(long[] array) { return Spliterators.spliterator(array, Spliterator.ORDERED | Spliterator.IMMUTABLE); @@ -5451,7 +5425,6 @@ public static Spliterator.OfLong spliterator(long[] array) { * the array size * @since 1.8 */ - public static Spliterator.OfLong spliterator(long[] array, int startInclusive, int endExclusive) { return Spliterators.spliterator(array, startInclusive, endExclusive, Spliterator.ORDERED | Spliterator.IMMUTABLE); @@ -5469,7 +5442,6 @@ public static Spliterator.OfLong spliterator(long[] array, int startInclusive, i * @return a spliterator for the array elements * @since 1.8 */ - public static Spliterator.OfDouble spliterator(double[] array) { return Spliterators.spliterator(array, Spliterator.ORDERED | Spliterator.IMMUTABLE); @@ -5493,7 +5465,6 @@ public static Spliterator.OfDouble spliterator(double[] array) { * the array size * @since 1.8 */ - public static Spliterator.OfDouble spliterator(double[] array, int startInclusive, int endExclusive) { return Spliterators.spliterator(array, startInclusive, endExclusive, Spliterator.ORDERED | Spliterator.IMMUTABLE); diff --git a/src/java.base/share/classes/java/util/BitSet.java b/src/java.base/share/classes/java/util/BitSet.java index abfe86d9beb..e763c5f838c 100644 --- a/src/java.base/share/classes/java/util/BitSet.java +++ b/src/java.base/share/classes/java/util/BitSet.java @@ -162,7 +162,7 @@ public BitSet() { * @throws NegativeArraySizeException if the specified initial size * is negative */ - public BitSet( int nbits) { + public BitSet(int nbits) { // nbits can't be negative; size 0 is OK if (nbits < 0) throw new NegativeArraySizeException("nbits < 0: " + nbits); @@ -384,7 +384,7 @@ private static void checkRange(int fromIndex, int toIndex) { * @throws IndexOutOfBoundsException if the specified index is negative * @since 1.4 */ - public void flip( int bitIndex) { + public void flip(int bitIndex) { if (bitIndex < 0) throw new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex); @@ -409,7 +409,7 @@ public void flip( int bitIndex) { * larger than {@code toIndex} * @since 1.4 */ - public void flip( int fromIndex, int toIndex) { + public void flip(int fromIndex, int toIndex) { checkRange(fromIndex, toIndex); if (fromIndex == toIndex) @@ -448,7 +448,7 @@ public void flip( int fromIndex, int toIndex) { * @throws IndexOutOfBoundsException if the specified index is negative * @since 1.0 */ - public void set( int bitIndex) { + public void set(int bitIndex) { if (bitIndex < 0) throw new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex); @@ -468,7 +468,7 @@ public void set( int bitIndex) { * @throws IndexOutOfBoundsException if the specified index is negative * @since 1.4 */ - public void set( int bitIndex, boolean value) { + public void set(int bitIndex, boolean value) { if (value) set(bitIndex); else @@ -486,7 +486,7 @@ public void set( int bitIndex, boolean value) { * larger than {@code toIndex} * @since 1.4 */ - public void set( int fromIndex, int toIndex) { + public void set(int fromIndex, int toIndex) { checkRange(fromIndex, toIndex); if (fromIndex == toIndex) @@ -530,7 +530,7 @@ public void set( int fromIndex, int toIndex) { * larger than {@code toIndex} * @since 1.4 */ - public void set( int fromIndex, int toIndex, boolean value) { + public void set(int fromIndex, int toIndex, boolean value) { if (value) set(fromIndex, toIndex); else @@ -544,7 +544,7 @@ public void set( int fromIndex, int toIndex, boolean value) { * @throws IndexOutOfBoundsException if the specified index is negative * @since 1.0 */ - public void clear( int bitIndex) { + public void clear(int bitIndex) { if (bitIndex < 0) throw new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex); @@ -569,7 +569,7 @@ public void clear( int bitIndex) { * larger than {@code toIndex} * @since 1.4 */ - public void clear( int fromIndex, int toIndex) { + public void clear(int fromIndex, int toIndex) { checkRange(fromIndex, toIndex); if (fromIndex == toIndex) @@ -627,8 +627,7 @@ public void clear() { * @return the value of the bit with the specified index * @throws IndexOutOfBoundsException if the specified index is negative */ - - public boolean get( int bitIndex) { + public boolean get(int bitIndex) { if (bitIndex < 0) throw new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex); @@ -651,8 +650,7 @@ public boolean get( int bitIndex) { * larger than {@code toIndex} * @since 1.4 */ - - public BitSet get( int fromIndex, int toIndex) { + public BitSet get(int fromIndex, int toIndex) { checkRange(fromIndex, toIndex); checkInvariants(); @@ -718,8 +716,7 @@ public BitSet get( int fromIndex, int toIndex) { * @throws IndexOutOfBoundsException if the specified index is negative * @since 1.4 */ - - public int nextSetBit( int fromIndex) { + public int nextSetBit(int fromIndex) { if (fromIndex < 0) throw new IndexOutOfBoundsException("fromIndex < 0: " + fromIndex); @@ -749,8 +746,7 @@ public int nextSetBit( int fromIndex) { * @throws IndexOutOfBoundsException if the specified index is negative * @since 1.4 */ - - public int nextClearBit( int fromIndex) { + public int nextClearBit(int fromIndex) { // Neither spec nor implementation handle bitsets of maximal length. // See 4816253. if (fromIndex < 0) @@ -794,7 +790,7 @@ public int nextClearBit( int fromIndex) { * than {@code -1} * @since 1.7 */ - public int previousSetBit( int fromIndex) { + public int previousSetBit(int fromIndex) { if (fromIndex < 0) { if (fromIndex == -1) return -1; @@ -832,7 +828,7 @@ public int previousSetBit( int fromIndex) { * than {@code -1} * @since 1.7 */ - public int previousClearBit( int fromIndex) { + public int previousClearBit(int fromIndex) { if (fromIndex < 0) { if (fromIndex == -1) return -1; @@ -865,8 +861,7 @@ public int previousClearBit( int fromIndex) { * @return the logical size of this {@code BitSet} * @since 1.2 */ - - public int length() { + public int length() { if (wordsInUse == 0) return 0; @@ -881,7 +876,6 @@ public int length() { * @return boolean indicating whether this {@code BitSet} is empty * @since 1.4 */ - public boolean isEmpty() { return wordsInUse == 0; } @@ -895,8 +889,7 @@ public boolean isEmpty() { * the specified {@code BitSet} * @since 1.4 */ - - public boolean intersects( BitSet set) { + public boolean intersects(BitSet set) { for (int i = Math.min(wordsInUse, set.wordsInUse) - 1; i >= 0; i--) if ((words[i] & set.words[i]) != 0) return true; @@ -909,8 +902,7 @@ public boolean intersects( BitSet set) { * @return the number of bits set to {@code true} in this {@code BitSet} * @since 1.4 */ - - public int cardinality() { + public int cardinality() { int sum = 0; for (int i = 0; i < wordsInUse; i++) sum += Long.bitCount(words[i]); @@ -1062,8 +1054,7 @@ public int hashCode() { * * @return the number of bits currently in this bit set */ - - public int size() { + public int size() { return words.length * BITS_PER_WORD; } @@ -1107,7 +1098,6 @@ public boolean equals(@Nullable Object obj) { * @return a clone of this bit set * @see #size() */ - public Object clone() { if (! sizeIsSticky) trimToSize(); @@ -1195,7 +1185,6 @@ private void readObject(ObjectInputStream s) * * @return a string representation of this bit set */ - public String toString() { checkInvariants(); diff --git a/src/java.base/share/classes/java/util/Calendar.java b/src/java.base/share/classes/java/util/Calendar.java index 9aa3560332f..20cfe501c6a 100644 --- a/src/java.base/share/classes/java/util/Calendar.java +++ b/src/java.base/share/classes/java/util/Calendar.java @@ -380,13 +380,13 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable getDisplayNames( int field, int style, Locale locale) { + public @Nullable Map getDisplayNames(int field, int style, Locale locale) { if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale, ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; @@ -2704,7 +2702,7 @@ public String getCalendarType() { * {@code false} otherwise. */ @Override - public boolean equals( @Nullable Object obj) { + public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } @@ -2732,7 +2730,6 @@ public boolean equals( @Nullable Object obj) { * @return a hash code value for this object. * @since 1.2 */ - @Override public int hashCode() { // 'otheritems' represents the hash code for the previous versions. @@ -2805,9 +2802,8 @@ public boolean after(Object when) { * any invalid calendar values. * @since 1.5 */ - @Override - public int compareTo( Calendar anotherCalendar) { + public int compareTo(Calendar anotherCalendar) { return compareTo(getMillisOf(anotherCalendar)); } @@ -2874,7 +2870,7 @@ public int compareTo( Calendar anotherCalendar) { * @see #add(int,int) * @see #set(int,int) */ - public void roll( int field, int amount) + public void roll(int field, int amount) { while (amount > 0) { roll(field, true); @@ -2961,7 +2957,6 @@ public void setLenient(boolean lenient) * {@code false} otherwise. * @see #setLenient(boolean) */ - public boolean isLenient() { return lenient; @@ -2975,7 +2970,7 @@ public boolean isLenient() * @see #getFirstDayOfWeek() * @see #getMinimalDaysInFirstWeek() */ - public void setFirstDayOfWeek( int value) + public void setFirstDayOfWeek(int value) { if (firstDayOfWeek == value) { return; @@ -2992,7 +2987,7 @@ public void setFirstDayOfWeek( int value) * @see #setFirstDayOfWeek(int) * @see #getMinimalDaysInFirstWeek() */ - public int getFirstDayOfWeek() + public int getFirstDayOfWeek() { return firstDayOfWeek; } @@ -3007,7 +3002,7 @@ public int getFirstDayOfWeek() * of the year. * @see #getMinimalDaysInFirstWeek() */ - public void setMinimalDaysInFirstWeek( int value) + public void setMinimalDaysInFirstWeek(int value) { if (minimalDaysInFirstWeek == value) { return; @@ -3026,7 +3021,7 @@ public void setMinimalDaysInFirstWeek( int value) * @return the minimal days required in the first week of the year. * @see #setMinimalDaysInFirstWeek(int) */ - public int getMinimalDaysInFirstWeek() + public int getMinimalDaysInFirstWeek() { return minimalDaysInFirstWeek; } @@ -3141,7 +3136,7 @@ public int getWeeksInWeekYear() { * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - public abstract int getMinimum( int field); + public abstract int getMinimum(int field); /** * Returns the maximum value for the given calendar field of this @@ -3158,7 +3153,7 @@ public int getWeeksInWeekYear() { * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - public abstract int getMaximum( int field); + public abstract int getMaximum(int field); /** * Returns the highest minimum value for the given calendar field @@ -3176,7 +3171,7 @@ public int getWeeksInWeekYear() { * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - public abstract int getGreatestMinimum( int field); + public abstract int getGreatestMinimum(int field); /** * Returns the lowest maximum value for the given calendar field @@ -3198,7 +3193,7 @@ public int getWeeksInWeekYear() { * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - public abstract int getLeastMaximum( int field); + public abstract int getLeastMaximum(int field); /** * Returns the minimum value that the specified calendar field @@ -3220,7 +3215,7 @@ public int getWeeksInWeekYear() { * @see #getActualMaximum(int) * @since 1.2 */ - public int getActualMinimum( int field) { + public int getActualMinimum(int field) { int fieldValue = getGreatestMinimum(field); int endValue = getMinimum(field); @@ -3274,7 +3269,7 @@ public int getActualMinimum( int field) { * @see #getActualMinimum(int) * @since 1.2 */ - public int getActualMaximum( int field) { + public int getActualMaximum(int field) { int fieldValue = getLeastMaximum(field); int endValue = getMaximum(field); @@ -3317,7 +3312,6 @@ public int getActualMaximum( int field) { * * @return a copy of this object. */ - @Override public Object clone() { @@ -3370,7 +3364,6 @@ static String getFieldName(int field) { * * @return a string representation of this calendar. */ - @Override public String toString() { // NOTE: BuddhistCalendar.toString() interprets the string diff --git a/src/java.base/share/classes/java/util/Collection.java b/src/java.base/share/classes/java/util/Collection.java index ad9e52ee77a..d0f5b90bbc2 100644 --- a/src/java.base/share/classes/java/util/Collection.java +++ b/src/java.base/share/classes/java/util/Collection.java @@ -258,7 +258,6 @@ * @since 1.2 */ - @NullMarked public interface Collection extends Iterable { // Query Operations @@ -270,15 +269,13 @@ public interface Collection extends Iterable { * * @return the number of elements in this collection */ - - int size(); + int size(); /** * Returns {@code true} if this collection contains no elements. * * @return {@code true} if this collection contains no elements */ - boolean isEmpty(); /** @@ -297,8 +294,6 @@ public interface Collection extends Iterable { * collection does not permit null elements * ({@linkplain Collection##optional-restrictions optional}) */ - - boolean contains(@Nullable Object o); /** @@ -309,7 +304,6 @@ public interface Collection extends Iterable { * * @return an {@code Iterator} over the elements in this collection */ - Iterator iterator(); /** @@ -334,8 +328,6 @@ public interface Collection extends Iterable { * @return an array, whose {@linkplain Class#getComponentType runtime component * type} is {@code Object}, containing all of the elements in this collection */ - - @Nullable Object[] toArray(); /** @@ -389,7 +381,6 @@ public interface Collection extends Iterable { * runtime component type} of the specified array * @throws NullPointerException if the specified array is null */ - T[] toArray(T[] a); /** @@ -511,7 +502,6 @@ public interface Collection extends Iterable { * or if the specified collection is null. * @see #contains(Object) */ - boolean containsAll(Collection c); /** @@ -669,8 +659,7 @@ default boolean removeIf(Predicate filter) { * @see Set#equals(Object) * @see List#equals(Object) */ - - boolean equals( @Nullable Object o); + boolean equals(@Nullable Object o); /** * Returns the hash code value for this collection. While the @@ -687,7 +676,6 @@ default boolean removeIf(Predicate filter) { * @see Object#hashCode() * @see Object#equals(Object) */ - int hashCode(); /** @@ -740,7 +728,6 @@ default boolean removeIf(Predicate filter) { * @return a {@code Spliterator} over the elements in this collection * @since 1.8 */ - @Override default Spliterator spliterator() { return Spliterators.spliterator(this, 0); diff --git a/src/java.base/share/classes/java/util/Collections.java b/src/java.base/share/classes/java/util/Collections.java index e794da23e99..382937387d8 100644 --- a/src/java.base/share/classes/java/util/Collections.java +++ b/src/java.base/share/classes/java/util/Collections.java @@ -3067,7 +3067,7 @@ public V putIfAbsent(K key, V value) { synchronized (mutex) {return m.putIfAbsent(key, value);} } @Override - public boolean remove(Object key, Object value) { + public boolean remove(Object key, Object value) { synchronized (mutex) {return m.remove(key, value);} } @Override @@ -3475,7 +3475,7 @@ private String badElementMsg(Object o) { public int size() { return c.size(); } public boolean isEmpty() { return c.isEmpty(); } - public boolean contains( Object o) { return c.contains(o); } + public boolean contains(Object o) { return c.contains(o); } public Object[] toArray() { return c.toArray(); } public T[] toArray(T[] a) { return c.toArray(a); } public T[] toArray(IntFunction f) { return c.toArray(f); } @@ -5052,7 +5052,7 @@ private static class EmptyMap public void clear() {} public boolean containsKey(Object key) {return false;} public boolean containsValue(Object value) {return false;} - public V get( Object key) {return null;} + public V get(Object key) {return null;} public Set keySet() {return emptySet();} public Collection values() {return emptySet();} public Set> entrySet() {return emptySet();} @@ -5283,7 +5283,7 @@ public T[] toArray(T[] a) { * @return an immutable list containing only the specified object. * @since 1.3 */ - public static List singletonList(T o) { + public static List singletonList(T o) { return new SingletonList<>(o); } @@ -5423,7 +5423,7 @@ public Collection values() { // Override default methods in Map @Override - public V getOrDefault( Object key, V defaultValue) { + public V getOrDefault(Object key, V defaultValue) { return eq(key, k) ? v : defaultValue; } @@ -5506,7 +5506,7 @@ public int hashCode() { * @see List#addAll(Collection) * @see List#addAll(int, Collection) */ - public static List nCopies( int n, T o) { + public static List nCopies(int n, T o) { if (n < 0) throw new IllegalArgumentException("List length = " + n); return new CopiesList<>(n, o); diff --git a/src/java.base/share/classes/java/util/Comparator.java b/src/java.base/share/classes/java/util/Comparator.java index 049217772c4..b08c2402290 100644 --- a/src/java.base/share/classes/java/util/Comparator.java +++ b/src/java.base/share/classes/java/util/Comparator.java @@ -114,7 +114,6 @@ * @see java.io.Serializable * @since 1.2 */ - @NullMarked @FunctionalInterface public interface Comparator { @@ -179,8 +178,7 @@ public interface Comparator { * @see Object#equals(Object) * @see Object#hashCode() */ - - boolean equals( @Nullable Object obj); + boolean equals(@Nullable Object obj); /** * Returns a comparator that imposes the reverse ordering of this @@ -408,7 +406,7 @@ public static > Comparator reverseOrder() { * @since 1.8 */ @SuppressWarnings("unchecked") - public static > Comparator naturalOrder() { + public static > Comparator naturalOrder() { return (Comparator) Comparators.NaturalOrderComparator.INSTANCE; } @@ -429,7 +427,7 @@ public static > Comparator reverseOrder() { * {@code Comparator}. * @since 1.8 */ - public static Comparator<@Nullable T> nullsFirst(@Nullable Comparator< ? super T> comparator) { + public static Comparator<@Nullable T> nullsFirst(@Nullable Comparator comparator) { return new Comparators.NullComparator<>(true, comparator); } @@ -450,7 +448,7 @@ public static > Comparator reverseOrder() { * {@code Comparator}. * @since 1.8 */ - public static Comparator<@Nullable T> nullsLast(@Nullable Comparator< ? super T> comparator) { + public static Comparator<@Nullable T> nullsLast(@Nullable Comparator comparator) { return new Comparators.NullComparator<>(false, comparator); } diff --git a/src/java.base/share/classes/java/util/Currency.java b/src/java.base/share/classes/java/util/Currency.java index 5fd80d70f49..5cf9c599cce 100644 --- a/src/java.base/share/classes/java/util/Currency.java +++ b/src/java.base/share/classes/java/util/Currency.java @@ -118,7 +118,7 @@ * @since 1.4 */ @NullMarked -public final class Currency implements Serializable { +public final class Currency implements Serializable { @java.io.Serial private static final long serialVersionUID = -158308464356906721L; @@ -684,7 +684,6 @@ public String getDisplayName(Locale locale) { * * @return the ISO 4217 currency code of this currency */ - @Override public String toString() { return currencyCode; diff --git a/src/java.base/share/classes/java/util/Date.java b/src/java.base/share/classes/java/util/Date.java index 58073659ce2..0fe94a3f324 100644 --- a/src/java.base/share/classes/java/util/Date.java +++ b/src/java.base/share/classes/java/util/Date.java @@ -279,7 +279,6 @@ public Date(String s) { /** * Return a copy of this object. */ - public Object clone() { Date d = null; try { @@ -949,8 +948,7 @@ public boolean after(Date when) { * {@code false} otherwise. * @see java.util.Date#getTime() */ - - public boolean equals( @Nullable Object obj) { + public boolean equals(@Nullable Object obj) { return obj instanceof Date && getTime() == ((Date) obj).getTime(); } @@ -996,7 +994,6 @@ public int compareTo(Date anotherDate) { * * @return a hash code value for this object. */ - public int hashCode() { long ht = this.getTime(); return (int) ht ^ (int) (ht >> 32); @@ -1032,7 +1029,6 @@ public int hashCode() { * @see java.util.Date#toLocaleString() * @see java.util.Date#toGMTString() */ - public String toString() { // "EEE MMM dd HH:mm:ss zzz yyyy"; BaseCalendar.Date date = normalize(); diff --git a/src/java.base/share/classes/java/util/Deque.java b/src/java.base/share/classes/java/util/Deque.java index d4c01f7fece..4dd25fdf14f 100644 --- a/src/java.base/share/classes/java/util/Deque.java +++ b/src/java.base/share/classes/java/util/Deque.java @@ -590,7 +590,6 @@ public interface Deque extends Queue, SequencedCo * deque does not permit null elements * ({@linkplain Collection##optional-restrictions optional}) */ - boolean contains(@Nullable Object o); /** @@ -598,8 +597,7 @@ public interface Deque extends Queue, SequencedCo * * @return the number of elements in this deque */ - - int size(); + int size(); /** * Returns an iterator over the elements in this deque in proper sequence. @@ -607,7 +605,6 @@ public interface Deque extends Queue, SequencedCo * * @return an iterator over the elements in this deque in proper sequence */ - Iterator iterator(); /** diff --git a/src/java.base/share/classes/java/util/Dictionary.java b/src/java.base/share/classes/java/util/Dictionary.java index 29c5b26a7f4..33c5b7aabcb 100644 --- a/src/java.base/share/classes/java/util/Dictionary.java +++ b/src/java.base/share/classes/java/util/Dictionary.java @@ -51,7 +51,6 @@ * @see java.util.Hashtable * @since 1.0 */ - @NullMarked public abstract class Dictionary { @@ -67,8 +66,7 @@ public Dictionary() { * * @return the number of keys in this dictionary. */ - - public abstract int size(); + public abstract int size(); /** * Tests if this dictionary maps no keys to value. The general contract @@ -78,7 +76,6 @@ public Dictionary() { * @return {@code true} if this dictionary maps no keys to values; * {@code false} otherwise. */ - public abstract boolean isEmpty(); /** @@ -118,7 +115,6 @@ public Dictionary() { * @throws NullPointerException if the {@code key} is {@code null}. * @see java.util.Dictionary#put(java.lang.Object, java.lang.Object) */ - public abstract @Nullable V get(Object key); /** @@ -148,7 +144,6 @@ public Dictionary() { * @see java.lang.Object#equals(java.lang.Object) * @see java.util.Dictionary#get(java.lang.Object) */ - public abstract @Nullable V put(K key, V value); /** diff --git a/src/java.base/share/classes/java/util/DoubleSummaryStatistics.java b/src/java.base/share/classes/java/util/DoubleSummaryStatistics.java index c8aab2950da..6335242abf8 100644 --- a/src/java.base/share/classes/java/util/DoubleSummaryStatistics.java +++ b/src/java.base/share/classes/java/util/DoubleSummaryStatistics.java @@ -25,7 +25,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.function.DoubleConsumer; import java.util.stream.Collector; diff --git a/src/java.base/share/classes/java/util/EnumMap.java b/src/java.base/share/classes/java/util/EnumMap.java index 547eed0cf45..461e1cb31e1 100644 --- a/src/java.base/share/classes/java/util/EnumMap.java +++ b/src/java.base/share/classes/java/util/EnumMap.java @@ -127,7 +127,7 @@ private Object maskNull(Object value) { } @SuppressWarnings("unchecked") - private V unmaskNull(Object value) { + private V unmaskNull(Object value) { return (V)(value == NULL ? null : value); } @@ -194,8 +194,7 @@ public EnumMap(Map m) { * * @return the number of key-value mappings in this map */ - - public int size() { + public int size() { return size; } @@ -206,7 +205,6 @@ public int size() { * @param value the value whose presence in this map is to be tested * @return {@code true} if this map maps one or more keys to this value */ - public boolean containsValue(@Nullable Object value) { value = maskNull(value); @@ -225,8 +223,6 @@ public boolean containsValue(@Nullable Object value) { * @return {@code true} if this map contains a mapping for the specified * key */ - - public boolean containsKey(@Nullable Object key) { return isValidKey(key) && vals[((Enum)key).ordinal()] != null; } @@ -272,7 +268,6 @@ private boolean containsMapping(Object key, Object value) { * {@code null} with the specified key.) * @throws NullPointerException if the specified key is null */ - public @Nullable V put(K key, V value) { typeCheck(key); @@ -320,7 +315,6 @@ private boolean removeMapping(Object key, Object value) { * Returns true if key is of the proper type to be a key in this * enum map. */ - private boolean isValidKey(Object key) { if (key == null) return false; @@ -341,9 +335,6 @@ private boolean isValidKey(Object key) { * @throws NullPointerException the specified map is null, or if * one or more keys in the specified map are null */ - - @SuppressWarnings({"nullness:contracts.precondition.override.invalid"}) - public void putAll(Map m) { if (m instanceof EnumMap em) { if (em.keyType != keyType) { @@ -401,15 +392,12 @@ public Set keySet() { } private class KeySet extends AbstractSet { - public Iterator iterator() { return new KeyIterator(); } - - public int size() { + public int size() { return size; } - public boolean contains(Object o) { return containsKey(o); } @@ -443,15 +431,12 @@ public Collection values() { } private class Values extends AbstractCollection { - public Iterator iterator() { return new ValueIterator(); } - - public int size() { + public int size() { return size; } - public boolean contains(Object o) { return containsValue(o); } @@ -481,7 +466,6 @@ public void clear() { * * @return a set view of the mappings contained in this enum map */ - public Set> entrySet() { Set> es = entrySet; if (es != null) @@ -491,7 +475,6 @@ public Set> entrySet() { } private class EntrySet extends AbstractSet> { - public Iterator> iterator() { return new EntryIterator(); } @@ -504,24 +487,16 @@ public boolean remove(Object o) { return o instanceof Map.Entry entry && removeMapping(entry.getKey(), entry.getValue()); } - - public int size() { + public int size() { return size; } public void clear() { EnumMap.this.clear(); } - public Object[] toArray() { return fillEntryArray(new Object[size]); } - - - @SuppressWarnings({ - "unchecked", - "nullness:argument.type.incompatible", - "nullness:override.param.invalid" - }) + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { int size = size(); if (a.length < size) @@ -531,8 +506,6 @@ public T[] toArray(T[] a) { a[size] = null; return (T[]) fillEntryArray(a); } - - @SuppressWarnings({"nullness:argument.type.incompatible"}) private Object[] fillEntryArray(Object[] a) { int j = 0; for (int i = 0; i < vals.length; i++) @@ -582,8 +555,6 @@ public K next() { } private class ValueIterator extends EnumMapIterator { - - @SuppressWarnings({"nullness:return.type.incompatible"}) public V next() { if (!hasNext()) throw new NoSuchElementException(); @@ -622,15 +593,11 @@ public K getKey() { return keyUniverse[index]; } - - @SuppressWarnings("nullness:return.type.incompatible") public V getValue() { checkIndexForEntryUse(); return unmaskNull(vals[index]); } - - @SuppressWarnings("nullness:return.type.incompatible") public V setValue(V value) { checkIndexForEntryUse(); V oldValue = unmaskNull(vals[index]); @@ -747,8 +714,6 @@ public int hashCode() { return h; } - - @SuppressWarnings({"nullness:dereference.of.nullable"}) private int entryHashCode(int index) { return (keyUniverse[index].hashCode() ^ vals[index].hashCode()); } diff --git a/src/java.base/share/classes/java/util/EnumSet.java b/src/java.base/share/classes/java/util/EnumSet.java index 1c844188f59..3e73a4b4d63 100644 --- a/src/java.base/share/classes/java/util/EnumSet.java +++ b/src/java.base/share/classes/java/util/EnumSet.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import jdk.internal.access.SharedSecrets; diff --git a/src/java.base/share/classes/java/util/Enumeration.java b/src/java.base/share/classes/java/util/Enumeration.java index 155e2a7c5dd..b626b50c542 100644 --- a/src/java.base/share/classes/java/util/Enumeration.java +++ b/src/java.base/share/classes/java/util/Enumeration.java @@ -75,7 +75,6 @@ public interface Enumeration { * contains at least one more element to provide; * {@code false} otherwise. */ - boolean hasMoreElements(); /** diff --git a/src/java.base/share/classes/java/util/EventListener.java b/src/java.base/share/classes/java/util/EventListener.java index 5e9c2fced57..4b5a2eb3043 100644 --- a/src/java.base/share/classes/java/util/EventListener.java +++ b/src/java.base/share/classes/java/util/EventListener.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * A tagging interface that all event listener interfaces must extend. diff --git a/src/java.base/share/classes/java/util/EventListenerProxy.java b/src/java.base/share/classes/java/util/EventListenerProxy.java index dddc1518458..748277a2b42 100644 --- a/src/java.base/share/classes/java/util/EventListenerProxy.java +++ b/src/java.base/share/classes/java/util/EventListenerProxy.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * An abstract wrapper class for an {@code EventListener} class @@ -56,7 +55,7 @@ * @since 1.4 */ @NullMarked -public abstract class EventListenerProxy +public abstract class EventListenerProxy implements EventListener { private final T listener; diff --git a/src/java.base/share/classes/java/util/EventObject.java b/src/java.base/share/classes/java/util/EventObject.java index 5066ae0a678..674d543b308 100644 --- a/src/java.base/share/classes/java/util/EventObject.java +++ b/src/java.base/share/classes/java/util/EventObject.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** *

@@ -40,7 +39,7 @@ */ @NullMarked -public class EventObject implements java.io.Serializable { +public class EventObject implements java.io.Serializable { @java.io.Serial private static final long serialVersionUID = 5516075349620653480L; @@ -77,7 +76,6 @@ public Object getSource() { * * @return a String representation of this EventObject */ - public String toString() { return getClass().getName() + "[source=" + source + "]"; } diff --git a/src/java.base/share/classes/java/util/Formattable.java b/src/java.base/share/classes/java/util/Formattable.java index fc05ba65cb6..fe20bcd6674 100644 --- a/src/java.base/share/classes/java/util/Formattable.java +++ b/src/java.base/share/classes/java/util/Formattable.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.IOException; diff --git a/src/java.base/share/classes/java/util/FormattableFlags.java b/src/java.base/share/classes/java/util/FormattableFlags.java index e4db1f1c8fa..b503090c2d4 100644 --- a/src/java.base/share/classes/java/util/FormattableFlags.java +++ b/src/java.base/share/classes/java/util/FormattableFlags.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * FormattableFlags are passed to the {@link Formattable#formatTo diff --git a/src/java.base/share/classes/java/util/Formatter.java b/src/java.base/share/classes/java/util/Formatter.java index 2c757f76d75..425e5d4c7b8 100644 --- a/src/java.base/share/classes/java/util/Formatter.java +++ b/src/java.base/share/classes/java/util/Formatter.java @@ -2698,7 +2698,6 @@ private void ensureOpen() { * * @return This formatter */ - public Formatter format(String format, @Nullable Object ... args) { return format(l, format, args); } @@ -2738,7 +2737,6 @@ public Formatter format(String format, @Nullable Object ... args) { * * @return This formatter */ - public Formatter format(@Nullable Locale l, String format, @Nullable Object ... args) { ensureOpen(); diff --git a/src/java.base/share/classes/java/util/GregorianCalendar.java b/src/java.base/share/classes/java/util/GregorianCalendar.java index 375eb9b0924..0f8683845c8 100644 --- a/src/java.base/share/classes/java/util/GregorianCalendar.java +++ b/src/java.base/share/classes/java/util/GregorianCalendar.java @@ -370,7 +370,7 @@ public class GregorianCalendar extends Calendar { * * @see #ERA */ - public static final int BC = 0; + public static final int BC = 0; /** * Value of the {@link #ERA} field indicating @@ -388,7 +388,7 @@ public class GregorianCalendar extends Calendar { * * @see #ERA */ - public static final int AD = 1; + public static final int AD = 1; /** * Value of the {@link #ERA} field indicating @@ -830,7 +830,6 @@ public final Date getGregorianChange() { * @param year the given year. * @return {@code true} if the given year is a leap year; {@code false} otherwise. */ - public boolean isLeapYear(int year) { if ((year & 3) != 0) { return false; @@ -882,9 +881,8 @@ public String getCalendarType() { * {@code false} otherwise. * @see Calendar#compareTo(Calendar) */ - @Override - public boolean equals( @Nullable Object obj) { + public boolean equals(@Nullable Object obj) { return obj instanceof GregorianCalendar && super.equals(obj) && gregorianCutover == ((GregorianCalendar)obj).gregorianCutover; @@ -893,7 +891,6 @@ public boolean equals( @Nullable Object obj) { /** * Generates the hash code for this {@code GregorianCalendar} object. */ - @Override public int hashCode() { return super.hashCode() ^ (int)gregorianCutoverDate; @@ -1987,7 +1984,6 @@ private long getYearOffsetInMillis() { (internalGet(ZONE_OFFSET) + internalGet(DST_OFFSET)); } - @Override public Object clone() { diff --git a/src/java.base/share/classes/java/util/HashMap.java b/src/java.base/share/classes/java/util/HashMap.java index 08ade48a361..48b95b31662 100644 --- a/src/java.base/share/classes/java/util/HashMap.java +++ b/src/java.base/share/classes/java/util/HashMap.java @@ -447,7 +447,7 @@ static final int tableSizeFor(int cap) { * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ - public HashMap( int initialCapacity, float loadFactor) { + public HashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); @@ -471,7 +471,7 @@ public HashMap( int initialCapacity, float loadFactor) { * @param initialCapacity the initial capacity. * @throws IllegalArgumentException if the initial capacity is negative. */ - public HashMap( int initialCapacity) { + public HashMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); } @@ -560,8 +560,7 @@ final void putMapEntries(Map m, boolean evict) { * * @return the number of key-value mappings in this map */ - - public int size() { + public int size() { return size; } @@ -570,7 +569,6 @@ public int size() { * * @return {@code true} if this map contains no key-value mappings */ - public boolean isEmpty() { return size == 0; } @@ -592,7 +590,6 @@ public boolean isEmpty() { * * @see #put(Object, Object) */ - public @Nullable V get(@Nullable Object key) { Node e; return (e = getNode(key)) == null ? null : e.value; @@ -648,7 +645,6 @@ public boolean containsKey(@Nullable Object key) { * (A {@code null} return can also indicate that the map * previously associated {@code null} with {@code key}.) */ - public @Nullable V put(K key, V value) { return putVal(hash(key), key, value, false, true); } @@ -715,7 +711,6 @@ else if (p instanceof TreeNode) * * @return the table */ - @SuppressWarnings("cast.unsafe") // https://github.com/typetools/checker-framework/issues/2731 final Node[] resize() { Node[] oldTab = table; int oldCap = (oldTab == null) ? 0 : oldTab.length; @@ -915,7 +910,6 @@ public void clear() { * @return {@code true} if this map maps one or more keys to the * specified value */ - public boolean containsValue(@Nullable Object value) { Node[] tab; V v; if ((tab = table) != null && size > 0) { @@ -945,8 +939,7 @@ public boolean containsValue(@Nullable Object value) { * * @return a set view of the keys contained in this map */ - - public Set< K> keySet() { + public Set keySet() { Set ks = keySet; if (ks == null) { ks = new KeySet(); @@ -1024,16 +1017,13 @@ T[] valuesToArray(T[] a) { } final class KeySet extends AbstractSet { - - public final int size() { return size; } + public final int size() { return size; } public final void clear() { HashMap.this.clear(); } - public final Iterator iterator() { return new KeyIterator(); } public final boolean contains(Object o) { return containsKey(o); } public final boolean remove(Object key) { return removeNode(hash(key), key, null, false, true) != null; } - public final Spliterator spliterator() { return new KeySpliterator<>(HashMap.this, 0, -1, 0, 0); } @@ -1077,7 +1067,6 @@ public final void forEach(Consumer action) { * * @return a view of the values contained in this map */ - public Collection values() { Collection vs = values; if (vs == null) { @@ -1088,13 +1077,10 @@ public Collection values() { } final class Values extends AbstractCollection { - - public final int size() { return size; } + public final int size() { return size; } public final void clear() { HashMap.this.clear(); } - public final Iterator iterator() { return new ValueIterator(); } public final boolean contains(Object o) { return containsValue(o); } - public final Spliterator spliterator() { return new ValueSpliterator<>(HashMap.this, 0, -1, 0, 0); } @@ -1139,17 +1125,14 @@ public final void forEach(Consumer action) { * * @return a set view of the mappings contained in this map */ - - public Set> entrySet() { + public Set> entrySet() { Set> es; return (es = entrySet) == null ? (entrySet = new EntrySet()) : es; } final class EntrySet extends AbstractSet> { - - public final int size() { return size; } + public final int size() { return size; } public final void clear() { HashMap.this.clear(); } - public final Iterator> iterator() { return new EntryIterator(); } @@ -1168,7 +1151,6 @@ public final boolean remove(Object o) { } return false; } - public final Spliterator> spliterator() { return new EntrySpliterator<>(HashMap.this, 0, -1, 0, 0); } @@ -1196,7 +1178,6 @@ public final void forEach(Consumer> action) { return (e = getNode(key)) == null ? defaultValue : e.value; } - @Override public @Nullable V putIfAbsent(K key, V value) { return putVal(hash(key), key, value, true, true); @@ -1509,7 +1490,6 @@ public void replaceAll(BiFunction function) { * * @return a shallow copy of this map */ - @SuppressWarnings("unchecked") @Override public Object clone() { diff --git a/src/java.base/share/classes/java/util/HashSet.java b/src/java.base/share/classes/java/util/HashSet.java index 6dec5fcde2e..fc77d293fb6 100644 --- a/src/java.base/share/classes/java/util/HashSet.java +++ b/src/java.base/share/classes/java/util/HashSet.java @@ -139,7 +139,7 @@ public HashSet(Collection c) { * @throws IllegalArgumentException if the initial capacity is less * than zero, or if the load factor is nonpositive */ - public HashSet( int initialCapacity, float loadFactor) { + public HashSet(int initialCapacity, float loadFactor) { map = new HashMap<>(initialCapacity, loadFactor); } @@ -155,7 +155,7 @@ public HashSet( int initialCapacity, float loadFactor) { * @throws IllegalArgumentException if the initial capacity is less * than zero */ - public HashSet( int initialCapacity) { + public HashSet(int initialCapacity) { map = new HashMap<>(initialCapacity); } @@ -183,7 +183,6 @@ public HashSet( int initialCapacity) { * @return an Iterator over the elements in this set * @see ConcurrentModificationException */ - public Iterator iterator() { return map.keySet().iterator(); } @@ -193,8 +192,7 @@ public Iterator iterator() { * * @return the number of elements in this set (its cardinality) */ - - public int size() { + public int size() { return map.size(); } @@ -203,7 +201,6 @@ public int size() { * * @return {@code true} if this set contains no elements */ - public boolean isEmpty() { return map.isEmpty(); } @@ -217,7 +214,6 @@ public boolean isEmpty() { * @param o element whose presence in this set is to be tested * @return {@code true} if this set contains the specified element */ - public boolean contains(@Nullable Object o) { return map.containsKey(o); } @@ -268,7 +264,6 @@ public void clear() { * * @return a shallow copy of this set */ - @SuppressWarnings("unchecked") public Object clone() { try { diff --git a/src/java.base/share/classes/java/util/Hashtable.java b/src/java.base/share/classes/java/util/Hashtable.java index 901900e0573..faf900b8c43 100644 --- a/src/java.base/share/classes/java/util/Hashtable.java +++ b/src/java.base/share/classes/java/util/Hashtable.java @@ -25,7 +25,6 @@ package java.util; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; @@ -137,7 +136,6 @@ * @see TreeMap * @since 1.0 */ - @NullMarked public class Hashtable extends Dictionary @@ -190,7 +188,7 @@ public class Hashtable * @throws IllegalArgumentException if the initial capacity is less * than zero, or if the load factor is nonpositive. */ - public Hashtable( int initialCapacity, float loadFactor) { + public Hashtable(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity); @@ -212,7 +210,7 @@ public Hashtable( int initialCapacity, float loadFactor) { * @throws IllegalArgumentException if the initial capacity is less * than zero. */ - public Hashtable( int initialCapacity) { + public Hashtable(int initialCapacity) { this(initialCapacity, 0.75f); } @@ -252,8 +250,7 @@ public Hashtable(Map t) { * * @return the number of keys in this hashtable. */ - - public synchronized int size() { + public synchronized int size() { return count; } @@ -263,7 +260,6 @@ public synchronized int size() { * @return {@code true} if this hashtable maps no keys to values; * {@code false} otherwise. */ - public synchronized boolean isEmpty() { return count == 0; } @@ -280,7 +276,7 @@ public synchronized boolean isEmpty() { * @see #keySet() * @see Map */ - public synchronized Enumeration< K> keys() { + public synchronized Enumeration keys() { return this.getEnumeration(KEYS); } @@ -316,8 +312,7 @@ public synchronized Enumeration elements() { * {@code false} otherwise. * @throws NullPointerException if the value is {@code null} */ - - public synchronized boolean contains( Object value) { + public synchronized boolean contains(Object value) { if (value == null) { throw new NullPointerException(); } @@ -345,8 +340,7 @@ public synchronized boolean contains( Object value) { * @throws NullPointerException if the value is {@code null} * @since 1.2 */ - - public boolean containsValue( Object value) { + public boolean containsValue(Object value) { return contains(value); } @@ -360,9 +354,7 @@ public boolean containsValue( Object value) { * @throws NullPointerException if the key is {@code null} * @see #contains(Object) */ - - - public synchronized boolean containsKey( Object key) { + public synchronized boolean containsKey(Object key) { Entry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; @@ -389,9 +381,8 @@ public synchronized boolean containsKey( Object key) { * @throws NullPointerException if the specified key is null * @see #put(Object, Object) */ - @SuppressWarnings("unchecked") - public synchronized @Nullable V get( Object key) { + public synchronized @Nullable V get(Object key) { Entry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; @@ -482,7 +473,6 @@ private void addEntry(int hash, K key, V value, int index) { * @see Object#equals(Object) * @see #get(Object) */ - public synchronized @Nullable V put(K key, V value) { // Make sure the value is not null if (value == null) { @@ -571,7 +561,6 @@ public synchronized void clear() { * * @return a clone of the hashtable */ - public synchronized Object clone() { Hashtable t = cloneHashtable(); t.table = new Entry[table.length]; @@ -672,20 +661,17 @@ private Iterator getIterator(int type) { * * @since 1.2 */ - - public Set< K> keySet() { + public Set keySet() { if (keySet == null) keySet = Collections.synchronizedSet(new KeySet(), this); return keySet; } private class KeySet extends AbstractSet { - public Iterator iterator() { return getIterator(KEYS); } - - public int size() { + public int size() { return count; } public boolean contains(Object o) { @@ -715,15 +701,13 @@ public void clear() { * * @since 1.2 */ - - public Set> entrySet() { + public Set> entrySet() { if (entrySet==null) entrySet = Collections.synchronizedSet(new EntrySet(), this); return entrySet; } private class EntrySet extends AbstractSet> { - public Iterator> iterator() { return getIterator(ENTRIES); } @@ -772,8 +756,7 @@ public boolean remove(Object o) { return false; } - - public int size() { + public int size() { return count; } @@ -797,7 +780,6 @@ public void clear() { * * @since 1.2 */ - public Collection values() { if (values==null) values = Collections.synchronizedCollection(new ValueCollection(), @@ -806,12 +788,10 @@ public Collection values() { } private class ValueCollection extends AbstractCollection { - public Iterator iterator() { return getIterator(VALUES); } - - public int size() { + public int size() { return count; } public boolean contains(Object o) { @@ -833,8 +813,7 @@ public void clear() { * @see Map#equals(Object) * @since 1.2 */ - - public synchronized boolean equals( @Nullable Object o) { + public synchronized boolean equals(@Nullable Object o) { if (o == this) return true; @@ -869,7 +848,6 @@ public synchronized boolean equals( @Nullable Object o) { * @see Map#hashCode() * @since 1.2 */ - public synchronized int hashCode() { /* * This code detects the recursion caused by computing the hash code @@ -946,7 +924,6 @@ public synchronized void replaceAll(BiFunction next) { this.next = next; } - @SuppressWarnings("unchecked") protected Object clone() { return new Entry<>(hash, key, value, diff --git a/src/java.base/share/classes/java/util/IdentityHashMap.java b/src/java.base/share/classes/java/util/IdentityHashMap.java index 27acbc07dd0..860a3a69275 100644 --- a/src/java.base/share/classes/java/util/IdentityHashMap.java +++ b/src/java.base/share/classes/java/util/IdentityHashMap.java @@ -158,7 +158,6 @@ * @since 1.4 */ - @NullMarked public class IdentityHashMap extends AbstractMap @@ -244,7 +243,7 @@ public IdentityHashMap() { * @param expectedMaxSize the expected maximum size of the map * @throws IllegalArgumentException if {@code expectedMaxSize} is negative */ - public IdentityHashMap( int expectedMaxSize) { + public IdentityHashMap(int expectedMaxSize) { if (expectedMaxSize < 0) throw new IllegalArgumentException("expectedMaxSize is negative: " + expectedMaxSize); @@ -298,8 +297,7 @@ public IdentityHashMap(Map m) { * * @return the number of key-value mappings in this map */ - - public int size() { + public int size() { return size; } @@ -310,7 +308,6 @@ public int size() { * @return {@code true} if this identity hash map contains no key-value * mappings */ - public boolean isEmpty() { return size == 0; } @@ -348,7 +345,6 @@ private static int nextKeyIndex(int i, int len) { * * @see #put(Object, Object) */ - @SuppressWarnings("unchecked") public @Nullable V get(@Nullable Object key) { Object k = maskNull(key); @@ -375,8 +371,6 @@ private static int nextKeyIndex(int i, int len) { * in this map * @see #containsValue(Object) */ - - public boolean containsKey(@Nullable Object key) { Object k = maskNull(key); Object[] tab = table; @@ -402,7 +396,6 @@ public boolean containsKey(@Nullable Object key) { * specified object reference * @see #containsKey(Object) */ - public boolean containsValue(@Nullable Object value) { Object[] tab = table; for (int i = 1; i < tab.length; i += 2) @@ -451,7 +444,6 @@ private boolean containsMapping(Object key, Object value) { * @see #get(Object) * @see #containsKey(Object) */ - public @Nullable V put(K key, V value) { final Object k = maskNull(key); @@ -678,7 +670,6 @@ public void clear() { * @return {@code true} if the specified object is equal to this map * @see Object#equals(Object) */ - public boolean equals(@Nullable Object o) { if (o == this) { return true; @@ -722,7 +713,6 @@ public boolean equals(@Nullable Object o) { * @see Object#equals(Object) * @see #equals(Object) */ - public int hashCode() { int result = 0; Object[] tab = table; @@ -743,7 +733,6 @@ public int hashCode() { * * @return a shallow copy of this map */ - public Object clone() { try { IdentityHashMap m = (IdentityHashMap) super.clone(); @@ -1006,8 +995,7 @@ private void checkIndexForEntryUse() { * @see Object#equals(Object) * @see System#identityHashCode(Object) */ - - public Set< K> keySet() { + public Set keySet() { Set ks = keySet; if (ks == null) { ks = new KeySet(); @@ -1017,12 +1005,10 @@ public Set< K> keySet() { } private class KeySet extends AbstractSet { - public Iterator iterator() { return new KeyIterator(); } - - public int size() { + public int size() { return size; } public boolean contains(Object o) { @@ -1058,12 +1044,10 @@ public int hashCode() { result += System.identityHashCode(key); return result; } - public Object[] toArray() { return toArray(new Object[0]); } @SuppressWarnings("unchecked") - public T[] toArray(T[] a) { int expectedModCount = modCount; int size = size(); @@ -1092,7 +1076,6 @@ public T[] toArray(T[] a) { return a; } - public Spliterator spliterator() { return new KeySpliterator<>(IdentityHashMap.this, 0, -1, 0, 0); } @@ -1118,7 +1101,6 @@ public Spliterator spliterator() { * behavior of its {@code contains}, {@code remove} and * {@code containsAll} methods. */ - public Collection values() { Collection vs = values; if (vs == null) { @@ -1129,12 +1111,10 @@ public Collection values() { } private class Values extends AbstractCollection { - public Iterator iterator() { return new ValueIterator(); } - - public int size() { + public int size() { return size; } public boolean contains(Object o) { @@ -1152,12 +1132,10 @@ public boolean remove(Object o) { public void clear() { IdentityHashMap.this.clear(); } - public Object[] toArray() { return toArray(new Object[0]); } @SuppressWarnings("unchecked") - public T[] toArray(T[] a) { int expectedModCount = modCount; int size = size(); @@ -1185,7 +1163,6 @@ public T[] toArray(T[] a) { return a; } - public Spliterator spliterator() { return new ValueSpliterator<>(IdentityHashMap.this, 0, -1, 0, 0); } @@ -1231,8 +1208,7 @@ public Spliterator spliterator() { * * @return a set view of the identity-mappings contained in this map */ - - public Set> entrySet() { + public Set> entrySet() { Set> es = entrySet; if (es != null) return es; @@ -1241,7 +1217,6 @@ public Set> entrySet() { } private class EntrySet extends AbstractSet> { - public Iterator> iterator() { return new EntryIterator(); } @@ -1253,8 +1228,7 @@ public boolean remove(Object o) { return o instanceof Entry entry && removeMapping(entry.getKey(), entry.getValue()); } - - public int size() { + public int size() { return size; } public void clear() { @@ -1277,13 +1251,11 @@ public boolean removeAll(Collection c) { return modified; } - public Object[] toArray() { return toArray(new Object[0]); } @SuppressWarnings("unchecked") - public T[] toArray(T[] a) { int expectedModCount = modCount; int size = size(); @@ -1312,7 +1284,6 @@ public T[] toArray(T[] a) { return a; } - public Spliterator> spliterator() { return new EntrySpliterator<>(IdentityHashMap.this, 0, -1, 0, 0); } diff --git a/src/java.base/share/classes/java/util/IntSummaryStatistics.java b/src/java.base/share/classes/java/util/IntSummaryStatistics.java index 41a430d737f..6bd789740a1 100644 --- a/src/java.base/share/classes/java/util/IntSummaryStatistics.java +++ b/src/java.base/share/classes/java/util/IntSummaryStatistics.java @@ -25,7 +25,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.function.IntConsumer; import java.util.stream.Collector; diff --git a/src/java.base/share/classes/java/util/Iterator.java b/src/java.base/share/classes/java/util/Iterator.java index 8659267b083..c9b047416e5 100644 --- a/src/java.base/share/classes/java/util/Iterator.java +++ b/src/java.base/share/classes/java/util/Iterator.java @@ -58,9 +58,7 @@ * @see Iterable * @since 1.2 */ - @NullMarked - public interface Iterator { /** * Returns {@code true} if the iteration has more elements. @@ -69,7 +67,6 @@ public interface Iterator { * * @return {@code true} if the iteration has more elements */ - boolean hasNext(); /** diff --git a/src/java.base/share/classes/java/util/LinkedHashMap.java b/src/java.base/share/classes/java/util/LinkedHashMap.java index eb9e26ca14e..b78530c439e 100644 --- a/src/java.base/share/classes/java/util/LinkedHashMap.java +++ b/src/java.base/share/classes/java/util/LinkedHashMap.java @@ -439,7 +439,7 @@ void internalWriteEntries(java.io.ObjectOutputStream s) throws IOException { * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ - public LinkedHashMap( int initialCapacity, float loadFactor) { + public LinkedHashMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); accessOrder = false; } @@ -455,7 +455,7 @@ public LinkedHashMap( int initialCapacity, float loadFactor) { * @param initialCapacity the initial capacity * @throws IllegalArgumentException if the initial capacity is negative */ - public LinkedHashMap( int initialCapacity) { + public LinkedHashMap(int initialCapacity) { super(initialCapacity); accessOrder = false; } @@ -496,7 +496,7 @@ public LinkedHashMap(Map m) { * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ - public LinkedHashMap( int initialCapacity, + public LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder) { super(initialCapacity, loadFactor); @@ -512,7 +512,6 @@ public LinkedHashMap( int initialCapacity, * @return {@code true} if this map maps one or more keys to the * specified value */ - public boolean containsValue(@Nullable Object value) { for (LinkedHashMap.Entry e = head; e != null; e = e.after) { V v = e.value; @@ -537,7 +536,6 @@ public boolean containsValue(@Nullable Object value) { * The {@link #containsKey containsKey} operation may be used to * distinguish these two cases. */ - public @Nullable V get(@Nullable Object key) { Node e; if ((e = getNode(key)) == null) @@ -703,7 +701,6 @@ final class LinkedKeySet extends AbstractSet implements SequencedSet { LinkedKeySet(boolean reversed) { this.reversed = reversed; } public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } - public final Iterator iterator() { return new LinkedKeyIterator(reversed); } @@ -711,7 +708,6 @@ public final Iterator iterator() { public final boolean remove(Object key) { return removeNode(hash(key), key, null, false, true) != null; } - public final Spliterator spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED | @@ -813,12 +809,10 @@ final class LinkedValues extends AbstractCollection implements SequencedColle LinkedValues(boolean reversed) { this.reversed = reversed; } public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } - public final Iterator iterator() { return new LinkedValueIterator(reversed); } public final boolean contains(Object o) { return containsValue(o); } - public final Spliterator spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED); @@ -921,7 +915,6 @@ final class LinkedEntrySet extends AbstractSet> LinkedEntrySet(boolean reversed) { this.reversed = reversed; } public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } - public final Iterator> iterator() { return new LinkedEntryIterator(reversed); } @@ -940,7 +933,6 @@ public final boolean remove(Object o) { } return false; } - public final Spliterator> spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED | diff --git a/src/java.base/share/classes/java/util/LinkedHashSet.java b/src/java.base/share/classes/java/util/LinkedHashSet.java index 3eeaec0bd21..11625e6c55d 100644 --- a/src/java.base/share/classes/java/util/LinkedHashSet.java +++ b/src/java.base/share/classes/java/util/LinkedHashSet.java @@ -122,7 +122,6 @@ * @since 1.4 */ - @NullMarked public class LinkedHashSet extends HashSet diff --git a/src/java.base/share/classes/java/util/LinkedList.java b/src/java.base/share/classes/java/util/LinkedList.java index 5428293b332..3a2f52f0f68 100644 --- a/src/java.base/share/classes/java/util/LinkedList.java +++ b/src/java.base/share/classes/java/util/LinkedList.java @@ -90,7 +90,6 @@ * @param the type of elements held in this collection */ - @NullMarked public class LinkedList extends AbstractSequentialList @@ -330,7 +329,6 @@ public void addLast(E e) { * @param o element whose presence in this list is to be tested * @return {@code true} if this list contains the specified element */ - public boolean contains(@Nullable Object o) { return indexOf(o) >= 0; } @@ -340,8 +338,7 @@ public boolean contains(@Nullable Object o) { * * @return the number of elements in this list */ - - public int size() { + public int size() { return size; } @@ -353,7 +350,6 @@ public int size() { * @param e element to be appended to this list * @return {@code true} (as specified by {@link Collection#add}) */ - public boolean add(E e) { linkLast(e); return true; @@ -372,7 +368,6 @@ public boolean add(E e) { * @param o element to be removed from this list, if present * @return {@code true} if this list contained the specified element */ - public boolean remove(@Nullable Object o) { if (o == null) { for (Node x = first; x != null; x = x.next) { @@ -423,7 +418,7 @@ public boolean addAll(Collection c) { * @throws IndexOutOfBoundsException {@inheritDoc} * @throws NullPointerException if the specified collection is null */ - public boolean addAll( int index, Collection c) { + public boolean addAll(int index, Collection c) { checkPositionIndex(index); Object[] a = c.toArray(); @@ -493,8 +488,7 @@ public void clear() { * @return the element at the specified position in this list * @throws IndexOutOfBoundsException {@inheritDoc} */ - - public E get( int index) { + public E get(int index) { checkElementIndex(index); return node(index).item; } @@ -508,7 +502,7 @@ public E get( int index) { * @return the element previously at the specified position * @throws IndexOutOfBoundsException {@inheritDoc} */ - public E set( int index, E element) { + public E set(int index, E element) { checkElementIndex(index); Node x = node(index); E oldVal = x.item; @@ -525,7 +519,7 @@ public E set( int index, E element) { * @param element element to be inserted * @throws IndexOutOfBoundsException {@inheritDoc} */ - public void add( int index, E element) { + public void add(int index, E element) { checkPositionIndex(index); if (index == size) @@ -543,7 +537,7 @@ public void add( int index, E element) { * @return the element previously at the specified position * @throws IndexOutOfBoundsException {@inheritDoc} */ - public E remove( int index) { + public E remove(int index) { checkElementIndex(index); return unlink(node(index)); } @@ -551,7 +545,7 @@ public E remove( int index) { /** * Tells if the argument is the index of an existing element. */ - private boolean isElementIndex( int index) { + private boolean isElementIndex(int index) { return index >= 0 && index < size; } @@ -559,7 +553,7 @@ private boolean isElementIndex( int index) { * Tells if the argument is the index of a valid position for an * iterator or an add operation. */ - private boolean isPositionIndex( int index) { + private boolean isPositionIndex(int index) { return index >= 0 && index <= size; } @@ -568,16 +562,16 @@ private boolean isPositionIndex( int index) { * Of the many possible refactorings of the error handling code, * this "outlining" performs best with both server and client VMs. */ - private String outOfBoundsMsg( int index) { + private String outOfBoundsMsg(int index) { return "Index: "+index+", Size: "+size; } - private void checkElementIndex( int index) { + private void checkElementIndex(int index) { if (!isElementIndex(index)) throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); } - private void checkPositionIndex( int index) { + private void checkPositionIndex(int index) { if (!isPositionIndex(index)) throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); } @@ -585,7 +579,7 @@ private void checkPositionIndex( int index) { /** * Returns the (non-null) Node at the specified element index. */ - Node node( int index) { + Node node(int index) { // assert isElementIndex(index); if (index < (size >> 1)) { @@ -614,8 +608,7 @@ Node node( int index) { * @return the index of the first occurrence of the specified element in * this list, or -1 if this list does not contain the element */ - - public int indexOf(@Nullable Object o) { + public int indexOf(@Nullable Object o) { int index = 0; if (o == null) { for (Node x = first; x != null; x = x.next) { @@ -644,8 +637,7 @@ public int indexOf(@Nullable Object o) { * @return the index of the last occurrence of the specified element in * this list, or -1 if this list does not contain the element */ - - public int lastIndexOf(@Nullable Object o) { + public int lastIndexOf(@Nullable Object o) { int index = size; if (o == null) { for (Node x = last; x != null; x = x.prev) { @@ -887,7 +879,7 @@ public boolean removeLastOccurrence(@Nullable Object o) { * @throws IndexOutOfBoundsException {@inheritDoc} * @see List#listIterator(int) */ - public ListIterator listIterator( int index) { + public ListIterator listIterator(int index) { checkPositionIndex(index); return new ListItr(index); } @@ -1041,7 +1033,6 @@ private LinkedList superClone() { * * @return a shallow copy of this {@code LinkedList} instance */ - public Object clone() { LinkedList clone = superClone(); @@ -1071,7 +1062,6 @@ public Object clone() { * @return an array containing all of the elements in this list * in proper sequence */ - public @Nullable Object[] toArray() { Object[] result = new Object[size]; int i = 0; @@ -1118,7 +1108,6 @@ public Object clone() { * this list * @throws NullPointerException if the specified array is null */ - @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length < size) @@ -1195,7 +1184,6 @@ private void readObject(java.io.ObjectInputStream s) * @return a {@code Spliterator} over the elements in this list * @since 1.8 */ - @Override public Spliterator spliterator() { return new LLSpliterator<>(this, -1, 0); diff --git a/src/java.base/share/classes/java/util/List.java b/src/java.base/share/classes/java/util/List.java index 1fe5f27c1e8..cf3336b1917 100644 --- a/src/java.base/share/classes/java/util/List.java +++ b/src/java.base/share/classes/java/util/List.java @@ -157,15 +157,13 @@ public interface List extends SequencedCollection * * @return the number of elements in this list */ - - int size(); + int size(); /** * Returns {@code true} if this list contains no elements. * * @return {@code true} if this list contains no elements */ - boolean isEmpty(); /** @@ -183,7 +181,6 @@ public interface List extends SequencedCollection * list does not permit null elements * (optional) */ - boolean contains(@Nullable Object o); /** @@ -191,7 +188,6 @@ public interface List extends SequencedCollection * * @return an iterator over the elements in this list in proper sequence */ - Iterator iterator(); /** @@ -210,7 +206,6 @@ public interface List extends SequencedCollection * sequence * @see Arrays#asList(Object[]) */ - @Nullable Object[] toArray(); /** @@ -252,7 +247,6 @@ public interface List extends SequencedCollection * this list * @throws NullPointerException if the specified array is null */ - T[] toArray(T[] a); @@ -280,7 +274,6 @@ public interface List extends SequencedCollection * @throws IllegalArgumentException if some property of this element * prevents it from being added to this list */ - boolean add(E e); /** @@ -327,7 +320,6 @@ public interface List extends SequencedCollection * or if the specified collection is null * @see #contains(Object) */ - boolean containsAll(Collection c); /** @@ -380,7 +372,7 @@ public interface List extends SequencedCollection * @throws IndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index > size()}) */ - boolean addAll( int index, Collection c); + boolean addAll(int index, Collection c); /** * Removes from this list all of its elements that are contained in the @@ -555,7 +547,6 @@ default void sort(@Nullable Comparator c) { * @param o the object to be compared for equality with this list * @return {@code true} if the specified object is equal to this list */ - boolean equals(@Nullable Object o); /** @@ -575,7 +566,6 @@ default void sort(@Nullable Comparator c) { * @see Object#equals(Object) * @see #equals(Object) */ - int hashCode(); @@ -589,8 +579,7 @@ default void sort(@Nullable Comparator c) { * @throws IndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ - - E get( int index); + E get(int index); /** * Replaces the element at the specified position in this list with the @@ -610,7 +599,7 @@ default void sort(@Nullable Comparator c) { * @throws IndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ - E set( int index, E element); + E set(int index, E element); /** * Inserts the specified element at the specified position in this list @@ -631,8 +620,7 @@ default void sort(@Nullable Comparator c) { * @throws IndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index > size()}) */ - - void add( int index, E element); + void add(int index, E element); /** * Removes the element at the specified position in this list (optional @@ -647,8 +635,7 @@ default void sort(@Nullable Comparator c) { * @throws IndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ - - E remove( int index); + E remove(int index); // Search Operations @@ -670,7 +657,6 @@ default void sort(@Nullable Comparator c) { * list does not permit null elements * (optional) */ - int indexOf(@Nullable Object o); /** @@ -690,7 +676,6 @@ default void sort(@Nullable Comparator c) { * list does not permit null elements * (optional) */ - int lastIndexOf(@Nullable Object o); @@ -720,7 +705,7 @@ default void sort(@Nullable Comparator c) { * @throws IndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index > size()}) */ - ListIterator listIterator( int index); + ListIterator listIterator(int index); // View @@ -758,8 +743,7 @@ default void sort(@Nullable Comparator c) { * ({@code fromIndex < 0 || toIndex > size || * fromIndex > toIndex}) */ - - List subList( int fromIndex, int toIndex); + List subList(int fromIndex, int toIndex); /** * Creates a {@link Spliterator} over the elements in this list. @@ -794,7 +778,6 @@ default void sort(@Nullable Comparator c) { * @return a {@code Spliterator} over the elements in this list * @since 1.8 */ - @Override default Spliterator spliterator() { if (this instanceof RandomAccess) { diff --git a/src/java.base/share/classes/java/util/ListIterator.java b/src/java.base/share/classes/java/util/ListIterator.java index 7f9c1f9e10b..e7a4b22fcc4 100644 --- a/src/java.base/share/classes/java/util/ListIterator.java +++ b/src/java.base/share/classes/java/util/ListIterator.java @@ -75,7 +75,6 @@ public interface ListIterator extends Iterator { * @return {@code true} if the list iterator has more elements when * traversing the list in the forward direction */ - // @Pure is not necessary here: it's inherited from Iterator boolean hasNext(); /** @@ -99,7 +98,6 @@ public interface ListIterator extends Iterator { * @return {@code true} if the list iterator has more elements when * traversing the list in the reverse direction */ - boolean hasPrevious(); /** @@ -125,8 +123,7 @@ public interface ListIterator extends Iterator { * subsequent call to {@code next}, or list size if the list * iterator is at the end of the list */ - - int nextIndex(); + int nextIndex(); /** * Returns the index of the element that would be returned by a @@ -137,8 +134,7 @@ public interface ListIterator extends Iterator { * subsequent call to {@code previous}, or -1 if the list * iterator is at the beginning of the list */ - - int previousIndex(); + int previousIndex(); // Modification Operations diff --git a/src/java.base/share/classes/java/util/Locale.java b/src/java.base/share/classes/java/util/Locale.java index 4d8cd1d028b..4f1096488e9 100644 --- a/src/java.base/share/classes/java/util/Locale.java +++ b/src/java.base/share/classes/java/util/Locale.java @@ -769,7 +769,7 @@ public enum IsoCountryCode { /** * Private constructor used by getInstance method */ - private Locale(BaseLocale baseLocale, LocaleExtensions extensions) { + private Locale(BaseLocale baseLocale, LocaleExtensions extensions) { this.baseLocale = baseLocale; this.localeExtensions = extensions; } @@ -1008,7 +1008,7 @@ public Locale apply(Object key) { private static final class LocaleKey { private final BaseLocale base; - private final LocaleExtensions exts; + private final LocaleExtensions exts; private final int hash; private LocaleKey(BaseLocale baseLocale, LocaleExtensions extensions) { @@ -1346,7 +1346,7 @@ public String getScript() { * @return The country/region code, or the empty string if none is defined. * @see #getDisplayCountry */ - public String getCountry() { + public String getCountry() { return baseLocale.getRegion(); } @@ -1356,7 +1356,7 @@ public String getCountry() { * @return The variant code, or the empty string if none is defined. * @see #getDisplayVariant */ - public String getVariant() { + public String getVariant() { return baseLocale.getVariant(); } @@ -1534,7 +1534,6 @@ LocaleExtensions getLocaleExtensions() { * @see #getDisplayName * @see #toLanguageTag */ - @Override public final String toString() { boolean l = !baseLocale.getLanguage().isEmpty(); @@ -2260,7 +2259,6 @@ public String getDisplayName(Locale inLocale) { /** * Overrides Cloneable. */ - @Override public Object clone() { @@ -2277,7 +2275,6 @@ public Object clone() * Since Locales are often used in hashtables, caches the value * for speed. */ - @Override public int hashCode() { int hc = hashCodeValue; @@ -2300,7 +2297,6 @@ public int hashCode() { * * @return true if this Locale is equal to the specified object. */ - @Override public boolean equals(@Nullable Object obj) { if (this == obj) // quick check @@ -2328,8 +2324,8 @@ public boolean equals(@Nullable Object obj) { private transient @Stable int hashCodeValue; private static volatile Locale defaultLocale = initDefault(); - private static volatile Locale defaultDisplayLocale; - private static volatile Locale defaultFormatLocale; + private static volatile Locale defaultDisplayLocale; + private static volatile Locale defaultFormatLocale; private final transient LazyConstant languageTag = LazyConstant.of(new Supplier<>() { @@ -3482,7 +3478,6 @@ public int hashCode() { * {@code weight} are the same as the {@code obj}'s; {@code false} * otherwise. */ - @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/src/java.base/share/classes/java/util/LongSummaryStatistics.java b/src/java.base/share/classes/java/util/LongSummaryStatistics.java index 4ea4d78618e..eb315c6401c 100644 --- a/src/java.base/share/classes/java/util/LongSummaryStatistics.java +++ b/src/java.base/share/classes/java/util/LongSummaryStatistics.java @@ -25,7 +25,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.function.IntConsumer; import java.util.function.LongConsumer; diff --git a/src/java.base/share/classes/java/util/Map.java b/src/java.base/share/classes/java/util/Map.java index 30f70317d7b..aceb6e6b401 100644 --- a/src/java.base/share/classes/java/util/Map.java +++ b/src/java.base/share/classes/java/util/Map.java @@ -168,7 +168,6 @@ * @see Set * @since 1.2 */ - @NullMarked public interface Map { // Query Operations @@ -180,15 +179,13 @@ public interface Map { * * @return the number of key-value mappings in this map */ - - int size(); + int size(); /** * Returns {@code true} if this map contains no key-value mappings. * * @return {@code true} if this map contains no key-value mappings */ - boolean isEmpty(); /** @@ -206,8 +203,6 @@ public interface Map { * @throws NullPointerException if the specified key is null and this map * does not permit null keys ({@linkplain Collection##optional-restrictions optional}) */ - - boolean containsKey(@Nullable Object key); /** @@ -226,7 +221,6 @@ public interface Map { * @throws NullPointerException if the specified value is null and this * map does not permit null values ({@linkplain Collection##optional-restrictions optional}) */ - boolean containsValue(@Nullable Object value); /** @@ -253,7 +247,6 @@ public interface Map { * @throws NullPointerException if the specified key is null and this map * does not permit null keys ({@linkplain Collection##optional-restrictions optional}) */ - @Nullable V get(@Nullable Object key); // Modification Operations @@ -282,8 +275,6 @@ public interface Map { * @throws IllegalArgumentException if some property of the specified key * or value prevents it from being stored in this map */ - - @Nullable V put(K key, V value); /** @@ -369,8 +360,7 @@ public interface Map { * * @return a set view of the keys contained in this map */ - - Set< K> keySet(); + Set keySet(); /** * Returns a {@link Collection} view of the values contained in this map. @@ -387,7 +377,6 @@ public interface Map { * * @return a collection view of the values contained in this map */ - Collection values(); /** @@ -406,8 +395,7 @@ public interface Map { * * @return a set view of the mappings contained in this map */ - - Set> entrySet(); + Set> entrySet(); /** * A map entry (key-value pair). The Entry may be unmodifiable, or the @@ -467,7 +455,6 @@ public interface Map { * @see Map#entrySet() * @since 1.2 */ - interface Entry { /** * Returns the key corresponding to this entry. @@ -477,7 +464,6 @@ interface Entry { * required to, throw this exception if the entry has been * removed from the backing map. */ - K getKey(); /** @@ -490,7 +476,6 @@ interface Entry { * required to, throw this exception if the entry has been * removed from the backing map. */ - V getValue(); /** @@ -533,8 +518,7 @@ interface Entry { * @return {@code true} if the specified object is equal to this map * entry */ - - boolean equals( @Nullable Object o); + boolean equals(@Nullable Object o); /** * Returns the hash code value for this map entry. The hash code @@ -552,7 +536,6 @@ interface Entry { * @see Object#equals(Object) * @see #equals(Object) */ - int hashCode(); /** @@ -673,7 +656,7 @@ public static Map.Entry copyOf(Map.Entry * @param o object to be compared for equality with this map * @return {@code true} if the specified object is equal to this map */ - boolean equals( @Nullable Object o); + boolean equals(@Nullable Object o); /** * Returns the hash code value for this map. The hash code of a map is @@ -861,7 +844,6 @@ default void replaceAll(BiFunction function) * ({@linkplain Collection##optional-restrictions optional}) * @since 1.8 */ - default @Nullable V putIfAbsent(K key, V value) { V v = get(key); if (v == null) { diff --git a/src/java.base/share/classes/java/util/NavigableMap.java b/src/java.base/share/classes/java/util/NavigableMap.java index 4b1aadf28b3..0ff10993763 100644 --- a/src/java.base/share/classes/java/util/NavigableMap.java +++ b/src/java.base/share/classes/java/util/NavigableMap.java @@ -103,7 +103,6 @@ * @param the type of mapped values * @since 1.6 */ - @NullMarked public interface NavigableMap extends SortedMap { /** @@ -281,7 +280,6 @@ public interface NavigableMap descendingMap(); /** @@ -298,8 +296,7 @@ public interface NavigableMap navigableKeySet(); + NavigableSet navigableKeySet(); /** * Returns a reverse order {@link NavigableSet} view of the keys contained in this map. @@ -315,8 +312,7 @@ public interface NavigableMap descendingKeySet(); + NavigableSet descendingKeySet(); /** * Returns a view of the portion of this map whose keys range from @@ -352,7 +348,6 @@ public interface NavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive); @@ -383,7 +378,6 @@ NavigableMap subMap(K fromKey, boolean fromInclusive, * restricted range, and {@code toKey} lies outside the * bounds of the range */ - NavigableMap headMap(K toKey, boolean inclusive); /** @@ -413,7 +407,6 @@ NavigableMap subMap(K fromKey, boolean fromInclusive, * restricted range, and {@code fromKey} lies outside the * bounds of the range */ - NavigableMap tailMap(K fromKey, boolean inclusive); /** @@ -425,7 +418,6 @@ NavigableMap subMap(K fromKey, boolean fromInclusive, * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - SortedMap subMap(K fromKey, K toKey); /** @@ -437,7 +429,6 @@ NavigableMap subMap(K fromKey, boolean fromInclusive, * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - SortedMap headMap(K toKey); /** @@ -449,7 +440,6 @@ NavigableMap subMap(K fromKey, boolean fromInclusive, * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - SortedMap tailMap(K fromKey); /** diff --git a/src/java.base/share/classes/java/util/NavigableSet.java b/src/java.base/share/classes/java/util/NavigableSet.java index 934aee4b997..03e8680252f 100644 --- a/src/java.base/share/classes/java/util/NavigableSet.java +++ b/src/java.base/share/classes/java/util/NavigableSet.java @@ -90,7 +90,6 @@ * @param the type of elements maintained by this set * @since 1.6 */ - @NullMarked public interface NavigableSet extends SortedSet { /** @@ -176,7 +175,6 @@ public interface NavigableSet extends SortedSet { * * @return an iterator over the elements in this set, in ascending order */ - Iterator iterator(); /** @@ -239,9 +237,8 @@ public interface NavigableSet extends SortedSet { * has a restricted range, and {@code fromElement} or * {@code toElement} lies outside the bounds of the range. */ - - NavigableSet subSet( E fromElement, boolean fromInclusive, - E toElement, boolean toInclusive); + NavigableSet subSet(E fromElement, boolean fromInclusive, + E toElement, boolean toInclusive); /** * Returns a view of the portion of this set whose elements are less than @@ -270,8 +267,7 @@ NavigableSet subSet( E fromElement, boolean fromInclusive, * restricted range, and {@code toElement} lies outside the * bounds of the range */ - - NavigableSet headSet( E toElement, boolean inclusive); + NavigableSet headSet(E toElement, boolean inclusive); /** * Returns a view of the portion of this set whose elements are greater @@ -300,8 +296,7 @@ NavigableSet subSet( E fromElement, boolean fromInclusive, * restricted range, and {@code fromElement} lies outside the * bounds of the range */ - - NavigableSet tailSet( E fromElement, boolean inclusive); + NavigableSet tailSet(E fromElement, boolean inclusive); /** * {@inheritDoc} @@ -312,8 +307,7 @@ NavigableSet subSet( E fromElement, boolean fromInclusive, * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - - SortedSet subSet( E fromElement, E toElement); + SortedSet subSet(E fromElement, E toElement); /** * {@inheritDoc} @@ -324,7 +318,6 @@ NavigableSet subSet( E fromElement, boolean fromInclusive, * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - SortedSet headSet(E toElement); /** @@ -336,7 +329,6 @@ NavigableSet subSet( E fromElement, boolean fromInclusive, * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ - SortedSet tailSet(E fromElement); /** diff --git a/src/java.base/share/classes/java/util/Observable.java b/src/java.base/share/classes/java/util/Observable.java index 424b050e2b1..8c3a99f697f 100644 --- a/src/java.base/share/classes/java/util/Observable.java +++ b/src/java.base/share/classes/java/util/Observable.java @@ -75,7 +75,6 @@ * For reactive streams style programming, see the * {@link java.util.concurrent.Flow} API. */ - @NullMarked @Deprecated(since="9") @SuppressWarnings("doclint:reference") // cross-module links @@ -227,7 +226,7 @@ public synchronized boolean hasChanged() { * * @return the number of observers of this object. */ - public synchronized int countObservers() { + public synchronized int countObservers() { return obs.size(); } } diff --git a/src/java.base/share/classes/java/util/Observer.java b/src/java.base/share/classes/java/util/Observer.java index 126717485f6..542d79af127 100644 --- a/src/java.base/share/classes/java/util/Observer.java +++ b/src/java.base/share/classes/java/util/Observer.java @@ -39,7 +39,6 @@ * This interface has been deprecated. See the {@link Observable} * class for further information. */ - @NullMarked @Deprecated(since="9") public interface Observer { diff --git a/src/java.base/share/classes/java/util/Optional.java b/src/java.base/share/classes/java/util/Optional.java index decddb3d3aa..103c9e3a7be 100644 --- a/src/java.base/share/classes/java/util/Optional.java +++ b/src/java.base/share/classes/java/util/Optional.java @@ -155,7 +155,7 @@ public static Optional ofNullable(@Nullable T value) { * @return the non-{@code null} value described by this {@code Optional} * @throws NoSuchElementException if no value is present */ - public T get() { + public T get() { if (value == null) { throw new NoSuchElementException("No value present"); } @@ -167,7 +167,6 @@ public T get() { * * @return {@code true} if a value is present, otherwise {@code false} */ - public boolean isPresent() { return value != null; } @@ -179,7 +178,6 @@ public boolean isPresent() { * @return {@code true} if a value is not present, otherwise {@code false} * @since 11 */ - public boolean isEmpty() { return value == null; } @@ -439,8 +437,6 @@ public T orElseThrow(Supplier exceptionSuppli * otherwise {@code false} */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/util/OptionalDouble.java b/src/java.base/share/classes/java/util/OptionalDouble.java index cbb67c8513a..eb75e4a9655 100644 --- a/src/java.base/share/classes/java/util/OptionalDouble.java +++ b/src/java.base/share/classes/java/util/OptionalDouble.java @@ -161,7 +161,6 @@ public boolean isPresent() { * @return {@code true} if a value is not present, otherwise {@code false} * @since 11 */ - public boolean isEmpty() { return !isPresent; } @@ -304,8 +303,6 @@ public double orElseThrow(Supplier exceptionSu * otherwise {@code false} */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/util/OptionalInt.java b/src/java.base/share/classes/java/util/OptionalInt.java index 284016b9eb3..6433709487d 100644 --- a/src/java.base/share/classes/java/util/OptionalInt.java +++ b/src/java.base/share/classes/java/util/OptionalInt.java @@ -161,7 +161,6 @@ public boolean isPresent() { * @return {@code true} if a value is not present, otherwise {@code false} * @since 11 */ - public boolean isEmpty() { return !isPresent; } @@ -302,8 +301,6 @@ public int orElseThrow(Supplier exceptionSuppl * otherwise {@code false} */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/util/OptionalLong.java b/src/java.base/share/classes/java/util/OptionalLong.java index 0b6e5f3fb4b..8e8dbc1884f 100644 --- a/src/java.base/share/classes/java/util/OptionalLong.java +++ b/src/java.base/share/classes/java/util/OptionalLong.java @@ -161,7 +161,6 @@ public boolean isPresent() { * @return {@code true} if a value is not present, otherwise {@code false} * @since 11 */ - public boolean isEmpty() { return !isPresent; } @@ -302,8 +301,6 @@ public long orElseThrow(Supplier exceptionSupp * otherwise {@code false} */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/java/util/PrimitiveIterator.java b/src/java.base/share/classes/java/util/PrimitiveIterator.java index 37f1642d29c..5c0c8255ad3 100644 --- a/src/java.base/share/classes/java/util/PrimitiveIterator.java +++ b/src/java.base/share/classes/java/util/PrimitiveIterator.java @@ -114,7 +114,6 @@ public static interface OfInt extends PrimitiveIterator { * action.accept(nextInt()); * } */ - @Override default void forEachRemaining(IntConsumer action) { Objects.requireNonNull(action); while (hasNext()) @@ -183,7 +182,6 @@ public static interface OfLong extends PrimitiveIterator { * action.accept(nextLong()); * } */ - @Override default void forEachRemaining(LongConsumer action) { Objects.requireNonNull(action); while (hasNext()) @@ -251,7 +249,6 @@ public static interface OfDouble extends PrimitiveIterator */ - @Override default void forEachRemaining(DoubleConsumer action) { Objects.requireNonNull(action); while (hasNext()) diff --git a/src/java.base/share/classes/java/util/PriorityQueue.java b/src/java.base/share/classes/java/util/PriorityQueue.java index 353626d117e..e4fc5bd367f 100644 --- a/src/java.base/share/classes/java/util/PriorityQueue.java +++ b/src/java.base/share/classes/java/util/PriorityQueue.java @@ -86,7 +86,6 @@ * @author Josh Bloch, Doug Lea * @param the type of elements held in this queue */ - @NullMarked @SuppressWarnings("unchecked") public class PriorityQueue extends AbstractQueue @@ -143,7 +142,7 @@ public PriorityQueue() { * @throws IllegalArgumentException if {@code initialCapacity} is less * than 1 */ - public PriorityQueue( int initialCapacity) { + public PriorityQueue(int initialCapacity) { this(initialCapacity, null); } @@ -171,7 +170,7 @@ public PriorityQueue(@Nullable Comparator comparator) { * @throws IllegalArgumentException if {@code initialCapacity} is * less than 1 */ - public PriorityQueue( int initialCapacity, + public PriorityQueue(int initialCapacity, @Nullable Comparator comparator) { // Note: This restriction of at least one is not actually needed, // but continues for 1.5 compatibility @@ -421,7 +420,6 @@ void removeEq(Object o) { * @param o object to be checked for containment in this queue * @return {@code true} if this queue contains the specified element */ - public boolean contains(@Nullable Object o) { return indexOf(o) >= 0; } @@ -439,7 +437,6 @@ public boolean contains(@Nullable Object o) { * * @return an array containing all of the elements in this queue */ - public Object[] toArray() { return Arrays.copyOf(queue, size); } @@ -480,7 +477,6 @@ public Object[] toArray() { * this queue * @throws NullPointerException if the specified array is null */ - public T[] toArray(T[] a) { final int size = this.size; if (a.length < size) @@ -498,7 +494,6 @@ public Object[] toArray() { * * @return an iterator over the elements in this queue */ - public Iterator iterator() { return new Itr(); } @@ -587,8 +582,7 @@ public void remove() { } } - - public int size() { + public int size() { return size; } @@ -779,7 +773,6 @@ private void heapify() { * {@code null} if this queue is sorted according to the * natural ordering of its elements */ - public @Nullable Comparator comparator() { return comparator; } diff --git a/src/java.base/share/classes/java/util/Properties.java b/src/java.base/share/classes/java/util/Properties.java index de951aec192..61f6259d179 100644 --- a/src/java.base/share/classes/java/util/Properties.java +++ b/src/java.base/share/classes/java/util/Properties.java @@ -231,7 +231,7 @@ private Properties(Properties defaults, int initialCapacity) { * @see #getProperty * @since 1.2 */ - public synchronized @Nullable Object setProperty( String key, String value) { + public synchronized @Nullable Object setProperty(String key, String value) { return put(key, value); } @@ -1145,8 +1145,7 @@ public void storeToXML(OutputStream os, @Nullable String comment, Charset charse * @see #setProperty * @see #defaults */ - - public @Nullable String getProperty( String key) { + public @Nullable String getProperty(String key) { Object oval = map.get(key); String sval = (oval instanceof String) ? (String)oval : null; Properties defaults; @@ -1166,8 +1165,7 @@ public void storeToXML(OutputStream os, @Nullable String comment, Charset charse * @see #setProperty * @see #defaults */ - - public @Nullable String getProperty( String key, @Nullable String defaultValue) { + public @Nullable String getProperty(String key, @Nullable String defaultValue) { String val = getProperty(key); return (val == null) ? defaultValue : val; } @@ -1304,13 +1302,11 @@ private void enumerateStringProperties(Map h) { // Hashtable methods overridden and delegated to a ConcurrentHashMap instance @Override - public int size() { return map.size(); } @Override - public boolean isEmpty() { return map.isEmpty(); } @@ -1333,13 +1329,11 @@ public boolean contains(Object value) { } @Override - public boolean containsValue(Object value) { return map.containsValue(value); } @Override - public boolean containsKey(Object key) { return map.containsKey(key); } @@ -1375,7 +1369,7 @@ public synchronized String toString() { } @Override - public Set< Object> keySet() { + public Set keySet() { return Collections.synchronizedSet(map.keySet(), this); } @@ -1385,8 +1379,7 @@ public Collection values() { } @Override - - public Set> entrySet() { + public Set> entrySet() { return Collections.synchronizedSet(new EntrySet(map.entrySet()), this); } diff --git a/src/java.base/share/classes/java/util/PropertyPermission.java b/src/java.base/share/classes/java/util/PropertyPermission.java index a78dd8ce26b..091fb837eed 100644 --- a/src/java.base/share/classes/java/util/PropertyPermission.java +++ b/src/java.base/share/classes/java/util/PropertyPermission.java @@ -192,9 +192,8 @@ public boolean implies(Permission p) { * @return true if obj is a PropertyPermission, and has the same name and * actions as this PropertyPermission object. */ - @Override - public boolean equals( @Nullable Object obj) { + public boolean equals(@Nullable Object obj) { if (obj == this) return true; @@ -211,7 +210,6 @@ public boolean equals( @Nullable Object obj) { * * @return a hash code value for this object. */ - @Override public int hashCode() { return this.getName().hashCode(); diff --git a/src/java.base/share/classes/java/util/Queue.java b/src/java.base/share/classes/java/util/Queue.java index 83fc4efa34c..5790d0e70cc 100644 --- a/src/java.base/share/classes/java/util/Queue.java +++ b/src/java.base/share/classes/java/util/Queue.java @@ -138,7 +138,6 @@ * @author Doug Lea * @param the type of elements held in this queue */ - @NullMarked public interface Queue extends Collection { /** diff --git a/src/java.base/share/classes/java/util/Random.java b/src/java.base/share/classes/java/util/Random.java index 21016a1b117..849f47ba4ab 100644 --- a/src/java.base/share/classes/java/util/Random.java +++ b/src/java.base/share/classes/java/util/Random.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.*; import java.util.concurrent.atomic.AtomicLong; diff --git a/src/java.base/share/classes/java/util/RandomAccess.java b/src/java.base/share/classes/java/util/RandomAccess.java index 524a8cc0489..43905f54904 100644 --- a/src/java.base/share/classes/java/util/RandomAccess.java +++ b/src/java.base/share/classes/java/util/RandomAccess.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Marker interface used by {@code List} implementations to indicate that diff --git a/src/java.base/share/classes/java/util/ResourceBundle.java b/src/java.base/share/classes/java/util/ResourceBundle.java index f8d1f916115..7c14fcac121 100644 --- a/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/src/java.base/share/classes/java/util/ResourceBundle.java @@ -72,6 +72,7 @@ import sun.util.locale.BaseLocale; import sun.util.resources.Bundles; + /** * * Resource bundles contain locale-specific objects. When your program needs a @@ -400,7 +401,7 @@ public void setName(ResourceBundle bundle, String name) { } @Override - public ResourceBundle getBundle( String baseName, Locale locale, Module module) { + public ResourceBundle getBundle(String baseName, Locale locale, Module module) { // use the given module as the caller to bypass the access check return getBundleImpl(module, module, baseName, locale, @@ -527,8 +528,7 @@ public ResourceBundle() { * @throws ClassCastException if the object found for the given key is not a string * @return the string for the given key */ - - public final String getString( String key) { + public final String getString(String key) { return (String) getObject(key); } @@ -546,7 +546,7 @@ public final String getString( String key) { * @throws ClassCastException if the object found for the given key is not a string array * @return the string array for the given key */ - public final String[] getStringArray( String key) { + public final String[] getStringArray(String key) { return (String[]) getObject(key); } @@ -563,7 +563,7 @@ public final String[] getStringArray( String key) { * @throws MissingResourceException if no object for the given key can be found * @return the object for the given key */ - public final Object getObject( String key) { + public final Object getObject(String key) { Object obj = handleGetObject(key); if (obj == null) { if (parent != null) { @@ -860,7 +860,7 @@ public CacheKey getCacheKey() { * @see Resource Bundles and Named Modules */ @CallerSensitive - public static final ResourceBundle getBundle( String baseName) + public static final ResourceBundle getBundle(String baseName) { Class caller = Reflection.getCallerClass(); return getBundleImpl(baseName, Locale.getDefault(), @@ -903,7 +903,7 @@ public static final ResourceBundle getBundle( String baseName) * @since 1.6 */ @CallerSensitive - public static final ResourceBundle getBundle( String baseName, + public static final ResourceBundle getBundle(String baseName, Control control) { Class caller = Reflection.getCallerClass(); Locale targetLocale = Locale.getDefault(); @@ -932,7 +932,7 @@ public static final ResourceBundle getBundle( String baseName, * @see Resource Bundles and Named Modules */ @CallerSensitive - public static final ResourceBundle getBundle( String baseName, + public static final ResourceBundle getBundle(String baseName, Locale locale) { Class caller = Reflection.getCallerClass(); @@ -962,7 +962,7 @@ public static final ResourceBundle getBundle( String baseName, * @see Resource Bundles and Named Modules */ @CallerSensitive - public static ResourceBundle getBundle( String baseName, Module module) { + public static ResourceBundle getBundle(String baseName, Module module) { return getBundleFromModule(Reflection.getCallerClass(), module, baseName, Locale.getDefault(), getDefaultControl(module, baseName)); @@ -1011,7 +1011,7 @@ public static ResourceBundle getBundle( String baseName, Module module) { * @see Resource Bundles and Named Modules */ @CallerSensitive - public static ResourceBundle getBundle( String baseName, Locale targetLocale, Module module) { + public static ResourceBundle getBundle(String baseName, Locale targetLocale, Module module) { return getBundleFromModule(Reflection.getCallerClass(), module, baseName, targetLocale, getDefaultControl(module, baseName)); } @@ -1056,7 +1056,7 @@ public static ResourceBundle getBundle( String baseName, Locale targetLocale, Mo * @since 1.6 */ @CallerSensitive - public static final ResourceBundle getBundle( String baseName, Locale targetLocale, + public static final ResourceBundle getBundle(String baseName, Locale targetLocale, Control control) { Class caller = Reflection.getCallerClass(); checkNamedModule(caller); @@ -1269,7 +1269,7 @@ public static final ResourceBundle getBundle( String baseName, Locale targetLoca * @see Resource Bundles and Named Modules */ @CallerSensitive - public static ResourceBundle getBundle( String baseName, Locale locale, + public static ResourceBundle getBundle(String baseName, Locale locale, ClassLoader loader) { if (loader == null) { @@ -1492,7 +1492,7 @@ public static ResourceBundle getBundle( String baseName, Locale locale, * @since 1.6 */ @CallerSensitive - public static ResourceBundle getBundle( String baseName, Locale targetLocale, + public static ResourceBundle getBundle(String baseName, Locale targetLocale, ClassLoader loader, Control control) { if (loader == null || control == null) { throw new NullPointerException(); @@ -2255,7 +2255,6 @@ public static final void clearCache(ClassLoader loader) { * @return an {@code Enumeration} of the keys contained in * this {@code ResourceBundle} and its parent bundles. */ - public abstract Enumeration getKeys(); /** @@ -2271,8 +2270,6 @@ public static final void clearCache(ClassLoader loader) { * if {@code key} is {@code null} * @since 1.6 */ - - public boolean containsKey(String key) { if (key == null) { throw new NullPointerException(); @@ -2293,8 +2290,7 @@ public boolean containsKey(String key) { * {@code ResourceBundle} and its parent bundles. * @since 1.6 */ - - public Set< String> keySet() { + public Set keySet() { Set keys = new HashSet<>(); for (ResourceBundle rb = this; rb != null; rb = rb.parent) { keys.addAll(rb.handleKeySet()); @@ -3106,7 +3102,7 @@ private static List getDefaultList(String language, String script, Strin * any I/O operations * @see java.util.spi.ResourceBundleProvider#getBundle(String, Locale) */ - public @Nullable ResourceBundle newBundle( String baseName, Locale locale, String format, + public @Nullable ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException { /* @@ -3245,7 +3241,7 @@ private ResourceBundle newBundle0(String bundleName, String format, * if {@code baseName} or {@code locale} is * {@code null} */ - public long getTimeToLive(String baseName, Locale locale) { + public long getTimeToLive(String baseName, Locale locale) { if (baseName == null || locale == null) { throw new NullPointerException(); } @@ -3301,7 +3297,7 @@ public long getTimeToLive(String baseName, Locale locale) { * {@code format}, {@code loader}, or * {@code bundle} is {@code null} */ - public boolean needsReload( String baseName, Locale locale, + public boolean needsReload(String baseName, Locale locale, String format, ClassLoader loader, ResourceBundle bundle, long loadTime) { if (bundle == null) { @@ -3388,7 +3384,7 @@ public boolean needsReload( String baseName, Locale locale, * is {@code null} * @see java.util.spi.AbstractResourceBundleProvider#toBundleName(String, Locale) */ - public String toBundleName( String baseName, Locale locale) { + public String toBundleName(String baseName, Locale locale) { if (locale == Locale.ROOT) { return baseName; } @@ -3421,10 +3417,7 @@ public String toBundleName( String baseName, Locale locale) { sb.append(language); } } - - @SuppressWarnings("signature") - String result = sb.toString(); - return result; + return sb.toString(); } diff --git a/src/java.base/share/classes/java/util/Scanner.java b/src/java.base/share/classes/java/util/Scanner.java index fe1b58a815d..74f364e1c59 100644 --- a/src/java.base/share/classes/java/util/Scanner.java +++ b/src/java.base/share/classes/java/util/Scanner.java @@ -345,7 +345,7 @@ * @since 1.5 */ @NullMarked -public final class Scanner implements Iterator, Closeable { +public final class Scanner implements Iterator, Closeable { // Internal buffer used to hold input private CharBuffer buf; @@ -396,10 +396,10 @@ public final class Scanner implements Iterator, Closeable { private boolean closed = false; // The current radix used by this scanner - private int radix = 10; + private int radix = 10; // The default radix for this scanner - private int defaultRadix = 10; + private int defaultRadix = 10; // The locale used by this scanner private Locale locale = null; @@ -1368,7 +1368,7 @@ public Scanner useLocale(Locale locale) { * * @return the default radix of this scanner */ - public int radix() { + public int radix() { return this.defaultRadix; } @@ -1390,7 +1390,7 @@ public int radix() { * @return this scanner * @throws IllegalArgumentException if radix is out of range */ - public Scanner useRadix( int radix) { + public Scanner useRadix(int radix) { if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) throw new IllegalArgumentException("radix:"+radix); @@ -1405,7 +1405,7 @@ public Scanner useRadix( int radix) { // The next operation should occur in the specified radix but // the default is left untouched. - private void setRadix( int radix) { + private void setRadix(int radix) { if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) throw new IllegalArgumentException("radix:"+radix); @@ -1448,7 +1448,6 @@ public MatchResult match() { * * @return The string representation of this scanner */ - public String toString() { StringBuilder sb = new StringBuilder(); sb.append("java.util.Scanner"); @@ -1786,7 +1785,7 @@ public String nextLine() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if horizon is negative */ - public @Nullable String findWithinHorizon(String pattern, int horizon) { + public @Nullable String findWithinHorizon(String pattern, int horizon) { return findWithinHorizon(patternCache.forName(pattern), horizon); } @@ -1821,7 +1820,7 @@ public String nextLine() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if horizon is negative */ - public @Nullable String findWithinHorizon(Pattern pattern, int horizon) { + public @Nullable String findWithinHorizon(Pattern pattern, int horizon) { ensureOpen(); if (pattern == null) throw new NullPointerException(); @@ -1965,7 +1964,7 @@ public boolean hasNextByte() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public boolean hasNextByte( int radix) { + public boolean hasNextByte(int radix) { setRadix(radix); boolean result = hasNext(integerPattern()); if (result) { // Cache it @@ -1996,7 +1995,7 @@ public boolean hasNextByte( int radix) { * @throws NoSuchElementException if input is exhausted * @throws IllegalStateException if this scanner is closed */ - public byte nextByte() { + public byte nextByte() { return nextByte(defaultRadix); } @@ -2031,7 +2030,7 @@ public byte nextByte() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public byte nextByte( int radix) { + public byte nextByte(int radix) { // Check cached result if ((typeCache != null) && (typeCache instanceof Byte) && this.radix == radix) { @@ -2081,7 +2080,7 @@ public boolean hasNextShort() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public boolean hasNextShort( int radix) { + public boolean hasNextShort(int radix) { setRadix(radix); boolean result = hasNext(integerPattern()); if (result) { // Cache it @@ -2112,7 +2111,7 @@ public boolean hasNextShort( int radix) { * @throws NoSuchElementException if input is exhausted * @throws IllegalStateException if this scanner is closed */ - public short nextShort() { + public short nextShort() { return nextShort(defaultRadix); } @@ -2147,7 +2146,7 @@ public short nextShort() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public short nextShort( int radix) { + public short nextShort(int radix) { // Check cached result if ((typeCache != null) && (typeCache instanceof Short) && this.radix == radix) { @@ -2197,7 +2196,7 @@ public boolean hasNextInt() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public boolean hasNextInt( int radix) { + public boolean hasNextInt(int radix) { setRadix(radix); boolean result = hasNext(integerPattern()); if (result) { // Cache it @@ -2252,7 +2251,7 @@ private String processIntegerToken(String token) { * @throws NoSuchElementException if input is exhausted * @throws IllegalStateException if this scanner is closed */ - public int nextInt() { + public int nextInt() { return nextInt(defaultRadix); } @@ -2287,7 +2286,7 @@ public int nextInt() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public int nextInt( int radix) { + public int nextInt(int radix) { // Check cached result if ((typeCache != null) && (typeCache instanceof Integer) && this.radix == radix) { @@ -2337,7 +2336,7 @@ public boolean hasNextLong() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public boolean hasNextLong( int radix) { + public boolean hasNextLong(int radix) { setRadix(radix); boolean result = hasNext(integerPattern()); if (result) { // Cache it @@ -2368,7 +2367,7 @@ public boolean hasNextLong( int radix) { * @throws NoSuchElementException if input is exhausted * @throws IllegalStateException if this scanner is closed */ - public long nextLong() { + public long nextLong() { return nextLong(defaultRadix); } @@ -2403,7 +2402,7 @@ public long nextLong() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public long nextLong( int radix) { + public long nextLong(int radix) { // Check cached result if ((typeCache != null) && (typeCache instanceof Long) && this.radix == radix) { @@ -2644,7 +2643,7 @@ public boolean hasNextBigInteger() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public boolean hasNextBigInteger( int radix) { + public boolean hasNextBigInteger(int radix) { setRadix(radix); boolean result = hasNext(integerPattern()); if (result) { // Cache it @@ -2706,7 +2705,7 @@ public BigInteger nextBigInteger() { * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if the radix is out of range */ - public BigInteger nextBigInteger( int radix) { + public BigInteger nextBigInteger(int radix) { // Check cached result if ((typeCache != null) && (typeCache instanceof BigInteger val) && this.radix == radix) { diff --git a/src/java.base/share/classes/java/util/ServiceLoader.java b/src/java.base/share/classes/java/util/ServiceLoader.java index 39049c450b3..238ba060601 100644 --- a/src/java.base/share/classes/java/util/ServiceLoader.java +++ b/src/java.base/share/classes/java/util/ServiceLoader.java @@ -378,7 +378,7 @@ */ @NullMarked -public final class ServiceLoader +public final class ServiceLoader implements Iterable { // The class or interface representing the service being loaded @@ -1218,7 +1218,6 @@ public Provider next() { * @return An iterator that lazily loads providers for this loader's * service */ - public Iterator iterator() { // create lookup iterator if needed @@ -1697,7 +1696,6 @@ public void reload() { * * @return A descriptive string */ - public String toString() { return "java.util.ServiceLoader[" + service.getName() + "]"; } diff --git a/src/java.base/share/classes/java/util/Set.java b/src/java.base/share/classes/java/util/Set.java index f5efb276eb8..fc1e1085089 100644 --- a/src/java.base/share/classes/java/util/Set.java +++ b/src/java.base/share/classes/java/util/Set.java @@ -120,7 +120,6 @@ * @since 1.2 */ - @NullMarked public interface Set extends Collection { // Query Operations @@ -132,15 +131,13 @@ public interface Set extends Collection { * * @return the number of elements in this set (its cardinality) */ - - int size(); + int size(); /** * Returns {@code true} if this set contains no elements. * * @return {@code true} if this set contains no elements */ - boolean isEmpty(); /** @@ -158,7 +155,6 @@ public interface Set extends Collection { * set does not permit null elements * (optional) */ - boolean contains(@Nullable Object o); /** @@ -168,7 +164,6 @@ public interface Set extends Collection { * * @return an iterator over the elements in this set */ - Iterator iterator(); /** @@ -187,7 +182,6 @@ public interface Set extends Collection { * * @return an array containing all the elements in this set */ - @Nullable Object[] toArray(); /** @@ -232,7 +226,6 @@ public interface Set extends Collection { * set * @throws NullPointerException if the specified array is null */ - T[] toArray(T[] a); @@ -316,7 +309,6 @@ public interface Set extends Collection { * or if the specified collection is null * @see #contains(Object) */ - boolean containsAll(Collection c); /** @@ -413,8 +405,7 @@ public interface Set extends Collection { * @param o object to be compared for equality with this set * @return {@code true} if the specified object is equal to this set */ - - boolean equals( @Nullable Object o); + boolean equals(@Nullable Object o); /** * Returns the hash code value for this set. The hash code of a set is @@ -429,7 +420,6 @@ public interface Set extends Collection { * @see Object#equals(Object) * @see Set#equals(Object) */ - int hashCode(); /** diff --git a/src/java.base/share/classes/java/util/SimpleTimeZone.java b/src/java.base/share/classes/java/util/SimpleTimeZone.java index 46e8ac6f340..b559b26ebd3 100644 --- a/src/java.base/share/classes/java/util/SimpleTimeZone.java +++ b/src/java.base/share/classes/java/util/SimpleTimeZone.java @@ -861,7 +861,6 @@ public boolean inDaylightTime(Date date) * Returns a clone of this {@code SimpleTimeZone} instance. * @return a clone of this instance. */ - public Object clone() { return super.clone(); @@ -871,7 +870,6 @@ public Object clone() * Generates the hash code for the SimpleTimeZone object. * @return the hash code for this object */ - public int hashCode() { int hash = 31 * getID().hashCode() + rawOffset; @@ -943,7 +941,6 @@ public boolean hasSameRules(TimeZone other) { * Returns a string representation of this time zone. * @return a string representation of this time zone. */ - public String toString() { return getClass().getName() + "[id=" + getID() + diff --git a/src/java.base/share/classes/java/util/SortedMap.java b/src/java.base/share/classes/java/util/SortedMap.java index 879171dcfcc..16b2e174600 100644 --- a/src/java.base/share/classes/java/util/SortedMap.java +++ b/src/java.base/share/classes/java/util/SortedMap.java @@ -124,7 +124,6 @@ public interface SortedMap comparator(); /** @@ -156,8 +155,7 @@ public interface SortedMap subMap( K fromKey, K toKey); + SortedMap subMap(K fromKey, K toKey); /** * Returns a view of the portion of this map whose keys are @@ -184,7 +182,6 @@ public interface SortedMap headMap(K toKey); /** @@ -212,7 +209,6 @@ public interface SortedMap tailMap(K fromKey); /** @@ -221,8 +217,7 @@ public interface SortedMap keySet(); + Set keySet(); /** * Returns a {@link Collection} view of the values contained in this map. @@ -271,7 +264,6 @@ public interface SortedMap values(); /** diff --git a/src/java.base/share/classes/java/util/SortedSet.java b/src/java.base/share/classes/java/util/SortedSet.java index b5b51103242..081106dc789 100644 --- a/src/java.base/share/classes/java/util/SortedSet.java +++ b/src/java.base/share/classes/java/util/SortedSet.java @@ -119,7 +119,6 @@ public interface SortedSet extends Set, Sequenced * or {@code null} if this set uses the natural ordering * of its elements */ - @Nullable Comparator comparator(); /** @@ -153,8 +152,7 @@ public interface SortedSet extends Set, Sequenced * has a restricted range, and {@code fromElement} or * {@code toElement} lies outside the bounds of the range */ - - SortedSet subSet( E fromElement, E toElement); + SortedSet subSet(E fromElement, E toElement); /** * Returns a view of the portion of this set whose elements are @@ -181,7 +179,6 @@ public interface SortedSet extends Set, Sequenced * restricted range, and {@code toElement} lies outside the * bounds of the range */ - SortedSet headSet(E toElement); /** @@ -209,7 +206,6 @@ public interface SortedSet extends Set, Sequenced * restricted range, and {@code fromElement} lies outside the * bounds of the range */ - SortedSet tailSet(E fromElement); /** @@ -218,7 +214,6 @@ public interface SortedSet extends Set, Sequenced * @return the first (lowest) element currently in this set * @throws NoSuchElementException if this set is empty */ - E first(); /** @@ -227,7 +222,6 @@ public interface SortedSet extends Set, Sequenced * @return the last (highest) element currently in this set * @throws NoSuchElementException if this set is empty */ - E last(); /** diff --git a/src/java.base/share/classes/java/util/Spliterator.java b/src/java.base/share/classes/java/util/Spliterator.java index d37cf649d2c..9c5d2d000f6 100644 --- a/src/java.base/share/classes/java/util/Spliterator.java +++ b/src/java.base/share/classes/java/util/Spliterator.java @@ -471,7 +471,6 @@ default boolean hasCharacteristics(int characteristics) { * @throws IllegalStateException if the spliterator does not report * a characteristic of {@code SORTED}. */ - default @Nullable Comparator getComparator() { throw new IllegalStateException(); } diff --git a/src/java.base/share/classes/java/util/StringTokenizer.java b/src/java.base/share/classes/java/util/StringTokenizer.java index baef9a7eb16..4b8a2fd2ad7 100644 --- a/src/java.base/share/classes/java/util/StringTokenizer.java +++ b/src/java.base/share/classes/java/util/StringTokenizer.java @@ -335,7 +335,7 @@ public boolean hasMoreTokens() { * @throws NoSuchElementException if there are no more tokens in this * tokenizer's string. */ - public String nextToken() { + public String nextToken() { /* * If next position already computed in hasMoreElements() and * delimiters have changed between the computation and this invocation, @@ -422,7 +422,7 @@ public Object nextElement() { * delimiter set. * @see java.util.StringTokenizer#nextToken() */ - public int countTokens() { + public int countTokens() { int count = 0; int currpos = currentPosition; while (currpos < maxPosition) { diff --git a/src/java.base/share/classes/java/util/TimeZone.java b/src/java.base/share/classes/java/util/TimeZone.java index 70903808fac..f19b604d318 100644 --- a/src/java.base/share/classes/java/util/TimeZone.java +++ b/src/java.base/share/classes/java/util/TimeZone.java @@ -334,7 +334,6 @@ public void setID(String ID) * @see Locale#getDefault(Locale.Category) * @see Locale.Category */ - public final String getDisplayName() { return getDisplayName(false, LONG, Locale.getDefault(Locale.Category.DISPLAY)); @@ -358,7 +357,6 @@ public final String getDisplayName() { * @since 1.2 * @see #getDisplayName(boolean, int, Locale) */ - public final String getDisplayName(Locale locale) { return getDisplayName(false, LONG, locale); } @@ -390,7 +388,6 @@ public final String getDisplayName(Locale locale) { * @see Locale.Category * @see java.text.DateFormatSymbols#getZoneStrings() */ - public final String getDisplayName(boolean daylight, int style) { return getDisplayName(daylight, style, Locale.getDefault(Locale.Category.DISPLAY)); @@ -429,7 +426,6 @@ public final String getDisplayName(boolean daylight, int style) { * @since 1.2 * @see java.text.DateFormatSymbols#getZoneStrings() */ - public String getDisplayName(boolean daylight, int style, Locale locale) { if (style != SHORT && style != LONG) { throw new IllegalArgumentException("Illegal style: " + style); @@ -483,7 +479,6 @@ private static String[] getDisplayNames(String id, Locale locale) { * @see #getOffset(int,int,int,int,int,int) * @see Calendar#ZONE_OFFSET */ - public int getDSTSavings() { if (useDaylightTime()) { return 3600000; @@ -506,7 +501,6 @@ public int getDSTSavings() { * @see #inDaylightTime(Date) * @see Calendar#DST_OFFSET */ - public abstract boolean useDaylightTime(); /** @@ -541,7 +535,6 @@ public boolean observesDaylightTime() { * @throws NullPointerException This method may throw a * {@code NullPointerException} if {@code date} is {@code null} */ - public abstract boolean inDaylightTime(Date date); /** @@ -811,7 +804,6 @@ public boolean hasSameRules(@Nullable TimeZone other) { * * @return a clone of this {@code TimeZone} */ - public Object clone() { try { diff --git a/src/java.base/share/classes/java/util/Timer.java b/src/java.base/share/classes/java/util/Timer.java index da65a4180a5..a354441dd42 100644 --- a/src/java.base/share/classes/java/util/Timer.java +++ b/src/java.base/share/classes/java/util/Timer.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Date; import java.util.concurrent.atomic.AtomicInteger; @@ -91,7 +90,7 @@ */ @NullMarked -public class Timer { +public class Timer { /** * The timer task queue. This data structure is shared with the timer * thread. The timer produces tasks, via its various schedule calls, @@ -475,7 +474,7 @@ public void cancel() { * @see TimerTask#cancel() * @since 1.5 */ - public int purge() { + public int purge() { int result = 0; synchronized(queue) { @@ -608,7 +607,6 @@ class TaskQueue { /** * Returns the number of tasks currently on the queue. */ - int size() { return size; } @@ -675,7 +673,6 @@ void rescheduleMin(long newTime) { /** * Returns true if the priority queue contains no elements. */ - boolean isEmpty() { return size==0; } diff --git a/src/java.base/share/classes/java/util/TimerTask.java b/src/java.base/share/classes/java/util/TimerTask.java index d084ff86fe9..98ce33c3806 100644 --- a/src/java.base/share/classes/java/util/TimerTask.java +++ b/src/java.base/share/classes/java/util/TimerTask.java @@ -26,7 +26,6 @@ package java.util; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * A task that can be scheduled for one-time or repeated execution by a @@ -41,7 +40,7 @@ */ @NullMarked -public abstract class TimerTask implements Runnable { +public abstract class TimerTask implements Runnable { /** * This object is used to control access to the TimerTask internals. */ diff --git a/src/java.base/share/classes/java/util/TreeMap.java b/src/java.base/share/classes/java/util/TreeMap.java index b05227703ad..83bbf520d4b 100644 --- a/src/java.base/share/classes/java/util/TreeMap.java +++ b/src/java.base/share/classes/java/util/TreeMap.java @@ -124,7 +124,6 @@ * @since 1.2 */ - @NullMarked public class TreeMap extends AbstractMap @@ -230,8 +229,7 @@ public TreeMap(SortedMap m) { * * @return the number of key-value mappings in this map */ - - public int size() { + public int size() { return size; } @@ -248,8 +246,6 @@ public int size() { * and this map uses natural ordering, or its comparator * does not permit null keys */ - - public boolean containsKey(@Nullable Object key) { return getEntry(key) != null; } @@ -267,7 +263,6 @@ public boolean containsKey(@Nullable Object key) { * {@code false} otherwise * @since 1.2 */ - public boolean containsValue(@Nullable Object value) { for (Entry e = getFirstEntry(); e != null; e = successor(e)) if (valEquals(value, e.value)) @@ -302,7 +297,6 @@ public boolean containsValue(@Nullable Object value) { return (p==null ? null : p.value); } - public @Nullable Comparator comparator() { return comparator; } @@ -310,14 +304,14 @@ public boolean containsValue(@Nullable Object value) { /** * @throws NoSuchElementException {@inheritDoc} */ - public K firstKey() { + public K firstKey() { return key(getFirstEntry()); } /** * @throws NoSuchElementException {@inheritDoc} */ - public K lastKey() { + public K lastKey() { return key(getLastEntry()); } @@ -1135,15 +1129,14 @@ public Object clone() { * operations. It does not support the {@code add} or {@code addAll} * operations. */ - public Set< K> keySet() { + public Set keySet() { return navigableKeySet(); } /** * @since 1.6 */ - - public NavigableSet< K> navigableKeySet() { + public NavigableSet navigableKeySet() { KeySet nks = navigableKeySet; return (nks != null) ? nks : (navigableKeySet = new KeySet<>(this)); } @@ -1151,8 +1144,7 @@ public NavigableSet< K> navigableKeySet() { /** * @since 1.6 */ - - public NavigableSet< K> descendingKeySet() { + public NavigableSet descendingKeySet() { return descendingMap().navigableKeySet(); } @@ -1210,8 +1202,7 @@ public Collection values() { * * @return {@inheritDoc SortedMap} */ - - public Set> entrySet() { + public Set> entrySet() { EntrySet es = entrySet; return (es != null) ? es : (entrySet = new EntrySet()); } @@ -1219,7 +1210,6 @@ public Set> entrySet() { /** * @since 1.6 */ - public NavigableMap descendingMap() { NavigableMap km = descendingMap; return (km != null) ? km : @@ -1236,9 +1226,8 @@ public NavigableMap descendingMap() { * @throws IllegalArgumentException {@inheritDoc} * @since 1.6 */ - - public NavigableMap subMap( K fromKey, boolean fromInclusive, - K toKey, boolean toInclusive) { + public NavigableMap subMap(K fromKey, boolean fromInclusive, + K toKey, boolean toInclusive) { return new AscendingSubMap<>(this, false, fromKey, fromInclusive, false, toKey, toInclusive); @@ -1252,8 +1241,7 @@ public NavigableMap subMap( K fromKey, boolean fromInclusive, * @throws IllegalArgumentException {@inheritDoc} * @since 1.6 */ - - public NavigableMap headMap( K toKey, boolean inclusive) { + public NavigableMap headMap(K toKey, boolean inclusive) { return new AscendingSubMap<>(this, true, null, true, false, toKey, inclusive); @@ -1267,8 +1255,7 @@ public NavigableMap headMap( K toKey, boolean inclusive) { * @throws IllegalArgumentException {@inheritDoc} * @since 1.6 */ - - public NavigableMap tailMap( K fromKey, boolean inclusive) { + public NavigableMap tailMap(K fromKey, boolean inclusive) { return new AscendingSubMap<>(this, false, fromKey, inclusive, true, null, true); @@ -1281,8 +1268,7 @@ public NavigableMap tailMap( K fromKey, boolean inclusive) { * does not permit null keys * @throws IllegalArgumentException {@inheritDoc} */ - - public SortedMap subMap( K fromKey, K toKey) { + public SortedMap subMap(K fromKey, K toKey) { return subMap(fromKey, true, toKey, false); } @@ -1293,7 +1279,6 @@ public SortedMap subMap( K fromKey, K toKey) { * does not permit null keys * @throws IllegalArgumentException {@inheritDoc} */ - public SortedMap headMap(K toKey) { return headMap(toKey, false); } @@ -1305,7 +1290,6 @@ public SortedMap headMap(K toKey) { * does not permit null keys * @throws IllegalArgumentException {@inheritDoc} */ - public SortedMap tailMap(K fromKey) { return tailMap(fromKey, true); } @@ -1361,13 +1345,11 @@ public void replaceAll(BiFunction function) { // View class support class Values extends AbstractCollection { - public Iterator iterator() { return new ValueIterator(getFirstEntry()); } - - public int size() { + public int size() { return TreeMap.this.size(); } @@ -1389,14 +1371,12 @@ public void clear() { TreeMap.this.clear(); } - public Spliterator spliterator() { return new ValueSpliterator<>(TreeMap.this, null, null, 0, -1, 0); } } class EntrySet extends AbstractSet> { - public Iterator> iterator() { return new EntryIterator(getFirstEntry()); } @@ -1421,8 +1401,7 @@ public boolean remove(Object o) { return false; } - - public int size() { + public int size() { return TreeMap.this.size(); } @@ -1430,7 +1409,6 @@ public void clear() { TreeMap.this.clear(); } - public Spliterator> spliterator() { return new EntrySpliterator<>(TreeMap.this, null, null, 0, -1, 0); } @@ -1456,7 +1434,6 @@ static final class KeySet extends AbstractSet implements NavigableSet { private final NavigableMap m; KeySet(NavigableMap map) { m = map; } - public Iterator iterator() { if (m instanceof TreeMap) return ((TreeMap)m).keyIterator(); @@ -1471,9 +1448,7 @@ public Iterator descendingIterator() { return ((TreeMap.NavigableSubMap)m).descendingKeyIterator(); } - - public int size() { return m.size(); } - + public int size() { return m.size(); } public boolean isEmpty() { return m.isEmpty(); } public boolean contains(Object o) { return m.containsKey(o); } public void clear() { m.clear(); } @@ -1521,7 +1496,6 @@ public NavigableSet descendingSet() { return new KeySet<>(m.descendingMap()); } - public Spliterator spliterator() { return keySpliteratorFor(m); } @@ -1848,23 +1822,18 @@ final TreeMap.Entry absLowFence() { // public methods - public boolean isEmpty() { return (fromStart && toEnd) ? m.isEmpty() : entrySet().isEmpty(); } - - public int size() { + public int size() { return (fromStart && toEnd) ? m.size() : entrySet().size(); } - - public final boolean containsKey(Object key) { return inRange(key) && m.containsKey(key); } - public final V put(K key, V value) { if (!inRange(key)) throw new IllegalArgumentException("key out of range"); @@ -1984,7 +1953,6 @@ public final Map.Entry pollLastEntry() { transient EntrySetView entrySetView; transient KeySet navigableKeySetView; - public final NavigableSet navigableKeySet() { KeySet nksv = navigableKeySetView; return (nksv != null) ? nksv : @@ -1995,22 +1963,18 @@ public final Set keySet() { return navigableKeySet(); } - public NavigableSet descendingKeySet() { return descendingMap().navigableKeySet(); } - public final SortedMap subMap(K fromKey, K toKey) { return subMap(fromKey, true, toKey, false); } - public final SortedMap headMap(K toKey) { return headMap(toKey, false); } - public final SortedMap tailMap(K fromKey) { return tailMap(fromKey, true); } @@ -2020,7 +1984,6 @@ public final SortedMap tailMap(K fromKey) { abstract class EntrySetView extends AbstractSet> { private transient int size = -1, sizeModCount; - public int size() { if (fromStart && toEnd) return m.size(); @@ -2036,7 +1999,6 @@ public int size() { return size; } - public boolean isEmpty() { TreeMap.Entry n = absLowest(); return n == null || tooHigh(n.key); @@ -2259,7 +2221,6 @@ public Comparator comparator() { return m.comparator(); } - public NavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { if (!inRange(fromKey, fromInclusive)) @@ -2271,7 +2232,6 @@ public NavigableMap subMap(K fromKey, boolean fromInclusive, false, toKey, toInclusive); } - public NavigableMap headMap(K toKey, boolean inclusive) { if (!inRange(toKey, inclusive)) throw new IllegalArgumentException("toKey out of range"); @@ -2280,7 +2240,6 @@ public NavigableMap headMap(K toKey, boolean inclusive) { false, toKey, inclusive); } - public NavigableMap tailMap(K fromKey, boolean inclusive) { if (!inRange(fromKey, inclusive)) throw new IllegalArgumentException("fromKey out of range"); @@ -2289,7 +2248,6 @@ public NavigableMap tailMap(K fromKey, boolean inclusive) { toEnd, hi, hiInclusive); } - public NavigableMap descendingMap() { NavigableMap mv = descendingMapView; return (mv != null) ? mv : @@ -2317,7 +2275,6 @@ public Iterator> iterator() { } } - public Set> entrySet() { EntrySetView es = entrySetView; return (es != null) ? es : (entrySetView = new AscendingEntrySetView()); @@ -2352,7 +2309,6 @@ public Comparator comparator() { return reverseComparator; } - public NavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { if (!inRange(fromKey, fromInclusive)) @@ -2364,7 +2320,6 @@ public NavigableMap subMap(K fromKey, boolean fromInclusive, false, fromKey, fromInclusive); } - public NavigableMap headMap(K toKey, boolean inclusive) { if (!inRange(toKey, inclusive)) throw new IllegalArgumentException("toKey out of range"); @@ -2373,7 +2328,6 @@ public NavigableMap headMap(K toKey, boolean inclusive) { toEnd, hi, hiInclusive); } - public NavigableMap tailMap(K fromKey, boolean inclusive) { if (!inRange(fromKey, inclusive)) throw new IllegalArgumentException("fromKey out of range"); @@ -2382,7 +2336,6 @@ public NavigableMap tailMap(K fromKey, boolean inclusive) { false, fromKey, inclusive); } - public NavigableMap descendingMap() { NavigableMap mv = descendingMapView; return (mv != null) ? mv : @@ -2410,7 +2363,6 @@ public Iterator> iterator() { } } - public Set> entrySet() { EntrySetView es = entrySetView; return (es != null) ? es : (entrySetView = new DescendingEntrySetView()); @@ -2451,15 +2403,11 @@ private Object readResolve() { fromStart, fromKey, true, toEnd, toKey, false); } - public Set> entrySet() { throw new InternalError(); } public K lastKey() { throw new InternalError(); } public K firstKey() { throw new InternalError(); } - public SortedMap subMap(K fromKey, K toKey) { throw new InternalError(); } - public SortedMap headMap(K toKey) { throw new InternalError(); } - public SortedMap tailMap(K fromKey) { throw new InternalError(); } public Comparator comparator() { throw new InternalError(); } } diff --git a/src/java.base/share/classes/java/util/TreeSet.java b/src/java.base/share/classes/java/util/TreeSet.java index 504cbb98323..ef994e96eee 100644 --- a/src/java.base/share/classes/java/util/TreeSet.java +++ b/src/java.base/share/classes/java/util/TreeSet.java @@ -96,7 +96,6 @@ * @since 1.2 */ - @NullMarked public class TreeSet extends AbstractSet implements NavigableSet, Cloneable, java.io.Serializable @@ -188,7 +187,6 @@ public TreeSet(SortedSet s) { * * @return an iterator over the elements in this set in ascending order */ - public Iterator iterator() { return m.navigableKeySet().iterator(); } @@ -215,8 +213,7 @@ public NavigableSet descendingSet() { * * @return the number of elements in this set (its cardinality) */ - - public int size() { + public int size() { return m.size(); } @@ -225,8 +222,6 @@ public int size() { * * @return {@code true} if this set contains no elements */ - - public boolean isEmpty() { return m.isEmpty(); } @@ -245,7 +240,6 @@ public boolean isEmpty() { * and this set uses natural ordering, or its comparator * does not permit null elements */ - public boolean contains(@Nullable Object o) { return m.containsKey(o); } @@ -333,9 +327,8 @@ public boolean addAll(Collection c) { * @throws IllegalArgumentException {@inheritDoc} * @since 1.6 */ - - public NavigableSet subSet( E fromElement, boolean fromInclusive, - E toElement, boolean toInclusive) { + public NavigableSet subSet(E fromElement, boolean fromInclusive, + E toElement, boolean toInclusive) { return new TreeSet<>(m.subMap(fromElement, fromInclusive, toElement, toInclusive)); } @@ -348,8 +341,7 @@ public NavigableSet subSet( E fromElement, boolean fromInclusive, * @throws IllegalArgumentException {@inheritDoc} * @since 1.6 */ - - public NavigableSet headSet( E toElement, boolean inclusive) { + public NavigableSet headSet(E toElement, boolean inclusive) { return new TreeSet<>(m.headMap(toElement, inclusive)); } @@ -361,8 +353,7 @@ public NavigableSet headSet( E toElement, boolean inclusive) { * @throws IllegalArgumentException {@inheritDoc} * @since 1.6 */ - - public NavigableSet tailSet( E fromElement, boolean inclusive) { + public NavigableSet tailSet(E fromElement, boolean inclusive) { return new TreeSet<>(m.tailMap(fromElement, inclusive)); } @@ -373,8 +364,7 @@ public NavigableSet tailSet( E fromElement, boolean inclusive) { * or its comparator does not permit null elements * @throws IllegalArgumentException {@inheritDoc} */ - - public SortedSet subSet( E fromElement, E toElement) { + public SortedSet subSet(E fromElement, E toElement) { return subSet(fromElement, true, toElement, false); } @@ -385,7 +375,6 @@ public SortedSet subSet( E fromElement, E toElement) { * not permit null elements * @throws IllegalArgumentException {@inheritDoc} */ - public SortedSet headSet(E toElement) { return headSet(toElement, false); } @@ -397,12 +386,10 @@ public SortedSet headSet(E toElement) { * not permit null elements * @throws IllegalArgumentException {@inheritDoc} */ - public SortedSet tailSet(E fromElement) { return tailSet(fromElement, true); } - public @Nullable Comparator comparator() { return m.comparator(); } @@ -410,7 +397,6 @@ public SortedSet tailSet(E fromElement) { /** * @throws NoSuchElementException {@inheritDoc} */ - public E first() { return m.firstKey(); } @@ -418,7 +404,6 @@ public E first() { /** * @throws NoSuchElementException {@inheritDoc} */ - public E last() { return m.lastKey(); } @@ -515,7 +500,6 @@ public void addLast(E e) { * * @return a shallow copy of this set */ - @SuppressWarnings("unchecked") public Object clone() { TreeSet clone; diff --git a/src/java.base/share/classes/java/util/UUID.java b/src/java.base/share/classes/java/util/UUID.java index 94df8ef7abc..814f2c5c19e 100644 --- a/src/java.base/share/classes/java/util/UUID.java +++ b/src/java.base/share/classes/java/util/UUID.java @@ -28,8 +28,6 @@ import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.StandardCharsets; import java.security.*; import jdk.internal.access.JavaLangAccess; diff --git a/src/java.base/share/classes/java/util/Vector.java b/src/java.base/share/classes/java/util/Vector.java index b7b0660d2b2..42e9b7c9cd9 100644 --- a/src/java.base/share/classes/java/util/Vector.java +++ b/src/java.base/share/classes/java/util/Vector.java @@ -92,7 +92,6 @@ * @see LinkedList * @since 1.0 */ - @NullMarked public class Vector extends AbstractList @@ -143,7 +142,7 @@ public class Vector * @throws IllegalArgumentException if the specified initial capacity * is negative */ - public Vector( int initialCapacity, int capacityIncrement) { + public Vector(int initialCapacity, int capacityIncrement) { super(); if (initialCapacity < 0) throw new IllegalArgumentException("Illegal Capacity: "+ @@ -160,7 +159,7 @@ public Vector( int initialCapacity, int capacityIncrement) { * @throws IllegalArgumentException if the specified initial capacity * is negative */ - public Vector( int initialCapacity) { + public Vector(int initialCapacity) { this(initialCapacity, 0); } @@ -280,7 +279,7 @@ private Object[] grow() { * @param newSize the new size of this vector * @throws ArrayIndexOutOfBoundsException if the new size is negative */ - public synchronized void setSize( int newSize) { + public synchronized void setSize(int newSize) { modCount++; if (newSize > elementData.length) grow(newSize); @@ -297,7 +296,7 @@ public synchronized void setSize( int newSize) { * data array, kept in the field {@code elementData} * of this vector) */ - public synchronized int capacity() { + public synchronized int capacity() { return elementData.length; } @@ -306,8 +305,7 @@ public synchronized int capacity() { * * @return the number of components in this vector */ - - public synchronized int size() { + public synchronized int size() { return elementCount; } @@ -318,7 +316,6 @@ public synchronized int size() { * no components, that is, its size is zero; * {@code false} otherwise. */ - public synchronized boolean isEmpty() { return elementCount == 0; } @@ -362,7 +359,6 @@ public E nextElement() { * @param o element whose presence in this vector is to be tested * @return {@code true} if this vector contains the specified element */ - public boolean contains(@Nullable Object o) { return indexOf(o, 0) >= 0; } @@ -378,8 +374,7 @@ public boolean contains(@Nullable Object o) { * @return the index of the first occurrence of the specified element in * this vector, or -1 if this vector does not contain the element */ - - public int indexOf(@Nullable Object o) { + public int indexOf(@Nullable Object o) { return indexOf(o, 0); } @@ -399,8 +394,7 @@ public int indexOf(@Nullable Object o) { * @throws IndexOutOfBoundsException if the specified index is negative * @see Object#equals(Object) */ - - public synchronized int indexOf( @Nullable Object o, int index) { + public synchronized int indexOf(@Nullable Object o, int index) { if (o == null) { for (int i = index ; i < elementCount ; i++) if (elementData[i]==null) @@ -424,8 +418,7 @@ public synchronized int indexOf( @Nullable Object o, int index) { * @return the index of the last occurrence of the specified element in * this vector, or -1 if this vector does not contain the element */ - - public synchronized int lastIndexOf(@Nullable Object o) { + public synchronized int lastIndexOf(@Nullable Object o) { return lastIndexOf(o, elementCount-1); } @@ -445,8 +438,7 @@ public synchronized int lastIndexOf(@Nullable Object o) { * @throws IndexOutOfBoundsException if the specified index is greater * than or equal to the current size of this vector */ - - public synchronized int lastIndexOf( @Nullable Object o, int index) { + public synchronized int lastIndexOf(@Nullable Object o, int index) { if (index >= elementCount) throw new IndexOutOfBoundsException(index + " >= "+ elementCount); @@ -473,7 +465,7 @@ public synchronized int lastIndexOf( @Nullable Object o, int index) { * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ - public synchronized E elementAt( int index) { + public synchronized E elementAt(int index) { if (index >= elementCount) { throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount); } @@ -529,7 +521,7 @@ public synchronized E lastElement() { * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ - public synchronized void setElementAt(E obj, int index) { + public synchronized void setElementAt(E obj, int index) { if (index >= elementCount) { throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount); @@ -556,7 +548,7 @@ public synchronized void setElementAt(E obj, int index) { * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ - public synchronized void removeElementAt( int index) { + public synchronized void removeElementAt(int index) { if (index >= elementCount) { throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount); @@ -596,7 +588,7 @@ else if (index < 0) { * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index > size()}) */ - public synchronized void insertElementAt(E obj, int index) { + public synchronized void insertElementAt(E obj, int index) { if (index > elementCount) { throw new ArrayIndexOutOfBoundsException(index + " > " + elementCount); @@ -674,7 +666,6 @@ public synchronized void removeAllElements() { * * @return a clone of this vector */ - public synchronized Object clone() { try { @SuppressWarnings("unchecked") @@ -694,7 +685,6 @@ public synchronized Object clone() { * * @since 1.2 */ - public synchronized @Nullable Object[] toArray() { return Arrays.copyOf(elementData, elementCount); } @@ -725,7 +715,6 @@ public synchronized Object clone() { * @throws NullPointerException if the given array is null * @since 1.2 */ - @SuppressWarnings("unchecked") public synchronized T[] toArray(T[] a) { if (a.length < elementCount) @@ -760,8 +749,7 @@ static E elementAt(Object[] es, int index) { * ({@code index < 0 || index >= size()}) * @since 1.2 */ - - public synchronized E get( int index) { + public synchronized E get(int index) { if (index >= elementCount) throw new ArrayIndexOutOfBoundsException(index); @@ -779,7 +767,7 @@ public synchronized E get( int index) { * ({@code index < 0 || index >= size()}) * @since 1.2 */ - public synchronized E set( int index, E element) { + public synchronized E set(int index, E element) { if (index >= elementCount) throw new ArrayIndexOutOfBoundsException(index); @@ -839,7 +827,7 @@ public boolean remove(@Nullable Object o) { * ({@code index < 0 || index > size()}) * @since 1.2 */ - public void add( int index, E element) { + public void add(int index, E element) { insertElementAt(element, index); } @@ -854,7 +842,7 @@ public void add( int index, E element) { * ({@code index < 0 || index >= size()}) * @since 1.2 */ - public synchronized E remove( int index) { + public synchronized E remove(int index) { modCount++; if (index >= elementCount) throw new ArrayIndexOutOfBoundsException(index); @@ -891,7 +879,6 @@ public void clear() { * specified collection * @throws NullPointerException if the specified collection is null */ - public synchronized boolean containsAll(Collection c) { return super.containsAll(c); } @@ -975,7 +962,6 @@ public boolean retainAll(Collection c) { /** * @throws NullPointerException {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) @Override public boolean removeIf(Predicate filter) { Objects.requireNonNull(filter); @@ -1046,7 +1032,7 @@ private synchronized boolean bulkRemove(Predicate filter) { * @throws NullPointerException if the specified collection is null * @since 1.2 */ - public synchronized boolean addAll( int index, Collection c) { + public synchronized boolean addAll(int index, Collection c) { if (index < 0 || index > elementCount) throw new ArrayIndexOutOfBoundsException(index); @@ -1082,15 +1068,13 @@ public synchronized boolean addAll( int index, Collection c) { * @param o the Object to be compared for equality with this Vector * @return true if the specified Object is equal to this Vector */ - - public synchronized boolean equals( @Nullable Object o) { + public synchronized boolean equals(@Nullable Object o) { return super.equals(o); } /** * Returns the hash code value for this Vector. */ - public synchronized int hashCode() { return super.hashCode(); } @@ -1099,7 +1083,6 @@ public synchronized int hashCode() { * Returns a string representation of this Vector, containing * the String representation of each element. */ - public synchronized String toString() { return super.toString(); } @@ -1138,7 +1121,6 @@ public synchronized String toString() { * @throws IllegalArgumentException if the endpoint indices are out of order * {@code (fromIndex > toIndex)} */ - public synchronized List subList(int fromIndex, int toIndex) { return Collections.synchronizedList(super.subList(fromIndex, toIndex), this); @@ -1222,7 +1204,7 @@ private void writeObject(java.io.ObjectOutputStream s) * * @throws IndexOutOfBoundsException {@inheritDoc} */ - public synchronized ListIterator listIterator( int index) { + public synchronized ListIterator listIterator(int index) { if (index < 0 || index > elementCount) throw new IndexOutOfBoundsException("Index: "+index); return new ListItr(index); @@ -1247,7 +1229,6 @@ public synchronized ListIterator listIterator() { * * @return an iterator over the elements in this list in proper sequence */ - public synchronized Iterator iterator() { return new Itr(); } @@ -1387,7 +1368,6 @@ public synchronized void forEach(Consumer action) { /** * @throws NullPointerException {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) @Override public synchronized void replaceAll(UnaryOperator operator) { Objects.requireNonNull(operator); @@ -1425,7 +1405,6 @@ public synchronized void sort(@Nullable Comparator c) { * @return a {@code Spliterator} over the elements in this list * @since 1.8 */ - @Override public Spliterator spliterator() { return new VectorSpliterator(null, 0, -1, 0); diff --git a/src/java.base/share/classes/java/util/WeakHashMap.java b/src/java.base/share/classes/java/util/WeakHashMap.java index 9551385c830..1f59a94b2b4 100644 --- a/src/java.base/share/classes/java/util/WeakHashMap.java +++ b/src/java.base/share/classes/java/util/WeakHashMap.java @@ -28,7 +28,6 @@ import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; -import java.lang.ref.WeakReference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.function.BiConsumer; @@ -224,7 +223,7 @@ private Entry[] newTable(int n) { * @throws IllegalArgumentException if the initial capacity is negative, * or if the load factor is nonpositive. */ - public WeakHashMap( int initialCapacity, float loadFactor) { + public WeakHashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal Initial Capacity: "+ initialCapacity); @@ -251,7 +250,7 @@ public WeakHashMap( int initialCapacity, float loadFactor) { * @param initialCapacity The initial capacity of the {@code WeakHashMap} * @throws IllegalArgumentException if the initial capacity is negative */ - public WeakHashMap( int initialCapacity) { + public WeakHashMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); } @@ -390,8 +389,7 @@ private Entry[] getTable() { * entries that will be removed before next attempted access * because they are no longer referenced. */ - - public int size() { + public int size() { if (size == 0) return 0; expungeStaleEntries(); @@ -404,7 +402,6 @@ public int size() { * entries that will be removed before next attempted access * because they are no longer referenced. */ - public boolean isEmpty() { return size() == 0; } @@ -427,7 +424,6 @@ public boolean isEmpty() { * * @see #put(Object, Object) */ - public @Nullable V get(@Nullable Object key) { Object k = maskNull(key); int h = hash(k); @@ -450,8 +446,6 @@ public boolean isEmpty() { * @return {@code true} if there is a mapping for {@code key}; * {@code false} otherwise */ - - public boolean containsKey(@Nullable Object key) { return getEntry(key) != null; } @@ -718,7 +712,6 @@ public void clear() { * @return {@code true} if this map maps one or more keys to the * specified value */ - public boolean containsValue(@Nullable Object value) { if (value==null) return containsNullValue(); @@ -910,8 +903,7 @@ public Map.Entry next() { * operations. It does not support the {@code add} or {@code addAll} * operations. */ - - public Set< K> keySet() { + public Set keySet() { Set ks = keySet; if (ks == null) { ks = new KeySet(); @@ -921,13 +913,11 @@ public Set< K> keySet() { } private class KeySet extends AbstractSet { - public Iterator iterator() { return new KeyIterator(); } - - public int size() { + public int size() { return WeakHashMap.this.size(); } @@ -948,7 +938,6 @@ public void clear() { WeakHashMap.this.clear(); } - public Spliterator spliterator() { return new KeySpliterator<>(WeakHashMap.this, 0, -1, 0, 0); } @@ -967,7 +956,6 @@ public Spliterator spliterator() { * {@code retainAll} and {@code clear} operations. It does not * support the {@code add} or {@code addAll} operations. */ - public Collection values() { Collection vs = values; if (vs == null) { @@ -978,13 +966,11 @@ public Collection values() { } private class Values extends AbstractCollection { - public Iterator iterator() { return new ValueIterator(); } - - public int size() { + public int size() { return WeakHashMap.this.size(); } @@ -996,7 +982,6 @@ public void clear() { WeakHashMap.this.clear(); } - public Spliterator spliterator() { return new ValueSpliterator<>(WeakHashMap.this, 0, -1, 0, 0); } @@ -1016,14 +1001,12 @@ public Spliterator spliterator() { * {@code clear} operations. It does not support the * {@code add} or {@code addAll} operations. */ - - public Set> entrySet() { + public Set> entrySet() { Set> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); } private class EntrySet extends AbstractSet> { - public Iterator> iterator() { return new EntryIterator(); } @@ -1038,8 +1021,7 @@ public boolean remove(Object o) { return removeMapping(o); } - - public int size() { + public int size() { return WeakHashMap.this.size(); } @@ -1054,17 +1036,14 @@ private List> deepCopy() { return list; } - public Object[] toArray() { return deepCopy().toArray(); } - public T[] toArray(T[] a) { return deepCopy().toArray(a); } - public Spliterator> spliterator() { return new EntrySpliterator<>(WeakHashMap.this, 0, -1, 0, 0); } diff --git a/src/java.base/share/classes/java/util/concurrent/ArrayBlockingQueue.java b/src/java.base/share/classes/java/util/concurrent/ArrayBlockingQueue.java index 22783174621..96e68136841 100644 --- a/src/java.base/share/classes/java/util/concurrent/ArrayBlockingQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/ArrayBlockingQueue.java @@ -462,7 +462,6 @@ public E take() throws InterruptedException { * * @return the number of elements in this queue */ - public int size() { final ReentrantLock lock = this.lock; lock.lock(); diff --git a/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java b/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java index 4bc7d6d48fc..e0709f2569f 100644 --- a/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java +++ b/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java @@ -617,7 +617,6 @@ boolean offer(E e, long timeout, TimeUnit unit) * @throws NullPointerException if the specified element is null * (optional) */ - boolean contains(@Nullable Object o); /** @@ -625,7 +624,6 @@ boolean offer(E e, long timeout, TimeUnit unit) * * @return the number of elements in this deque */ - int size(); /** @@ -634,7 +632,6 @@ boolean offer(E e, long timeout, TimeUnit unit) * * @return an iterator over the elements in this deque in proper sequence */ - Iterator iterator(); // *** Stack methods *** diff --git a/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java b/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java index 4c93c9f293b..4a29843d37e 100644 --- a/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java @@ -325,7 +325,6 @@ boolean offer(E e, long timeout, TimeUnit unit) * @throws NullPointerException if the specified element is null * (optional) */ - boolean contains(@Nullable Object o); /** diff --git a/src/java.base/share/classes/java/util/concurrent/Callable.java b/src/java.base/share/classes/java/util/concurrent/Callable.java index 4be6ef443dd..1d5885f9510 100644 --- a/src/java.base/share/classes/java/util/concurrent/Callable.java +++ b/src/java.base/share/classes/java/util/concurrent/Callable.java @@ -57,7 +57,6 @@ * @author Doug Lea * @param the result type of method {@code call} */ - @NullMarked @FunctionalInterface public interface Callable { diff --git a/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java b/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java index 467eb33110b..ec1f0337975 100644 --- a/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java +++ b/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java @@ -144,8 +144,7 @@ * @since 1.8 */ @NullMarked -public class CompletableFuture - implements Future, CompletionStage { +public class CompletableFuture implements Future, CompletionStage { /* * Overview: @@ -2025,7 +2024,8 @@ public CompletableFuture() { * @param the function's return type * @return the new CompletableFuture */ - public static CompletableFuture supplyAsync(Supplier supplier, Executor executor) { + public static CompletableFuture supplyAsync(Supplier supplier, + Executor executor) { return asyncSupplyStage(Objects.requireNonNull(executor), supplier); } @@ -2266,22 +2266,19 @@ public boolean completeExceptionally(Throwable ex) { return uniRunStage(Objects.requireNonNull(executor), action); } - public - CompletableFuture thenCombine( + public CompletableFuture thenCombine( CompletionStage other, BiFunction fn) { return biApplyStage(null, other, fn); } - public - CompletableFuture thenCombineAsync( + public CompletableFuture thenCombineAsync( CompletionStage other, BiFunction fn) { return biApplyStage(defaultExecutor(), other, fn); } - public - CompletableFuture thenCombineAsync( + public CompletableFuture thenCombineAsync( CompletionStage other, BiFunction fn, Executor executor) { return biApplyStage(Objects.requireNonNull(executor), other, fn); @@ -2293,15 +2290,13 @@ CompletableFuture thenCombineAsync( return biAcceptStage(null, other, action); } - public CompletableFuture<@Nullable Void> - thenAcceptBothAsync( + public CompletableFuture<@Nullable Void> thenAcceptBothAsync( CompletionStage other, BiConsumer action) { return biAcceptStage(defaultExecutor(), other, action); } - public CompletableFuture<@Nullable Void> - thenAcceptBothAsync( + public CompletableFuture<@Nullable Void> thenAcceptBothAsync( CompletionStage other, BiConsumer action, Executor executor) { return biAcceptStage(Objects.requireNonNull(executor), other, action); @@ -2398,8 +2393,7 @@ public CompletableFuture whenCompleteAsync( } public CompletableFuture whenCompleteAsync( - BiConsumer action, - Executor executor) { + BiConsumer action, Executor executor) { return uniWhenCompleteStage(Objects.requireNonNull(executor), action); } @@ -2414,8 +2408,7 @@ public CompletableFuture whenCompleteAsync( } public CompletableFuture handleAsync( - BiFunction fn, - Executor executor) { + BiFunction fn, Executor executor) { return uniHandleStage(Objects.requireNonNull(executor), fn); } diff --git a/src/java.base/share/classes/java/util/concurrent/CompletionStage.java b/src/java.base/share/classes/java/util/concurrent/CompletionStage.java index 6ce9125b537..314ec27d1b7 100644 --- a/src/java.base/share/classes/java/util/concurrent/CompletionStage.java +++ b/src/java.base/share/classes/java/util/concurrent/CompletionStage.java @@ -324,7 +324,7 @@ public interface CompletionStage { * @param the function's return type * @return the new CompletionStage */ - public CompletionStage thenCombine + public CompletionStage thenCombine (CompletionStage other, BiFunction fn); @@ -344,7 +344,7 @@ public interface CompletionStage { * @param the function's return type * @return the new CompletionStage */ - public CompletionStage thenCombineAsync + public CompletionStage thenCombineAsync (CompletionStage other, BiFunction fn); @@ -365,7 +365,7 @@ public interface CompletionStage { * @param the function's return type * @return the new CompletionStage */ - public CompletionStage thenCombineAsync + public CompletionStage thenCombineAsync (CompletionStage other, BiFunction fn, Executor executor); diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java index 08f61639f28..93d37f3f5fe 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java @@ -35,7 +35,6 @@ package java.util.concurrent; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; @@ -926,7 +925,6 @@ public ConcurrentHashMap(int initialCapacity, /** * {@inheritDoc} */ - public int size() { long n = sumCount(); return ((n < 0L) ? 0 : @@ -937,7 +935,6 @@ public int size() { /** * {@inheritDoc} */ - public boolean isEmpty() { return sumCount() <= 0L; // ignore transient negative values } @@ -953,7 +950,6 @@ public boolean isEmpty() { * * @throws NullPointerException if the specified key is null */ - public @Nullable V get(Object key) { Node[] tab; Node e, p; int n, eh; K ek; int h = spread(key.hashCode()); @@ -983,8 +979,6 @@ else if (eh < 0) * {@code equals} method; {@code false} otherwise * @throws NullPointerException if the specified key is null */ - - public boolean containsKey(Object key) { return get(key) != null; } @@ -999,7 +993,6 @@ public boolean containsKey(Object key) { * specified value * @throws NullPointerException if the specified value is null */ - public boolean containsValue(Object value) { if (value == null) throw new NullPointerException(); @@ -1028,7 +1021,6 @@ public boolean containsValue(Object value) { * {@code null} if there was no mapping for {@code key} * @throws NullPointerException if the specified key or value is null */ - public @Nullable V put(K key, V value) { return putVal(key, value, false); } @@ -1262,8 +1254,7 @@ else if ((fh = f.hash) == MOVED) { * * @return the set view */ - - public KeySetView< K,V> keySet() { + public KeySetView keySet() { KeySetView ks; if ((ks = keySet) != null) return ks; return keySet = new KeySetView(this, null); @@ -1287,7 +1278,6 @@ public KeySetView< K,V> keySet() { * * @return the collection view */ - public Collection values() { ValuesView vs; if ((vs = values) != null) return vs; @@ -1311,8 +1301,7 @@ public Collection values() { * * @return the set view */ - - public Set> entrySet() { + public Set> entrySet() { EntrySetView es; if ((es = entrySet) != null) return es; return entrySet = new EntrySetView(this); @@ -1379,8 +1368,6 @@ public String toString() { * @param o object to be compared for equality with this map * @return {@code true} if the specified object is equal to this map */ - - public boolean equals(@Nullable Object o) { if (o != this) { if (!(o instanceof Map)) @@ -1579,7 +1566,6 @@ private void readObject(java.io.ObjectInputStream s) * or {@code null} if there was no mapping for the key * @throws NullPointerException if the specified key or value is null */ - public @Nullable V putIfAbsent(K key, V value) { return putVal(key, value, true); } @@ -2176,7 +2162,6 @@ else if (f instanceof ReservationNode) * {@code false} otherwise * @throws NullPointerException if the specified value is null */ - public boolean contains(Object value) { return containsValue(value); } @@ -2187,8 +2172,7 @@ public boolean contains(Object value) { * @return an enumeration of the keys in this table * @see #keySet() */ - - public Enumeration< K> keys() { + public Enumeration keys() { Node[] t; int f = (t = table) == null ? 0 : t.length; return new KeyIterator(t, f, 0, f, this); @@ -2200,7 +2184,6 @@ public Enumeration< K> keys() { * @return an enumeration of the values in this table * @see #values() */ - public Enumeration elements() { Node[] t; int f = (t = table) == null ? 0 : t.length; @@ -4491,9 +4474,7 @@ abstract static sealed class CollectionView * the mappings from the map backing this view. */ public final void clear() { map.clear(); } - public final int size() { return map.size(); } - public final boolean isEmpty() { return map.isEmpty(); } // implementations below rely on concrete classes supplying these @@ -4506,14 +4487,12 @@ abstract static sealed class CollectionView * * @return an iterator over the elements in this collection */ - public abstract Iterator iterator(); public abstract boolean contains(Object o); public abstract boolean remove(Object o); private static final String OOME_MSG = "Required array size too large"; - public final @Nullable Object[] toArray() { long sz = map.mappingCount(); if (sz > MAX_ARRAY_SIZE) @@ -4536,7 +4515,6 @@ abstract static sealed class CollectionView return (i == n) ? r : Arrays.copyOf(r, i); } - @SuppressWarnings("unchecked") public final T[] toArray(T[] a) { long sz = map.mappingCount(); @@ -4594,7 +4572,7 @@ public final String toString() { return sb.append(']').toString(); } - public final boolean containsAll(Collection c) { + public final boolean containsAll(Collection c) { if (c != this) { for (Object e : c) { if (e == null || !contains(e)) @@ -4694,7 +4672,6 @@ public static final class KeySetView extends CollectionView /** * @return an iterator over the keys of the backing map */ - public Iterator iterator() { Node[] t; ConcurrentHashMap m = map; @@ -4756,7 +4733,6 @@ public boolean equals(Object o) { (containsAll(c) && c.containsAll(this)))); } - public Spliterator spliterator() { Node[] t; ConcurrentHashMap m = map; @@ -4801,7 +4777,6 @@ public final boolean remove(Object o) { return false; } - public final Iterator iterator() { ConcurrentHashMap m = map; Node[] t; @@ -4832,7 +4807,6 @@ public boolean removeIf(Predicate filter) { return map.removeValueIf(filter); } - public Spliterator spliterator() { Node[] t; ConcurrentHashMap m = map; @@ -4882,7 +4856,6 @@ public boolean remove(Object o) { /** * @return an iterator over the entries of the backing map */ - public Iterator> iterator() { ConcurrentHashMap m = map; Node[] t; @@ -4926,7 +4899,6 @@ public final boolean equals(Object o) { (containsAll(c) && c.containsAll(this)))); } - public Spliterator> spliterator() { Node[] t; ConcurrentHashMap m = map; diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java index 6a206f45fa9..6219a8c755f 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java @@ -1078,7 +1078,6 @@ public boolean removeLastOccurrence(Object o) { * @param o element whose presence in this deque is to be tested * @return {@code true} if this deque contains the specified element */ - public boolean contains(@Nullable Object o) { if (o != null) { for (Node p = first(); p != null; p = succ(p)) { @@ -1095,8 +1094,6 @@ public boolean contains(@Nullable Object o) { * * @return {@code true} if this collection contains no elements */ - - public boolean isEmpty() { return peekFirst() == null; } @@ -1117,7 +1114,6 @@ public boolean isEmpty() { * * @return the number of elements in this deque */ - public int size() { restart: for (;;) { int count = 0; @@ -1290,7 +1286,6 @@ else if (a != null && size <= a.length) { * * @return an array containing all of the elements in this deque */ - public Object[] toArray() { return toArrayInternal(null); } @@ -1332,7 +1327,6 @@ public Object[] toArray() { * this deque * @throws NullPointerException if the specified array is null */ - @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a == null) throw new NullPointerException(); @@ -1348,7 +1342,6 @@ public Object[] toArray() { * * @return an iterator over the elements in this deque in proper sequence */ - public Iterator iterator() { return new Itr(); } @@ -1554,7 +1547,6 @@ public int characteristics() { * @return a {@code Spliterator} over the elements in this deque * @since 1.8 */ - public Spliterator spliterator() { return new CLDSpliterator(); } diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java index 4795d71e22b..58aadd3a84c 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java @@ -447,7 +447,6 @@ else if (p == q) * * @return {@code true} if this queue contains no elements */ - public boolean isEmpty() { return first() == null; } @@ -468,7 +467,6 @@ public boolean isEmpty() { * * @return the number of elements in this queue */ - public int size() { restartFromHead: for (;;) { int count = 0; @@ -491,7 +489,6 @@ public int size() { * @param o object to be checked for containment in this queue * @return {@code true} if this queue contains the specified element */ - public boolean contains(@Nullable Object o) { if (o == null) return false; restartFromHead: for (;;) { @@ -678,7 +675,6 @@ else if (a != null && size <= a.length) { * * @return an array containing all of the elements in this queue */ - public Object[] toArray() { return toArrayInternal(null); } @@ -718,7 +714,6 @@ public Object[] toArray() { * this queue * @throws NullPointerException if the specified array is null */ - @SuppressWarnings("unchecked") public T[] toArray(T[] a) { Objects.requireNonNull(a); @@ -734,7 +729,6 @@ public Object[] toArray() { * * @return an iterator over the elements in this queue in proper sequence */ - public Iterator iterator() { return new Itr(); } @@ -961,7 +955,6 @@ public int characteristics() { * @return a {@code Spliterator} over the elements in this queue * @since 1.8 */ - @Override public Spliterator spliterator() { return new CLQSpliterator(); diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentMap.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentMap.java index f4e4084fd61..aa71d5e031c 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentMap.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentMap.java @@ -35,7 +35,6 @@ package java.util.concurrent; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; @@ -159,7 +158,6 @@ default void forEach(BiConsumer action) { * @throws IllegalArgumentException if some property of the specified key * or value prevents it from being stored in this map */ - @Nullable V putIfAbsent(K key, V value); /** diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java index 601adc3b83a..67414203803 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java @@ -1297,7 +1297,6 @@ private void readObject(final java.io.ObjectInputStream s) * with the keys currently in the map * @throws NullPointerException if the specified key is null */ - public boolean containsKey(Object key) { return doGet(key) != null; } @@ -1381,7 +1380,6 @@ public boolean containsKey(Object key) { * {@code false} otherwise * @throws NullPointerException if the specified value is null */ - public boolean containsValue(Object value) { if (value == null) throw new NullPointerException(); @@ -1400,7 +1398,6 @@ public boolean containsValue(Object value) { /** * {@inheritDoc} */ - public int size() { long c; return ((baseHead() == null) ? 0 : @@ -1411,7 +1408,6 @@ public int size() { /** * {@inheritDoc} */ - public boolean isEmpty() { return findFirst() == null; } @@ -1627,7 +1623,6 @@ public NavigableSet keySet() { return keySet = new KeySet<>(this); } - public NavigableSet navigableKeySet() { KeySet ks; if ((ks = keySet) != null) return ks; @@ -1686,14 +1681,12 @@ public Collection values() { * @return a set view of the mappings contained in this map, * sorted in ascending key order */ - public Set> entrySet() { EntrySet es; if ((es = entrySet) != null) return es; return entrySet = new EntrySet(this); } - public ConcurrentNavigableMap descendingMap() { ConcurrentNavigableMap dm; if ((dm = descendingMap) != null) return dm; @@ -1701,7 +1694,6 @@ public ConcurrentNavigableMap descendingMap() { new SubMap(this, null, false, null, false, true); } - public NavigableSet descendingKeySet() { return descendingMap().navigableKeySet(); } @@ -1720,8 +1712,6 @@ public NavigableSet descendingKeySet() { * @param o object to be compared for equality with this map * @return {@code true} if the specified object is equal to this map */ - - public boolean equals(@Nullable Object o) { if (o == this) return true; @@ -1918,7 +1908,6 @@ public K lastKey() { * @throws NullPointerException if {@code fromKey} or {@code toKey} is null * @throws IllegalArgumentException {@inheritDoc} */ - public ConcurrentNavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, @@ -1934,7 +1923,6 @@ public ConcurrentNavigableMap subMap(K fromKey, * @throws NullPointerException if {@code toKey} is null * @throws IllegalArgumentException {@inheritDoc} */ - public ConcurrentNavigableMap headMap(K toKey, boolean inclusive) { if (toKey == null) @@ -1948,7 +1936,6 @@ public ConcurrentNavigableMap headMap(K toKey, * @throws NullPointerException if {@code fromKey} is null * @throws IllegalArgumentException {@inheritDoc} */ - public ConcurrentNavigableMap tailMap(K fromKey, boolean inclusive) { if (fromKey == null) @@ -1962,7 +1949,6 @@ public ConcurrentNavigableMap tailMap(K fromKey, * @throws NullPointerException if {@code fromKey} or {@code toKey} is null * @throws IllegalArgumentException {@inheritDoc} */ - public ConcurrentNavigableMap subMap(K fromKey, K toKey) { return subMap(fromKey, true, toKey, false); } @@ -1972,7 +1958,6 @@ public ConcurrentNavigableMap subMap(K fromKey, K toKey) { * @throws NullPointerException if {@code toKey} is null * @throws IllegalArgumentException {@inheritDoc} */ - public ConcurrentNavigableMap headMap(K toKey) { return headMap(toKey, false); } @@ -1982,7 +1967,6 @@ public ConcurrentNavigableMap headMap(K toKey) { * @throws NullPointerException if {@code fromKey} is null * @throws IllegalArgumentException {@inheritDoc} */ - public ConcurrentNavigableMap tailMap(K fromKey) { return tailMap(fromKey, true); } @@ -2219,9 +2203,7 @@ static final class KeySet extends AbstractSet implements NavigableSet { final ConcurrentNavigableMap m; KeySet(ConcurrentNavigableMap map) { m = map; } - public int size() { return m.size(); } - public boolean isEmpty() { return m.isEmpty(); } public boolean contains(Object o) { return m.containsKey(o); } public boolean remove(Object o) { return m.remove(o) != null; } @@ -2306,9 +2288,7 @@ public Iterator iterator() { ? ((ConcurrentSkipListMap)m).new ValueIterator() : ((SubMap)m).new SubMapValueIterator(); } - public int size() { return m.size(); } - public boolean isEmpty() { return m.isEmpty(); } public boolean contains(Object o) { return m.containsValue(o); } public void clear() { m.clear(); } @@ -2364,11 +2344,9 @@ public boolean remove(Object o) { return m.remove(e.getKey(), e.getValue()); } - public boolean isEmpty() { return m.isEmpty(); } - public int size() { return m.size(); } @@ -2670,7 +2648,6 @@ K getNearKey(K key, int rel) { /* ---------------- Map API methods -------------- */ - public boolean containsKey(Object key) { if (key == null) throw new NullPointerException(); return inBounds(key, m.comparator) && m.containsKey(key); @@ -2690,7 +2667,6 @@ public V remove(Object key) { return (!inBounds(key, m.comparator)) ? null : m.remove(key); } - public int size() { Comparator cmp = m.comparator; long count = 0; @@ -2703,13 +2679,11 @@ public int size() { return count >= Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)count; } - public boolean isEmpty() { Comparator cmp = m.comparator; return !isBeforeEnd(loNode(cmp), cmp); } - public boolean containsValue(Object value) { if (value == null) throw new NullPointerException(); @@ -2806,7 +2780,6 @@ SubMap newSubMap(K fromKey, boolean fromInclusive, toKey, toInclusive, isDescending); } - public SubMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { if (fromKey == null || toKey == null) @@ -2814,36 +2787,30 @@ public SubMap subMap(K fromKey, boolean fromInclusive, return newSubMap(fromKey, fromInclusive, toKey, toInclusive); } - public SubMap headMap(K toKey, boolean inclusive) { if (toKey == null) throw new NullPointerException(); return newSubMap(null, false, toKey, inclusive); } - public SubMap tailMap(K fromKey, boolean inclusive) { if (fromKey == null) throw new NullPointerException(); return newSubMap(fromKey, inclusive, null, false); } - public SubMap subMap(K fromKey, K toKey) { return subMap(fromKey, true, toKey, false); } - public SubMap headMap(K toKey) { return headMap(toKey, false); } - public SubMap tailMap(K fromKey) { return tailMap(fromKey, true); } - public SubMap descendingMap() { return new SubMap(m, lo, loInclusive, hi, hiInclusive, !isDescending); @@ -2915,7 +2882,6 @@ public NavigableSet keySet() { return keySetView = new KeySet<>(this); } - public NavigableSet navigableKeySet() { KeySet ks; if ((ks = keySetView) != null) return ks; @@ -2928,14 +2894,12 @@ public Collection values() { return valuesView = new Values<>(this); } - public Set> entrySet() { EntrySet es; if ((es = entrySetView) != null) return es; return entrySetView = new EntrySet(this); } - public NavigableSet descendingKeySet() { return descendingMap().navigableKeySet(); } diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java index b961bc7e352..e0f3c582894 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java @@ -176,7 +176,6 @@ public ConcurrentSkipListSet(SortedSet s) { * * @return a shallow copy of this set */ - public ConcurrentSkipListSet clone() { try { @SuppressWarnings("unchecked") @@ -204,7 +203,6 @@ public ConcurrentSkipListSet clone() { * * @return the number of elements in this set */ - public int size() { return m.size(); } @@ -213,7 +211,6 @@ public int size() { * Returns {@code true} if this set contains no elements. * @return {@code true} if this set contains no elements */ - public boolean isEmpty() { return m.isEmpty(); } @@ -229,7 +226,6 @@ public boolean isEmpty() { * compared with the elements currently in this set * @throws NullPointerException if the specified element is null */ - public boolean contains(Object o) { return m.containsKey(o); } @@ -282,7 +278,6 @@ public void clear() { * * @return an iterator over the elements in this set in ascending order */ - public Iterator iterator() { return m.navigableKeySet().iterator(); } @@ -311,8 +306,6 @@ public Iterator descendingIterator() { * @param o the object to be compared for equality with this set * @return {@code true} if the specified object is equal to this set */ - - public boolean equals(@Nullable Object o) { // Override AbstractSet version to avoid calling size() if (o == this) @@ -397,7 +390,6 @@ public boolean removeAll(Collection c) { /* ---------------- SortedSet operations -------------- */ - public @Nullable Comparator comparator() { return m.comparator(); } @@ -535,8 +527,6 @@ public NavigableSet descendingSet() { * @return a {@code Spliterator} over the elements in this set * @since 1.8 */ - @SuppressWarnings({"unchecked"}) - public Spliterator spliterator() { return (m instanceof ConcurrentSkipListMap) ? ((ConcurrentSkipListMap)m).keySpliterator() diff --git a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java index 0a3407f3adc..8c70d7d88a0 100644 --- a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java +++ b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java @@ -178,7 +178,6 @@ public CopyOnWriteArrayList(E[] toCopyIn) { * * @return the number of elements in this list */ - public int size() { return getArray().length; } @@ -188,7 +187,6 @@ public int size() { * * @return {@code true} if this list contains no elements */ - public boolean isEmpty() { return size() == 0; } @@ -1079,8 +1077,6 @@ public String toString() { * @param o the object to be compared for equality with this list * @return {@code true} if the specified object is equal to this list */ - - public boolean equals(@Nullable Object o) { if (o == this) return true; @@ -1404,7 +1400,6 @@ public boolean containsAll(Collection c) { return true; } - public boolean isEmpty() { return size() == 0; } diff --git a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java index 0743059c58f..ce4e73a09b4 100644 --- a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java +++ b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java @@ -144,7 +144,6 @@ public CopyOnWriteArraySet(Collection c) { * * @return the number of elements in this set */ - public int size() { return al.size(); } @@ -154,7 +153,6 @@ public int size() { * * @return {@code true} if this set contains no elements */ - public boolean isEmpty() { return al.isEmpty(); } @@ -419,8 +417,6 @@ public Iterator iterator() { * @param o object to be compared for equality with this set * @return {@code true} if the specified object is equal to this set */ - - public boolean equals(@Nullable Object o) { return (o == this) || ((o instanceof Set) diff --git a/src/java.base/share/classes/java/util/concurrent/DelayQueue.java b/src/java.base/share/classes/java/util/concurrent/DelayQueue.java index d592d88c286..5e4fbfdecf4 100644 --- a/src/java.base/share/classes/java/util/concurrent/DelayQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/DelayQueue.java @@ -100,7 +100,7 @@ * @param the type of elements held in this queue */ @NullMarked -public class DelayQueue extends AbstractQueue +public class DelayQueue extends AbstractQueue implements BlockingQueue { private final transient ReentrantLock lock = new ReentrantLock(); @@ -356,7 +356,6 @@ public E remove() { } } - public int size() { final ReentrantLock lock = this.lock; lock.lock(); @@ -446,7 +445,6 @@ public int remainingCapacity() { * * @return an array containing all of the elements in this queue */ - public Object[] toArray() { final ReentrantLock lock = this.lock; lock.lock(); @@ -492,7 +490,6 @@ public Object[] toArray() { * this queue * @throws NullPointerException if the specified array is null */ - public T[] toArray(T[] a) { final ReentrantLock lock = this.lock; lock.lock(); @@ -545,7 +542,6 @@ void removeEQ(Object o) { * * @return an iterator over the elements in this queue */ - public Iterator iterator() { return new Itr(toArray()); } diff --git a/src/java.base/share/classes/java/util/concurrent/ExecutionException.java b/src/java.base/share/classes/java/util/concurrent/ExecutionException.java index 8c101175ac9..4aa41198df0 100644 --- a/src/java.base/share/classes/java/util/concurrent/ExecutionException.java +++ b/src/java.base/share/classes/java/util/concurrent/ExecutionException.java @@ -56,7 +56,6 @@ public class ExecutionException extends Exception { * The cause is not initialized, and may subsequently be * initialized by a call to {@link #initCause(Throwable) initCause}. */ - protected ExecutionException() { } /** @@ -66,7 +65,6 @@ protected ExecutionException() { } * * @param message the detail message */ - protected ExecutionException(@Nullable String message) { super(message); } @@ -79,7 +77,6 @@ protected ExecutionException(@Nullable String message) { * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method) */ - public ExecutionException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -93,7 +90,6 @@ public ExecutionException(@Nullable String message, @Nullable Throwable cause) { * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method) */ - public ExecutionException(@Nullable Throwable cause) { super(cause); } diff --git a/src/java.base/share/classes/java/util/concurrent/ExecutorService.java b/src/java.base/share/classes/java/util/concurrent/ExecutorService.java index 12079a98b49..58568d6981b 100644 --- a/src/java.base/share/classes/java/util/concurrent/ExecutorService.java +++ b/src/java.base/share/classes/java/util/concurrent/ExecutorService.java @@ -264,7 +264,7 @@ boolean awaitTermination(long timeout, TimeUnit unit) * scheduled for execution * @throws NullPointerException if the task is null */ - Future< ?> submit(Runnable task); + Future submit(Runnable task); /** * Executes the given tasks, returning a list of Futures holding diff --git a/src/java.base/share/classes/java/util/concurrent/Future.java b/src/java.base/share/classes/java/util/concurrent/Future.java index cb0d71b73a5..6cb89f068dc 100644 --- a/src/java.base/share/classes/java/util/concurrent/Future.java +++ b/src/java.base/share/classes/java/util/concurrent/Future.java @@ -143,7 +143,6 @@ public interface Future { * * @return {@code true} if this task was cancelled before it completed */ - boolean isCancelled(); /** @@ -155,7 +154,6 @@ public interface Future { * * @return {@code true} if this task completed */ - boolean isDone(); /** diff --git a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java index a58a819ff87..cd334b280ab 100644 --- a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java +++ b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java @@ -817,7 +817,6 @@ public boolean remove(@Nullable Object o) { * * @return the number of elements in this deque */ - public int size() { return count; } diff --git a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingQueue.java b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingQueue.java index be30139b2e2..51c9a3052e3 100644 --- a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingQueue.java @@ -299,7 +299,6 @@ public LinkedBlockingQueue(Collection c) { * * @return the number of elements in this queue */ - public int size() { return count.get(); } diff --git a/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java b/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java index c8cc902f509..fa4a136b448 100644 --- a/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java @@ -1346,7 +1346,6 @@ else if (item == null) * * @return {@code true} if this queue contains no elements */ - public boolean isEmpty() { return firstDataNode() == null; } @@ -1380,7 +1379,6 @@ else if (item == null) * * @return the number of elements in this queue */ - public int size() { return countOfMode(true); } diff --git a/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java b/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java index 8581b14eb4e..62d62aec883 100644 --- a/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java @@ -581,7 +581,6 @@ public E take() throws InterruptedException { return comparator; } - public int size() { final ReentrantLock lock = this.lock; lock.lock(); diff --git a/src/java.base/share/classes/java/util/concurrent/SynchronousQueue.java b/src/java.base/share/classes/java/util/concurrent/SynchronousQueue.java index 9dec54ed0f8..63775143cbc 100644 --- a/src/java.base/share/classes/java/util/concurrent/SynchronousQueue.java +++ b/src/java.base/share/classes/java/util/concurrent/SynchronousQueue.java @@ -362,7 +362,6 @@ public E take() throws InterruptedException { * * @return {@code true} */ - public boolean isEmpty() { return true; } @@ -373,7 +372,6 @@ public boolean isEmpty() { * * @return zero */ - public int size() { return 0; } @@ -402,7 +400,6 @@ public void clear() { * @param o the element * @return {@code false} */ - public boolean contains(@Nullable Object o) { return false; } @@ -425,7 +422,6 @@ public boolean remove(@Nullable Object o) { * @param c the collection * @return {@code false} unless given collection is empty */ - public boolean containsAll(Collection c) { return c.isEmpty(); } @@ -469,7 +465,6 @@ public boolean retainAll(Collection c) { * * @return an empty iterator */ - public Iterator iterator() { return Collections.emptyIterator(); } @@ -481,7 +476,6 @@ public Iterator iterator() { * @return an empty spliterator * @since 1.8 */ - public Spliterator spliterator() { return Spliterators.emptySpliterator(); } @@ -489,7 +483,6 @@ public Spliterator spliterator() { /** * {@return a zero-length array} */ - public Object[] toArray() { return new Object[0]; } @@ -502,7 +495,6 @@ public Object[] toArray() { * @return the specified array * @throws NullPointerException if the specified array is null */ - public T[] toArray(T[] a) { if (a.length > 0) a[0] = null; diff --git a/src/java.base/share/classes/java/util/function/BiFunction.java b/src/java.base/share/classes/java/util/function/BiFunction.java index b53e46b3dc9..19d648e3ec8 100644 --- a/src/java.base/share/classes/java/util/function/BiFunction.java +++ b/src/java.base/share/classes/java/util/function/BiFunction.java @@ -44,7 +44,6 @@ * @since 1.8 */ @NullMarked - @FunctionalInterface public interface BiFunction { diff --git a/src/java.base/share/classes/java/util/function/DoubleBinaryOperator.java b/src/java.base/share/classes/java/util/function/DoubleBinaryOperator.java index a96da4e4ffe..aefb758b89d 100644 --- a/src/java.base/share/classes/java/util/function/DoubleBinaryOperator.java +++ b/src/java.base/share/classes/java/util/function/DoubleBinaryOperator.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents an operation upon two {@code double}-valued operands and producing a diff --git a/src/java.base/share/classes/java/util/function/DoubleConsumer.java b/src/java.base/share/classes/java/util/function/DoubleConsumer.java index b72d4e2ac04..f730bd59023 100644 --- a/src/java.base/share/classes/java/util/function/DoubleConsumer.java +++ b/src/java.base/share/classes/java/util/function/DoubleConsumer.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/DoubleFunction.java b/src/java.base/share/classes/java/util/function/DoubleFunction.java index 983af9be089..987fbdbe2e0 100644 --- a/src/java.base/share/classes/java/util/function/DoubleFunction.java +++ b/src/java.base/share/classes/java/util/function/DoubleFunction.java @@ -41,7 +41,6 @@ * @since 1.8 */ @NullMarked - @FunctionalInterface public interface DoubleFunction { diff --git a/src/java.base/share/classes/java/util/function/DoublePredicate.java b/src/java.base/share/classes/java/util/function/DoublePredicate.java index a78ff21e67f..40b87ff3a4e 100644 --- a/src/java.base/share/classes/java/util/function/DoublePredicate.java +++ b/src/java.base/share/classes/java/util/function/DoublePredicate.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/DoubleSupplier.java b/src/java.base/share/classes/java/util/function/DoubleSupplier.java index b6d5dbf4e74..3418fd0cef9 100644 --- a/src/java.base/share/classes/java/util/function/DoubleSupplier.java +++ b/src/java.base/share/classes/java/util/function/DoubleSupplier.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a supplier of {@code double}-valued results. This is the diff --git a/src/java.base/share/classes/java/util/function/DoubleToIntFunction.java b/src/java.base/share/classes/java/util/function/DoubleToIntFunction.java index db0af38ffba..7cc65aa4ad6 100644 --- a/src/java.base/share/classes/java/util/function/DoubleToIntFunction.java +++ b/src/java.base/share/classes/java/util/function/DoubleToIntFunction.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a function that accepts a double-valued argument and produces an diff --git a/src/java.base/share/classes/java/util/function/DoubleToLongFunction.java b/src/java.base/share/classes/java/util/function/DoubleToLongFunction.java index cd0b82513b3..9863b65db18 100644 --- a/src/java.base/share/classes/java/util/function/DoubleToLongFunction.java +++ b/src/java.base/share/classes/java/util/function/DoubleToLongFunction.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a function that accepts a double-valued argument and produces a diff --git a/src/java.base/share/classes/java/util/function/DoubleUnaryOperator.java b/src/java.base/share/classes/java/util/function/DoubleUnaryOperator.java index 2b4f50b9955..13d624ef096 100644 --- a/src/java.base/share/classes/java/util/function/DoubleUnaryOperator.java +++ b/src/java.base/share/classes/java/util/function/DoubleUnaryOperator.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/Function.java b/src/java.base/share/classes/java/util/function/Function.java index f225dd94b6a..3f06e214fea 100644 --- a/src/java.base/share/classes/java/util/function/Function.java +++ b/src/java.base/share/classes/java/util/function/Function.java @@ -41,7 +41,6 @@ * @since 1.8 */ @NullMarked - @FunctionalInterface public interface Function { diff --git a/src/java.base/share/classes/java/util/function/IntBinaryOperator.java b/src/java.base/share/classes/java/util/function/IntBinaryOperator.java index 3b236a512a6..04d27a9d6ac 100644 --- a/src/java.base/share/classes/java/util/function/IntBinaryOperator.java +++ b/src/java.base/share/classes/java/util/function/IntBinaryOperator.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents an operation upon two {@code int}-valued operands and producing an diff --git a/src/java.base/share/classes/java/util/function/IntConsumer.java b/src/java.base/share/classes/java/util/function/IntConsumer.java index c07a74ec703..28353c77362 100644 --- a/src/java.base/share/classes/java/util/function/IntConsumer.java +++ b/src/java.base/share/classes/java/util/function/IntConsumer.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/IntFunction.java b/src/java.base/share/classes/java/util/function/IntFunction.java index 61b87081798..05566c09a22 100644 --- a/src/java.base/share/classes/java/util/function/IntFunction.java +++ b/src/java.base/share/classes/java/util/function/IntFunction.java @@ -41,7 +41,6 @@ * @since 1.8 */ @NullMarked - @FunctionalInterface public interface IntFunction { diff --git a/src/java.base/share/classes/java/util/function/IntPredicate.java b/src/java.base/share/classes/java/util/function/IntPredicate.java index ea421c74bb7..5a0f202b4e3 100644 --- a/src/java.base/share/classes/java/util/function/IntPredicate.java +++ b/src/java.base/share/classes/java/util/function/IntPredicate.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/IntSupplier.java b/src/java.base/share/classes/java/util/function/IntSupplier.java index b9159be4968..f89709f4830 100644 --- a/src/java.base/share/classes/java/util/function/IntSupplier.java +++ b/src/java.base/share/classes/java/util/function/IntSupplier.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a supplier of {@code int}-valued results. This is the diff --git a/src/java.base/share/classes/java/util/function/IntToDoubleFunction.java b/src/java.base/share/classes/java/util/function/IntToDoubleFunction.java index c7b82450ba8..553068263b2 100644 --- a/src/java.base/share/classes/java/util/function/IntToDoubleFunction.java +++ b/src/java.base/share/classes/java/util/function/IntToDoubleFunction.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a function that accepts an int-valued argument and produces a diff --git a/src/java.base/share/classes/java/util/function/IntToLongFunction.java b/src/java.base/share/classes/java/util/function/IntToLongFunction.java index 2dfc4001677..ecf48305975 100644 --- a/src/java.base/share/classes/java/util/function/IntToLongFunction.java +++ b/src/java.base/share/classes/java/util/function/IntToLongFunction.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a function that accepts an int-valued argument and produces a diff --git a/src/java.base/share/classes/java/util/function/IntUnaryOperator.java b/src/java.base/share/classes/java/util/function/IntUnaryOperator.java index fd19d922b43..840b0173749 100644 --- a/src/java.base/share/classes/java/util/function/IntUnaryOperator.java +++ b/src/java.base/share/classes/java/util/function/IntUnaryOperator.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/LongBinaryOperator.java b/src/java.base/share/classes/java/util/function/LongBinaryOperator.java index db4484dc4e2..e3e0633d11e 100644 --- a/src/java.base/share/classes/java/util/function/LongBinaryOperator.java +++ b/src/java.base/share/classes/java/util/function/LongBinaryOperator.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents an operation upon two {@code long}-valued operands and producing a diff --git a/src/java.base/share/classes/java/util/function/LongConsumer.java b/src/java.base/share/classes/java/util/function/LongConsumer.java index d121eaaf62b..d4af7e115a7 100644 --- a/src/java.base/share/classes/java/util/function/LongConsumer.java +++ b/src/java.base/share/classes/java/util/function/LongConsumer.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/LongFunction.java b/src/java.base/share/classes/java/util/function/LongFunction.java index ba0eb1cc33a..15d139c0a0d 100644 --- a/src/java.base/share/classes/java/util/function/LongFunction.java +++ b/src/java.base/share/classes/java/util/function/LongFunction.java @@ -41,7 +41,6 @@ * @since 1.8 */ @NullMarked - @FunctionalInterface public interface LongFunction { diff --git a/src/java.base/share/classes/java/util/function/LongPredicate.java b/src/java.base/share/classes/java/util/function/LongPredicate.java index 08a9734318b..4dee7bc3da6 100644 --- a/src/java.base/share/classes/java/util/function/LongPredicate.java +++ b/src/java.base/share/classes/java/util/function/LongPredicate.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/LongSupplier.java b/src/java.base/share/classes/java/util/function/LongSupplier.java index db27babbec5..1791028458c 100644 --- a/src/java.base/share/classes/java/util/function/LongSupplier.java +++ b/src/java.base/share/classes/java/util/function/LongSupplier.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a supplier of {@code long}-valued results. This is the diff --git a/src/java.base/share/classes/java/util/function/LongToDoubleFunction.java b/src/java.base/share/classes/java/util/function/LongToDoubleFunction.java index ccd07bb6254..6f0aa9cb07c 100644 --- a/src/java.base/share/classes/java/util/function/LongToDoubleFunction.java +++ b/src/java.base/share/classes/java/util/function/LongToDoubleFunction.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a function that accepts a long-valued argument and produces a diff --git a/src/java.base/share/classes/java/util/function/LongToIntFunction.java b/src/java.base/share/classes/java/util/function/LongToIntFunction.java index 58ac8898470..ab9502ea688 100644 --- a/src/java.base/share/classes/java/util/function/LongToIntFunction.java +++ b/src/java.base/share/classes/java/util/function/LongToIntFunction.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Represents a function that accepts a long-valued argument and produces an diff --git a/src/java.base/share/classes/java/util/function/LongUnaryOperator.java b/src/java.base/share/classes/java/util/function/LongUnaryOperator.java index 34fe3d771c1..b1839c606a2 100644 --- a/src/java.base/share/classes/java/util/function/LongUnaryOperator.java +++ b/src/java.base/share/classes/java/util/function/LongUnaryOperator.java @@ -25,7 +25,6 @@ package java.util.function; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.util.Objects; diff --git a/src/java.base/share/classes/java/util/function/Supplier.java b/src/java.base/share/classes/java/util/function/Supplier.java index f4122a26838..7168fde408b 100644 --- a/src/java.base/share/classes/java/util/function/Supplier.java +++ b/src/java.base/share/classes/java/util/function/Supplier.java @@ -41,7 +41,6 @@ * @since 1.8 */ @NullMarked - @FunctionalInterface public interface Supplier { diff --git a/src/java.base/share/classes/java/util/jar/Attributes.java b/src/java.base/share/classes/java/util/jar/Attributes.java index 42560203241..5e93eb934e2 100644 --- a/src/java.base/share/classes/java/util/jar/Attributes.java +++ b/src/java.base/share/classes/java/util/jar/Attributes.java @@ -202,7 +202,6 @@ public Attributes(Attributes attr) { * @return true if this Map maps one or more attribute names to * the specified value */ - public boolean containsValue(@Nullable Object value) { return map.containsValue(value); } @@ -213,7 +212,6 @@ public boolean containsValue(@Nullable Object value) { * @param name the attribute name * @return true if this Map contains the specified attribute name */ - public boolean containsKey(@Nullable Object name) { return map.containsKey(name); } @@ -243,7 +241,6 @@ public void clear() { /** * Returns the number of attributes in this Map. */ - public int size() { return map.size(); } @@ -251,7 +248,6 @@ public int size() { /** * Returns true if this Map contains no attributes. */ - public boolean isEmpty() { return map.isEmpty(); } @@ -274,7 +270,6 @@ public Collection values() { * Returns a Collection view of the attribute name-value mappings * contained in this Map. */ - public Set> entrySet() { return map.entrySet(); } @@ -288,8 +283,6 @@ public Set> entrySet() { * @param o the Object to be compared * @return true if the specified Object is equal to this Map */ - - public boolean equals(@Nullable Object o) { return map.equals(o); } diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index 7140de0e96a..3da1771383a 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -200,14 +200,14 @@ public class JarFile extends ZipFile { } } - private static final String META_INF = "META-INF/"; + private static final String META_INF = "META-INF/"; - private static final String META_INF_VERSIONS = META_INF + "versions/"; + private static final String META_INF_VERSIONS = META_INF + "versions/"; /** * The JAR manifest file name. */ - public static final String MANIFEST_NAME = META_INF + "MANIFEST.MF"; + public static final String MANIFEST_NAME = META_INF + "MANIFEST.MF"; /** * The 'JAR index' feature has been removed, but JarInputStream and diff --git a/src/java.base/share/classes/java/util/regex/Matcher.java b/src/java.base/share/classes/java/util/regex/Matcher.java index edfbb334087..3b512dbede4 100644 --- a/src/java.base/share/classes/java/util/regex/Matcher.java +++ b/src/java.base/share/classes/java/util/regex/Matcher.java @@ -117,7 +117,7 @@ */ @NullMarked -public final class Matcher implements MatchResult { +public final class Matcher implements MatchResult { /** * The Pattern object that created this Matcher. @@ -643,7 +643,6 @@ public int end(String name) { * If no match has yet been attempted, * or if the previous match operation failed */ - public @Nullable String group() { return group(0); } @@ -740,8 +739,7 @@ public int end(String name) { * * @return The number of capturing groups in this matcher's pattern */ - - public int groupCount() { + public int groupCount() { return parentPattern.capturingGroupCount - 1; } @@ -810,7 +808,7 @@ public boolean find() { * sequence starting at the given index matches this matcher's * pattern */ - public boolean find( int start) { + public boolean find(int start) { int limit = getTextLength(); if ((start < 0) || (start > limit)) throw new IndexOutOfBoundsException("Illegal start index"); @@ -1550,7 +1548,7 @@ public String replaceFirst(Function replacer) { * @return this matcher * @since 1.5 */ - public Matcher region( int start, int end) { + public Matcher region(int start, int end) { if ((start < 0) || (start > getTextLength())) throw new IndexOutOfBoundsException("start"); if ((end < 0) || (end > getTextLength())) @@ -1572,8 +1570,7 @@ public Matcher region( int start, int end) { * @return The starting point of this matcher's region * @since 1.5 */ - - public int regionStart() { + public int regionStart() { return from; } @@ -1586,8 +1583,7 @@ public int regionStart() { * @return the ending point of this matcher's region * @since 1.5 */ - - public int regionEnd() { + public int regionEnd() { return to; } @@ -1608,7 +1604,6 @@ public int regionEnd() { * @see java.util.regex.Matcher#useTransparentBounds(boolean) * @since 1.5 */ - public boolean hasTransparentBounds() { return transparentBounds; } @@ -1660,7 +1655,6 @@ public Matcher useTransparentBounds(boolean b) { * @see java.util.regex.Matcher#useAnchoringBounds(boolean) * @since 1.5 */ - public boolean hasAnchoringBounds() { return anchoringBounds; } @@ -1699,7 +1693,6 @@ public Matcher useAnchoringBounds(boolean b) { * @return The string representation of this matcher * @since 1.5 */ - public String toString() { StringBuilder sb = new StringBuilder(); sb.append("java.util.regex.Matcher") @@ -1725,7 +1718,6 @@ public String toString() { * otherwise * @since 1.5 */ - public boolean hitEnd() { return hitEnd; } @@ -1744,7 +1736,6 @@ public boolean hitEnd() { * negative one. * @since 1.5 */ - public boolean requireEnd() { return requireEnd; } diff --git a/src/java.base/share/classes/java/util/regex/Pattern.java b/src/java.base/share/classes/java/util/regex/Pattern.java index 0fb37e885d2..19946c276f6 100644 --- a/src/java.base/share/classes/java/util/regex/Pattern.java +++ b/src/java.base/share/classes/java/util/regex/Pattern.java @@ -26,7 +26,6 @@ package java.util.regex; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.text.Normalizer; import java.text.Normalizer.Form; @@ -806,7 +805,7 @@ */ @NullMarked -public final class Pattern +public final class Pattern implements java.io.Serializable { @@ -1103,9 +1102,7 @@ public final class Pattern * @throws PatternSyntaxException * If the expression's syntax is invalid */ - - - public static Pattern compile( String regex) { + public static Pattern compile(String regex) { return new Pattern(regex, 0); } @@ -1138,9 +1135,7 @@ public static Pattern compile( String regex) { * marks for any character is too large, an {@link java.lang.OutOfMemoryError} * is thrown. */ - - - public static Pattern compile( String regex, int flags) { + public static Pattern compile(String regex, int flags) { return new Pattern(regex, flags); } @@ -1161,7 +1156,6 @@ public String pattern() { * @return The string representation of this pattern * @since 1.5 */ - public String toString() { return pattern; } @@ -1181,7 +1175,7 @@ public String toString() { * {@link java.lang.OutOfMemoryError} is thrown, * as in {@link #compile(String, int)}. */ - public Matcher matcher(CharSequence input) { + public Matcher matcher(CharSequence input) { if (!compiled) { synchronized(this) { if (!compiled) @@ -1227,7 +1221,7 @@ public int flags() { * @throws PatternSyntaxException * If the expression's syntax is invalid */ - public static boolean matches( String regex, CharSequence input) { + public static boolean matches(String regex, CharSequence input) { Pattern p = Pattern.compile(regex); Matcher m = p.matcher(input); return m.matches(); @@ -1506,9 +1500,7 @@ public String[] split(CharSequence input) { * @return A literal string replacement * @since 1.5 */ - - - public static String quote(String s) { + public static String quote(String s) { int slashEIndex = s.indexOf("\\E"); if (slashEIndex == -1) return "\\Q" + s + "\\E"; diff --git a/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java b/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java index 3be35b4a30e..5b8b0804b42 100644 --- a/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java +++ b/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java @@ -26,7 +26,6 @@ package java.util.regex; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Unchecked exception thrown to indicate a syntax error in a @@ -62,7 +61,6 @@ public class PatternSyntaxException * The approximate index in the pattern of the error, * or {@code -1} if the index is not known */ - public PatternSyntaxException(String desc, String regex, int index) { this.desc = desc; this.pattern = regex; @@ -75,7 +73,6 @@ public PatternSyntaxException(String desc, String regex, int index) { * @return The approximate index in the pattern of the error, * or {@code -1} if the index is not known */ - public int getIndex() { return index; } @@ -85,7 +82,6 @@ public int getIndex() { * * @return The description of the error */ - public String getDescription() { return desc; } @@ -95,7 +91,6 @@ public String getDescription() { * * @return The erroneous pattern */ - public String getPattern() { return pattern; } @@ -107,7 +102,6 @@ public String getPattern() { * * @return The full detail message */ - public String getMessage() { StringBuilder sb = new StringBuilder(); sb.append(desc); diff --git a/src/java.base/share/classes/java/util/stream/BaseStream.java b/src/java.base/share/classes/java/util/stream/BaseStream.java index b3f4e53205e..569dfbbf04f 100644 --- a/src/java.base/share/classes/java/util/stream/BaseStream.java +++ b/src/java.base/share/classes/java/util/stream/BaseStream.java @@ -73,7 +73,6 @@ public interface BaseStream iterator(); /** @@ -97,7 +96,6 @@ public interface BaseStream spliterator(); /** diff --git a/src/java.base/share/classes/java/util/stream/Collectors.java b/src/java.base/share/classes/java/util/stream/Collectors.java index e90a846017a..50c6732383f 100644 --- a/src/java.base/share/classes/java/util/stream/Collectors.java +++ b/src/java.base/share/classes/java/util/stream/Collectors.java @@ -2033,7 +2033,6 @@ public Iterator> iterator() { } @Override - public int size() { return 2; } diff --git a/src/java.base/share/classes/java/util/stream/DoubleStream.java b/src/java.base/share/classes/java/util/stream/DoubleStream.java index 6162130c71b..9ca30a35648 100644 --- a/src/java.base/share/classes/java/util/stream/DoubleStream.java +++ b/src/java.base/share/classes/java/util/stream/DoubleStream.java @@ -493,7 +493,6 @@ default DoubleStream dropWhile(DoublePredicate predicate) { * * @return an array containing the elements of this stream */ - double[] toArray(); /** @@ -935,11 +934,9 @@ default DoubleStream dropWhile(DoublePredicate predicate) { @Override DoubleStream parallel(); - @Override PrimitiveIterator.OfDouble iterator(); - @Override Spliterator.OfDouble spliterator(); diff --git a/src/java.base/share/classes/java/util/stream/IntStream.java b/src/java.base/share/classes/java/util/stream/IntStream.java index 00352614da4..ee6f3d61e76 100644 --- a/src/java.base/share/classes/java/util/stream/IntStream.java +++ b/src/java.base/share/classes/java/util/stream/IntStream.java @@ -489,7 +489,6 @@ default IntStream dropWhile(IntPredicate predicate) { * * @return an array containing the elements of this stream */ - int[] toArray(); /** @@ -877,11 +876,9 @@ default IntStream dropWhile(IntPredicate predicate) { @Override IntStream parallel(); - @Override PrimitiveIterator.OfInt iterator(); - @Override Spliterator.OfInt spliterator(); diff --git a/src/java.base/share/classes/java/util/stream/LongStream.java b/src/java.base/share/classes/java/util/stream/LongStream.java index a0e2671a5e7..a312f693085 100644 --- a/src/java.base/share/classes/java/util/stream/LongStream.java +++ b/src/java.base/share/classes/java/util/stream/LongStream.java @@ -491,7 +491,6 @@ default LongStream dropWhile(LongPredicate predicate) { * * @return an array containing the elements of this stream */ - long[] toArray(); /** @@ -866,11 +865,9 @@ default LongStream dropWhile(LongPredicate predicate) { @Override LongStream parallel(); - @Override PrimitiveIterator.OfLong iterator(); - @Override Spliterator.OfLong spliterator(); diff --git a/src/java.base/share/classes/java/util/stream/Stream.java b/src/java.base/share/classes/java/util/stream/Stream.java index 7d5d38c1231..ed1b7a10baa 100644 --- a/src/java.base/share/classes/java/util/stream/Stream.java +++ b/src/java.base/share/classes/java/util/stream/Stream.java @@ -883,7 +883,6 @@ default Stream dropWhile(Predicate predicate) { * @return an array, whose {@linkplain Class#getComponentType runtime component * type} is {@code Object}, containing the elements of this stream */ - @Nullable Object[] toArray(); /** @@ -913,7 +912,6 @@ default Stream dropWhile(Predicate predicate) { * stream is not assignable to the {@linkplain Class#getComponentType * runtime component type} of the generated array */ - A[] toArray(IntFunction generator); /** diff --git a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java index 8fc37b12435..37cda049b2b 100644 --- a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java +++ b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java @@ -26,7 +26,6 @@ package java.util.zip; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; import java.io.FilterInputStream; import java.io.InputStream; @@ -104,7 +103,7 @@ private void ensureOpen() throws IOException { * @param size the input buffer size * @throws IllegalArgumentException if {@code size <= 0} */ - public InflaterInputStream(InputStream in, Inflater inf, int size) { + public InflaterInputStream(InputStream in, Inflater inf, int size) { super(in); if (in == null || inf == null) { throw new NullPointerException(); diff --git a/src/java.base/share/classes/java/util/zip/InflaterOutputStream.java b/src/java.base/share/classes/java/util/zip/InflaterOutputStream.java index 63eceb9efd1..4b3bd4f34d2 100644 --- a/src/java.base/share/classes/java/util/zip/InflaterOutputStream.java +++ b/src/java.base/share/classes/java/util/zip/InflaterOutputStream.java @@ -55,6 +55,7 @@ * @see DeflaterInputStream * @see DeflaterOutputStream */ + @NullMarked public class InflaterOutputStream extends FilterOutputStream { /** Decompressor for this stream. */ diff --git a/src/java.base/share/classes/java/util/zip/ZipEntry.java b/src/java.base/share/classes/java/util/zip/ZipEntry.java index 7b8f334730a..1354583521f 100644 --- a/src/java.base/share/classes/java/util/zip/ZipEntry.java +++ b/src/java.base/share/classes/java/util/zip/ZipEntry.java @@ -421,7 +421,7 @@ public ZipEntry setCreationTime(FileTime time) { * or is less than 0 when ZIP64 is supported * @see #getSize() */ - public void setSize( long size) { + public void setSize(long size) { if (size < 0) { throw new IllegalArgumentException("invalid entry size"); } @@ -434,7 +434,7 @@ public void setSize( long size) { * @return the uncompressed size of the entry data, or -1 if not known * @see #setSize(long) */ - public long getSize() { + public long getSize() { return size; } @@ -649,7 +649,6 @@ void setExtra0(byte[] extra, boolean doZIP64, boolean isLOC) { * * @see #setExtra(byte[]) */ - public byte @Nullable [] getExtra() { return extra; } diff --git a/src/java.base/share/classes/java/util/zip/ZipException.java b/src/java.base/share/classes/java/util/zip/ZipException.java index 66e530d7f73..dca06f5eafc 100644 --- a/src/java.base/share/classes/java/util/zip/ZipException.java +++ b/src/java.base/share/classes/java/util/zip/ZipException.java @@ -35,6 +35,7 @@ * @see java.io.IOException * @since 1.1 */ + @NullMarked public class ZipException extends IOException { @java.io.Serial diff --git a/src/java.base/share/classes/java/util/zip/ZipFile.java b/src/java.base/share/classes/java/util/zip/ZipFile.java index e989f732589..90fadb78570 100644 --- a/src/java.base/share/classes/java/util/zip/ZipFile.java +++ b/src/java.base/share/classes/java/util/zip/ZipFile.java @@ -684,8 +684,7 @@ private ZipEntry getZipEntry(String name, int pos) { * @return the number of entries in the ZIP file * @throws IllegalStateException if the ZIP file has been closed */ - - public int size() { + public int size() { synchronized (this) { ensureOpen(); return res.zsrc.total; diff --git a/src/java.base/share/classes/javax/net/ssl/SNIHostName.java b/src/java.base/share/classes/javax/net/ssl/SNIHostName.java index cedfbf5d033..5db3b18d5a7 100644 --- a/src/java.base/share/classes/javax/net/ssl/SNIHostName.java +++ b/src/java.base/share/classes/javax/net/ssl/SNIHostName.java @@ -252,8 +252,6 @@ public String getAsciiName() { * RFC 6066: Transport Layer Security (TLS) Extensions: Extension Definitions */ @Override - - public boolean equals(@Nullable Object other) { if (this == other) { return true; diff --git a/src/java.base/share/classes/javax/net/ssl/SNIServerName.java b/src/java.base/share/classes/javax/net/ssl/SNIServerName.java index 5501d35ca9c..cdc6c187cc4 100644 --- a/src/java.base/share/classes/javax/net/ssl/SNIServerName.java +++ b/src/java.base/share/classes/javax/net/ssl/SNIServerName.java @@ -118,8 +118,6 @@ public final byte[] getEncoded() { * encoded value as this server name. */ @Override - - public boolean equals(@Nullable Object other) { if (this == other) { return true; diff --git a/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java b/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java index b2b457545e5..20da8f14813 100644 --- a/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java +++ b/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java @@ -46,7 +46,6 @@ public abstract class X509ExtendedKeyManager implements X509KeyManager { /** * Constructor used by subclasses only. */ - protected X509ExtendedKeyManager() { } diff --git a/src/java.base/share/classes/javax/net/ssl/X509KeyManager.java b/src/java.base/share/classes/javax/net/ssl/X509KeyManager.java index 834c2512fdc..7b216c5b668 100644 --- a/src/java.base/share/classes/javax/net/ssl/X509KeyManager.java +++ b/src/java.base/share/classes/javax/net/ssl/X509KeyManager.java @@ -83,7 +83,7 @@ public interface X509KeyManager extends KeyManager { * are no matches. */ @Nullable String chooseClientAlias(String[] keyType, Principal @Nullable [] issuers, - @Nullable Socket socket); + @Nullable Socket socket); /** * Get the matching aliases for authenticating the server side of a secure @@ -114,7 +114,7 @@ public interface X509KeyManager extends KeyManager { * are no matches. */ @Nullable String chooseServerAlias(String keyType, Principal @Nullable [] issuers, - @Nullable Socket socket); + @Nullable Socket socket); /** * Returns the certificate chain associated with the given alias. diff --git a/src/java.base/share/classes/javax/security/auth/login/Configuration.java b/src/java.base/share/classes/javax/security/auth/login/Configuration.java index 8477d834be5..de3c471d9bd 100644 --- a/src/java.base/share/classes/javax/security/auth/login/Configuration.java +++ b/src/java.base/share/classes/javax/security/auth/login/Configuration.java @@ -484,7 +484,7 @@ private static Configuration handleException(NoSuchAlgorithmException nsae) * * @since 1.6 */ - public Configuration. @Nullable Parameters getParameters() { + public Configuration.@Nullable Parameters getParameters() { return null; } diff --git a/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java b/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java index 323c5897ce3..cf703d1c23d 100644 --- a/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java +++ b/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java @@ -174,8 +174,6 @@ public int hashCode() { private int hash; @Override - - public boolean equals(@Nullable Object ob) { if (!(ob instanceof ModuleReferenceImpl)) return false; diff --git a/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java b/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java index 96660eb556f..a9aad8b3ae0 100644 --- a/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java +++ b/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java @@ -350,8 +350,6 @@ void encode(DerOutputStream out) { * @return true iff the names are identical. */ @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/sun/security/x509/GeneralNames.java b/src/java.base/share/classes/sun/security/x509/GeneralNames.java index d7aec1cd815..05cc61817dc 100644 --- a/src/java.base/share/classes/sun/security/x509/GeneralNames.java +++ b/src/java.base/share/classes/sun/security/x509/GeneralNames.java @@ -130,8 +130,6 @@ public void encode(DerOutputStream out) { * * @return true if this equals obj */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java b/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java index 8c7305963fd..cf4fef77add 100644 --- a/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java +++ b/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java @@ -152,8 +152,6 @@ public void encode(DerOutputStream out) { * @param obj GeneralSubtrees to compare to this * @return true if match */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/sun/security/x509/RDN.java b/src/java.base/share/classes/sun/security/x509/RDN.java index bf0e8332a77..32b2815325f 100644 --- a/src/java.base/share/classes/sun/security/x509/RDN.java +++ b/src/java.base/share/classes/sun/security/x509/RDN.java @@ -291,8 +291,6 @@ public int size() { return assertion.length; } - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/sun/text/CompactByteArray.java b/src/java.base/share/classes/sun/text/CompactByteArray.java index 9d2613f2a8c..e57f1b77fd0 100644 --- a/src/java.base/share/classes/sun/text/CompactByteArray.java +++ b/src/java.base/share/classes/sun/text/CompactByteArray.java @@ -283,8 +283,6 @@ public Object clone() * @return true if the current compact array object is the same * as the compact array object obj; false otherwise. */ - - public boolean equals(@Nullable Object obj) { if (obj == null) return false; if (this == obj) // quick check diff --git a/src/java.base/share/classes/sun/util/BuddhistCalendar.java b/src/java.base/share/classes/sun/util/BuddhistCalendar.java index f50abc7932a..9a5b2f71675 100644 --- a/src/java.base/share/classes/sun/util/BuddhistCalendar.java +++ b/src/java.base/share/classes/sun/util/BuddhistCalendar.java @@ -104,8 +104,6 @@ public String getCalendarType() { * @return true if this object is equal to obj; false otherwise */ @Override - - public boolean equals(@Nullable Object obj) { return obj instanceof BuddhistCalendar && super.equals(obj); diff --git a/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java b/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java index 6805708207b..3dfb2a7eb0d 100644 --- a/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java +++ b/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java @@ -674,8 +674,6 @@ public int hashCode() { * @return true if given object is same as this ZoneInfo object, * false otherwise. */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.base/share/classes/sun/util/locale/LocaleExtensions.java b/src/java.base/share/classes/sun/util/locale/LocaleExtensions.java index 2cc18062e02..d4a32c47ec0 100644 --- a/src/java.base/share/classes/sun/util/locale/LocaleExtensions.java +++ b/src/java.base/share/classes/sun/util/locale/LocaleExtensions.java @@ -232,8 +232,6 @@ public int hashCode() { } @Override - - public boolean equals(@Nullable Object other) { if (this == other) { return true; diff --git a/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java b/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java index d62fe859ae4..40c4ea0d4d2 100644 --- a/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java +++ b/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java @@ -46,7 +46,6 @@ import java.util.Collections; import java.util.Objects; - import sun.datatransfer.DataFlavorUtil; /** @@ -112,7 +111,6 @@ * @author Jeff Dunn * @since 1.1 */ - public class DataFlavor implements Externalizable, Cloneable { /** @@ -239,7 +237,7 @@ private static DataFlavor initHtml(String htmlFlavorType) { * identifies the Java type of an object returned as a reference from an * invocation {@code java.awt.datatransfer.getTransferData}. */ - public static final String javaSerializedObjectMimeType = "application/x-java-serialized-object"; + public static final String javaSerializedObjectMimeType = "application/x-java-serialized-object"; /** * To transfer a list of files to/from Java (and the underlying platform) a @@ -260,7 +258,7 @@ private static DataFlavor initHtml(String htmlFlavorType) { * for a {@code DataFlavor} with this MIME Content-Type is required to be an * instance of the representation Class of the {@code DataFlavor}. */ - public static final String javaJVMLocalObjectMimeType = "application/x-java-jvm-local-objectref"; + public static final String javaJVMLocalObjectMimeType = "application/x-java-jvm-local-objectref"; /** * In order to pass a live link to a Remote object via a Drag and Drop @@ -269,7 +267,7 @@ private static DataFlavor initHtml(String htmlFlavorType) { * class of the {@code DataFlavor} represents the type of the {@code Remote} * interface to be transferred. */ - public static final String javaRemoteObjectMimeType = "application/x-java-remote-object"; + public static final String javaRemoteObjectMimeType = "application/x-java-remote-object"; /** * Represents a piece of an HTML markup. The markup consists of the part @@ -915,8 +913,6 @@ public void setHumanPresentableName(String humanPresentableName) { * {@code DataFlavor}; {@code false} otherwise * @see #selectBestTextFlavor */ - - public boolean equals(@Nullable Object o) { return ((o instanceof DataFlavor) && equals((DataFlavor)o)); } diff --git a/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java b/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java index 77b9b5b38de..9411a648f8a 100644 --- a/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java +++ b/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java @@ -146,8 +146,6 @@ public int hashCode() { } @Override - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof ModelIdentifier)) return false; diff --git a/src/java.desktop/share/classes/java/awt/AlphaComposite.java b/src/java.desktop/share/classes/java/awt/AlphaComposite.java index 0475f62a469..d8244714f71 100644 --- a/src/java.desktop/share/classes/java/awt/AlphaComposite.java +++ b/src/java.desktop/share/classes/java/awt/AlphaComposite.java @@ -822,8 +822,6 @@ public int hashCode() { * @return {@code true} if {@code obj} equals this * {@code AlphaComposite}; {@code false} otherwise. */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof AlphaComposite)) { return false; diff --git a/src/java.desktop/share/classes/java/awt/BasicStroke.java b/src/java.desktop/share/classes/java/awt/BasicStroke.java index 24e331aac42..ac844b75c5f 100644 --- a/src/java.desktop/share/classes/java/awt/BasicStroke.java +++ b/src/java.desktop/share/classes/java/awt/BasicStroke.java @@ -410,8 +410,6 @@ public int hashCode() { * dash phase are the same for both objects; * {@code false} otherwise. */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof BasicStroke)) { return false; diff --git a/src/java.desktop/share/classes/java/awt/Component.java b/src/java.desktop/share/classes/java/awt/Component.java index 338bdad7afe..f5a3e14e532 100644 --- a/src/java.desktop/share/classes/java/awt/Component.java +++ b/src/java.desktop/share/classes/java/awt/Component.java @@ -213,7 +213,7 @@ * @author Sami Shaio */ @NullMarked -public abstract class Component implements ImageObserver, MenuContainer, +public abstract class Component implements ImageObserver, MenuContainer, Serializable { @@ -398,7 +398,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @see #setDropTarget * @see #getDropTarget */ - DropTarget dropTarget; + DropTarget dropTarget; /** * @serial @@ -3342,7 +3342,6 @@ void paintHeavyweightComponents(Graphics g) { * @see #update(Graphics) * @since 1.0 */ - public void repaint() { repaint(0, 0, 0, width, height); } @@ -3362,7 +3361,6 @@ public void repaint() { * @see #update(Graphics) * @since 1.0 */ - public void repaint(long tm) { repaint(tm, 0, 0, width, height); } @@ -3387,7 +3385,6 @@ public void repaint(long tm) { * @see #update(Graphics) * @since 1.0 */ - public void repaint(int x, int y, int width, int height) { repaint(0, x, y, width, height); } @@ -3414,7 +3411,6 @@ public void repaint(int x, int y, int width, int height) { * @see #update(Graphics) * @since 1.0 */ - public void repaint(long tm, int x, int y, int width, int height) { if (this.peer instanceof LightweightPeer) { // Needs to be translated to parent coordinates since diff --git a/src/java.desktop/share/classes/java/awt/Container.java b/src/java.desktop/share/classes/java/awt/Container.java index 09176f79203..e0e55a3f3d9 100644 --- a/src/java.desktop/share/classes/java/awt/Container.java +++ b/src/java.desktop/share/classes/java/awt/Container.java @@ -95,7 +95,7 @@ * @since 1.0 */ @NullMarked -public class Container extends Component { +public class Container extends Component { private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.Container"); private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.Container"); @@ -1604,7 +1604,6 @@ void invalidateParent() { * @see #layout * @see LayoutManager2 */ - @Override public void invalidate() { LayoutManager layoutMgr = this.layoutMgr; diff --git a/src/java.desktop/share/classes/java/awt/Dialog.java b/src/java.desktop/share/classes/java/awt/Dialog.java index f652abd9ec6..f783f5e6daf 100644 --- a/src/java.desktop/share/classes/java/awt/Dialog.java +++ b/src/java.desktop/share/classes/java/awt/Dialog.java @@ -428,7 +428,7 @@ public Dialog(@Nullable Frame owner, @Nullable String title, boolean modal) { * @since 1.4 */ public Dialog(@Nullable Frame owner, @Nullable String title, boolean modal, - @Nullable GraphicsConfiguration gc) { + @Nullable GraphicsConfiguration gc) { this(owner, title, modal ? DEFAULT_MODALITY_TYPE : ModalityType.MODELESS, gc); } @@ -696,7 +696,7 @@ public Dialog(@Nullable Window owner, @Nullable String title, @Nullable Modality * @since 1.6 */ public Dialog(@Nullable Window owner, @Nullable String title, @Nullable ModalityType modalityType, - @Nullable GraphicsConfiguration gc) { + @Nullable GraphicsConfiguration gc) { super(owner, gc); if ((owner != null) && diff --git a/src/java.desktop/share/classes/java/awt/Dimension.java b/src/java.desktop/share/classes/java/awt/Dimension.java index e0e7fa68961..cacb18e2f1f 100644 --- a/src/java.desktop/share/classes/java/awt/Dimension.java +++ b/src/java.desktop/share/classes/java/awt/Dimension.java @@ -208,8 +208,6 @@ public void setSize(int width, int height) { /** * Checks whether two dimension objects have equal values. */ - - public boolean equals(@Nullable Object obj) { if (obj instanceof Dimension) { Dimension d = (Dimension)obj; diff --git a/src/java.desktop/share/classes/java/awt/DisplayMode.java b/src/java.desktop/share/classes/java/awt/DisplayMode.java index cbdf8dd198b..1bf54625edc 100644 --- a/src/java.desktop/share/classes/java/awt/DisplayMode.java +++ b/src/java.desktop/share/classes/java/awt/DisplayMode.java @@ -145,8 +145,6 @@ && getBitDepth() == dm.getBitDepth() * {@inheritDoc} */ @Override - - public boolean equals(@Nullable Object dm) { if (dm instanceof DisplayMode) { return equals((DisplayMode)dm); diff --git a/src/java.desktop/share/classes/java/awt/Font.java b/src/java.desktop/share/classes/java/awt/Font.java index 268616e7902..059fcb0d577 100644 --- a/src/java.desktop/share/classes/java/awt/Font.java +++ b/src/java.desktop/share/classes/java/awt/Font.java @@ -256,7 +256,6 @@ * especially important are called out as having 'baseline-relative * coordinates.' */ - public class Font implements java.io.Serializable { private static class FontAccessImpl extends FontAccess { @@ -308,7 +307,7 @@ public FontPeer getFontPeer(final Font font) { * to provide compile-time verification of the name. * @since 1.6 */ - public static final String DIALOG = "Dialog"; + public static final String DIALOG = "Dialog"; /** * A String constant for the canonical family name of the @@ -316,7 +315,7 @@ public FontPeer getFontPeer(final Font font) { * to provide compile-time verification of the name. * @since 1.6 */ - public static final String DIALOG_INPUT = "DialogInput"; + public static final String DIALOG_INPUT = "DialogInput"; /** * A String constant for the canonical family name of the @@ -324,7 +323,7 @@ public FontPeer getFontPeer(final Font font) { * to provide compile-time verification of the name. * @since 1.6 */ - public static final String SANS_SERIF = "SansSerif"; + public static final String SANS_SERIF = "SansSerif"; /** * A String constant for the canonical family name of the @@ -332,7 +331,7 @@ public FontPeer getFontPeer(final Font font) { * to provide compile-time verification of the name. * @since 1.6 */ - public static final String SERIF = "Serif"; + public static final String SERIF = "Serif"; /** * A String constant for the canonical family name of the @@ -340,7 +339,7 @@ public FontPeer getFontPeer(final Font font) { * to provide compile-time verification of the name. * @since 1.6 */ - public static final String MONOSPACED = "Monospaced"; + public static final String MONOSPACED = "Monospaced"; /* * Constants to be used for styles. Can be combined to mix @@ -1696,8 +1695,6 @@ public int hashCode() { * {@code false} otherwise. * @since 1.0 */ - - public boolean equals(@Nullable Object obj) { if (obj == this) { return true; diff --git a/src/java.desktop/share/classes/java/awt/Frame.java b/src/java.desktop/share/classes/java/awt/Frame.java index 2cead4b21ff..5ddf4704da0 100644 --- a/src/java.desktop/share/classes/java/awt/Frame.java +++ b/src/java.desktop/share/classes/java/awt/Frame.java @@ -43,7 +43,6 @@ import javax.accessibility.AccessibleState; import javax.accessibility.AccessibleStateSet; - import sun.awt.AWTAccessor; import sun.awt.SunToolkit; diff --git a/src/java.desktop/share/classes/java/awt/JobAttributes.java b/src/java.desktop/share/classes/java/awt/JobAttributes.java index 8465e27a866..99c12d72f67 100644 --- a/src/java.desktop/share/classes/java/awt/JobAttributes.java +++ b/src/java.desktop/share/classes/java/awt/JobAttributes.java @@ -950,8 +950,6 @@ public void setToPage(int toPage) { * @return whether obj is equal to this JobAttribute according to the * above criteria. */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof JobAttributes)) { return false; diff --git a/src/java.desktop/share/classes/java/awt/MenuShortcut.java b/src/java.desktop/share/classes/java/awt/MenuShortcut.java index 0da2dd0432f..6c80a62fe0f 100644 --- a/src/java.desktop/share/classes/java/awt/MenuShortcut.java +++ b/src/java.desktop/share/classes/java/awt/MenuShortcut.java @@ -165,8 +165,6 @@ public boolean equals(MenuShortcut s) { * {@code false} otherwise. * @since 1.2 */ - - public boolean equals(@Nullable Object obj) { if (obj instanceof MenuShortcut) { return equals( (MenuShortcut) obj ); diff --git a/src/java.desktop/share/classes/java/awt/PageAttributes.java b/src/java.desktop/share/classes/java/awt/PageAttributes.java index 8072ea88fff..39219b47775 100644 --- a/src/java.desktop/share/classes/java/awt/PageAttributes.java +++ b/src/java.desktop/share/classes/java/awt/PageAttributes.java @@ -1331,8 +1331,6 @@ public void setPrinterResolutionToDefault() { * @return whether obj is equal to this PageAttribute according to the * above criteria. */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof PageAttributes)) { return false; diff --git a/src/java.desktop/share/classes/java/awt/Point.java b/src/java.desktop/share/classes/java/awt/Point.java index 25d510ea3fe..a2fb83af501 100644 --- a/src/java.desktop/share/classes/java/awt/Point.java +++ b/src/java.desktop/share/classes/java/awt/Point.java @@ -215,8 +215,6 @@ public void translate(int dx, int dy) { * an instance of {@code Point2D} and has * the same values; {@code false} otherwise. */ - - public boolean equals(@Nullable Object obj) { if (obj instanceof Point) { Point pt = (Point)obj; diff --git a/src/java.desktop/share/classes/java/awt/Rectangle.java b/src/java.desktop/share/classes/java/awt/Rectangle.java index fb35bff8515..c1789778c53 100644 --- a/src/java.desktop/share/classes/java/awt/Rectangle.java +++ b/src/java.desktop/share/classes/java/awt/Rectangle.java @@ -1183,8 +1183,6 @@ public Rectangle2D createUnion(Rectangle2D r) { * @return {@code true} if the objects are equal; * {@code false} otherwise. */ - - public boolean equals(@Nullable Object obj) { if (obj instanceof Rectangle) { Rectangle r = (Rectangle)obj; diff --git a/src/java.desktop/share/classes/java/awt/font/FontRenderContext.java b/src/java.desktop/share/classes/java/awt/font/FontRenderContext.java index 67dd5065a77..a4ed2ab736b 100644 --- a/src/java.desktop/share/classes/java/awt/font/FontRenderContext.java +++ b/src/java.desktop/share/classes/java/awt/font/FontRenderContext.java @@ -302,8 +302,6 @@ public Object getFractionalMetricsHint() { * this {@code FontRenderContext}; {@code false} * otherwise. */ - - public boolean equals(@Nullable Object obj) { try { return equals((FontRenderContext)obj); diff --git a/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java b/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java index 91bc1fd3013..fde12332066 100644 --- a/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java +++ b/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java @@ -183,8 +183,6 @@ public int hashCode() { * {@code ImageGraphicAttribute} equals {@code rhs}; * {@code false} otherwise. */ - - public boolean equals(@Nullable Object rhs) { try { diff --git a/src/java.desktop/share/classes/java/awt/font/NumericShaper.java b/src/java.desktop/share/classes/java/awt/font/NumericShaper.java index 918869f0734..25b2b53b6ca 100644 --- a/src/java.desktop/share/classes/java/awt/font/NumericShaper.java +++ b/src/java.desktop/share/classes/java/awt/font/NumericShaper.java @@ -1843,8 +1843,6 @@ public int hashCode() { * {@code false} otherwise. * @see java.lang.Object#equals(java.lang.Object) */ - - public boolean equals(@Nullable Object o) { if (o != null) { try { diff --git a/src/java.desktop/share/classes/java/awt/font/ShapeGraphicAttribute.java b/src/java.desktop/share/classes/java/awt/font/ShapeGraphicAttribute.java index 7550d3ea06f..f64804274e6 100644 --- a/src/java.desktop/share/classes/java/awt/font/ShapeGraphicAttribute.java +++ b/src/java.desktop/share/classes/java/awt/font/ShapeGraphicAttribute.java @@ -212,8 +212,6 @@ public int hashCode() { * {@code ShapeGraphicAttribute} equals {@code rhs}; * {@code false} otherwise. */ - - public boolean equals(@Nullable Object rhs) { try { diff --git a/src/java.desktop/share/classes/java/awt/font/TextHitInfo.java b/src/java.desktop/share/classes/java/awt/font/TextHitInfo.java index 62092efa537..8951fbe90b3 100644 --- a/src/java.desktop/share/classes/java/awt/font/TextHitInfo.java +++ b/src/java.desktop/share/classes/java/awt/font/TextHitInfo.java @@ -42,7 +42,6 @@ import org.jspecify.annotations.Nullable; import java.lang.String; - /** * The {@code TextHitInfo} class represents a character position in a * text model, and a bias, or "side," of the character. Biases are @@ -146,8 +145,6 @@ public int hashCode() { * @return {@code true} if the specified {@code Object} * equals this {@code TextHitInfo}; {@code false} otherwise. */ - - public boolean equals(@Nullable Object obj) { return (obj instanceof TextHitInfo) && equals((TextHitInfo)obj); } diff --git a/src/java.desktop/share/classes/java/awt/font/TransformAttribute.java b/src/java.desktop/share/classes/java/awt/font/TransformAttribute.java index e0e3c368363..1a23fc3f2be 100644 --- a/src/java.desktop/share/classes/java/awt/font/TransformAttribute.java +++ b/src/java.desktop/share/classes/java/awt/font/TransformAttribute.java @@ -159,8 +159,6 @@ public int hashCode() { * transform. * @since 1.6 */ - - public boolean equals(@Nullable Object rhs) { if (rhs != null) { try { diff --git a/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java b/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java index 64fd4808c33..7c5a09050dc 100644 --- a/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java +++ b/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java @@ -3933,8 +3933,6 @@ private static long hash(double m) { * {@code AffineTransform} object; {@code false} otherwise. * @since 1.2 */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof AffineTransform)) { return false; diff --git a/src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java b/src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java index 7cef252a365..ecdcd0ada7c 100644 --- a/src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java +++ b/src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java @@ -2922,8 +2922,6 @@ public WritableRaster getAlphaRaster(WritableRaster raster) { * {@code ComponentColorModel}; {@code false} otherwise. */ @Override - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof ComponentColorModel)) { return false; @@ -2970,4 +2968,4 @@ public int hashCode() { } return result; } -} +} \ No newline at end of file diff --git a/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java b/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java index 6df2d2de701..529e55d7915 100644 --- a/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java +++ b/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java @@ -1537,8 +1537,6 @@ public String toString() { * equals this {@code IndexColorModel}; {@code false} otherwise. */ @Override - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof IndexColorModel)) { diff --git a/src/java.desktop/share/classes/java/awt/image/PackedColorModel.java b/src/java.desktop/share/classes/java/awt/image/PackedColorModel.java index 601d726d858..c50e4e3fe98 100644 --- a/src/java.desktop/share/classes/java/awt/image/PackedColorModel.java +++ b/src/java.desktop/share/classes/java/awt/image/PackedColorModel.java @@ -398,8 +398,6 @@ public WritableRaster getAlphaRaster(WritableRaster raster) { * {@code PackedColorModel}; {@code false} otherwise. */ @Override - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof PackedColorModel)) { return false; @@ -524,4 +522,4 @@ private static final int countBits(int mask) { return count; } -} +} \ No newline at end of file diff --git a/src/java.desktop/share/classes/java/beans/Beans.java b/src/java.desktop/share/classes/java/beans/Beans.java index 1633876798c..4d729043d4e 100644 --- a/src/java.desktop/share/classes/java/beans/Beans.java +++ b/src/java.desktop/share/classes/java/beans/Beans.java @@ -57,7 +57,7 @@ */ @NullMarked -public class Beans { +public class Beans { /** * Constructs a {@code Beans}. diff --git a/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java b/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java index f640284b335..d54d654678a 100644 --- a/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java @@ -53,7 +53,7 @@ */ @NullMarked -public class FeatureDescriptor { +public class FeatureDescriptor { private static final String TRANSIENT = "transient"; private @Nullable Reference> classRef; @@ -289,7 +289,6 @@ private void addTable(Hashtable table) { * * @return the initialized attribute table */ - private Hashtable getTable() { if (this.table == null) { this.table = new Hashtable<>(); diff --git a/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java b/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java index 6fb742602bb..fb6084fd10d 100644 --- a/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java +++ b/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java @@ -85,8 +85,7 @@ * @since 1.1 */ @NullMarked - -public class PropertyChangeSupport implements Serializable { +public class PropertyChangeSupport implements Serializable { private PropertyChangeListenerMap map = new PropertyChangeListenerMap(); /** @@ -94,8 +93,7 @@ public class PropertyChangeSupport implements Serializable { * * @param sourceBean The bean to be given as the source for any events. */ - - public PropertyChangeSupport( Object sourceBean) { + public PropertyChangeSupport(Object sourceBean) { if (sourceBean == null) { throw new NullPointerException(); } @@ -112,8 +110,7 @@ public PropertyChangeSupport( Object sourceBean) { * * @param listener The PropertyChangeListener to be added */ - - public void addPropertyChangeListener(@Nullable PropertyChangeListener listener) { + public void addPropertyChangeListener(@Nullable PropertyChangeListener listener) { if (listener == null) { return; } @@ -139,7 +136,6 @@ public void addPropertyChangeListener(@Nullable PropertyChangeListener listener * * @param listener The PropertyChangeListener to be removed */ - public void removePropertyChangeListener(@Nullable PropertyChangeListener listener) { if (listener == null) { return; @@ -186,8 +182,7 @@ public void removePropertyChangeListener(@Nullable PropertyChangeListener listen * empty array if no listeners have been added * @since 1.4 */ - - public PropertyChangeListener[] getPropertyChangeListeners() { + public PropertyChangeListener[] getPropertyChangeListeners() { return this.map.getListeners(); } @@ -205,10 +200,9 @@ public PropertyChangeListener[] getPropertyChangeListeners() { * @param listener The PropertyChangeListener to be added * @since 1.2 */ - public void addPropertyChangeListener( @Nullable String propertyName, - @Nullable PropertyChangeListener listener) { + @Nullable PropertyChangeListener listener) { if (listener == null || propertyName == null) { return; } @@ -232,7 +226,7 @@ public void addPropertyChangeListener( * @param listener The PropertyChangeListener to be removed * @since 1.2 */ - public void removePropertyChangeListener( + public void removePropertyChangeListener( @Nullable String propertyName, @Nullable PropertyChangeListener listener) { if (listener == null || propertyName == null) { @@ -255,7 +249,7 @@ public void removePropertyChangeListener( * returned. * @since 1.4 */ - public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) { + public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) { return this.map.getListeners(propertyName); } @@ -273,7 +267,7 @@ public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) * @param oldValue the old value of the property * @param newValue the new value of the property */ - public void firePropertyChange(String propertyName, @Nullable Object oldValue, @Nullable Object newValue) { + public void firePropertyChange(String propertyName, @Nullable Object oldValue, @Nullable Object newValue) { if (oldValue == null || newValue == null || !oldValue.equals(newValue)) { firePropertyChange(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue)); } @@ -294,7 +288,7 @@ public void firePropertyChange(String propertyName, @Nullable Object oldValue, * @param newValue the new value of the property * @since 1.2 */ - public void firePropertyChange(String propertyName, int oldValue, int newValue) { + public void firePropertyChange(String propertyName, int oldValue, int newValue) { if (oldValue != newValue) { firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue)); } @@ -315,7 +309,7 @@ public void firePropertyChange(String propertyName, int oldValue, int newValue * @param newValue the new value of the property * @since 1.2 */ - public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { + public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { if (oldValue != newValue) { firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); } @@ -331,7 +325,7 @@ public void firePropertyChange(String propertyName, boolean oldValue, boolean ne * @param event the {@code PropertyChangeEvent} to be fired * @since 1.2 */ - public void firePropertyChange(PropertyChangeEvent event) { + public void firePropertyChange(PropertyChangeEvent event) { Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); if (oldValue == null || newValue == null || !oldValue.equals(newValue)) { @@ -371,7 +365,7 @@ private static void fire(PropertyChangeListener @Nullable [] listeners, Property * @param newValue the new value of the property * @since 1.5 */ - public void fireIndexedPropertyChange(String propertyName, int index, @Nullable Object oldValue, @Nullable Object newValue) { + public void fireIndexedPropertyChange(String propertyName, int index, @Nullable Object oldValue, @Nullable Object newValue) { if (oldValue == null || newValue == null || !oldValue.equals(newValue)) { firePropertyChange(new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index)); } @@ -393,7 +387,7 @@ public void fireIndexedPropertyChange(String propertyName, int index, @Nullable * @param newValue the new value of the property * @since 1.5 */ - public void fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue) { + public void fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue) { if (oldValue != newValue) { fireIndexedPropertyChange(propertyName, index, Integer.valueOf(oldValue), Integer.valueOf(newValue)); } @@ -415,7 +409,7 @@ public void fireIndexedPropertyChange(String propertyName, int index, int oldVal * @param newValue the new value of the property * @since 1.5 */ - public void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue) { + public void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue) { if (oldValue != newValue) { fireIndexedPropertyChange(propertyName, index, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); } @@ -430,7 +424,7 @@ public void fireIndexedPropertyChange(String propertyName, int index, boolean ol * @return true if there are one or more listeners for the given property * @since 1.2 */ - public boolean hasListeners(@Nullable String propertyName) { + public boolean hasListeners(@Nullable String propertyName) { return this.map.hasListeners(propertyName); } @@ -514,7 +508,7 @@ private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOEx /** * The object to be provided as the "source" for any generated events. */ - private Object source; + private Object source; /** * @serialField children Hashtable diff --git a/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java b/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java index 156a0aff656..1394589bb7f 100644 --- a/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java @@ -72,7 +72,6 @@ public class PropertyDescriptor extends FeatureDescriptor { * @throws IntrospectionException if an exception occurs during * introspection. */ - public PropertyDescriptor(String propertyName, Class beanClass) throws IntrospectionException { this(propertyName, beanClass, @@ -94,7 +93,6 @@ public PropertyDescriptor(String propertyName, Class beanClass) * @throws IntrospectionException if an exception occurs during * introspection. */ - public PropertyDescriptor(String propertyName, Class beanClass, @Nullable String readMethodName, @Nullable String writeMethodName) throws IntrospectionException { @@ -137,7 +135,6 @@ public PropertyDescriptor(String propertyName, Class beanClass, * @throws IntrospectionException if an exception occurs during * introspection. */ - public PropertyDescriptor(String propertyName, @Nullable Method readMethod, @Nullable Method writeMethod) throws IntrospectionException { if (propertyName == null || propertyName.length() == 0) { @@ -208,7 +205,6 @@ public PropertyDescriptor(String propertyName, @Nullable Method readMethod, @Nul * @return the {@code Class} object that represents the Java type info, * or {@code null} if the type cannot be determined */ - public synchronized @Nullable Class getPropertyType() { Class type = getPropertyType0(); if (type == null) { @@ -238,7 +234,6 @@ private void setPropertyType(@Nullable Class type) { * @return The method that should be used to read the property value. * May return null if the property can't be read. */ - public synchronized @Nullable Method getReadMethod() { Method readMethod = this.readMethodRef.get(); if (readMethod == null) { @@ -308,7 +303,6 @@ private void setReadMethod0(Method readMethod) { * @return The method that should be used to write the property value. * May return null if the property can't be written. */ - public synchronized @Nullable Method getWriteMethod() { Method writeMethod = this.writeMethodRef.get(); if (writeMethod == null) { @@ -396,7 +390,6 @@ void setClass0(Class clz) { * * @return True if this is a bound property. */ - public boolean isBound() { return bound; } @@ -417,7 +410,6 @@ public void setBound(boolean bound) { * * @return True if this is a constrained property. */ - public boolean isConstrained() { return constrained; } @@ -455,7 +447,6 @@ public void setPropertyEditorClass(@Nullable Class propertyEditorClass) { * so the PropertyEditorManager should be used to locate * a suitable PropertyEditor. */ - public @Nullable Class getPropertyEditorClass() { return (this.propertyEditorClassRef != null) ? this.propertyEditorClassRef.get() @@ -475,7 +466,6 @@ public void setPropertyEditorClass(@Nullable Class propertyEditorClass) { * not been defined or cannot be created * @since 1.5 */ - @SuppressWarnings("deprecation") public @Nullable PropertyEditor createPropertyEditor(@Nullable Object bean) { Object editor = null; diff --git a/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java b/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java index 21ae4182dab..6ef91c151b4 100644 --- a/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java +++ b/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java @@ -258,7 +258,7 @@ public void repaint(Rectangle r) {} * for more information. */ @Override - protected void firePropertyChange( String propertyName, Object oldValue, Object newValue) { + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { // Strings get interned... if (propertyName == "text" || ((SwingUtilities2.isScaleChanged(propertyName, oldValue, newValue) diff --git a/src/java.desktop/share/classes/javax/swing/JComponent.java b/src/java.desktop/share/classes/javax/swing/JComponent.java index 755ce609617..76ba00565e2 100644 --- a/src/java.desktop/share/classes/javax/swing/JComponent.java +++ b/src/java.desktop/share/classes/javax/swing/JComponent.java @@ -229,7 +229,6 @@ * @since 1.2 */ @NullMarked - @JavaBean(defaultProperty = "UIClassID") @SuppressWarnings("serial") // Same-version serialization only public abstract class JComponent extends Container implements Serializable, @@ -353,7 +352,7 @@ public abstract class JComponent extends Container implements Serializable, * The comment to display when the cursor is over the component, * also known as a "value tip", "flyover help", or "flyover label". */ - public static final String TOOL_TIP_TEXT_KEY = "ToolTipText"; + public static final String TOOL_TIP_TEXT_KEY = "ToolTipText"; private static final String NEXT_FOCUS = "nextFocus"; @@ -4921,7 +4920,6 @@ public void repaint(Rectangle r) { * @see #isValidateRoot * @see RepaintManager#addInvalidComponent */ - public void revalidate() { if (getParent() == null) { // Note: We don't bother invalidating here as once added diff --git a/src/java.desktop/share/classes/javax/swing/JDialog.java b/src/java.desktop/share/classes/javax/swing/JDialog.java index 63a1903108c..d1a315b40ac 100644 --- a/src/java.desktop/share/classes/javax/swing/JDialog.java +++ b/src/java.desktop/share/classes/javax/swing/JDialog.java @@ -626,7 +626,7 @@ public JDialog(@Nullable Window owner, @Nullable String title, Dialog.ModalityTy * @since 1.6 */ public JDialog(@Nullable Window owner, @Nullable String title, Dialog.ModalityType modalityType, - @Nullable GraphicsConfiguration gc) { + @Nullable GraphicsConfiguration gc) { super(owner, title, modalityType, gc); dialogInit(); } diff --git a/src/java.desktop/share/classes/javax/swing/JFileChooser.java b/src/java.desktop/share/classes/javax/swing/JFileChooser.java index c1f4e44bd42..2167a9212f0 100644 --- a/src/java.desktop/share/classes/javax/swing/JFileChooser.java +++ b/src/java.desktop/share/classes/javax/swing/JFileChooser.java @@ -172,90 +172,90 @@ public class JFileChooser extends JComponent implements Accessible { public static final int FILES_AND_DIRECTORIES = 2; /** Instruction to cancel the current selection. */ - public static final String CANCEL_SELECTION = "CancelSelection"; + public static final String CANCEL_SELECTION = "CancelSelection"; /** * Instruction to approve the current selection * (same as pressing yes or ok). */ - public static final String APPROVE_SELECTION = "ApproveSelection"; + public static final String APPROVE_SELECTION = "ApproveSelection"; /** Identifies change in the text on the approve (yes, ok) button. */ - public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY = "ApproveButtonTextChangedProperty"; + public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY = "ApproveButtonTextChangedProperty"; /** * Identifies change in the tooltip text for the approve (yes, ok) * button. */ - public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY = "ApproveButtonToolTipTextChangedProperty"; + public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY = "ApproveButtonToolTipTextChangedProperty"; /** Identifies change in the mnemonic for the approve (yes, ok) button. */ - public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY = "ApproveButtonMnemonicChangedProperty"; + public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY = "ApproveButtonMnemonicChangedProperty"; /** Instruction to display the control buttons. */ - public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY = "ControlButtonsAreShownChangedProperty"; + public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY = "ControlButtonsAreShownChangedProperty"; /** Identifies user's directory change. */ - public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged"; + public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged"; /** Identifies change in user's single-file selection. */ - public static final String SELECTED_FILE_CHANGED_PROPERTY = "SelectedFileChangedProperty"; + public static final String SELECTED_FILE_CHANGED_PROPERTY = "SelectedFileChangedProperty"; /** Identifies change in user's multiple-file selection. */ public static final String SELECTED_FILES_CHANGED_PROPERTY = "SelectedFilesChangedProperty"; /** Enables multiple-file selections. */ - public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY = "MultiSelectionEnabledChangedProperty"; + public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY = "MultiSelectionEnabledChangedProperty"; /** * Says that a different object is being used to find available drives * on the system. */ - public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY = "FileSystemViewChanged"; + public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY = "FileSystemViewChanged"; /** * Says that a different object is being used to retrieve file * information. */ - public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged"; + public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged"; /** Identifies a change in the display-hidden-files property. */ public static final String FILE_HIDING_CHANGED_PROPERTY = "FileHidingChanged"; /** User changed the kind of files to display. */ - public static final String FILE_FILTER_CHANGED_PROPERTY = "fileFilterChanged"; + public static final String FILE_FILTER_CHANGED_PROPERTY = "fileFilterChanged"; /** * Identifies a change in the kind of selection (single, * multiple, etc.). */ - public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY = "fileSelectionChanged"; + public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY = "fileSelectionChanged"; /** * Says that a different accessory component is in use * (for example, to preview files). */ - public static final String ACCESSORY_CHANGED_PROPERTY = "AccessoryChangedProperty"; + public static final String ACCESSORY_CHANGED_PROPERTY = "AccessoryChangedProperty"; /** * Identifies whether the AcceptAllFileFilter is used or not. */ - public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY = "acceptAllFileFilterUsedChanged"; + public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY = "acceptAllFileFilterUsedChanged"; /** Identifies a change in the dialog title. */ - public static final String DIALOG_TITLE_CHANGED_PROPERTY = "DialogTitleChangedProperty"; + public static final String DIALOG_TITLE_CHANGED_PROPERTY = "DialogTitleChangedProperty"; /** * Identifies a change in the type of files displayed (files only, * directories only, or both files and directories). */ - public static final String DIALOG_TYPE_CHANGED_PROPERTY = "DialogTypeChangedProperty"; + public static final String DIALOG_TYPE_CHANGED_PROPERTY = "DialogTypeChangedProperty"; /** * Identifies a change in the list of predefined file filters * the user can choose from. */ - public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY = "ChoosableFileFilterChangedProperty"; + public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY = "ChoosableFileFilterChangedProperty"; // ****************************** // ***** instance variables ***** @@ -298,7 +298,7 @@ public class JFileChooser extends JComponent implements Accessible { private @Nullable File currentDirectory = null; private @Nullable File selectedFile = null; - private File @Nullable[] selectedFiles; + private File @Nullable [] selectedFiles; // ************************************* // ***** JFileChooser Constructors ***** @@ -548,7 +548,7 @@ public File[] getSelectedFiles() { */ @BeanProperty(description = "The list of selected files if the chooser is in multiple selection mode.") - public void setSelectedFiles(File @Nullable[] selectedFiles) { + public void setSelectedFiles(File @Nullable [] selectedFiles) { File[] oldValue = this.selectedFiles; if (selectedFiles == null || selectedFiles.length == 0) { selectedFiles = null; diff --git a/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/src/java.desktop/share/classes/javax/swing/JOptionPane.java index 7925456d00d..e8533d4f4e4 100644 --- a/src/java.desktop/share/classes/javax/swing/JOptionPane.java +++ b/src/java.desktop/share/classes/javax/swing/JOptionPane.java @@ -380,27 +380,27 @@ public class JOptionPane extends JComponent implements Accessible public static final int PLAIN_MESSAGE = -1; /** Bound property name for icon. */ - public static final String ICON_PROPERTY = "icon"; + public static final String ICON_PROPERTY = "icon"; /** Bound property name for message. */ - public static final String MESSAGE_PROPERTY = "message"; + public static final String MESSAGE_PROPERTY = "message"; /** Bound property name for value. */ - public static final String VALUE_PROPERTY = "value"; + public static final String VALUE_PROPERTY = "value"; /** Bound property name for option. */ - public static final String OPTIONS_PROPERTY = "options"; + public static final String OPTIONS_PROPERTY = "options"; /** Bound property name for initialValue. */ - public static final String INITIAL_VALUE_PROPERTY = "initialValue"; + public static final String INITIAL_VALUE_PROPERTY = "initialValue"; /** Bound property name for type. */ - public static final String MESSAGE_TYPE_PROPERTY = "messageType"; + public static final String MESSAGE_TYPE_PROPERTY = "messageType"; /** Bound property name for optionType. */ - public static final String OPTION_TYPE_PROPERTY = "optionType"; + public static final String OPTION_TYPE_PROPERTY = "optionType"; /** Bound property name for selectionValues. */ - public static final String SELECTION_VALUES_PROPERTY = "selectionValues"; + public static final String SELECTION_VALUES_PROPERTY = "selectionValues"; /** Bound property name for initialSelectionValue. */ - public static final String INITIAL_SELECTION_VALUE_PROPERTY = "initialSelectionValue"; + public static final String INITIAL_SELECTION_VALUE_PROPERTY = "initialSelectionValue"; /** Bound property name for inputValue. */ - public static final String INPUT_VALUE_PROPERTY = "inputValue"; + public static final String INPUT_VALUE_PROPERTY = "inputValue"; /** Bound property name for wantsInput. */ - public static final String WANTS_INPUT_PROPERTY = "wantsInput"; + public static final String WANTS_INPUT_PROPERTY = "wantsInput"; /** Icon used in pane. */ protected transient @Nullable Icon icon; @@ -700,7 +700,7 @@ public static void showMessageDialog(@Nullable Component parentComponent, * @see java.awt.GraphicsEnvironment#isHeadless */ public static int showConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message) throws HeadlessException { + @Nullable Object message) throws HeadlessException { return showConfirmDialog(parentComponent, message, UIManager.getString("OptionPane.titleText"), YES_NO_CANCEL_OPTION); @@ -728,7 +728,7 @@ public static int showConfirmDialog(@Nullable Component parentComponent, * @see java.awt.GraphicsEnvironment#isHeadless */ public static int showConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, int optionType) + @Nullable Object message, @Nullable String title, int optionType) throws HeadlessException { return showConfirmDialog(parentComponent, message, title, optionType, QUESTION_MESSAGE); @@ -767,7 +767,7 @@ public static int showConfirmDialog(@Nullable Component parentComponent, * @see java.awt.GraphicsEnvironment#isHeadless */ public static int showConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, int optionType, int messageType) + @Nullable Object message, @Nullable String title, int optionType, int messageType) throws HeadlessException { return showConfirmDialog(parentComponent, message, title, optionType, messageType, null); @@ -805,7 +805,7 @@ public static int showConfirmDialog(@Nullable Component parentComponent, * @see java.awt.GraphicsEnvironment#isHeadless */ public static int showConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, int optionType, + @Nullable Object message, @Nullable String title, int optionType, int messageType, @Nullable Icon icon) throws HeadlessException { return showOptionDialog(parentComponent, message, title, optionType, messageType, icon, null, null); @@ -867,8 +867,8 @@ public static int showConfirmDialog(@Nullable Component parentComponent, */ @SuppressWarnings("deprecation") public static int showOptionDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, int optionType, int messageType, - @Nullable Icon icon, Object @Nullable [] options, @Nullable Object initialValue) + @Nullable Object message, @Nullable String title, int optionType, int messageType, + @Nullable Icon icon, Object @Nullable [] options, @Nullable Object initialValue) throws HeadlessException { JOptionPane pane = new JOptionPane(message, messageType, optionType, icon, @@ -1064,7 +1064,7 @@ public void componentShown(ComponentEvent ce) { * @param message the object to display */ public static void showInternalMessageDialog(@Nullable Component parentComponent, - @Nullable Object message) { + @Nullable Object message) { showInternalMessageDialog(parentComponent, message, UIManager. getString("OptionPane.messageDialogTitle", parentComponent), INFORMATION_MESSAGE); @@ -1089,7 +1089,7 @@ public static void showInternalMessageDialog(@Nullable Component parentComponent * or PLAIN_MESSAGE */ public static void showInternalMessageDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, + @Nullable Object message, @Nullable String title, int messageType) { showInternalMessageDialog(parentComponent, message, title, messageType,null); } @@ -1114,7 +1114,7 @@ public static void showInternalMessageDialog(@Nullable Component parentComponent * identify the kind of message that is being displayed */ public static void showInternalMessageDialog(@Nullable Component parentComponent, - @Nullable Object message, + @Nullable Object message, @Nullable String title, int messageType, @Nullable Icon icon){ showInternalOptionDialog(parentComponent, message, title, DEFAULT_OPTION, @@ -1133,7 +1133,7 @@ public static void showInternalMessageDialog(@Nullable Component parentComponent * @return an integer indicating the option selected by the user */ public static int showInternalConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message) { + @Nullable Object message) { return showInternalConfirmDialog(parentComponent, message, UIManager.getString("OptionPane.titleText"), YES_NO_CANCEL_OPTION); @@ -1160,7 +1160,7 @@ public static int showInternalConfirmDialog(@Nullable Component parentComponent, * @return an integer indicating the option selected by the user */ public static int showInternalConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, + @Nullable Object message, @Nullable String title, int optionType) { return showInternalConfirmDialog(parentComponent, message, title, optionType, QUESTION_MESSAGE); @@ -1196,8 +1196,8 @@ public static int showInternalConfirmDialog(@Nullable Component parentComponent, * @return an integer indicating the option selected by the user */ public static int showInternalConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message, - @Nullable String title, int optionType, + @Nullable Object message, + @Nullable String title, int optionType, int messageType) { return showInternalConfirmDialog(parentComponent, message, title, optionType, messageType, null); @@ -1235,8 +1235,8 @@ public static int showInternalConfirmDialog(@Nullable Component parentComponent, * @return an integer indicating the option selected by the user */ public static int showInternalConfirmDialog(@Nullable Component parentComponent, - @Nullable Object message, - @Nullable String title, int optionType, + @Nullable Object message, + @Nullable String title, int optionType, int messageType, @Nullable Icon icon) { return showInternalOptionDialog(parentComponent, message, title, optionType, messageType, icon, null, null); @@ -1300,8 +1300,8 @@ private static boolean checkFrameForComponent(@Nullable Component parentComponen * or CLOSED_OPTION if the user closed the Dialog */ public static int showInternalOptionDialog(@Nullable Component parentComponent, - @Nullable Object message, - @Nullable String title, int optionType, + @Nullable Object message, + @Nullable String title, int optionType, int messageType, @Nullable Icon icon, Object @Nullable [] options, @Nullable Object initialValue) { JOptionPane pane = new JOptionPane(message, messageType, @@ -1383,7 +1383,7 @@ public static int showInternalOptionDialog(@Nullable Component parentComponent, * @return user's input */ public static String showInternalInputDialog(@Nullable Component parentComponent, - @Nullable Object message) { + @Nullable Object message) { return showInternalInputDialog(parentComponent, message, UIManager. getString("OptionPane.inputDialogTitle", parentComponent), QUESTION_MESSAGE); @@ -1404,7 +1404,7 @@ public static String showInternalInputDialog(@Nullable Component parentComponent * @return user's input */ public static String showInternalInputDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, int messageType) { + @Nullable Object message, @Nullable String title, int messageType) { return (String)showInternalInputDialog(parentComponent, message, title, messageType, null, null, null); } @@ -1439,8 +1439,8 @@ public static String showInternalInputDialog(@Nullable Component parentComponent * canceled the input */ public static Object showInternalInputDialog(@Nullable Component parentComponent, - @Nullable Object message, @Nullable String title, int messageType, @Nullable Icon icon, - Object @Nullable [] selectionValues, @Nullable Object initialSelectionValue) { + @Nullable Object message, @Nullable String title, int messageType, @Nullable Icon icon, + Object @Nullable [] selectionValues, @Nullable Object initialSelectionValue) { JOptionPane pane = new JOptionPane(message, messageType, OK_CANCEL_OPTION, icon, null, null); pane.putClientProperty(PopupFactory_FORCE_HEAVYWEIGHT_POPUP, @@ -1513,7 +1513,7 @@ public static Object showInternalInputDialog(@Nullable Component parentComponent * not have a valid parent */ public JInternalFrame createInternalFrame(@Nullable Component parentComponent, - @Nullable String title) { + @Nullable String title) { Container parent = JOptionPane.getDesktopPaneForComponent(parentComponent); @@ -1766,7 +1766,7 @@ public JOptionPane(@Nullable Object message, int messageType, int optionType) { * @param icon the Icon image to display */ public JOptionPane(@Nullable Object message, int messageType, int optionType, - @Nullable Icon icon) { + @Nullable Icon icon) { this(message, messageType, optionType, icon, null); } @@ -1798,7 +1798,7 @@ public JOptionPane(@Nullable Object message, int messageType, int optionType, * @param options the choices the user can select */ public JOptionPane(@Nullable Object message, int messageType, int optionType, - @Nullable Icon icon, Object @Nullable [] options) { + @Nullable Icon icon, Object @Nullable [] options) { this(message, messageType, optionType, icon, options, null); } @@ -1826,7 +1826,7 @@ public JOptionPane(@Nullable Object message, int messageType, int optionType, * only meaningful if options is used */ public JOptionPane(@Nullable Object message, int messageType, int optionType, - @Nullable Icon icon, Object @Nullable [] options, @Nullable Object initialValue) { + @Nullable Icon icon, Object @Nullable [] options, @Nullable Object initialValue) { this.message = message; this.options = options == null ? null : Arrays.copyOf(options, options.length); diff --git a/src/java.desktop/share/classes/javax/swing/JRootPane.java b/src/java.desktop/share/classes/javax/swing/JRootPane.java index d2316181e29..87b5e039464 100644 --- a/src/java.desktop/share/classes/javax/swing/JRootPane.java +++ b/src/java.desktop/share/classes/javax/swing/JRootPane.java @@ -33,7 +33,6 @@ import java.io.Serializable; - /** * A lightweight container used behind the scenes by * JFrame, JDialog, JWindow, @@ -293,7 +292,7 @@ public class JRootPane extends JComponent implements Accessible { private int windowDecorationStyle; /** The menu bar. */ - protected JMenuBar menuBar; + protected JMenuBar menuBar; /** The content pane. */ protected Container contentPane; diff --git a/src/java.desktop/share/classes/javax/swing/UIDefaults.java b/src/java.desktop/share/classes/javax/swing/UIDefaults.java index 1a6f19d15d5..0465d6a92ee 100644 --- a/src/java.desktop/share/classes/javax/swing/UIDefaults.java +++ b/src/java.desktop/share/classes/javax/swing/UIDefaults.java @@ -29,8 +29,6 @@ import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; import javax.swing.plaf.ComponentUI; - - import javax.swing.border.*; import javax.swing.event.SwingPropertyChangeSupport; diff --git a/src/java.desktop/share/classes/javax/swing/UIManager.java b/src/java.desktop/share/classes/javax/swing/UIManager.java index 67d1b9c3b03..8ebcfa90b3b 100644 --- a/src/java.desktop/share/classes/javax/swing/UIManager.java +++ b/src/java.desktop/share/classes/javax/swing/UIManager.java @@ -212,7 +212,6 @@ * @since 1.2 */ @NullMarked - @SuppressWarnings("serial") // Same-version serialization only public class UIManager implements Serializable { @@ -596,7 +595,6 @@ public static LookAndFeel createLookAndFeel(String name) * {@code false} * @see #getLookAndFeel */ - public static void setLookAndFeel(LookAndFeel newLookAndFeel) throws UnsupportedLookAndFeelException { @@ -648,7 +646,6 @@ public static void setLookAndFeel(LookAndFeel newLookAndFeel) * a class that extends {@code LookAndFeel} * @throws NullPointerException if {@code className} is {@code null} */ - @SuppressWarnings("deprecation") public static void setLookAndFeel(String className) throws ClassNotFoundException, diff --git a/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java b/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java index 4b55a0177f7..621895b8652 100644 --- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java +++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java @@ -192,7 +192,7 @@ public void updateUI() { * @see javax.swing.JComponent#isPaintingForPrint() */ public Component getTableCellRendererComponent(JTable table, @Nullable Object value, - boolean isSelected, boolean hasFocus, int row, int column) { + boolean isSelected, boolean hasFocus, int row, int column) { if (table == null) { return this; } @@ -345,7 +345,7 @@ public void repaint() { * See the Implementation Note * for more information. */ - protected void firePropertyChange( String propertyName, @Nullable Object oldValue, @Nullable Object newValue) { + protected void firePropertyChange(String propertyName, @Nullable Object oldValue, @Nullable Object newValue) { // Strings get interned... if (propertyName=="text" || propertyName == "labelFor" diff --git a/src/java.desktop/share/classes/javax/swing/text/TabSet.java b/src/java.desktop/share/classes/javax/swing/text/TabSet.java index 16e101eb095..a4b71bdaa70 100644 --- a/src/java.desktop/share/classes/javax/swing/text/TabSet.java +++ b/src/java.desktop/share/classes/javax/swing/text/TabSet.java @@ -164,8 +164,6 @@ public int getTabIndexAfter(float location) { * * @since 1.5 */ - - public boolean equals(@Nullable Object o) { if (o == this) { return true; diff --git a/src/java.desktop/share/classes/javax/swing/text/TabStop.java b/src/java.desktop/share/classes/javax/swing/text/TabStop.java index a1b081c8785..8098240e379 100644 --- a/src/java.desktop/share/classes/javax/swing/text/TabStop.java +++ b/src/java.desktop/share/classes/javax/swing/text/TabStop.java @@ -138,8 +138,6 @@ public int getLeader() { * Returns true if the tabs are equal. * @return true if the tabs are equal, otherwise false */ - - public boolean equals(@Nullable Object other) { if (other == this) { diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java index 515c84adce2..f56e746866e 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java @@ -696,7 +696,7 @@ public void repaint() {} * See the Implementation Note * for more information. */ - protected void firePropertyChange( String propertyName, @Nullable Object oldValue, @Nullable Object newValue) { + protected void firePropertyChange(String propertyName, @Nullable Object oldValue, @Nullable Object newValue) { // Strings get interned... if (propertyName == "text" || ((SwingUtilities2.isScaleChanged(propertyName, oldValue, newValue) diff --git a/src/java.desktop/share/classes/javax/swing/tree/TreePath.java b/src/java.desktop/share/classes/javax/swing/tree/TreePath.java index 21b81580d99..7650fd2f750 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/TreePath.java +++ b/src/java.desktop/share/classes/javax/swing/tree/TreePath.java @@ -249,8 +249,6 @@ public Object getPathComponent(int index) { * * @param o the object to compare */ - - public boolean equals(@Nullable Object o) { if(o == this) return true; diff --git a/src/java.desktop/share/classes/sun/java2d/loops/CompositeType.java b/src/java.desktop/share/classes/sun/java2d/loops/CompositeType.java index 5cca235408b..c19253423bf 100644 --- a/src/java.desktop/share/classes/sun/java2d/loops/CompositeType.java +++ b/src/java.desktop/share/classes/sun/java2d/loops/CompositeType.java @@ -283,8 +283,6 @@ public boolean isDerivedFrom(CompositeType other) { return false; } - - public boolean equals(@Nullable Object o) { if (o instanceof CompositeType) { return (((CompositeType) o).uniqueID == this.uniqueID); diff --git a/src/java.desktop/share/classes/sun/java2d/loops/SurfaceType.java b/src/java.desktop/share/classes/sun/java2d/loops/SurfaceType.java index 1c108791f67..e6420b9dd28 100644 --- a/src/java.desktop/share/classes/sun/java2d/loops/SurfaceType.java +++ b/src/java.desktop/share/classes/sun/java2d/loops/SurfaceType.java @@ -447,8 +447,6 @@ public int hashCode() { return desc.hashCode(); } - - public boolean equals(@Nullable Object o) { if (o instanceof SurfaceType) { return (((SurfaceType) o).uniqueID == this.uniqueID); diff --git a/src/java.desktop/share/classes/sun/java2d/pipe/Region.java b/src/java.desktop/share/classes/sun/java2d/pipe/Region.java index dfb47855ea0..431ece8a543 100644 --- a/src/java.desktop/share/classes/sun/java2d/pipe/Region.java +++ b/src/java.desktop/share/classes/sun/java2d/pipe/Region.java @@ -1371,8 +1371,6 @@ public int hashCode() { } @Override - - public boolean equals(@Nullable Object o) { if (this == o) { return true; diff --git a/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java b/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java index e3c9076eb88..784c73c996e 100644 --- a/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java +++ b/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java @@ -509,8 +509,6 @@ public String toString() { /* Stream services have an output stream which cannot be shared, * so two services are equal only if they are the same object. */ - - public boolean equals(@Nullable Object obj) { return (obj == this || (obj instanceof PSStreamPrintService && diff --git a/src/java.desktop/share/classes/sun/swing/BakedArrayList.java b/src/java.desktop/share/classes/sun/swing/BakedArrayList.java index a92701aceff..0161a7d75db 100644 --- a/src/java.desktop/share/classes/sun/swing/BakedArrayList.java +++ b/src/java.desktop/share/classes/sun/swing/BakedArrayList.java @@ -79,8 +79,6 @@ public int hashCode() { return _hashCode; } - - public boolean equals(@Nullable Object o) { @SuppressWarnings("unchecked") BakedArrayList list = (BakedArrayList)o; diff --git a/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java b/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java index 9893a8cbc58..532fefa4abc 100644 --- a/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java +++ b/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java @@ -181,6 +181,7 @@ * @see java.lang.instrument.Instrumentation * @since 1.5 */ + @NullMarked public interface ClassFileTransformer { @@ -211,7 +212,7 @@ public interface ClassFileTransformer { */ default byte @Nullable [] transform( @Nullable ClassLoader loader, - String className, + String className, @Nullable Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) @@ -250,7 +251,7 @@ public interface ClassFileTransformer { default byte @Nullable [] transform( Module module, @Nullable ClassLoader loader, - String className, + String className, @Nullable Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) diff --git a/src/java.logging/share/classes/java/util/logging/Level.java b/src/java.logging/share/classes/java/util/logging/Level.java index 8c8872d4aa0..032244a0579 100644 --- a/src/java.logging/share/classes/java/util/logging/Level.java +++ b/src/java.logging/share/classes/java/util/logging/Level.java @@ -78,7 +78,7 @@ */ @NullMarked -public class Level implements java.io.Serializable { +public class Level implements java.io.Serializable { private static final String defaultBundle = "sun.util.logging.resources.logging"; @@ -103,7 +103,7 @@ private static final class RbAccess { /** * @serial The resource bundle name to be used in localizing the level name. */ - private final @Nullable String resourceBundleName; + private final @Nullable String resourceBundleName; // localized level name private transient @Nullable String localizedLevelName; @@ -216,7 +216,6 @@ private static final class RbAccess { * @param value an integer value for the level. * @throws NullPointerException if the name is null */ - @SuppressWarnings("signature") protected Level(String name, int value) { this(name, value, null); } @@ -232,15 +231,13 @@ protected Level(String name, int value) { * or an empty string, it is ignored. * @throws NullPointerException if the name is null */ - protected Level(String name, int value, @Nullable String resourceBundleName) { + protected Level(String name, int value, @Nullable String resourceBundleName) { this(name, value, resourceBundleName, true); } // private constructor to specify whether this instance should be added // to the KnownLevel list from which Level.parse method does its look up - - @SuppressWarnings({"argument.type.incompatible"}) - private Level(String name, int value, @Nullable String resourceBundleName, boolean visible) { + private Level(String name, int value, @Nullable String resourceBundleName, boolean visible) { if (name == null) { throw new NullPointerException(); } @@ -260,7 +257,7 @@ private Level(String name, int value, @Nullable String resourceBundleName, bool * * @return localization resource bundle name */ - public @Nullable String getResourceBundleName() { + public @Nullable String getResourceBundleName() { return resourceBundleName; } @@ -292,7 +289,6 @@ final String getLevelName() { return this.name; } - private String computeLocalizedLevelName(Locale newLocale) { // Resource bundle should be loaded from the defining module // or its defining class loader, if it's unnamed module, @@ -346,8 +342,6 @@ private String computeLocalizedLevelName(Locale newLocale) { return null; } - - @SuppressWarnings({"contracts.precondition.not.satisfied"}) final synchronized String getLocalizedLevelName() { // See if we have a cached localized name @@ -379,8 +373,6 @@ final synchronized String getLocalizedLevelName() { // that overrides Level.getLocalizedName() to return a different string // than what's returned by the default implementation. // - - @SuppressWarnings({"dereference.of.nullable"}) static @Nullable Level findLevel(String name) { if (name == null) { throw new NullPointerException(); @@ -493,8 +485,6 @@ private Object readResolve() { * Passing an integer that does not (e.g., 1) will return a new level name * initialized to that value. */ - - @SuppressWarnings({"dereference.of.nullable"}) public static synchronized Level parse(String name) throws IllegalArgumentException { // Check that name is not null. name.length(); @@ -543,8 +533,6 @@ public static synchronized Level parse(String name) throws IllegalArgumentExcept * Compare two objects for value equality. * @return true if and only if the two objects have the same level value. */ - - @SuppressWarnings({"dereference.of.nullable"}) @Override public boolean equals(@Nullable Object ox) { try { diff --git a/src/java.logging/share/classes/java/util/logging/LogRecord.java b/src/java.logging/share/classes/java/util/logging/LogRecord.java index 6bad92ee02f..7e61f64c9ef 100644 --- a/src/java.logging/share/classes/java/util/logging/LogRecord.java +++ b/src/java.logging/share/classes/java/util/logging/LogRecord.java @@ -73,7 +73,7 @@ */ @NullMarked -public class LogRecord implements java.io.Serializable { +public class LogRecord implements java.io.Serializable { private static final AtomicLong globalSequenceNumber = new AtomicLong(); @@ -280,7 +280,7 @@ public void setResourceBundle(@Nullable ResourceBundle bundle) { * The result may be null if the message is not localizable. * @return the localization resource bundle name */ - public @Nullable String getResourceBundleName() { + public @Nullable String getResourceBundleName() { return resourceBundleName; } diff --git a/src/java.logging/share/classes/java/util/logging/Logger.java b/src/java.logging/share/classes/java/util/logging/Logger.java index 972abf32782..1993c8cb95e 100644 --- a/src/java.logging/share/classes/java/util/logging/Logger.java +++ b/src/java.logging/share/classes/java/util/logging/Logger.java @@ -221,10 +221,8 @@ * * @since 1.4 */ - - @NullMarked -public class Logger { +public class Logger { private static final Handler emptyHandlers[] = new Handler[0]; private static final int offValue = Level.OFF.intValue(); @@ -471,7 +469,7 @@ ConfigurationData merge(Logger systemPeer) { * * @since 1.6 */ - public static final String GLOBAL_LOGGER_NAME = "global"; + public static final String GLOBAL_LOGGER_NAME = "global"; /** * Return global logger object with the name Logger.GLOBAL_LOGGER_NAME. @@ -479,7 +477,6 @@ ConfigurationData merge(Logger systemPeer) { * @return global logger object * @since 1.7 */ - public static final Logger getGlobal() { // In order to break a cyclic dependence between the LogManager // and Logger static initializers causing deadlocks, the global @@ -558,7 +555,7 @@ public static final Logger getGlobal() { * @throws MissingResourceException if the resourceBundleName is non-null and * no corresponding resource can be found. */ - protected Logger(@Nullable String name, @Nullable String resourceBundleName) { + protected Logger(@Nullable String name, @Nullable String resourceBundleName) { this(name, resourceBundleName, null, LogManager.getLogManager(), false); } @@ -683,7 +680,6 @@ private static Logger demandLogger(String name, @Nullable String resourceBundleN // Synchronization is not required here. All synchronization for // adding a new Logger object is handled by LogManager.addLogger(). - @CallerSensitive public static Logger getLogger(String name) { // This method is intentionally not a wrapper around a call @@ -762,9 +758,8 @@ private static Logger getLogger(String name, Class callerClass) { // Synchronization is not required here. All synchronization for // adding a new Logger object is handled by LogManager.addLogger(). - @CallerSensitive - public static Logger getLogger(String name, @Nullable String resourceBundleName) { + public static Logger getLogger(String name, @Nullable String resourceBundleName) { return Logger.getLogger(name, resourceBundleName, Reflection.getCallerClass()); } @@ -836,7 +831,6 @@ static Logger getPlatformLogger(String name) { * * @return a newly created private Logger */ - public static Logger getAnonymousLogger() { return getAnonymousLogger(null); } @@ -867,9 +861,8 @@ public static Logger getAnonymousLogger() { // Synchronization is not required here. All synchronization for // adding a new anonymous Logger object is handled by doSetParent(). - @CallerSensitive - public static Logger getAnonymousLogger(@Nullable String resourceBundleName) { + public static Logger getAnonymousLogger(@Nullable String resourceBundleName) { LogManager manager = LogManager.getLogManager(); // cleanup some Loggers that have been GC'ed manager.drainLoggerRefQueueBounded(); @@ -898,7 +891,6 @@ public static Logger getAnonymousLogger(@Nullable String resourceBundleName) { * * @return localization bundle (may be {@code null}) */ - public @Nullable ResourceBundle getResourceBundle() { return findResourceBundle(getResourceBundleName(), true); } @@ -916,8 +908,7 @@ public static Logger getAnonymousLogger(@Nullable String resourceBundleName) { * * @return localization bundle name (may be {@code null}) */ - - public @Nullable String getResourceBundleName() { + public @Nullable String getResourceBundleName() { return loggerBundle.resourceBundleName; } @@ -940,7 +931,6 @@ public void setFilter(@Nullable Filter newFilter) { * * @return a filter object (may be null) */ - public @Nullable Filter getFilter() { return config.filter; } @@ -954,7 +944,6 @@ public void setFilter(@Nullable Filter newFilter) { * * @param record the LogRecord to be published */ - public void log(LogRecord record) { if (!isLoggable(record.getLevel())) { return; @@ -992,7 +981,6 @@ public void log(LogRecord record) { // private support method for logging. // We fill in the logger name, resource bundle name, and // resource bundle and then call "void log(LogRecord)". - private void doLog(LogRecord lr) { lr.setLoggerName(name); final LoggerBundle lb = getEffectiveLoggerBundle(); @@ -1020,8 +1008,7 @@ private void doLog(LogRecord lr) { * @param level One of the message level identifiers, e.g., SEVERE * @param msg The string message (or a key in the message catalog) */ - - public void log( Level level, @Nullable String msg) { + public void log(Level level, @Nullable String msg) { if (!isLoggable(level)) { return; } @@ -1043,8 +1030,7 @@ public void log( Level level, @Nullable String msg) { * desired log message * @since 1.8 */ - - public void log( Level level, Supplier<@Nullable String> msgSupplier) { + public void log(Level level, Supplier<@Nullable String> msgSupplier) { if (!isLoggable(level)) { return; } @@ -1063,8 +1049,7 @@ public void log( Level level, Supplier<@Nullable String> msgSupplier) { * @param msg The string message (or a key in the message catalog) * @param param1 parameter to the message */ - - public void log( Level level, @Nullable String msg, @Nullable Object param1) { + public void log(Level level, @Nullable String msg, @Nullable Object param1) { if (!isLoggable(level)) { return; } @@ -1085,8 +1070,7 @@ public void log( Level level, @Nullable String msg, @Nullable Object param1) { * @param msg The string message (or a key in the message catalog) * @param params array of parameters to the message */ - - public void log( Level level, @Nullable String msg, @Nullable Object params @Nullable []) { + public void log(Level level, @Nullable String msg, @Nullable Object params @Nullable []) { if (!isLoggable(level)) { return; } @@ -1111,8 +1095,7 @@ public void log( Level level, @Nullable String msg, @Nullable Object params @N * @param msg The string message (or a key in the message catalog) * @param thrown Throwable associated with log message. */ - - public void log( Level level, @Nullable String msg, @Nullable Throwable thrown) { + public void log(Level level, @Nullable String msg, @Nullable Throwable thrown) { if (!isLoggable(level)) { return; } @@ -1140,8 +1123,7 @@ public void log( Level level, @Nullable String msg, @Nullable Throwable thrown) * desired log message * @since 1.8 */ - - public void log( Level level, @Nullable Throwable thrown, Supplier<@Nullable String> msgSupplier) { + public void log(Level level, @Nullable Throwable thrown, Supplier<@Nullable String> msgSupplier) { if (!isLoggable(level)) { return; } @@ -1167,8 +1149,7 @@ public void log( Level level, @Nullable Throwable thrown, Supplier<@Nullable S * @param sourceMethod name of method that issued the logging request * @param msg The string message (or a key in the message catalog) */ - - public void logp( Level level, @Nullable String sourceClass, @Nullable String sourceMethod, @Nullable String msg) { + public void logp(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, @Nullable String msg) { if (!isLoggable(level)) { return; } @@ -1194,7 +1175,6 @@ public void logp( Level level, @Nullable String sourceClass, @Nullable String so * desired log message * @since 1.8 */ - public void logp(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, Supplier<@Nullable String> msgSupplier) { if (!isLoggable(level)) { @@ -1220,7 +1200,6 @@ public void logp(Level level, @Nullable String sourceClass, @Nullable String sou * @param msg The string message (or a key in the message catalog) * @param param1 Parameter to the log message. */ - public void logp(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, @Nullable String msg, @Nullable Object param1) { if (!isLoggable(level)) { @@ -1248,7 +1227,6 @@ public void logp(Level level, @Nullable String sourceClass, @Nullable String sou * @param msg The string message (or a key in the message catalog) * @param params Array of parameters to the message */ - public void logp(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, @Nullable String msg, @Nullable Object params @Nullable []) { if (!isLoggable(level)) { @@ -1280,7 +1258,6 @@ public void logp(Level level, @Nullable String sourceClass, @Nullable String sou * @param msg The string message (or a key in the message catalog) * @param thrown Throwable associated with log message. */ - public void logp(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, @Nullable String msg, @Nullable Throwable thrown) { if (!isLoggable(level)) { @@ -1315,7 +1292,6 @@ public void logp(Level level, @Nullable String sourceClass, @Nullable String sou * desired log message * @since 1.8 */ - public void logp(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Throwable thrown, Supplier<@Nullable String> msgSupplier) { if (!isLoggable(level)) { @@ -1336,8 +1312,7 @@ public void logp(Level level, @Nullable String sourceClass, @Nullable String sou // Private support method for logging for "logrb" methods. // We fill in the logger name, resource bundle name, and // resource bundle and then call "void log(LogRecord)". - - private void doLog( LogRecord lr, @Nullable String rbname) { + private void doLog(LogRecord lr, @Nullable String rbname) { lr.setLoggerName(name); if (rbname != null) { lr.setResourceBundleName(rbname); @@ -1378,10 +1353,9 @@ private void doLog(LogRecord lr, ResourceBundle rb) { * java.lang.String, java.util.ResourceBundle, java.lang.String, * java.lang.Object...)} instead. */ - @Deprecated public void logrb(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, - @Nullable String bundleName, @Nullable String msg) { + @Nullable String bundleName, @Nullable String msg) { if (!isLoggable(level)) { return; } @@ -1414,10 +1388,9 @@ public void logrb(Level level, @Nullable String sourceClass, @Nullable String so * java.lang.String, java.util.ResourceBundle, java.lang.String, * java.lang.Object...)} instead */ - @Deprecated public void logrb(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, - @Nullable String bundleName, @Nullable String msg, @Nullable Object param1) { + @Nullable String bundleName, @Nullable String msg, @Nullable Object param1) { if (!isLoggable(level)) { return; } @@ -1452,10 +1425,9 @@ public void logrb(Level level, @Nullable String sourceClass, @Nullable String so * java.lang.String, java.util.ResourceBundle, java.lang.String, * java.lang.Object...)} instead. */ - @Deprecated public void logrb(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, - @Nullable String bundleName, @Nullable String msg, @Nullable Object params @Nullable []) { + @Nullable String bundleName, @Nullable String msg, @Nullable Object params @Nullable []) { if (!isLoggable(level)) { return; } @@ -1488,7 +1460,7 @@ public void logrb(Level level, @Nullable String sourceClass, @Nullable String so * @since 1.8 */ public void logrb(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, - @Nullable ResourceBundle bundle, @Nullable String msg, @Nullable Object @Nullable... params) { + @Nullable ResourceBundle bundle, @Nullable String msg, @Nullable Object @Nullable ... params) { if (!isLoggable(level)) { return; } @@ -1520,7 +1492,7 @@ public void logrb(Level level, @Nullable String sourceClass, @Nullable String so * @param params Parameters to the message (optional, may be none). * @since 9 */ - public void logrb(Level level, @Nullable ResourceBundle bundle, @Nullable String msg, @Nullable Object @Nullable... params) { + public void logrb(Level level, @Nullable ResourceBundle bundle, @Nullable String msg, @Nullable Object @Nullable ... params) { if (!isLoggable(level)) { return; } @@ -1559,10 +1531,9 @@ public void logrb(Level level, @Nullable ResourceBundle bundle, @Nullable String * java.lang.String, java.util.ResourceBundle, java.lang.String, * java.lang.Throwable)} instead. */ - @Deprecated public void logrb(Level level, @Nullable String sourceClass, @Nullable String sourceMethod, - @Nullable String bundleName, @Nullable String msg, @Nullable Throwable thrown) { + @Nullable String bundleName, @Nullable String msg, @Nullable Throwable thrown) { if (!isLoggable(level)) { return; } @@ -1662,7 +1633,6 @@ public void logrb(Level level, @Nullable ResourceBundle bundle, @Nullable String * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that is being entered */ - public void entering(@Nullable String sourceClass, @Nullable String sourceMethod) { logp(Level.FINER, sourceClass, sourceMethod, "ENTRY"); } @@ -1679,8 +1649,7 @@ public void entering(@Nullable String sourceClass, @Nullable String sourceMethod * @param sourceMethod name of method that is being entered * @param param1 parameter to the method being entered */ - - public void entering(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Object param1) { + public void entering(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Object param1) { logp(Level.FINER, sourceClass, sourceMethod, "ENTRY {0}", param1); } @@ -1697,8 +1666,7 @@ public void entering(@Nullable String sourceClass, @Nullable String sourceMethod * @param sourceMethod name of method that is being entered * @param params array of parameters to the method being entered */ - - public void entering(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Object params @Nullable []) { + public void entering(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Object params @Nullable []) { String msg = "ENTRY"; if (params == null ) { logp(Level.FINER, sourceClass, sourceMethod, msg); @@ -1725,7 +1693,6 @@ public void entering(@Nullable String sourceClass, @Nullable String sourceMethod * @param sourceClass name of class that issued the logging request * @param sourceMethod name of the method */ - public void exiting(@Nullable String sourceClass, @Nullable String sourceMethod) { logp(Level.FINER, sourceClass, sourceMethod, "RETURN"); } @@ -1743,8 +1710,7 @@ public void exiting(@Nullable String sourceClass, @Nullable String sourceMethod) * @param sourceMethod name of the method * @param result Object that is being returned */ - - public void exiting(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Object result) { + public void exiting(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Object result) { logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result); } @@ -1769,8 +1735,7 @@ public void exiting(@Nullable String sourceClass, @Nullable String sourceMethod, * @param sourceMethod name of the method. * @param thrown The Throwable that is being thrown. */ - - public void throwing(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Throwable thrown) { + public void throwing(@Nullable String sourceClass, @Nullable String sourceMethod, @Nullable Throwable thrown) { if (!isLoggable(Level.FINER)) { return; } @@ -1794,7 +1759,6 @@ public void throwing(@Nullable String sourceClass, @Nullable String sourceMethod * * @param msg The string message (or a key in the message catalog) */ - public void severe(@Nullable String msg) { log(Level.SEVERE, msg); } @@ -1808,7 +1772,6 @@ public void severe(@Nullable String msg) { * * @param msg The string message (or a key in the message catalog) */ - public void warning(@Nullable String msg) { log(Level.WARNING, msg); } @@ -1822,7 +1785,6 @@ public void warning(@Nullable String msg) { * * @param msg The string message (or a key in the message catalog) */ - public void info(@Nullable String msg) { log(Level.INFO, msg); } @@ -1836,7 +1798,6 @@ public void info(@Nullable String msg) { * * @param msg The string message (or a key in the message catalog) */ - public void config(@Nullable String msg) { log(Level.CONFIG, msg); } @@ -1850,7 +1811,6 @@ public void config(@Nullable String msg) { * * @param msg The string message (or a key in the message catalog) */ - public void fine(@Nullable String msg) { log(Level.FINE, msg); } @@ -1864,7 +1824,6 @@ public void fine(@Nullable String msg) { * * @param msg The string message (or a key in the message catalog) */ - public void finer(@Nullable String msg) { log(Level.FINER, msg); } @@ -1878,7 +1837,6 @@ public void finer(@Nullable String msg) { * * @param msg The string message (or a key in the message catalog) */ - public void finest(@Nullable String msg) { log(Level.FINEST, msg); } @@ -1901,7 +1859,6 @@ public void finest(@Nullable String msg) { * desired log message * @since 1.8 */ - public void severe(Supplier<@Nullable String> msgSupplier) { log(Level.SEVERE, msgSupplier); } @@ -1919,7 +1876,6 @@ public void severe(Supplier<@Nullable String> msgSupplier) { * desired log message * @since 1.8 */ - public void warning(Supplier<@Nullable String> msgSupplier) { log(Level.WARNING, msgSupplier); } @@ -1937,7 +1893,6 @@ public void warning(Supplier<@Nullable String> msgSupplier) { * desired log message * @since 1.8 */ - public void info(Supplier<@Nullable String> msgSupplier) { log(Level.INFO, msgSupplier); } @@ -1955,7 +1910,6 @@ public void info(Supplier<@Nullable String> msgSupplier) { * desired log message * @since 1.8 */ - public void config(Supplier<@Nullable String> msgSupplier) { log(Level.CONFIG, msgSupplier); } @@ -1973,7 +1927,6 @@ public void config(Supplier<@Nullable String> msgSupplier) { * desired log message * @since 1.8 */ - public void fine(Supplier<@Nullable String> msgSupplier) { log(Level.FINE, msgSupplier); } @@ -1991,7 +1944,6 @@ public void fine(Supplier<@Nullable String> msgSupplier) { * desired log message * @since 1.8 */ - public void finer(Supplier<@Nullable String> msgSupplier) { log(Level.FINER, msgSupplier); } @@ -2009,7 +1961,6 @@ public void finer(Supplier<@Nullable String> msgSupplier) { * desired log message * @since 1.8 */ - public void finest(Supplier<@Nullable String> msgSupplier) { log(Level.FINEST, msgSupplier); } @@ -2049,7 +2000,6 @@ final boolean isLevelInitialized() { * * @return this Logger's level */ - public @Nullable Level getLevel() { return config.levelObject; } @@ -2062,7 +2012,6 @@ final boolean isLevelInitialized() { * @param level a message logging level * @return true if the given message level is currently being logged. */ - public boolean isLoggable(Level level) { int levelValue = config.levelValue; if (level.intValue() < levelValue || levelValue == offValue) { @@ -2075,7 +2024,6 @@ public boolean isLoggable(Level level) { * Get the name for this logger. * @return logger name. Will be null for anonymous Loggers. */ - public @Nullable String getName() { return name; } @@ -2115,7 +2063,6 @@ public void removeHandler(@Nullable Handler handler) { * * @return an array of all registered Handlers */ - public Handler[] getHandlers() { return accessCheckedHandlers(); } @@ -2146,7 +2093,6 @@ public void setUseParentHandlers(boolean useParentHandlers) { * * @return true if output is to be sent to the logger's parent */ - public boolean getUseParentHandlers() { return config.useParentHandlers; } @@ -2380,7 +2326,6 @@ public void setResourceBundle(ResourceBundle bundle) { * * @return nearest existing parent Logger */ - public @Nullable Logger getParent() { // Note: this used to be synchronized on treeLock. However, this only // provided memory semantics, as there was no guarantee that the caller @@ -2398,7 +2343,7 @@ public void setResourceBundle(ResourceBundle bundle) { * * @param parent the new parent logger */ - public void setParent( Logger parent) { + public void setParent(Logger parent) { if (parent == null) { throw new NullPointerException(); } @@ -2410,7 +2355,7 @@ public void setParent( Logger parent) { // Private method to do the work for parenting a child // Logger onto a parent logger. - private void doSetParent( Logger newParent) { + private void doSetParent(Logger newParent) { // System.err.println("doSetParent \"" + getName() + "\" \"" // + newParent.getName() + "\""); diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/NamedObject.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/NamedObject.java index 3b8612d348a..110c67ad04b 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/NamedObject.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/NamedObject.java @@ -90,8 +90,6 @@ public NamedObject(String objectName, DynamicMBean object) throws MalformedObjec * * @return True if the two named objects are equal, otherwise false. */ - - public boolean equals(@Nullable Object object) { if (this == object) return true; if (object == null) return false; diff --git a/src/java.management/share/classes/javax/management/Attribute.java b/src/java.management/share/classes/javax/management/Attribute.java index 5d5fc7ad567..591312f94d7 100644 --- a/src/java.management/share/classes/javax/management/Attribute.java +++ b/src/java.management/share/classes/javax/management/Attribute.java @@ -100,8 +100,6 @@ public Object getValue() { */ - - public boolean equals(@Nullable Object object) { if (!(object instanceof Attribute)) { return false; diff --git a/src/java.management/share/classes/javax/management/Descriptor.java b/src/java.management/share/classes/javax/management/Descriptor.java index 840b1aacbe0..97aa133cd37 100644 --- a/src/java.management/share/classes/javax/management/Descriptor.java +++ b/src/java.management/share/classes/javax/management/Descriptor.java @@ -624,8 +624,6 @@ public void setFields(String[] fieldNames, Object[] fieldValues) * * @since 1.6 */ - - public boolean equals(@Nullable Object obj); /** diff --git a/src/java.management/share/classes/javax/management/ImmutableDescriptor.java b/src/java.management/share/classes/javax/management/ImmutableDescriptor.java index b92cd249546..d23b5d0c24b 100644 --- a/src/java.management/share/classes/javax/management/ImmutableDescriptor.java +++ b/src/java.management/share/classes/javax/management/ImmutableDescriptor.java @@ -347,8 +347,6 @@ public final String[] getFieldNames() { } @Override - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanAttributeInfo.java b/src/java.management/share/classes/javax/management/MBeanAttributeInfo.java index 2688622ac8d..902034df0bb 100644 --- a/src/java.management/share/classes/javax/management/MBeanAttributeInfo.java +++ b/src/java.management/share/classes/javax/management/MBeanAttributeInfo.java @@ -257,8 +257,6 @@ public String toString() { * #isWritable()}, and {@link #isIs()} values are equal (not * necessarily identical) to those of this MBeanAttributeInfo. */ - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanConstructorInfo.java b/src/java.management/share/classes/javax/management/MBeanConstructorInfo.java index 555c2552e53..789382dce84 100644 --- a/src/java.management/share/classes/javax/management/MBeanConstructorInfo.java +++ b/src/java.management/share/classes/javax/management/MBeanConstructorInfo.java @@ -187,8 +187,6 @@ public String toString() { * signature arrays are equal if their elements are pairwise * equal. */ - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanFeatureInfo.java b/src/java.management/share/classes/javax/management/MBeanFeatureInfo.java index a4e79d60ffc..6eea33a53d1 100644 --- a/src/java.management/share/classes/javax/management/MBeanFeatureInfo.java +++ b/src/java.management/share/classes/javax/management/MBeanFeatureInfo.java @@ -144,8 +144,6 @@ public Descriptor getDescriptor() { * values are equal (not necessarily identical) to those of this * MBeanFeatureInfo. */ - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanInfo.java b/src/java.management/share/classes/javax/management/MBeanInfo.java index 1167ca15c11..a4ffa3af41e 100644 --- a/src/java.management/share/classes/javax/management/MBeanInfo.java +++ b/src/java.management/share/classes/javax/management/MBeanInfo.java @@ -486,8 +486,6 @@ public String toString() { * to this one according to the rules above. */ @Override - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java b/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java index 3b88f1edc1b..81d089d5f9d 100644 --- a/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java +++ b/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java @@ -190,8 +190,6 @@ public String toString() { * elements are equal. They are not equal if they have the same * elements but in a different order. */ - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanOperationInfo.java b/src/java.management/share/classes/javax/management/MBeanOperationInfo.java index d273856750b..1f6b9c1ef52 100644 --- a/src/java.management/share/classes/javax/management/MBeanOperationInfo.java +++ b/src/java.management/share/classes/javax/management/MBeanOperationInfo.java @@ -295,8 +295,6 @@ public String toString() { * are equal if their elements are pairwise equal. */ @Override - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanParameterInfo.java b/src/java.management/share/classes/javax/management/MBeanParameterInfo.java index 2be58efd5f3..c459d652b48 100644 --- a/src/java.management/share/classes/javax/management/MBeanParameterInfo.java +++ b/src/java.management/share/classes/javax/management/MBeanParameterInfo.java @@ -134,8 +134,6 @@ public String toString() { * #getDescription()} values are equal (not necessarily identical) * to those of this MBeanParameterInfo. */ - - public boolean equals(@Nullable Object o) { if (o == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanPermission.java b/src/java.management/share/classes/javax/management/MBeanPermission.java index 98d5a9d1a61..0be0b12db4a 100644 --- a/src/java.management/share/classes/javax/management/MBeanPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanPermission.java @@ -1145,8 +1145,6 @@ public boolean implies(Permission p) { * @return true if obj is an MBeanPermission, and has the * same name and actions as this MBeanPermission object. */ - - public boolean equals(@Nullable Object obj) { if (obj == this) return true; diff --git a/src/java.management/share/classes/javax/management/MBeanServer.java b/src/java.management/share/classes/javax/management/MBeanServer.java index d6db76d2e4a..92767d68d4e 100644 --- a/src/java.management/share/classes/javax/management/MBeanServer.java +++ b/src/java.management/share/classes/javax/management/MBeanServer.java @@ -30,7 +30,6 @@ // java import - import java.util.Set; import java.io.ObjectInputStream; diff --git a/src/java.management/share/classes/javax/management/MBeanServerPermission.java b/src/java.management/share/classes/javax/management/MBeanServerPermission.java index fcdb27bbceb..323ac20f239 100644 --- a/src/java.management/share/classes/javax/management/MBeanServerPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanServerPermission.java @@ -37,7 +37,6 @@ import java.util.Set; import java.util.StringTokenizer; - /** A Permission to perform actions related to MBeanServers. The name of the permission specifies the operation requested or granted by the permission. For a granted permission, it can be @@ -192,7 +191,7 @@ static int impliedMask(int mask) { return mask; } - static String getCanonicalName(int mask) { + static String getCanonicalName(int mask) { if (mask == ALL_MASK) return "*"; @@ -301,8 +300,6 @@ public boolean implies(Permission p) { * @param obj the object we are testing for equality with this object. * @return true if the objects are equal. */ - - public boolean equals(@Nullable Object obj) { if (obj == this) return true; diff --git a/src/java.management/share/classes/javax/management/ObjectInstance.java b/src/java.management/share/classes/javax/management/ObjectInstance.java index 06906abe507..116cc7d687e 100644 --- a/src/java.management/share/classes/javax/management/ObjectInstance.java +++ b/src/java.management/share/classes/javax/management/ObjectInstance.java @@ -111,8 +111,6 @@ public ObjectInstance(ObjectName objectName, String className) { * * @return True if the two object instances are equal, otherwise false. */ - - public boolean equals(@Nullable Object object) { if (!(object instanceof ObjectInstance)) { return false; diff --git a/src/java.management/share/classes/javax/management/ObjectName.java b/src/java.management/share/classes/javax/management/ObjectName.java index 51b1c8379d1..dbc54ab65b6 100644 --- a/src/java.management/share/classes/javax/management/ObjectName.java +++ b/src/java.management/share/classes/javax/management/ObjectName.java @@ -1668,8 +1668,6 @@ public String toString() { * canonical form is equal to that of this ObjectName. */ @Override - - public boolean equals(@Nullable Object object) { // same object case diff --git a/src/java.management/share/classes/javax/management/openmbean/ArrayType.java b/src/java.management/share/classes/javax/management/openmbean/ArrayType.java index 81e80961e76..3bc50e49ac0 100644 --- a/src/java.management/share/classes/javax/management/openmbean/ArrayType.java +++ b/src/java.management/share/classes/javax/management/openmbean/ArrayType.java @@ -687,8 +687,6 @@ boolean isAssignableFrom(OpenType ot) { * @return {@code true} if the specified object is equal to * this {@code ArrayType} instance. */ - - public boolean equals(@Nullable Object obj) { // if obj is null, return false diff --git a/src/java.management/share/classes/javax/management/openmbean/CompositeData.java b/src/java.management/share/classes/javax/management/openmbean/CompositeData.java index 70393de38e4..1f1526db5ff 100644 --- a/src/java.management/share/classes/javax/management/openmbean/CompositeData.java +++ b/src/java.management/share/classes/javax/management/openmbean/CompositeData.java @@ -143,8 +143,6 @@ public interface CompositeData { * @return {@code true} if the specified object is equal to this * {@code CompositeData} instance. */ - - public boolean equals(@Nullable Object obj) ; /** diff --git a/src/java.management/share/classes/javax/management/openmbean/CompositeType.java b/src/java.management/share/classes/javax/management/openmbean/CompositeType.java index 3eccee96f94..122d23c39d7 100644 --- a/src/java.management/share/classes/javax/management/openmbean/CompositeType.java +++ b/src/java.management/share/classes/javax/management/openmbean/CompositeType.java @@ -60,9 +60,9 @@ public class CompositeType extends OpenType { /* As this instance is immutable, following three values need only * be calculated once. */ - private transient Integer myHashCode = null; - private transient String myToString = null; - private transient Set myNamesSet = null; + private transient Integer myHashCode = null; + private transient String myToString = null; + private transient Set myNamesSet = null; /* *** Constructor *** */ @@ -185,7 +185,6 @@ private static void checkForEmptyString(String[] arg, String argName) { * * @return true if an item of this name is present. */ - public boolean containsKey(@Nullable String itemName) { if (itemName == null) { diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java index 269941eb258..9dfb9fb96ce 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java @@ -104,8 +104,6 @@ public interface OpenMBeanAttributeInfo extends OpenMBeanParameterInfo { * * @return {@code true} if the specified object is equal to this {@code OpenMBeanAttributeInfo} instance. */ - - public boolean equals(@Nullable Object obj); /** diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java index 31d0a99313f..fcc4e83a8d3 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java @@ -973,8 +973,6 @@ static boolean isValue(OpenMBeanParameterInfo info, Object obj) { * @return {@code true} if the specified object is equal to this * {@code OpenMBeanAttributeInfoSupport} instance. */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof OpenMBeanAttributeInfo)) return false; diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java index bc171070be8..a1ac8fb4368 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java @@ -106,8 +106,6 @@ public interface OpenMBeanConstructorInfo { * * @return {@code true} if the specified object is equal to this {@code OpenMBeanConstructorInfo} instance. */ - - public boolean equals(@Nullable Object obj); /** diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java index 0cc9a170601..61212940579 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java @@ -178,8 +178,6 @@ public OpenMBeanConstructorInfoSupport(String name, * @return {@code true} if the specified object is equal to this * {@code OpenMBeanConstructorInfoSupport} instance. */ - - public boolean equals(@Nullable Object obj) { // if obj is null, return false diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java index 18138713fd6..43c52144e39 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java @@ -155,8 +155,6 @@ public interface OpenMBeanInfo { * * @return {@code true} if the specified object is equal to this {@code OpenMBeanInfo} instance. */ - - public boolean equals(@Nullable Object obj); /** diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java index 4a3640c837f..cd41c8d9738 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java @@ -149,8 +149,6 @@ public interface OpenMBeanOperationInfo { * * @return {@code true} if the specified object is equal to this {@code OpenMBeanOperationInfo} instance. */ - - public boolean equals(@Nullable Object obj); /** diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java index f7733bbe671..8c7c3e1621e 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java @@ -266,8 +266,6 @@ public OpenType getReturnOpenType() { * @return {@code true} if the specified object is equal to this * {@code OpenMBeanOperationInfoSupport} instance. */ - - public boolean equals(@Nullable Object obj) { // if obj is null, return false diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java index d624261c145..fdde99f31bb 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java @@ -181,8 +181,6 @@ public interface OpenMBeanParameterInfo { * * @return {@code true} if the specified object is equal to this {@code OpenMBeanParameterInfo} instance. */ - - public boolean equals(@Nullable Object obj); /** diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java index 513f8c7bead..a51b6289d8b 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java @@ -546,8 +546,6 @@ public boolean isValue(Object obj) { * @return {@code true} if the specified object is equal to this * {@code OpenMBeanParameterInfoSupport} instance. */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof OpenMBeanParameterInfo)) return false; diff --git a/src/java.management/share/classes/javax/management/openmbean/SimpleType.java b/src/java.management/share/classes/javax/management/openmbean/SimpleType.java index 48e755eb4ba..bfc05b876dd 100644 --- a/src/java.management/share/classes/javax/management/openmbean/SimpleType.java +++ b/src/java.management/share/classes/javax/management/openmbean/SimpleType.java @@ -230,8 +230,6 @@ public boolean isValue(Object obj) { * * @return true if the specified object is equal to this SimpleType instance. */ - - public boolean equals(@Nullable Object obj) { /* If it weren't for readReplace(), we could replace this method diff --git a/src/java.management/share/classes/javax/management/openmbean/TabularData.java b/src/java.management/share/classes/javax/management/openmbean/TabularData.java index ae42cc48b5a..353c07b380c 100644 --- a/src/java.management/share/classes/javax/management/openmbean/TabularData.java +++ b/src/java.management/share/classes/javax/management/openmbean/TabularData.java @@ -275,8 +275,6 @@ public interface TabularData /*extends Map*/ { * * @return {@code true} if the specified object is equal to this {@code TabularData} instance. */ - - public boolean equals(@Nullable Object obj); /** diff --git a/src/java.management/share/classes/javax/management/remote/JMXPrincipal.java b/src/java.management/share/classes/javax/management/remote/JMXPrincipal.java index 244ea3011fd..607ce7937c4 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXPrincipal.java +++ b/src/java.management/share/classes/javax/management/remote/JMXPrincipal.java @@ -103,8 +103,6 @@ public String toString() { * @return true if the specified Object is equal to this * JMXPrincipal. */ - - public boolean equals(@Nullable Object o) { if (o == null) return false; diff --git a/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java b/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java index d3126f546bf..cbb33a99bb7 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java +++ b/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java @@ -680,8 +680,6 @@ public String toString() { * @return true if this object is the same as the * obj argument; false otherwise. */ - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof JMXServiceURL)) return false; diff --git a/src/java.management/share/classes/sun/management/LazyCompositeData.java b/src/java.management/share/classes/sun/management/LazyCompositeData.java index 755ad796479..4d2cd7e008a 100644 --- a/src/java.management/share/classes/sun/management/LazyCompositeData.java +++ b/src/java.management/share/classes/sun/management/LazyCompositeData.java @@ -63,8 +63,6 @@ public boolean containsValue(Object value) { } @Override - - public boolean equals(@Nullable Object obj) { return compositeData().equals(obj); } diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapName.java b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapName.java index f8494c63fe6..2b25d27b696 100644 --- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapName.java +++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapName.java @@ -143,8 +143,6 @@ public String toString() { return unparsed; } - - public boolean equals(@Nullable Object obj) { return ((obj instanceof LdapName) && (compareTo(obj) == 0)); diff --git a/src/java.naming/share/classes/javax/naming/CompoundName.java b/src/java.naming/share/classes/javax/naming/CompoundName.java index 15347d7e302..9976aa7eac9 100644 --- a/src/java.naming/share/classes/javax/naming/CompoundName.java +++ b/src/java.naming/share/classes/javax/naming/CompoundName.java @@ -244,8 +244,6 @@ public String toString() { * @return true if obj is equal to this compound name, false otherwise. * @see #compareTo(java.lang.Object obj) */ - - public boolean equals(@Nullable Object obj) { // %%% check syntax too? return (obj instanceof CompoundName other) && diff --git a/src/java.naming/share/classes/javax/naming/directory/Attributes.java b/src/java.naming/share/classes/javax/naming/directory/Attributes.java index b44f55db196..d84d65dc43b 100644 --- a/src/java.naming/share/classes/javax/naming/directory/Attributes.java +++ b/src/java.naming/share/classes/javax/naming/directory/Attributes.java @@ -78,7 +78,6 @@ public interface Attributes extends Cloneable, java.io.Serializable { * attribute identifiers when retrieving or adding attributes. * @return true if case is ignored; false otherwise. */ - boolean isCaseIgnored(); /** @@ -86,7 +85,6 @@ public interface Attributes extends Cloneable, java.io.Serializable { * * @return The nonnegative number of attributes in this attribute set. */ - int size(); /** @@ -101,8 +99,7 @@ public interface Attributes extends Cloneable, java.io.Serializable { * @see #put * @see #remove */ - @Nullable - Attribute get(String attrID); + @Nullable Attribute get(String attrID); /** * Retrieves an enumeration of the attributes in the attribute set. @@ -114,7 +111,6 @@ public interface Attributes extends Cloneable, java.io.Serializable { * If attribute set has zero attributes, an empty enumeration * is returned. */ - NamingEnumeration getAll(); /** @@ -129,7 +125,6 @@ public interface Attributes extends Cloneable, java.io.Serializable { * If attribute set has zero attributes, an empty enumeration * is returned. */ - NamingEnumeration getIDs(); /** diff --git a/src/java.naming/share/classes/javax/naming/ldap/LdapName.java b/src/java.naming/share/classes/javax/naming/ldap/LdapName.java index f9d6ebb00b2..bb87d8a955f 100644 --- a/src/java.naming/share/classes/javax/naming/ldap/LdapName.java +++ b/src/java.naming/share/classes/javax/naming/ldap/LdapName.java @@ -653,8 +653,6 @@ public String toString() { * false otherwise. * @see #hashCode */ - - public boolean equals(@Nullable Object obj) { // check possible shortcuts if (obj == this) { diff --git a/src/java.naming/share/classes/javax/naming/ldap/Rdn.java b/src/java.naming/share/classes/javax/naming/ldap/Rdn.java index 6930b6e1e8b..815f67fb5bd 100644 --- a/src/java.naming/share/classes/javax/naming/ldap/Rdn.java +++ b/src/java.naming/share/classes/javax/naming/ldap/Rdn.java @@ -362,8 +362,6 @@ public int compareTo(Object obj) { * @return true if the specified object is equal to this Rdn. * @see #hashCode() */ - - public boolean equals(@Nullable Object obj) { if (obj == this) { return true; diff --git a/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java b/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java index ff076116cd3..1217f257387 100644 --- a/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java +++ b/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java @@ -691,7 +691,7 @@ public void putByteArray(String key, byte[] value) { * @throws IllegalArgumentException if key contains the null control * character, code point U+0000. */ - public byte @Nullable[] getByteArray(String key, byte @Nullable[] def) { + public byte @Nullable [] getByteArray(String key, byte @Nullable [] def) { byte[] result = def; String value = get(key, null); try { diff --git a/src/java.prefs/share/classes/java/util/prefs/Preferences.java b/src/java.prefs/share/classes/java/util/prefs/Preferences.java index cc58f90669c..871bc178aa8 100644 --- a/src/java.prefs/share/classes/java/util/prefs/Preferences.java +++ b/src/java.prefs/share/classes/java/util/prefs/Preferences.java @@ -216,7 +216,7 @@ * @since 1.4 */ @NullMarked -public abstract class Preferences { +public abstract class Preferences { private static final PreferencesFactory factory = factory(); @@ -842,7 +842,7 @@ protected Preferences() { * @see #get(String,String) * @see #putByteArray(String,byte[]) */ - public abstract byte @Nullable[] getByteArray(String key, byte @Nullable[] def); + public abstract byte @Nullable [] getByteArray(String key, byte @Nullable [] def); /** * Returns all of the keys that have an associated value in this diff --git a/src/java.rmi/share/classes/java/rmi/MarshalledObject.java b/src/java.rmi/share/classes/java/rmi/MarshalledObject.java index 52f445b186d..0bb3f3e0617 100644 --- a/src/java.rmi/share/classes/java/rmi/MarshalledObject.java +++ b/src/java.rmi/share/classes/java/rmi/MarshalledObject.java @@ -209,8 +209,6 @@ public int hashCode() { * serialized object; false otherwise * @since 1.2 */ - - public boolean equals(@Nullable Object obj) { if (obj == this) return true; diff --git a/src/java.rmi/share/classes/java/rmi/dgc/VMID.java b/src/java.rmi/share/classes/java/rmi/dgc/VMID.java index c05d2a10178..a6b382d6701 100644 --- a/src/java.rmi/share/classes/java/rmi/dgc/VMID.java +++ b/src/java.rmi/share/classes/java/rmi/dgc/VMID.java @@ -98,8 +98,6 @@ public int hashCode() { * Compare this VMID to another, and return true if they are the * same identifier. */ - - public boolean equals(@Nullable Object obj) { if (obj instanceof VMID) { VMID vmid = (VMID) obj; diff --git a/src/java.rmi/share/classes/java/rmi/server/ObjID.java b/src/java.rmi/share/classes/java/rmi/server/ObjID.java index 3536b3f6d4f..d68f4640462 100644 --- a/src/java.rmi/share/classes/java/rmi/server/ObjID.java +++ b/src/java.rmi/share/classes/java/rmi/server/ObjID.java @@ -217,8 +217,6 @@ public int hashCode() { * @return true if the given object is equivalent to * this one, and false otherwise */ - - public boolean equals(@Nullable Object obj) { if (obj instanceof ObjID) { ObjID id = (ObjID) obj; diff --git a/src/java.rmi/share/classes/java/rmi/server/UID.java b/src/java.rmi/share/classes/java/rmi/server/UID.java index 06b6f92f701..6dbb6a414ab 100644 --- a/src/java.rmi/share/classes/java/rmi/server/UID.java +++ b/src/java.rmi/share/classes/java/rmi/server/UID.java @@ -193,8 +193,6 @@ public int hashCode() { * @return true if the given object is equivalent to * this one, and false otherwise */ - - public boolean equals(@Nullable Object obj) { if (obj instanceof UID) { UID uid = (UID) obj; diff --git a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java index 5e725d06cc4..5e63ae70f59 100644 --- a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java +++ b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java @@ -183,8 +183,6 @@ public Socket createSocket(String host, int port) throws IOException { * as {@link #hashCode()}) if its instances are not all * functionally equivalent.

*/ - - public boolean equals(@Nullable Object obj) { if (obj == null) return false; if (obj == this) return true; diff --git a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIServerSocketFactory.java b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIServerSocketFactory.java index e4041c69d5d..ba7acd6d52a 100644 --- a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIServerSocketFactory.java +++ b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIServerSocketFactory.java @@ -288,8 +288,6 @@ public Socket accept() throws IOException { * {@link #hashCode()}) if it adds instance state that affects * equality.

*/ - - public boolean equals(@Nullable Object obj) { if (obj == null) return false; if (obj == this) return true; diff --git a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java index 7fd59bedd6d..47330aa2274 100644 --- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java +++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java @@ -171,8 +171,6 @@ public int hashCode() { * {@code KerberosCredMessage}, false otherwise. */ @Override - - public boolean equals(@Nullable Object other) { if (other == this) { return true; diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java b/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java index e3a4e2262f1..de168d31e39 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java @@ -204,8 +204,6 @@ public Object clone() { } @Override - - public boolean equals(@Nullable Object o) { if (this == o) { return true; diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java index 6cb1cdcdd6d..2104aa2bf9f 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java @@ -235,8 +235,6 @@ public boolean greaterThan(KerberosTime time) { microSeconds > time.microSeconds; } - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.smartcardio/share/classes/javax/smartcardio/ATR.java b/src/java.smartcardio/share/classes/javax/smartcardio/ATR.java index 2be5db6a543..6b3a6d652f2 100644 --- a/src/java.smartcardio/share/classes/javax/smartcardio/ATR.java +++ b/src/java.smartcardio/share/classes/javax/smartcardio/ATR.java @@ -139,8 +139,6 @@ public String toString() { * @param obj the object to be compared for equality with this ATR * @return true if the specified object is equal to this ATR */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.smartcardio/share/classes/javax/smartcardio/CardPermission.java b/src/java.smartcardio/share/classes/javax/smartcardio/CardPermission.java index f2c36ee9886..7cc82b11017 100644 --- a/src/java.smartcardio/share/classes/javax/smartcardio/CardPermission.java +++ b/src/java.smartcardio/share/classes/javax/smartcardio/CardPermission.java @@ -262,8 +262,6 @@ public boolean implies(Permission permission) { * @return true if and only if the specified object is equal to this * CardPermission */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.smartcardio/share/classes/javax/smartcardio/CommandAPDU.java b/src/java.smartcardio/share/classes/javax/smartcardio/CommandAPDU.java index 4a545c57872..15dff32c773 100644 --- a/src/java.smartcardio/share/classes/javax/smartcardio/CommandAPDU.java +++ b/src/java.smartcardio/share/classes/javax/smartcardio/CommandAPDU.java @@ -578,8 +578,6 @@ public String toString() { * @param obj the object to be compared for equality with this command APDU * @return true if the specified object is equal to this command APDU */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.smartcardio/share/classes/javax/smartcardio/ResponseAPDU.java b/src/java.smartcardio/share/classes/javax/smartcardio/ResponseAPDU.java index 211d0315d3c..9cbcf2b0eea 100644 --- a/src/java.smartcardio/share/classes/javax/smartcardio/ResponseAPDU.java +++ b/src/java.smartcardio/share/classes/javax/smartcardio/ResponseAPDU.java @@ -158,8 +158,6 @@ public String toString() { * @param obj the object to be compared for equality with this response APDU * @return true if the specified object is equal to this response APDU */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialArray.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialArray.java index 932d5b4ffa6..45b89dc8165 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialArray.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialArray.java @@ -562,8 +562,6 @@ public ResultSet getResultSet(long index, int count, * equivalent to this SerialArray, {@code false} otherwise * */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialBlob.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialBlob.java index f058d6e24af..db0d4c5fd4f 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialBlob.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialBlob.java @@ -515,8 +515,6 @@ public void free() throws SQLException { * equivalent to this SerialBlob, {@code false} otherwise * */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialClob.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialClob.java index cc5c1ee1e84..f71662be827 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialClob.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialClob.java @@ -606,8 +606,6 @@ public void free() throws SQLException { * equivalent to this SerialClob, {@code false} otherwise * */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialDatalink.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialDatalink.java index d7e51d49beb..ee2db6fa999 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialDatalink.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialDatalink.java @@ -124,8 +124,6 @@ public URL getDatalink() throws SerialException { * equivalent to this SerialDatalink, {@code false} otherwise * */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java index bfc6bff08ff..cb0380b6e51 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java @@ -159,8 +159,6 @@ public Field[] getFields() throws SerialException { * equivalent to this SerialJavaObject, {@code false} otherwise * */ - - public boolean equals(@Nullable Object o) { if (this == o) { return true; diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialRef.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialRef.java index 2322f04d8a5..5bf86f82d7e 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialRef.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialRef.java @@ -186,8 +186,6 @@ public void setObject(Object obj) throws SerialException { * equivalent to this SerialRef, {@code false} otherwise * */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialStruct.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialStruct.java index ca55e3e2bf0..db4206061c2 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialStruct.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialStruct.java @@ -273,8 +273,6 @@ private void mapToSerial(Map> map) throws SerialException { * equivalent to this SerialStruct, {@code false} otherwise * */ - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.sql/share/classes/java/sql/CallableStatement.java b/src/java.sql/share/classes/java/sql/CallableStatement.java index 624987c1740..a64d589a0fb 100644 --- a/src/java.sql/share/classes/java/sql/CallableStatement.java +++ b/src/java.sql/share/classes/java/sql/CallableStatement.java @@ -971,7 +971,7 @@ void registerOutParameter (String parameterName, int sqlType, String typeName) * @see #getBytes * @since 1.4 */ - void setBytes(String parameterName, byte @Nullable [] x) throws SQLException; + void setBytes(String parameterName, byte x @Nullable []) throws SQLException; /** * Sets the designated parameter to the given {@code java.sql.Date} value diff --git a/src/java.sql/share/classes/java/sql/DriverManager.java b/src/java.sql/share/classes/java/sql/DriverManager.java index 37a704068d2..b4ee6f134e3 100644 --- a/src/java.sql/share/classes/java/sql/DriverManager.java +++ b/src/java.sql/share/classes/java/sql/DriverManager.java @@ -81,8 +81,7 @@ * @see Connection * @since 1.1 */ - -public class DriverManager { +public class DriverManager { // List of registered JDBC drivers @@ -660,8 +659,6 @@ class DriverInfo { } @Override - - public boolean equals(@Nullable Object other) { return (other instanceof DriverInfo) && this.driver == ((DriverInfo) other).driver; diff --git a/src/java.sql/share/classes/java/sql/ResultSet.java b/src/java.sql/share/classes/java/sql/ResultSet.java index c5ea06764b5..13b6ed56840 100644 --- a/src/java.sql/share/classes/java/sql/ResultSet.java +++ b/src/java.sql/share/classes/java/sql/ResultSet.java @@ -2096,7 +2096,7 @@ void updateObject(int columnIndex, @Nullable Object x, int scaleOrLength) * this method * @since 1.2 */ - void updateBytes(String columnLabel, byte @Nullable [] x) throws SQLException; + void updateBytes(String columnLabel, byte x @Nullable []) throws SQLException; /** * Updates the designated column with a {@code java.sql.Date} value. diff --git a/src/java.sql/share/classes/java/sql/SQLType.java b/src/java.sql/share/classes/java/sql/SQLType.java index 33c917857b5..9ea5707ff5b 100644 --- a/src/java.sql/share/classes/java/sql/SQLType.java +++ b/src/java.sql/share/classes/java/sql/SQLType.java @@ -25,7 +25,6 @@ package java.sql; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * An object that is used to identify a generic SQL type, called a JDBC type or diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java index fcfab4306a7..e4d7695f80c 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java @@ -120,8 +120,6 @@ public Data canonicalize(Data data, XMLCryptoContext xc, OutputStream os) } @Override - - public boolean equals(@Nullable Object o) { if (this == o) { return true; diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java index f70a2e42b5f..e9a3b2219fc 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java @@ -223,8 +223,6 @@ private void marshal(Node parent, Element kiElem, Node nextSibling, } @Override - - public boolean equals(@Nullable Object o) { if (this == o) { return true; diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java index 4c1b65069d5..2dd473b4706 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java @@ -295,8 +295,6 @@ public XMLStructure dereferenceAsXMLStructure(XMLCryptoContext context) } @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java index c87979eb81e..be7631afce4 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java @@ -177,8 +177,6 @@ public Data transform(Data data, XMLCryptoContext xc, OutputStream os) } @Override - - public boolean equals(@Nullable Object o) { if (this == o) { return true; diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java index ab67c21964b..a137d2e6491 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java @@ -257,8 +257,6 @@ private ByteArrayInputStream unmarshalBase64Binary(Element elem) } @Override - - public boolean equals(@Nullable Object o) { if (this == o) { return true; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectType.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectType.java index ea492c0a8f1..455e45b4405 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectType.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectType.java @@ -74,8 +74,6 @@ public int hashCode() { return java.lang.Object.class.hashCode(); } - - public boolean equals(@Nullable Object obj) { return (obj instanceof ObjectType); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLContentSpec.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLContentSpec.java index de52384c037..d3089ac5794 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLContentSpec.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLContentSpec.java @@ -249,8 +249,6 @@ public int hashCode() { } /** Returns true if the two objects are equal. */ - - public boolean equals(@Nullable Object object) { if (object != null && object instanceof XMLContentSpec) { XMLContentSpec contentSpec = (XMLContentSpec)object; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDDescription.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDDescription.java index ae8ff7dd952..7010e62788d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDDescription.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDDescription.java @@ -108,8 +108,6 @@ public void setPossibleRoots(List possibleRoots) { * @param desc The description of the grammar to be compared with * @return True if they are equal, else false */ - - public boolean equals(@Nullable Object desc) { if (!(desc instanceof XMLGrammarDescription)) return false; if (!getGrammarType().equals(((XMLGrammarDescription)desc).getGrammarType())) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/models/CMStateSet.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/models/CMStateSet.java index 5056bd37b4d..f5136be74d6 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/models/CMStateSet.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/models/CMStateSet.java @@ -283,8 +283,6 @@ public final void zeroBits() int fBits2; byte[] fByteArray; /* Optimization(Jan, 2001) */ - - public boolean equals(@Nullable Object o) { if (!(o instanceof CMStateSet)) return false; return isSameSet((CMStateSet)o); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java index 65c74b148ce..c5944b314f5 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java @@ -2350,8 +2350,6 @@ public String getOptions() { /** * Return true if patterns are the same and the options are equivalent. */ - - public boolean equals(@Nullable Object obj) { if (obj == null) return false; if (!(obj instanceof RegularExpression)) diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java index 015e8b60ebc..10457609826 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java @@ -201,8 +201,6 @@ public boolean isExternal() { * @param descObj The description of the grammar to be compared with * @return True if they are equal, else false */ - - public boolean equals(@Nullable Object descObj) { if(!(descObj instanceof XMLSchemaDescription)) return false; XMLSchemaDescription desc = (XMLSchemaDescription)descObj; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSElementDecl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSElementDecl.java index d93f93c5c01..aeddfab0e09 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSElementDecl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSElementDecl.java @@ -169,8 +169,6 @@ public int hashCode() { /** * whether two decls are the same */ - - public boolean equals(@Nullable Object o) { return o == this; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/ShortListImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/ShortListImpl.java index 3755d1c5fb2..2d4f872eaaf 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/ShortListImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/ShortListImpl.java @@ -90,8 +90,6 @@ public short item(int index) throws XSException { return fArray[index]; } - - public boolean equals(@Nullable Object obj) { if (obj == null || !(obj instanceof ShortList)) { return false; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/QName.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/QName.java index 7b22a92a4cc..583a7ee6510 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/QName.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/QName.java @@ -150,8 +150,6 @@ public int hashCode() { } // hashCode():int /** Returns true if the two objects are equal. */ - - public boolean equals(@Nullable Object object) { if (object == this) { return true; diff --git a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java index f89aa960566..57ceb11d574 100644 --- a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java +++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java @@ -2243,8 +2243,6 @@ public int hashCode() { * This is required to satisfy the contract for hashCode. */ @Override - - public boolean equals(@Nullable Object obj) { return (this == obj); } diff --git a/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java b/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java index ff286eb09df..896d66c9a42 100644 --- a/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java +++ b/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java @@ -143,7 +143,6 @@ public interface NamespaceContext { * @throws IllegalArgumentException When {@code prefix} is * {@code null} */ - String getNamespaceURI(String prefix); /** @@ -205,8 +204,7 @@ public interface NamespaceContext { * @throws IllegalArgumentException When {@code namespaceURI} is * {@code null} */ - @Nullable - String getPrefix(String namespaceURI); + @Nullable String getPrefix(String namespaceURI); /** * Get all prefixes bound to a Namespace URI in the current @@ -274,6 +272,5 @@ public interface NamespaceContext { * @throws IllegalArgumentException When {@code namespaceURI} is * {@code null} */ - Iterator getPrefixes(String namespaceURI); } diff --git a/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilder.java b/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilder.java index 2ec52ea1004..45862c7bd16 100644 --- a/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilder.java +++ b/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilder.java @@ -88,8 +88,6 @@ protected DocumentBuilder () { * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public void reset() { // implementors should override this method @@ -317,8 +315,6 @@ public boolean getCanonicalization() { * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public @Nullable Schema getSchema() { throw new UnsupportedOperationException( "This parser does not support specification \"" @@ -345,8 +341,6 @@ public boolean getCanonicalization() { * * @see DocumentBuilderFactory#setXIncludeAware(boolean) */ - - @SuppressWarnings({"nullness"}) public boolean isXIncludeAware() { throw new UnsupportedOperationException( "This parser does not support specification \"" diff --git a/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java b/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java index f52f7300332..cb19a035a19 100644 --- a/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java +++ b/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java @@ -540,8 +540,6 @@ public abstract boolean getFeature(String name) * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public @Nullable Schema getSchema() { throw new UnsupportedOperationException( "This parser does not support specification \"" @@ -609,8 +607,6 @@ public abstract boolean getFeature(String name) * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public void setSchema(@Nullable Schema schema) { throw new UnsupportedOperationException( "This parser does not support specification \"" @@ -658,8 +654,6 @@ public void setXIncludeAware(final boolean state) { * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public boolean isXIncludeAware() { throw new UnsupportedOperationException( "This parser does not support specification \"" diff --git a/src/java.xml/share/classes/javax/xml/parsers/ParserConfigurationException.java b/src/java.xml/share/classes/javax/xml/parsers/ParserConfigurationException.java index c00b39d711a..3c770135a5f 100644 --- a/src/java.xml/share/classes/javax/xml/parsers/ParserConfigurationException.java +++ b/src/java.xml/share/classes/javax/xml/parsers/ParserConfigurationException.java @@ -26,7 +26,6 @@ package javax.xml.parsers; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * Indicates a serious configuration error. diff --git a/src/java.xml/share/classes/javax/xml/parsers/SAXParser.java b/src/java.xml/share/classes/javax/xml/parsers/SAXParser.java index dc15d3fc0c3..2d2a91641b3 100644 --- a/src/java.xml/share/classes/javax/xml/parsers/SAXParser.java +++ b/src/java.xml/share/classes/javax/xml/parsers/SAXParser.java @@ -109,8 +109,6 @@ protected SAXParser () { * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public void reset() { // implementors should override this method @@ -526,8 +524,6 @@ public boolean getCanonicalization() { * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public @Nullable Schema getSchema() { throw new UnsupportedOperationException( "This parser does not support specification \"" @@ -553,8 +549,6 @@ public boolean getCanonicalization() { * * @see SAXParserFactory#setXIncludeAware(boolean) */ - - @SuppressWarnings({"nullness"}) public boolean isXIncludeAware() { throw new UnsupportedOperationException( "This parser does not support specification \"" diff --git a/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java b/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java index 5c29a865e0d..62ebe08a5c3 100644 --- a/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java +++ b/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java @@ -42,7 +42,6 @@ * * @since 1.4 */ - public abstract class SAXParserFactory { private static final String DEFAULT_IMPL = "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"; @@ -389,8 +388,6 @@ public abstract boolean getFeature(String name) * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public @Nullable Schema getSchema() { throw new UnsupportedOperationException( "This parser does not support specification \"" @@ -447,8 +444,6 @@ public abstract boolean getFeature(String name) * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public void setSchema(@Nullable Schema schema) { throw new UnsupportedOperationException( "This parser does not support specification \"" @@ -494,8 +489,6 @@ public void setXIncludeAware(final boolean state) { * * @since 1.5 */ - - @SuppressWarnings({"nullness"}) public boolean isXIncludeAware() { throw new UnsupportedOperationException( "This parser does not support specification \"" diff --git a/src/java.xml/share/classes/javax/xml/stream/XMLResolver.java b/src/java.xml/share/classes/javax/xml/stream/XMLResolver.java index a27a8966cc3..7d85659045d 100644 --- a/src/java.xml/share/classes/javax/xml/stream/XMLResolver.java +++ b/src/java.xml/share/classes/javax/xml/stream/XMLResolver.java @@ -53,7 +53,6 @@ public interface XMLResolver { * @return The resource requested or null. * @throws XMLStreamException if there was a failure attempting to resolve the resource. */ - public @Nullable Object resolveEntity(@Nullable String publicID, String systemID, @Nullable String baseURI, diff --git a/src/java.xml/share/classes/javax/xml/stream/XMLStreamException.java b/src/java.xml/share/classes/javax/xml/stream/XMLStreamException.java index 28de8af0b02..2819111c571 100644 --- a/src/java.xml/share/classes/javax/xml/stream/XMLStreamException.java +++ b/src/java.xml/share/classes/javax/xml/stream/XMLStreamException.java @@ -59,7 +59,6 @@ public class XMLStreamException extends Exception { /** * Default constructor */ - public XMLStreamException(){ super(); } @@ -69,7 +68,6 @@ public XMLStreamException(){ * * @param msg the message to report */ - public XMLStreamException(@Nullable String msg) { super(msg); } @@ -79,7 +77,6 @@ public XMLStreamException(@Nullable String msg) { * * @param th a nested exception */ - public XMLStreamException(@Nullable Throwable th) { super(th); nested = th; @@ -91,7 +88,6 @@ public XMLStreamException(@Nullable Throwable th) { * @param msg the message to report * @param th a nested exception */ - public XMLStreamException(@Nullable String msg, @Nullable Throwable th) { super(msg, th); nested = th; @@ -104,7 +100,6 @@ public XMLStreamException(@Nullable String msg, @Nullable Throwable th) { * @param location the location of the error * @param th a nested exception */ - public XMLStreamException(@Nullable String msg, Location location, @Nullable Throwable th) { super("ParseError at [row,col]:["+location.getLineNumber()+","+ location.getColumnNumber()+"]\n"+ @@ -119,7 +114,6 @@ public XMLStreamException(@Nullable String msg, Location location, @Nullable Thr * @param msg the message to report * @param location the location of the error */ - public XMLStreamException(@Nullable String msg, Location location) { super("ParseError at [row,col]:["+location.getLineNumber()+","+ @@ -134,7 +128,6 @@ public XMLStreamException(@Nullable String msg, * * @return Nested exception */ - public @Nullable Throwable getNestedException() { return nested; } @@ -144,7 +137,6 @@ public XMLStreamException(@Nullable String msg, * * @return the location of the exception, may be null if none is available */ - public @Nullable Location getLocation() { return location; } diff --git a/src/java.xml/share/classes/javax/xml/transform/URIResolver.java b/src/java.xml/share/classes/javax/xml/transform/URIResolver.java index 9c99afaa92b..845ddedefb3 100644 --- a/src/java.xml/share/classes/javax/xml/transform/URIResolver.java +++ b/src/java.xml/share/classes/javax/xml/transform/URIResolver.java @@ -51,7 +51,6 @@ public interface URIResolver { * @throws TransformerException if an error occurs when trying to * resolve the URI. */ - public @Nullable Source resolve(String href, @Nullable String base) throws TransformerException; } diff --git a/src/java.xml/share/classes/javax/xml/xpath/XPathVariableResolver.java b/src/java.xml/share/classes/javax/xml/xpath/XPathVariableResolver.java index 271b64212fb..16ee3638c5b 100644 --- a/src/java.xml/share/classes/javax/xml/xpath/XPathVariableResolver.java +++ b/src/java.xml/share/classes/javax/xml/xpath/XPathVariableResolver.java @@ -58,6 +58,5 @@ public interface XPathVariableResolver { * * @throws NullPointerException If variableName is null. */ - public @Nullable Object resolveVariable(QName variableName); } diff --git a/src/java.xml/share/classes/org/w3c/dom/Attr.java b/src/java.xml/share/classes/org/w3c/dom/Attr.java index 6c812c5b1ab..8dd379e149b 100644 --- a/src/java.xml/share/classes/org/w3c/dom/Attr.java +++ b/src/java.xml/share/classes/org/w3c/dom/Attr.java @@ -197,7 +197,6 @@ public interface Attr extends Node { * Returns the name of this attribute. If Node.localName is * different from null, this attribute is a qualified name. */ - public String getName(); /** @@ -210,7 +209,6 @@ public interface Attr extends Node { * use Document.normalizeDocument() to guarantee this * information is up-to-date. */ - public boolean getSpecified(); /** @@ -227,7 +225,6 @@ public interface Attr extends Node { * mutation; in such case, the value on retrieval may differ from the * value on setting. */ - public String getValue(); /** * On retrieval, the value of the attribute is returned as a string. @@ -253,7 +250,6 @@ public void setValue(String value) * null if this attribute is not in use. * @since 1.4, DOM Level 2 */ - public @Nullable Element getOwnerElement(); /** @@ -264,7 +260,6 @@ public void setValue(String value) * may not be reliable if the node was moved. * @since 1.5, DOM Level 3 */ - public TypeInfo getSchemaTypeInfo(); /** @@ -313,7 +308,6 @@ public void setValue(String value) * isId will always return true. * @since 1.5, DOM Level 3 */ - public boolean isId(); } diff --git a/src/java.xml/share/classes/org/w3c/dom/CharacterData.java b/src/java.xml/share/classes/org/w3c/dom/CharacterData.java index 91de83ee6f8..0ab3daa8be5 100644 --- a/src/java.xml/share/classes/org/w3c/dom/CharacterData.java +++ b/src/java.xml/share/classes/org/w3c/dom/CharacterData.java @@ -42,7 +42,6 @@ package org.w3c.dom; import org.jspecify.annotations.NullMarked; -import org.jspecify.annotations.Nullable; /** * The CharacterData interface extends Node with a set of @@ -75,7 +74,6 @@ public interface CharacterData extends Node { * fit in a DOMString variable on the implementation * platform. */ - public String getData() throws DOMException; /** @@ -97,7 +95,6 @@ public void setData(String data) * and the substringData method below. This may have the * value zero, i.e., CharacterData nodes may be empty. */ - public int getLength(); /** @@ -115,7 +112,6 @@ public void setData(String data) *
DOMSTRING_SIZE_ERR: Raised if the specified range of text does * not fit into a DOMString. */ - public String substringData(int offset, int count) throws DOMException; diff --git a/src/java.xml/share/classes/org/w3c/dom/Document.java b/src/java.xml/share/classes/org/w3c/dom/Document.java index 0f2ea33cf0f..45d5a69e103 100644 --- a/src/java.xml/share/classes/org/w3c/dom/Document.java +++ b/src/java.xml/share/classes/org/w3c/dom/Document.java @@ -81,21 +81,18 @@ public interface Document extends Node { * * @since 1.4, DOM Level 3 */ - public @Nullable DocumentType getDoctype(); /** * The DOMImplementation object that handles this document. A * DOM application may use objects from multiple implementations. */ - public DOMImplementation getImplementation(); /** * This is a convenience attribute that allows direct access to the child * node that is the document element of the document. */ - public Element getDocumentElement(); /** @@ -235,7 +232,6 @@ public EntityReference createEntityReference(String name) * @return A new NodeList object containing all the matched * Elements. */ - public NodeList getElementsByTagName(String tagname); /** @@ -507,7 +503,6 @@ public Attr createAttributeNS(@Nullable String namespaceURI, * Elements. * @since 1.4, DOM Level 2 */ - public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, String localName); @@ -524,7 +519,6 @@ public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, * @return The matching element or null if there is none. * @since 1.4, DOM Level 2 */ - public @Nullable Element getElementById(String elementId); /** @@ -533,7 +527,6 @@ public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, * as when the Document was created in memory. * @since 1.5, DOM Level 3 */ - public @Nullable String getInputEncoding(); /** @@ -542,7 +535,6 @@ public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, * Document was created in memory. * @since 1.5, DOM Level 3 */ - public @Nullable String getXmlEncoding(); /** @@ -555,7 +547,6 @@ public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, * constraint for standalone document declaration as defined in [XML 1.0]. * @since 1.5, DOM Level 3 */ - public boolean getXmlStandalone(); /** * An attribute specifying, as part of the XML declaration, whether this document is standalone. This is false when @@ -597,7 +588,6 @@ public void setXmlStandalone(boolean xmlStandalone) * number when using Document.xmlVersion. * @since 1.5, DOM Level 3 */ - public @Nullable String getXmlVersion(); /** * An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if @@ -640,7 +630,6 @@ public void setXmlVersion(String xmlVersion) * true by default. * @since 1.5, DOM Level 3 */ - public boolean getStrictErrorChecking(); /** * An attribute specifying whether error checking is enforced or not. When @@ -667,7 +656,6 @@ public void setXmlVersion(String xmlVersion) * this attribute when computing Node.baseURI. * @since 1.5, DOM Level 3 */ - public @Nullable String getDocumentURI(); /** * The location of the document or null if undefined or if @@ -761,7 +749,6 @@ public void setXmlVersion(String xmlVersion) * is invoked. * @since 1.5, DOM Level 3 */ - public DOMConfiguration getDomConfig(); /** diff --git a/src/java.xml/share/classes/org/w3c/dom/Element.java b/src/java.xml/share/classes/org/w3c/dom/Element.java index 67fddf77f17..36755e03c7e 100644 --- a/src/java.xml/share/classes/org/w3c/dom/Element.java +++ b/src/java.xml/share/classes/org/w3c/dom/Element.java @@ -77,7 +77,6 @@ public interface Element extends Node { * the tagName of an HTML element in the canonical * uppercase form, regardless of the case in the source HTML document. */ - public String getTagName(); /** @@ -86,7 +85,6 @@ public interface Element extends Node { * @return The Attr value as a string, or the empty string * if that attribute does not have a specified or default value. */ - public String getAttribute(String name); /** @@ -143,7 +141,6 @@ public void removeAttribute(String name) * nodeName) or null if there is no such * attribute. */ - public @Nullable Attr getAttributeNode(String name); /** @@ -196,7 +193,6 @@ public Attr removeAttributeNode(Attr oldAttr) * matches all tags. * @return A list of matching Element nodes. */ - public NodeList getElementsByTagName(String name); /** @@ -215,7 +211,6 @@ public Attr removeAttributeNode(Attr oldAttr) * through the Document does not support XML Namespaces (such as [HTML 4.01]). * @since 1.4, DOM Level 2 */ - public String getAttributeNS(@Nullable String namespaceURI, String localName) throws DOMException; @@ -312,7 +307,6 @@ public void removeAttributeNS(@Nullable String namespaceURI, * through the Document does not support XML Namespaces (such as [HTML 4.01]). * @since 1.4, DOM Level 2 */ - public @Nullable Attr getAttributeNodeNS(@Nullable String namespaceURI, String localName) throws DOMException; @@ -362,7 +356,6 @@ public void removeAttributeNS(@Nullable String namespaceURI, * through the Document does not support XML Namespaces (such as [HTML 4.01]). * @since 1.4, DOM Level 2 */ - public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, String localName) throws DOMException; @@ -377,7 +370,6 @@ public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, * otherwise. * @since 1.4, DOM Level 2 */ - public boolean hasAttribute(String name); /** @@ -399,7 +391,6 @@ public NodeList getElementsByTagNameNS(@Nullable String namespaceURI, * through the Document does not support XML Namespaces (such as [HTML 4.01]). * @since 1.4, DOM Level 2 */ - public boolean hasAttributeNS(@Nullable String namespaceURI, String localName) throws DOMException; @@ -408,7 +399,6 @@ public boolean hasAttributeNS(@Nullable String namespaceURI, * The type information associated with this element. * @since 1.5, DOM Level 3 */ - public TypeInfo getSchemaTypeInfo(); /** diff --git a/src/java.xml/share/classes/org/w3c/dom/NamedNodeMap.java b/src/java.xml/share/classes/org/w3c/dom/NamedNodeMap.java index dcd6b137672..e9df692a4f4 100644 --- a/src/java.xml/share/classes/org/w3c/dom/NamedNodeMap.java +++ b/src/java.xml/share/classes/org/w3c/dom/NamedNodeMap.java @@ -67,7 +67,6 @@ public interface NamedNodeMap { * nodeName, or null if it does not identify * any node in this map. */ - public @Nullable Node getNamedItem(String name); /** @@ -126,14 +125,12 @@ public Node removeNamedItem(String name) * @return The node at the indexth position in the map, or * null if that is not a valid index. */ - public @Nullable Node item(int index); /** * The number of nodes in this map. The range of valid child node indices * is 0 to length-1 inclusive. */ - public int getLength(); /** @@ -152,7 +149,6 @@ public Node removeNamedItem(String name) * Document does not support XML Namespaces (such as [HTML 4.01]). * @since 1.4, DOM Level 2 */ - public @Nullable Node getNamedItemNS(@Nullable String namespaceURI, String localName) throws DOMException; diff --git a/src/java.xml/share/classes/org/w3c/dom/Node.java b/src/java.xml/share/classes/org/w3c/dom/Node.java index 0f35697b254..6b326df5176 100644 --- a/src/java.xml/share/classes/org/w3c/dom/Node.java +++ b/src/java.xml/share/classes/org/w3c/dom/Node.java @@ -227,7 +227,6 @@ public interface Node { /** * The name of this node, depending on its type; see the table above. */ - public String getNodeName(); /** @@ -239,7 +238,6 @@ public interface Node { * fit in a DOMString variable on the implementation * platform. */ - public @Nullable String getNodeValue() throws DOMException; /** @@ -256,7 +254,6 @@ public void setNodeValue(@Nullable String nodeValue) /** * A code representing the type of the underlying object, as defined above. */ - public short getNodeType(); /** @@ -267,7 +264,6 @@ public void setNodeValue(@Nullable String nodeValue) * tree, or if it has been removed from the tree, this is * null. */ - public @Nullable Node getParentNode(); /** @@ -275,42 +271,36 @@ public void setNodeValue(@Nullable String nodeValue) * there are no children, this is a NodeList containing no * nodes. */ - public NodeList getChildNodes(); /** * The first child of this node. If there is no such node, this returns * null. */ - public @Nullable Node getFirstChild(); /** * The last child of this node. If there is no such node, this returns * null. */ - public @Nullable Node getLastChild(); /** * The node immediately preceding this node. If there is no such node, * this returns null. */ - public @Nullable Node getPreviousSibling(); /** * The node immediately following this node. If there is no such node, * this returns null. */ - public @Nullable Node getNextSibling(); /** * A NamedNodeMap containing the attributes of this node (if * it is an Element) or null otherwise. */ - public @Nullable NamedNodeMap getAttributes(); /** @@ -322,7 +312,6 @@ public void setNodeValue(@Nullable String nodeValue) * * @since 1.4, DOM Level 2 */ - public @Nullable Document getOwnerDocument(); /** @@ -454,7 +443,6 @@ public Node appendChild(Node newChild) * @return Returns true if this node has any children, * false otherwise. */ - public boolean hasChildNodes(); /** @@ -528,7 +516,6 @@ public Node appendChild(Node newChild) * * @since 1.4, DOM Level 2 */ - public boolean isSupported(String feature, @Nullable String version); @@ -549,7 +536,6 @@ public boolean isSupported(String feature, * * @since 1.4, DOM Level 2 */ - public @Nullable String getNamespaceURI(); /** @@ -574,7 +560,6 @@ public boolean isSupported(String feature, * * @since 1.4, DOM Level 2 */ - public @Nullable String getPrefix(); /** * The namespace prefix of this node, or null if it is @@ -624,7 +609,6 @@ public void setPrefix(@Nullable String prefix) * * @since 1.4, DOM Level 2 */ - public @Nullable String getLocalName(); /** @@ -634,7 +618,6 @@ public void setPrefix(@Nullable String prefix) * * @since 1.4, DOM Level 2 */ - public boolean hasAttributes(); /** @@ -649,7 +632,6 @@ public void setPrefix(@Nullable String prefix) * * @since 1.5, DOM Level 3 */ - public @Nullable String getBaseURI(); // DocumentPosition @@ -697,7 +679,6 @@ public void setPrefix(@Nullable String prefix) * * @since 1.5, DOM Level 3 */ - public short compareDocumentPosition(Node other) throws DOMException; @@ -754,7 +735,6 @@ public short compareDocumentPosition(Node other) * * @since 1.5, DOM Level 3 */ - public @Nullable String getTextContent() throws DOMException; /** @@ -826,7 +806,6 @@ public void setTextContent(@Nullable String textContent) * * @since 1.5, DOM Level 3 */ - public boolean isSameNode(Node other); /** @@ -842,7 +821,6 @@ public void setTextContent(@Nullable String textContent) * * @since 1.5, DOM Level 3 */ - public @Nullable String lookupPrefix(@Nullable String namespaceURI); /** @@ -855,7 +833,6 @@ public void setTextContent(@Nullable String textContent) * * @since 1.5, DOM Level 3 */ - public boolean isDefaultNamespace(@Nullable String namespaceURI); /** @@ -870,7 +847,6 @@ public void setTextContent(@Nullable String textContent) * * @since 1.5, DOM Level 3 */ - public @Nullable String lookupNamespaceURI(@Nullable String prefix); /** @@ -937,7 +913,6 @@ public void setTextContent(@Nullable String textContent) * * @since 1.5, DOM Level 3 */ - public boolean isEqualNode(Node arg); /** @@ -963,7 +938,6 @@ public void setTextContent(@Nullable String textContent) * * @since 1.5, DOM Level 3 */ - public @Nullable Object getFeature(String feature, @Nullable String version); @@ -995,7 +969,6 @@ public void setTextContent(@Nullable String textContent) * * @since 1.5, DOM Level 3 */ - public @Nullable Object getUserData(String key); } diff --git a/src/java.xml/share/classes/org/w3c/dom/NodeList.java b/src/java.xml/share/classes/org/w3c/dom/NodeList.java index d3a9d19a630..ccc6b76ff32 100644 --- a/src/java.xml/share/classes/org/w3c/dom/NodeList.java +++ b/src/java.xml/share/classes/org/w3c/dom/NodeList.java @@ -65,14 +65,12 @@ public interface NodeList { * NodeList, or null if that is not a valid * index. */ - public @Nullable Node item(int index); /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. */ - public int getLength(); } diff --git a/src/java.xml/share/classes/org/w3c/dom/Text.java b/src/java.xml/share/classes/org/w3c/dom/Text.java index a84610b30c9..11d375c21db 100644 --- a/src/java.xml/share/classes/org/w3c/dom/Text.java +++ b/src/java.xml/share/classes/org/w3c/dom/Text.java @@ -101,7 +101,6 @@ public Text splitText(int offset) * Document.normalizeDocument(). * @since 1.5, DOM Level 3 */ - public boolean isElementContentWhitespace(); /** @@ -130,7 +129,6 @@ public Text splitText(int offset) * * @since 1.5, DOM Level 3 */ - public String getWholeText(); /** diff --git a/src/java.xml/share/classes/org/w3c/dom/ls/LSInput.java b/src/java.xml/share/classes/org/w3c/dom/ls/LSInput.java index ed7b1abd6c7..7c5f77bf880 100644 --- a/src/java.xml/share/classes/org/w3c/dom/ls/LSInput.java +++ b/src/java.xml/share/classes/org/w3c/dom/ls/LSInput.java @@ -97,7 +97,6 @@ public interface LSInput { * using character streams. If an XML declaration is present, the value * of the encoding attribute will be ignored. */ - public java.io.@Nullable Reader getCharacterStream(); /** * An attribute of a language and binding dependent type that represents @@ -116,7 +115,6 @@ public interface LSInput { * this way will override any encoding specified in an XML declaration * in the data. */ - public java.io.@Nullable InputStream getByteStream(); /** * An attribute of a language and binding dependent type that represents @@ -135,7 +133,6 @@ public interface LSInput { * stringData. If an XML declaration is present, the value * of the encoding attribute will be ignored. */ - public @Nullable String getStringData(); /** * String data to parse. If provided, this will always be treated as a @@ -164,7 +161,6 @@ public interface LSInput { * baseURI as the base, if that fails, the behavior is * implementation dependent. */ - public @Nullable String getSystemId(); /** * The system identifier, a URI reference [IETF RFC 2396], for this @@ -193,7 +189,6 @@ public interface LSInput { * may also be reported as part of the location information when errors * are reported. */ - public @Nullable String getPublicId(); /** * The public identifier for this input source. This may be mapped to an @@ -210,7 +205,6 @@ public interface LSInput { *
If, when used, the base URI is itself a relative URI, an empty * string, or null, the behavior is implementation dependent. */ - public @Nullable String getBaseURI(); /** * The base URI to be used (see section 5.1.4 in [IETF RFC 2396]) for @@ -230,7 +224,6 @@ public interface LSInput { * encoding specified in the XML declaration or the Text declaration, or * an encoding obtained from a higher level protocol, such as HTTP [IETF RFC 2616]. */ - public @Nullable String getEncoding(); /** * The character encoding, if known. The encoding must be a string @@ -249,7 +242,6 @@ public interface LSInput { * in [XML 1.1]) when * parsing [XML 1.1]. */ - public boolean getCertifiedText(); /** * If set to true, assume that the input is certified (see section 2.13 diff --git a/src/java.xml/share/classes/org/w3c/dom/ls/LSResourceResolver.java b/src/java.xml/share/classes/org/w3c/dom/ls/LSResourceResolver.java index 4732dc9768d..d2329861f65 100644 --- a/src/java.xml/share/classes/org/w3c/dom/ls/LSResourceResolver.java +++ b/src/java.xml/share/classes/org/w3c/dom/ls/LSResourceResolver.java @@ -107,7 +107,6 @@ public interface LSResourceResolver { * source, or null to request that the parser open a * regular URI connection to the resource. */ - public @Nullable LSInput resolveResource(String type, @Nullable String namespaceURI, @Nullable String publicId, diff --git a/src/java.xml/share/classes/org/xml/sax/EntityResolver.java b/src/java.xml/share/classes/org/xml/sax/EntityResolver.java index 879337426a0..b23dd6c3140 100644 --- a/src/java.xml/share/classes/org/xml/sax/EntityResolver.java +++ b/src/java.xml/share/classes/org/xml/sax/EntityResolver.java @@ -126,7 +126,6 @@ public interface EntityResolver { * or Reader for the InputSource. * @see org.xml.sax.InputSource */ - public abstract @Nullable InputSource resolveEntity (@Nullable String publicId, String systemId) throws SAXException, IOException; diff --git a/src/java.xml/share/classes/org/xml/sax/InputSource.java b/src/java.xml/share/classes/org/xml/sax/InputSource.java index fc3d1472153..a95baa72633 100644 --- a/src/java.xml/share/classes/org/xml/sax/InputSource.java +++ b/src/java.xml/share/classes/org/xml/sax/InputSource.java @@ -85,7 +85,6 @@ public class InputSource { * @see #setCharacterStream * @see #setEncoding */ - public InputSource () { } @@ -108,7 +107,6 @@ public InputSource () * @see #setEncoding * @see #setCharacterStream */ - public InputSource (@Nullable String systemId) { setSystemId(systemId); @@ -130,7 +128,6 @@ public InputSource (@Nullable String systemId) * @see #setByteStream * @see #setCharacterStream */ - public InputSource (@Nullable InputStream byteStream) { setByteStream(byteStream); @@ -152,7 +149,6 @@ public InputSource (@Nullable InputStream byteStream) * @see #setByteStream * @see #setCharacterStream */ - public InputSource (@Nullable Reader characterStream) { setCharacterStream(characterStream); @@ -183,7 +179,6 @@ public void setPublicId (@Nullable String publicId) * @return The public identifier, or null if none was supplied. * @see #setPublicId */ - public @Nullable String getPublicId () { return publicId; @@ -231,7 +226,6 @@ public void setSystemId (@Nullable String systemId) * @see #setSystemId * @see #getEncoding */ - public @Nullable String getSystemId () { return systemId; @@ -271,7 +265,6 @@ public void setByteStream (@Nullable InputStream byteStream) * @see #getEncoding * @see #setByteStream */ - public @Nullable InputStream getByteStream () { return byteStream; @@ -309,7 +302,6 @@ public void setEncoding (@Nullable String encoding) * @see #getSystemId * @see #getByteStream */ - public @Nullable String getEncoding () { return encoding; @@ -340,7 +332,6 @@ public void setCharacterStream (@Nullable Reader characterStream) * @return The character stream, or null if none was supplied. * @see #setCharacterStream */ - public @Nullable Reader getCharacterStream () { return characterStream; diff --git a/src/java.xml/share/classes/org/xml/sax/ext/EntityResolver2.java b/src/java.xml/share/classes/org/xml/sax/ext/EntityResolver2.java index 5070d28c40a..3581ff65cc9 100644 --- a/src/java.xml/share/classes/org/xml/sax/ext/EntityResolver2.java +++ b/src/java.xml/share/classes/org/xml/sax/ext/EntityResolver2.java @@ -146,7 +146,6 @@ public interface EntityResolver2 extends EntityResolver * @throws IOException Probably indicating a failure to create * a new InputStream or Reader, or an illegal URL. */ - public @Nullable InputSource getExternalSubset (String name, @Nullable String baseURI) throws SAXException, IOException; @@ -204,7 +203,6 @@ public interface EntityResolver2 extends EntityResolver * @throws IOException Probably indicating a failure to create * a new InputStream or Reader, or an illegal URL. */ - public @Nullable InputSource resolveEntity ( String name, @Nullable String publicId, diff --git a/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java b/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java index 32da24ce496..2364081436c 100644 --- a/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java +++ b/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java @@ -178,8 +178,6 @@ public void setSource(Object o) { * @param o the {@code Object} to check against * @return true if this is the same object */ - - public boolean equals(@Nullable Object o) { if (o instanceof Translator) { return java.util.Objects.equals(source, o); diff --git a/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java b/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java index 0db104508a7..b66357ba96b 100644 --- a/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java +++ b/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java @@ -687,8 +687,6 @@ public int hashCode() { * a VirtualMachine that is equal to this * VirtualMachine. */ - - public boolean equals(@Nullable Object ob) { if (ob == this) return true; diff --git a/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachineDescriptor.java b/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachineDescriptor.java index 2fc0d099e80..2e10bcf9522 100644 --- a/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachineDescriptor.java +++ b/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachineDescriptor.java @@ -175,8 +175,6 @@ public int hashCode() { * a VirtualMachineDescriptor that is equal to this * VirtualMachineDescriptor. */ - - public boolean equals(@Nullable Object ob) { if (ob == this) return true; diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java index 841dc5c0597..447e0c92daf 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java @@ -406,8 +406,6 @@ private static String toString(long[] longs) { return sb.toString(); } - - public boolean equals(@Nullable Object obj) { return this == obj; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java index 650dc43527e..972214ca2e6 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java @@ -41,8 +41,6 @@ public LinuxAddress(LinuxDebugger debugger, long addr) { // Basic Java routines // - - public boolean equals(@Nullable Object arg) { if (arg == null) { return false; diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/HostIdentifier.java b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/HostIdentifier.java index 403b10341a1..bad2b717c86 100644 --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/HostIdentifier.java +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/HostIdentifier.java @@ -527,8 +527,6 @@ public int hashCode() { * * @see URI#equals(Object) */ - - public boolean equals(@Nullable Object object) { if (object == this) { return true; diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/VmIdentifier.java b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/VmIdentifier.java index ac6a0a5a999..03f9569ae70 100644 --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/VmIdentifier.java +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/VmIdentifier.java @@ -408,8 +408,6 @@ public int hashCode() { * * @see URI#equals(Object) */ - - public boolean equals(@Nullable Object object) { if (object == this) { return true; diff --git a/src/jdk.jcmd/share/classes/sun/tools/jstat/OptionFormat.java b/src/jdk.jcmd/share/classes/sun/tools/jstat/OptionFormat.java index b5a101ccbfb..a088dc24108 100644 --- a/src/jdk.jcmd/share/classes/sun/tools/jstat/OptionFormat.java +++ b/src/jdk.jcmd/share/classes/sun/tools/jstat/OptionFormat.java @@ -46,8 +46,6 @@ public OptionFormat(String name) { this.children = new ArrayList(); } - - public boolean equals(@Nullable Object o) { if (o == this) { return true; diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XMBean.java b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XMBean.java index e6af7b1ee8e..d5ca18b82cf 100644 --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XMBean.java +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XMBean.java @@ -146,8 +146,6 @@ public MBeanInfo getMBeanInfo() throws InstanceNotFoundException, } @Override - - public boolean equals(@Nullable Object obj) { if (obj == null) { return false; diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XObject.java b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XObject.java index 2d6a9c2a739..9afddc2f021 100644 --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XObject.java +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XObject.java @@ -50,8 +50,6 @@ public XObject (Object object) { setHorizontalAlignment(SwingConstants.LEFT); } - - public boolean equals(@Nullable Object o) { if (o instanceof XObject) { return Objects.equals(object, ((XObject)o).getObject()); diff --git a/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventQueueImpl.java b/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventQueueImpl.java index 9df46b3d911..e6639d7a3e7 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventQueueImpl.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventQueueImpl.java @@ -54,8 +54,6 @@ public class EventQueueImpl extends MirrorImpl implements EventQueue { /* * Override superclass back to default equality */ - - public boolean equals(@Nullable Object obj) { return this == obj; } diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractResourcePoolEntry.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractResourcePoolEntry.java index b1338d7c1bd..3f2d3717a83 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractResourcePoolEntry.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractResourcePoolEntry.java @@ -82,8 +82,6 @@ public int hashCode() { } @Override - - public boolean equals(@Nullable Object other) { if (!(other instanceof AbstractResourcePoolEntry)) { return false; diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java index bc10260b39d..fff7681a0c9 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java @@ -136,8 +136,6 @@ int hashCode(int seed) { } @Override - - public boolean equals(@Nullable Object obj) { if (this == obj) { return true; diff --git a/src/jdk.management.agent/share/classes/sun/management/jdp/JdpJmxPacket.java b/src/jdk.management.agent/share/classes/sun/management/jdp/JdpJmxPacket.java index 3fd0cbde24d..5a7888451df 100644 --- a/src/jdk.management.agent/share/classes/sun/management/jdp/JdpJmxPacket.java +++ b/src/jdk.management.agent/share/classes/sun/management/jdp/JdpJmxPacket.java @@ -235,8 +235,6 @@ public int hashCode() { * @return either packet equals or not */ @Override - - public boolean equals(@Nullable Object o) { if (o == null || ! (o instanceof JdpJmxPacket) ){ diff --git a/src/jdk.management.agent/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java b/src/jdk.management.agent/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java index c509f277d60..834f2a4dd28 100644 --- a/src/jdk.management.agent/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java +++ b/src/jdk.management.agent/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java @@ -123,8 +123,6 @@ public Socket accept() throws IOException { * are equal if they are of the same type. */ @Override - - public boolean equals(@Nullable Object obj) { return (obj instanceof LocalRMIServerSocketFactory); } diff --git a/src/jdk.management/share/classes/com/sun/management/GcInfo.java b/src/jdk.management/share/classes/com/sun/management/GcInfo.java index e85f8b8533b..ce5bca7e51e 100644 --- a/src/jdk.management/share/classes/com/sun/management/GcInfo.java +++ b/src/jdk.management/share/classes/com/sun/management/GcInfo.java @@ -246,8 +246,6 @@ public boolean containsValue(Object value) { return cdata.containsValue(value); } - - public boolean equals(@Nullable Object obj) { return cdata.equals(obj); } diff --git a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsName.java b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsName.java index b8960b298ce..6034b08f518 100644 --- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsName.java +++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsName.java @@ -208,8 +208,6 @@ public int hashCode() { return h; } - - public boolean equals(@Nullable Object obj) { if (!(obj instanceof Name) || (obj instanceof CompositeName)) { return false; diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java index 0c364a38e0e..c0037d58974 100644 --- a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java +++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java @@ -83,8 +83,6 @@ public String toString() { * @return true if the specified Object is equal to this * {@code NTNumericCredential}. */ - - public boolean equals(@Nullable Object o) { if (o == null) return false; diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java index 579aec76fcc..27600838c52 100644 --- a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java +++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java @@ -90,8 +90,6 @@ public String toString() { * @return true if the specified Object is equal to this * {@code NTSidDomainPrincipal}. */ - - public boolean equals(@Nullable Object o) { if (o == null) return false; diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java index 1bf52accccc..480957906cb 100644 --- a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java +++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java @@ -85,8 +85,6 @@ public String toString() { * @return true if the specified Object is equal to this * {@code NTSidGroupPrincipal}. */ - - public boolean equals(@Nullable Object o) { if (o == null) return false; diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java index e61db33b57e..3672e9b7bb7 100644 --- a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java +++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java @@ -88,8 +88,6 @@ public String toString() { * @return true if the specified Object is equal to this * {@code NTSidPrimaryGroupPrincipal}. */ - - public boolean equals(@Nullable Object o) { if (o == null) return false; diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java index 3caafaf88e8..031a63df383 100644 --- a/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java +++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java @@ -84,8 +84,6 @@ public String toString() { * @return true if the specified Object is equal to this * {@code NTSidUserPrincipal}. */ - - public boolean equals(@Nullable Object o) { if (o == null) return false; diff --git a/src/jdk.unsupported/share/classes/sun/misc/Signal.java b/src/jdk.unsupported/share/classes/sun/misc/Signal.java index d3b9e2c040f..bd5183f25c2 100644 --- a/src/jdk.unsupported/share/classes/sun/misc/Signal.java +++ b/src/jdk.unsupported/share/classes/sun/misc/Signal.java @@ -100,8 +100,6 @@ public String getName() { * @param other the object to compare with. * @return whether two Signal objects are equal. */ - - public boolean equals(@Nullable Object other) { if (this == other) { return true; From ec61eadddbb77886a6f1b0d713d795b960dab95d Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Wed, 18 Nov 2026 22:18:25 -0500 Subject: [PATCH 2/2] Restore `@NonNull` import. --- .../share/classes/java/util/concurrent/ConcurrentHashMap.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java index bcfe28bc6fa..ecfdbbf6c14 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java @@ -35,6 +35,7 @@ package java.util.concurrent; +import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable;