On Mon, 24 Feb 2025 17:01:56 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>>> And two @throws with the same type aren't allowed in javadoc, which means >>> you have to add the new reason to throw IllegalArgumentException into the >>> existing one. >> >> That's demonstrably untrue. This method already has two. >> >> Regarding the scenario above, this apparent and has all been considered >> already and the IAE is the preferred solution. >> >> And FWIW I don't think ISE is really any better. > >> > And two @throws with the same type aren't allowed in javadoc, which means >> > you have to add the new reason to throw IllegalArgumentException into the >> > existing one. >> >> That's demonstrably untrue. This method already has two. > > I was wrong here, the specification for > [`ICC_Profile.html.setData`](https://docs.oracle.com/en/java/javase/23/docs/api/java.desktop/java/awt/color/ICC_Profile.html#setData(int,byte[])) > correctly displays the two entries for `IllegalArgumentException`. The > generated javadoc for the proposed changeset contains three entries for IAE. > > I misremembered it, or it was a limitation in an IDE javadoc parser. > Regarding the scenario above, this apparent and has all been considered > already and the IAE is the preferred solution. > > And FWIW I don't think ISE is really any better. <code>Illegal<i>Argument</i>Exception</code> implies the *argument* is invalid, but it is now thrown for a *valid* argument if the object *state* doesn't allow modifying the data. <code>Illegal<i>State</i>Exception</code> conveys the object *state* is inappropriate to call this method. There's a semantic difference between the two, and I think <code>Illegal<i>State</i>Exception</code> is better in this case. We can also discuss it with Joe in the CSR. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23606#discussion_r1968073992