Skip to content

Commit

Permalink
feat(#532): rename classes
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Oct 7, 2024
1 parent 228cc40 commit 9854183
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public final class BytecodeAnnotation implements BytecodeAnnotationValue {
/**
* Properties.
*/
private final List<BytecodeAnnotationValue> properties;
private final List<BytecodeAnnotationValue> values;

/**
* Constructor.
Expand All @@ -71,16 +71,16 @@ public BytecodeAnnotation(final String descriptor, final boolean visible) {
* Constructor.
* @param descriptor Descriptor.
* @param visible Visible.
* @param properties Properties.
* @param vals Properties.
*/
public BytecodeAnnotation(
final String descriptor,
final boolean visible,
final List<BytecodeAnnotationValue> properties
final List<BytecodeAnnotationValue> vals
) {
this.descr = descriptor;
this.visible = visible;
this.properties = properties;
this.values = vals;
}

/**
Expand All @@ -90,7 +90,7 @@ public BytecodeAnnotation(
*/
public BytecodeAnnotation write(final ClassVisitor visitor) {
final AnnotationVisitor avisitor = visitor.visitAnnotation(this.descr, this.visible);
this.properties.forEach(property -> property.writeTo(avisitor));
this.values.forEach(property -> property.writeTo(avisitor));
return this;
}

Expand All @@ -101,7 +101,7 @@ public BytecodeAnnotation write(final ClassVisitor visitor) {
*/
public BytecodeAnnotation write(final MethodVisitor visitor) {
final AnnotationVisitor avisitor = visitor.visitAnnotation(this.descr, this.visible);
this.properties.forEach(property -> property.writeTo(avisitor));
this.values.forEach(property -> property.writeTo(avisitor));
return this;
}

Expand All @@ -115,7 +115,7 @@ public BytecodeAnnotation write(final int index, final MethodVisitor visitor) {
final AnnotationVisitor avisitor = visitor.visitParameterAnnotation(
index, this.descr, this.visible
);
this.properties.forEach(property -> property.writeTo(avisitor));
this.values.forEach(property -> property.writeTo(avisitor));
return this;
}

Expand All @@ -126,22 +126,22 @@ public BytecodeAnnotation write(final int index, final MethodVisitor visitor) {
*/
public BytecodeAnnotation write(final FieldVisitor visitor) {
final AnnotationVisitor avisitor = visitor.visitAnnotation(this.descr, this.visible);
this.properties.forEach(property -> property.writeTo(avisitor));
this.values.forEach(property -> property.writeTo(avisitor));
return this;
}

@Override
public void writeTo(final AnnotationVisitor visitor) {
final AnnotationVisitor inner = visitor.visitAnnotation(this.descr, this.descr);
this.properties.forEach(property -> property.writeTo(inner));
this.values.forEach(property -> property.writeTo(inner));
}

@Override
public Iterable<Directive> directives() {
return new DirectivesAnnotation(
this.descr,
this.visible,
this.properties.stream()
this.values.stream()
.map(BytecodeAnnotationValue::directives)
.collect(Collectors.toList())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public BytecodeAnnotation bytecode() {
return new BytecodeAnnotation(
this.descriptor(),
this.visible(),
this.props()
this.values()
);
}

Expand Down Expand Up @@ -85,13 +85,13 @@ private XmlNode child(final int index) {
* Annotation properties.
* @return Properties.
*/
private List<BytecodeAnnotationValue> props() {
private List<BytecodeAnnotationValue> values() {
return this.node.children()
.filter(
xmlnode -> xmlnode.hasAttribute("base", new JeoFqn("annotation-property").fqn())
)
.map(XmlAnnotationProperty::new)
.map(XmlAnnotationProperty::bytecode)
.map(XmlAnnotationValue::new)
.map(XmlAnnotationValue::bytecode)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Xmir annotation property.
* @since 0.3
*/
public final class XmlAnnotationProperty {
public final class XmlAnnotationValue {

/**
* Annotation property XML node.
Expand All @@ -46,7 +46,7 @@ public final class XmlAnnotationProperty {
* Constructor.
* @param xmlnode XML node.
*/
public XmlAnnotationProperty(final XmlNode xmlnode) {
public XmlAnnotationValue(final XmlNode xmlnode) {
this.node = xmlnode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public final class XmlDefaultValue {
public Optional<BytecodeDefaultValue> bytecode() {
return this.node.children().findFirst().map(
property -> new BytecodeDefaultValue(
new XmlAnnotationProperty(property).bytecode()
new XmlAnnotationValue(property).bytecode()
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Object asObject() {
} else if (new JeoFqn("annotation").fqn().equals(base)) {
result = new XmlAnnotation(this.raw).bytecode();
} else if (new JeoFqn("annotation-property").fqn().equals(base)) {
result = new XmlAnnotationProperty(this.raw).bytecode();
result = new XmlAnnotationValue(this.raw).bytecode();
} else {
result = new XmlValue(this.raw).object();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Collections;
import org.eolang.jeo.representation.bytecode.BytecodeAnnotation;
import org.eolang.jeo.representation.bytecode.BytecodeAnnotationAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlAnnotationProperty;
import org.eolang.jeo.representation.xmir.XmlAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlNode;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand Down Expand Up @@ -67,7 +67,7 @@ void createsAnnotationAnnotationProperty() throws ImpossibleModificationExceptio
final boolean visible = true;
MatcherAssert.assertThat(
"Incorrect annotation property type",
new XmlAnnotationProperty(
new XmlAnnotationValue(
new XmlNode(
new Xembler(
new DirectivesAnnotationAnnotationValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Collections;
import org.eolang.jeo.representation.bytecode.BytecodeAnnotation;
import org.eolang.jeo.representation.bytecode.BytecodeArrayAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlAnnotationProperty;
import org.eolang.jeo.representation.xmir.XmlAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlNode;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand Down Expand Up @@ -65,7 +65,7 @@ void createsAnnotationArrayProperty() throws ImpossibleModificationException {
final boolean visible = true;
MatcherAssert.assertThat(
"Incorrect array annotation property",
new XmlAnnotationProperty(
new XmlAnnotationValue(
new XmlNode(
new Xembler(
new DirectivesArrayAnnotationValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.jcabi.matchers.XhtmlMatchers;
import java.time.DayOfWeek;
import org.eolang.jeo.representation.bytecode.BytecodeEnumAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlAnnotationProperty;
import org.eolang.jeo.representation.xmir.XmlAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlNode;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand Down Expand Up @@ -64,7 +64,7 @@ void createsAnnotationEnumProperty() throws ImpossibleModificationException {
final String value = "BOOL";
MatcherAssert.assertThat(
"Incorrect annotation property for enum property",
new XmlAnnotationProperty(
new XmlAnnotationValue(
new XmlNode(
new Xembler(new DirectivesEnumAnnotationValue(name, descriptor, value)).xml()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import com.jcabi.matchers.XhtmlMatchers;
import org.eolang.jeo.representation.bytecode.BytecodePlainAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlAnnotationProperty;
import org.eolang.jeo.representation.xmir.XmlAnnotationValue;
import org.eolang.jeo.representation.xmir.XmlNode;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand Down Expand Up @@ -59,7 +59,7 @@ void createsAnnotationPlainProperty() throws ImpossibleModificationException {
final int value = 1;
MatcherAssert.assertThat(
"Incorrect annotation property for plain property",
new XmlAnnotationProperty(
new XmlAnnotationValue(
new XmlNode(
new Xembler(new DirectivesPlainAnnotationValue(name, value)).xml()
)
Expand Down

1 comment on commit 9854183

@0pdd
Copy link

@0pdd 0pdd commented on 9854183 Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 488-c2b6a994 disappeared from src/main/java/org/eolang/jeo/representation/bytecode/BytecodeAnnotation.java), that's why I closed #532. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.