Repository: objectionary/eo
Issue: turn on Checkstyle in eo-runtime

At the moment it's disabled. Let's turn it on and fix the code.

Changed files:
eo-runtime/src/main/java/org/eolang/Data.java, eo-runtime/src/main/java/EOorg/EOeolang/EOheap$EOpointer$EOblock.java, eo-runtime/src/main/java/EOorg/EOeolang/EOstring$EOslice.java, eo-runtime/src/main/java/EOorg/EOeolang/EOint$EOdiv.java, eo-runtime/src/main/java/EOorg/EOeolang/EOram$EOread.java, eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOdiv.java, eo-runtime/src/main/java/org/eolang/Term.java, eo-runtime/src/main/java/org/eolang/AtNamed.java, eo-runtime/src/main/java/EOorg/EOeolang/Ram.java, eo-runtime/src/main/java/org/eolang/PhPackage.java, eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/EOtext$EOtrim.java

diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOdiv.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOdiv.java
index abb876102..718e1d1d6 100644
--- a/eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOdiv.java
+++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOdiv.java
@@ -59,7 +59,13 @@ public class EOfloat$EOdiv extends PhDefault {
                     "x",
                     Double.class,
                     (acc, x) -> acc / x,
-                    x -> x.equals(0.0) ? "division by zero is infinity" : ""
+                    x -> {
+                        String msg = "";
+                        if (x.equals(0.0)) {
+                            msg = "division by zero is infinity";
+                        }
+                        return msg;
+                    }
                 )
             )
         );
diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOheap$EOpointer$EOblock.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOheap$EOpointer$EOblock.java
index 7c336a19f..47a246f67 100644
--- a/eo-runtime/src/main/java/EOorg/EOeolang/EOheap$EOpointer$EOblock.java
+++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOheap$EOpointer$EOblock.java
@@ -96,7 +96,8 @@ public class EOheap$EOpointer$EOblock extends PhDefault {
                     rho -> {
                         final Phi block = rho.attr("σ").get();
                         final Phi pointer = block.attr("σ").get();
-                        final int address = new Param(pointer, "address").strong(Long.class).intValue();
+                        final int address =
+                            new Param(pointer, "address").strong(Long.class).intValue();
                         final byte[] source = new Param(rho, "x").strong(byte[].class);
                         final byte[] data = Heaps.INSTANCE.data(pointer);
                         System.arraycopy(source, 0, data, address, source.length);
diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOint$EOdiv.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOint$EOdiv.java
index b8282d986..55e0fb771 100644
--- a/eo-runtime/src/main/java/EOorg/EOeolang/EOint$EOdiv.java
+++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOint$EOdiv.java
@@ -64,7 +64,13 @@ public class EOint$EOdiv extends PhDefault {
                     "x",
                     Long.class,
                     (acc, x) -> acc / x,
-                    x -> x.equals(0L) ? "division by zero is infinity" : ""
+                    x -> {
+                        String msg = "";
+                        if (x.equals(0L)) {
+                            msg = "division by zero is infinity";
+                        }
+                        return msg;
+                    }
                 )
             )
         );
diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOram$EOread.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOram$EOread.java
index 58f73c9e0..06ca0d0bb 100644
--- a/eo-runtime/src/main/java/EOorg/EOeolang/EOram$EOread.java
+++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOram$EOread.java
@@ -46,7 +46,7 @@ public class EOram$EOread extends PhDefault {
      * Ctor.
      * @param sigma Sigma
      */
-    public EOram$EOread(Phi sigma) {
+    public EOram$EOread(final Phi sigma) {
         super(sigma);
         this.add("p", new AtFree());
         this.add("l", new AtFree());
@@ -58,13 +58,10 @@ public class EOram$EOread extends PhDefault {
                     final int pos = new Param(rho, "p").strong(Long.class).intValue();
                     final int len = new Param(rho, "l").strong(Long.class).intValue();
                     return new Data.ToPhi(
-                        Ram.INSTANCE.read(
-                            rho.attr("ρ").get(), pos, len)
+                        Ram.INSTANCE.read(rho.attr("ρ").get(), pos, len)
                     );
                 }
             )
         );
     }
-
-
 }
diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOstring$EOslice.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOstring$EOslice.java
index 0c90928d3..890fa8934 100644
--- a/eo-runtime/src/main/java/EOorg/EOeolang/EOstring$EOslice.java
+++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOstring$EOslice.java
@@ -62,7 +62,7 @@ public class EOstring$EOslice extends PhDefault {
                     final int start = new Param(rho, "start").strong(Long.class).intValue();
                     final int length = new Param(rho, "len").strong(Long.class).intValue();
                     final int end = length + start;
-                    Phi result;
+                    final Phi result;
                     if (start < 0) {
                         result = error(
                             "Start index must be greater than 0 but was %d",
@@ -91,7 +91,7 @@ public class EOstring$EOslice extends PhDefault {
      * Building error.
      * @param msg Formatted string for error message
      * @param args Arguments for the formatted string
-     * @return φ containing error
+     * @return A φ containing error
      */
     private static Phi error(final String msg, final Object... args) {
         return new PhWith(
diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/EOtext$EOtrim.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/EOtext$EOtrim.java
index 8658c4998..7261c0541 100644
--- a/eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/EOtext$EOtrim.java
+++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/EOtext$EOtrim.java
@@ -55,8 +55,8 @@ public class EOtext$EOtrim extends PhDefault {
                 this,
                 rho -> {
                     final Phi text = rho.attr("ρ").get();
-                    final String s = new Param(text, "s").strong(String.class);
-                    return new Data.ToPhi(s.trim());
+                    final String content = new Param(text, "s").strong(String.class);
+                    return new Data.ToPhi(content.trim());
                 }
             )
         );
diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/Ram.java b/eo-runtime/src/main/java/EOorg/EOeolang/Ram.java
index a3c2eb41f..70e2a2b12 100644
--- a/eo-runtime/src/main/java/EOorg/EOeolang/Ram.java
+++ b/eo-runtime/src/main/java/EOorg/EOeolang/Ram.java
@@ -66,7 +66,7 @@ public enum Ram {
         final int position,
         final int length
     ) throws IOException {
-        final RandomAccessFile ram = init(object);
+        final RandomAccessFile ram = this.init(object);
         ram.seek(position);
         final byte[] buffer = new byte[length];
         ram.readFully(buffer, 0, length);
@@ -112,8 +112,8 @@ public enum Ram {
                     );
                     file.setLength(size);
                     return file;
-                } catch (final IOException e) {
-                    throw new UncheckedIOException(e);
+                } catch (final IOException ex) {
+                    throw new UncheckedIOException(ex);
                 }
             }
         );
diff --git a/eo-runtime/src/main/java/org/eolang/AtNamed.java b/eo-runtime/src/main/java/org/eolang/AtNamed.java
index 0b96410da..1bea27923 100644
--- a/eo-runtime/src/main/java/org/eolang/AtNamed.java
+++ b/eo-runtime/src/main/java/org/eolang/AtNamed.java
@@ -57,6 +57,7 @@ final class AtNamed implements Attr {
      * @param onme Oname
      * @param src Source φ
      * @param attr Attribute
+     * @checkstyle ParameterNumberCheck (10 lines)
      */
     AtNamed(final String nme, final String onme,
         final Phi src, final Attr attr) {
diff --git a/eo-runtime/src/main/java/org/eolang/Data.java b/eo-runtime/src/main/java/org/eolang/Data.java
index c9eb09c7c..10cd1ffe4 100644
--- a/eo-runtime/src/main/java/org/eolang/Data.java
+++ b/eo-runtime/src/main/java/org/eolang/Data.java
@@ -88,6 +88,13 @@ public interface Data<T> {
             return this.take().hashCode();
         }
 
+        @Override
+        public boolean equals(final Object obj) {
+            if (this == obj) return true;
+            if (obj == null || getClass() != obj.getClass()) return false;
+            return this.take().equals(((Once<?>) obj).take());
+        }
+
         @Override
         public String toString() {
             final T data = this.ref.get();
diff --git a/eo-runtime/src/main/java/org/eolang/PhPackage.java b/eo-runtime/src/main/java/org/eolang/PhPackage.java
index e2ecec3c3..08e82e137 100644
--- a/eo-runtime/src/main/java/org/eolang/PhPackage.java
+++ b/eo-runtime/src/main/java/org/eolang/PhPackage.java
@@ -68,11 +68,13 @@ final class PhPackage implements Phi {
         return new AtSimple(
             this.objects.computeIfAbsent(
                 target, t -> {
+                    Phi phi;
                     try {
-                        return this.sub(t);
+                        phi = this.sub(t);
                     } catch (final ClassNotFoundException ex) {
-                        return new PhPackage(abs.toString());
+                        phi = new PhPackage(abs.toString());
                     }
+                    return phi;
                 }
             )
         );
diff --git a/eo-runtime/src/main/java/org/eolang/Term.java b/eo-runtime/src/main/java/org/eolang/Term.java
index 4d679f59b..f2beb66e3 100644
--- a/eo-runtime/src/main/java/org/eolang/Term.java
+++ b/eo-runtime/src/main/java/org/eolang/Term.java
@@ -35,6 +35,7 @@ public interface Term {
      * To φ-calculus term, as text.
      *
      * @return The expression in φ-calculus
+     * @checkstyle MethodNameCheck (5 lines)
      */
     String φTerm();