Skip to content

README Atomic lock example does not compile: missing Callable arg and wrong override signature #113

@bibonix

Description

@bibonix

The README example for using a Lock at README.md lines 42 to 54 does not compile against the current API.

It calls new Atomic(lock), but Atomic declares no constructor that takes only a Lock; the three public constructors at src/main/java/co/stateful/Atomic.java lines 89, 99, and 112 all require a Callable<T> as the first argument. The same example then invokes .call(...) with a Callable argument, but Atomic#call() is the no-arg method declared on java.util.concurrent.Callable; it takes nothing and returns T. The inner Callable<Void> further declares its call() method as public void call() instead of public Void call(), so the override signature is wrong too.

The Javadoc at the top of Atomic already shows the correct shape on lines 24 to 33: build the Callable first, then pass it together with the Lock into new Atomic<>(origin, lock) and invoke .call() with no arguments. Replace the README block with the same shape so the snippet matches the real API: declare a Callable<Void> work = new Callable<Void>() { @Override public Void call() { return null; } }; and then run new Atomic<>(work, lock).call();.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions