Skip to content

Commit

Permalink
feat(objectionary#112): rename ClassDirectives -> DirectivesClass
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Oct 4, 2023
1 parent 82bccd6 commit 8b5967d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.cactoos.io.InputOf;
import org.eolang.jeo.Representation;
import org.eolang.jeo.representation.asm.Bytecode;
import org.eolang.jeo.representation.asm.ClassDirectives;
import org.eolang.jeo.representation.asm.DirectivesClass;
import org.eolang.jeo.representation.asm.ClassName;
import org.objectweb.asm.ClassReader;
import org.xembly.ImpossibleModificationException;
Expand Down Expand Up @@ -89,7 +89,7 @@ public String name() {
@Override
public XML toEO() {
try {
final ClassDirectives directives = new ClassDirectives(
final DirectivesClass directives = new DirectivesClass(
new Base64Bytecode(this.input).asString()
);
new ClassReader(this.input).accept(directives, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* remove that puzzle.
*/
@SuppressWarnings({"PMD.UseObjectForClearerAPI", "PMD.AvoidDuplicateLiterals"})
public final class ClassDirectives extends ClassVisitor implements Iterable<Directive> {
public final class DirectivesClass extends ClassVisitor implements Iterable<Directive> {

/**
* Bytecode listing.
Expand All @@ -63,14 +63,14 @@ public final class ClassDirectives extends ClassVisitor implements Iterable<Dire
* Constructor.
* @param listing Bytecode listing.
*/
public ClassDirectives(final String listing) {
public DirectivesClass(final String listing) {
this(new DefaultVersion().api(), new Directives(), listing);
}

/**
* Constructor.
*/
ClassDirectives() {
DirectivesClass() {
this("");
}

Expand All @@ -80,7 +80,7 @@ public ClassDirectives(final String listing) {
* @param directives Xembly directives.
* @param listing Bytecode listing.
*/
private ClassDirectives(
private DirectivesClass(
final int api,
final Directives directives,
final String listing
Expand Down Expand Up @@ -118,7 +118,7 @@ public void visit(
.add("objects");
this.directives.add("o")
.attr("abstract", "")
.attr("name", ClassDirectives.className(access, name));
.attr("name", DirectivesClass.className(access, name));
super.visit(version, access, name, signature, supername, interfaces);
}

Expand All @@ -136,7 +136,7 @@ public MethodVisitor visitMethod(
} else {
this.directives.add("o")
.attr("abstract", "")
.attr("name", ClassDirectives.methodName(access, name, descriptor));
.attr("name", DirectivesClass.methodName(access, name, descriptor));
if (Type.getMethodType(descriptor).getArgumentTypes().length > 0) {
this.directives.add("o")
.attr("name", "args")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
import org.xembly.Xembler;

/**
* Test case for {@link ClassDirectives}.
* Test case for {@link DirectivesClass}.
* @since 0.1.0
*/
class ClassDirectivesTest {
class DirectivesClassTest {

@Test
void parsesSimpleClassWithoutConstructor() throws ImpossibleModificationException {
final ClassDirectives directives = new ClassDirectives();
final DirectivesClass directives = new DirectivesClass();
new ClassReader(new BytecodeClass().bytecode().asBytes()).accept(directives, 0);
MatcherAssert.assertThat(
"Can't parse simple class without constructor",
Expand All @@ -52,7 +52,7 @@ void parsesSimpleClassWithoutConstructor() throws ImpossibleModificationExceptio

@Test
void parsesSimpleClassWithMethod() throws ImpossibleModificationException {
final ClassDirectives directives = new ClassDirectives();
final DirectivesClass directives = new DirectivesClass();
new ClassReader(
new BytecodeClass("WithMethod")
.withMethod("main")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
/**
* Test case for {@link MethodDirectives}.
* We create {@link MethodDirectives} only in the context
* of using {@link ClassDirectives} in other words, {@link MethodDirectives} can't be createad
* without {@link ClassDirectives} and it is the main reason why in all the test we create
* {@link ClassDirectives}.
* of using {@link DirectivesClass} in other words, {@link MethodDirectives} can't be createad
* without {@link DirectivesClass} and it is the main reason why in all the test we create
* {@link DirectivesClass}.
*
* @since 0.1.0
* @todo #97:60min Add more user-friendly Hamcrest matchers.
Expand All @@ -58,7 +58,7 @@ class MethodDirectivesTest {

@Test
void parsesMethodInstructions() {
final ClassDirectives visitor = new ClassDirectives();
final DirectivesClass visitor = new DirectivesClass();
new ClassReader(
new BytecodeClass()
.withMethod("main")
Expand Down

0 comments on commit 8b5967d

Please sign in to comment.