RFR: 8345987: java.management has two Util.newObjectName methods (remove one) [v2]

Leonid Mesnik lmesnik at openjdk.org
Fri Dec 13 01:28:32 UTC 2024


On Thu, 12 Dec 2024 09:54:03 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> Unnecessary duplication of small utility method.  There should be only one Util.newObjectName().
>
> Kevin Walls has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'upstream/master' into 8345987_newObjectName
>  - static imports
>  - 8345987: java.management has two Util.newObjectName methods (remove one)

Changes requested by lmesnik (Reviewer).

src/java.management/share/classes/javax/management/ObjectName.java line 1225:

> 1223:         if (name.getClass().equals(ObjectName.class))
> 1224:             return name;
> 1225:         return sun.management.Util.newObjectName(name.getSerializedNameString());

The newObjectName methods are different in 2 Utils.
The share/classes/sun/management/Util.java is

  45   │     public static ObjectName newObjectName(String name) {
  46   │         try {
  47   │             return ObjectName.getInstance(name);
  48   │         } catch (MalformedObjectNameException e) {
  49   │             throw new IllegalArgumentException(e);
  50   │         }
  51   │     }

Isn't it infinite recursion?

-------------

PR Review: https://git.openjdk.org/jdk/pull/22681#pullrequestreview-2501062283
PR Review Comment: https://git.openjdk.org/jdk/pull/22681#discussion_r1883103577


More information about the serviceability-dev mailing list