Skip to content

Bugfix Release 0.9.3

Compare
Choose a tag to compare
@danieldietrich danieldietrich released this 07 Jan 01:28
· 382 commits to master since this release

Info

The release increases stability and performance.

Please find the complete list of changes here.

The API Docs can be found here

Comitters

🎉 MANY THANKS TO ALL COMMITTERS THAT MADE THIS RELEASE POSSIBLE 🎉

Bug fixes

🚨 LinkedHashMap duplicate entries

In Vavr 0.9.2, all LinkedHashMap factory methods internally did not store keys and values correctly.

Example:

var map = LinkedHashMap(1, "1", 1, "2", 2, "3", 2, "4");

// = 2 (CORRECT)
map.size();

// = LinkedHashSet(1, 1, 2, 2) (WRONG)
// = LinkedHashSet(1, 2) (FIXED)
map.keySet() = LinkedHashSet(1, 1, 2, 2)

// = List("1", "2", "3", "4") (WRONG)
// = List("2", "4") (FIXED)
map.values() = List(1, 2, 3, 4)

Details can be found here.

🚨 TreeSet fell back to natural comparator after removing all elements

// = TreeSet(2, 1)
var set1 = TreeSet.ofAll(Comparator.reverseOrder(), List(1, 1, 2, 2));

// = TreeSet() has now natural comparator (WRONG)
// = TreeSet() keeps reverse order (FIXED)
var set2 = set1.removeAll();

// = TreeSet(1, 2) (WRONG)
// = TreeSet(2, 1) (FIXED)
set2.addAll(List(1, 1, 2, 2));

Details can be found here.

🚨 Stream flatMap memory consumption

Stream.flatMap used an inner class for iteration, with the effect of the result stream holding an unnecessary indirect reference to the head of the source stream, resulting in a "temporary" memory leak.

However, when the reference to the original Stream was garbage-collected, the memory was completely freed.

Details can be found here.

Performance improvements

🏁 Hash code calculation

Internally, we relied on

Objects.hash(T... varargs)

for hashCode calculation. A call

Objects.hash(1, 2, 3)

results in an array creation. In order to prevent that unnecessary instance creation, we added internal methods that preserve our hash semantics.

🏁 Micro-optimizations of collections

We did some micro-optimizations to

  • CharSeq.ofAll(Iterable)
  • CharSeq.prependAll(Iterable)
  • Vector.ofAll(Iterable)
  • Vector.appendAll(Iterable)
  • Vector.prependAll(Iterable)

Low-level details can be found here.

New API

🎉 Map additions

We follow the Semantic Versioning scheme. Although this release is a patch release, there are two new methods:

I hope, your OSGi infrastructure does not complain about it.

Jar files

📦 Separate annotation processor jar

We separated annotation vavr-match-processor-<version>.jar from vavr-match-<version>.jar.

If you want to create your own pattern matching patterns, you need to include these two dependencies now instead of only vavr-match.

Documentation

📚 Javadoc improvements

  • We clarified that LinkedHashMap.put(K, V) and LinkedHashMap.add(T) have a worst-case linear complexity. This is because equal elements need to be replaced while preserving their position.
  • Several small improvements and fixes

Other improvements

  • Improved interoperability with the GWT compiler
  • Improved Eclipse integration for Vavr committers