reflections icon indicating copy to clipboard operation
reflections copied to clipboard

Binary uncompatible changes in FilterBuilder class

Open rulle-io opened this issue 2 years ago • 0 comments

We have a code piece like (new FilterBuilder().includePackage("XXX")).

It suddenly started to fail at runtime (after upgrade org.reflections:reflections:jar:0.9.12 => 0.10.2)

Caused by: java.lang.NoSuchMethodError:
'org.reflections.util.FilterBuilder org.reflections.util.FilterBuilder.includePackage(java.lang.String[])'

It turned out that public interface in FilterBuilder was changed here:

-public FilterBuilder includePackage(final String... prefixes)
+public FilterBuilder includePackage(String value)

-- Old one https://github.com/ronmamo/reflections/blob/7741e8f5d13f739d644ef5e91dde055fbe88ca57/src/main/java/org/reflections/util/FilterBuilder.java#L42

-- New one https://github.com/ronmamo/reflections/blob/1f05c178131b252b787e0c89f43feab3b370295b/src/main/java/org/reflections/util/FilterBuilder.java#L36

This change is problematic in so many different ways: :)

  1. You usually never just delete a public method in a public library without a proper deprecation cycle.
  2. Changing parameter from java.lang.String[] to String will make compilation work for some use-cases, and not for others.
  3. It breaks the binary compatibility.

rulle-io avatar Apr 04 '22 11:04 rulle-io