In this Wolves, Goats and Cabbages in Java question (here is a link to the pre-edited version), Java code is presented to solve the problem.
The code requires pre-processing by a third-party tool in order to function.
The third-party tool adds a number of 'template' or 'boilerplate' methods that make the code complete. In Java terms, these are things like getters
, setters
, toString()
, equals()
, and hashCode()
.
Without pre-processing the code, it is:
- full of errors, and will not compile.
- comprehensively broken in 'standard' IDE's like Eclipse, IntelliJ, Netbeans, etc.
In order to pre-process the code, you need to download the pre-processor, as well as plugins for the various IDEs so that they are modified to accommodate these pre-processor annotations.
These downloads are from a non-official site, and are not part of any standard tool-chain.
For example, from the question we have the interface Action
, and the class ActionImpl
:
import java.util.Collection; public interface Action<T> { Action<T> previous(); T data(); Collection<Action<T>> children(); void children(Collection<Action<T>> children); }
and
@Accessors(fluent = true, chain = false) @Data() @EqualsAndHashCode(of = "data") @ToString(of = {"data"}) public class ActionImpl<T> implements Action<T> { private final Action<T> previous; private final T data; private Collection<Action<T>> children; }
In Java terms, the ActionImpl
class is missing four methods:
previous()
data()
children()
children(Collection<Action<T>>)
Additionally, there are compile/IDE errors for all the @Annotations which do not exist.
This makes the class fail to compile, and, essentially, there is nothing to review ;-)
Question:
Is it working code, or is it off-topic?