From 1f9da278abc259623f23c1c6a170996a27977ce6 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Fri, 2 Aug 2024 20:15:21 +0300 Subject: Small improvements --- src/main/java/lv/enes/orang/NonEmptyList.java | 7 ++++++- src/main/java/lv/enes/orang/ast/Statement.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/lv/enes/orang/NonEmptyList.java b/src/main/java/lv/enes/orang/NonEmptyList.java index b532a18..860db28 100644 --- a/src/main/java/lv/enes/orang/NonEmptyList.java +++ b/src/main/java/lv/enes/orang/NonEmptyList.java @@ -1,13 +1,18 @@ package lv.enes.orang; +import lombok.EqualsAndHashCode; + import java.util.AbstractList; import java.util.List; +@EqualsAndHashCode(callSuper = true) public class NonEmptyList extends AbstractList { private final List delegate; public NonEmptyList(List delegate) { - assert !delegate.isEmpty(); + if (delegate.isEmpty()) { + throw new IllegalArgumentException("Empty list"); + } this.delegate = List.copyOf(delegate); } diff --git a/src/main/java/lv/enes/orang/ast/Statement.java b/src/main/java/lv/enes/orang/ast/Statement.java index 62b76bd..0f52fc3 100644 --- a/src/main/java/lv/enes/orang/ast/Statement.java +++ b/src/main/java/lv/enes/orang/ast/Statement.java @@ -4,5 +4,5 @@ import lv.enes.orang.OrangRuntimeException; import lv.enes.orang.Scope; public interface Statement { - Scope runStatement(Scope scope) throws OrangRuntimeException, OrangRuntimeException; + Scope runStatement(Scope scope) throws OrangRuntimeException; } -- cgit v1.2.3