From 440213455ba4eb114c2b69def288e82883f734c8 Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Thu, 8 Aug 2024 15:37:01 +0200 Subject: [PATCH] Rename ClassInfo.canonicalConstructor() to canonicalRecordConstructor() --- .../main/java/org/jboss/jandex/ClassInfo.java | 10 +++--- .../org/jboss/jandex/test/RecordTestCase.java | 32 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/org/jboss/jandex/ClassInfo.java b/core/src/main/java/org/jboss/jandex/ClassInfo.java index f1335491..3a00eadc 100644 --- a/core/src/main/java/org/jboss/jandex/ClassInfo.java +++ b/core/src/main/java/org/jboss/jandex/ClassInfo.java @@ -757,13 +757,13 @@ public final List constructors() { /** * Returns the canonical constructor of this record. If this class is not a record, returns {@code null}. *

- * Note that this method has the same limitations as {@link #unsortedRecordComponents()}. That is, - * at most 256 record components may be present, and an assumption is made that bytecode order - * of record components corresponds to the declaration order. + * Note that this method has the same limitations as {@link #recordComponentsInDeclarationOrder()}. + * That is, at most 256 record components may be present, and an assumption is made that bytecode + * order of record components corresponds to the declaration order. * * @return the canonical constructor of this record, or {@code null} if this class is not a record */ - public MethodInfo canonicalConstructor() { + public MethodInfo canonicalRecordConstructor() { if (!isRecord()) { return null; } @@ -955,7 +955,7 @@ public final RecordComponentInfo recordComponent(String name) { * If this class is not a record, returns an empty list. *

* Note that the result doesn't have any guaranteed order. If you need - * declaration order, use {@link #unsortedRecordComponents()}. + * declaration order, use {@link #recordComponentsInDeclarationOrder()}. * * @return immutable list of record components */ diff --git a/core/src/test/java/org/jboss/jandex/test/RecordTestCase.java b/core/src/test/java/org/jboss/jandex/test/RecordTestCase.java index 2847b9f8..69dcaddb 100644 --- a/core/src/test/java/org/jboss/jandex/test/RecordTestCase.java +++ b/core/src/test/java/org/jboss/jandex/test/RecordTestCase.java @@ -158,47 +158,47 @@ public void testRecordSignatureProcessed() { public void canonicalCtor() { ClassInfo rec = index.getClassByName("test.RecordWithNoComponentsAndDefaultCanonicalCtor"); assertEquals(1, rec.constructors().size()); - assertEquals(rec.constructors().get(0), rec.canonicalConstructor()); + assertEquals(rec.constructors().get(0), rec.canonicalRecordConstructor()); rec = index.getClassByName("test.RecordWithNoComponentsAndCompactCanonicalCtor"); assertEquals(1, rec.constructors().size()); - assertEquals(rec.constructors().get(0), rec.canonicalConstructor()); + assertEquals(rec.constructors().get(0), rec.canonicalRecordConstructor()); rec = index.getClassByName("test.RecordWithNoComponentsAndCustomCanonicalCtor"); assertEquals(1, rec.constructors().size()); - assertEquals(rec.constructors().get(0), rec.canonicalConstructor()); + assertEquals(rec.constructors().get(0), rec.canonicalRecordConstructor()); rec = index.getClassByName("test.RecordWithDefaultCanonicalCtor"); assertEquals(1, rec.constructors().size()); - assertEquals(rec.constructors().get(0), rec.canonicalConstructor()); + assertEquals(rec.constructors().get(0), rec.canonicalRecordConstructor()); rec = index.getClassByName("test.RecordWithCompactCanonicalCtor"); assertEquals(1, rec.constructors().size()); - assertEquals(rec.constructors().get(0), rec.canonicalConstructor()); + assertEquals(rec.constructors().get(0), rec.canonicalRecordConstructor()); rec = index.getClassByName("test.RecordWithCustomCanonicalCtor"); assertEquals(1, rec.constructors().size()); - assertEquals(rec.constructors().get(0), rec.canonicalConstructor()); + assertEquals(rec.constructors().get(0), rec.canonicalRecordConstructor()); rec = index.getClassByName("test.RecordWithMultipleCtorsAndDefaultCanonicalCtor"); assertEquals(4, rec.constructors().size()); - assertEquals(2, rec.canonicalConstructor().parametersCount()); - assertEquals(PrimitiveType.INT, rec.canonicalConstructor().parameterType(0)); - assertEquals(ClassType.create(String.class), rec.canonicalConstructor().parameterType(1)); + assertEquals(2, rec.canonicalRecordConstructor().parametersCount()); + assertEquals(PrimitiveType.INT, rec.canonicalRecordConstructor().parameterType(0)); + assertEquals(ClassType.create(String.class), rec.canonicalRecordConstructor().parameterType(1)); rec = index.getClassByName("test.RecordWithMultipleCtorsAndCompactCanonicalCtor"); assertEquals(4, rec.constructors().size()); - assertEquals(2, rec.canonicalConstructor().parametersCount()); - assertEquals(PrimitiveType.INT, rec.canonicalConstructor().parameterType(0)); - assertEquals(ClassType.create(String.class), rec.canonicalConstructor().parameterType(1)); + assertEquals(2, rec.canonicalRecordConstructor().parametersCount()); + assertEquals(PrimitiveType.INT, rec.canonicalRecordConstructor().parameterType(0)); + assertEquals(ClassType.create(String.class), rec.canonicalRecordConstructor().parameterType(1)); rec = index.getClassByName("test.RecordWithMultipleCtorsAndCustomCanonicalCtor"); assertEquals(4, rec.constructors().size()); - assertEquals(2, rec.canonicalConstructor().parametersCount()); - assertEquals(PrimitiveType.INT, rec.canonicalConstructor().parameterType(0)); - assertEquals(ClassType.create(String.class), rec.canonicalConstructor().parameterType(1)); + assertEquals(2, rec.canonicalRecordConstructor().parametersCount()); + assertEquals(PrimitiveType.INT, rec.canonicalRecordConstructor().parameterType(0)); + assertEquals(ClassType.create(String.class), rec.canonicalRecordConstructor().parameterType(1)); - assertNull(index.getClassByName(RecordTestCase.class).canonicalConstructor()); + assertNull(index.getClassByName(RecordTestCase.class).canonicalRecordConstructor()); } private Index buildIndex() throws IOException {