Search code examples
vavr

Has vavr io.vavr.API been removed in 1.0.0-alpha-2?


I have been investigating the use of the excellent functional library vavr

  // https://mvnrepository.com/artifact/io.vavr/vavr
compile group: 'io.vavr', name: 'vavr', version: '0.9.2'
// https://mvnrepository.com/artifact/io.vavr/vavr-match
compile group: 'io.vavr', name: 'vavr-match', version: '0.9.2'

Using this type of example:-

int input = 2;
        String output = Match(input).of(Case($(1), "one"), Case($(2), "two"), Case($(3), "three"), Case($(), "?"));

        assertEquals("two", output);

using these static imports

import static io.vavr.API.$;
import static io.vavr.API.Case;
import static io.vavr.API.Match;

However when I upgrade to

// https://mvnrepository.com/artifact/io.vavr/vavr
compile group: 'io.vavr', name: 'vavr', version: '1.0.0-alpha-2'

I can no longer resolve the io.vavr.API imports.

Where have these been refactored to in the most recent version of vavr?

Have they been removed altogether?


Solution

  • TL;DR Yes, it has been removed from 1.x.x.

    Please have a look at this post, especially this part:

    We can't change the Java language by ourselves. All features that try to do so, e.g. pattern matching and for comprehensions, will be moved to a separate module vavr-api. Because different Java 9 modules can't export the same package, the package name needs to be changed.

    Please note that Java will come up with native pattern matching. Therefore the use of vavr-api is discouraged but it will still be maintained.

    All main modules mentioned above (excluding vavr-api and the co-module vavr-match) will be available as one big bundle, called vavr-all-in-one.

    I'm not up-to-date with the status of current work, however it will be no longer available in the core module.