From b3ef2a600cfec31723dc78fe552e9cf9976b0337 Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Thu, 11 Jul 2024 20:51:27 +0000 Subject: [PATCH] 8336036: Synthetic documentation for a record's equals is incorrect for floating-point types Reviewed-by: prappo --- .../doclets/toolkit/resources/doclets.properties | 6 ++++-- .../doclet/testRecordTypes/TestRecordTypes.java | 14 +++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties index 859289ff8bd..0ee9429ec0c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties @@ -319,10 +319,12 @@ doclet.record_equals_doc.fullbody.head=\ doclet.record_equals_doc.fullbody.tail.both=\ Reference components are compared with \ {@link java.util.Objects#equals(Object,Object) Objects::equals(Object,Object)}; \ - primitive components are compared with '=='. + primitive components are compared with the compare method from \ + their corresponding wrapper classes. doclet.record_equals_doc.fullbody.tail.primitive=\ - All components in this record class are compared with '=='. + All components in this record class are compared with the compare \ + method from their corresponding wrapper classes. doclet.record_equals_doc.fullbody.tail.reference=\ All components in this record class are compared with \ diff --git a/test/langtools/jdk/javadoc/doclet/testRecordTypes/TestRecordTypes.java b/test/langtools/jdk/javadoc/doclet/testRecordTypes/TestRecordTypes.java index c4579c501ec..f9aa3cfd6fa 100644 --- a/test/langtools/jdk/javadoc/doclet/testRecordTypes/TestRecordTypes.java +++ b/test/langtools/jdk/javadoc/doclet/testRecordTypes/TestRecordTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -237,7 +237,8 @@ public class TestRecordTypes extends JavadocTester { """ Indicates whether some other object is "equal to" this one. The objects are equa\ l if the other object is of the same class and if all the record components are \ - equal. All components in this record class are compared with '=='.""", + equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.""", """ r1""", """ @@ -300,7 +301,8 @@ public class TestRecordTypes extends JavadocTester { """ Indicates whether some other object is "equal to" this one. The objects are equa\ l if the other object is of the same class and if all the record components are \ - equal. All components in this record class are compared with '=='.""", + equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.""", """ r1""", """ @@ -311,7 +313,8 @@ public class TestRecordTypes extends JavadocTester { @Test public void testGeneratedEqualsPrimitive(Path base) throws IOException { testGeneratedEquals(base, "int a, int b", - "All components in this record class are compared with '=='."); + "All components in this record class are compared with the compare method " + + "from their corresponding wrapper classes."); } @Test @@ -324,7 +327,8 @@ public class TestRecordTypes extends JavadocTester { public void testGeneratedEqualsMixed(Path base) throws IOException { testGeneratedEquals(base, "int a, Object b", "Reference components are compared with Objects::equals(Object,Object); " - + "primitive components are compared with '=='."); + + "primitive components are compared with the compare method from their " + + "corresponding wrapper classes."); } private void testGeneratedEquals(Path base, String comps, String expect) throws IOException {