Commit 72225c99 authored by Eric Bruneton's avatar Eric Bruneton
Browse files

Merge branch 'rename-subtype-to-subclass' into 'master'

Rename remaining 'subtype' to 'subclass'.

See merge request asm/asm!295
parents 975df122 66a06368
......@@ -125,8 +125,7 @@ public abstract class AsmTest {
JDK11_ALL_STRUCTURES_NESTED("jdk11.AllStructures$Nested"),
JDK14_ALL_STRUCTURES_RECORD("jdk14.AllStructures$RecordSubType"),
JDK14_ALL_STRUCTURES_EMPTY_RECORD("jdk14.AllStructures$EmptyRecord"),
JDK15_ALL_STRUCTURES("jdk15.AllStructures"),
;
JDK15_ALL_STRUCTURES("jdk15.AllStructures");
private final String name;
private byte[] bytes;
......
......@@ -495,7 +495,7 @@ public class ClassFile {
} else if (attributeName.equals("NestMembers")) {
dumpNestMembersAttribute(parser, builder);
} else if (attributeName.equals("PermittedSubclasses")) {
dumpPermittedSubtypesAttribute(parser, builder);
dumpPermittedSubclassesAttribute(parser, builder);
} else if (attributeName.equals("Record")) {
dumpRecordAttribute(parser, builder);
} else if (attributeName.equals("StackMap")) {
......@@ -1691,17 +1691,17 @@ public class ClassFile {
}
/**
* Parses and dumps a PermittedSubtypes attribute.
* Parses and dumps a PermittedSubclasses attribute.
*
* @param parser a class parser.
* @param builder a dump builder.
* @throws IOException if the class can't be parsed.
* @see <a href="https://openjdk.java.net/jeps/360">JEP 360</a>
*/
private static void dumpPermittedSubtypesAttribute(final Parser parser, final Builder builder)
private static void dumpPermittedSubclassesAttribute(final Parser parser, final Builder builder)
throws IOException {
int permittedSubTypesCount = builder.add("permitted_subtypes_count: ", parser.u2());
for (int i = 0; i < permittedSubTypesCount; ++i) {
int permittedSubclassesCount = builder.add("permitted_subclasses_count: ", parser.u2());
for (int i = 0; i < permittedSubclassesCount; ++i) {
builder.addCpInfo("class: ", parser.u2());
}
}
......
......@@ -34,4 +34,4 @@ public sealed interface AllStructures {
record RecordSubType(int component1, String component2) implements AllStructures {
}
}
\ No newline at end of file
}
......@@ -89,12 +89,12 @@ public class PrinterTest {
}
@Test
public void testVisitPermittedSubtype_unsupportedByDefault() {
public void testVisitPermittedSubclass_unsupportedByDefault() {
Printer printer = new EmptyPrinter(/* latest */ Opcodes.ASM10_EXPERIMENTAL);
Executable visitPermittedSubtype = () -> printer.visitPermittedSubclass(null);
Executable visitPermittedSubclass = () -> printer.visitPermittedSubclass(null);
Exception exception = assertThrows(UnsupportedOperationException.class, visitPermittedSubtype);
Exception exception = assertThrows(UnsupportedOperationException.class, visitPermittedSubclass);
assertEquals(UNSUPPORTED_OPERATION_MESSAGE, exception.getMessage());
}
......
......@@ -30,7 +30,7 @@ package org.objectweb.asm;
/**
* A visitor to visit a Java class. The methods of this class must be called in the following order:
* {@code visit} [ {@code visitSource} ] [ {@code visitModule} ][ {@code visitNestHost} ][ {@code
* visitPermittedSubtype} ][ {@code visitOuterClass} ] ( {@code visitAnnotation} | {@code
* visitPermittedclass} ][ {@code visitOuterClass} ] ( {@code visitAnnotation} | {@code
* visitTypeAnnotation} | {@code visitAttribute} )* ( {@code visitNestMember} | {@code
* visitInnerClass} | {@code visitRecordComponent} | {@code visitField} | {@code visitMethod} )*
* {@code visitEnd}.
......
......@@ -370,7 +370,7 @@ public class ClassReaderTest extends AsmTest implements Opcodes {
/**
* Tests the ClassReader accept method with a visitor that skips fields, methods, members,
* modules, nest host, permitted subtypes and record.
* modules, nest host, permitted subclasses and record.
*/
@ParameterizedTest
@MethodSource(ALL_CLASSES_AND_ALL_APIS)
......@@ -470,7 +470,7 @@ public class ClassReaderTest extends AsmTest implements Opcodes {
Executable accept = () -> classReader.accept(classVisitor, 0);
boolean hasPermittedSubtypes = classParameter == PrecompiledClass.JDK15_ALL_STRUCTURES;
boolean hasPermittedSubclasses = classParameter == PrecompiledClass.JDK15_ALL_STRUCTURES;
boolean hasRecord =
classParameter == PrecompiledClass.JDK14_ALL_STRUCTURES_RECORD
|| classParameter == PrecompiledClass.JDK14_ALL_STRUCTURES_EMPTY_RECORD;
......@@ -479,7 +479,7 @@ public class ClassReaderTest extends AsmTest implements Opcodes {
|| classParameter == PrecompiledClass.JDK11_ALL_STRUCTURES_NESTED;
boolean hasModules = classParameter == PrecompiledClass.JDK9_MODULE;
boolean hasTypeAnnotations = classParameter == PrecompiledClass.JDK8_ALL_STRUCTURES;
if ((hasPermittedSubtypes && apiParameter.value() < ASM9)
if ((hasPermittedSubclasses && apiParameter.value() < ASM9)
|| (hasRecord && apiParameter.value() < ASM8)
|| (hasNestHostOrMembers && apiParameter.value() < ASM7)
|| (hasModules && apiParameter.value() < ASM6)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment