Expected Behavior
InetAddressMatchers.builder().includeAddresses(...) returns this for fluent style calls, however, calling includeAddresses again doesn't work in a useful way.
Current Behavior
InetAddressMatchers.builder().includeAddresses(...) accepts a list of include addresses and the javadoc states "Adds an include list matcher that permits only the specified addresses.". If you call InetAddressMatchers.builder().includeAddresses(List.of("192.168.1.1", "192.168.1.2")).build() you'll get a matcher that matcher "192.168.1.1" or 192.168.1.2".
If however, you call the method more than once, e.g. InetAddressMatchers.builder().includeAddresses(List.of("192.168.1.1")).includeAddresses(List.of("192.168.1.2")).build() you get a matcher that won't match anything. This is because internally there are two IncludeListInetAddressMatcher instances. One will only match 192.168.1.1 and the other will only match 192.168.1.2.
Context
This came up during the development of spring-projects/spring-boot#49687. You could argue that the API is working as designed, so perhaps this issue can just be closed.
Expected Behavior
InetAddressMatchers.builder().includeAddresses(...)returnsthisfor fluent style calls, however, callingincludeAddressesagain doesn't work in a useful way.Current Behavior
InetAddressMatchers.builder().includeAddresses(...)accepts a list of include addresses and the javadoc states "Adds an include list matcher that permits only the specified addresses.". If you callInetAddressMatchers.builder().includeAddresses(List.of("192.168.1.1", "192.168.1.2")).build()you'll get a matcher that matcher "192.168.1.1" or 192.168.1.2".If however, you call the method more than once, e.g.
InetAddressMatchers.builder().includeAddresses(List.of("192.168.1.1")).includeAddresses(List.of("192.168.1.2")).build()you get a matcher that won't match anything. This is because internally there are twoIncludeListInetAddressMatcherinstances. One will only match 192.168.1.1 and the other will only match 192.168.1.2.Context
This came up during the development of spring-projects/spring-boot#49687. You could argue that the API is working as designed, so perhaps this issue can just be closed.