diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java index fbe1393a2b..39bde2aa29 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java @@ -54,16 +54,18 @@ public ChRemote(final String tag) { @Override public String value() { - final String result = new ChText(ChRemote.CACHE::asString, this.tag).value(); - if (result == null) { + try { + final String sha = new ChText(ChRemote.CACHE::asString, this.tag).value(); + Logger.debug(this, "Git sha of %s is %s", this.tag, sha); + return sha; + } catch (final ChText.NotFound ex) { throw new IllegalArgumentException( String.format( "Tag '%s' doesn't exist or the list of all tags was not loaded correctly", this.tag - ) + ), + ex ); } - Logger.debug(this, "Git sha of %s is %s", this.tag, result); - return result; } } diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChText.java b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChText.java index 8b94044314..ce07481025 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChText.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChText.java @@ -87,14 +87,24 @@ public String value() { new Split(new TextOf(this.source), "\n") ), () -> { - throw new NotFound(); + throw new NotFound( + String.format( + "Git SHA not found for the '%s' tag", + this.tag + ) + ); } ) ), "\\s+" ), () -> { - throw new NotFound(); + throw new NotFound( + String.format( + "No SHA found for the '%s' tag", + this.tag + ) + ); } ) ) @@ -106,12 +116,13 @@ public String value() { * * @since 0.28.11 */ - final class NotFound extends RuntimeException { + static final class NotFound extends RuntimeException { /** * The main constructor. + * @param cause The cause of it */ - private NotFound() { - super(String.format("The hash wasn't found for tag %s", ChText.this.tag)); + private NotFound(final String cause) { + super(cause); } } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java index 67d6c38c8f..a7920a8d5e 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java @@ -66,9 +66,9 @@ void getsCommitHashOldTag() { @Test void throwsCommitHashException() { Assertions.assertThrows( - ChText.NotFound.class, + IllegalArgumentException.class, () -> new ChRemote("nonsense").value(), - BinarizeParseTest.TO_ADD_MESSAGE + "Throws when tag is not found" ); } diff --git a/eo-runtime/src/main/java/org/eolang/AtAbsent.java b/eo-runtime/src/main/java/org/eolang/AtAbsent.java index cb1d93fdd6..5b34733ed9 100644 --- a/eo-runtime/src/main/java/org/eolang/AtAbsent.java +++ b/eo-runtime/src/main/java/org/eolang/AtAbsent.java @@ -27,9 +27,9 @@ /** * Absent attribute. * - * This class exists only because we want to have nice and informative + *

This class exists only because we want to have nice and informative * error messages for the attributes that are absent, but are being - * written or read. + * written or read.

* * @since 0.1 */ diff --git a/eo-runtime/src/main/java/org/eolang/AtComposite.java b/eo-runtime/src/main/java/org/eolang/AtComposite.java index 79b3d03d0a..2baf004c27 100644 --- a/eo-runtime/src/main/java/org/eolang/AtComposite.java +++ b/eo-runtime/src/main/java/org/eolang/AtComposite.java @@ -28,7 +28,8 @@ /** * Attribute that constructs object lazily. - * The attribute depends on context (argument of lambda expression). + * + *

The attribute depends on context (argument of lambda expression).

* * @since 0.1 */ diff --git a/eo-runtime/src/main/java/org/eolang/AtEnvelope.java b/eo-runtime/src/main/java/org/eolang/AtEnvelope.java index 97a617e102..a150d519de 100644 --- a/eo-runtime/src/main/java/org/eolang/AtEnvelope.java +++ b/eo-runtime/src/main/java/org/eolang/AtEnvelope.java @@ -26,6 +26,7 @@ /** * Wrapper for {@link Attr}. + * * @since 0.36.0 * @checkstyle DesignForExtensionCheck (100 lines) */ diff --git a/eo-runtime/src/main/java/org/eolang/AtFormed.java b/eo-runtime/src/main/java/org/eolang/AtFormed.java index 533d74bffc..1e1fe540f3 100644 --- a/eo-runtime/src/main/java/org/eolang/AtFormed.java +++ b/eo-runtime/src/main/java/org/eolang/AtFormed.java @@ -29,9 +29,11 @@ /** * Attribute that constructs object lazily. - * The main difference between this attribute and {@link AtComposite} is + * + *

The main difference between this attribute and {@link AtComposite} is * it does not depend on context. It means that every new copy of the attribute - * is linked to the origin one (which was initialized first). + * is linked to the origin one (which was initialized first).

+ * * @since 0.36.0 */ public final class AtFormed implements Attr { diff --git a/eo-runtime/src/main/java/org/eolang/AtGetOnly.java b/eo-runtime/src/main/java/org/eolang/AtGetOnly.java index 6aba27d29f..a8dff47da0 100644 --- a/eo-runtime/src/main/java/org/eolang/AtGetOnly.java +++ b/eo-runtime/src/main/java/org/eolang/AtGetOnly.java @@ -28,6 +28,7 @@ /** * Attribute that only gets objects. + * * @since 0.36.0 */ final class AtGetOnly implements Attr { diff --git a/eo-runtime/src/main/java/org/eolang/AtOnce.java b/eo-runtime/src/main/java/org/eolang/AtOnce.java index 568549bed6..b35a6f730e 100644 --- a/eo-runtime/src/main/java/org/eolang/AtOnce.java +++ b/eo-runtime/src/main/java/org/eolang/AtOnce.java @@ -28,7 +28,8 @@ /** * Attribute that retrieves object only once. - * It's highly recommended to use it with {@link AtComposite}. + * + *

It's highly recommended to use it with {@link AtComposite}.

* * @since 0.1 */ diff --git a/eo-runtime/src/main/java/org/eolang/AtRho.java b/eo-runtime/src/main/java/org/eolang/AtRho.java index 9b60f972ad..0a14f01628 100644 --- a/eo-runtime/src/main/java/org/eolang/AtRho.java +++ b/eo-runtime/src/main/java/org/eolang/AtRho.java @@ -28,7 +28,9 @@ /** * Special attribute for \rho. - * The attribute can be set only once, and it ignores all other puts. + * + *

The attribute can be set only once, and it ignores all other puts.

+ * * @since 0.36.0 */ final class AtRho implements Attr { diff --git a/eo-runtime/src/main/java/org/eolang/AtSafe.java b/eo-runtime/src/main/java/org/eolang/AtSafe.java index f21263a71f..b261a609d1 100644 --- a/eo-runtime/src/main/java/org/eolang/AtSafe.java +++ b/eo-runtime/src/main/java/org/eolang/AtSafe.java @@ -29,10 +29,11 @@ /** * The attribute that catches {@link ExFailure} and * throws {@link EOerror.ExError}. - * Every time attribute is taken from an object (when method {@link PhDefault#attr(String)} + * + *

Every time attribute is taken from an object (when method {@link PhDefault#take(String)} * is called) - this attribute is being wrapped by this {@link AtSafe}. * It allows to catch {@link ExFailure} inside encapsulated attributes and transform them into - * {@link EOerror.ExError} which is cached by {@link EOorg.EOeolang.EOtry} lately. + * {@link EOerror.ExError} which is cached by {@link EOorg.EOeolang.EOtry} lately.

* * @since 0.26 */ diff --git a/eo-runtime/src/main/java/org/eolang/AtSetRho.java b/eo-runtime/src/main/java/org/eolang/AtSetRho.java index 96c2223081..61a4d5c75b 100644 --- a/eo-runtime/src/main/java/org/eolang/AtSetRho.java +++ b/eo-runtime/src/main/java/org/eolang/AtSetRho.java @@ -26,7 +26,8 @@ /** * The attribute tries to copy object and set \rho to it. - * If the name of the attribute is {@link Attr#RHO} - just object is returned. + * + *

If the name of the attribute is {@link Attr#RHO} - just object is returned.

* * @since 0.36.0 */ diff --git a/eo-runtime/src/main/java/org/eolang/AtSimple.java b/eo-runtime/src/main/java/org/eolang/AtSimple.java index fe0256b0fc..eb8285a898 100644 --- a/eo-runtime/src/main/java/org/eolang/AtSimple.java +++ b/eo-runtime/src/main/java/org/eolang/AtSimple.java @@ -27,7 +27,7 @@ /** * Default attribute that just keeps single object. * - * The class is NOT thread-safe. + *

The class is NOT thread-safe.

* * @since 0.1 */ diff --git a/eo-runtime/src/main/java/org/eolang/AtVoid.java b/eo-runtime/src/main/java/org/eolang/AtVoid.java index 6dcd650d89..5442c968c7 100644 --- a/eo-runtime/src/main/java/org/eolang/AtVoid.java +++ b/eo-runtime/src/main/java/org/eolang/AtVoid.java @@ -29,8 +29,8 @@ /** * Void attribute. * - * The attribute is not yet set, but can be set. It's writable, but - * only once. + *

The attribute is not yet set, but can be set. It's writable, but + * only once.

* * @since 0.1 */ diff --git a/eo-runtime/src/main/java/org/eolang/Atom.java b/eo-runtime/src/main/java/org/eolang/Atom.java index 9d02176449..66cacac33e 100644 --- a/eo-runtime/src/main/java/org/eolang/Atom.java +++ b/eo-runtime/src/main/java/org/eolang/Atom.java @@ -25,9 +25,11 @@ /** * Atom. - * A native object implemented in the language EO is compiled into. + * + *

A native object implemented in the language EO is compiled into. * For EO end user atoms look like magic box. That's why all atoms have - * λ function, that calculates the final object. + * λ function, that calculates the final object.

+ * * @since 0.36.0 */ public interface Atom { diff --git a/eo-runtime/src/main/java/org/eolang/AtomSafe.java b/eo-runtime/src/main/java/org/eolang/AtomSafe.java index 83defa69d7..7fcad95c88 100644 --- a/eo-runtime/src/main/java/org/eolang/AtomSafe.java +++ b/eo-runtime/src/main/java/org/eolang/AtomSafe.java @@ -27,6 +27,7 @@ /** * Atom that catches exceptions. + * * @since 0.36.0 */ public final class AtomSafe implements Atom { diff --git a/eo-runtime/src/main/java/org/eolang/Bytes.java b/eo-runtime/src/main/java/org/eolang/Bytes.java index 1d357bc19c..24a36c8985 100644 --- a/eo-runtime/src/main/java/org/eolang/Bytes.java +++ b/eo-runtime/src/main/java/org/eolang/Bytes.java @@ -26,9 +26,9 @@ /** * Bytes. * - * Represents byte array of arbitrary size, + *

Represents byte array of arbitrary size, * convertible to a numeric value. - * Original size is preserved by and, or and xor. + * Original size is preserved by and, or and xor.

* * @since 1.0 */ diff --git a/eo-runtime/src/main/java/org/eolang/ExAbstract.java b/eo-runtime/src/main/java/org/eolang/ExAbstract.java index f92e0d971c..486cf1881f 100644 --- a/eo-runtime/src/main/java/org/eolang/ExAbstract.java +++ b/eo-runtime/src/main/java/org/eolang/ExAbstract.java @@ -27,9 +27,9 @@ /** * Abstract exception. * - * The exception raised when something is not right inside - * attributes. - + *

The exception raised when something is not right inside + * attributes.

+ * * @since 0.21 */ @Versionized diff --git a/eo-runtime/src/main/java/org/eolang/JavaPath.java b/eo-runtime/src/main/java/org/eolang/JavaPath.java index 5dc4e33c47..5a63ed4c13 100644 --- a/eo-runtime/src/main/java/org/eolang/JavaPath.java +++ b/eo-runtime/src/main/java/org/eolang/JavaPath.java @@ -25,12 +25,14 @@ /** * Java path. - * The class converts object path in eolang notation to java notation. + * + *

The class converts object path in eolang notation to java notation. * For example * - "org.eolang" -> "EOorg.EOeolang" * - "org.eolang.as-bytes" -> "EOorg.EOeolang.EOas_bytes" * - "org.eolang.as-bytes$bytes" -> "EOorg.EOeolang.EOas_bytes$EObytes" - * Since eolang allows using dashes in object names, they are converted to underscores for Java. + * Since EOLANG allows using dashes in object names, they are converted to + * underscores for Java.

* * @since 0.29 */ diff --git a/eo-runtime/src/main/java/org/eolang/Main.java b/eo-runtime/src/main/java/org/eolang/Main.java index e4ea8532a1..3d778c51ad 100644 --- a/eo-runtime/src/main/java/org/eolang/Main.java +++ b/eo-runtime/src/main/java/org/eolang/Main.java @@ -42,9 +42,9 @@ /** * Bridge between Java CLI and EO. * - * This class has a single public static method {@code main()}, which + *

This class has a single public static method {@code main()}, which * is supposed to be called by java runtime from command line. The best - * example of this class usage is in the "sandbox/canonical" directory. + * example of this class usage is in the "sandbox/canonical" directory.

* * @since 0.1 */ diff --git a/eo-runtime/src/test/java/org/eolang/MainTest.java b/eo-runtime/src/test/java/org/eolang/MainTest.java index b6bf6c3932..5eabfe864c 100644 --- a/eo-runtime/src/test/java/org/eolang/MainTest.java +++ b/eo-runtime/src/test/java/org/eolang/MainTest.java @@ -55,7 +55,7 @@ static void checkHeapSize() { @Test void printsVersion() { MatcherAssert.assertThat( - AtCompositeTest.TO_ADD_MESSAGE, + "Prints its own version properly", MainTest.exec("--version"), Matchers.allOf( Matchers.containsString("."), @@ -67,7 +67,7 @@ void printsVersion() { @Test void printsHelp() { MatcherAssert.assertThat( - AtCompositeTest.TO_ADD_MESSAGE, + "Prints help summary properly", MainTest.exec("--help"), Matchers.containsString("Usage: ") ); @@ -102,11 +102,11 @@ void executesJvmFullRun() { @Test void executesJvmFullRunWithDashedObject() { MatcherAssert.assertThat( - AtCompositeTest.TO_ADD_MESSAGE, + "Fails with the proper error message", MainTest.exec("--verbose", "as-bytes"), Matchers.allOf( Matchers.containsString("Loading class EOas_bytes"), - Matchers.containsString("Can not find 'as-bytes' object") + Matchers.containsString("Can not find \"as-bytes\" object") ) ); } @@ -114,11 +114,11 @@ void executesJvmFullRunWithDashedObject() { @Test void executesJvmFullRinWithAttributeCall() { MatcherAssert.assertThat( - AtCompositeTest.TO_ADD_MESSAGE, + "Fails with the proper error message", MainTest.exec("--verbose", "string$as-bytes"), Matchers.allOf( Matchers.containsString("Loading class EOstring$EOas_bytes"), - Matchers.containsString("Can not find 'string$as-bytes' object") + Matchers.containsString("Can not find \"string$as-bytes\" object") ) ); } @@ -126,7 +126,7 @@ void executesJvmFullRinWithAttributeCall() { @Test void executesJvmFullRunWithError() { MatcherAssert.assertThat( - AtCompositeTest.TO_ADD_MESSAGE, + "Fails with the proper error message", MainTest.exec("--verbose", "org.eolang.io.stdout"), Matchers.containsString("Error at \"EOorg.EOeolang.EOio.EOstdout#text\" attribute") ); @@ -135,9 +135,9 @@ void executesJvmFullRunWithError() { @Test void executesWithObjectNotFoundException() { MatcherAssert.assertThat( - AtCompositeTest.TO_ADD_MESSAGE, + "Fails with the proper error message", MainTest.exec("unavailable-name"), - Matchers.containsString("Can not find 'unavailable-name' object") + Matchers.containsString("Can not find \"unavailable-name\" object") ); } @@ -152,7 +152,7 @@ void readsStreamCorrectly() throws IOException { ) ) ), - StandardCharsets.UTF_8.name() + StandardCharsets.UTF_8 ) ); MatcherAssert.assertThat( @@ -173,7 +173,7 @@ void readsSimpleStreamCorrectly() throws IOException { ) ) ), - StandardCharsets.UTF_8.name() + StandardCharsets.UTF_8 ) ); MatcherAssert.assertThat(